diff --git a/CHANGELOG.md b/CHANGELOG.md index caf7d2e..eaa8352 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.2.1 +- Updated local xterm.js packages to version 5.1.0 and loading from local file +- Modified CSS to hide terminal scrollbar in chrome based browsers +- Added dynamic resize of terminal when sidebar is toggled + # 0.2.0 - Added cluster groups - Added evacuate and restore options for cluster members diff --git a/lxconsole/static/css/styles.css b/lxconsole/static/css/styles.css index 48e4f4f..cf753a4 100644 --- a/lxconsole/static/css/styles.css +++ b/lxconsole/static/css/styles.css @@ -57,3 +57,8 @@ code { color: #ff0000 !important; word-break: break-word; } + + +.terminal .xterm-viewport { + overflow-y: hidden; +} diff --git a/lxconsole/static/js/xterm/xterm.js b/lxconsole/static/js/xterm/xterm.js index 62af4a5..88d7c19 100644 --- a/lxconsole/static/js/xterm/xterm.js +++ b/lxconsole/static/js/xterm/xterm.js @@ -1,2 +1,2 @@ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(self,(function(){return(()=>{"use strict";var e={4567:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;var o=r(9042),s=r(6114),a=r(6193),c=r(3656),l=r(844),h=r(5596),u=r(9631),f=function(e){function t(t,r){var i=e.call(this)||this;i._terminal=t,i._renderService=r,i._liveRegionLineCount=0,i._charsToConsume=[],i._charsToAnnounce="",i._accessibilityTreeRoot=document.createElement("div"),i._accessibilityTreeRoot.classList.add("xterm-accessibility"),i._rowContainer=document.createElement("div"),i._rowContainer.setAttribute("role","list"),i._rowContainer.classList.add("xterm-accessibility-tree"),i._rowElements=[];for(var n=0;ne;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e},t.prototype._onTab=function(e){for(var t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=o.tooMuchOutput)),s.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((function(){t._accessibilityTreeRoot.appendChild(t._liveRegion)}),0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,s.isMac&&u.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(e){this._clearLiveRegion(),this._charsToConsume.push(e)},t.prototype._refreshRows=function(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)},t.prototype._renderRows=function(e,t){for(var r=this._terminal.buffer,i=r.lines.length.toString(),n=e;n<=t;n++){var o=r.translateBufferLineToString(r.ydisp+n,!0),s=(r.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===o.length?a.innerText=" ":a.textContent=o,a.setAttribute("aria-posinset",s),a.setAttribute("aria-setsize",i))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var e=0;e{function r(e){return e.replace(/\r?\n/g,"\r")}function i(e,t){return t?"[200~"+e+"[201~":e}function n(e,t,n){e=i(e=r(e),n.decPrivateModes.bracketedPasteMode),n.triggerDataEvent(e,!0),t.value=""}function o(e,t,r){var i=r.getBoundingClientRect(),n=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=n+"px",t.style.top=o+"px",t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=r,t.bracketTextForPaste=i,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,r){e.stopPropagation(),e.clipboardData&&n(e.clipboardData.getData("text/plain"),t,r)},t.paste=n,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,r,i,n){o(e,t,r),n&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}},4774:(e,t)=>{var r,i,n,o;function s(e){var t=e.toString(16);return t.length<2?"0"+t:t}function a(e,t){return e>>0}}(r=t.channels||(t.channels={})),(i=t.color||(t.color={})).blend=function(e,t){var i=(255&t.rgba)/255;if(1===i)return{css:t.css,rgba:t.rgba};var n=t.rgba>>24&255,o=t.rgba>>16&255,s=t.rgba>>8&255,a=e.rgba>>24&255,c=e.rgba>>16&255,l=e.rgba>>8&255,h=a+Math.round((n-a)*i),u=c+Math.round((o-c)*i),f=l+Math.round((s-l)*i);return{css:r.toCss(h,u,f),rgba:r.toRgba(h,u,f)}},i.isOpaque=function(e){return 255==(255&e.rgba)},i.ensureContrastRatio=function(e,t,r){var i=o.ensureContrastRatio(e.rgba,t.rgba,r);if(i)return o.toColor(i>>24&255,i>>16&255,i>>8&255)},i.opaque=function(e){var t=(255|e.rgba)>>>0,i=o.toChannels(t),n=i[0],s=i[1],a=i[2];return{css:r.toCss(n,s,a),rgba:t}},i.opacity=function(e,t){var i=Math.round(255*t),n=o.toChannels(e.rgba),s=n[0],a=n[1],c=n[2];return{css:r.toCss(s,a,c,i),rgba:r.toRgba(s,a,c,i)}},(t.css||(t.css={})).toColor=function(e){switch(e.length){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}}throw new Error("css.toColor: Unsupported css format")},function(e){function t(e,t,r){var i=e/255,n=t/255,o=r/255;return.2126*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.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}(n=t.rgb||(t.rgb={})),function(e){function t(e,t,r){for(var i=e>>24&255,o=e>>16&255,s=e>>8&255,c=t>>24&255,l=t>>16&255,h=t>>8&255,u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));u0||l>0||h>0);)c-=Math.max(0,Math.ceil(.1*c)),l-=Math.max(0,Math.ceil(.1*l)),h-=Math.max(0,Math.ceil(.1*h)),u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));return(c<<24|l<<16|h<<8|255)>>>0}function i(e,t,r){for(var i=e>>24&255,o=e>>16&255,s=e>>8&255,c=t>>24&255,l=t>>16&255,h=t>>8&255,u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));u>>0}e.ensureContrastRatio=function(e,r,o){var s=n.relativeLuminance(e>>8),c=n.relativeLuminance(r>>8);if(a(s,c)>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i){return{css:r.toCss(e,t,i),rgba:r.toRgba(e,t,i)}}}(o=t.rgba||(t.rgba={})),t.toPaddedHex=s,t.contrastRatio=a},7239:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;var r=function(){function e(){this._color={},this._rgba={}}return e.prototype.clear=function(){this._color={},this._rgba={}},e.prototype.setCss=function(e,t,r){this._rgba[e]||(this._rgba[e]={}),this._rgba[e][t]=r},e.prototype.getCss=function(e,t){return this._rgba[e]?this._rgba[e][t]:void 0},e.prototype.setColor=function(e,t,r){this._color[e]||(this._color[e]={}),this._color[e][t]=r},e.prototype.getColor=function(e,t){return this._color[e]?this._color[e][t]:void 0},e}();t.ColorContrastCache=r},5680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorManager=t.DEFAULT_ANSI_COLORS=void 0;var i=r(4774),n=r(7239),o=i.css.toColor("#ffffff"),s=i.css.toColor("#000000"),a=i.css.toColor("#ffffff"),c=i.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze(function(){for(var e=[i.css.toColor("#2e3436"),i.css.toColor("#cc0000"),i.css.toColor("#4e9a06"),i.css.toColor("#c4a000"),i.css.toColor("#3465a4"),i.css.toColor("#75507b"),i.css.toColor("#06989a"),i.css.toColor("#d3d7cf"),i.css.toColor("#555753"),i.css.toColor("#ef2929"),i.css.toColor("#8ae234"),i.css.toColor("#fce94f"),i.css.toColor("#729fcf"),i.css.toColor("#ad7fa8"),i.css.toColor("#34e2e2"),i.css.toColor("#eeeeec")],t=[0,95,135,175,215,255],r=0;r<216;r++){var n=t[r/36%6|0],o=t[r/6%6|0],s=t[r%6];e.push({css:i.channels.toCss(n,o,s),rgba:i.channels.toRgba(n,o,s)})}for(r=0;r<24;r++){var a=8+10*r;e.push({css:i.channels.toCss(a,a,a),rgba:i.channels.toRgba(a,a,a)})}return e}());var h=function(){function e(e,r){this.allowTransparency=r;var h=e.createElement("canvas");h.width=1,h.height=1;var u=h.getContext("2d");if(!u)throw new Error("Could not get rendering context");this._ctx=u,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new n.ColorContrastCache,this.colors={foreground:o,background:s,cursor:a,cursorAccent:c,selectionTransparent:l,selectionOpaque:i.color.blend(s,l),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return e.prototype.onOptionsChange=function(e){"minimumContrastRatio"===e&&this._contrastCache.clear()},e.prototype.setTheme=function(e){void 0===e&&(e={}),this.colors.foreground=this._parseColor(e.foreground,o),this.colors.background=this._parseColor(e.background,s),this.colors.cursor=this._parseColor(e.cursor,a,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,c,!0),this.colors.selectionTransparent=this._parseColor(e.selection,l,!0),this.colors.selectionOpaque=i.color.blend(this.colors.background,this.colors.selectionTransparent),i.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=i.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(e.black,t.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(e.red,t.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(e.green,t.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(e.yellow,t.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(e.blue,t.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(e.magenta,t.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(e.cyan,t.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(e.white,t.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},e.prototype._parseColor=function(e,t,r){if(void 0===r&&(r=this.allowTransparency),void 0===e)return t;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=e,"string"!=typeof this._ctx.fillStyle)return console.warn("Color: "+e+" is invalid using fallback "+t.css),t;this._ctx.fillRect(0,0,1,1);var n=this._ctx.getImageData(0,0,1,1).data;if(255!==n[3]){if(!r)return console.warn("Color: "+e+" is using transparency, but allowTransparency is false. Using fallback "+t.css+"."),t;var o=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map((function(e){return Number(e)})),s=o[0],a=o[1],c=o[2],l=o[3],h=Math.round(255*l);return{rgba:i.channels.toRgba(s,a,c,h),css:e}}return{css:this._ctx.fillStyle,rgba:i.channels.toRgba(n[0],n[1],n[2],n[3])}},e}();t.ColorManager=h},9631:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,r,i){e.addEventListener(t,r,i);var n=!1;return{dispose:function(){n||(n=!0,e.removeEventListener(t,r,i))}}}},3551:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZone=t.Linkifier=void 0;var o=r(8460),s=r(2585),a=function(){function e(e,t,r){this._bufferService=e,this._logService=t,this._unicodeService=r,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new o.EventEmitter,this._onHideLinkUnderline=new o.EventEmitter,this._onLinkTooltip=new o.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(e.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),e.prototype.attachToDom=function(e,t){this._element=e,this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,r){var i=this;this._mouseZoneManager&&(void 0===this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=r):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,r)),this._mouseZoneManager.clearAll(t,r),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout((function(){return i._linkifyRows()}),e._timeBeforeLatency))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var e=this._bufferService.buffer;if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var t=e.ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var r=e.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,i=Math.ceil(2e3/this._bufferService.cols),n=this._bufferService.buffer.iterator(!1,t,r,i,i);n.hasNext();)for(var o=n.next(),s=0;s=0;t--)if(e.priority<=this._linkMatchers[t].priority)return void this._linkMatchers.splice(t+1,0,e);this._linkMatchers.splice(0,0,e)}else this._linkMatchers.push(e)},e.prototype.deregisterLinkMatcher=function(e){for(var t=0;t>9&511:void 0;r.validationCallback?r.validationCallback(a,(function(e){n._rowsTimeoutId||e&&n._addLink(l[1],l[0]-n._bufferService.buffer.ydisp,a,r,f)})):c._addLink(l[1],l[0]-c._bufferService.buffer.ydisp,a,r,f)},c=this;null!==(i=o.exec(t))&&"break"!==a(););},e.prototype._addLink=function(e,t,r,i,n){var o=this;if(this._mouseZoneManager&&this._element){var s=this._unicodeService.getStringCellWidth(r),a=e%this._bufferService.cols,l=t+Math.floor(e/this._bufferService.cols),h=(a+s)%this._bufferService.cols,u=l+Math.floor((a+s)/this._bufferService.cols);0===h&&(h=this._bufferService.cols,u--),this._mouseZoneManager.add(new c(a+1,l+1,h+1,u+1,(function(e){if(i.handler)return i.handler(e,r);var t=window.open();t?(t.opener=null,t.location.href=r):console.warn("Opening link blocked as opener could not be cleared")}),(function(){o._onShowLinkUnderline.fire(o._createLinkHoverEvent(a,l,h,u,n)),o._element.classList.add("xterm-cursor-pointer")}),(function(e){o._onLinkTooltip.fire(o._createLinkHoverEvent(a,l,h,u,n)),i.hoverTooltipCallback&&i.hoverTooltipCallback(e,r,{start:{x:a,y:l},end:{x:h,y:u}})}),(function(){o._onHideLinkUnderline.fire(o._createLinkHoverEvent(a,l,h,u,n)),o._element.classList.remove("xterm-cursor-pointer"),i.hoverLeaveCallback&&i.hoverLeaveCallback()}),(function(e){return!i.willLinkActivate||i.willLinkActivate(e,r)})))}},e.prototype._createLinkHoverEvent=function(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}},e._timeBeforeLatency=200,e=i([n(0,s.IBufferService),n(1,s.ILogService),n(2,s.IUnicodeService)],e)}();t.Linkifier=a;var c=function(e,t,r,i,n,o,s,a,c){this.x1=e,this.y1=t,this.x2=r,this.y2=i,this.clickCallback=n,this.hoverCallback=o,this.tooltipCallback=s,this.leaveCallback=a,this.willLinkActivate=c};t.MouseZone=c},6465:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;var a=r(2585),c=r(8460),l=r(844),h=r(3656),u=function(e){function t(t){var r=e.call(this)||this;return r._bufferService=t,r._linkProviders=[],r._linkCacheDisposables=[],r._isMouseOut=!0,r._activeLine=-1,r._onShowLinkUnderline=r.register(new c.EventEmitter),r._onHideLinkUnderline=r.register(new c.EventEmitter),r.register(l.getDisposeArrayDisposable(r._linkCacheDisposables)),r}return n(t,e),Object.defineProperty(t.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),t.prototype.registerLinkProvider=function(e){var t=this;return this._linkProviders.push(e),{dispose:function(){var r=t._linkProviders.indexOf(e);-1!==r&&t._linkProviders.splice(r,1)}}},t.prototype.attachToDom=function(e,t,r){var i=this;this._element=e,this._mouseService=t,this._renderService=r,this.register(h.addDisposableDomListener(this._element,"mouseleave",(function(){i._isMouseOut=!0,i._clearCurrentLink()}))),this.register(h.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(h.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},t.prototype._onMouseMove=function(e){if(this._lastMouseEvent=e,this._element&&this._mouseService){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(t){this._isMouseOut=!1;for(var r=e.composedPath(),i=0;ie?this._bufferService.cols:s.link.range.end.x,l=a;l<=c;l++){if(r.has(l)){n.splice(o--,1);break}r.add(l)}}},t.prototype._checkLinkProviderResult=function(e,t,r){var i,n=this;if(!this._activeProviderReplies)return r;for(var o=this._activeProviderReplies.get(e),s=!1,a=0;a=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,l.disposeArray(this._linkCacheDisposables))},t.prototype._handleNewLink=function(e){var t=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(e.link,r)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:function(){var e,r;return null===(r=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===r?void 0:r.decorations.pointerCursor},set:function(e){var r,i;(null===(r=t._currentLink)||void 0===r?void 0:r.state)&&t._currentLink.state.decorations.pointerCursor!==e&&(t._currentLink.state.decorations.pointerCursor=e,t._currentLink.state.isHovered&&(null===(i=t._element)||void 0===i||i.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:function(){var e,r;return null===(r=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===r?void 0:r.decorations.underline},set:function(r){var i,n,o;(null===(i=t._currentLink)||void 0===i?void 0:i.state)&&(null===(o=null===(n=t._currentLink)||void 0===n?void 0:n.state)||void 0===o?void 0:o.decorations.underline)!==r&&(t._currentLink.state.decorations.underline=r,t._currentLink.state.isHovered&&t._fireUnderlineEvent(e.link,r))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange((function(e){var r=0===e.start?0:e.start+1+t._bufferService.buffer.ydisp;t._clearCurrentLink(r,e.end+1+t._bufferService.buffer.ydisp)}))))}},t.prototype._linkHover=function(e,t,r){var i;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)},t.prototype._fireUnderlineEvent=function(e,t){var r=e.range,i=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)},t.prototype._linkLeave=function(e,t,r){var i;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)},t.prototype._linkAtPosition=function(e,t){var r=e.range.start.y===e.range.end.y,i=e.range.start.yt.y;return(r&&e.range.start.x<=t.x&&e.range.end.x>=t.x||i&&e.range.end.x>=t.x||n&&e.range.start.x<=t.x||i&&n)&&e.range.start.y<=t.y&&e.range.end.y>=t.y},t.prototype._positionFromMouseEvent=function(e,t,r){var i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}},t.prototype._createLinkUnderlineEvent=function(e,t,r,i,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}},o([s(0,a.IBufferService)],t)}(l.Disposable);t.Linkifier2=u},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},6954:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZoneManager=void 0;var a=r(844),c=r(3656),l=r(4725),h=r(2585),u=function(e){function t(t,r,i,n,o,s){var a=e.call(this)||this;return a._element=t,a._screenElement=r,a._bufferService=i,a._mouseService=n,a._selectionService=o,a._optionsService=s,a._zones=[],a._areZonesActive=!1,a._lastHoverCoords=[void 0,void 0],a._initialSelectionLength=0,a.register(c.addDisposableDomListener(a._element,"mousedown",(function(e){return a._onMouseDown(e)}))),a._mouseMoveListener=function(e){return a._onMouseMove(e)},a._mouseLeaveListener=function(e){return a._onMouseLeave(e)},a._clickListener=function(e){return a._onClick(e)},a}return n(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._deactivate()},t.prototype.add=function(e){this._zones.push(e),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(e,t){if(0!==this._zones.length){e&&t||(e=0,t=this._bufferService.rows-1);for(var r=0;re&&i.y1<=t+1||i.y2>e&&i.y2<=t+1||i.y1t+1)&&(this._currentZone&&this._currentZone===i&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(r--,1))}0===this._zones.length&&this._deactivate()}},t.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},t.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},t.prototype._onMouseMove=function(e){this._lastHoverCoords[0]===e.pageX&&this._lastHoverCoords[1]===e.pageY||(this._onHover(e),this._lastHoverCoords=[e.pageX,e.pageY])},t.prototype._onHover=function(e){var t=this,r=this._findZoneEventAt(e);r!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),r&&(this._currentZone=r,r.hoverCallback&&r.hoverCallback(e),this._tooltipTimeout=window.setTimeout((function(){return t._onTooltip(e)}),this._optionsService.options.linkTooltipHoverDuration)))},t.prototype._onTooltip=function(e){this._tooltipTimeout=void 0;var t=this._findZoneEventAt(e);t&&t.tooltipCallback&&t.tooltipCallback(e)},t.prototype._onMouseDown=function(e){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var t=this._findZoneEventAt(e);(null==t?void 0:t.willLinkActivate(e))&&(e.preventDefault(),e.stopImmediatePropagation())}},t.prototype._onMouseLeave=function(e){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},t.prototype._onClick=function(e){var t=this._findZoneEventAt(e),r=this._getSelectionLength();t&&r===this._initialSelectionLength&&(t.clickCallback(e),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._getSelectionLength=function(){var e=this._selectionService.selectionText;return e?e.length:0},t.prototype._findZoneEventAt=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(t)for(var r=t[0],i=t[1],n=0;n=o.x1&&r=o.x1||i===o.y2&&ro.y1&&i{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0;var r=function(){function e(e){this._renderCallback=e}return e.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.refresh=function(e,t,r){var i=this;this._rowCount=r,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){return i._innerRefresh()})))},e.prototype._innerRefresh=function(){if(void 0!==this._rowStart&&void 0!==this._rowEnd&&void 0!==this._rowCount){var e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(e,t)}},e}();t.RenderDebouncer=r},5596:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._currentDevicePixelRatio=window.devicePixelRatio,t}return n(t,e),t.prototype.setListener=function(e){var t=this;this._listener&&this.clearListener(),this._listener=e,this._outerListener=function(){t._listener&&(t._listener(window.devicePixelRatio,t._currentDevicePixelRatio),t._updateDpr())},this._updateDpr()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.clearListener()},t.prototype._updateDpr=function(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},t.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},t}(r(844).Disposable);t.ScreenDprMonitor=o},3236:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var o=r(2950),s=r(1680),a=r(3614),c=r(2584),l=r(5435),h=r(3525),u=r(3551),f=r(9312),_=r(6114),d=r(3656),p=r(9042),v=r(357),g=r(6954),y=r(4567),b=r(1296),S=r(7399),m=r(8460),C=r(8437),w=r(5680),E=r(3230),L=r(4725),A=r(428),R=r(8934),k=r(6465),x=r(5114),D=r(8969),T=r(4774),O="undefined"!=typeof window?window.document:null,M=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.browser=_,r._keyDownHandled=!1,r._onCursorMove=new m.EventEmitter,r._onKey=new m.EventEmitter,r._onRender=new m.EventEmitter,r._onSelectionChange=new m.EventEmitter,r._onTitleChange=new m.EventEmitter,r._onFocus=new m.EventEmitter,r._onBlur=new m.EventEmitter,r._onA11yCharEmitter=new m.EventEmitter,r._onA11yTabEmitter=new m.EventEmitter,r._setup(),r.linkifier=r._instantiationService.createInstance(u.Linkifier),r.linkifier2=r.register(r._instantiationService.createInstance(k.Linkifier2)),r.register(r._inputHandler.onRequestBell((function(){return r.bell()}))),r.register(r._inputHandler.onRequestRefreshRows((function(e,t){return r.refresh(e,t)}))),r.register(r._inputHandler.onRequestReset((function(){return r.reset()}))),r.register(r._inputHandler.onRequestScroll((function(e,t){return r.scroll(e,t||void 0)}))),r.register(r._inputHandler.onRequestWindowsOptionsReport((function(e){return r._reportWindowsOptions(e)}))),r.register(r._inputHandler.onAnsiColorChange((function(e){return r._changeAnsiColor(e)}))),r.register(m.forwardEvent(r._inputHandler.onCursorMove,r._onCursorMove)),r.register(m.forwardEvent(r._inputHandler.onTitleChange,r._onTitleChange)),r.register(m.forwardEvent(r._inputHandler.onA11yChar,r._onA11yCharEmitter)),r.register(m.forwardEvent(r._inputHandler.onA11yTab,r._onA11yTabEmitter)),r.register(r._bufferService.onResize((function(e){return r._afterResize(e.cols,e.rows)}))),r}return n(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),t.prototype._changeAnsiColor=function(e){var t,r,i=this;this._colorManager&&(e.colors.forEach((function(e){var t=T.rgba.toColor(e.red,e.green,e.blue);i._colorManager.colors.ansi[e.colorIndex]=t})),null===(t=this._renderService)||void 0===t||t.setColors(this._colorManager.colors),null===(r=this.viewport)||void 0===r||r.onThemeChange(this._colorManager.colors))},t.prototype.dispose=function(){var t,r,i;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._renderService)||void 0===t||t.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},null===(i=null===(r=this.element)||void 0===r?void 0:r.parentNode)||void 0===i||i.removeChild(this.element))},t.prototype._setup=function(){e.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(t.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),t.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},t.prototype._updateOptions=function(t){var r,i,n,o;switch(e.prototype._updateOptions.call(this,t),t){case"fontFamily":case"fontSize":null===(r=this._renderService)||void 0===r||r.clear(),null===(i=this._charSizeService)||void 0===i||i.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":null===(n=this.viewport)||void 0===n||n.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)):(null===(o=this._accessibilityManager)||void 0===o||o.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},t.prototype._onTextAreaFocus=function(e){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(c.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},t.prototype.blur=function(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()},t.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(c.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},t.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var e=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),t=this._bufferService.buffer.y*e,r=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=r+"px",this.textarea.style.top=t+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=e+"px",this.textarea.style.lineHeight=e+"px",this.textarea.style.zIndex="-5"}},t.prototype._initGlobal=function(){var e=this;this._bindKeys(),this.register(d.addDisposableDomListener(this.element,"copy",(function(t){e.hasSelection()&&a.copyHandler(t,e._selectionService)})));var t=function(t){return a.handlePasteEvent(t,e.textarea,e._coreService)};this.register(d.addDisposableDomListener(this.textarea,"paste",t)),this.register(d.addDisposableDomListener(this.element,"paste",t)),_.isFirefox?this.register(d.addDisposableDomListener(this.element,"mousedown",(function(t){2===t.button&&a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))):this.register(d.addDisposableDomListener(this.element,"contextmenu",(function(t){a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))),_.isLinux&&this.register(d.addDisposableDomListener(this.element,"auxclick",(function(t){1===t.button&&a.moveTextAreaUnderMouseCursor(t,e.textarea,e.screenElement)})))},t.prototype._bindKeys=function(){var e=this;this.register(d.addDisposableDomListener(this.textarea,"keyup",(function(t){return e._keyUp(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"keydown",(function(t){return e._keyDown(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"keypress",(function(t){return e._keyPress(t)}),!0)),this.register(d.addDisposableDomListener(this.textarea,"compositionstart",(function(){return e._compositionHelper.compositionstart()}))),this.register(d.addDisposableDomListener(this.textarea,"compositionupdate",(function(t){return e._compositionHelper.compositionupdate(t)}))),this.register(d.addDisposableDomListener(this.textarea,"compositionend",(function(){return e._compositionHelper.compositionend()}))),this.register(this.onRender((function(){return e._compositionHelper.updateCompositionElements()}))),this.register(this.onRender((function(t){return e._queueLinkification(t.start,t.end)})))},t.prototype.open=function(e){var t=this;if(!e)throw new Error("Terminal requires a parent element.");e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),this.element.setAttribute("role","document"),e.appendChild(this.element);var r=O.createDocumentFragment();this._viewportElement=O.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this._viewportScrollArea=O.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=O.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=O.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement),this.textarea=O.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register(d.addDisposableDomListener(this.textarea,"focus",(function(e){return t._onTextAreaFocus(e)}))),this.register(d.addDisposableDomListener(this.textarea,"blur",(function(){return t._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea);var i=this._instantiationService.createInstance(x.CoreBrowserService,this.textarea);this._instantiationService.setService(L.ICoreBrowserService,i),this._charSizeService=this._instantiationService.createInstance(A.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._compositionView=O.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(r),this._theme=this.options.theme||this._theme,this._colorManager=new w.ColorManager(O,this.options.allowTransparency),this.register(this.optionsService.onOptionChange((function(e){return t._colorManager.onOptionsChange(e)}))),this._colorManager.setTheme(this._theme);var n=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,n,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange((function(e){return t._onRender.fire(e)}))),this.onResize((function(e){return t._renderService.resize(e.cols,e.rows)})),this._soundService=this._instantiationService.createInstance(v.SoundService),this._instantiationService.setService(L.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(s.Viewport,(function(e,r){return t.scrollLines(e,r)}),this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar((function(){return t.viewport.syncScrollArea()}))),this.register(this.viewport),this.register(this.onCursorMove((function(){t._renderService.onCursorMove(),t._syncTextArea()}))),this.register(this.onResize((function(){return t._renderService.onResize(t.cols,t.rows)}))),this.register(this.onBlur((function(){return t._renderService.onBlur()}))),this.register(this.onFocus((function(){return t._renderService.onFocus()}))),this.register(this._renderService.onDimensionsChange((function(){return t.viewport.syncScrollArea()}))),this._selectionService=this.register(this._instantiationService.createInstance(f.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((function(e){return t.scrollLines(e.amount,e.suppressScrollEvent)}))),this.register(this._selectionService.onSelectionChange((function(){return t._onSelectionChange.fire()}))),this.register(this._selectionService.onRequestRedraw((function(e){return t._renderService.onSelectionChanged(e.start,e.end,e.columnSelectMode)}))),this.register(this._selectionService.onLinuxMouseSelection((function(e){t.textarea.value=e,t.textarea.focus(),t.textarea.select()}))),this.register(this.onScroll((function(){t.viewport.syncScrollArea(),t._selectionService.refresh()}))),this.register(d.addDisposableDomListener(this._viewportElement,"scroll",(function(){return t._selectionService.refresh()}))),this._mouseZoneManager=this._instantiationService.createInstance(g.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll((function(){return t._mouseZoneManager.clearAll()}))),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(d.addDisposableDomListener(this.element,"mousedown",(function(e){return t._selectionService.onMouseDown(e)}))),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},t.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(h.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(b.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},t.prototype._setTheme=function(e){var t,r,i;this._theme=e,null===(t=this._colorManager)||void 0===t||t.setTheme(e),null===(r=this._renderService)||void 0===r||r.setColors(this._colorManager.colors),null===(i=this.viewport)||void 0===i||i.onThemeChange(this._colorManager.colors)},t.prototype.bindMouse=function(){var e=this,t=this,r=this.element;function i(e){var r,i,n=t._mouseService.getRawByteCoords(e,t.screenElement,t.cols,t.rows);if(!n)return!1;switch(e.overrideType||e.type){case"mousemove":i=32,void 0===e.buttons?(r=3,void 0!==e.button&&(r=e.button<3?e.button:3)):r=1&e.buttons?0:4&e.buttons?1:2&e.buttons?2:3;break;case"mouseup":i=0,r=e.button<3?e.button:3;break;case"mousedown":i=1,r=e.button<3?e.button:3;break;case"wheel":0!==e.deltaY&&(i=e.deltaY<0?0:1),r=4;break;default:return!1}return!(void 0===i||void 0===r||r>4)&&t._coreMouseService.triggerMouseEvent({col:n.x-33,row:n.y-33,button:r,action:i,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})}var n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o=function(t){return i(t),t.buttons||(e._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.removeEventListener("mousemove",n.mousedrag)),e.cancel(t)},s=function(t){return i(t),t.preventDefault(),e.cancel(t)},a=function(e){e.buttons&&i(e)},l=function(e){e.buttons||i(e)};this.register(this._coreMouseService.onProtocolChange((function(t){t?("debug"===e.optionsService.options.logLevel&&e._logService.debug("Binding to mouse events:",e._coreMouseService.explainEvents(t)),e.element.classList.add("enable-mouse-events"),e._selectionService.disable()):(e._logService.debug("Unbinding from mouse events."),e.element.classList.remove("enable-mouse-events"),e._selectionService.enable()),8&t?n.mousemove||(r.addEventListener("mousemove",l),n.mousemove=l):(r.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&t?n.wheel||(r.addEventListener("wheel",s,{passive:!1}),n.wheel=s):(r.removeEventListener("wheel",n.wheel),n.wheel=null),2&t?n.mouseup||(n.mouseup=o):(e._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&t?n.mousedrag||(n.mousedrag=a):(e._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)}))),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(d.addDisposableDomListener(r,"mousedown",(function(t){if(t.preventDefault(),e.focus(),e._coreMouseService.areMouseEventsActive&&!e._selectionService.shouldForceSelection(t))return i(t),n.mouseup&&e._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.addEventListener("mousemove",n.mousedrag),e.cancel(t)}))),this.register(d.addDisposableDomListener(r,"wheel",(function(t){if(n.wheel);else if(!e.buffer.hasScrollback){var r=e.viewport.getLinesScrolled(t);if(0===r)return;for(var i=c.C0.ESC+(e._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B"),o="",s=0;s47)},t.prototype._keyUp=function(e){this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e))},t.prototype._keyPress=function(e){var t;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t,!0),0))},t.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},t.prototype.resize=function(t,r){t!==this.cols||r!==this.rows?e.prototype.resize.call(this,t,r):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},t.prototype._afterResize=function(e,t){var r,i;null===(r=this._charSizeService)||void 0===r||r.measure(),null===(i=this.viewport)||void 0===i||i.syncScrollArea(!0)},t.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var e=1;e=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;var a=r(844),c=r(3656),l=r(4725),h=r(2585),u=function(e){function t(t,r,i,n,o,s,a){var l=e.call(this)||this;return l._scrollLines=t,l._viewportElement=r,l._scrollArea=i,l._bufferService=n,l._optionsService=o,l._charSizeService=s,l._renderService=a,l.scrollBarWidth=0,l._currentRowHeight=0,l._lastRecordedBufferLength=0,l._lastRecordedViewportHeight=0,l._lastRecordedBufferHeight=0,l._lastTouchY=0,l._lastScrollTop=0,l._wheelPartialScroll=0,l._refreshAnimationFrame=null,l._ignoreNextScrollEvent=!1,l.scrollBarWidth=l._viewportElement.offsetWidth-l._scrollArea.offsetWidth||15,l.register(c.addDisposableDomListener(l._viewportElement,"scroll",l._onScroll.bind(l))),setTimeout((function(){return l.syncScrollArea()}),0),l}return n(t,e),t.prototype.onThemeChange=function(e){this._viewportElement.style.backgroundColor=e.background.css},t.prototype._refresh=function(e){var t=this;if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame((function(){return t._innerRefresh()})))},t.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null},t.prototype.syncScrollArea=function(e){if(void 0===e&&(e=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===t&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(e)}else this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t,!0)}},t.prototype._bubbleScroll=function(e,t){var r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&r0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t},t.prototype._applyScrollModifier=function(e,t){var r=this._optionsService.options.fastScrollModifier;return"alt"===r&&t.altKey||"ctrl"===r&&t.ctrlKey||"shift"===r&&t.shiftKey?e*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:e*this._optionsService.options.scrollSensitivity},t.prototype.onTouchStart=function(e){this._lastTouchY=e.touches[0].pageY},t.prototype.onTouchMove=function(e){var t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},o([s(3,h.IBufferService),s(4,h.IOptionsService),s(5,l.ICharSizeService),s(6,l.IRenderService)],t)}(a.Disposable);t.Viewport=u},2950:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;var o=r(4725),s=r(2585),a=function(){function e(e,t,r,i,n,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._charSizeService=n,this._coreService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}return Object.defineProperty(e.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),e.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")},e.prototype.compositionupdate=function(e){var t=this;this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((function(){t._compositionPosition.end=t._textarea.value.length}),0)},e.prototype.compositionend=function(){this._finalizeComposition(!0)},e.prototype.keydown=function(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)},e.prototype._finalizeComposition=function(e){var t=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){var r={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((function(){if(t._isSendingComposition){t._isSendingComposition=!1;var e;r.start+=t._dataAlreadySent.length,(e=t._isComposing?t._textarea.value.substring(r.start,r.end):t._textarea.value.substring(r.start)).length>0&&t._coreService.triggerDataEvent(e,!0)}}),0)}else{this._isSendingComposition=!1;var i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}},e.prototype._handleAnyTextareaChanges=function(){var e=this,t=this._textarea.value;setTimeout((function(){if(!e._isComposing){var r=e._textarea.value.replace(t,"");r.length>0&&(e._dataAlreadySent=r,e._coreService.triggerDataEvent(r,!0))}}),0)},e.prototype.updateCompositionElements=function(e){var t=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var r=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),i=this._bufferService.buffer.y*r,n=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=o.width+"px",this._textarea.style.height=o.height+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout((function(){return t.updateCompositionElements(!0)}),0)}},i([n(2,s.IBufferService),n(3,s.IOptionsService),n(4,o.ICharSizeService),n(5,s.ICoreService)],e)}();t.CompositionHelper=a},9806:(e,t)=>{function r(e,t){var r=t.getBoundingClientRect();return[e.clientX-r.left,e.clientY-r.top]}Object.defineProperty(t,"__esModule",{value:!0}),t.getRawByteCoords=t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=r,t.getCoords=function(e,t,i,n,o,s,a,c){if(o){var l=r(e,t);if(l)return l[0]=Math.ceil((l[0]+(c?s/2:0))/s),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),i+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),n),l}},t.getRawByteCoords=function(e){if(e)return{x:e[0]+32,y:e[1]+32}}},9504:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;var i=r(2584);function n(e,t,r,i){var n=e-o(r,e),a=t-o(r,t);return l(Math.abs(n-a)-function(e,t,r){for(var i=0,n=e-o(r,e),a=t-o(r,t),c=0;c=0&&tt?"A":"B"}function a(e,t,r,i,n,o){for(var s=e,a=t,c="";s!==r||a!==i;)s+=n?1:-1,n&&s>o.cols-1?(c+=o.buffer.translateBufferLineToString(a,!1,e,s),s=0,e=0,a++):!n&&s<0&&(c+=o.buffer.translateBufferLineToString(a,!1,0,e+1),e=s=o.cols-1,a--);return c+o.buffer.translateBufferLineToString(a,!1,e,s)}function c(e,t){var r=t?"O":"[";return i.C0.ESC+r+e}function l(e,t){e=Math.floor(e);for(var r="",i=0;i0?i-o(s,i):t;var f=i,_=function(e,t,r,i,s,a){var c;return c=n(r,i,s,a).length>0?i-o(s,i):t,e=r&&ce?"D":"C",l(Math.abs(h-e),c(s,i));s=u>t?"D":"C";var f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:h,r)+(f-1)*r.cols+1+((u>t?h:e)-1),c(s,i))}},244:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0;var r=function(){function e(){this._addons=[]}return e.prototype.dispose=function(){for(var e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()},e.prototype.loadAddon=function(e,t){var r=this,i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=function(){return r._wrappedAddonDispose(i)},t.activate(e)},e.prototype._wrappedAddonDispose=function(e){if(!e.isDisposed){for(var t=-1,r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var i=r(511),n=r(3236),o=r(9042),s=r(8460),a=r(244),c=function(){function e(e){this._core=new n.Terminal(e),this._addonManager=new a.AddonManager}return e.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(e.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new f(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unicode",{get:function(){return this._checkProposedApi(),new _(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._checkProposedApi(),this._buffer||(this._buffer=new h(this._core)),this._buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),e.prototype.blur=function(){this._core.blur()},e.prototype.focus=function(){this._core.focus()},e.prototype.resize=function(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)},e.prototype.open=function(e){this._core.open(e)},e.prototype.attachCustomKeyEventHandler=function(e){this._core.attachCustomKeyEventHandler(e)},e.prototype.registerLinkMatcher=function(e,t,r){return this._checkProposedApi(),this._core.registerLinkMatcher(e,t,r)},e.prototype.deregisterLinkMatcher=function(e){this._checkProposedApi(),this._core.deregisterLinkMatcher(e)},e.prototype.registerLinkProvider=function(e){return this._checkProposedApi(),this._core.registerLinkProvider(e)},e.prototype.registerCharacterJoiner=function(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)},e.prototype.deregisterCharacterJoiner=function(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)},e.prototype.registerMarker=function(e){return this._checkProposedApi(),this._verifyIntegers(e),this._core.addMarker(e)},e.prototype.addMarker=function(e){return this.registerMarker(e)},e.prototype.hasSelection=function(){return this._core.hasSelection()},e.prototype.select=function(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)},e.prototype.getSelection=function(){return this._core.getSelection()},e.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},e.prototype.clearSelection=function(){this._core.clearSelection()},e.prototype.selectAll=function(){this._core.selectAll()},e.prototype.selectLines=function(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)},e.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},e.prototype.scrollLines=function(e){this._verifyIntegers(e),this._core.scrollLines(e)},e.prototype.scrollPages=function(e){this._verifyIntegers(e),this._core.scrollPages(e)},e.prototype.scrollToTop=function(){this._core.scrollToTop()},e.prototype.scrollToBottom=function(){this._core.scrollToBottom()},e.prototype.scrollToLine=function(e){this._verifyIntegers(e),this._core.scrollToLine(e)},e.prototype.clear=function(){this._core.clear()},e.prototype.write=function(e,t){this._core.write(e,t)},e.prototype.writeUtf8=function(e,t){this._core.write(e,t)},e.prototype.writeln=function(e,t){this._core.write(e),this._core.write("\r\n",t)},e.prototype.paste=function(e){this._core.paste(e)},e.prototype.getOption=function(e){return this._core.optionsService.getOption(e)},e.prototype.setOption=function(e,t){this._core.optionsService.setOption(e,t)},e.prototype.refresh=function(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)},e.prototype.reset=function(){this._core.reset()},e.prototype.loadAddon=function(e){return this._addonManager.loadAddon(this,e)},Object.defineProperty(e,"strings",{get:function(){return o},enumerable:!1,configurable:!0}),e.prototype._verifyIntegers=function(){for(var e=[],t=0;t=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new i.CellData)},e.prototype.translateToString=function(e,t,r){return this._line.translateToString(e,t,r)},e}(),f=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.addCsiHandler(e,(function(e){return t(e.toArray())}))},e.prototype.addCsiHandler=function(e,t){return this.registerCsiHandler(e,t)},e.prototype.registerDcsHandler=function(e,t){return this._core.addDcsHandler(e,(function(e,r){return t(e,r.toArray())}))},e.prototype.addDcsHandler=function(e,t){return this.registerDcsHandler(e,t)},e.prototype.registerEscHandler=function(e,t){return this._core.addEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.addOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}(),_=function(){function e(e){this._core=e}return e.prototype.register=function(e){this._core.unicodeService.register(e)},Object.defineProperty(e.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(e){this._core.unicodeService.activeVersion=e},enumerable:!1,configurable:!0}),e}()},1546:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;var i=r(643),n=r(8803),o=r(1420),s=r(3734),a=r(1752),c=r(4774),l=r(9631),h=function(){function e(e,t,r,i,n,o,s,a){this._container=e,this._alpha=i,this._colors=n,this._rendererId=o,this._bufferService=s,this._optionsService=a,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+t+"-layer"),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return e.prototype.dispose=function(){var e;l.removeElementFromParent(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=a.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},e.prototype.onOptionsChanged=function(){},e.prototype.onBlur=function(){},e.prototype.onFocus=function(){},e.prototype.onCursorMove=function(){},e.prototype.onGridChanged=function(e,t){},e.prototype.onSelectionChanged=function(e,t,r){void 0===r&&(r=!1)},e.prototype.setColors=function(e){this._refreshCharAtlas(e)},e.prototype._setTransparency=function(e){if(e!==this._alpha){var t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},e.prototype._refreshCharAtlas=function(e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=o.acquireCharAtlas(this._optionsService.options,this._rendererId,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},e.prototype.resize=function(e){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},e.prototype._fillCells=function(e,t,r,i){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight)},e.prototype._fillBottomLineAtCells=function(e,t,r){void 0===r&&(r=1),this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-window.devicePixelRatio-1,r*this._scaledCellWidth,window.devicePixelRatio)},e.prototype._fillLeftLineAtCell=function(e,t,r){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,window.devicePixelRatio*r,this._scaledCellHeight)},e.prototype._strokeRectAtCell=function(e,t,r,i){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(e*this._scaledCellWidth+window.devicePixelRatio/2,t*this._scaledCellHeight+window.devicePixelRatio/2,r*this._scaledCellWidth-window.devicePixelRatio,i*this._scaledCellHeight-window.devicePixelRatio)},e.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},e.prototype._clearCells=function(e,t,r,i){this._alpha?this._ctx.clearRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,r*this._scaledCellWidth,i*this._scaledCellHeight))},e.prototype._fillCharTrueColor=function(e,t,r){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(r),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},e.prototype._drawChars=function(e,t,r){var o,s,a=this._getContrastColor(e);a||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,r,a):(e.isInverse()?(o=e.isBgDefault()?n.INVERTED_DEFAULT_COLOR:e.getBgColor(),s=e.isFgDefault()?n.INVERTED_DEFAULT_COLOR:e.getFgColor()):(s=e.isBgDefault()?i.DEFAULT_COLOR:e.getBgColor(),o=e.isFgDefault()?i.DEFAULT_COLOR:e.getFgColor()),o+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||i.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||i.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=s,this._currentGlyphIdentifier.fg=o,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(e,t,r))},e.prototype._drawUncachedChars=function(e,t,r,i){if(this._ctx.save(),this._ctx.font=this._getFont(!!e.isBold(),!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse())if(i)this._ctx.fillStyle=i.css;else if(e.isBgDefault())this._ctx.fillStyle=c.color.opaque(this._colors.background).css;else if(e.isBgRGB())this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var o=e.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8&&(o+=8),this._ctx.fillStyle=this._colors.ansi[o].css}else if(i)this._ctx.fillStyle=i.css;else if(e.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(e.isFgRGB())this._ctx.fillStyle="rgb("+s.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var a=e.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&a<8&&(a+=8),this._ctx.fillStyle=this._colors.ansi[a].css}this._clipRow(r),e.isDim()&&(this._ctx.globalAlpha=n.DIM_OPACITY),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},e.prototype._clipRow=function(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},e.prototype._getFont=function(e,t){return(t?"italic":"")+" "+(e?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},e.prototype._getContrastColor=function(e){if(1!==this._optionsService.options.minimumContrastRatio){var t=this._colors.contrastCache.getColor(e.bg,e.fg);if(void 0!==t)return t||void 0;var r=e.getFgColor(),i=e.getFgColorMode(),n=e.getBgColor(),o=e.getBgColorMode(),s=!!e.isInverse(),a=!!e.isInverse();if(s){var l=r;r=n,n=l;var h=i;i=o,o=h}var u=this._resolveBackgroundRgba(o,n,s),f=this._resolveForegroundRgba(i,r,s,a),_=c.rgba.ensureContrastRatio(u,f,this._optionsService.options.minimumContrastRatio);if(_){var d={css:c.channels.toCss(_>>24&255,_>>16&255,_>>8&255),rgba:_};return this._colors.contrastCache.setColor(e.bg,e.fg,d),d}this._colors.contrastCache.setColor(e.bg,e.fg,null)}},e.prototype._resolveBackgroundRgba=function(e,t,r){switch(e){case 16777216:case 33554432:return this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return r?this._colors.foreground.rgba:this._colors.background.rgba}},e.prototype._resolveForegroundRgba=function(e,t,r,i){switch(e){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&i&&t<8&&(t+=8),this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return r?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=h},5879:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerRegistry=t.JoinedCellData=void 0;var o=r(3734),s=r(643),a=r(511),c=function(e){function t(t,r,i){var n=e.call(this)||this;return n.content=0,n.combinedData="",n.fg=t.fg,n.bg=t.bg,n.combinedData=r,n._width=i,n}return n(t,e),t.prototype.isCombined=function(){return 2097152},t.prototype.getWidth=function(){return this._width},t.prototype.getChars=function(){return this.combinedData},t.prototype.getCode=function(){return 2097151},t.prototype.setFromCharData=function(e){throw new Error("not implemented")},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(o.AttributeData);t.JoinedCellData=c;var l=function(){function e(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}return e.prototype.registerCharacterJoiner=function(e){var t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id},e.prototype.deregisterCharacterJoiner=function(e){for(var t=0;t1)for(var u=this._getJoinedRanges(i,a,o,t,n),f=0;f1)for(u=this._getJoinedRanges(i,a,o,t,n),f=0;f=this._bufferService.rows)this._clearCursor();else{var i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(i,this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var n=this._optionsService.options.cursorStyle;return n&&"block"!==n?this._cursorRenderers[n](i,r,this._cell):this._renderBlurCursor(i,r,this._cell),this._ctx.restore(),this._state.x=i,this._state.y=r,this._state.isFocused=!1,this._state.style=n,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===i&&this._state.y===r&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](i,r,this._cell),this._ctx.restore(),this._state.x=i,this._state.y=r,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},t.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},t.prototype._renderBarCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.options.cursorWidth),this._ctx.restore()},t.prototype._renderBlockCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(e,t,r.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(r,e,t),this._ctx.restore()},t.prototype._renderUnderlineCursor=function(e,t,r){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()},t.prototype._renderBlurCursor=function(e,t,r){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(e,t,r.getWidth(),1),this._ctx.restore()},t}(o.BaseRenderLayer);t.CursorRenderLayer=c;var l=function(){function e(e,t){this._renderCallback=t,this.isCursorVisible=!0,e&&this._restartInterval()}return Object.defineProperty(e.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.restartBlinkAnimation=function(){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){e._renderCallback(),e._animationFrame=void 0}))))},e.prototype._restartInterval=function(e){var t=this;void 0===e&&(e=a),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout((function(){if(t._animationTimeRestarted){var e=a-(Date.now()-t._animationTimeRestarted);if(t._animationTimeRestarted=void 0,e>0)return void t._restartInterval(e)}t.isCursorVisible=!1,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0})),t._blinkInterval=window.setInterval((function(){if(t._animationTimeRestarted){var e=a-(Date.now()-t._animationTimeRestarted);return t._animationTimeRestarted=void 0,void t._restartInterval(e)}t.isCursorVisible=!t.isCursorVisible,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0}))}),a)}),e)},e.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},e}()},3700:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0;var r=function(){function e(){this.cache=[]}return e.prototype.resize=function(e,t){for(var r=0;r0&&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}},t.prototype._onShowLinkUnderline=function(e){if(e.fg===s.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:e.fg&&a.is256Color(e.fg)?this._ctx.fillStyle=this._colors.ansi[e.fg].css:this._ctx.fillStyle=this._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(var t=e.y1+1;t=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;var a=r(9596),c=r(4149),l=r(2512),h=r(5098),u=r(5879),f=r(844),_=r(4725),d=r(2585),p=r(1420),v=r(8460),g=1,y=function(e){function t(t,r,i,n,o,s,f,_,d){var p=e.call(this)||this;p._colors=t,p._screenElement=r,p._bufferService=o,p._charSizeService=s,p._optionsService=f,p._id=g++,p._onRequestRedraw=new v.EventEmitter;var y=p._optionsService.options.allowTransparency;return p._characterJoinerRegistry=new u.CharacterJoinerRegistry(p._bufferService),p._renderLayers=[new a.TextRenderLayer(p._screenElement,0,p._colors,p._characterJoinerRegistry,y,p._id,p._bufferService,f),new c.SelectionRenderLayer(p._screenElement,1,p._colors,p._id,p._bufferService,f),new h.LinkRenderLayer(p._screenElement,2,p._colors,p._id,i,n,p._bufferService,f),new l.CursorRenderLayer(p._screenElement,3,p._colors,p._id,p._onRequestRedraw,p._bufferService,f,_,d)],p.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},p._devicePixelRatio=window.devicePixelRatio,p._updateDimensions(),p.onOptionsChanged(),p}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){for(var t=0,r=this._renderLayers;t{Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e}},4149:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionRenderLayer=void 0;var o=function(e){function t(t,r,i,n,o,s){var a=e.call(this,t,"selection",r,!0,i,n,o,s)||this;return a._clearState(),a}return n(t,e),t.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._clearState()},t.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},t.prototype.onSelectionChanged=function(e,t,r){if(this._didStateChange(e,t,r,this._bufferService.buffer.ydisp))if(this._clearAll(),e&&t){var i=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,o=Math.max(i,0),s=Math.min(n,this._bufferService.rows-1);if(o>=this._bufferService.rows||s<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=this._colors.selectionTransparent.css,r){var a=e[0],c=t[0]-a,l=s-o+1;this._fillCells(a,o,c,l)}else{a=i===o?e[0]:0;var h=o===n?t[0]:this._bufferService.cols;this._fillCells(a,o,h-a,1);var u=Math.max(s-o-1,0);if(this._fillCells(0,o+1,this._bufferService.cols,u),o!==s){var f=n===s?t[0]:this._bufferService.cols;this._fillCells(0,s,f,1)}}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=r,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},t.prototype._didStateChange=function(e,t,r,i){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||r!==this._state.columnSelectMode||i!==this._state.ydisp},t.prototype._areCoordinatesEqual=function(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]},t}(r(1546).BaseRenderLayer);t.SelectionRenderLayer=o},9596:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.TextRenderLayer=void 0;var o=r(3700),s=r(1546),a=r(3734),c=r(643),l=r(5879),h=r(511),u=function(e){function t(t,r,i,n,s,a,c,l){var u=e.call(this,t,"text",r,s,i,a,c,l)||this;return u._characterWidth=0,u._characterFont="",u._characterOverlapCache={},u._workCell=new h.CellData,u._state=new o.GridCache,u._characterJoinerRegistry=n,u}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t);var r=this._getFont(!1,!1);this._characterWidth===t.scaledCharWidth&&this._characterFont===r||(this._characterWidth=t.scaledCharWidth,this._characterFont=r,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},t.prototype.reset=function(){this._state.clear(),this._clearAll()},t.prototype._forEachCell=function(e,t,r,i){for(var n=e;n<=t;n++)for(var o=n+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.lines.get(o),a=r?r.getJoinedCharacters(o):[],h=0;h0&&h===a[0][0]){f=!0;var d=a.shift();u=new l.JoinedCellData(this._workCell,s.translateToString(!0,d[0],d[1]),d[1]-d[0]),_=d[1]-1}!f&&this._isOverlapping(u)&&_this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=r,r},t}(s.BaseRenderLayer);t.TextRenderLayer=u},9616:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseCharAtlas=void 0;var r=function(){function e(){this._didWarmUp=!1}return e.prototype.dispose=function(){},e.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},e.prototype._doWarmUp=function(){},e.prototype.beginFrame=function(){},e}();t.BaseCharAtlas=r},1420:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireCharAtlas=void 0;var i=r(2040),n=r(1906),o=[];t.acquireCharAtlas=function(e,t,r,s,a){for(var c=i.generateConfig(s,a,e,r),l=0;l=0){if(i.configEquals(u.config,c))return u.atlas;1===u.ownedBy.length?(u.atlas.dispose(),o.splice(l,1)):u.ownedBy.splice(h,1);break}}for(l=0;l{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;var i=r(643);t.generateConfig=function(e,t,r,i){var n={foreground:i.foreground,background:i.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:i.ansi};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:e,scaledCharHeight:t,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,colors:n}},t.configEquals=function(e,t){for(var r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR_ATLAS_CELL_SPACING=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.CHAR_ATLAS_CELL_SPACING=1},1906:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.NoneCharAtlas=t.DynamicCharAtlas=t.getGlyphCacheKey=void 0;var o=r(8803),s=r(9616),a=r(5680),c=r(7001),l=r(6114),h=r(1752),u=r(4774),f={css:"rgba(0, 0, 0, 0)",rgba:0};function _(e){return e.code<<21|e.bg<<12|e.fg<<3|(e.bold?0:4)+(e.dim?0:2)+(e.italic?0:1)}t.getGlyphCacheKey=_;var d=function(e){function t(t,r){var i=e.call(this)||this;i._config=r,i._drawToCacheCount=0,i._glyphsWaitingOnBitmap=[],i._bitmapCommitTimeout=null,i._bitmap=null,i._cacheCanvas=t.createElement("canvas"),i._cacheCanvas.width=1024,i._cacheCanvas.height=1024,i._cacheCtx=h.throwIfFalsy(i._cacheCanvas.getContext("2d",{alpha:!0}));var n=t.createElement("canvas");n.width=i._config.scaledCharWidth,n.height=i._config.scaledCharHeight,i._tmpCtx=h.throwIfFalsy(n.getContext("2d",{alpha:i._config.allowTransparency})),i._width=Math.floor(1024/i._config.scaledCharWidth),i._height=Math.floor(1024/i._config.scaledCharHeight);var o=i._width*i._height;return i._cacheMap=new c.LRUMap(o),i._cacheMap.prealloc(o),i}return n(t,e),t.prototype.dispose=function(){null!==this._bitmapCommitTimeout&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},t.prototype.beginFrame=function(){this._drawToCacheCount=0},t.prototype.draw=function(e,t,r,i){if(32===t.code)return!0;if(!this._canCache(t))return!1;var n=_(t),o=this._cacheMap.get(n);if(null!=o)return this._drawFromCache(e,o,r,i),!0;if(this._drawToCacheCount<100){var s;s=this._cacheMap.size>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,s=0;s{Object.defineProperty(t,"__esModule",{value:!0}),t.LRUMap=void 0;var r=function(){function e(e){this.capacity=e,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return e.prototype._unlinkNode=function(e){var t=e.prev,r=e.next;e===this._head&&(this._head=r),e===this._tail&&(this._tail=t),null!==t&&(t.next=r),null!==r&&(r.prev=t)},e.prototype._appendNode=function(e){var t=this._tail;null!==t&&(t.next=e),e.prev=t,e.next=null,this._tail=e,null===this._head&&(this._head=e)},e.prototype.prealloc=function(e){for(var t=this._nodePool,r=0;r=this.capacity)r=this._head,this._unlinkNode(r),delete this._map[r.key],r.key=e,r.value=t,this._map[e]=r;else{var i=this._nodePool;i.length>0?((r=i.pop()).key=e,r.value=t):r={prev:null,next:null,key:e,value:t},this._map[e]=r,this.size++}this._appendNode(r)},e}();t.LRUMap=r},1296:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;var a=r(3787),c=r(8803),l=r(844),h=r(4725),u=r(2585),f=r(8460),_=r(4774),d=r(9631),p="xterm-dom-renderer-owner-",v="xterm-fg-",g="xterm-bg-",y="xterm-focus",b=1,S=function(e){function t(t,r,i,n,o,s,c,l,h){var u=e.call(this)||this;return u._colors=t,u._element=r,u._screenElement=i,u._viewportElement=n,u._linkifier=o,u._linkifier2=s,u._charSizeService=c,u._optionsService=l,u._bufferService=h,u._terminalClass=b++,u._rowElements=[],u._rowContainer=document.createElement("div"),u._rowContainer.classList.add("xterm-rows"),u._rowContainer.style.lineHeight="normal",u._rowContainer.setAttribute("aria-hidden","true"),u._refreshRowElements(u._bufferService.cols,u._bufferService.rows),u._selectionContainer=document.createElement("div"),u._selectionContainer.classList.add("xterm-selection"),u._selectionContainer.setAttribute("aria-hidden","true"),u.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},u._updateDimensions(),u._injectCss(),u._rowFactory=new a.DomRendererRowFactory(document,u._optionsService,u._colors),u._element.classList.add(p+u._terminalClass),u._screenElement.appendChild(u._rowContainer),u._screenElement.appendChild(u._selectionContainer),u._linkifier.onShowLinkUnderline((function(e){return u._onLinkHover(e)})),u._linkifier.onHideLinkUnderline((function(e){return u._onLinkLeave(e)})),u._linkifier2.onShowLinkUnderline((function(e){return u._onLinkHover(e)})),u._linkifier2.onHideLinkUnderline((function(e){return u._onLinkLeave(e)})),u}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return(new f.EventEmitter).event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._element.classList.remove(p+this._terminalClass),d.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),e.prototype.dispose.call(this)},t.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var e=0,t=this._rowElements;et;)this._rowContainer.removeChild(this._rowElements.pop())},t.prototype.onResize=function(e,t){this._refreshRowElements(e,t),this._updateDimensions()},t.prototype.onCharSizeChanged=function(){this._updateDimensions()},t.prototype.onBlur=function(){this._rowContainer.classList.remove(y)},t.prototype.onFocus=function(){this._rowContainer.classList.add(y)},t.prototype.onSelectionChanged=function(e,t,r){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(e&&t){var i=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,o=Math.max(i,0),s=Math.min(n,this._bufferService.rows-1);if(!(o>=this._bufferService.rows||s<0)){var a=document.createDocumentFragment();if(r)a.appendChild(this._createSelectionElement(o,e[0],t[0],s-o+1));else{var c=i===o?e[0]:0,l=o===n?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,c,l));var h=s-o-1;if(a.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,h)),o!==s){var u=n===s?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,0,u))}}this._selectionContainer.appendChild(a)}}},t.prototype._createSelectionElement=function(e,t,r,i){void 0===i&&(i=1);var n=document.createElement("div");return n.style.height=i*this.dimensions.actualCellHeight+"px",n.style.top=e*this.dimensions.actualCellHeight+"px",n.style.left=t*this.dimensions.actualCellWidth+"px",n.style.width=this.dimensions.actualCellWidth*(r-t)+"px",n},t.prototype.onCursorMove=function(){},t.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},t.prototype.clear=function(){for(var e=0,t=this._rowElements;e=n&&(e=0,r++)}},o([s(6,h.ICharSizeService),s(7,u.IOptionsService),s(8,u.IBufferService)],t)}(l.Disposable);t.DomRenderer=S},3787:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;var i=r(8803),n=r(643),o=r(511),s=r(4774);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var a=function(){function e(e,t,r){this._document=e,this._optionsService=t,this._colors=r,this._workCell=new o.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,r,o,a,l,h,u){for(var f=this._document.createDocumentFragment(),_=0,d=Math.min(e.length,u)-1;d>=0;d--)if(e.loadCell(d,this._workCell).getCode()!==n.NULL_CELL_CODE||r&&d===a){_=d+1;break}for(d=0;d<_;d++){e.loadCell(d,this._workCell);var p=this._workCell.getWidth();if(0!==p){var v=this._document.createElement("span");if(p>1&&(v.style.width=h*p+"px"),r&&d===a)switch(v.classList.add(t.CURSOR_CLASS),l&&v.classList.add(t.CURSOR_BLINK_CLASS),o){case"bar":v.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":v.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:v.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&v.classList.add(t.BOLD_CLASS),this._workCell.isItalic()&&v.classList.add(t.ITALIC_CLASS),this._workCell.isDim()&&v.classList.add(t.DIM_CLASS),this._workCell.isUnderline()&&v.classList.add(t.UNDERLINE_CLASS),this._workCell.isInvisible()?v.textContent=n.WHITESPACE_CELL_CHAR:v.textContent=this._workCell.getChars()||n.WHITESPACE_CELL_CHAR;var g=this._workCell.getFgColor(),y=this._workCell.getFgColorMode(),b=this._workCell.getBgColor(),S=this._workCell.getBgColorMode(),m=!!this._workCell.isInverse();if(m){var C=g;g=b,b=C;var w=y;y=S,S=w}switch(y){case 16777216:case 33554432:this._workCell.isBold()&&g<8&&this._optionsService.options.drawBoldTextInBrightColors&&(g+=8),this._applyMinimumContrast(v,this._colors.background,this._colors.ansi[g])||v.classList.add("xterm-fg-"+g);break;case 50331648:var E=s.rgba.toColor(g>>16&255,g>>8&255,255&g);this._applyMinimumContrast(v,this._colors.background,E)||this._addStyle(v,"color:#"+c(g.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(v,this._colors.background,this._colors.foreground)||m&&v.classList.add("xterm-fg-"+i.INVERTED_DEFAULT_COLOR)}switch(S){case 16777216:case 33554432:v.classList.add("xterm-bg-"+b);break;case 50331648:this._addStyle(v,"background-color:#"+c(b.toString(16),"0",6));break;case 0:default:m&&v.classList.add("xterm-bg-"+i.INVERTED_DEFAULT_COLOR)}f.appendChild(v)}}return f},e.prototype._applyMinimumContrast=function(e,t,r){if(1===this._optionsService.options.minimumContrastRatio)return!1;var i=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===i&&(i=s.color.ensureContrastRatio(t,r,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=i?i:null)),!!i&&(this._addStyle(e,"color:"+i.css),!0)},e.prototype._addStyle=function(e,t){e.setAttribute("style",""+(e.getAttribute("style")||"")+t+";")},e}();function c(e,t,r){for(;e.length{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0;var r=function(){function e(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}return e.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(e.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),e.prototype.areSelectionValuesReversed=function(){var e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])},e.prototype.onTrim=function(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},e}();t.SelectionModel=r},428:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;var o=r(2585),s=r(8460),a=function(){function e(e,t,r){this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=new s.EventEmitter,this._measureStrategy=new c(e,t,this._optionsService)}return Object.defineProperty(e.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),e.prototype.measure=function(){var e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())},i([n(2,o.IOptionsService)],e)}();t.CharSizeService=a;var c=function(){function e(e,t,r){this._document=e,this._parentElement=t,this._optionsService=r,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return e.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result},e}()},5114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;var r=function(){function e(e){this._textarea=e}return Object.defineProperty(e.prototype,"isFocused",{get:function(){return(this._textarea.getRootNode?this._textarea.getRootNode():document).activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),e}();t.CoreBrowserService=r},8934:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;var o=r(4725),s=r(9806),a=function(){function e(e,t){this._renderService=e,this._charSizeService=t}return e.prototype.getCoords=function(e,t,r,i,n){return s.getCoords(e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,n)},e.prototype.getRawByteCoords=function(e,t,r,i){var n=this.getCoords(e,t,r,i);return s.getRawByteCoords(n)},i([n(0,o.IRenderService),n(1,o.ICharSizeService)],e)}();t.MouseService=a},3230:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;var a=r(6193),c=r(8460),l=r(844),h=r(5596),u=r(3656),f=r(2585),_=r(4725),d=function(e){function t(t,r,i,n,o,s){var l=e.call(this)||this;if(l._renderer=t,l._rowCount=r,l._charSizeService=o,l._isPaused=!1,l._needsFullRefresh=!1,l._isNextRenderRedrawOnly=!0,l._needsSelectionRefresh=!1,l._canvasWidth=0,l._canvasHeight=0,l._selectionState={start:void 0,end:void 0,columnSelectMode:!1},l._onDimensionsChange=new c.EventEmitter,l._onRender=new c.EventEmitter,l._onRefreshRequest=new c.EventEmitter,l.register({dispose:function(){return l._renderer.dispose()}}),l._renderDebouncer=new a.RenderDebouncer((function(e,t){return l._renderRows(e,t)})),l.register(l._renderDebouncer),l._screenDprMonitor=new h.ScreenDprMonitor,l._screenDprMonitor.setListener((function(){return l.onDevicePixelRatioChange()})),l.register(l._screenDprMonitor),l.register(s.onResize((function(e){return l._fullRefresh()}))),l.register(n.onOptionChange((function(){return l._renderer.onOptionsChanged()}))),l.register(l._charSizeService.onCharSizeChange((function(){return l.onCharSizeChanged()}))),l._renderer.onRequestRedraw((function(e){return l.refreshRows(e.start,e.end,!0)})),l.register(u.addDisposableDomListener(window,"resize",(function(){return l.onDevicePixelRatioChange()}))),"IntersectionObserver"in window){var f=new IntersectionObserver((function(e){return l._onIntersectionChange(e[e.length-1])}),{threshold:0});f.observe(i),l.register({dispose:function(){return f.disconnect()}})}return l}return n(t,e),Object.defineProperty(t.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),t.prototype._onIntersectionChange=function(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},t.prototype.refreshRows=function(e,t,r){void 0===r&&(r=!1),this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))},t.prototype._renderRows=function(e,t){this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0},t.prototype.resize=function(e,t){this._rowCount=t,this._fireOnCanvasResize()},t.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},t.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.setRenderer=function(e){var t=this;this._renderer.dispose(),this._renderer=e,this._renderer.onRequestRedraw((function(e){return t.refreshRows(e.start,e.end,!0)})),this._needsSelectionRefresh=!0,this._fullRefresh()},t.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},t.prototype.setColors=function(e){this._renderer.setColors(e),this._fullRefresh()},t.prototype.onDevicePixelRatioChange=function(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},t.prototype.onResize=function(e,t){this._renderer.onResize(e,t),this._fullRefresh()},t.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},t.prototype.onBlur=function(){this._renderer.onBlur()},t.prototype.onFocus=function(){this._renderer.onFocus()},t.prototype.onSelectionChanged=function(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.onSelectionChanged(e,t,r)},t.prototype.onCursorMove=function(){this._renderer.onCursorMove()},t.prototype.clear=function(){this._renderer.clear()},t.prototype.registerCharacterJoiner=function(e){return this._renderer.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._renderer.deregisterCharacterJoiner(e)},o([s(3,f.IOptionsService),s(4,_.ICharSizeService),s(5,f.IBufferService)],t)}(l.Disposable);t.RenderService=d},9312:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;var a=r(6114),c=r(456),l=r(511),h=r(8460),u=r(4725),f=r(2585),_=r(9806),d=r(9504),p=r(844),v=String.fromCharCode(160),g=new RegExp(v,"g"),y=function(e){function t(t,r,i,n,o,s,a){var u=e.call(this)||this;return u._element=t,u._screenElement=r,u._bufferService=i,u._coreService=n,u._mouseService=o,u._optionsService=s,u._renderService=a,u._dragScrollAmount=0,u._enabled=!0,u._workCell=new l.CellData,u._mouseDownTimeStamp=0,u._oldHasSelection=!1,u._oldSelectionStart=void 0,u._oldSelectionEnd=void 0,u._onLinuxMouseSelection=u.register(new h.EventEmitter),u._onRedrawRequest=u.register(new h.EventEmitter),u._onSelectionChange=u.register(new h.EventEmitter),u._onRequestScrollLines=u.register(new h.EventEmitter),u._mouseMoveListener=function(e){return u._onMouseMove(e)},u._mouseUpListener=function(e){return u._onMouseUp(e)},u._coreService.onUserInput((function(){u.hasSelection&&u.clearSelection()})),u._trimListener=u._bufferService.buffer.lines.onTrim((function(e){return u._onTrim(e)})),u.register(u._bufferService.buffers.onBufferActivate((function(e){return u._onBufferActivate(e)}))),u.enable(),u._model=new c.SelectionModel(u._bufferService),u._activeSelectionMode=0,u}return n(t,e),Object.defineProperty(t.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._removeMouseDownListeners()},t.prototype.reset=function(){this.clearSelection()},t.prototype.disable=function(){this.clearSelection(),this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSelection",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";var r=this._bufferService.buffer,i=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";for(var n=e[1];n<=t[1];n++){var o=r.translateBufferLineToString(n,!0,e[0],t[0]);i.push(o)}}else{var s=e[1]===t[1]?t[0]:void 0;for(i.push(r.translateBufferLineToString(e[1],!0,e[0],s)),n=e[1]+1;n<=t[1]-1;n++){var c=r.lines.get(n);o=r.translateBufferLineToString(n,!0),c&&c.isWrapped?i[i.length-1]+=o:i.push(o)}e[1]!==t[1]&&(c=r.lines.get(t[1]),o=r.translateBufferLineToString(t[1],!0,0,t[0]),c&&c.isWrapped?i[i.length-1]+=o:i.push(o))}return i.map((function(e){return e.replace(g," ")})).join(a.isWindows?"\r\n":"\n")},enumerable:!1,configurable:!0}),t.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},t.prototype.refresh=function(e){var t=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame((function(){return t._refresh()}))),a.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},t.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},t.prototype._isClickInSelection=function(e){var t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!(r&&i&&t)&&this._areCoordsInSelection(t,r,i)},t.prototype._areCoordsInSelection=function(e,t,r){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]},t.prototype._selectWordAtCursor=function(e){var t=this._getMouseBufferCoords(e);t&&(this._selectWordAt(t,!1),this._model.selectionEnd=void 0,this.refresh(!0))},t.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},t.prototype.selectLines=function(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()},t.prototype._onTrim=function(e){this._model.onTrim(e)&&this.refresh()},t.prototype._getMouseBufferCoords=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t},t.prototype._getMouseEventScrollAmount=function(e){var t=_.getCoordsRelativeToElement(e,this._screenElement)[1],r=this._renderService.dimensions.canvasHeight;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-50),50),(t/=50)/Math.abs(t)+Math.round(14*t))},t.prototype.shouldForceSelection=function(e){return a.isMac?e.altKey&&this._optionsService.options.macOptionClickForcesSelection:e.shiftKey},t.prototype.onMouseDown=function(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._onIncrementalClick(e):1===e.detail?this._onSingleClick(e):2===e.detail?this._onDoubleClick(e):3===e.detail&&this._onTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}},t.prototype._addMouseDownListeners=function(){var e=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval((function(){return e._dragScroll()}),50)},t.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},t.prototype._onIncrementalClick=function(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))},t.prototype._onSingleClick=function(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),this._model.selectionStart){this._model.selectionEnd=void 0;var t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}},t.prototype._onDoubleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},t.prototype._onTripleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},t.prototype.shouldColumnSelect=function(e){return e.altKey&&!(a.isMac&&this._optionsService.options.macOptionClickForcesSelection)},t.prototype._onMouseMove=function(e){if(e.stopImmediatePropagation(),this._model.selectionStart){var t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),this._model.selectionEnd){2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var r=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}},t.prototype._onMouseUp=function(e){var t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.getOption("altClickMovesCursor")){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&void 0!==r[0]&&void 0!==r[1]){var i=d.moveToCellSequence(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()},t.prototype._fireEventIfSelectionChanged=function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);r?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,r)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,r)},t.prototype._fireOnSelectionChange=function(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()},t.prototype._onBufferActivate=function(e){var t=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((function(e){return t._onTrim(e)}))},t.prototype._convertViewportColToCharacterIndex=function(e,t){for(var r=t[0],i=0;t[0]>=i;i++){var n=e.loadCell(i,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:n>1&&t[0]!==i&&(r+=n-1)}return r},t.prototype.setSelection=function(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh()},t.prototype.rightClickSelect=function(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e),this._fireEventIfSelectionChanged())},t.prototype._getWordAt=function(e,t,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!0),!(e[0]>=this._bufferService.cols)){var n=this._bufferService.buffer,o=n.lines.get(e[1]);if(o){var s=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(o,e),c=a,l=e[0]-a,h=0,u=0,f=0,_=0;if(" "===s.charAt(a)){for(;a>0&&" "===s.charAt(a-1);)a--;for(;c1&&(_+=v-1,c+=v-1);d>0&&a>0&&!this._isCharWordSeparator(o.loadCell(d-1,this._workCell));){o.loadCell(d-1,this._workCell);var g=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,d--):g>1&&(f+=g-1,a-=g-1),a--,d--}for(;p1&&(_+=y-1,c+=y-1),c++,p++}}c++;var b=a+l-h+f,S=Math.min(this._bufferService.cols,c-a+h+u-f-_);if(t||""!==s.slice(a,c).trim()){if(r&&0===b&&32!==o.getCodePoint(0)){var m=n.lines.get(e[1]-1);if(m&&o.isWrapped&&32!==m.getCodePoint(this._bufferService.cols-1)){var C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){var w=this._bufferService.cols-C.start;b-=w,S+=w}}}if(i&&b+S===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){var E=n.lines.get(e[1]+1);if(E&&E.isWrapped&&32!==E.getCodePoint(0)){var L=this._getWordAt([0,e[1]+1],!1,!1,!0);L&&(S+=L.length)}}return{start:b,length:S}}}}},t.prototype._selectWordAt=function(e,t){var r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}},t.prototype._selectToWordAt=function(e){var t=this._getWordAt(e,!0);if(t){for(var r=e[1];t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}},t.prototype._isCharWordSeparator=function(e){return 0!==e.getWidth()&&this._optionsService.options.wordSeparator.indexOf(e.getChars())>=0},t.prototype._selectLineAt=function(e){var t=this._bufferService.buffer.getWrappedRangeForLine(e);this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._bufferService.cols,t.last],this._model.selectionStartLength=0},o([s(2,f.IBufferService),s(3,f.ICoreService),s(4,u.IMouseService),s(5,f.IOptionsService),s(6,u.IRenderService)],t)}(p.Disposable);t.SelectionService=y},4725:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var i=r(8343);t.ICharSizeService=i.createDecorator("CharSizeService"),t.ICoreBrowserService=i.createDecorator("CoreBrowserService"),t.IMouseService=i.createDecorator("MouseService"),t.IRenderService=i.createDecorator("RenderService"),t.ISelectionService=i.createDecorator("SelectionService"),t.ISoundService=i.createDecorator("SoundService")},357:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SoundService=void 0;var o=r(2585),s=function(){function e(e){this._optionsService=e}return Object.defineProperty(e,"audioContext",{get:function(){if(!e._audioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;e._audioContext=new t}return e._audioContext},enumerable:!1,configurable:!0}),e.prototype.playBellSound=function(){var t=e.audioContext;if(t){var r=t.createBufferSource();t.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),(function(e){r.buffer=e,r.connect(t.destination),r.start(0)}))}},e.prototype._base64ToArrayBuffer=function(e){for(var t=window.atob(e),r=t.length,i=new Uint8Array(r),n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;var i=r(8460),n=function(){function e(e){this._maxLength=e,this.onDeleteEmitter=new i.EventEmitter,this.onInsertEmitter=new i.EventEmitter,this.onTrimEmitter=new i.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(e.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._maxLength},set:function(e){if(this._maxLength!==e){for(var t=new Array(e),r=0;rthis._length)for(var t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(n=0;nthis._maxLength){var o=this._length+r.length-this._maxLength;this._startIndex+=o,this._length=this._maxLength,this.onTrimEmitter.fire(o)}else this._length+=r.length},e.prototype.trimStart=function(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)},e.prototype.shiftElements=function(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(var i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));var n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(i=0;i{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,r){if(void 0===r&&(r=5),"object"!=typeof t)return t;var i=Array.isArray(t)?[]:{};for(var n in t)i[n]=r<=1?t[n]:t[n]?e(t[n],r-1):t[n];return i}},8969:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;var o=r(844),s=r(2585),a=r(4348),c=r(7866),l=r(744),h=r(7302),u=r(6975),f=r(8460),_=r(1753),d=r(3730),p=r(1480),v=r(7994),g=r(9282),y=r(5435),b=r(5981),S=function(e){function t(t){var r=e.call(this)||this;return r._onBinary=new f.EventEmitter,r._onData=new f.EventEmitter,r._onLineFeed=new f.EventEmitter,r._onResize=new f.EventEmitter,r._onScroll=new f.EventEmitter,r._instantiationService=new a.InstantiationService,r.optionsService=new h.OptionsService(t),r._instantiationService.setService(s.IOptionsService,r.optionsService),r._bufferService=r.register(r._instantiationService.createInstance(l.BufferService)),r._instantiationService.setService(s.IBufferService,r._bufferService),r._logService=r._instantiationService.createInstance(c.LogService),r._instantiationService.setService(s.ILogService,r._logService),r._coreService=r.register(r._instantiationService.createInstance(u.CoreService,(function(){return r.scrollToBottom()}))),r._instantiationService.setService(s.ICoreService,r._coreService),r._coreMouseService=r._instantiationService.createInstance(_.CoreMouseService),r._instantiationService.setService(s.ICoreMouseService,r._coreMouseService),r._dirtyRowService=r._instantiationService.createInstance(d.DirtyRowService),r._instantiationService.setService(s.IDirtyRowService,r._dirtyRowService),r.unicodeService=r._instantiationService.createInstance(p.UnicodeService),r._instantiationService.setService(s.IUnicodeService,r.unicodeService),r._charsetService=r._instantiationService.createInstance(v.CharsetService),r._instantiationService.setService(s.ICharsetService,r._charsetService),r._inputHandler=new y.InputHandler(r._bufferService,r._charsetService,r._coreService,r._dirtyRowService,r._logService,r.optionsService,r._coreMouseService,r.unicodeService),r.register(f.forwardEvent(r._inputHandler.onLineFeed,r._onLineFeed)),r.register(r._inputHandler),r.register(f.forwardEvent(r._bufferService.onResize,r._onResize)),r.register(f.forwardEvent(r._coreService.onData,r._onData)),r.register(f.forwardEvent(r._coreService.onBinary,r._onBinary)),r.register(r.optionsService.onOptionChange((function(e){return r._updateOptions(e)}))),r._writeBuffer=new b.WriteBuffer((function(e){return r._inputHandler.parse(e)})),r}return n(t,e),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)},t.prototype.write=function(e,t){this._writeBuffer.write(e,t)},t.prototype.writeSync=function(e){this._writeBuffer.writeSync(e)},t.prototype.resize=function(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,l.MINIMUM_COLS),t=Math.max(t,l.MINIMUM_ROWS),this._bufferService.resize(e,t))},t.prototype.scroll=function(e,t){void 0===t&&(t=!1);var r,i=this._bufferService.buffer;(r=this._cachedBlankLine)&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;var n=i.ybase+i.scrollTop,o=i.ybase+i.scrollBottom;if(0===i.scrollTop){var s=i.lines.isFull;o===i.lines.length-1?s?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(o+1,0,r.clone()),s?this._bufferService.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this._bufferService.isUserScrolling||i.ydisp++)}else{var a=o-n+1;i.lines.shiftElements(n+1,a-1,-1),i.lines.set(o,r.clone())}this._bufferService.isUserScrolling||(i.ydisp=i.ybase),this._dirtyRowService.markRangeDirty(i.scrollTop,i.scrollBottom),this._onScroll.fire(i.ydisp)},t.prototype.scrollLines=function(e,t){var r=this._bufferService.buffer;if(e<0){if(0===r.ydisp)return;this._bufferService.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this._bufferService.isUserScrolling=!1);var i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))},t.prototype.scrollPages=function(e){this.scrollLines(e*(this.rows-1))},t.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},t.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},t.prototype.scrollToLine=function(e){var t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)},t.prototype.addEscHandler=function(e,t){return this._inputHandler.addEscHandler(e,t)},t.prototype.addDcsHandler=function(e,t){return this._inputHandler.addDcsHandler(e,t)},t.prototype.addCsiHandler=function(e,t){return this._inputHandler.addCsiHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._inputHandler.addOscHandler(e,t)},t.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},t.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},t.prototype._updateOptions=function(e){var t;switch(e){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}},t.prototype._enableWindowsMode=function(){var e=this;if(!this._windowsMode){var t=[];t.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),t.push(this.addCsiHandler({final:"H"},(function(){return g.updateWindowsModeWrappedState(e._bufferService),!1}))),this._windowsMode={dispose:function(){for(var e=0,r=t;e{Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0;var r=function(){function e(){this._listeners=[],this._disposed=!1}return Object.defineProperty(e.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(t){return e._listeners.push(t),{dispose:function(){if(!e._disposed)for(var r=0;r24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(o=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));var C=function(){function e(e,t,r,i){this._bufferService=e,this._coreService=t,this._logService=r,this._optionsService=i,this._data=new Uint32Array(0)}return e.prototype.hook=function(e){this._data=new Uint32Array(0)},e.prototype.put=function(e,t,r){this._data=h.concat(this._data,e.subarray(t,r))},e.prototype.unhook=function(e){if(!e)return this._data=new Uint32Array(0),!0;var t=u.utf32ToString(this._data);switch(this._data=new Uint32Array(0),t){case'"q':this._coreService.triggerDataEvent(s.C0.ESC+'P1$r0"q'+s.C0.ESC+"\\");break;case'"p':this._coreService.triggerDataEvent(s.C0.ESC+'P1$r61;1"p'+s.C0.ESC+"\\");break;case"r":var r=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";this._coreService.triggerDataEvent(s.C0.ESC+"P1$r"+r+s.C0.ESC+"\\");break;case"m":this._coreService.triggerDataEvent(s.C0.ESC+"P1$r0m"+s.C0.ESC+"\\");break;case" q":var i={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];i-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(s.C0.ESC+"P1$r"+i+" q"+s.C0.ESC+"\\");break;default:this._logService.debug("Unknown DCS $q %s",t),this._coreService.triggerDataEvent(s.C0.ESC+"P0$r"+s.C0.ESC+"\\")}return!0},e}(),w=function(e){function t(t,r,i,n,o,l,h,d,v){void 0===v&&(v=new c.EscapeSequenceParser);var y=e.call(this)||this;y._bufferService=t,y._charsetService=r,y._coreService=i,y._dirtyRowService=n,y._logService=o,y._optionsService=l,y._coreMouseService=h,y._unicodeService=d,y._parser=v,y._parseBuffer=new Uint32Array(4096),y._stringDecoder=new u.StringToUtf32,y._utf8Decoder=new u.Utf8ToUtf32,y._workCell=new p.CellData,y._windowTitle="",y._iconName="",y._windowTitleStack=[],y._iconNameStack=[],y._curAttrData=f.DEFAULT_ATTR_DATA.clone(),y._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),y._onRequestBell=new _.EventEmitter,y._onRequestRefreshRows=new _.EventEmitter,y._onRequestReset=new _.EventEmitter,y._onRequestScroll=new _.EventEmitter,y._onRequestSyncScrollBar=new _.EventEmitter,y._onRequestWindowsOptionsReport=new _.EventEmitter,y._onA11yChar=new _.EventEmitter,y._onA11yTab=new _.EventEmitter,y._onCursorMove=new _.EventEmitter,y._onLineFeed=new _.EventEmitter,y._onScroll=new _.EventEmitter,y._onTitleChange=new _.EventEmitter,y._onAnsiColorChange=new _.EventEmitter,y.register(y._parser),y._parser.setCsiHandlerFallback((function(e,t){y._logService.debug("Unknown CSI code: ",{identifier:y._parser.identToString(e),params:t.toArray()})})),y._parser.setEscHandlerFallback((function(e){y._logService.debug("Unknown ESC code: ",{identifier:y._parser.identToString(e)})})),y._parser.setExecuteHandlerFallback((function(e){y._logService.debug("Unknown EXECUTE code: ",{code:e})})),y._parser.setOscHandlerFallback((function(e,t,r){y._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:r})})),y._parser.setDcsHandlerFallback((function(e,t,r){"HOOK"===t&&(r=r.toArray()),y._logService.debug("Unknown DCS code: ",{identifier:y._parser.identToString(e),action:t,payload:r})})),y._parser.setPrintHandler((function(e,t,r){return y.print(e,t,r)})),y._parser.registerCsiHandler({final:"@"},(function(e){return y.insertChars(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"@"},(function(e){return y.scrollLeft(e)})),y._parser.registerCsiHandler({final:"A"},(function(e){return y.cursorUp(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"A"},(function(e){return y.scrollRight(e)})),y._parser.registerCsiHandler({final:"B"},(function(e){return y.cursorDown(e)})),y._parser.registerCsiHandler({final:"C"},(function(e){return y.cursorForward(e)})),y._parser.registerCsiHandler({final:"D"},(function(e){return y.cursorBackward(e)})),y._parser.registerCsiHandler({final:"E"},(function(e){return y.cursorNextLine(e)})),y._parser.registerCsiHandler({final:"F"},(function(e){return y.cursorPrecedingLine(e)})),y._parser.registerCsiHandler({final:"G"},(function(e){return y.cursorCharAbsolute(e)})),y._parser.registerCsiHandler({final:"H"},(function(e){return y.cursorPosition(e)})),y._parser.registerCsiHandler({final:"I"},(function(e){return y.cursorForwardTab(e)})),y._parser.registerCsiHandler({final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.registerCsiHandler({prefix:"?",final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.registerCsiHandler({final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.registerCsiHandler({prefix:"?",final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.registerCsiHandler({final:"L"},(function(e){return y.insertLines(e)})),y._parser.registerCsiHandler({final:"M"},(function(e){return y.deleteLines(e)})),y._parser.registerCsiHandler({final:"P"},(function(e){return y.deleteChars(e)})),y._parser.registerCsiHandler({final:"S"},(function(e){return y.scrollUp(e)})),y._parser.registerCsiHandler({final:"T"},(function(e){return y.scrollDown(e)})),y._parser.registerCsiHandler({final:"X"},(function(e){return y.eraseChars(e)})),y._parser.registerCsiHandler({final:"Z"},(function(e){return y.cursorBackwardTab(e)})),y._parser.registerCsiHandler({final:"`"},(function(e){return y.charPosAbsolute(e)})),y._parser.registerCsiHandler({final:"a"},(function(e){return y.hPositionRelative(e)})),y._parser.registerCsiHandler({final:"b"},(function(e){return y.repeatPrecedingCharacter(e)})),y._parser.registerCsiHandler({final:"c"},(function(e){return y.sendDeviceAttributesPrimary(e)})),y._parser.registerCsiHandler({prefix:">",final:"c"},(function(e){return y.sendDeviceAttributesSecondary(e)})),y._parser.registerCsiHandler({final:"d"},(function(e){return y.linePosAbsolute(e)})),y._parser.registerCsiHandler({final:"e"},(function(e){return y.vPositionRelative(e)})),y._parser.registerCsiHandler({final:"f"},(function(e){return y.hVPosition(e)})),y._parser.registerCsiHandler({final:"g"},(function(e){return y.tabClear(e)})),y._parser.registerCsiHandler({final:"h"},(function(e){return y.setMode(e)})),y._parser.registerCsiHandler({prefix:"?",final:"h"},(function(e){return y.setModePrivate(e)})),y._parser.registerCsiHandler({final:"l"},(function(e){return y.resetMode(e)})),y._parser.registerCsiHandler({prefix:"?",final:"l"},(function(e){return y.resetModePrivate(e)})),y._parser.registerCsiHandler({final:"m"},(function(e){return y.charAttributes(e)})),y._parser.registerCsiHandler({final:"n"},(function(e){return y.deviceStatus(e)})),y._parser.registerCsiHandler({prefix:"?",final:"n"},(function(e){return y.deviceStatusPrivate(e)})),y._parser.registerCsiHandler({intermediates:"!",final:"p"},(function(e){return y.softReset(e)})),y._parser.registerCsiHandler({intermediates:" ",final:"q"},(function(e){return y.setCursorStyle(e)})),y._parser.registerCsiHandler({final:"r"},(function(e){return y.setScrollRegion(e)})),y._parser.registerCsiHandler({final:"s"},(function(e){return y.saveCursor(e)})),y._parser.registerCsiHandler({final:"t"},(function(e){return y.windowOptions(e)})),y._parser.registerCsiHandler({final:"u"},(function(e){return y.restoreCursor(e)})),y._parser.registerCsiHandler({intermediates:"'",final:"}"},(function(e){return y.insertColumns(e)})),y._parser.registerCsiHandler({intermediates:"'",final:"~"},(function(e){return y.deleteColumns(e)})),y._parser.setExecuteHandler(s.C0.BEL,(function(){return y.bell()})),y._parser.setExecuteHandler(s.C0.LF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.VT,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.FF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(s.C0.CR,(function(){return y.carriageReturn()})),y._parser.setExecuteHandler(s.C0.BS,(function(){return y.backspace()})),y._parser.setExecuteHandler(s.C0.HT,(function(){return y.tab()})),y._parser.setExecuteHandler(s.C0.SO,(function(){return y.shiftOut()})),y._parser.setExecuteHandler(s.C0.SI,(function(){return y.shiftIn()})),y._parser.setExecuteHandler(s.C1.IND,(function(){return y.index()})),y._parser.setExecuteHandler(s.C1.NEL,(function(){return y.nextLine()})),y._parser.setExecuteHandler(s.C1.HTS,(function(){return y.tabSet()})),y._parser.registerOscHandler(0,new g.OscHandler((function(e){return y.setTitle(e),y.setIconName(e),!0}))),y._parser.registerOscHandler(1,new g.OscHandler((function(e){return y.setIconName(e)}))),y._parser.registerOscHandler(2,new g.OscHandler((function(e){return y.setTitle(e)}))),y._parser.registerOscHandler(4,new g.OscHandler((function(e){return y.setAnsiColor(e)}))),y._parser.registerEscHandler({final:"7"},(function(){return y.saveCursor()})),y._parser.registerEscHandler({final:"8"},(function(){return y.restoreCursor()})),y._parser.registerEscHandler({final:"D"},(function(){return y.index()})),y._parser.registerEscHandler({final:"E"},(function(){return y.nextLine()})),y._parser.registerEscHandler({final:"H"},(function(){return y.tabSet()})),y._parser.registerEscHandler({final:"M"},(function(){return y.reverseIndex()})),y._parser.registerEscHandler({final:"="},(function(){return y.keypadApplicationMode()})),y._parser.registerEscHandler({final:">"},(function(){return y.keypadNumericMode()})),y._parser.registerEscHandler({final:"c"},(function(){return y.fullReset()})),y._parser.registerEscHandler({final:"n"},(function(){return y.setgLevel(2)})),y._parser.registerEscHandler({final:"o"},(function(){return y.setgLevel(3)})),y._parser.registerEscHandler({final:"|"},(function(){return y.setgLevel(3)})),y._parser.registerEscHandler({final:"}"},(function(){return y.setgLevel(2)})),y._parser.registerEscHandler({final:"~"},(function(){return y.setgLevel(1)})),y._parser.registerEscHandler({intermediates:"%",final:"@"},(function(){return y.selectDefaultCharset()})),y._parser.registerEscHandler({intermediates:"%",final:"G"},(function(){return y.selectDefaultCharset()}));var b=function(e){S._parser.registerEscHandler({intermediates:"(",final:e},(function(){return y.selectCharset("("+e)})),S._parser.registerEscHandler({intermediates:")",final:e},(function(){return y.selectCharset(")"+e)})),S._parser.registerEscHandler({intermediates:"*",final:e},(function(){return y.selectCharset("*"+e)})),S._parser.registerEscHandler({intermediates:"+",final:e},(function(){return y.selectCharset("+"+e)})),S._parser.registerEscHandler({intermediates:"-",final:e},(function(){return y.selectCharset("-"+e)})),S._parser.registerEscHandler({intermediates:".",final:e},(function(){return y.selectCharset("."+e)})),S._parser.registerEscHandler({intermediates:"/",final:e},(function(){return y.selectCharset("/"+e)}))},S=this;for(var m in a.CHARSETS)b(m);return y._parser.registerEscHandler({intermediates:"#",final:"8"},(function(){return y.screenAlignmentPattern()})),y._parser.setErrorHandler((function(e){return y._logService.error("Parsing error: ",e),e})),y._parser.registerDcsHandler({intermediates:"$",final:"q"},new C(y._bufferService,y._coreService,y._logService,y._optionsService)),y}return n(t,e),Object.defineProperty(t.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onAnsiColorChange",{get:function(){return this._onAnsiColorChange.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.parse=function(e){var t=this._bufferService.buffer,r=t.x,i=t.y;if(this._logService.debug("parsing data",e),this._parseBuffer.lengthS)for(var n=0;n0&&2===_.getWidth(o.x-1)&&_.setCellFromCodePoint(o.x-1,0,1,f.fg,f.bg,f.extended);for(var p=t;p=c)if(l){for(;o.x=this._bufferService.rows&&(o.y=this._bufferService.rows-1),o.lines.get(o.ybase+o.y).isWrapped=!0),_=o.lines.get(o.ybase+o.y)}else if(o.x=c-1,2===n)continue;if(h&&(_.insertCells(o.x,n,o.getNullCell(f),f),2===_.getWidth(c-1)&&_.setCellFromCodePoint(c-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,f.fg,f.bg,f.extended)),_.setCellFromCodePoint(o.x++,i,n,f.fg,f.bg,f.extended),n>0)for(;--n;)_.setCellFromCodePoint(o.x++,0,0,f.fg,f.bg,f.extended)}else _.getWidth(o.x-1)?_.addCodepointToCell(o.x-1,i):_.addCodepointToCell(o.x-2,i)}r-t>0&&(_.loadCell(o.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),o.x0&&0===_.getWidth(o.x)&&!_.hasContent(o.x)&&_.setCellFromCodePoint(o.x,0,1,f.fg,f.bg,f.extended),this._dirtyRowService.markDirty(o.y)},t.prototype.addCsiHandler=function(e,t){var r=this;return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(function(e){return!m(e.params[0],r._optionsService.options.windowOptions)||t(e)}))},t.prototype.addDcsHandler=function(e,t){return this._parser.registerDcsHandler(e,new y.DcsHandler(t))},t.prototype.addEscHandler=function(e,t){return this._parser.registerEscHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._parser.registerOscHandler(e,new g.OscHandler(t))},t.prototype.bell=function(){return this._onRequestBell.fire(),!0},t.prototype.lineFeed=function(){var e=this._bufferService.buffer;return this._dirtyRowService.markDirty(e.y),this._optionsService.options.convertEol&&(e.x=0),e.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),e.x>=this._bufferService.cols&&e.x--,this._dirtyRowService.markDirty(e.y),this._onLineFeed.fire(),!0},t.prototype.carriageReturn=function(){return this._bufferService.buffer.x=0,!0},t.prototype.backspace=function(){var e,t=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),t.x>0&&t.x--,!0;if(this._restrictCursor(this._bufferService.cols),t.x>0)t.x--;else if(0===t.x&&t.y>t.scrollTop&&t.y<=t.scrollBottom&&(null===(e=t.lines.get(t.ybase+t.y))||void 0===e?void 0:e.isWrapped)){t.lines.get(t.ybase+t.y).isWrapped=!1,t.y--,t.x=this._bufferService.cols-1;var r=t.lines.get(t.ybase+t.y);r.hasWidth(t.x)&&!r.hasContent(t.x)&&t.x--}return this._restrictCursor(),!0},t.prototype.tab=function(){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;var e=this._bufferService.buffer.x;return this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-e),!0},t.prototype.shiftOut=function(){return this._charsetService.setgLevel(1),!0},t.prototype.shiftIn=function(){return this._charsetService.setgLevel(0),!0},t.prototype._restrictCursor=function(e){void 0===e&&(e=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(e,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._setCursor=function(e,t){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=e,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+t):(this._bufferService.buffer.x=e,this._bufferService.buffer.y=t),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+e,this._bufferService.buffer.y+t)},t.prototype.cursorUp=function(e){var t=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0},t.prototype.cursorDown=function(e){var t=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0},t.prototype.cursorForward=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.cursorBackward=function(e){return this._moveCursor(-(e.params[0]||1),0),!0},t.prototype.cursorNextLine=function(e){return this.cursorDown(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorPrecedingLine=function(e){return this.cursorUp(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorCharAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.cursorPosition=function(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0},t.prototype.charPosAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.hPositionRelative=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.linePosAbsolute=function(e){return this._setCursor(this._bufferService.buffer.x,(e.params[0]||1)-1),!0},t.prototype.vPositionRelative=function(e){return this._moveCursor(0,e.params[0]||1),!0},t.prototype.hVPosition=function(e){return this.cursorPosition(e),!0},t.prototype.tabClear=function(e){var t=e.params[0];return 0===t?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===t&&(this._bufferService.buffer.tabs={}),!0},t.prototype.cursorForwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1;t--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop();return!0},t.prototype.cursorBackwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1,r=this._bufferService.buffer;t--;)r.x=r.prevStop();return!0},t.prototype._eraseInBufferLine=function(e,t,r,i){void 0===i&&(i=!1);var n=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);n.replaceCells(t,r,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i&&(n.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);t.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(),e.params[0]){case 0:for(t=this._bufferService.buffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t++,this._bufferService.buffer.x,this._bufferService.cols,0===this._bufferService.buffer.x);t=this._bufferService.cols&&(this._bufferService.buffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 2:for(t=this._bufferService.rows,this._dirtyRowService.markDirty(t-1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 3:var r=this._bufferService.buffer.lines.length-this._bufferService.rows;r>0&&(this._bufferService.buffer.lines.trimStart(r),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-r,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-r,0),this._onScroll.fire(0))}return!0},t.prototype.eraseInLine=function(e){switch(this._restrictCursor(),e.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}return this._dirtyRowService.markDirty(this._bufferService.buffer.y),!0},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1,r=this._bufferService.buffer;if(r.y>r.scrollBottom||r.yr.scrollBottom||r.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0},t.prototype.sendDeviceAttributesSecondary=function(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0},t.prototype._is=function(e){return 0===(this._optionsService.options.termName+"").indexOf(e)},t.prototype.setMode=function(e){for(var t=0;t=2||2===i[1]&&o+n>=5)break;i[1]&&(n=1)}while(++o+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()},t.prototype.charAttributes=function(e){if(1===e.length&&0===e.params[0])return this._curAttrData.fg=f.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=f.DEFAULT_ATTR_DATA.bg,!0;for(var t,r=e.length,i=this._curAttrData,n=0;n=30&&t<=37?(i.fg&=-50331904,i.fg|=16777216|t-30):t>=40&&t<=47?(i.bg&=-50331904,i.bg|=16777216|t-40):t>=90&&t<=97?(i.fg&=-50331904,i.fg|=16777224|t-90):t>=100&&t<=107?(i.bg&=-50331904,i.bg|=16777224|t-100):0===t?(i.fg=f.DEFAULT_ATTR_DATA.fg,i.bg=f.DEFAULT_ATTR_DATA.bg):1===t?i.fg|=134217728:3===t?i.bg|=67108864:4===t?(i.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,i)):5===t?i.fg|=536870912:7===t?i.fg|=67108864:8===t?i.fg|=1073741824:2===t?i.bg|=134217728:21===t?this._processUnderline(2,i):22===t?(i.fg&=-134217729,i.bg&=-134217729):23===t?i.bg&=-67108865:24===t?i.fg&=-268435457:25===t?i.fg&=-536870913:27===t?i.fg&=-67108865:28===t?i.fg&=-1073741825:39===t?(i.fg&=-67108864,i.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):49===t?(i.bg&=-67108864,i.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):38===t||48===t||58===t?n+=this._extractColor(e,n,i):59===t?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):100===t?(i.fg&=-67108864,i.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,i.bg&=-67108864,i.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",t);return!0},t.prototype.deviceStatus=function(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(s.C0.ESC+"[0n");break;case 6:var t=this._bufferService.buffer.y+1,r=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"["+t+";"+r+"R")}return!0},t.prototype.deviceStatusPrivate=function(e){switch(e.params[0]){case 6:var t=this._bufferService.buffer.y+1,r=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"[?"+t+";"+r+"R")}return!0},t.prototype.softReset=function(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0},t.prototype.setCursorStyle=function(e){var t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}var r=t%2==1;return this._optionsService.options.cursorBlink=r,!0},t.prototype.setScrollRegion=function(e){var t,r=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>r&&(this._bufferService.buffer.scrollTop=r-1,this._bufferService.buffer.scrollBottom=t-1,this._setCursor(0,0)),!0},t.prototype.windowOptions=function(e){if(!m(e.params[0],this._optionsService.options.windowOptions))return!0;var t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(o.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(o.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(s.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0},t.prototype.saveCursor=function(e){return this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,!0},t.prototype.restoreCursor=function(e){return this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor(),!0},t.prototype.setTitle=function(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0},t.prototype.setIconName=function(e){return this._iconName=e,!0},t.prototype._parseAnsiColorChange=function(e){for(var t,r={colors:[]},i=/(\d+);rgb:([0-9a-f]{2})\/([0-9a-f]{2})\/([0-9a-f]{2})/gi;null!==(t=i.exec(e));)r.colors.push({colorIndex:parseInt(t[1]),red:parseInt(t[2],16),green:parseInt(t[3],16),blue:parseInt(t[4],16)});return 0===r.colors.length?null:r},t.prototype.setAnsiColor=function(e){var t=this._parseAnsiColorChange(e);return t?this._onAnsiColorChange.fire(t):this._logService.warn("Expected format ;rgb:// but got data: "+e),!0},t.prototype.nextLine=function(){return this._bufferService.buffer.x=0,this.index(),!0},t.prototype.keypadApplicationMode=function(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0},t.prototype.keypadNumericMode=function(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0},t.prototype.selectDefaultCharset=function(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),!0},t.prototype.selectCharset=function(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(b[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET),!0)},t.prototype.index=function(){this._restrictCursor();var e=this._bufferService.buffer;return this._bufferService.buffer.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),this._restrictCursor(),!0},t.prototype.tabSet=function(){return this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0,!0},t.prototype.reverseIndex=function(){this._restrictCursor();var e=this._bufferService.buffer;if(e.y===e.scrollTop){var t=e.scrollBottom-e.scrollTop;e.lines.shiftElements(e.ybase+e.y,t,1),e.lines.set(e.ybase+e.y,e.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(e.scrollTop,e.scrollBottom)}else e.y--,this._restrictCursor();return!0},t.prototype.fullReset=function(){return this._parser.reset(),this._onRequestReset.fire(),!0},t.prototype.reset=function(){this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()},t.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},t.prototype.setgLevel=function(e){return this._charsetService.setgLevel(e),!0},t.prototype.screenAlignmentPattern=function(){var e=new p.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg;var t=this._bufferService.buffer;this._setCursor(0,0);for(var r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.Disposable=void 0;var r=function(){function e(){this._disposables=[],this._isDisposed=!1}return e.prototype.dispose=function(){this._isDisposed=!0;for(var e=0,t=this._disposables;e{Object.defineProperty(t,"__esModule",{value:!0}),t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isFirefox=void 0;var r="undefined"==typeof navigator,i=r?"node":navigator.userAgent,n=r?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(n),t.isIpad="iPad"===n,t.isIphone="iPhone"===n,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(n),t.isLinux=n.indexOf("Linux")>=0},8273:(e,t)=>{function r(e,t,r,i){if(void 0===r&&(r=0),void 0===i&&(i=e.length),r>=e.length)return e;r=(e.length+r)%e.length,i=i>=e.length?e.length:(e.length+i)%e.length;for(var n=r;n{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;var i=r(643);t.updateWindowsModeWrappedState=function(e){var t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),r=null==t?void 0:t.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&r&&(n.isWrapped=r[i.CHAR_DATA_CODE_INDEX]!==i.NULL_CELL_CODE&&r[i.CHAR_DATA_CODE_INDEX]!==i.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;var r=function(){function e(){this.fg=0,this.bg=0,this.extended=new i}return e.toColorRGB=function(e){return[e>>>16&255,e>>>8&255,255&e]},e.fromColorRGB=function(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},e.prototype.clone=function(){var t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t},e.prototype.isInverse=function(){return 67108864&this.fg},e.prototype.isBold=function(){return 134217728&this.fg},e.prototype.isUnderline=function(){return 268435456&this.fg},e.prototype.isBlink=function(){return 536870912&this.fg},e.prototype.isInvisible=function(){return 1073741824&this.fg},e.prototype.isItalic=function(){return 67108864&this.bg},e.prototype.isDim=function(){return 134217728&this.bg},e.prototype.getFgColorMode=function(){return 50331648&this.fg},e.prototype.getBgColorMode=function(){return 50331648&this.bg},e.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},e.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},e.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},e.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},e.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},e.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},e.prototype.isAttributeDefault=function(){return 0===this.fg&&0===this.bg},e.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},e.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},e.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},e.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},e.prototype.getUnderlineColor=function(){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()},e.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},e.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()},e.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()},e.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()},e.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},e}();t.AttributeData=r;var i=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=-1),this.underlineStyle=e,this.underlineColor=t}return e.prototype.clone=function(){return new e(this.underlineStyle,this.underlineColor)},e.prototype.isEmpty=function(){return 0===this.underlineStyle},e}();t.ExtendedAttrs=i},9092:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;var i=r(6349),n=r(8437),o=r(511),s=r(643),a=r(4634),c=r(4863),l=r(7116),h=r(3734);t.MAX_BUFFER_SIZE=4294967295;var u=function(){function e(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=l.DEFAULT_CHARSET,this.markers=[],this._nullCell=o.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]),this._whitespaceCell=o.CellData.fromCharData([0,s.WHITESPACE_CELL_CHAR,s.WHITESPACE_CELL_WIDTH,s.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new i.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return e.prototype.getNullCell=function(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell},e.prototype.getWhitespaceCell=function(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell},e.prototype.getBlankLine=function(e,t){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),t)},Object.defineProperty(e.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCursorInViewport",{get:function(){var e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r},e.prototype.fillViewportRows=function(e){if(0===this.lines.length){void 0===e&&(e=n.DEFAULT_ATTR_DATA);for(var t=this._rows;t--;)this.lines.push(this.getBlankLine(e))}},e.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new i.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},e.prototype.resize=function(e,t){var r=this.getNullCell(n.DEFAULT_ATTR_DATA),i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,r)));else for(a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(o=0;othis._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var r=a.reflowLargerGetLinesToRemove(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(r.length>0){var i=a.reflowLargerCreateNewLayout(this.lines,r);a.reflowLargerApplyNewLayout(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}},e.prototype._reflowLargerAdjustViewport=function(e,t,r){for(var i=this.getNullCell(n.DEFAULT_ATTR_DATA),o=r;o-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;s--){var c=this.lines.get(s);if(!(!c||!c.isWrapped&&c.getTrimmedLength()<=e)){for(var l=[c];c.isWrapped&&s>0;)c=this.lines.get(--s),l.unshift(c);var h=this.ybase+this.y;if(!(h>=s&&h0&&(i.push({start:s+l.length+o,newLines:p}),o+=p.length),l.push.apply(l,p);var y=_.length-1,b=_[y];0===b&&(b=_[--y]);for(var S=l.length-d-1,m=f;S>=0;){var C=Math.min(m,b);if(l[y].copyCellsFrom(l[S],m-C,b-C,C,!0),0==(b-=C)&&(b=_[--y]),0==(m-=C)){S--;var w=Math.max(S,0);m=a.getWrappedLineTrimmedLength(l,w,this._cols)}}for(v=0;v0;)0===this.ybase?this.y0){var L=[],A=[];for(v=0;v=0;v--)if(D&&D.start>k+T){for(var O=D.newLines.length-1;O>=0;O--)this.lines.set(v--,D.newLines[O]);v++,L.push({index:k+1,amount:D.newLines.length}),T+=D.newLines.length,D=i[++x]}else this.lines.set(v,A[k--]);var M=0;for(v=L.length-1;v>=0;v--)L[v].index+=M,this.lines.onInsertEmitter.fire(L[v]),M+=L[v].amount;var P=Math.max(0,R+o-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}},e.prototype.stringIndexToBufferIndex=function(e,t,r){for(void 0===r&&(r=!1);t;){var i=this.lines.get(e);if(!i)return[-1,-1];for(var n=r?i.getTrimmedLength():i.length,o=0;o0&&this.lines.get(t).isWrapped;)t--;for(;r+10;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e},e.prototype.addMarker=function(e){var t=this,r=new c.Marker(e);return this.markers.push(r),r.register(this.lines.onTrim((function(e){r.line-=e,r.line<0&&r.dispose()}))),r.register(this.lines.onInsert((function(e){r.line>=e.index&&(r.line+=e.amount)}))),r.register(this.lines.onDelete((function(e){r.line>=e.index&&r.linee.index&&(r.line-=e.amount)}))),r.register(r.onDispose((function(){return t._removeMarker(r)}))),r},e.prototype._removeMarker=function(e){this.markers.splice(this.markers.indexOf(e),1)},e.prototype.iterator=function(e,t,r,i,n){return new f(this,e,t,r,i,n)},e}();t.Buffer=u;var f=function(){function e(e,t,r,i,n,o){void 0===r&&(r=0),void 0===i&&(i=e.lines.length),void 0===n&&(n=0),void 0===o&&(o=0),this._buffer=e,this._trimRight=t,this._startIndex=r,this._endIndex=i,this._startOverscan=n,this._endOverscan=o,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return e.prototype.hasNext=function(){return this._currentthis._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);for(var t="",r=e.first;r<=e.last;++r)t+=this._buffer.translateBufferLineToString(r,this._trimRight);return this._current=e.last+1,{range:e,content:t}},e}();t.BufferStringIterator=f},8437:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;var i=r(482),n=r(643),o=r(511),s=r(3734);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);var a=function(){function e(e,t,r){void 0===r&&(r=!1),this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);for(var i=t||o.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]),s=0;s>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]},e.prototype.set=function(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22},e.prototype.getWidth=function(e){return this._data[3*e+0]>>22},e.prototype.hasWidth=function(e){return 12582912&this._data[3*e+0]},e.prototype.getFg=function(e){return this._data[3*e+1]},e.prototype.getBg=function(e){return this._data[3*e+2]},e.prototype.hasContent=function(e){return 4194303&this._data[3*e+0]},e.prototype.getCodePoint=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t},e.prototype.isCombined=function(e){return 2097152&this._data[3*e+0]},e.prototype.getString=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?i.stringFromCodePoint(2097151&t):""},e.prototype.loadCell=function(e,t){var r=3*e;return t.content=this._data[r+0],t.fg=this._data[r+1],t.bg=this._data[r+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t},e.prototype.setCell=function(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg},e.prototype.setCellFromCodePoint=function(e,t,r,i,n,o){268435456&n&&(this._extendedAttrs[e]=o),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=i,this._data[3*e+2]=n},e.prototype.addCodepointToCell=function(e,t){var r=this._data[3*e+0];2097152&r?this._combined[e]+=i.stringFromCodePoint(t):(2097151&r?(this._combined[e]=i.stringFromCodePoint(2097151&r)+i.stringFromCodePoint(t),r&=-2097152,r|=2097152):r=t|1<<22,this._data[3*e+0]=r)},e.prototype.insertCells=function(e,t,r,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new s.ExtendedAttrs),t=0;--a)this.setCell(e+t+a,this.loadCell(e+a,n));for(a=0;athis.length){var r=new Uint32Array(3*e);this.length&&(3*e=e&&delete this._combined[o]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}},e.prototype.fill=function(e){this._combined={},this._extendedAttrs={};for(var t=0;t=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0},e.prototype.copyCellsFrom=function(e,t,r,i,n){var o=e._data;if(n)for(var s=i-1;s>=0;s--)for(var a=0;a<3;a++)this._data[3*(r+s)+a]=o[3*(t+s)+a];else for(s=0;s=t&&(this._combined[l-t+r]=e._combined[l])}},e.prototype.translateToString=function(e,t,r){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===r&&(r=this.length),e&&(r=Math.min(r,this.getTrimmedLength()));for(var o="";t>22||1}return o},e}();t.BufferLine=a},4634:(e,t)=>{function r(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();var i=!e[t].hasContent(r-1)&&1===e[t].getWidth(r-1),n=2===e[t+1].getWidth(0);return i&&n?r-1:r}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,i,n,o){for(var s=[],a=0;a=a&&n0&&(S>u||0===h[S].getTrimmedLength());S--)b++;b>0&&(s.push(a+h.length-b),s.push(b)),a+=h.length-1}}}return s},t.reflowLargerCreateNewLayout=function(e,t){for(var r=[],i=0,n=t[i],o=0,s=0;sl&&(s-=l,a++);var h=2===e[a].getWidth(s-1);h&&s--;var u=h?i-1:i;n.push(u),c+=u}return n},t.getWrappedLineTrimmedLength=r},5295:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;var o=r(9092),s=r(8460),a=function(e){function t(t,r){var i=e.call(this)||this;return i._optionsService=t,i._bufferService=r,i._onBufferActivate=i.register(new s.EventEmitter),i.reset(),i}return n(t,e),Object.defineProperty(t.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this.setupTabStops()},Object.defineProperty(t.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),t.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},t.prototype.activateAltBuffer=function(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},t.prototype.resize=function(e,t){this._normal.resize(e,t),this._alt.resize(e,t)},t.prototype.setupTabStops=function(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)},t}(r(844).Disposable);t.BufferSet=a},511:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;var o=r(482),s=r(643),a=r(3734),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.content=0,t.fg=0,t.bg=0,t.extended=new a.ExtendedAttrs,t.combinedData="",t}return n(t,e),t.fromCharData=function(e){var r=new t;return r.setFromCharData(e),r},t.prototype.isCombined=function(){return 2097152&this.content},t.prototype.getWidth=function(){return this.content>>22},t.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?o.stringFromCodePoint(2097151&this.content):""},t.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},t.prototype.setFromCharData=function(e){this.fg=e[s.CHAR_DATA_ATTR_INDEX],this.bg=0;var t=!1;if(e[s.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[s.CHAR_DATA_CHAR_INDEX].length){var r=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=r&&r<=56319){var i=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(r-55296)+i-56320+65536|e[s.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[s.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[s.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[s.CHAR_DATA_WIDTH_INDEX]<<22)},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(a.AttributeData);t.CellData=c},643:(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_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=256,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,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},4863:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;var o=r(8460),s=function(e){function t(r){var i=e.call(this)||this;return i.line=r,i._id=t._nextId++,i.isDisposed=!1,i._onDispose=new o.EventEmitter,i}return n(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),e.prototype.dispose.call(this))},t._nextId=1,t}(r(844).Disposable);t.Marker=s},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1=t.C0=void 0,(i=t.C0||(t.C0={})).NUL="\0",i.SOH="",i.STX="",i.ETX="",i.EOT="",i.ENQ="",i.ACK="",i.BEL="",i.BS="\b",i.HT="\t",i.LF="\n",i.VT="\v",i.FF="\f",i.CR="\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL="",(r=t.C1||(t.C1={})).PAD="€",r.HOP="",r.BPH="‚",r.NBH="ƒ",r.IND="„",r.NEL="…",r.SSA="†",r.ESA="‡",r.HTS="ˆ",r.HTJ="‰",r.VTS="Š",r.PLD="‹",r.PLU="Œ",r.RI="",r.SS2="Ž",r.SS3="",r.DCS="",r.PU1="‘",r.PU2="’",r.STS="“",r.CCH="”",r.MW="•",r.SPA="–",r.EPA="—",r.SOS="˜",r.SGCI="™",r.SCI="š",r.CSI="›",r.ST="œ",r.OSC="",r.PM="ž",r.APC="Ÿ"},7399:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;var i=r(2584),n={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,r,o){var s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?s.key=t?i.C0.ESC+"OA":i.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?s.key=t?i.C0.ESC+"OD":i.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?s.key=t?i.C0.ESC+"OC":i.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(s.key=t?i.C0.ESC+"OB":i.C0.ESC+"[B");break;case 8:if(e.shiftKey){s.key=i.C0.BS;break}if(e.altKey){s.key=i.C0.ESC+i.C0.DEL;break}s.key=i.C0.DEL;break;case 9:if(e.shiftKey){s.key=i.C0.ESC+"[Z";break}s.key=i.C0.HT,s.cancel=!0;break;case 13:s.key=e.altKey?i.C0.ESC+i.C0.CR:i.C0.CR,s.cancel=!0;break;case 27:s.key=i.C0.ESC,e.altKey&&(s.key=i.C0.ESC+i.C0.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"D",s.key===i.C0.ESC+"[1;3D"&&(s.key=i.C0.ESC+(r?"b":"[1;5D"))):s.key=t?i.C0.ESC+"OD":i.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"C",s.key===i.C0.ESC+"[1;3C"&&(s.key=i.C0.ESC+(r?"f":"[1;5C"))):s.key=t?i.C0.ESC+"OC":i.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"A",r||s.key!==i.C0.ESC+"[1;3A"||(s.key=i.C0.ESC+"[1;5A")):s.key=t?i.C0.ESC+"OA":i.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(s.key=i.C0.ESC+"[1;"+(a+1)+"B",r||s.key!==i.C0.ESC+"[1;3B"||(s.key=i.C0.ESC+"[1;5B")):s.key=t?i.C0.ESC+"OB":i.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(s.key=i.C0.ESC+"[2~");break;case 46:s.key=a?i.C0.ESC+"[3;"+(a+1)+"~":i.C0.ESC+"[3~";break;case 36:s.key=a?i.C0.ESC+"[1;"+(a+1)+"H":t?i.C0.ESC+"OH":i.C0.ESC+"[H";break;case 35:s.key=a?i.C0.ESC+"[1;"+(a+1)+"F":t?i.C0.ESC+"OF":i.C0.ESC+"[F";break;case 33:e.shiftKey?s.type=2:s.key=i.C0.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:s.key=i.C0.ESC+"[6~";break;case 112:s.key=a?i.C0.ESC+"[1;"+(a+1)+"P":i.C0.ESC+"OP";break;case 113:s.key=a?i.C0.ESC+"[1;"+(a+1)+"Q":i.C0.ESC+"OQ";break;case 114:s.key=a?i.C0.ESC+"[1;"+(a+1)+"R":i.C0.ESC+"OR";break;case 115:s.key=a?i.C0.ESC+"[1;"+(a+1)+"S":i.C0.ESC+"OS";break;case 116:s.key=a?i.C0.ESC+"[15;"+(a+1)+"~":i.C0.ESC+"[15~";break;case 117:s.key=a?i.C0.ESC+"[17;"+(a+1)+"~":i.C0.ESC+"[17~";break;case 118:s.key=a?i.C0.ESC+"[18;"+(a+1)+"~":i.C0.ESC+"[18~";break;case 119:s.key=a?i.C0.ESC+"[19;"+(a+1)+"~":i.C0.ESC+"[19~";break;case 120:s.key=a?i.C0.ESC+"[20;"+(a+1)+"~":i.C0.ESC+"[20~";break;case 121:s.key=a?i.C0.ESC+"[21;"+(a+1)+"~":i.C0.ESC+"[21~";break;case 122:s.key=a?i.C0.ESC+"[23;"+(a+1)+"~":i.C0.ESC+"[23~";break;case 123:s.key=a?i.C0.ESC+"[24;"+(a+1)+"~":i.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(r&&!o||!e.altKey||e.metaKey)!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?s.key=e.key:e.key&&e.ctrlKey&&"_"===e.key&&(s.key=i.C0.US):65===e.keyCode&&(s.type=1);else{var c=n[e.keyCode],l=c&&c[e.shiftKey?1:0];if(l)s.key=i.C0.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){var h=e.ctrlKey?e.keyCode-64:e.keyCode+32;s.key=i.C0.ESC+String.fromCharCode(h)}}else e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?s.key=i.C0.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?s.key=i.C0.DEL:219===e.keyCode?s.key=i.C0.ESC:220===e.keyCode?s.key=i.C0.FS:221===e.keyCode&&(s.key=i.C0.GS)}return s}},482:(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,r){void 0===t&&(t=0),void 0===r&&(r=e.length);for(var i="",n=t;n65535?(o-=65536,i+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i};var r=function(){function e(){this._interim=0}return e.prototype.clear=function(){this._interim=0},e.prototype.decode=function(e,t){var r=e.length;if(!r)return 0;var i=0,n=0;this._interim&&(56320<=(a=e.charCodeAt(n++))&&a<=57343?t[i++]=1024*(this._interim-55296)+a-56320+65536:(t[i++]=this._interim,t[i++]=a),this._interim=0);for(var o=n;o=r)return this._interim=s,i;var a;56320<=(a=e.charCodeAt(o))&&a<=57343?t[i++]=1024*(s-55296)+a-56320+65536:(t[i++]=s,t[i++]=a)}else 65279!==s&&(t[i++]=s)}return i},e}();t.StringToUtf32=r;var i=function(){function e(){this.interim=new Uint8Array(3)}return e.prototype.clear=function(){this.interim.fill(0)},e.prototype.decode=function(e,t){var r=e.length;if(!r)return 0;var i,n,o,s,a=0,c=0,l=0;if(this.interim[0]){var h=!1,u=this.interim[0];u&=192==(224&u)?31:224==(240&u)?15:7;for(var f=0,_=void 0;(_=63&this.interim[++f])&&f<4;)u<<=6,u|=_;for(var d=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,p=d-f;l=r)return 0;if(128!=(192&(_=e[l++]))){l--,h=!0;break}this.interim[f++]=_,u<<=6,u|=63&_}h||(2===d?u<128?l--:t[a++]=u:3===d?u<2048||u>=55296&&u<=57343||65279===u||(t[a++]=u):u<65536||u>1114111||(t[a++]=u)),this.interim.fill(0)}for(var v=r-4,g=l;g=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if((c=(31&i)<<6|63&n)<128){g--;continue}t[a++]=c}else if(224==(240&i)){if(g>=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,a;if(128!=(192&(o=e[g++]))){g--;continue}if((c=(15&i)<<12|(63&n)<<6|63&o)<2048||c>=55296&&c<=57343||65279===c)continue;t[a++]=c}else if(240==(248&i)){if(g>=r)return this.interim[0]=i,a;if(128!=(192&(n=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,a;if(128!=(192&(o=e[g++]))){g--;continue}if(g>=r)return this.interim[0]=i,this.interim[1]=n,this.interim[2]=o,a;if(128!=(192&(s=e[g++]))){g--;continue}if((c=(7&i)<<18|(63&n)<<12|(63&o)<<6|63&s)<65536||c>1114111)continue;t[a++]=c}}return a},e}();t.Utf8ToUtf32=i},225:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;var i,n=r(8273),o=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],a=function(){function e(){if(this.version="6",!i){i=new Uint8Array(65536),n.fill(i,1),i[0]=0,n.fill(i,0,1,32),n.fill(i,0,127,160),n.fill(i,2,4352,4448),i[9001]=2,i[9002]=2,n.fill(i,2,11904,42192),i[12351]=1,n.fill(i,2,44032,55204),n.fill(i,2,63744,64256),n.fill(i,2,65040,65050),n.fill(i,2,65072,65136),n.fill(i,2,65280,65377),n.fill(i,2,65504,65511);for(var e=0;et[n][1])return!1;for(;n>=i;)if(e>t[r=i+n>>1][1])i=r+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1},e}();t.UnicodeV6=a},5981:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;var r=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return e.prototype.writeSync=function(e){if(this._writeBuffer.length){for(var t=this._bufferOffset;t5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout((function(){return r._innerWrite()}))),this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)},e.prototype._innerWrite=function(){for(var e=this,t=Date.now();this._writeBuffer.length>this._bufferOffset;){var r=this._writeBuffer[this._bufferOffset],i=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(r),this._pendingData-=r.length,i&&i(),Date.now()-t>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((function(){return e._innerWrite()}),0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=r},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;var i=r(482),n=r(8742),o=r(5770),s=[],a=function(){function e(){this._handlers=Object.create(null),this._active=s,this._ident=0,this._handlerFb=function(){}}return e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=s},e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var r=this._handlers[e];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=s,this._ident=0},e.prototype.hook=function(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||s,this._active.length)for(var r=this._active.length-1;r>=0;r--)this._active[r].hook(t);else this._handlerFb(this._ident,"HOOK",t)},e.prototype.put=function(e,t,r){if(this._active.length)for(var n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r);else this._handlerFb(this._ident,"PUT",i.utf32ToString(e,t,r))},e.prototype.unhook=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].unhook(e);t--);for(t--;t>=0;t--)this._active[t].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",e);this._active=s,this._ident=0},e}();t.DcsParser=a;var c=new n.Params;c.addParam(0);var l=function(){function e(e){this._handler=e,this._data="",this._params=c,this._hitLimit=!1}return e.prototype.hook=function(e){this._params=e.length>1||e.params[0]?e.clone():c,this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,r){this._hitLimit||(this._data+=i.utf32ToString(e,t,r),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data,this._params)),this._params=c,this._data="",this._hitLimit=!1,t},e}();t.DcsHandler=l},2015:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;var o=r(844),s=r(8273),a=r(8742),c=r(6242),l=r(6351),h=function(){function e(e){this.table=new Uint8Array(e)}return e.prototype.setDefault=function(e,t){s.fill(this.table,e<<4|t)},e.prototype.add=function(e,t,r,i){this.table[t<<8|e]=r<<4|i},e.prototype.addMany=function(e,t,r,i){for(var n=0;n1)throw new Error("only one byte as prefix supported");if((r=e.prefix.charCodeAt(0))&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var i=0;in||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(1!==e.final.length)throw new Error("final must be a single byte");var o=e.final.charCodeAt(0);if(t[0]>o||o>t[1])throw new Error("final must be in range "+t[0]+" .. "+t[1]);return(r<<=8)|o},r.prototype.identToString=function(e){for(var t=[];e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")},r.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},r.prototype.setPrintHandler=function(e){this._printHandler=e},r.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},r.prototype.registerEscHandler=function(e,t){var r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);var i=this._escHandlers[r];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},r.prototype.clearEscHandler=function(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]},r.prototype.setEscHandlerFallback=function(e){this._escHandlerFb=e},r.prototype.setExecuteHandler=function(e,t){this._executeHandlers[e.charCodeAt(0)]=t},r.prototype.clearExecuteHandler=function(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]},r.prototype.setExecuteHandlerFallback=function(e){this._executeHandlerFb=e},r.prototype.registerCsiHandler=function(e,t){var r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);var i=this._csiHandlers[r];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},r.prototype.clearCsiHandler=function(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]},r.prototype.setCsiHandlerFallback=function(e){this._csiHandlerFb=e},r.prototype.registerDcsHandler=function(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)},r.prototype.clearDcsHandler=function(e){this._dcsParser.clearHandler(this._identifier(e))},r.prototype.setDcsHandlerFallback=function(e){this._dcsParser.setHandlerFallback(e)},r.prototype.registerOscHandler=function(e,t){return this._oscParser.registerHandler(e,t)},r.prototype.clearOscHandler=function(e){this._oscParser.clearHandler(e)},r.prototype.setOscHandlerFallback=function(e){this._oscParser.setHandlerFallback(e)},r.prototype.setErrorHandler=function(e){this._errorHandler=e},r.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},r.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},r.prototype.parse=function(e,t){for(var r=0,i=0,n=this.currentState,o=this._oscParser,s=this._dcsParser,a=this._collect,c=this._params,l=this._transitions.table,h=0;h>4){case 2:for(var f=h+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=t||(r=e[f])<32||r>126&&r=0&&!_[d](c);d--);d<0&&this._csiHandlerFb(a<<8|r,c),this.precedingCodepoint=0;break;case 8:do{switch(r){case 59:c.addParam(0);break;case 58:c.addSubParam(-1);break;default:c.addDigit(r-48)}}while(++h47&&r<60);h--;break;case 9:a<<=8,a|=r;break;case 10:for(var p=this._escHandlers[a<<8|r],v=p?p.length-1:-1;v>=0&&!p[v]();v--);v<0&&this._escHandlerFb(a<<8|r),this.precedingCodepoint=0;break;case 11:c.reset(),c.addParam(0),a=0;break;case 12:s.hook(a<<8|r,c);break;case 13:for(var g=h+1;;++g)if(g>=t||24===(r=e[g])||26===r||27===r||r>127&&r=t||(r=e[y])<32||r>127&&r{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;var i=r(5770),n=r(482),o=[],s=function(){function e(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var r=this._handlers[e];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=o},e.prototype.reset=function(){2===this._state&&this.end(!1),this._active=o,this._id=-1,this._state=0},e.prototype._start=function(){if(this._active=this._handlers[this._id]||o,this._active.length)for(var e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")},e.prototype._put=function(e,t,r){if(this._active.length)for(var i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r);else this._handlerFb(this._id,"PUT",n.utf32ToString(e,t,r))},e.prototype._end=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].end(e);t--);for(t--;t>=0;t--)this._active[t].end(!1)}else this._handlerFb(this._id,"END",e)},e.prototype.start=function(){this.reset(),this._state=1},e.prototype.put=function(e,t,r){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,r)}},e.prototype.end=function(e){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),this._end(e)),this._active=o,this._id=-1,this._state=0)},e}();t.OscParser=s;var a=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.start=function(){this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,r){this._hitLimit||(this._data+=n.utf32ToString(e,t,r),this._data.length>i.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data)),this._data="",this._hitLimit=!1,t},e}();t.OscHandler=a},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;var r=2147483647,i=function(){function e(e,t){if(void 0===e&&(e=32),void 0===t&&(t=32),this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return e.fromArray=function(t){var r=new e;if(!t.length)return r;for(var i=t[0]instanceof Array?1:0;i>8,i=255&this._subParamsIdx[t];i-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,i))}return e},e.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},e.prototype.addParam=function(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>r?r:e}},e.prototype.addSubParam=function(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>r?r:e,this._subParamsIdx[this.length-1]++}},e.prototype.hasSubParams=function(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0},e.prototype.getSubParams=function(e){var t=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-t>0?this._subParams.subarray(t,r):null},e.prototype.getSubParamsAll=function(){for(var e={},t=0;t>8,i=255&this._subParamsIdx[t];i-r>0&&(e[t]=this._subParams.slice(r,i))}return e},e.prototype.addDigit=function(e){var t;if(!(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var i=this._digitIsSub?this._subParams:this.params,n=i[t-1];i[t-1]=~n?Math.min(10*n+e,r):e}},e}();t.Params=i},744:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;var a=r(2585),c=r(5295),l=r(8460),h=r(844);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;var u=function(e){function r(r){var i=e.call(this)||this;return i._optionsService=r,i.isUserScrolling=!1,i._onResize=new l.EventEmitter,i.cols=Math.max(r.options.cols,t.MINIMUM_COLS),i.rows=Math.max(r.options.rows,t.MINIMUM_ROWS),i.buffers=new c.BufferSet(r,i),i}return n(r,e),Object.defineProperty(r.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),r.prototype.dispose=function(){e.prototype.dispose.call(this),this.buffers.dispose()},r.prototype.resize=function(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:t})},r.prototype.reset=function(){this.buffers.reset(),this.isUserScrolling=!1},o([s(0,a.IOptionsService)],r)}(h.Disposable);t.BufferService=u},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0;var r=function(){function e(){this.glevel=0,this._charsets=[]}return e.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},e.prototype.setgLevel=function(e){this.glevel=e,this.charset=this._charsets[e]},e.prototype.setgCharset=function(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)},e}();t.CharsetService=r},1753:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;var o=r(2585),s=r(8460),a={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(e){return 4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)}},VT200:{events:19,restrict:function(e){return 32!==e.action}},DRAG:{events:23,restrict:function(e){return 32!==e.action||3!==e.button}},ANY:{events:31,restrict:function(e){return!0}}};function c(e,t){var r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||t||(r|=3)),r}var l=String.fromCharCode,h={DEFAULT:function(e){var t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":""+l(t[0])+l(t[1])+l(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"[<"+c(e,!0)+";"+e.col+";"+e.row+t}},u=function(){function e(e,t){this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new s.EventEmitter,this._lastEvent=null;for(var r=0,i=Object.keys(a);r=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._compareEvents(this._lastEvent,e))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;var t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0},e.prototype.explainEvents=function(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}},e.prototype._compareEvents=function(e,t){return e.col===t.col&&e.row===t.row&&e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift},i([n(0,o.IBufferService),n(1,o.ICoreService)],e)}();t.CoreMouseService=u},6975:function(e,t,r){var i,n=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;var a=r(2585),c=r(8460),l=r(1439),h=r(844),u=Object.freeze({insertMode:!1}),f=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),_=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o._bufferService=r,o._logService=i,o._optionsService=n,o.isCursorInitialized=!1,o.isCursorHidden=!1,o._onData=o.register(new c.EventEmitter),o._onUserInput=o.register(new c.EventEmitter),o._onBinary=o.register(new c.EventEmitter),o._scrollToBottom=t,o.register({dispose:function(){return o._scrollToBottom=void 0}}),o.modes=l.clone(u),o.decPrivateModes=l.clone(f),o}return n(t,e),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.modes=l.clone(u),this.decPrivateModes=l.clone(f)},t.prototype.triggerDataEvent=function(e,t){if(void 0===t&&(t=!1),!this._optionsService.options.disableStdin){var r=this._bufferService.buffer;r.ybase!==r.ydisp&&this._scrollToBottom(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onData.fire(e)}},t.prototype.triggerBinaryEvent=function(e){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onBinary.fire(e))},o([s(1,a.IBufferService),s(2,a.ILogService),s(3,a.IOptionsService)],t)}(h.Disposable);t.CoreService=_},3730:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirtyRowService=void 0;var o=r(2585),s=function(){function e(e){this._bufferService=e,this.clearRange()}return Object.defineProperty(e.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),e.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},e.prototype.markDirty=function(e){ethis._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var r=e;e=t,t=r}ethis._end&&(this._end=t)},e.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},i([n(0,o.IBufferService)],e)}();t.DirtyRowService=s},4348:function(e,t,r){var i=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t0?n[0].index:t.length;if(t.length!==u)throw new Error("[createInstance] First service dependency of "+e.name+" at position "+(u+1)+" conflicts with "+t.length+" static arguments");return new(e.bind.apply(e,i([void 0],i(t,s))))},e}();t.InstantiationService=a},7866:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__param||function(e,t){return function(r,i){t(r,i,e)}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=t.DEFAULT_BELL_SOUND=void 0;var i=r(8460),n=r(6114),o=r(1439);t.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",t.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:t.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1});var s=["normal","bold","100","200","300","400","500","600","700","800","900"],a=["cols","rows"],c=function(){function e(e){this._onOptionChange=new i.EventEmitter,this.options=o.clone(t.DEFAULT_OPTIONS);for(var r=0,n=Object.keys(e);r{function r(e,t,r){t.di$target===t?t.di$dependencies.push({id:e,index:r}):(t.di$dependencies=[{id:e,index:r}],t.di$target=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0,t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e.di$dependencies||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);var i=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");r(i,e,n)};return i.toString=function(){return e},t.serviceRegistry.set(e,i),i}},2585:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IUnicodeService=t.IOptionsService=t.ILogService=t.IInstantiationService=t.IDirtyRowService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;var i=r(8343);t.IBufferService=i.createDecorator("BufferService"),t.ICoreMouseService=i.createDecorator("CoreMouseService"),t.ICoreService=i.createDecorator("CoreService"),t.ICharsetService=i.createDecorator("CharsetService"),t.IDirtyRowService=i.createDecorator("DirtyRowService"),t.IInstantiationService=i.createDecorator("InstantiationService"),t.ILogService=i.createDecorator("LogService"),t.IOptionsService=i.createDecorator("OptionsService"),t.IUnicodeService=i.createDecorator("UnicodeService")},1480:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;var i=r(8460),n=r(225),o=function(){function e(){this._providers=Object.create(null),this._active="",this._onChange=new i.EventEmitter;var e=new n.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}return Object.defineProperty(e.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._active},set:function(e){if(!this._providers[e])throw new Error('unknown Unicode version "'+e+'"');this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)},enumerable:!1,configurable:!0}),e.prototype.register=function(e){this._providers[e.version]=e},e.prototype.wcwidth=function(e){return this._activeProvider.wcwidth(e)},e.prototype.getStringCellWidth=function(e){for(var t=0,r=e.length,i=0;i=r)return t+this.wcwidth(n);var o=e.charCodeAt(i);56320<=o&&o<=57343?n=1024*(n-55296)+o-56320+65536:t+=this.wcwidth(o)}t+=this.wcwidth(n)}return t},e}();t.UnicodeService=o}},t={};return function r(i){if(t[i])return t[i].exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}(4389)})()})); +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(self,(function(){return(()=>{"use strict";var e={4567:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const s=i(9042),r=i(6114),n=i(9924),o=i(3656),a=i(844),h=i(5596),c=i(9631);class l extends a.Disposable{constructor(e,t){super(),this._terminal=e,this._renderService=t,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityTreeRoot=document.createElement("div"),this._accessibilityTreeRoot.classList.add("xterm-accessibility"),this._accessibilityTreeRoot.tabIndex=0,this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityTreeRoot.appendChild(this._rowContainer),this._renderRowsDebouncer=new n.TimeBasedDebouncer(this._renderRows.bind(this)),this._refreshRows(),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityTreeRoot.appendChild(this._liveRegion),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityTreeRoot),this.register(this._renderRowsDebouncer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar("\n")))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new h.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,o.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this.register((0,a.toDisposable)((()=>{(0,c.removeElementFromParent)(this._accessibilityTreeRoot),this._rowElements.length=0})))}_handleBoundaryFocus(e,t){const i=e.target,s=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")===(0===t?"1":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==s)return;let r,n;if(0===t?(r=i,n=this._rowElements.pop(),this._rowContainer.removeChild(n)):(r=this._rowElements.shift(),n=i,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),n.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=s.tooMuchOutput)),r.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityTreeRoot.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,r.isMac&&(0,c.removeElementFromParent)(this._liveRegion)}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){const e=i.translateBufferLineToString(i.ydisp+r,!0),t=(i.ydisp+r+1).toString(),n=this._rowElements[r];n&&(0===e.length?n.innerText=" ":n.textContent=e,n.setAttribute("aria-posinset",t),n.setAttribute("aria-setsize",s))}this._announceCharacters()}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityTreeRoot.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{function i(e){return e.replace(/\r?\n/g,"\r")}function s(e,t){return t?"[200~"+e+"[201~":e}function r(e,t,r){e=s(e=i(e),r.decPrivateModes.bracketedPasteMode),r.triggerDataEvent(e,!0),t.value=""}function n(e,t,i){const s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=i,t.bracketTextForPaste=s,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i){e.stopPropagation(),e.clipboardData&&r(e.clipboardData.getData("text/plain"),t,i)},t.paste=r,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(e,t,i,s,r){n(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}},7239:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const s=i(1505);t.ColorContrastCache=class{constructor(){this._color=new s.TwoKeyMap,this._css=new s.TwoKeyMap}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},9631:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(...e){var t;for(const i of e)null===(t=null==i?void 0:i.parentElement)||void 0===t||t.removeChild(i)}},3656:(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))}}}},6465:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;const n=i(2585),o=i(8460),a=i(844),h=i(3656);let c=class extends a.Disposable{constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,a.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,a.toDisposable)((()=>{this._lastMouseEvent=void 0})))}get currentLink(){return this._currentLink}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const t=this._linkProviders.indexOf(e);-1!==t&&this._linkProviders.splice(t,1)}}}attachToDom(e,t,i){this._element=e,this._mouseService=t,this._renderService=i,this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const i=e.composedPath();for(let e=0;e{null==e||e.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(const[i,n]of this._linkProviders.entries())t?(null===(s=this._activeProviderReplies)||void 0===s?void 0:s.get(i))&&(r=this._checkLinkProviderResult(i,e,r)):n.provideLinks(e.y,(t=>{var s,n;if(this._isMouseOut)return;const o=null==t?void 0:t.map((e=>({link:e})));null===(s=this._activeProviderReplies)||void 0===s||s.set(i,o),r=this._checkLinkProviderResult(i,e,r),(null===(n=this._activeProviderReplies)||void 0===n?void 0:n.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){const i=new Set;for(let s=0;se?this._bufferService.cols:s.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){r.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){var s;if(!this._activeProviderReplies)return i;const r=this._activeProviderReplies.get(e);let n=!1;for(let t=0;tthis._linkAtPosition(e.link,t)));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviders.length&&!i)for(let e=0;ethis._linkAtPosition(e.link,t)));if(r){i=!0,this._handleNewLink(r);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,a.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var e,t;return null===(t=null===(e=this._currentLink)||void 0===e?void 0:e.state)||void 0===t?void 0:t.decorations.pointerCursor},set:e=>{var t,i;(null===(t=this._currentLink)||void 0===t?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&(null===(i=this._element)||void 0===i||i.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:()=>{var e,t;return null===(t=null===(e=this._currentLink)||void 0===e?void 0:e.state)||void 0===t?void 0:t.decorations.underline},set:t=>{var i,s,r;(null===(i=this._currentLink)||void 0===i?void 0:i.state)&&(null===(r=null===(s=this._currentLink)||void 0===s?void 0:s.state)||void 0===r?void 0:r.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._currentLink?this._lastMouseEvent:void 0;if(this._clearCurrentLink(t,e.end+1+this._bufferService.buffer.ydisp),i&&this._element){const e=this._positionFromMouseEvent(i,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,i){var s;(null===(s=this._currentLink)||void 0===s?void 0:s.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){const i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){var s;(null===(s=this._currentLink)||void 0===s?void 0:s.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){const i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){const s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};c=s([r(0,n.IBufferService)],c),t.Linkifier2=c},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=i(511),o=i(2585);let a=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var i;const s=this._bufferService.buffer.lines.get(e-1);if(!s)return void t(void 0);const r=[],o=this._optionsService.rawOptions.linkHandler,a=new n.CellData,c=s.getTrimmedLength();let l=-1,d=-1,_=!1;for(let t=0;to?o.activate(e,t,i):h(0,t),hover:(e,t)=>{var s;return null===(s=null==o?void 0:o.hover)||void 0===s?void 0:s.call(o,e,t,i)},leave:(e,t)=>{var s;return null===(s=null==o?void 0:o.leave)||void 0===s?void 0:s.call(o,e,t,i)}})}_=!1,a.hasExtendedAttrs()&&a.extended.urlId?(d=t,l=a.extended.urlId):(d=-1,l=-1)}}t(r)}};function h(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){const e=window.open();if(e){try{e.opener=null}catch(e){}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}a=s([r(0,o.IBufferService),r(1,o.IOptionsService),r(2,o.IOscLinkService)],a),t.OscLinkProvider=a},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._parentWindow=e,this._renderCallback=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},5596:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;const s=i(844);class r extends s.Disposable{constructor(e){super(),this._parentWindow=e,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,s.toDisposable)((()=>{this.clearListener()})))}setListener(e){this._listener&&this.clearListener(),this._listener=e,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}t.ScreenDprMonitor=r},3236:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const s=i(2950),r=i(1680),n=i(3614),o=i(2584),a=i(5435),h=i(9312),c=i(6114),l=i(3656),d=i(9042),_=i(4567),u=i(1296),f=i(7399),v=i(8460),g=i(8437),p=i(3230),S=i(4725),m=i(428),C=i(8934),b=i(6465),y=i(5114),w=i(8969),E=i(8055),L=i(4269),k=i(5941),R=i(3107),D=i(5744),A=i(9074),x=i(2585),B=i(3730),T=i(844),M=i(6731),O="undefined"!=typeof window?window.document:null;class I extends w.CoreTerminal{constructor(e={}){super(e),this.browser=c,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._onCursorMove=this.register(new v.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new v.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new v.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new v.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new v.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new v.EventEmitter),this._onBlur=this.register(new v.EventEmitter),this._onA11yCharEmitter=this.register(new v.EventEmitter),this._onA11yTabEmitter=this.register(new v.EventEmitter),this._onWillOpen=this.register(new v.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(b.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(B.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(x.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,v.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,v.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,v.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,v.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,T.toDisposable)((()=>{var e,t;this._customKeyEventHandler=void 0,null===(t=null===(e=this.element)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.element)})))}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,i="";switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:const s=E.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${o.C0.ESC}]${i};${(0,k.toRgbString)(s)}${o.C1_ESCAPED.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors((e=>e.ansi[t.index]=E.rgba.toColor(...t.color)));else{const i=e;this._themeService.modifyColors((e=>e[i]=E.rgba.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){var t;e?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new _.AccessibilityManager(this,this._renderService)):(null===(t=this._accessibilityManager)||void 0===t||t.dispose(),this._accessibilityManager=void 0)}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(o.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(o.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",(e=>{this.hasSelection()&&(0,n.copyHandler)(e,this._selectionService)})));const e=e=>(0,n.handlePasteEvent)(e,this.textarea,this.coreService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",e)),this.register((0,l.addDisposableDomListener)(this.element,"paste",e)),c.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(e=>{2===e.button&&(0,n.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",(e=>{(0,n.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),c.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",(e=>{1===e.button&&(0,n.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",(e=>this._keyUp(e)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",(e=>this._keyDown(e)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",(e=>this._keyPress(e)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,l.addDisposableDomListener)(this.textarea,"input",(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){var t;if(!e)throw new Error("Terminal requires a parent element.");e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),e.appendChild(this.element);const i=O.createDocumentFragment();this._viewportElement=O.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this._viewportScrollArea=O.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=O.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=O.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement),this.textarea=O.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),c.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this._instantiationService.createInstance(y.CoreBrowserService,this.textarea,null!==(t=this._document.defaultView)&&void 0!==t?t:window),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",(e=>this._handleTextAreaFocus(e)))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(m.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(M.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(L.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(p.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=O.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch(e){}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(C.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(r.Viewport,(e=>this.scrollLines(e,!0,1)),this._viewportElement,this._viewportScrollArea),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(h.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(R.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new _.AccessibilityManager(this,this._renderService)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(D.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(D.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(u.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const e=this,t=this.element;function i(t){const i=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!i)return!1;let s,r;switch(t.overrideType||t.type){case"mousemove":r=32,void 0===t.buttons?(s=3,void 0!==t.button&&(s=t.button<3?t.button:3)):s=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":r=0,s=t.button<3?t.button:3;break;case"mousedown":r=1,s=t.button<3?t.button:3;break;case"wheel":if(0===e.viewport.getLinesScrolled(t))return!1;r=t.deltaY<0?0:1,s=4;break;default:return!1}return!(void 0===r||void 0===s||s>4)&&e.coreMouseService.triggerMouseEvent({col:i.col,row:i.row,x:i.x,y:i.y,button:s,action:r,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:e=>(i(e),e.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(e)),wheel:e=>(i(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&i(e)},mousemove:e=>{e.buttons||i(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(t,"mousedown",(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return i(e),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(e)}))),this.register((0,l.addDisposableDomListener)(t,"wheel",(e=>{if(!s.wheel){if(!this.buffer.hasScrollback){const t=this.viewport.getLinesScrolled(e);if(0===t)return;const i=o.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(e.deltaY<0?"A":"B");let s="";for(let e=0;e{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,l.addDisposableDomListener)(t,"touchmove",(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){var i;null===(i=this._renderService)||void 0===i||i.refreshRows(e,t)}updateCursorStyle(e){var t;(null===(t=this._selectionService)||void 0===t?void 0:t.shouldColumnSelect(e))?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,i=0){super.scrollLines(e,t,i),this.refresh(0,this.rows-1)}paste(e){(0,n.paste)(e,this.textarea,this.coreService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}registerLinkProvider(e){return this.linkifier2.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}addMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;null===(e=this._selectionService)||void 0===e||e.clearSelection()}selectAll(){var e;null===(e=this._selectionService)||void 0===e||e.selectAll()}selectLines(e,t){var i;null===(i=this._selectionService)||void 0===i||i.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this._bufferService.scrollToBottom(),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const i=(0,f.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===i.type||2===i.type){const t=this.rows-1;return this.scrollLines(2===i.type?-t:t),this.cancel(e,!0)}return 1===i.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(i.key!==o.C0.ETX&&i.key!==o.C0.CR||(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){const i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var i,s;null===(i=this._charSizeService)||void 0===i||i.measure(),null===(s=this.viewport)||void 0===s||s.syncScrollArea(!0)}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=i(844),o=i(3656),a=i(4725),h=i(2585);let c=class extends n.Disposable{constructor(e,t,i,s,r,n,a,h,c){super(),this._scrollLines=e,this._viewportElement=t,this._scrollArea=i,this._bufferService=s,this._optionsService=r,this._charSizeService=n,this._renderService=a,this._coreBrowserService=h,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(c.colors),this.register(c.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()),0)}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}_refresh(e){if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._scrollLines(0);const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t)}_smoothScroll(){if(this._isDisposed||-1===this._smoothScrollState.origin||-1===this._smoothScrollState.target)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){const i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&i0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){const i=this._optionsService.rawOptions.fastScrollModifier;return"alt"===i&&t.altKey||"ctrl"===i&&t.ctrlKey||"shift"===i&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){const t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};c=s([r(3,h.IBufferService),r(4,h.IOptionsService),r(5,a.ICharSizeService),r(6,a.IRenderService),r(7,a.ICoreBrowserService),r(8,a.IThemeService)],c),t.Viewport=c},3107:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=i(3656),o=i(4725),a=i(844),h=i(2585);let c=class extends a.Disposable{constructor(e,t,i,s){super(),this._screenElement=e,this._bufferService=t,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register((0,n.addDisposableDomListener)(window,"resize",(()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,a.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var t;const i=document.createElement("div");i.classList.add("xterm-decoration"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const s=null!==(t=e.options.x)&&void 0!==t?t:0;return s&&s>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){const t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i)),i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){var i;if(!t)return;const s=null!==(i=e.options.x)&&void 0!==i?i:0;"right"===(e.options.anchor||"left")?t.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=s?s*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var t;null===(t=this._decorationElements.get(e))||void 0===t||t.remove(),this._decorationElements.delete(e),e.dispose()}};c=s([r(1,h.IBufferService),r(2,h.IDecorationService),r(3,o.IRenderService)],c),t.BufferDecorationRenderer=c},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(const t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=i(5871),o=i(3656),a=i(4725),h=i(844),c=i(2585),l={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0};let u=class extends h.Disposable{constructor(e,t,i,s,r,o,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=o,this._coreBrowseService=a,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),null===(c=this._viewportElement.parentElement)||void 0===c||c.insertBefore(this._canvas,this._viewportElement);const l=this._canvas.getContext("2d");if(!l)throw new Error("Ctx cannot be null");this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,h.toDisposable)((()=>{var e;null===(e=this._canvas)||void 0===e||e.remove()})))}get _width(){return this._optionsService.options.overviewRulerWidth||0}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register((0,o.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=e,d.center=t,d.right=e,this._refreshDrawHeightConstants(),_.full=0,_.left=0,_.center=d.left,_.right=d.left+d.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowseService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowseService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;const e=this._colorZoneStore.zones;for(const t of e)"full"!==t.position&&this._renderColorZone(t);for(const t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(_[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||"full"]/2),d[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};u=s([r(2,c.IBufferService),r(3,c.IDecorationService),r(4,a.IRenderService),r(5,c.IOptionsService),r(6,a.ICoreBrowserService)],u),t.OverviewRulerRenderer=u},2950:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=i(4725),o=i(2585),a=i(2584);let h=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.lengththis.updateCompositionElements(!0)),0)}}};h=s([r(2,o.IBufferService),r(3,o.IOptionsService),r(4,o.ICoreService),r(5,n.IRenderService)],h),t.CompositionHelper=h},9806:(e,t)=>{function i(e,t,i){const s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=i,t.getCoords=function(e,t,s,r,n,o,a,h,c){if(!o)return;const l=i(e,t,s);return l?(l[0]=Math.ceil((l[0]+(c?a/2:0))/a),l[1]=Math.ceil(l[1]/h),l[0]=Math.min(Math.max(l[0],1),r+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),n),l):void 0}},9504:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const s=i(2584);function r(e,t,i,s){const r=e-n(e,i),a=t-n(t,i),l=Math.abs(r-a)-function(e,t,i){let s=0;const r=e-n(e,i),a=t-n(t,i);for(let n=0;n=0&&et?"A":"B"}function a(e,t,i,s,r,n){let o=e,a=t,h="";for(;o!==i||a!==s;)o+=r?1:-1,r&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(h+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return h+n.buffer.translateBufferLineToString(a,!1,e,o)}function h(e,t){const i=t?"O":"[";return s.C0.ESC+i+e}function c(e,t){e=Math.floor(e);let i="";for(let s=0;s0?s-n(s,o):t;const _=s,u=function(e,t,i,s,o,a){let h;return h=r(i,s,o,a).length>0?s-n(s,o):t,e=i&&he?"D":"C",c(Math.abs(o-e),h(d,s));d=l>t?"D":"C";const _=Math.abs(l-t);return c(function(e,t){return t.cols-e}(l>t?e:o,i)+(_-1)*i.cols+1+((l>t?o:e)-1),h(d,s))}},1296:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=i(9631),o=i(3787),a=i(2223),h=i(6171),c=i(4725),l=i(8055),d=i(8460),_=i(844),u=i(2585),f="xterm-dom-renderer-owner-",v="xterm-focus";let g=1,p=class extends _.Disposable{constructor(e,t,i,s,r,a,c,l,u,v){super(),this._element=e,this._screenElement=t,this._viewportElement=i,this._linkifier2=s,this._charSizeService=a,this._optionsService=c,this._bufferService=l,this._coreBrowserService=u,this._terminalClass=g++,this._rowElements=[],this._cellToRowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add("xterm-rows"),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add("xterm-selection"),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,h.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(v.onChangeColors((e=>this._injectCss(e)))),this._injectCss(v.colors),this._rowFactory=r.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(f+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,_.toDisposable)((()=>{this._element.classList.remove(f+this._terminalClass),(0,n.removeElementFromParent)(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement)})))}_updateDimensions(){const e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const t=`${this._terminalSelector} .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: ${this.dimensions.css.cell.width}px}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .xterm-rows { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px;}`;t+=`${this._terminalSelector} span:not(.${o.BOLD_CLASS}) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.${o.BOLD_CLASS} { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.${o.ITALIC_CLASS} { font-style: italic;}`,t+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",t+="@keyframes blink_block_"+this._terminalClass+" { 0% {"+` background-color: ${e.cursor.css};`+` color: ${e.cursorAccent.css}; } 50% {`+` background-color: ${e.cursorAccent.css};`+` color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .xterm-rows:not(.xterm-focus) .${o.CURSOR_CLASS}.${o.CURSOR_STYLE_BLOCK_CLASS} { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows.xterm-focus .${o.CURSOR_CLASS}.${o.CURSOR_BLINK_CLASS}:not(.${o.CURSOR_STYLE_BLOCK_CLASS}) { animation: blink_box_shadow_`+this._terminalClass+" 1s step-end infinite;}"+`${this._terminalSelector} .xterm-rows.xterm-focus .${o.CURSOR_CLASS}.${o.CURSOR_BLINK_CLASS}.${o.CURSOR_STYLE_BLOCK_CLASS} { animation: blink_block_`+this._terminalClass+" 1s step-end infinite;}"+`${this._terminalSelector} .xterm-rows.xterm-focus .${o.CURSOR_CLASS}.${o.CURSOR_STYLE_BLOCK_CLASS} {`+` background-color: ${e.cursor.css};`+` color: ${e.cursorAccent.css};}`+`${this._terminalSelector} .xterm-rows .${o.CURSOR_CLASS}.${o.CURSOR_STYLE_BAR_CLASS} {`+` box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}`+`${this._terminalSelector} .xterm-rows .${o.CURSOR_CLASS}.${o.CURSOR_STYLE_UNDERLINE_CLASS} {`+` box-shadow: 0 -1px 0 ${e.cursor.css} inset;}`,t+=`${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[i,s]of e.ansi.entries())t+=`${this._terminalSelector} .xterm-fg-${i} { color: ${s.css}; }${this._terminalSelector} .xterm-bg-${i} { background-color: ${s.css}; }`;t+=`${this._terminalSelector} .xterm-fg-${a.INVERTED_DEFAULT_COLOR} { color: ${l.color.opaque(e.background).css}; }${this._terminalSelector} .xterm-bg-${a.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}handleDevicePixelRatioChange(){this._updateDimensions()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){const e=document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions()}handleBlur(){this._rowContainer.classList.remove(v)}handleFocus(){this._rowContainer.classList.add(v)}handleSelectionChanged(e,t,i){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;const s=e[1]-this._bufferService.buffer.ydisp,r=t[1]-this._bufferService.buffer.ydisp,n=Math.max(s,0),o=Math.min(r,this._bufferService.rows-1);if(n>=this._bufferService.rows||o<0)return;const a=document.createDocumentFragment();if(i){const i=e[0]>t[0];a.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],o-n+1))}else{const i=s===n?e[0]:0,h=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,i,h));const c=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,c)),n!==o){const e=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){const r=document.createElement("div");return r.style.height=s*this.dimensions.css.cell.height+"px",r.style.top=e*this.dimensions.css.cell.height+"px",r.style.left=t*this.dimensions.css.cell.width+"px",r.style.width=this.dimensions.css.cell.width*(i-t)+"px",r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions()}clear(){for(const e of this._rowElements)e.replaceChildren()}renderRows(e,t){const i=this._bufferService.buffer.ybase+this._bufferService.buffer.y,s=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._optionsService.rawOptions.cursorBlink;for(let n=e;n<=t;n++){const e=this._rowElements[n],t=n+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.lines.get(t),a=this._optionsService.rawOptions.cursorStyle;this._cellToRowElements[n]&&this._cellToRowElements[n].length===this._bufferService.cols||(this._cellToRowElements[n]=new Int16Array(this._bufferService.cols)),e.replaceChildren(this._rowFactory.createRow(o,t,t===i,a,s,r,this.dimensions.css.cell.width,this._bufferService.cols,this._cellToRowElements[n]))}}get _terminalSelector(){return`.${f}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){if(e=this._cellToRowElements[i][e],t=this._cellToRowElements[s][t],-1!==e&&-1!==t)for(;e!==t||i!==s;){const t=this._rowElements[i];if(!t)return;const s=t.children[e];s&&(s.style.textDecoration=n?"underline":"none"),++e>=r&&(e=0,i++)}}};p=s([r(4,u.IInstantiationService),r(5,c.ICharSizeService),r(6,u.IOptionsService),r(7,u.IBufferService),r(8,c.ICoreBrowserService),r(9,c.IThemeService)],p),t.DomRenderer=p},3787:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.STRIKETHROUGH_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;const n=i(2223),o=i(643),a=i(511),h=i(2585),c=i(8055),l=i(4725),d=i(4269),_=i(6171),u=i(3734);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.STRIKETHROUGH_CLASS="xterm-strikethrough",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";let f=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new a.CellData,this._columnSelectMode=!1}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,i,s,r,a,h,l,_,f){const g=this._document.createDocumentFragment(),p=this._characterJoinerService.getJoinedCharacters(i);let S=0;for(let t=Math.min(e.length,_)-1;t>=0;t--)if(e.loadCell(t,this._workCell).getCode()!==o.NULL_CELL_CODE||s&&t===a){S=t+1;break}const m=this._themeService.colors;let C=-1,b=0;for(;b0&&b===p[0][0]){S=!0;const t=p.shift();w=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),y=t[1]-1,_=w.getWidth()}const E=this._document.createElement("span");if(_>1&&(E.style.width=l*_+"px"),S&&(E.style.display="inline",a>=b&&a<=y&&(a=b)),!this._coreService.isCursorHidden&&s&&b===a)switch(E.classList.add(t.CURSOR_CLASS),h&&E.classList.add(t.CURSOR_BLINK_CLASS),r){case"bar":E.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":E.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:E.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}if(w.isBold()&&E.classList.add(t.BOLD_CLASS),w.isItalic()&&E.classList.add(t.ITALIC_CLASS),w.isDim()&&E.classList.add(t.DIM_CLASS),w.isInvisible()?E.textContent=o.WHITESPACE_CELL_CHAR:E.textContent=w.getChars()||o.WHITESPACE_CELL_CHAR,w.isUnderline()&&(E.classList.add(`${t.UNDERLINE_CLASS}-${w.extended.underlineStyle}`)," "===E.textContent&&(E.textContent=" "),!w.isUnderlineColorDefault()))if(w.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(w.getUnderlineColor()).join(",")})`;else{let e=w.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&w.isBold()&&e<8&&(e+=8),E.style.textDecorationColor=m.ansi[e].css}w.isStrikethrough()&&E.classList.add(t.STRIKETHROUGH_CLASS);let L=w.getFgColor(),k=w.getFgColorMode(),R=w.getBgColor(),D=w.getBgColorMode();const A=!!w.isInverse();if(A){const e=L;L=R,R=e;const t=k;k=D,D=t}let x,B,T=!1;this._decorationService.forEachDecorationAtCell(b,i,void 0,(e=>{"top"!==e.options.layer&&T||(e.backgroundColorRGB&&(D=50331648,R=e.backgroundColorRGB.rgba>>8&16777215,x=e.backgroundColorRGB),e.foregroundColorRGB&&(k=50331648,L=e.foregroundColorRGB.rgba>>8&16777215,B=e.foregroundColorRGB),T="top"===e.options.layer)}));const M=this._isCellInSelection(b,i);let O;switch(T||m.selectionForeground&&M&&(k=50331648,L=m.selectionForeground.rgba>>8&16777215,B=m.selectionForeground),M&&(x=this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque,T=!0),T&&E.classList.add("xterm-decoration-top"),D){case 16777216:case 33554432:O=m.ansi[R],E.classList.add(`xterm-bg-${R}`);break;case 50331648:O=c.rgba.toColor(R>>16,R>>8&255,255&R),this._addStyle(E,`background-color:#${v((R>>>0).toString(16),"0",6)}`);break;default:A?(O=m.foreground,E.classList.add(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):O=m.background}switch(x||w.isDim()&&(x=c.color.multiplyOpacity(O,.5)),k){case 16777216:case 33554432:w.isBold()&&L<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(L+=8),this._applyMinimumContrast(E,O,m.ansi[L],w,x,void 0)||E.classList.add(`xterm-fg-${L}`);break;case 50331648:const e=c.rgba.toColor(L>>16&255,L>>8&255,255&L);this._applyMinimumContrast(E,O,e,w,x,B)||this._addStyle(E,`color:#${v(L.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,O,m.foreground,w,x,void 0)||A&&E.classList.add(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}g.appendChild(E),f[b]=++C,b=y}return b<_-1&&f.subarray(b).fill(++C),g}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,_.excludeFromContrastRatioDemands)(s.getCode()))return!1;let o;return r||n||(o=this._themeService.colors.contrastCache.getColor(t.rgba,i.rgba)),void 0===o&&(o=c.color.ensureContrastRatio(r||t,n||i,this._optionsService.rawOptions.minimumContrastRatio),this._themeService.colors.contrastCache.setColor((r||t).rgba,(n||i).rgba,null!=o?o:null)),!!o&&(this._addStyle(e,`color:${o.css}`),!0)}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){const i=this._selectionStart,s=this._selectionEnd;return!(!i||!s)&&(this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t=i[0]&&e=i[0])}};function v(e,t,i){for(;e.length{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const s=i(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=s.isFirefox||s.isLegacyEdge?"bottom":"ideographic"},6171:(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}}}}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=i(2585),o=i(8460),a=i(844);let h=class extends a.Disposable{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new c(e,t,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}get hasValidSize(){return this.width>0&&this.height>0}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};h=s([r(2,n.IOptionsService)],h),t.CharSizeService=h;class c{constructor(e,t,i){this._document=e,this._parentElement=t,this._optionsService=i,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result}}},4269:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=i(3734),o=i(643),a=i(511),h=i(2585);class c extends n.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()]}}t.JoinedCellData=c;let l=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0,t.CoreBrowserService=class{constructor(e,t){this._textarea=e,this.window=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}},8934:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=i(4725),o=i(9806);let a=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return(0,o.getCoords)(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){const i=(0,o.getCoordsRelativeToElement)(window,e,t);if(!(!this._charSizeService.hasValidSize||i[0]<0||i[1]<0||i[0]>=this._renderService.dimensions.css.canvas.width||i[1]>=this._renderService.dimensions.css.canvas.height))return{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};a=s([r(0,n.IRenderService),r(1,n.ICharSizeService)],a),t.MouseService=a},3230:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=i(6193),o=i(8460),a=i(844),h=i(5596),c=i(3656),l=i(2585),d=i(4725),_=i(7226);let u=class extends a.Disposable{constructor(e,t,i,s,r,a,l,d){if(super(),this._rowCount=e,this._charSizeService=s,this._pausedResizeTask=new _.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new o.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new o.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new o.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new o.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this.register({dispose:()=>{var e;return null===(e=this._renderer)||void 0===e?void 0:e.dispose()}}),this._renderDebouncer=new n.RenderDebouncer(l.window,((e,t)=>this._renderRows(e,t))),this.register(this._renderDebouncer),this._screenDprMonitor=new h.ScreenDprMonitor(l.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(a.onResize((()=>this._fullRefresh()))),this.register(a.buffers.onBufferActivate((()=>{var e;return null===(e=this._renderer)||void 0===e?void 0:e.clear()}))),this.register(i.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(r.onDecorationRegistered((()=>this._fullRefresh()))),this.register(r.onDecorationRemoved((()=>this._fullRefresh()))),this.register(i.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()}))),this.register(i.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(a.buffer.y,a.buffer.y,!0)))),this.register((0,c.addDisposableDomListener)(l.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(d.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in l.window){const e=new l.window.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});e.observe(t),this.register({dispose:()=>e.disconnect()})}}get dimensions(){return this._renderer.dimensions}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){this._isPaused?this._needsFullRefresh=!0:(i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer&&(this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer&&(this._renderer.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions))}hasRenderer(){return!!this._renderer}setRenderer(e){var t;null===(t=this._renderer)||void 0===t||t.dispose(),this._renderer=e,this._renderer.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer&&(null===(t=(e=this._renderer).clearTextureAtlas)||void 0===t||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer&&(this._renderer.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.handleResize(e,t))):this._renderer.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null===(e=this._renderer)||void 0===e||e.handleCharSizeChanged()}handleBlur(){var e;null===(e=this._renderer)||void 0===e||e.handleBlur()}handleFocus(){var e;null===(e=this._renderer)||void 0===e||e.handleFocus()}handleSelectionChanged(e,t,i){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,null===(s=this._renderer)||void 0===s||s.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;null===(e=this._renderer)||void 0===e||e.handleCursorMove()}clear(){var e;null===(e=this._renderer)||void 0===e||e.clear()}};u=s([r(2,l.IOptionsService),r(3,d.ICharSizeService),r(4,l.IDecorationService),r(5,l.IBufferService),r(6,d.ICoreBrowserService),r(7,d.IThemeService)],u),t.RenderService=u},9312:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=i(6114),o=i(456),a=i(511),h=i(8460),c=i(4725),l=i(2585),d=i(9806),_=i(9504),u=i(844),f=i(4841),v=String.fromCharCode(160),g=new RegExp(v,"g");let p=class extends u.Disposable{constructor(e,t,i,s,r,n,c,l,d){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=c,this._renderService=l,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new a.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new h.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new h.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new h.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new h.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new o.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";const i=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";const r=e[0]e.replace(g," "))).join(n.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),n.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(i&&s&&t)&&this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){const i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!i||!s)&&this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){var i,s;const r=null===(s=null===(i=this._linkifier.currentLink)||void 0===i?void 0:i.link)||void 0===s?void 0:s.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const n=this._getMouseBufferCoords(e);return!!n&&(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return n.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const i=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,_.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,i)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){const r=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;const r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;const o=r.translateBufferLineToString(e[1],!1);let a=this._convertViewportColToCharacterIndex(n,e[0]),h=a;const c=e[0]-a;let l=0,d=0,_=0,u=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;h1&&(u+=s-1,h+=s-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(l++,t--):e>1&&(_+=e-1,a-=e-1),a--,t--}for(;i1&&(u+=e-1,h+=e-1),h++,i++}}h++;let f=a+c-l+_,v=Math.min(this._bufferService.cols,h-a+l+d-_-u);if(t||""!==o.slice(a,h).trim()){if(i&&0===f&&32!==n.getCodePoint(0)){const t=r.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;f-=e,v+=e}}}if(s&&f+v===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){const t=r.lines.get(e[1]+1);if((null==t?void 0:t.isWrapped)&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(v+=t.length)}}return{start:f,length:v}}}_selectWordAt(e,t){const i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(i,this._bufferService.cols)}};p=s([r(3,l.IBufferService),r(4,l.ICoreService),r(5,c.IMouseService),r(6,l.IOptionsService),r(7,c.IRenderService),r(8,c.ICoreBrowserService)],p),t.SelectionService=p},4725:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const s=i(8343);t.ICharSizeService=(0,s.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,s.createDecorator)("CoreBrowserService"),t.IMouseService=(0,s.createDecorator)("MouseService"),t.IRenderService=(0,s.createDecorator)("RenderService"),t.ISelectionService=(0,s.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,s.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,s.createDecorator)("ThemeService")},6731:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=i(7239),o=i(8055),a=i(8460),h=i(844),c=i(2585),l=o.css.toColor("#ffffff"),d=o.css.toColor("#000000"),_=o.css.toColor("#ffffff"),u=o.css.toColor("#000000"),f={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[o.css.toColor("#2e3436"),o.css.toColor("#cc0000"),o.css.toColor("#4e9a06"),o.css.toColor("#c4a000"),o.css.toColor("#3465a4"),o.css.toColor("#75507b"),o.css.toColor("#06989a"),o.css.toColor("#d3d7cf"),o.css.toColor("#555753"),o.css.toColor("#ef2929"),o.css.toColor("#8ae234"),o.css.toColor("#fce94f"),o.css.toColor("#729fcf"),o.css.toColor("#ad7fa8"),o.css.toColor("#34e2e2"),o.css.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){const s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:o.channels.toCss(s,r,n),rgba:o.channels.toRgba(s,r,n)})}for(let t=0;t<24;t++){const i=8+10*t;e.push({css:o.channels.toCss(i,i,i),rgba:o.channels.toRgba(i,i,i)})}return e})());let v=class extends h.Disposable{constructor(e){super(),this._optionsService=e,this._onChangeColors=this.register(new a.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._contrastCache=new n.ColorContrastCache,this._colors={foreground:l,background:d,cursor:_,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:f,selectionBackgroundOpaque:o.color.blend(d,f),selectionInactiveBackgroundTransparent:f,selectionInactiveBackgroundOpaque:o.color.blend(d,f),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}get colors(){return this._colors}_setTheme(e={}){const i=this._colors;if(i.foreground=g(e.foreground,l),i.background=g(e.background,d),i.cursor=g(e.cursor,_),i.cursorAccent=g(e.cursorAccent,u),i.selectionBackgroundTransparent=g(e.selectionBackground,f),i.selectionBackgroundOpaque=o.color.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=o.color.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,i.selectionForeground===o.NULL_COLOR&&(i.selectionForeground=void 0),o.color.isOpaque(i.selectionBackgroundTransparent)){const e=.3;i.selectionBackgroundTransparent=o.color.opacity(i.selectionBackgroundTransparent,e)}if(o.color.isOpaque(i.selectionInactiveBackgroundTransparent)){const e=.3;i.selectionInactiveBackgroundTransparent=o.color.opacity(i.selectionInactiveBackgroundTransparent,e)}if(i.ansi=t.DEFAULT_ANSI_COLORS.slice(),i.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),i.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),i.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),i.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),i.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),i.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),i.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),i.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),i.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),i.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),i.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),i.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),i.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),i.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),i.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),i.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const s=i(8460),r=i(844);class n extends r.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new s.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new s.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new s.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;const t=new Array(e);for(let i=0;ithis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+i.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){const e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));const s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,i=5){if("object"!=typeof t)return t;const s=Array.isArray(t)?[]:{};for(const r in t)s[r]=i<=1?t[r]:t[r]&&e(t[r],i-1);return s}},8055:(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(6114);let r=0,n=0,o=0,a=0;var h,c,l;function d(e){const t=e.toString(16);return t.length<2?"0"+t:t}function _(e,t){return e>>0}}(h=t.channels||(t.channels={})),function(e){function t(e,t){return a=Math.round(255*t),[r,n,o]=l.toChannels(e.rgba),{css:h.toCss(r,n,o,a),rgba:h.toRgba(r,n,o,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,c=t.rgba>>8&255,l=e.rgba>>24&255,d=e.rgba>>16&255,_=e.rgba>>8&255;return r=l+Math.round((i-l)*a),n=d+Math.round((s-d)*a),o=_+Math.round((c-_)*a),{css:h.toCss(r,n,o),rgba:h.toRgba(r,n,o)}},e.isOpaque=function(e){return 255==(255&e.rgba)},e.ensureContrastRatio=function(e,t,i){const s=l.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return l.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[r,n,o]=l.toChannels(t),{css:h.toCss(r,n,o),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]}}(t.color||(t.color={})),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),n=parseInt(e.slice(2,3).repeat(2),16),o=parseInt(e.slice(3,4).repeat(2),16),l.toColor(r,n,o);case 5:return r=parseInt(e.slice(1,2).repeat(2),16),n=parseInt(e.slice(2,3).repeat(2),16),o=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),l.toColor(r,n,o,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]),n=parseInt(s[2]),o=parseInt(s[3]),a=Math.round(255*(void 0===s[5]?1:parseFloat(s[5]))),l.toColor(r,n,o,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,n,o,a]=t.getImageData(0,0,1,1).data,255!==a)throw new Error("css.toColor: Unsupported css format");return{rgba:h.toRgba(r,n,o,a),css:e}}}(t.css||(t.css={})),function(e){function t(e,t,i){const s=e/255,r=t/255,n=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*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(c=t.rgb||(t.rgb={})),function(e){function t(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,h=t>>8&255,l=_(c.relativeLuminance2(o,a,h),c.relativeLuminance2(s,r,n));for(;l0||a>0||h>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),h-=Math.max(0,Math.ceil(.1*h)),l=_(c.relativeLuminance2(o,a,h),c.relativeLuminance2(s,r,n));return(o<<24|a<<16|h<<8|255)>>>0}function i(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,h=t>>8&255,l=_(c.relativeLuminance2(o,a,h),c.relativeLuminance2(s,r,n));for(;l>>0}e.ensureContrastRatio=function(e,s,r){const n=c.relativeLuminance(e>>8),o=c.relativeLuminance(s>>8);if(_(n,o)>8));if(a_(n,c.relativeLuminance(t>>8))?o:t}return o}const a=i(e,s,r),h=_(n,c.relativeLuminance(a>>8));if(h_(n,c.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)}}}(l=t.rgba||(t.rgba={})),t.toPaddedHex=d,t.contrastRatio=_},8969:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const s=i(844),r=i(2585),n=i(4348),o=i(7866),a=i(744),h=i(7302),c=i(6975),l=i(8460),d=i(1753),_=i(1480),u=i(7994),f=i(9282),v=i(5435),g=i(5981),p=i(2660);let S=!1;class m extends s.Disposable{constructor(e){super(),this._onBinary=this.register(new l.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new l.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new l.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new l.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new h.OptionsService(e)),this._instantiationService.setService(r.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(a.BufferService)),this._instantiationService.setService(r.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(r.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(r.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(r.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(_.UnicodeService)),this._instantiationService.setService(r.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(r.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(p.OscLinkService),this._instantiationService.setService(r.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,l.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,l.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,l.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,l.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onSpecificOptionChange("windowsMode",(e=>this._handleWindowsModeOptionChange(e)))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,l.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed)),this.register((0,s.toDisposable)((()=>{var e;null===(e=this._windowsMode)||void 0===e||e.dispose(),this._windowsMode=void 0})))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new l.EventEmitter),this._onScroll.event((e=>{var t;null===(t=this._onScrollApi)||void 0===t||t.fire(e.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=r.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,a.MINIMUM_COLS),t=Math.max(t,a.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,i){this._bufferService.scrollLines(e,t,i)}scrollPages(e){this._bufferService.scrollPages(e)}scrollToTop(){this._bufferService.scrollToTop()}scrollToBottom(){this._bufferService.scrollToBottom()}scrollToLine(e){this._bufferService.scrollToLine(e)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this.optionsService.rawOptions.windowsMode&&this._enableWindowsMode()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsModeOptionChange(e){var t;e?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}_enableWindowsMode(){if(!this._windowsMode){const e=[];e.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},(()=>((0,f.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsMode={dispose:()=>{for(const t of e)t.dispose()}}}}}t.CoreTerminal=m},8460:(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;tt.fire(e)))}},5435:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=i(2584),o=i(7116),a=i(2015),h=i(844),c=i(482),l=i(8437),d=i(8460),_=i(643),u=i(511),f=i(3734),v=i(2585),g=i(6242),p=i(6351),S=i(5941),m={"(":0,")":1,"*":2,"+":3,"-":1,".":2},C=131072;function b(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var y;!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(y=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));let w=0;class E extends h.Disposable{constructor(e,t,i,s,r,h,_,f,v=new a.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=h,this._coreMouseService=_,this._unicodeService=f,this._parser=v,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new L(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._parser.setCsiHandlerFallback(((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})})),this._parser.setEscHandlerFallback((e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})})),this._parser.setExecuteHandlerFallback((e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})})),this._parser.setOscHandlerFallback(((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})})),this._parser.setDcsHandlerFallback(((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})})),this._parser.setPrintHandler(((e,t,i)=>this.print(e,t,i))),this._parser.registerCsiHandler({final:"@"},(e=>this.insertChars(e))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(e=>this.scrollLeft(e))),this._parser.registerCsiHandler({final:"A"},(e=>this.cursorUp(e))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(e=>this.scrollRight(e))),this._parser.registerCsiHandler({final:"B"},(e=>this.cursorDown(e))),this._parser.registerCsiHandler({final:"C"},(e=>this.cursorForward(e))),this._parser.registerCsiHandler({final:"D"},(e=>this.cursorBackward(e))),this._parser.registerCsiHandler({final:"E"},(e=>this.cursorNextLine(e))),this._parser.registerCsiHandler({final:"F"},(e=>this.cursorPrecedingLine(e))),this._parser.registerCsiHandler({final:"G"},(e=>this.cursorCharAbsolute(e))),this._parser.registerCsiHandler({final:"H"},(e=>this.cursorPosition(e))),this._parser.registerCsiHandler({final:"I"},(e=>this.cursorForwardTab(e))),this._parser.registerCsiHandler({final:"J"},(e=>this.eraseInDisplay(e,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(e=>this.eraseInDisplay(e,!0))),this._parser.registerCsiHandler({final:"K"},(e=>this.eraseInLine(e,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(e=>this.eraseInLine(e,!0))),this._parser.registerCsiHandler({final:"L"},(e=>this.insertLines(e))),this._parser.registerCsiHandler({final:"M"},(e=>this.deleteLines(e))),this._parser.registerCsiHandler({final:"P"},(e=>this.deleteChars(e))),this._parser.registerCsiHandler({final:"S"},(e=>this.scrollUp(e))),this._parser.registerCsiHandler({final:"T"},(e=>this.scrollDown(e))),this._parser.registerCsiHandler({final:"X"},(e=>this.eraseChars(e))),this._parser.registerCsiHandler({final:"Z"},(e=>this.cursorBackwardTab(e))),this._parser.registerCsiHandler({final:"`"},(e=>this.charPosAbsolute(e))),this._parser.registerCsiHandler({final:"a"},(e=>this.hPositionRelative(e))),this._parser.registerCsiHandler({final:"b"},(e=>this.repeatPrecedingCharacter(e))),this._parser.registerCsiHandler({final:"c"},(e=>this.sendDeviceAttributesPrimary(e))),this._parser.registerCsiHandler({prefix:">",final:"c"},(e=>this.sendDeviceAttributesSecondary(e))),this._parser.registerCsiHandler({final:"d"},(e=>this.linePosAbsolute(e))),this._parser.registerCsiHandler({final:"e"},(e=>this.vPositionRelative(e))),this._parser.registerCsiHandler({final:"f"},(e=>this.hVPosition(e))),this._parser.registerCsiHandler({final:"g"},(e=>this.tabClear(e))),this._parser.registerCsiHandler({final:"h"},(e=>this.setMode(e))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(e=>this.setModePrivate(e))),this._parser.registerCsiHandler({final:"l"},(e=>this.resetMode(e))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(e=>this.resetModePrivate(e))),this._parser.registerCsiHandler({final:"m"},(e=>this.charAttributes(e))),this._parser.registerCsiHandler({final:"n"},(e=>this.deviceStatus(e))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(e=>this.deviceStatusPrivate(e))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(e=>this.softReset(e))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(e=>this.setCursorStyle(e))),this._parser.registerCsiHandler({final:"r"},(e=>this.setScrollRegion(e))),this._parser.registerCsiHandler({final:"s"},(e=>this.saveCursor(e))),this._parser.registerCsiHandler({final:"t"},(e=>this.windowOptions(e))),this._parser.registerCsiHandler({final:"u"},(e=>this.restoreCursor(e))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(e=>this.insertColumns(e))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(e=>this.deleteColumns(e))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(e=>this.selectProtected(e))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(e=>this.requestMode(e,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(e=>this.requestMode(e,!1))),this._parser.setExecuteHandler(n.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(n.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(n.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(n.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(n.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(n.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(n.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(n.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(n.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new g.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new g.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new g.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new g.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new g.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new g.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new g.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new g.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new g.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new g.OscHandler((e=>this.restoreCursorColor(e)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const e in o.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:e},(()=>this.selectCharset("("+e))),this._parser.registerEscHandler({intermediates:")",final:e},(()=>this.selectCharset(")"+e))),this._parser.registerEscHandler({intermediates:"*",final:e},(()=>this.selectCharset("*"+e))),this._parser.registerEscHandler({intermediates:"+",final:e},(()=>this.selectCharset("+"+e))),this._parser.registerEscHandler({intermediates:"-",final:e},(()=>this.selectCharset("-"+e))),this._parser.registerEscHandler({intermediates:".",final:e},(()=>this.selectCharset("."+e))),this._parser.registerEscHandler({intermediates:"/",final:e},(()=>this.selectCharset("/"+e)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((e=>(this._logService.error("Parsing error: ",e),e))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new p.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t("#SLOW_TIMEOUT")),5e3)))]).catch((e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0;const o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>C&&(n=this._parseStack.position+C)}if(this._logService.logLevel<=v.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join("")}"`),"string"==typeof e?e.split("").map((e=>e.charCodeAt(0))):e),this._parseBuffer.lengthC)for(let t=n;t0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodePoint(this._activeBuffer.x-1,0,1,d.fg,d.bg,d.extended);for(let f=t;f=a)if(h){for(;this._activeBuffer.x=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=a-1,2===r)continue;if(l&&(u.insertCells(this._activeBuffer.x,r,this._activeBuffer.getNullCell(d),d),2===u.getWidth(a-1)&&u.setCellFromCodePoint(a-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),u.setCellFromCodePoint(this._activeBuffer.x++,s,r,d.fg,d.bg,d.extended),r>0)for(;--r;)u.setCellFromCodePoint(this._activeBuffer.x++,0,0,d.fg,d.bg,d.extended)}else u.getWidth(this._activeBuffer.x-1)?u.addCodepointToCell(this._activeBuffer.x-1,s):u.addCodepointToCell(this._activeBuffer.x-2,s)}i-t>0&&(u.loadCell(this._activeBuffer.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodePoint(this._activeBuffer.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!b(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new p.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new g.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null===(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))||void 0===e?void 0:e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){const t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){const t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){const n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1}eraseInDisplay(e,t=!1){let i;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);i=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(n.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(n.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(n.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(n.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let t=0;te?1:2,u=e.params[0];return f=u,v=t?2===u?3:4===u?_(o.modes.insertMode):12===u?4:20===u?_(d.convertEol):0:1===u?_(i.applicationCursorKeys):3===u?d.windowOptions.setWinLines?80===h?2:132===h?1:0:0:6===u?_(i.origin):7===u?_(i.wraparound):8===u?3:9===u?_("X10"===s):12===u?_(d.cursorBlink):25===u?_(!o.isCursorHidden):45===u?_(i.reverseWraparound):66===u?_(i.applicationKeypad):1e3===u?_("VT200"===s):1002===u?_("DRAG"===s):1003===u?_("ANY"===s):1004===u?_(i.sendFocus):1005===u?4:1006===u?_("SGR"===r):1015===u?4:1016===u?_("SGR_PIXELS"===r):1048===u?1:47===u||1047===u||1049===u?_(c===l):2004===u?_(i.bracketedPasteMode):0,o.triggerDataEvent(`${n.C0.ESC}[${t?"":"?"}${f};${v}$y`),!0;var f,v}_updateAttrColor(e,t,i,s,r){return 2===t?(e|=50331648,e&=-16777216,e|=f.AttributeData.fromColorRGB([i,s,r])):5===t&&(e&=-50331904,e|=33554432|255&i),e}_extractColor(e,t,i){const s=[0,0,-1,0,0,0];let r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){const i=e.getSubParams(t+n);let o=0;do{5===s[1]&&(r=1),s[n+o+1+r]=i[o]}while(++o=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=l.DEFAULT_ATTR_DATA.fg,e.bg=l.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let i;const s=this._curAttrData;for(let r=0;r=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777224|i-90):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777224|i-100):0===i?this._processSGR0(s):1===i?s.fg|=134217728:3===i?s.bg|=67108864:4===i?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):5===i?s.fg|=536870912:7===i?s.fg|=67108864:8===i?s.fg|=1073741824:9===i?s.fg|=2147483648:2===i?s.bg|=134217728:21===i?this._processUnderline(2,s):22===i?(s.fg&=-134217729,s.bg&=-134217729):23===i?s.bg&=-67108865:24===i?(s.fg&=-268435457,this._processUnderline(0,s)):25===i?s.fg&=-536870913:27===i?s.fg&=-67108865:28===i?s.fg&=-1073741825:29===i?s.fg&=2147483647:39===i?(s.fg&=-67108864,s.fg|=16777215&l.DEFAULT_ATTR_DATA.fg):49===i?(s.bg&=-67108864,s.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):38===i||48===i||58===i?r+=this._extractColor(e,r,s):59===i?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):100===i?(s.fg&=-67108864,s.fg|=16777215&l.DEFAULT_ATTR_DATA.fg,s.bg&=-67108864,s.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){const t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const i=t%2==1;return this._optionsService.options.cursorBlink=i,!0}setScrollRegion(e){const t=e.params[0]||1;let i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||0===i)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!b(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(y.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(y.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){const t=[],i=e.split(";");for(;i.length>1;){const e=i.shift(),s=i.shift();if(/^\d+$/.exec(e)){const i=parseInt(e);if(0<=i&&i<256)if("?"===s)t.push({type:0,index:i});else{const e=(0,S.parseColor)(s);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.split(";");return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const i=e.split(":");let s;const r=i.findIndex((e=>e.startsWith("id=")));return-1!==r&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){const i=e.split(";");for(let e=0;e=this._specialColors.length);++e,++t)if("?"===i[e])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const s=(0,S.parseColor)(i[e]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;const t=[],i=e.split(";");for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new u.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${n.C0.ESC}${e}${n.C0.ESC}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=E;let L=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(w=e,e=t,t=w),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};L=s([r(0,v.IBufferService)],L)},844:(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.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.toDisposable=function(e){return{dispose:e}},t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return{dispose:()=>i(e)}}},1505:(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,n){this._data.get(e,t)||this._data.set(e,t,new i),this._data.get(e,t).set(s,r,n)}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()}}},6114:(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)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let i=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){0!==this._array.length?(i=this._search(this._getKey(e),0,this._array.length-1),this._array.splice(i,0,e)):this._array.push(e)}delete(e){if(0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(i=this._search(t,0,this._array.length-1),-1===i)return!1;if(this._getKey(this._array[i])!==t)return!1;do{if(this._array[i]===e)return this._array.splice(i,1),!0}while(++i=this._array.length)&&this._getKey(this._array[i])===e))do{yield this._array[i]}while(++i=this._array.length)&&this._getKey(this._array[i])===e))do{t(this._array[i])}while(++ie)return this._search(e,t,s-1);if(r0&&this._getKey(this._array[s-1])===e;)s--;return s}}},7226:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const s=i(6114);class r{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ir)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 n 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=n,t.IdleTaskQueue=!s.isNode&&"requestIdleCallback"in window?class extends r{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const s=i(643);t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=null==t?void 0:t.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=i[s.CHAR_DATA_CODE_INDEX]!==s.NULL_CELL_CODE&&i[s.CHAR_DATA_CODE_INDEX]!==s.WHITESPACE_CELL_CODE)}},3734:(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}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{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}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}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=s},9092:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;const s=i(6349),r=i(8437),n=i(511),o=i(643),a=i(4634),h=i(4863),c=i(7116),l=i(3734),d=i(7226);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=r.DEFAULT_ATTR_DATA.clone(),this.savedCharset=c.DEFAULT_CHARSET,this.markers=[],this._nullCell=n.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=n.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new l.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new l.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new r.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=r.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const i=this.getNullCell(r.DEFAULT_ATTR_DATA);let s=0;const n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new r.BufferLine(e,i)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){return this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){const i=(0,a.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(r.DEFAULT_ATTR_DATA));if(i.length>0){const s=(0,a.reflowLargerCreateNewLayout)(this.lines,i);(0,a.reflowLargerApplyNewLayout)(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){const s=this.getNullCell(r.DEFAULT_ATTR_DATA);let n=i;for(;n-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;o--){let h=this.lines.get(o);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;const c=[h];for(;h.isWrapped&&o>0;)h=this.lines.get(--o),c.unshift(h);const l=this.ybase+this.y;if(l>=o&&l0&&(s.push({start:o+c.length+n,newLines:v}),n+=v.length),c.push(...v);let g=_.length-1,p=_[g];0===p&&(g--,p=_[g]);let S=c.length-u-1,m=d;for(;S>=0;){const e=Math.min(m,p);if(void 0===c[g])break;if(c[g].copyCellsFrom(c[S],m-e,p-e,e,!0),p-=e,0===p&&(g--,p=_[g]),m-=e,0===m){S--;const e=Math.max(S,0);m=(0,a.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t0;)0===this.ybase?this.y0){const e=[],t=[];for(let e=0;e=0;c--)if(a&&a.start>r+h){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(c--,a.newLines[e]);c++,e.push({index:r+1,amount:a.newLines.length}),h+=a.newLines.length,a=s[++o]}else this.lines.set(c,t[r--]);let c=0;for(let t=e.length-1;t>=0;t--)e[t].index+=c,this.lines.onInsertEmitter.fire(e[t]),c+=e[t].amount;const l=Math.max(0,i+n-this.lines.maxLength);l>0&&this.lines.onTrimEmitter.fire(l)}}stringIndexToBufferIndex(e,t,i=!1){for(;t;){const s=this.lines.get(e);if(!s)return[-1,-1];const r=i?s.getTrimmedLength():s.length;for(let i=0;i0&&this.lines.get(t).isWrapped;)t--;for(;i+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((e=>{t.line>=e.index&&(t.line+=e.amount)}))),t.register(this.lines.onDelete((e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}iterator(e,t,i,s,r){return new _(this,e,t,i,s,r)}};class _{constructor(e,t,i=0,s=e.lines.length,r=0,n=0){this._buffer=e,this._trimRight=t,this._startIndex=i,this._endIndex=s,this._startOverscan=r,this._endOverscan=n,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}hasNext(){return this._currentthis._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);let t="";for(let i=e.first;i<=e.last;++i)t+=this._buffer.translateBufferLineToString(i,this._trimRight);return this._current=e.last+1,{range:e,content:t}}}t.BufferStringIterator=_},8437:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const s=i(482),r=i(643),n=i(511),o=i(3734);t.DEFAULT_ATTR_DATA=Object.freeze(new o.AttributeData);let a=0;class h{constructor(e,t,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=t||n.CellData.fromCharData([0,r.NULL_CELL_CHAR,r.NULL_CELL_WIDTH,r.NULL_CELL_CODE]);for(let t=0;t>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._data[3*e+1]=t[r.CHAR_DATA_ATTR_INDEX],t[r.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[r.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[r.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,s.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return a=3*e,t.content=this._data[a+0],t.fg=this._data[a+1],t.bg=this._data[a+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodePoint(e,t,i,s,r,n){268435456&r&&(this._extendedAttrs[e]=n),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=s,this._data[3*e+2]=r}addCodepointToCell(e,t){let i=this._data[3*e+0];2097152&i?this._combined[e]+=(0,s.stringFromCodePoint)(t):(2097151&i?(this._combined[e]=(0,s.stringFromCodePoint)(2097151&i)+(0,s.stringFromCodePoint)(t),i&=-2097152,i|=2097152):i=t|1<<22,this._data[3*e+0]=i)}insertCells(e,t,i,s){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==s?void 0:s.fg)||0,(null==s?void 0:s.bg)||0,(null==s?void 0:s.extended)||new o.ExtendedAttrs),t=0;--i)this.setCell(e+t+i,this.loadCell(e+i,s));for(let s=0;sthis.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i=e&&delete this._combined[s]}const s=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[i]}}return this.length=e,4*i*2=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,s,r){const n=e._data;if(r)for(let r=s-1;r>=0;r--){for(let e=0;e<3;e++)this._data[3*(i+r)+e]=n[3*(t+r)+e];268435456&n[3*(t+r)+2]&&(this._extendedAttrs[i+r]=e._extendedAttrs[t+r])}else for(let r=0;r=t&&(this._combined[r-t+i]=e._combined[r])}}translateToString(e=!1,t=0,i=this.length){e&&(i=Math.min(i,this.getTrimmedLength()));let n="";for(;t>22||1}return n}}t.BufferLine=h},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function i(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();const s=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return s&&r?i-1:i}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,s,r,n){const o=[];for(let a=0;a=a&&r0&&(e>d||0===l[e].getTrimmedLength());e--)v++;v>0&&(o.push(a+l.length-v),o.push(v)),a+=l.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){const i=[];let s=0,r=t[s],n=0;for(let o=0;oi(e,r,t))).reduce(((e,t)=>e+t));let o=0,a=0,h=0;for(;hc&&(o-=c,a++);const l=2===e[a].getWidth(o-1);l&&o--;const d=l?s-1:s;r.push(d),h+=d}return r},t.getWrappedLineTrimmedLength=i},5295:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const s=i(9092),r=i(8460),n=i(844);class o extends n.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new s.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new s.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const s=i(482),r=i(643),n=i(3734);class o extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(e){const t=new o;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=o},643:(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},4863:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const s=i(8460),r=i(844);class n{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new s.EventEmitter),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,r.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=n,n._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var i,s;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="",e.BS="\b",e.HT="\t",e.LF="\n",e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""}(i=t.C0||(t.C0={})),(s=t.C1||(t.C1={})).PAD="€",s.HOP="",s.BPH="‚",s.NBH="ƒ",s.IND="„",s.NEL="…",s.SSA="†",s.ESA="‡",s.HTS="ˆ",s.HTJ="‰",s.VTS="Š",s.PLD="‹",s.PLU="Œ",s.RI="",s.SS2="Ž",s.SS3="",s.DCS="",s.PU1="‘",s.PU2="’",s.STS="“",s.CCH="”",s.MW="•",s.SPA="–",s.EPA="—",s.SOS="˜",s.SGCI="™",s.SCI="š",s.CSI="›",s.ST="œ",s.OSC="",s.PM="ž",s.APC="Ÿ",(t.C1_ESCAPED||(t.C1_ESCAPED={})).ST=`${i.ESC}\\`},7399:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const s=i(2584),r={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,i,n){const o={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?o.key=t?s.C0.ESC+"OA":s.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?o.key=t?s.C0.ESC+"OD":s.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?o.key=t?s.C0.ESC+"OC":s.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(o.key=t?s.C0.ESC+"OB":s.C0.ESC+"[B");break;case 8:if(e.altKey){o.key=s.C0.ESC+s.C0.DEL;break}o.key=s.C0.DEL;break;case 9:if(e.shiftKey){o.key=s.C0.ESC+"[Z";break}o.key=s.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?s.C0.ESC+s.C0.CR:s.C0.CR,o.cancel=!0;break;case 27:o.key=s.C0.ESC,e.altKey&&(o.key=s.C0.ESC+s.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"D",o.key===s.C0.ESC+"[1;3D"&&(o.key=s.C0.ESC+(i?"b":"[1;5D"))):o.key=t?s.C0.ESC+"OD":s.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"C",o.key===s.C0.ESC+"[1;3C"&&(o.key=s.C0.ESC+(i?"f":"[1;5C"))):o.key=t?s.C0.ESC+"OC":s.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"A",i||o.key!==s.C0.ESC+"[1;3A"||(o.key=s.C0.ESC+"[1;5A")):o.key=t?s.C0.ESC+"OA":s.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(o.key=s.C0.ESC+"[1;"+(a+1)+"B",i||o.key!==s.C0.ESC+"[1;3B"||(o.key=s.C0.ESC+"[1;5B")):o.key=t?s.C0.ESC+"OB":s.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(o.key=s.C0.ESC+"[2~");break;case 46:o.key=a?s.C0.ESC+"[3;"+(a+1)+"~":s.C0.ESC+"[3~";break;case 36:o.key=a?s.C0.ESC+"[1;"+(a+1)+"H":t?s.C0.ESC+"OH":s.C0.ESC+"[H";break;case 35:o.key=a?s.C0.ESC+"[1;"+(a+1)+"F":t?s.C0.ESC+"OF":s.C0.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=s.C0.ESC+"[5;"+(a+1)+"~":o.key=s.C0.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=s.C0.ESC+"[6;"+(a+1)+"~":o.key=s.C0.ESC+"[6~";break;case 112:o.key=a?s.C0.ESC+"[1;"+(a+1)+"P":s.C0.ESC+"OP";break;case 113:o.key=a?s.C0.ESC+"[1;"+(a+1)+"Q":s.C0.ESC+"OQ";break;case 114:o.key=a?s.C0.ESC+"[1;"+(a+1)+"R":s.C0.ESC+"OR";break;case 115:o.key=a?s.C0.ESC+"[1;"+(a+1)+"S":s.C0.ESC+"OS";break;case 116:o.key=a?s.C0.ESC+"[15;"+(a+1)+"~":s.C0.ESC+"[15~";break;case 117:o.key=a?s.C0.ESC+"[17;"+(a+1)+"~":s.C0.ESC+"[17~";break;case 118:o.key=a?s.C0.ESC+"[18;"+(a+1)+"~":s.C0.ESC+"[18~";break;case 119:o.key=a?s.C0.ESC+"[19;"+(a+1)+"~":s.C0.ESC+"[19~";break;case 120:o.key=a?s.C0.ESC+"[20;"+(a+1)+"~":s.C0.ESC+"[20~";break;case 121:o.key=a?s.C0.ESC+"[21;"+(a+1)+"~":s.C0.ESC+"[21~";break;case 122:o.key=a?s.C0.ESC+"[23;"+(a+1)+"~":s.C0.ESC+"[23~";break;case 123:o.key=a?s.C0.ESC+"[24;"+(a+1)+"~":s.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!n||!e.altKey||e.metaKey)!i||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?o.key=e.key:e.key&&e.ctrlKey&&("_"===e.key&&(o.key=s.C0.US),"@"===e.key&&(o.key=s.C0.NUL)):65===e.keyCode&&(o.type=1);else{const t=r[e.keyCode],i=null==t?void 0:t[e.shiftKey?1:0];if(i)o.key=s.C0.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),o.key=s.C0.ESC+i}else if(32===e.keyCode)o.key=s.C0.ESC+(e.ctrlKey?s.C0.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=s.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?o.key=s.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?o.key=s.C0.DEL:219===e.keyCode?o.key=s.C0.ESC:220===e.keyCode?o.key=s.C0.FS:221===e.keyCode&&(o.key=s.C0.GS)}return o}},482:(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;r65535?(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 n=r;n=i)return this._interim=r,s;const o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=1024*(r-55296)+o-56320+65536:(t[s++]=r,t[s++]=o)}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,n,o,a=0,h=0,c=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let n,o=0;for(;(n=63&this.interim[++o])&&o<4;)r<<=6,r|=n;const h=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,l=h-o;for(;c=i)return 0;if(n=e[c++],128!=(192&n)){c--,s=!0;break}this.interim[o++]=n,r<<=6,r|=63&n}s||(2===h?r<128?c--: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 l=i-4;let d=c;for(;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(n=e[d++],128!=(192&n)){d--;continue}if(h=(15&s)<<12|(63&r)<<6|63&n,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(n=e[d++],128!=(192&n)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=n,a;if(o=e[d++],128!=(192&o)){d--;continue}if(h=(7&s)<<18|(63&r)<<12|(63&n)<<6|63&o,h<65536||h>1114111)continue;t[a++]=h}}return a}}},225:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let r;t.UnicodeV6=class{constructor(){if(this.version="6",!r){r=new Uint8Array(65536),r.fill(1),r[0]=0,r.fill(0,1,32),r.fill(0,127,160),r.fill(2,4352,4448),r[9001]=2,r[9002]=2,r.fill(2,11904,42192),r[12351]=1,r.fill(2,44032,55204),r.fill(2,63744,64256),r.fill(2,65040,65050),r.fill(2,65072,65136),r.fill(2,65280,65377),r.fill(2,65504,65511);for(let e=0;et[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}}},5981:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const s=i(8460),r=i(844);class n extends r.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new s.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){const i=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){const e=e=>Date.now()-i>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(i,e);return void s.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-i>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=n},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const i=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,s=/^[\da-f]+$/;function r(e,t){const i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);const e=i.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(0===t.indexOf("#")&&(t=t.slice(1),s.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){const r=parseInt(t.slice(e*s,e*s+e),16);i[s]=1===e?r<<4:2===e?r:3===e?r>>4:r>>8}return i}},t.toRgbString=function(e,t=16){const[i,s,n]=e;return`rgb:${r(i,t)}/${r(s,t)}/${r(n,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const s=i(482),r=i(8742),n=i(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",(0,s.utf32ToString)(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].unhook(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",e);this._active=o,this._ident=0}};const a=new r.Params;a.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data="",this._params=a,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():a,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=a,this._data="",this._hitLimit=!1,e)));return this._params=a,this._data="",this._hitLimit=!1,t}}},2015:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const s=i(844),r=i(8742),n=i(6242),o=i(6351);class a{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;rt)),i=(e,i)=>t.slice(e,i),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));const n=i(0,14);let o;for(o in e.setDefault(1,0),e.addMany(s,0,2,0),n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(h,0,2,0),e.add(h,8,5,8),e.add(h,6,0,6),e.add(h,11,0,11),e.add(h,13,13,13),e}();class c extends s.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new r.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(e,t,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,s.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let t=0;ts||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(1!==e.final.length)throw new Error("final must be a single byte");const s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const i=this._identifier(e,[48,126]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);const s=this._escHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const i=this._identifier(e);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);const s=this._csiHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s,r=0,n=0,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const t=this._parseStack.handlers;let n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](this._params),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 4:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],s=this._dcsParser.unhook(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],s=this._oscParser.end(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let i=o;i>4){case 2:for(let s=i+1;;++s){if(s>=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=0&&(s=o[a](this._params),!0!==s);a--)if(s instanceof Promise)return this._preserveStack(3,o,a,n,i),s;a<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingCodepoint=0;break;case 8:do{switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}}while(++i47&&r<60);i--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:const c=this._escHandlers[this._collect<<8|r];let l=c?c.length-1:-1;for(;l>=0&&(s=c[l](),!0!==s);l--)if(s instanceof Promise)return this._preserveStack(4,c,l,n,i),s;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let s=i+1;;++s)if(s>=t||24===(r=e[s])||26===r||27===r||r>127&&r=t||(r=e[s])<32||r>127&&r{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const s=i(5770),r=i(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",(0,r.utf32ToString)(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e);this._active=n,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,i),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data="",this._hitLimit=!1,e)));return this._data="",this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const i=2147483647;class s{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){const t=new s;if(!e.length)return t;for(let i=Array.isArray(e[0])?1:0;i>8,s=255&this._subParamsIdx[t];s-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>i?i:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>i?i:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){const e={};for(let t=0;t>8,s=255&this._subParamsIdx[t];s-i>0&&(e[t]=this._subParams.slice(i,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(10*r+e,i):e}}t.Params=s},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const s=i(3785),r=i(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new s.BufferLineApiView(t)}getNullCell(){return new r.CellData}}},3785:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const s=i(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new s.CellData)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}}},8285:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const s=i(8771),r=i(8460);t.BufferNamespaceApi=class{constructor(e){this._core=e,this._onBufferChange=new r.EventEmitter,this.onBufferChange=this._onBufferChange.event,this._normal=new s.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new s.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,i)=>t(e,i.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=i(2585),o=i(5295),a=i(8460),h=i(844);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let c=class extends h.Disposable{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new o.BufferSet(e,this))}get buffer(){return this.buffers.active}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;const r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(0===i.scrollTop){const e=i.lines.isFull;n===i.lines.length-1?e?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),e?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const e=n-r+1;i.lines.shiftElements(r+1,e-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t,i){const s=this.buffer;if(e<0){if(0===s.ydisp)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this.buffer.ydisp)}scrollToBottom(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)}scrollToLine(e){const t=e-this.buffer.ydisp;0!==t&&this.scrollLines(t)}};c=s([r(0,n.IOptionsService)],c),t.BufferService=c},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=i(2585),o=i(8460),a=i(844),h={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function c(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}const l=String.fromCharCode,d={DEFAULT:e=>{const t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${l(t[0])}${l(t[1])}${l(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.x};${e.y}${t}`}};let _=class extends a.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const e of Object.keys(h))this.addProtocol(e,h[e]);for(const e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};_=s([r(0,n.IBufferService),r(1,n.ICoreService)],_),t.CoreMouseService=_},6975:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=i(2585),o=i(8460),a=i(1439),h=i(844),c=Object.freeze({insertMode:!1}),l=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=class extends h.Disposable{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(c),this.decPrivateModes=(0,a.clone)(l)}reset(){this.modes=(0,a.clone)(c),this.decPrivateModes=(0,a.clone)(l)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};d=s([r(0,n.IBufferService),r(1,n.ILogService),r(2,n.IOptionsService)],d),t.CoreService=d},9074:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const s=i(8055),r=i(8460),n=i(844),o=i(6106);let a=0,h=0;class c extends n.Disposable{constructor(){super(),this._decorations=new o.SortedList((e=>null==e?void 0:e.marker.line)),this._onDecorationRegistered=this.register(new r.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new r.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)((()=>{for(const e of this._decorations.values())this._onDecorationRemoved.fire(e);this.reset()})))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;const t=new l(e);if(t){const e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){var s,r,n;let o=0,a=0;for(const h of this._decorations.getKeyIterator(t))o=null!==(s=h.options.x)&&void 0!==s?s:0,a=o+(null!==(r=h.options.width)&&void 0!==r?r:1),e>=o&&e{var r,n,o;a=null!==(r=t.options.x)&&void 0!==r?r:0,h=a+(null!==(n=t.options.width)&&void 0!==n?n:1),e>=a&&e{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const s=i(2585),r=i(8343);class n{constructor(...e){this._entries=new Map;for(const[t,i]of e)this.set(t,i)}set(e,t){const i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(const[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(s.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){const i=(0,r.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),s=[];for(const t of i){const i=this._services.get(t.id);if(!i)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);s.push(i)}const n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...[...t,...s])}}},7866:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.LogService=void 0;const n=i(844),o=i(2585),a={debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF};let h=class extends n.Disposable{constructor(e){super(),this._optionsService=e,this.logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel())))}_updateLogLevel(){this.logLevel=a[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const s=i(8460),r=i(6114),n=i(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:r.isMac,windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const o=["normal","bold","100","200","300","400","500","600","700","800","900"];class a extends n.Disposable{constructor(e){super(),this._onOptionChange=this.register(new s.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i=Object.assign({},t.DEFAULT_OPTIONS);for(const t in e)if(t in i)try{const s=e[t];i[t]=this._sanitizeAndValidateOption(t,s)}catch(e){console.error(e)}this.rawOptions=i,this.options=Object.assign({},i),this._setupOptions()}onSpecificOptionChange(e,t){return this.onOptionChange((i=>{i===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((i=>{-1!==e.indexOf(i)&&t()}))}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const s={get:e.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[e]),!function(e){return"block"===e||"underline"===e||"bar"===e}(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=o.includes(i)?i:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);case"rows":case"cols":if(!i&&0!==i)throw new Error(`${e} must be numeric, value: ${i}`)}return i}}t.OptionsService=a},2660:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=i(2585);let o=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const i=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[i]};return i.onDispose((()=>this._removeMarkerFromLink(s,i))),this._dataByLinkId.set(s.id,s),s.id}const i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;const n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(o,n))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){const i=this._dataByLinkId.get(e);if(i&&i.lines.every((e=>e.line!==t))){const e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(i,e)))}}getLinkData(e){var t;return null===(t=this._dataByLinkId.get(e))||void 0===t?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){const i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};o=s([r(0,n.IBufferService)],o),t.OscLinkService=o},8343:(e,t)=>{function i(e,t,i){t.di$target===t?t.di$dependencies.push({id:e,index:i}):(t.di$dependencies=[{id:e,index:i}],t.di$target=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0,t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e.di$dependencies||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const s=function(e,t,r){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");i(s,e,r)};return s.toString=()=>e,t.serviceRegistry.set(e,s),s}},2585:(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(8343);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"),(r=t.LogLevelEnum||(t.LogLevelEnum={}))[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.WARN=2]="WARN",r[r.ERROR=3]="ERROR",r[r.OFF=4]="OFF",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")},1480:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const s=i(8460),r=i(225);t.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new s.EventEmitter,this.onChange=this._onChange.event;const e=new r.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0;const i=e.length;for(let s=0;s=i)return t+this.wcwidth(r);const n=e.charCodeAt(s);56320<=n&&n<=57343?r=1024*(r-55296)+n-56320+65536:t+=this.wcwidth(n)}t+=this.wcwidth(r)}return t}}}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const t=i(3236),r=i(9042),n=i(7975),o=i(7090),a=i(5741),h=i(8285),c=["cols","rows"];e.Terminal=class{constructor(e){this._core=new t.Terminal(e),this._addonManager=new a.AddonManager,this._publicOptions=Object.assign({},this._core.options);const i=e=>this._core.options[e],s=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const e in this._core.options){const t={get:i.bind(this,e),set:s.bind(this,e)};Object.defineProperty(this._publicOptions,e,t)}}_checkReadonlyOptions(e){if(c.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new n.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new o.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=new h.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.addMarker(e)}registerDecoration(e){var t,i,s;return this._checkProposedApi(),this._verifyPositiveIntegers(null!==(t=e.x)&&void 0!==t?t:0,null!==(i=e.width)&&void 0!==i?i:0,null!==(s=e.height)&&void 0!==s?s:0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){this._addonManager.dispose(),this._core.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write("\r\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){return this._addonManager.loadAddon(this,e)}static get strings(){return r}_verifyIntegers(...e){for(const t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(const t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}})(),s})()})); //# sourceMappingURL=xterm.js.map \ No newline at end of file diff --git a/lxconsole/static/js/xterm/xterm.js.map b/lxconsole/static/js/xterm/xterm.js.map index 68cd2e2..8cdd067 100644 --- a/lxconsole/static/js/xterm/xterm.js.map +++ b/lxconsole/static/js/xterm/xterm.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://xterm/webpack/universalModuleDefinition","webpack://xterm/./src/browser/AccessibilityManager.ts","webpack://xterm/./src/browser/Clipboard.ts","webpack://xterm/./src/browser/Color.ts","webpack://xterm/./src/browser/ColorContrastCache.ts","webpack://xterm/./src/browser/ColorManager.ts","webpack://xterm/./src/browser/Dom.ts","webpack://xterm/./src/browser/Lifecycle.ts","webpack://xterm/./src/browser/Linkifier.ts","webpack://xterm/./src/browser/Linkifier2.ts","webpack://xterm/./src/browser/LocalizableStrings.ts","webpack://xterm/./src/browser/MouseZoneManager.ts","webpack://xterm/./src/browser/RenderDebouncer.ts","webpack://xterm/./src/browser/ScreenDprMonitor.ts","webpack://xterm/./src/browser/Terminal.ts","webpack://xterm/./src/browser/Viewport.ts","webpack://xterm/./src/browser/input/CompositionHelper.ts","webpack://xterm/./src/browser/input/Mouse.ts","webpack://xterm/./src/browser/input/MoveToCell.ts","webpack://xterm/./src/browser/public/AddonManager.ts","webpack://xterm/./src/browser/public/Terminal.ts","webpack://xterm/./src/browser/renderer/BaseRenderLayer.ts","webpack://xterm/./src/browser/renderer/CharacterJoinerRegistry.ts","webpack://xterm/./src/browser/renderer/CursorRenderLayer.ts","webpack://xterm/./src/browser/renderer/GridCache.ts","webpack://xterm/./src/browser/renderer/LinkRenderLayer.ts","webpack://xterm/./src/browser/renderer/Renderer.ts","webpack://xterm/./src/browser/renderer/RendererUtils.ts","webpack://xterm/./src/browser/renderer/SelectionRenderLayer.ts","webpack://xterm/./src/browser/renderer/TextRenderLayer.ts","webpack://xterm/./src/browser/renderer/atlas/BaseCharAtlas.ts","webpack://xterm/./src/browser/renderer/atlas/CharAtlasCache.ts","webpack://xterm/./src/browser/renderer/atlas/CharAtlasUtils.ts","webpack://xterm/./src/browser/renderer/atlas/Constants.ts","webpack://xterm/./src/browser/renderer/atlas/DynamicCharAtlas.ts","webpack://xterm/./src/browser/renderer/atlas/LRUMap.ts","webpack://xterm/./src/browser/renderer/dom/DomRenderer.ts","webpack://xterm/./src/browser/renderer/dom/DomRendererRowFactory.ts","webpack://xterm/./src/browser/selection/SelectionModel.ts","webpack://xterm/./src/browser/services/CharSizeService.ts","webpack://xterm/./src/browser/services/CoreBrowserService.ts","webpack://xterm/./src/browser/services/MouseService.ts","webpack://xterm/./src/browser/services/RenderService.ts","webpack://xterm/./src/browser/services/SelectionService.ts","webpack://xterm/./src/browser/services/Services.ts","webpack://xterm/./src/browser/services/SoundService.ts","webpack://xterm/./src/common/CircularList.ts","webpack://xterm/./src/common/Clone.ts","webpack://xterm/./src/common/CoreTerminal.ts","webpack://xterm/./src/common/EventEmitter.ts","webpack://xterm/./src/common/InputHandler.ts","webpack://xterm/./src/common/Lifecycle.ts","webpack://xterm/./src/common/Platform.ts","webpack://xterm/./src/common/TypedArrayUtils.ts","webpack://xterm/./src/common/WindowsMode.ts","webpack://xterm/./src/common/buffer/AttributeData.ts","webpack://xterm/./src/common/buffer/Buffer.ts","webpack://xterm/./src/common/buffer/BufferLine.ts","webpack://xterm/./src/common/buffer/BufferReflow.ts","webpack://xterm/./src/common/buffer/BufferSet.ts","webpack://xterm/./src/common/buffer/CellData.ts","webpack://xterm/./src/common/buffer/Constants.ts","webpack://xterm/./src/common/buffer/Marker.ts","webpack://xterm/./src/common/data/Charsets.ts","webpack://xterm/./src/common/data/EscapeSequences.ts","webpack://xterm/./src/common/input/Keyboard.ts","webpack://xterm/./src/common/input/TextDecoder.ts","webpack://xterm/./src/common/input/UnicodeV6.ts","webpack://xterm/./src/common/input/WriteBuffer.ts","webpack://xterm/./src/common/parser/Constants.ts","webpack://xterm/./src/common/parser/DcsParser.ts","webpack://xterm/./src/common/parser/EscapeSequenceParser.ts","webpack://xterm/./src/common/parser/OscParser.ts","webpack://xterm/./src/common/parser/Params.ts","webpack://xterm/./src/common/services/BufferService.ts","webpack://xterm/./src/common/services/CharsetService.ts","webpack://xterm/./src/common/services/CoreMouseService.ts","webpack://xterm/./src/common/services/CoreService.ts","webpack://xterm/./src/common/services/DirtyRowService.ts","webpack://xterm/./src/common/services/InstantiationService.ts","webpack://xterm/./src/common/services/LogService.ts","webpack://xterm/./src/common/services/OptionsService.ts","webpack://xterm/./src/common/services/ServiceRegistry.ts","webpack://xterm/./src/common/services/Services.ts","webpack://xterm/./src/common/services/UnicodeService.ts","webpack://xterm/webpack/bootstrap","webpack://xterm/webpack/startup"],"names":["root","factory","exports","module","define","amd","a","i","self","_terminal","_renderService","_liveRegionLineCount","_charsToConsume","_charsToAnnounce","_accessibilityTreeRoot","document","createElement","classList","add","_rowContainer","setAttribute","_rowElements","rows","_createAccessibilityTreeNode","appendChild","_topBoundaryFocusListener","e","_onBoundaryFocus","_bottomBoundaryFocusListener","addEventListener","length","_refreshRowsDimensions","_renderRowsDebouncer","RenderDebouncer","_renderRows","bind","_refreshRows","_liveRegion","element","Error","insertAdjacentElement","register","onResize","_onResize","onRender","start","end","onScroll","onA11yChar","char","_onChar","onLineFeed","onA11yTab","spaceCount","_onTab","onKey","_onKey","key","onBlur","_clearLiveRegion","onDimensionsChange","_screenDprMonitor","ScreenDprMonitor","setListener","addDisposableDomListener","window","dispose","removeElementFromParent","this","position","boundaryElement","target","beforeBoundaryElement","getAttribute","buffer","lines","relatedTarget","topBoundaryElement","bottomBoundaryElement","pop","removeChild","shift","removeEventListener","newElement","unshift","push","scrollLines","focus","preventDefault","stopImmediatePropagation","children","tabIndex","_refreshRowDimensions","MAX_ROWS_TO_READ","textContent","Strings","tooMuchOutput","isMac","parentNode","setTimeout","keyChar","refresh","setSize","toString","lineData","translateBufferLineToString","ydisp","posInSet","innerText","_announceCharacters","dimensions","actualCellHeight","style","height","Disposable","AccessibilityManager","prepareTextForTerminal","text","replace","bracketTextForPaste","bracketedPasteMode","paste","textarea","coreService","decPrivateModes","triggerDataEvent","value","moveTextAreaUnderMouseCursor","ev","screenElement","pos","getBoundingClientRect","left","clientX","top","clientY","width","zIndex","selectionService","clipboardData","setData","selectionText","stopPropagation","getData","shouldSelectWord","rightClickSelect","select","channels","rgb","rgba","toPaddedHex","c","s","contrastRatio","l1","l2","toCss","r","g","b","undefined","toRgba","color","blend","bg","fg","css","fgR","fgG","fgB","bgR","bgG","bgB","Math","round","isOpaque","ensureContrastRatio","ratio","result","toColor","opaque","rgbaColor","toChannels","opacity","parseInt","slice","relativeLuminance2","rs","gs","bs","pow","relativeLuminance","reduceLuminance","bgRgba","fgRgba","cr","max","ceil","increaseLuminance","min","bgL","fgL","_color","_rgba","clear","setCss","getCss","setColor","getColor","ColorContrastCache","DEFAULT_FOREGROUND","DEFAULT_BACKGROUND","DEFAULT_CURSOR","DEFAULT_CURSOR_ACCENT","DEFAULT_SELECTION","DEFAULT_ANSI_COLORS","Object","freeze","colors","v","allowTransparency","canvas","ctx","getContext","_ctx","globalCompositeOperation","_litmusColor","createLinearGradient","_contrastCache","foreground","background","cursor","cursorAccent","selectionTransparent","selectionOpaque","ansi","contrastCache","onOptionsChange","setTheme","theme","_parseColor","selection","black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite","fallback","fillStyle","console","warn","fillRect","data","getImageData","substring","split","map","component","Number","alpha","ColorManager","elements","parentElement","node","type","handler","options","disposed","_bufferService","_logService","_unicodeService","_linkMatchers","_nextLinkMatcherId","_onShowLinkUnderline","EventEmitter","_onHideLinkUnderline","_onLinkTooltip","_rowsToLinkify","event","attachToDom","mouseZoneManager","_element","_mouseZoneManager","linkifyRows","clearAll","_rowsTimeoutId","clearTimeout","_linkifyRows","Linkifier","_timeBeforeLatency","absoluteRowIndexStart","absoluteRowIndexEnd","overscanLineLimit","cols","iterator","hasNext","next","_doLinkifyRow","range","first","content","debug","registerLinkMatcher","regex","matcher","id","matchIndex","validationCallback","hoverTooltipCallback","tooltipCallback","hoverLeaveCallback","leaveCallback","willLinkActivate","priority","_addLinkMatcherToList","splice","deregisterLinkMatcher","matcherId","rowIndex","match","rex","RegExp","source","flags","stringIndex","uri","indexOf","lastIndex","bufferIndex","stringIndexToBufferIndex","line","get","attr","getFg","isValid","_addLink","exec","x","y","getStringCellWidth","x1","y1","floor","x2","y2","MouseZone","newWindow","open","opener","location","href","fire","_createLinkHoverEvent","remove","IBufferService","ILogService","IUnicodeService","clickCallback","hoverCallback","_linkProviders","_linkCacheDisposables","_isMouseOut","_activeLine","getDisposeArrayDisposable","registerLinkProvider","linkProvider","providerIndex","mouseService","renderService","_mouseService","_clearCurrentLink","_onMouseMove","_onClick","_lastMouseEvent","_positionFromMouseEvent","composedPath","contains","_lastBufferCell","_onHover","_askForLink","_currentLink","_linkAtPosition","link","useLineCache","_activeProviderReplies","forEach","reply","linkWithState","Map","linkProvided","_checkLinkProviderResult","provideLinks","links","linksWithState","set","size","_removeIntersectingLinks","replies","occupiedCells","Set","providerReply","startX","endX","has","index","hasLinkBefore","j","linkAtPosition","find","_handleNewLink","currentLink","activate","startRow","endRow","_linkLeave","disposeArray","state","decorations","underline","pointerCursor","isHovered","_linkHover","defineProperties","toggle","_fireUnderlineEvent","onRenderedBufferChange","hover","showEvent","scrollOffset","_createLinkUnderlineEvent","leave","sameLine","wrappedFromLeft","wrappedToRight","coords","getCoords","Linkifier2","promptLabel","_screenElement","_selectionService","_optionsService","_zones","_areZonesActive","_lastHoverCoords","_initialSelectionLength","_onMouseDown","_mouseMoveListener","_mouseLeaveListener","_onMouseLeave","_clickListener","_deactivate","zone","_activate","_currentZone","pageX","pageY","_findZoneEventAt","_tooltipTimeout","_onTooltip","linkTooltipHoverDuration","_getSelectionLength","currentSelectionLength","IMouseService","ISelectionService","IOptionsService","MouseZoneManager","_renderCallback","_animationFrame","cancelAnimationFrame","rowStart","rowEnd","rowCount","_rowCount","_rowStart","_rowEnd","requestAnimationFrame","_innerRefresh","_currentDevicePixelRatio","devicePixelRatio","listener","_listener","clearListener","_outerListener","_updateDpr","_resolutionMediaMatchList","removeListener","matchMedia","addListener","browser","Browser","_keyDownHandled","_onCursorMove","_onRender","_onSelectionChange","_onTitleChange","_onFocus","_onBlur","_onA11yCharEmitter","_onA11yTabEmitter","_setup","linkifier","_instantiationService","createInstance","linkifier2","_inputHandler","onRequestBell","bell","onRequestRefreshRows","onRequestReset","reset","onRequestScroll","eraseAttr","isWrapped","scroll","onRequestWindowsOptionsReport","_reportWindowsOptions","onAnsiColorChange","_changeAnsiColor","forwardEvent","onCursorMove","onTitleChange","_afterResize","optionsService","_colorManager","ansiColor","colorIndex","setColors","viewport","onThemeChange","_isDisposed","_customKeyEventHandler","write","buffers","active","preventScroll","_updateOptions","_charSizeService","measure","setRenderer","_createRenderer","syncScrollArea","screenReaderMode","_accessibilityManager","setupTabStops","_setTheme","_onTextAreaFocus","_coreService","sendFocus","C0","ESC","updateCursorStyle","_showCursor","blur","_onTextAreaBlur","_syncTextArea","isCursorInViewport","_compositionHelper","isComposing","cellHeight","lineHeight","cursorTop","cursorLeft","_initGlobal","_bindKeys","hasSelection","copyHandler","pasteHandlerWrapper","handlePasteEvent","isFirefox","button","rightClickHandler","rightClickSelectsWord","isLinux","_keyUp","_keyDown","_keyPress","compositionstart","compositionupdate","compositionend","updateCompositionElements","_queueLinkification","parent","isConnected","_document","ownerDocument","dir","fragment","createDocumentFragment","_viewportElement","_viewportScrollArea","_helperContainer","coreBrowserService","CoreBrowserService","setService","ICoreBrowserService","CharSizeService","ICharSizeService","_compositionView","CompositionHelper","_theme","onOptionChange","renderer","RenderService","IRenderService","resize","_soundService","SoundService","ISoundService","MouseService","Viewport","amount","suppressEvent","onRequestSyncScrollBar","onFocus","SelectionService","onRequestScrollLines","suppressScrollEvent","onSelectionChange","onRequestRedraw","onSelectionChanged","columnSelectMode","onLinuxMouseSelection","onMouseDown","_coreMouseService","areMouseEventsActive","disable","enable","bindMouse","rendererType","Renderer","DomRenderer","el","sendEvent","but","action","getRawByteCoords","overrideType","buttons","deltaY","triggerMouseEvent","col","row","ctrl","ctrlKey","alt","altKey","shiftKey","requestedEvents","mouseup","wheel","mousedrag","mousemove","eventListeners","cancel","onProtocolChange","events","logLevel","explainEvents","passive","activeProtocol","shouldForceSelection","hasScrollback","getLinesScrolled","sequence","applicationCursorKeys","abs","onWheel","onTouchStart","onTouchMove","refreshRows","shouldColumnSelect","isCursorInitialized","disp","attachCustomKeyEventHandler","customKeyEventHandler","registerCharacterJoiner","joinerId","deregisterCharacterJoiner","markers","addMarker","cursorYOffset","normal","ybase","column","setSelection","getSelection","getSelectionPosition","startColumn","selectionStart","endColumn","selectionEnd","clearSelection","selectAll","selectLines","keydown","scrollToBottom","evaluateKeyboardEvent","macOptionIsMeta","scrollCount","_isThirdLevelShift","ETX","CR","domEvent","thirdLevelKey","metaKey","isWindows","keyCode","wasModifierKeyOnlyEvent","charCode","which","String","fromCharCode","_soundBell","playBellSound","hasValidSize","getBlankLine","DEFAULT_ATTR_DATA","_onScroll","WindowsOptionsReportType","GET_WIN_SIZE_PIXELS","canvasWidth","scaledCanvasWidth","toFixed","canvasHeight","scaledCanvasHeight","GET_CELL_SIZE_PIXELS","cellWidth","scaledCellWidth","scaledCellHeight","force","cancelEvents","_visualBell","bellStyle","CoreTerminal","Terminal","_scrollLines","_scrollArea","scrollBarWidth","_currentRowHeight","_lastRecordedBufferLength","_lastRecordedViewportHeight","_lastRecordedBufferHeight","_lastTouchY","_lastScrollTop","_wheelPartialScroll","_refreshAnimationFrame","_ignoreNextScrollEvent","offsetWidth","backgroundColor","_refresh","immediate","offsetHeight","newBufferHeight","scrollTop","newScrollTop","offsetParent","diff","_bubbleScroll","scrollPosFromTop","cancelable","_getPixelsScrolled","_applyScrollModifier","deltaMode","WheelEvent","DOM_DELTA_LINE","DOM_DELTA_PAGE","DOM_DELTA_PIXEL","modifier","fastScrollModifier","fastScrollSensitivity","scrollSensitivity","touches","_textarea","_isComposing","_isSendingComposition","_compositionPosition","_dataAlreadySent","_finalizeComposition","_handleAnyTextareaChanges","waitForPropagation","input","oldValue","dontRecurse","fontFamily","fontSize","compositionViewBounds","ICoreService","getCoordsRelativeToElement","rect","colCount","hasValidCharSize","actualCellWidth","isSelection","moveToRequestedRow","startY","targetY","bufferService","applicationCursor","wrappedRowsForRow","repeat","wrappedRows","direction","verticalDirection","wrappedRowsCount","currentRow","lineWraps","bufferLine","startCol","endCol","forward","currentCol","bufferStr","mod","count","str","rpt","targetX","resetStartingRow","horizontalDirection","moveToRequestedCol","rowDifference","currX","colsFromRowEnd","_addons","instance","loadAddon","terminal","loadedAddon","isDisposed","_wrappedAddonDispose","apply","AddonManager","_core","_addonManager","_checkProposedApi","allowProposedApi","onData","onBinary","_parser","ParserApi","UnicodeApi","_buffer","BufferNamespaceApi","columns","_verifyIntegers","registerMarker","scrollPages","pageCount","scrollToTop","scrollToLine","callback","writeUtf8","writeln","getOption","setOption","addon","values","Infinity","isNaN","init","getLine","BufferLineApiView","getNullCell","CellData","_onBufferChange","_normal","BufferApiView","_alternate","onBufferActivate","alternate","_line","getCell","cell","loadCell","translateToString","trimRight","registerCsiHandler","addCsiHandler","params","toArray","registerDcsHandler","addDcsHandler","registerEscHandler","addEscHandler","registerOscHandler","ident","addOscHandler","provider","unicodeService","versions","activeVersion","version","_container","_alpha","_colors","_rendererId","_scaledCharWidth","_scaledCharHeight","_scaledCellWidth","_scaledCellHeight","_scaledCharLeft","_scaledCharTop","_currentGlyphIdentifier","chars","code","bold","dim","italic","_canvas","_initCanvas","_charAtlas","throwIfFalsy","_clearAll","onOptionsChanged","onGridChanged","colorSet","_refreshCharAtlas","_setTransparency","oldCanvas","cloneNode","replaceChild","acquireCharAtlas","warmUp","scaledCharWidth","scaledCharHeight","scaledCharLeft","scaledCharTop","_fillCells","_fillBottomLineAtCells","_fillLeftLineAtCell","_strokeRectAtCell","lineWidth","strokeRect","clearRect","_clearCells","_fillCharTrueColor","font","_getFont","textBaseline","_clipRow","fillText","getChars","_drawChars","contrastColor","_getContrastColor","isFgRGB","isBgRGB","_drawUncachedChars","isInverse","isBgDefault","INVERTED_DEFAULT_COLOR","getBgColor","isFgDefault","getFgColor","DEFAULT_COLOR","drawBoldTextInBrightColors","isBold","WHITESPACE_CELL_CHAR","getCode","WHITESPACE_CELL_CODE","isDim","isItalic","draw","fgOverride","save","AttributeData","toColorRGB","join","globalAlpha","DIM_OPACITY","restore","beginPath","clip","fontWeightBold","fontWeight","minimumContrastRatio","adjustedColor","fgColor","fgColorMode","getFgColorMode","bgColor","bgColorMode","getBgColorMode","temp","temp2","_resolveBackgroundRgba","_resolveForegroundRgba","inverse","BaseRenderLayer","firstCell","combinedData","_width","isCombined","getWidth","setFromCharData","getAsCharData","JoinedCellData","_characterJoiners","_nextCharacterJoinerId","_workCell","joiner","getJoinedCharacters","ranges","lineStr","rangeStartColumn","currentStringIndex","rangeStartStringIndex","rangeAttrFG","rangeAttrBG","getBg","getTrimmedLength","joinedRanges","_getJoinedRanges","startIndex","endIndex","joinerRanges","CharacterJoinerRegistry","_mergeRanges","_stringRangesToCellRanges","currentRangeIndex","currentRangeStarted","currentRange","getString","newRange","inRange","BLINK_INTERVAL","container","rendererId","_onRequestRedraw","_coreBrowserService","_cell","_state","isFocused","_cursorRenderers","_renderBarCursor","_renderBlockCursor","_renderUnderlineCursor","_clearCursor","_cursorBlinkStateManager","pause","resume","cursorBlink","CursorBlinkStateManager","_render","restartBlinkAnimation","isPaused","triggeredByAnimationFrame","isCursorHidden","cursorY","viewportRelativeCursorY","cursorX","cursorStyle","_renderBlurCursor","isCursorVisible","cursorWidth","strokeStyle","CursorRenderLayer","_restartInterval","_blinkStartTimeout","_blinkInterval","clearInterval","_animationTimeRestarted","Date","now","timeToStart","time","setInterval","cache","GridCache","onShowLinkUnderline","onHideLinkUnderline","middleRowCount","is256Color","LinkRenderLayer","nextRendererId","_id","_characterJoinerRegistry","_renderLayers","TextRenderLayer","SelectionRenderLayer","_devicePixelRatio","_updateDimensions","removeTerminalFromCache","onDevicePixelRatioChange","l","onCharSizeChanged","_runOperation","operation","renderRows","letterSpacing","_clearState","_didStateChange","viewportStartRow","viewportEndRow","viewportCappedStartRow","viewportCappedEndRow","startRowEndCol","middleRowsCount","_areCoordinatesEqual","coord1","coord2","characterJoinerRegistry","_characterWidth","_characterFont","_characterOverlapCache","terminalFont","_forEachCell","firstRow","lastRow","joinerRegistry","isJoined","lastCharX","_isOverlapping","getCodePoint","NULL_CELL_CODE","_drawBackground","prevFillStyle","nextFillStyle","isBgPalette","_drawForeground","isInvisible","isUnderline","beginFrame","hasOwnProperty","overlaps","measureText","_didWarmUp","_doWarmUp","BaseCharAtlas","charAtlasCache","newConfig","generateConfig","ownedByIndex","entry","ownedBy","configEquals","config","atlas","newEntry","DynamicCharAtlas","clonedColors","colorCode","CHAR_ATLAS_CELL_SPACING","TRANSPARENT_COLOR","getGlyphCacheKey","glyph","_config","_drawToCacheCount","_glyphsWaitingOnBitmap","_bitmapCommitTimeout","_bitmap","_cacheCanvas","_cacheCtx","tmpCanvas","_tmpCtx","_height","capacity","_cacheMap","LRUMap","prealloc","_canCache","glyphKey","cacheValue","_drawFromCache","peek","_drawToCache","_toCoordinateX","_toCoordinateY","isEmpty","cacheX","cacheY","drawImage","inBitmap","_getColorFromAnsiIndex","idx","_getBackgroundColor","_getForegroundColor","fontStyle","imageData","offset","clearColor","putImageData","_addGlyphToBitmap","isSafari","_generateBitmap","glyphsMovingToBitmap","createImageBitmap","then","bitmap","NoneCharAtlas","_map","_head","_tail","_nodePool","_unlinkNode","prev","_appendNode","tail","nodePool","peekValue","head","TERMINAL_CLASS_PREFIX","FG_CLASS_PREFIX","BG_CLASS_PREFIX","FOCUS_CLASS","nextTerminalId","_linkifier","_linkifier2","_terminalClass","_refreshRowElements","_selectionContainer","_injectCss","_rowFactory","DomRendererRowFactory","_onLinkHover","_onLinkLeave","_themeStyleElement","_dimensionsStyleElement","overflow","styles","_terminalSelector","BOLD_CLASS","ITALIC_CLASS","CURSOR_CLASS","CURSOR_STYLE_BLOCK_CLASS","CURSOR_BLINK_CLASS","CURSOR_STYLE_BAR_CLASS","CURSOR_STYLE_UNDERLINE_CLASS","documentFragment","_createSelectionElement","colStart","colEnd","cursorAbsoluteY","rowElement","createRow","_setCellUnderline","enabled","span","textDecoration","DIM_CLASS","UNDERLINE_CLASS","isCursorRow","lineLength","charElement","_applyMinimumContrast","_addStyle","padStart","padChar","isSelectAllActive","selectionStartLength","areSelectionValuesReversed","startPlusLength","onTrim","SelectionModel","_onCharSizeChange","_measureStrategy","DomMeasureStrategy","_parentElement","_result","_measureElement","geometry","getRootNode","activeElement","hasFocus","_renderer","_isPaused","_needsFullRefresh","_isNextRenderRedrawOnly","_needsSelectionRefresh","_canvasWidth","_canvasHeight","_selectionState","_onDimensionsChange","_onRefreshRequest","_renderDebouncer","_fullRefresh","onCharSizeChange","IntersectionObserver","_onIntersectionChange","threshold","observe","disconnect","isIntersecting","intersectionRatio","isRedrawOnly","_fireOnCanvasResize","changeOptions","NON_BREAKING_SPACE_CHAR","ALL_NON_BREAKING_SPACE_REGEX","_dragScrollAmount","_enabled","_mouseDownTimeStamp","_oldHasSelection","_oldSelectionStart","_oldSelectionEnd","_onLinuxMouseSelection","_onRedrawRequest","_onRequestScrollLines","_mouseUpListener","_onMouseUp","onUserInput","_trimListener","_onTrim","_onBufferActivate","_model","_activeSelectionMode","_removeMouseDownListeners","finalSelectionStart","finalSelectionEnd","lineText","isLinuxMouseSelection","_isClickInSelection","_getMouseBufferCoords","_areCoordsInSelection","_selectWordAtCursor","_selectWordAt","_getMouseEventScrollAmount","terminalHeight","macOptionClickForcesSelection","timeStamp","_onIncrementalClick","detail","_onSingleClick","_onDoubleClick","_onTripleClick","_addMouseDownListeners","_dragScrollIntervalTimer","_dragScroll","hasWidth","_selectLineAt","previousSelectionEnd","_selectToWordAt","timeElapsed","coordinates","moveToCellSequence","_fireEventIfSelectionChanged","_fireOnSelectionChange","activeBuffer","_convertViewportColToCharacterIndex","charIndex","_getWordAt","allowWhitespaceOnlySelection","followWrappedLinesAbove","followWrappedLinesBelow","charOffset","leftWideCharCount","rightWideCharCount","leftLongCharOffset","rightLongCharOffset","charAt","_isCharWordSeparator","trim","previousBufferLine","previousLineWordPosition","nextBufferLine","nextLineWordPosition","wordPosition","wordSeparator","wrappedRange","getWrappedRangeForLine","last","createDecorator","_audioContext","audioContextCtor","AudioContext","webkitAudioContext","audioContext","bellAudioSource","createBufferSource","decodeAudioData","_base64ToArrayBuffer","_removeMimeType","bellSound","connect","destination","base64","binaryString","atob","len","bytes","Uint8Array","charCodeAt","dataURI","_maxLength","onDeleteEmitter","onInsertEmitter","onTrimEmitter","_array","Array","_startIndex","_length","newMaxLength","newArray","_getCyclicIndex","newLength","recycle","deleteCount","items","countToTrim","trimStart","shiftElements","expandListBy","CircularList","clone","val","depth","clonedObject","isArray","_onBinary","_onData","_onLineFeed","InstantiationService","OptionsService","BufferService","LogService","CoreService","CoreMouseService","ICoreMouseService","_dirtyRowService","DirtyRowService","IDirtyRowService","UnicodeService","_charsetService","CharsetService","ICharsetService","InputHandler","_writeBuffer","WriteBuffer","parse","_windowsMode","writeSync","MINIMUM_COLS","MINIMUM_ROWS","newLine","_cachedBlankLine","topRow","bottomRow","scrollBottom","willBufferBeTrimmed","isFull","copyFrom","isUserScrolling","scrollRegionHeight","markRangeDirty","oldYdisp","scrollAmount","windowsMode","_enableWindowsMode","updateWindowsModeWrappedState","final","_listeners","_disposed","_event","arg1","arg2","queue","call","from","to","GLEVEL","MAX_PARSEBUFFER_LENGTH","paramToWindowOption","n","opts","setWinLines","restoreWin","minimizeWin","setWinPosition","setWinSizePixels","raiseWin","lowerWin","refreshWin","setWinSizeChars","maximizeWin","fullscreenWin","getWinState","getWinPosition","getWinSizePixels","getScreenSizePixels","getCellSizePixels","getWinSizeChars","getScreenSizeChars","getIconTitle","getWinTitle","pushTitle","popTitle","_data","Uint32Array","hook","put","concat","subarray","unhook","success","utf32ToString","pt","EscapeSequenceParser","_parseBuffer","_stringDecoder","StringToUtf32","_utf8Decoder","Utf8ToUtf32","_windowTitle","_iconName","_windowTitleStack","_iconNameStack","_curAttrData","_eraseAttrDataInternal","_onRequestBell","_onRequestRefreshRows","_onRequestReset","_onRequestScroll","_onRequestSyncScrollBar","_onRequestWindowsOptionsReport","_onA11yChar","_onA11yTab","_onAnsiColorChange","setCsiHandlerFallback","identifier","identToString","setEscHandlerFallback","setExecuteHandlerFallback","setOscHandlerFallback","setDcsHandlerFallback","payload","setPrintHandler","print","insertChars","intermediates","scrollLeft","cursorUp","scrollRight","cursorDown","cursorForward","cursorBackward","cursorNextLine","cursorPrecedingLine","cursorCharAbsolute","cursorPosition","cursorForwardTab","eraseInDisplay","prefix","eraseInLine","insertLines","deleteLines","deleteChars","scrollUp","scrollDown","eraseChars","cursorBackwardTab","charPosAbsolute","hPositionRelative","repeatPrecedingCharacter","sendDeviceAttributesPrimary","sendDeviceAttributesSecondary","linePosAbsolute","vPositionRelative","hVPosition","tabClear","setMode","setModePrivate","resetMode","resetModePrivate","charAttributes","deviceStatus","deviceStatusPrivate","softReset","setCursorStyle","setScrollRegion","saveCursor","windowOptions","restoreCursor","insertColumns","deleteColumns","setExecuteHandler","BEL","LF","lineFeed","VT","FF","carriageReturn","BS","backspace","HT","tab","SO","shiftOut","SI","shiftIn","C1","IND","NEL","nextLine","HTS","tabSet","OscHandler","setTitle","setIconName","setAnsiColor","reverseIndex","keypadApplicationMode","keypadNumericMode","fullReset","setgLevel","selectDefaultCharset","flag","selectCharset","CHARSETS","screenAlignmentPattern","setErrorHandler","error","DECRQSS","cursorStartX","cursorStartY","clearRange","decode","chWidth","charset","wraparoundMode","wraparound","insertMode","modes","curAttr","bufferRow","markDirty","setCellFromCodePoint","extended","wcwidth","ch","stringFromCodePoint","_eraseAttrData","insertCells","NULL_CELL_WIDTH","addCodepointToCell","precedingCodepoint","hasContent","DcsHandler","convertEol","reverseWraparound","_restrictCursor","originalX","nextStop","maxCol","origin","_setCursor","_moveCursor","diffToTop","diffToBottom","param","tabs","prevStop","_eraseInBufferLine","clearWrap","replaceCells","_resetBufferLine","fill","scrollBackSize","scrollBottomRowsOffset","scrollBottomAbsolute","deleteCells","_is","term","termName","setgCharset","DEFAULT_CHARSET","applicationKeypad","activeEncoding","activateAltBuffer","activateNormalBuffer","_updateAttrColor","mode","c1","c2","c3","fromColorRGB","_extractColor","accu","cSpace","advance","hasSubParams","subparams","getSubParams","underlineColor","_processUnderline","underlineStyle","updateExtended","p","savedX","savedY","savedCurAttrData","savedCharset","isBlinking","bottom","second","_savedCharset","_parseAnsiColorChange","collectAndFlag","level","yOffset","markAllDirty","_disposables","d","unregister","disposables","array","isNode","navigator","userAgent","platform","includes","test","isIpad","isIphone","fillFallback","constructor","lastChar","CHAR_DATA_CODE_INDEX","ExtendedAttrs","newObj","isBlink","isFgPalette","isAttributeDefault","hasExtendedAttrs","getUnderlineColor","getUnderlineColorMode","isUnderlineColorRGB","isUnderlineColorPalette","isUnderlineColorDefault","getUnderlineStyle","MAX_BUFFER_SIZE","_hasScrollback","_nullCell","fromCharData","NULL_CELL_CHAR","_whitespaceCell","WHITESPACE_CELL_WIDTH","_cols","_rows","_getCorrectBufferLength","getWhitespaceCell","BufferLine","maxLength","relativeY","correctBufferLength","scrollback","fillViewportRows","fillAttr","newCols","newRows","nullCell","addToY","amountToTrim","_isReflowEnabled","_reflow","_reflowLarger","_reflowSmaller","toRemove","reflowLargerGetLinesToRemove","newLayoutResult","reflowLargerCreateNewLayout","reflowLargerApplyNewLayout","layout","_reflowLargerAdjustViewport","countRemoved","viewportAdjustments","toInsert","countToInsert","wrappedLines","absoluteY","trimmedLines","lastLineLength","destLineLengths","reflowSmallerGetNewLineLengths","linesToAdd","newLines","destLineIndex","destCol","srcLineIndex","srcCol","cellsToCopy","copyCellsFrom","wrappedLinesIndex","getWrappedLineTrimmedLength","setCell","insertEvents","originalLines","originalLinesLength","originalLineIndex","nextToInsertIndex","nextToInsert","countInsertedSoFar","nextI","insertCountEmitted","lineIndex","CHAR_DATA_WIDTH_INDEX","CHAR_DATA_CHAR_INDEX","tabStopWidth","marker","Marker","onInsert","onDelete","onDispose","_removeMarker","startOverscan","endOverscan","BufferStringIterator","Buffer","_trimRight","_endIndex","_startOverscan","_endOverscan","_current","fillCellData","_combined","_extendedAttrs","cp","CHAR_DATA_ATTR_INDEX","codePoint","eAttrs","keys","src","applyInReverse","srcData","srcCombinedKeys","endsInNull","followingLineStartsWithWide","oldCols","bufferAbsoluteY","srcTrimmedTineLength","srcRemainingCells","destRemainingCells","countToRemove","nextToRemoveIndex","nextToRemoveStart","countRemovedSoFar","newLayout","newLayoutLines","newLineLengths","cellsNeeded","reduce","srcLine","cellsAvailable","oldTrimmedLength","endsWithWide","_alt","_activeBuffer","inactiveBuffer","BufferSet","obj","combined","DEFAULT_ATTR","_nextId","_onDispose","C","NUL","SOH","STX","EOT","ENQ","ACK","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","FS","GS","RS","US","SP","DEL","PAD","HOP","BPH","NBH","SSA","ESA","HTJ","VTS","PLD","PLU","RI","SS2","SS3","DCS","PU1","PU2","STS","CCH","MW","SPA","EPA","SOS","SGCI","SCI","CSI","ST","OSC","PM","APC","KEYCODE_KEY_MAPPINGS","48","49","50","51","52","53","54","55","56","57","186","187","188","189","190","191","192","219","220","221","222","applicationCursorMode","modifiers","keyMapping","codepoint","_interim","startPos","interim","byte1","byte2","byte3","byte4","discardInterim","tmp","missing","fourStop","table","BMP_COMBINING","HIGH_COMBINING","num","ucs","mid","bisearch","UnicodeV6","_action","_callbacks","_pendingData","_bufferOffset","cb","_innerWrite","startTime","PAYLOAD_LIMIT","EMPTY_HANDLERS","_handlers","create","_active","_ident","_handlerFb","registerHandler","handlerList","handlerIndex","clearHandler","setHandlerFallback","DcsParser","EMPTY_PARAMS","Params","addParam","_handler","_params","_hitLimit","ret","setDefault","addMany","codes","TransitionTable","NON_ASCII_PRINTABLE","VT500_TRANSITION_TABLE","blueprint","unused","PRINTABLES","EXECUTABLES","states","_transitions","initialState","currentState","_collect","_printHandlerFb","_executeHandlerFb","_csiHandlerFb","_escHandlerFb","_errorHandlerFb","_printHandler","_executeHandlers","_csiHandlers","_escHandlers","_oscParser","OscParser","_dcsParser","_errorHandler","_identifier","finalRange","res","intermediate","finalCode","reverse","clearPrintHandler","clearEscHandler","clearExecuteHandler","clearCsiHandler","clearDcsHandler","clearOscHandler","clearErrorHandler","transition","osc","dcs","collect","abort","handlers","addSubParam","addDigit","handlersEsc","jj","_start","_put","_end","MAX_VALUE","maxSubParamsLength","Int32Array","_subParams","_subParamsLength","_subParamsIdx","Uint16Array","_rejectDigits","_rejectSubDigits","_digitIsSub","fromArray","k","newParams","prototype","getSubParamsAll","store","cur","glevel","_charsets","DEFAULT_PROTOCOLS","NONE","restrict","X10","VT200","DRAG","ANY","eventCode","isSGR","S","DEFAULT_ENCODINGS","DEFAULT","SGR","_protocols","_encodings","_activeProtocol","_activeEncoding","_onProtocolChange","_lastEvent","addProtocol","addEncoding","name","protocol","encoding","_compareEvents","report","triggerBinaryEvent","down","up","drag","move","e1","e2","DEFAULT_MODES","DEFAULT_DEC_PRIVATE_MODES","_onUserInput","_scrollToBottom","wasUserInput","disableStdin","_entries","entries","service","ServiceCollection","_services","IInstantiationService","getService","ctor","serviceDependencies","getServiceDependencies","sort","serviceArgs","dependency","firstServiceArgPos","args","LogLevel","optionsKeyToLogLevel","DEBUG","info","INFO","WARN","ERROR","off","OFF","_updateLogLevel","_logLevel","_evalLazyOptionalParams","optionalParams","_log","message","log","DEFAULT_BELL_SOUND","DEFAULT_OPTIONS","altClickMovesCursor","FONT_WEIGHT_OPTIONS","CONSTRUCTOR_ONLY_OPTIONS","_onOptionChange","newValue","_sanitizeAndValidateOption","storeServiceDependency","serviceRegistry","decorator","arguments","_providers","_onChange","defaultProvider","_activeProvider","__webpack_module_cache__","__webpack_require__","moduleId","__web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AOj2D,KAAK+hE,gBAAgB7f,QAAQ+T,IAG/B,YAAAvkD,mBAAP,SAA0BtM,GAGxB,IAFA,IAAI0B,EAAS,EACPpJ,EAAS0H,EAAE1H,OACRvB,EAAI,EAAGA,EAAIuB,IAAUvB,EAAG,CAC/B,IAAI44B,EAAO3vB,EAAEwtC,WAAWz2C,GAExB,GAAI,OAAU44B,GAAQA,GAAQ,MAAQ,CACpC,KAAM54B,GAAKuB,EAMT,OAAOoJ,EAAS9G,KAAKkiD,QAAQntB,GAE/B,IAAMqxB,EAAShhD,EAAEwtC,WAAWz2C,GAGxB,OAAUiqD,GAAUA,GAAU,MAChCrxB,EAAyB,MAAjBA,EAAO,OAAkBqxB,EAAS,MAAS,MAEnDt/C,GAAU9G,KAAKkiD,QAAQkE,GAG3Bt/C,GAAU9G,KAAKkiD,QAAQntB,GAEzB,OAAOjuB,GAEX,EAxEA,GAAa,EAAAsuC,mBCRT4sB,EAA2B,GCE/B,ODCA,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUpmE,QAG3C,IAAIC,EAASimE,EAAyBE,GAAY,CAGjDpmE,QAAS,IAOV,OAHAqmE,EAAoBD,GAAU3qB,KAAKx7C,EAAOD,QAASC,EAAQA,EAAOD,QAASmmE,GAGpElmE,EAAOD,QCjBRmmE,CAAoB,O","file":"xterm.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(self, function() {\nreturn ","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { ITerminal } from 'browser/Types';\nimport { IBuffer } from 'common/buffer/Types';\nimport { isMac } from 'common/Platform';\nimport { RenderDebouncer } from 'browser/RenderDebouncer';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { Disposable } from 'common/Lifecycle';\nimport { ScreenDprMonitor } from 'browser/ScreenDprMonitor';\nimport { IRenderService } from 'browser/services/Services';\nimport { removeElementFromParent } from 'browser/Dom';\n\nconst MAX_ROWS_TO_READ = 20;\n\nconst enum BoundaryPosition {\n TOP,\n BOTTOM\n}\n\nexport class AccessibilityManager extends Disposable {\n private _accessibilityTreeRoot: HTMLElement;\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[];\n private _liveRegion: HTMLElement;\n private _liveRegionLineCount: number = 0;\n\n private _renderRowsDebouncer: RenderDebouncer;\n private _screenDprMonitor: ScreenDprMonitor;\n\n private _topBoundaryFocusListener: (e: FocusEvent) => void;\n private _bottomBoundaryFocusListener: (e: FocusEvent) => void;\n\n /**\n * This queue has a character pushed to it for keys that are pressed, if the\n * next character added to the terminal is equal to the key char then it is\n * not announced (added to live region) because it has already been announced\n * by the textarea event (which cannot be canceled). There are some race\n * condition cases if there is typing while data is streaming, but this covers\n * the main case of typing into the prompt and inputting the answer to a\n * question (Y/N, etc.).\n */\n private _charsToConsume: string[] = [];\n\n private _charsToAnnounce: string = '';\n\n constructor(\n private readonly _terminal: ITerminal,\n private readonly _renderService: IRenderService\n ) {\n super();\n this._accessibilityTreeRoot = document.createElement('div');\n this._accessibilityTreeRoot.classList.add('xterm-accessibility');\n\n this._rowContainer = document.createElement('div');\n this._rowContainer.setAttribute('role', 'list');\n this._rowContainer.classList.add('xterm-accessibility-tree');\n this._rowElements = [];\n for (let i = 0; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n\n this._topBoundaryFocusListener = e => this._onBoundaryFocus(e, BoundaryPosition.TOP);\n this._bottomBoundaryFocusListener = e => this._onBoundaryFocus(e, BoundaryPosition.BOTTOM);\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._refreshRowsDimensions();\n this._accessibilityTreeRoot.appendChild(this._rowContainer);\n\n this._renderRowsDebouncer = new RenderDebouncer(this._renderRows.bind(this));\n this._refreshRows();\n\n this._liveRegion = document.createElement('div');\n this._liveRegion.classList.add('live-region');\n this._liveRegion.setAttribute('aria-live', 'assertive');\n this._accessibilityTreeRoot.appendChild(this._liveRegion);\n\n if (!this._terminal.element) {\n throw new Error('Cannot enable accessibility before Terminal.open');\n }\n this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityTreeRoot);\n\n this.register(this._renderRowsDebouncer);\n this.register(this._terminal.onResize(e => this._onResize(e.rows)));\n this.register(this._terminal.onRender(e => this._refreshRows(e.start, e.end)));\n this.register(this._terminal.onScroll(() => this._refreshRows()));\n // Line feed is an issue as the prompt won't be read out after a command is run\n this.register(this._terminal.onA11yChar(char => this._onChar(char)));\n this.register(this._terminal.onLineFeed(() => this._onChar('\\n')));\n this.register(this._terminal.onA11yTab(spaceCount => this._onTab(spaceCount)));\n this.register(this._terminal.onKey(e => this._onKey(e.key)));\n this.register(this._terminal.onBlur(() => this._clearLiveRegion()));\n this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions()));\n\n this._screenDprMonitor = new ScreenDprMonitor();\n this.register(this._screenDprMonitor);\n this._screenDprMonitor.setListener(() => this._refreshRowsDimensions());\n // This shouldn't be needed on modern browsers but is present in case the\n // media query that drives the ScreenDprMonitor isn't supported\n this.register(addDisposableDomListener(window, 'resize', () => this._refreshRowsDimensions()));\n }\n\n public dispose(): void {\n super.dispose();\n removeElementFromParent(this._accessibilityTreeRoot);\n this._rowElements.length = 0;\n }\n\n private _onBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {\n const boundaryElement = e.target;\n const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];\n\n // Don't scroll if the buffer top has reached the end in that direction\n const posInSet = boundaryElement.getAttribute('aria-posinset');\n const lastRowPos = position === BoundaryPosition.TOP ? '1' : `${this._terminal.buffer.lines.length}`;\n if (posInSet === lastRowPos) {\n return;\n }\n\n // Don't scroll when the last focused item was not the second row (focus is going the other\n // direction)\n if (e.relatedTarget !== beforeBoundaryElement) {\n return;\n }\n\n // Remove old boundary element from array\n let topBoundaryElement: HTMLElement;\n let bottomBoundaryElement: HTMLElement;\n if (position === BoundaryPosition.TOP) {\n topBoundaryElement = boundaryElement;\n bottomBoundaryElement = this._rowElements.pop()!;\n this._rowContainer.removeChild(bottomBoundaryElement);\n } else {\n topBoundaryElement = this._rowElements.shift()!;\n bottomBoundaryElement = boundaryElement;\n this._rowContainer.removeChild(topBoundaryElement);\n }\n\n // Remove listeners from old boundary elements\n topBoundaryElement.removeEventListener('focus', this._topBoundaryFocusListener);\n bottomBoundaryElement.removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Add new element to array/DOM\n if (position === BoundaryPosition.TOP) {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.unshift(newElement);\n this._rowContainer.insertAdjacentElement('afterbegin', newElement);\n } else {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.push(newElement);\n this._rowContainer.appendChild(newElement);\n }\n\n // Add listeners to new boundary elements\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Scroll up\n this._terminal.scrollLines(position === BoundaryPosition.TOP ? -1 : 1);\n\n // Focus new boundary before element\n this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2].focus();\n\n // Prevent the standard behavior\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n private _onResize(rows: number): void {\n // Remove bottom boundary listener\n this._rowElements[this._rowElements.length - 1].removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Grow rows as required\n for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n // Shrink rows as required\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n\n // Add bottom boundary listener\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._refreshRowsDimensions();\n }\n\n private _createAccessibilityTreeNode(): HTMLElement {\n const element = document.createElement('div');\n element.setAttribute('role', 'listitem');\n element.tabIndex = -1;\n this._refreshRowDimensions(element);\n return element;\n }\n\n private _onTab(spaceCount: number): void {\n for (let i = 0; i < spaceCount; i++) {\n this._onChar(' ');\n }\n }\n\n private _onChar(char: string): void {\n if (this._liveRegionLineCount < MAX_ROWS_TO_READ + 1) {\n if (this._charsToConsume.length > 0) {\n // Have the screen reader ignore the char if it was just input\n const shiftedChar = this._charsToConsume.shift();\n if (shiftedChar !== char) {\n this._charsToAnnounce += char;\n }\n } else {\n this._charsToAnnounce += char;\n }\n\n if (char === '\\n') {\n this._liveRegionLineCount++;\n if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {\n this._liveRegion.textContent += Strings.tooMuchOutput;\n }\n }\n\n // Only detach/attach on mac as otherwise messages can go unaccounced\n if (isMac) {\n if (this._liveRegion.textContent && this._liveRegion.textContent.length > 0 && !this._liveRegion.parentNode) {\n setTimeout(() => {\n this._accessibilityTreeRoot.appendChild(this._liveRegion);\n }, 0);\n }\n }\n }\n }\n\n private _clearLiveRegion(): void {\n this._liveRegion.textContent = '';\n this._liveRegionLineCount = 0;\n\n // Only detach/attach on mac as otherwise messages can go unaccounced\n if (isMac) {\n removeElementFromParent(this._liveRegion);\n }\n }\n\n private _onKey(keyChar: string): void {\n this._clearLiveRegion();\n this._charsToConsume.push(keyChar);\n }\n\n private _refreshRows(start?: number, end?: number): void {\n this._renderRowsDebouncer.refresh(start, end, this._terminal.rows);\n }\n\n private _renderRows(start: number, end: number): void {\n const buffer: IBuffer = this._terminal.buffer;\n const setSize = buffer.lines.length.toString();\n for (let i = start; i <= end; i++) {\n const lineData = buffer.translateBufferLineToString(buffer.ydisp + i, true);\n const posInSet = (buffer.ydisp + i + 1).toString();\n const element = this._rowElements[i];\n if (element) {\n if (lineData.length === 0) {\n element.innerText = '\\u00a0';\n } else {\n element.textContent = lineData;\n }\n element.setAttribute('aria-posinset', posInSet);\n element.setAttribute('aria-setsize', setSize);\n }\n }\n this._announceCharacters();\n }\n\n private _refreshRowsDimensions(): void {\n if (!this._renderService.dimensions.actualCellHeight) {\n return;\n }\n if (this._rowElements.length !== this._terminal.rows) {\n this._onResize(this._terminal.rows);\n }\n for (let i = 0; i < this._terminal.rows; i++) {\n this._refreshRowDimensions(this._rowElements[i]);\n }\n }\n\n private _refreshRowDimensions(element: HTMLElement): void {\n element.style.height = `${this._renderService.dimensions.actualCellHeight}px`;\n }\n\n private _announceCharacters(): void {\n if (this._charsToAnnounce.length === 0) {\n return;\n }\n this._liveRegion.textContent += this._charsToAnnounce;\n this._charsToAnnounce = '';\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ISelectionService } from 'browser/services/Services';\nimport { ICoreService } from 'common/services/Services';\n\n/**\n * Prepares text to be pasted into the terminal by normalizing the line endings\n * @param text The pasted text that needs processing before inserting into the terminal\n */\nexport function prepareTextForTerminal(text: string): string {\n return text.replace(/\\r?\\n/g, '\\r');\n}\n\n/**\n * Bracket text for paste, if necessary, as per https://cirw.in/blog/bracketed-paste\n * @param text The pasted text to bracket\n */\nexport function bracketTextForPaste(text: string, bracketedPasteMode: boolean): string {\n if (bracketedPasteMode) {\n return '\\x1b[200~' + text + '\\x1b[201~';\n }\n return text;\n}\n\n/**\n * Binds copy functionality to the given terminal.\n * @param ev The original copy event to be handled\n */\nexport function copyHandler(ev: ClipboardEvent, selectionService: ISelectionService): void {\n if (ev.clipboardData) {\n ev.clipboardData.setData('text/plain', selectionService.selectionText);\n }\n // Prevent or the original text will be copied.\n ev.preventDefault();\n}\n\n/**\n * Redirect the clipboard's data to the terminal's input handler.\n * @param ev The original paste event to be handled\n * @param term The terminal on which to apply the handled paste event\n */\nexport function handlePasteEvent(ev: ClipboardEvent, textarea: HTMLTextAreaElement, coreService: ICoreService): void {\n ev.stopPropagation();\n if (ev.clipboardData) {\n const text = ev.clipboardData.getData('text/plain');\n paste(text, textarea, coreService);\n }\n}\n\nexport function paste(text: string, textarea: HTMLTextAreaElement, coreService: ICoreService): void {\n text = prepareTextForTerminal(text);\n text = bracketTextForPaste(text, coreService.decPrivateModes.bracketedPasteMode);\n coreService.triggerDataEvent(text, true);\n textarea.value = '';\n}\n\n/**\n * Moves the textarea under the mouse cursor and focuses it.\n * @param ev The original right click event to be handled.\n * @param textarea The terminal's textarea.\n */\nexport function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement): void {\n\n // Calculate textarea position relative to the screen element\n const pos = screenElement.getBoundingClientRect();\n const left = ev.clientX - pos.left - 10;\n const top = ev.clientY - pos.top - 10;\n\n // Bring textarea at the cursor position\n textarea.style.width = '20px';\n textarea.style.height = '20px';\n textarea.style.left = `${left}px`;\n textarea.style.top = `${top}px`;\n textarea.style.zIndex = '1000';\n\n textarea.focus();\n}\n\n/**\n * Bind to right-click event and allow right-click copy and paste.\n * @param ev The original right click event to be handled.\n * @param textarea The terminal's textarea.\n * @param selectionService The terminal's selection manager.\n * @param shouldSelectWord If true and there is no selection the current word will be selected\n */\nexport function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement, selectionService: ISelectionService, shouldSelectWord: boolean): void {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n\n // Get textarea ready to copy from the context menu\n textarea.value = selectionService.selectionText;\n textarea.select();\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColor } from 'browser/Types';\n\n/**\n * Helper functions where the source type is \"channels\" (individual color channels as numbers).\n */\nexport namespace channels {\n export function toCss(r: number, g: number, b: number, a?: number): string {\n if (a !== undefined) {\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}${toPaddedHex(a)}`;\n }\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}`;\n }\n\n export function toRgba(r: number, g: number, b: number, a: number = 0xFF): number {\n // >>> 0 forces an unsigned int\n return (r << 24 | g << 16 | b << 8 | a) >>> 0;\n }\n}\n\n/**\n * Helper functions where the source type is `IColor`.\n */\nexport namespace color {\n export function blend(bg: IColor, fg: IColor): IColor {\n const a = (fg.rgba & 0xFF) / 255;\n if (a === 1) {\n return {\n css: fg.css,\n rgba: fg.rgba\n };\n }\n const fgR = (fg.rgba >> 24) & 0xFF;\n const fgG = (fg.rgba >> 16) & 0xFF;\n const fgB = (fg.rgba >> 8) & 0xFF;\n const bgR = (bg.rgba >> 24) & 0xFF;\n const bgG = (bg.rgba >> 16) & 0xFF;\n const bgB = (bg.rgba >> 8) & 0xFF;\n const r = bgR + Math.round((fgR - bgR) * a);\n const g = bgG + Math.round((fgG - bgG) * a);\n const b = bgB + Math.round((fgB - bgB) * a);\n const css = channels.toCss(r, g, b);\n const rgba = channels.toRgba(r, g, b);\n return { css, rgba };\n }\n\n export function isOpaque(color: IColor): boolean {\n return (color.rgba & 0xFF) === 0xFF;\n }\n\n export function ensureContrastRatio(bg: IColor, fg: IColor, ratio: number): IColor | undefined {\n const result = rgba.ensureContrastRatio(bg.rgba, fg.rgba, ratio);\n if (!result) {\n return undefined;\n }\n return rgba.toColor(\n (result >> 24 & 0xFF),\n (result >> 16 & 0xFF),\n (result >> 8 & 0xFF)\n );\n }\n\n export function opaque(color: IColor): IColor {\n const rgbaColor = (color.rgba | 0xFF) >>> 0;\n const [r, g, b] = rgba.toChannels(rgbaColor);\n return {\n css: channels.toCss(r, g, b),\n rgba: rgbaColor\n };\n }\n\n export function opacity(color: IColor, opacity: number): IColor {\n const a = Math.round(opacity * 0xFF);\n const [r, g, b] = rgba.toChannels(color.rgba);\n return {\n css: channels.toCss(r, g, b, a),\n rgba: channels.toRgba(r, g, b, a)\n };\n }\n}\n\n/**\n * Helper functions where the source type is \"css\" (string: '#rgb', '#rgba', '#rrggbb', '#rrggbbaa').\n */\nexport namespace css {\n export function toColor(css: string): IColor {\n switch (css.length) {\n case 7: // #rrggbb\n return {\n css,\n rgba: (parseInt(css.slice(1), 16) << 8 | 0xFF) >>> 0\n };\n case 9: // #rrggbbaa\n return {\n css,\n rgba: parseInt(css.slice(1), 16) >>> 0\n };\n }\n throw new Error('css.toColor: Unsupported css format');\n }\n}\n\n/**\n * Helper functions where the source type is \"rgb\" (number: 0xrrggbb).\n */\nexport namespace rgb {\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param rgb The color to use.\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance(rgb: number): number {\n return relativeLuminance2(\n (rgb >> 16) & 0xFF,\n (rgb >> 8 ) & 0xFF,\n (rgb ) & 0xFF);\n }\n\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param r The red channel (0x00 to 0xFF).\n * @param g The green channel (0x00 to 0xFF).\n * @param b The blue channel (0x00 to 0xFF).\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance2(r: number, g: number, b: number): number {\n const rs = r / 255;\n const gs = g / 255;\n const bs = b / 255;\n const rr = rs <= 0.03928 ? rs / 12.92 : Math.pow((rs + 0.055) / 1.055, 2.4);\n const rg = gs <= 0.03928 ? gs / 12.92 : Math.pow((gs + 0.055) / 1.055, 2.4);\n const rb = bs <= 0.03928 ? bs / 12.92 : Math.pow((bs + 0.055) / 1.055, 2.4);\n return rr * 0.2126 + rg * 0.7152 + rb * 0.0722;\n }\n}\n\n/**\n * Helper functions where the source type is \"rgba\" (number: 0xrrggbbaa).\n */\nexport namespace rgba {\n export function ensureContrastRatio(bgRgba: number, fgRgba: number, ratio: number): number | undefined {\n const bgL = rgb.relativeLuminance(bgRgba >> 8);\n const fgL = rgb.relativeLuminance(fgRgba >> 8);\n const cr = contrastRatio(bgL, fgL);\n if (cr < ratio) {\n if (fgL < bgL) {\n return reduceLuminance(bgRgba, fgRgba, ratio);\n }\n return increaseLuminance(bgRgba, fgRgba, ratio);\n }\n return undefined;\n }\n\n export function reduceLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to reducing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgB, fgG), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR > 0 || fgG > 0 || fgB > 0)) {\n // Reduce by 10% until the ratio is hit\n fgR -= Math.max(0, Math.ceil(fgR * 0.1));\n fgG -= Math.max(0, Math.ceil(fgG * 0.1));\n fgB -= Math.max(0, Math.ceil(fgB * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgB, fgG), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function increaseLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to increasing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgB, fgG), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR < 0xFF || fgG < 0xFF || fgB < 0xFF)) {\n // Increase by 10% until the ratio is hit\n fgR = Math.min(0xFF, fgR + Math.ceil((255 - fgR) * 0.1));\n fgG = Math.min(0xFF, fgG + Math.ceil((255 - fgG) * 0.1));\n fgB = Math.min(0xFF, fgB + Math.ceil((255 - fgB) * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgB, fgG), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function toChannels(value: number): [number, number, number, number] {\n return [(value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF];\n }\n\n export function toColor(r: number, g: number, b: number): IColor {\n return {\n css: channels.toCss(r, g, b),\n rgba: channels.toRgba(r, g, b)\n };\n }\n}\n\nexport function toPaddedHex(c: number): string {\n const s = c.toString(16);\n return s.length < 2 ? '0' + s : s;\n}\n\n/**\n * Gets the contrast ratio between two relative luminance values.\n * @param l1 The first relative luminance.\n * @param l2 The first relative luminance.\n * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef\n */\nexport function contrastRatio(l1: number, l2: number): number {\n if (l1 < l2) {\n return (l2 + 0.05) / (l1 + 0.05);\n }\n return (l1 + 0.05) / (l2 + 0.05);\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColor, IColorContrastCache } from 'browser/Types';\n\nexport class ColorContrastCache implements IColorContrastCache {\n private _color: { [bg: number]: { [fg: number]: IColor | null | undefined } | undefined } = {};\n private _rgba: { [bg: number]: { [fg: number]: string | null | undefined } | undefined } = {};\n\n public clear(): void {\n this._color = {};\n this._rgba = {};\n }\n\n public setCss(bg: number, fg: number, value: string | null): void {\n if (!this._rgba[bg]) {\n this._rgba[bg] = {};\n }\n this._rgba[bg]![fg] = value;\n }\n\n public getCss(bg: number, fg: number): string | null | undefined {\n return this._rgba[bg] ? this._rgba[bg]![fg] : undefined;\n }\n\n public setColor(bg: number, fg: number, value: IColor | null): void {\n if (!this._color[bg]) {\n this._color[bg] = {};\n }\n this._color[bg]![fg] = value;\n }\n\n public getColor(bg: number, fg: number): IColor | null | undefined {\n return this._color[bg] ? this._color[bg]![fg] : undefined;\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColorManager, IColor, IColorSet, IColorContrastCache } from 'browser/Types';\nimport { ITheme } from 'common/services/Services';\nimport { channels, color, css } from 'browser/Color';\nimport { ColorContrastCache } from 'browser/ColorContrastCache';\n\nconst DEFAULT_FOREGROUND = css.toColor('#ffffff');\nconst DEFAULT_BACKGROUND = css.toColor('#000000');\nconst DEFAULT_CURSOR = css.toColor('#ffffff');\nconst DEFAULT_CURSOR_ACCENT = css.toColor('#000000');\nconst DEFAULT_SELECTION = {\n css: 'rgba(255, 255, 255, 0.3)',\n rgba: 0xFFFFFF4D\n};\n\n// An IIFE to generate DEFAULT_ANSI_COLORS.\nexport const DEFAULT_ANSI_COLORS = Object.freeze((() => {\n const colors = [\n // dark:\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 // bright:\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')\n ];\n\n // Fill in the remaining 240 ANSI colors.\n // Generate colors (16-231)\n const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];\n for (let i = 0; i < 216; i++) {\n const r = v[(i / 36) % 6 | 0];\n const g = v[(i / 6) % 6 | 0];\n const b = v[i % 6];\n colors.push({\n css: channels.toCss(r, g, b),\n rgba: channels.toRgba(r, g, b)\n });\n }\n\n // Generate greys (232-255)\n for (let i = 0; i < 24; i++) {\n const c = 8 + i * 10;\n colors.push({\n css: channels.toCss(c, c, c),\n rgba: channels.toRgba(c, c, c)\n });\n }\n\n return colors;\n})());\n\n/**\n * Manages the source of truth for a terminal's colors.\n */\nexport class ColorManager implements IColorManager {\n public colors: IColorSet;\n private _ctx: CanvasRenderingContext2D;\n private _litmusColor: CanvasGradient;\n private _contrastCache: IColorContrastCache;\n\n constructor(document: Document, public allowTransparency: boolean) {\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Could not get rendering context');\n }\n this._ctx = ctx;\n this._ctx.globalCompositeOperation = 'copy';\n this._litmusColor = this._ctx.createLinearGradient(0, 0, 1, 1);\n this._contrastCache = new ColorContrastCache();\n this.colors = {\n foreground: DEFAULT_FOREGROUND,\n background: DEFAULT_BACKGROUND,\n cursor: DEFAULT_CURSOR,\n cursorAccent: DEFAULT_CURSOR_ACCENT,\n selectionTransparent: DEFAULT_SELECTION,\n selectionOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n ansi: DEFAULT_ANSI_COLORS.slice(),\n contrastCache: this._contrastCache\n };\n }\n\n public onOptionsChange(key: string): void {\n if (key === 'minimumContrastRatio') {\n this._contrastCache.clear();\n }\n }\n\n /**\n * Sets the terminal's theme.\n * @param theme The theme to use. If a partial theme is provided then default\n * colors will be used where colors are not defined.\n */\n public setTheme(theme: ITheme = {}): void {\n this.colors.foreground = this._parseColor(theme.foreground, DEFAULT_FOREGROUND);\n this.colors.background = this._parseColor(theme.background, DEFAULT_BACKGROUND);\n this.colors.cursor = this._parseColor(theme.cursor, DEFAULT_CURSOR, true);\n this.colors.cursorAccent = this._parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT, true);\n this.colors.selectionTransparent = this._parseColor(theme.selection, DEFAULT_SELECTION, true);\n this.colors.selectionOpaque = color.blend(this.colors.background, this.colors.selectionTransparent);\n /**\n * If selection color is opaque, blend it with background with 0.3 opacity\n * Issue #2737\n */\n if (color.isOpaque(this.colors.selectionTransparent)) {\n const opacity = 0.3;\n this.colors.selectionTransparent = color.opacity(this.colors.selectionTransparent, opacity);\n }\n this.colors.ansi[0] = this._parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);\n this.colors.ansi[1] = this._parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);\n this.colors.ansi[2] = this._parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);\n this.colors.ansi[3] = this._parseColor(theme.yellow, DEFAULT_ANSI_COLORS[3]);\n this.colors.ansi[4] = this._parseColor(theme.blue, DEFAULT_ANSI_COLORS[4]);\n this.colors.ansi[5] = this._parseColor(theme.magenta, DEFAULT_ANSI_COLORS[5]);\n this.colors.ansi[6] = this._parseColor(theme.cyan, DEFAULT_ANSI_COLORS[6]);\n this.colors.ansi[7] = this._parseColor(theme.white, DEFAULT_ANSI_COLORS[7]);\n this.colors.ansi[8] = this._parseColor(theme.brightBlack, DEFAULT_ANSI_COLORS[8]);\n this.colors.ansi[9] = this._parseColor(theme.brightRed, DEFAULT_ANSI_COLORS[9]);\n this.colors.ansi[10] = this._parseColor(theme.brightGreen, DEFAULT_ANSI_COLORS[10]);\n this.colors.ansi[11] = this._parseColor(theme.brightYellow, DEFAULT_ANSI_COLORS[11]);\n this.colors.ansi[12] = this._parseColor(theme.brightBlue, DEFAULT_ANSI_COLORS[12]);\n this.colors.ansi[13] = this._parseColor(theme.brightMagenta, DEFAULT_ANSI_COLORS[13]);\n this.colors.ansi[14] = this._parseColor(theme.brightCyan, DEFAULT_ANSI_COLORS[14]);\n this.colors.ansi[15] = this._parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);\n // Clear our the cache\n this._contrastCache.clear();\n }\n\n private _parseColor(\n css: string | undefined,\n fallback: IColor,\n allowTransparency: boolean = this.allowTransparency\n ): IColor {\n if (css === undefined) {\n return fallback;\n }\n\n // If parsing the value results in failure, then it must be ignored, and the attribute must\n // retain its previous value.\n // -- https://html.spec.whatwg.org/multipage/canvas.html#fill-and-stroke-styles\n this._ctx.fillStyle = this._litmusColor;\n this._ctx.fillStyle = css;\n if (typeof this._ctx.fillStyle !== 'string') {\n console.warn(`Color: ${css} is invalid using fallback ${fallback.css}`);\n return fallback;\n }\n\n this._ctx.fillRect(0, 0, 1, 1);\n const data = this._ctx.getImageData(0, 0, 1, 1).data;\n\n // Check if the printed color was transparent\n if (data[3] !== 0xFF) {\n if (!allowTransparency) {\n // Ideally we'd just ignore the alpha channel, but...\n //\n // Browsers may not give back exactly the same RGB values we put in, because most/all\n // convert the color to a pre-multiplied representation. getImageData converts that back to\n // a un-premultipled representation, but the precision loss may make the RGB channels unuable\n // on their own.\n //\n // E.g. In Chrome #12345610 turns into #10305010, and in the extreme case, 0xFFFFFF00 turns\n // into 0x00000000.\n //\n // \"Note: Due to the lossy nature of converting to and from premultiplied alpha color values,\n // pixels that have just been set using putImageData() might be returned to an equivalent\n // getImageData() as different values.\"\n // -- https://html.spec.whatwg.org/multipage/canvas.html#pixel-manipulation\n //\n // So let's just use the fallback color in this case instead.\n console.warn(\n `Color: ${css} is using transparency, but allowTransparency is false. ` +\n `Using fallback ${fallback.css}.`\n );\n return fallback;\n }\n\n // https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color\n // the color value has alpha less than 1.0, and the string is the color value in the CSS rgba()\n const [r, g, b, a] = this._ctx.fillStyle.substring(5, this._ctx.fillStyle.length - 1).split(',').map(component => Number(component));\n const alpha = Math.round(a * 255);\n const rgba: number = channels.toRgba(r, g, b, alpha);\n return {\n rgba,\n css\n };\n }\n\n return {\n // https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color\n // if it has alpha equal to 1.0, then the string is a lowercase six-digit hex value, prefixed with a \"#\" character\n css: this._ctx.fillStyle,\n rgba: channels.toRgba(data[0], data[1], data[2], data[3])\n };\n }\n}\n","/**\n * Copyright (c) 2020 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function removeElementFromParent(...elements: (HTMLElement | undefined)[]): void {\n for (const e of elements) {\n e?.parentElement?.removeChild(e);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\n\n/**\n * Adds a disposable listener to a node in the DOM, returning the disposable.\n * @param type The event type.\n * @param handler The handler for the listener.\n */\nexport function addDisposableDomListener(\n node: Element | Window | Document,\n type: string,\n handler: (e: any) => void,\n options?: boolean | AddEventListenerOptions\n): IDisposable {\n node.addEventListener(type, handler, options);\n let disposed = false;\n return {\n dispose: () => {\n if (disposed) {\n return;\n }\n disposed = true;\n node.removeEventListener(type, handler, options);\n }\n };\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ILinkifierEvent, ILinkMatcher, LinkMatcherHandler, ILinkMatcherOptions, ILinkifier, IMouseZoneManager, IMouseZone, IRegisteredLinkMatcher } from 'browser/Types';\nimport { IBufferStringIteratorResult } from 'common/buffer/Types';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { ILogService, IBufferService, IOptionsService, IUnicodeService } from 'common/services/Services';\n\n/**\n * Limit of the unwrapping line expansion (overscan) at the top and bottom\n * of the actual viewport in ASCII characters.\n * A limit of 2000 should match most sane urls.\n */\nconst OVERSCAN_CHAR_LIMIT = 2000;\n\n/**\n * The Linkifier applies links to rows shortly after they have been refreshed.\n */\nexport class Linkifier implements ILinkifier {\n /**\n * The time to wait after a row is changed before it is linkified. This prevents\n * the costly operation of searching every row multiple times, potentially a\n * huge amount of times.\n */\n protected static _timeBeforeLatency = 200;\n\n protected _linkMatchers: IRegisteredLinkMatcher[] = [];\n\n private _mouseZoneManager: IMouseZoneManager | undefined;\n private _element: HTMLElement | undefined;\n\n private _rowsTimeoutId: number | undefined;\n private _nextLinkMatcherId = 0;\n private _rowsToLinkify: { start: number | undefined, end: number | undefined };\n\n private _onShowLinkUnderline = new EventEmitter();\n public get onShowLinkUnderline(): IEvent { return this._onShowLinkUnderline.event; }\n private _onHideLinkUnderline = new EventEmitter();\n public get onHideLinkUnderline(): IEvent { return this._onHideLinkUnderline.event; }\n private _onLinkTooltip = new EventEmitter();\n public get onLinkTooltip(): IEvent { return this._onLinkTooltip.event; }\n\n constructor(\n @IBufferService protected readonly _bufferService: IBufferService,\n @ILogService private readonly _logService: ILogService,\n @IUnicodeService private readonly _unicodeService: IUnicodeService\n ) {\n this._rowsToLinkify = {\n start: undefined,\n end: undefined\n };\n }\n\n /**\n * Attaches the linkifier to the DOM, enabling linkification.\n * @param mouseZoneManager The mouse zone manager to register link zones with.\n */\n public attachToDom(element: HTMLElement, mouseZoneManager: IMouseZoneManager): void {\n this._element = element;\n this._mouseZoneManager = mouseZoneManager;\n }\n\n /**\n * Queue linkification on a set of rows.\n * @param start The row to linkify from (inclusive).\n * @param end The row to linkify to (inclusive).\n */\n public linkifyRows(start: number, end: number): void {\n // Don't attempt linkify if not yet attached to DOM\n if (!this._mouseZoneManager) {\n return;\n }\n\n // Increase range to linkify\n if (this._rowsToLinkify.start === undefined || this._rowsToLinkify.end === undefined) {\n this._rowsToLinkify.start = start;\n this._rowsToLinkify.end = end;\n } else {\n this._rowsToLinkify.start = Math.min(this._rowsToLinkify.start, start);\n this._rowsToLinkify.end = Math.max(this._rowsToLinkify.end, end);\n }\n\n // Clear out any existing links on this row range\n this._mouseZoneManager.clearAll(start, end);\n\n // Restart timer\n if (this._rowsTimeoutId) {\n clearTimeout(this._rowsTimeoutId);\n }\n this._rowsTimeoutId = setTimeout(() => this._linkifyRows(), Linkifier._timeBeforeLatency);\n }\n\n /**\n * Linkifies the rows requested.\n */\n private _linkifyRows(): void {\n this._rowsTimeoutId = undefined;\n const buffer = this._bufferService.buffer;\n\n if (this._rowsToLinkify.start === undefined || this._rowsToLinkify.end === undefined) {\n this._logService.debug('_rowToLinkify was unset before _linkifyRows was called');\n return;\n }\n\n // Ensure the start row exists\n const absoluteRowIndexStart = buffer.ydisp + this._rowsToLinkify.start;\n if (absoluteRowIndexStart >= buffer.lines.length) {\n return;\n }\n\n // Invalidate bad end row values (if a resize happened)\n const absoluteRowIndexEnd = buffer.ydisp + Math.min(this._rowsToLinkify.end, this._bufferService.rows) + 1;\n\n // Iterate over the range of unwrapped content strings within start..end\n // (excluding).\n // _doLinkifyRow gets full unwrapped lines with the start row as buffer offset\n // for every matcher.\n // The unwrapping is needed to also match content that got wrapped across\n // several buffer lines. To avoid a worst case scenario where the whole buffer\n // contains just a single unwrapped string we limit this line expansion beyond\n // the viewport to +OVERSCAN_CHAR_LIMIT chars (overscan) at top and bottom.\n // This comes with the tradeoff that matches longer than OVERSCAN_CHAR_LIMIT\n // chars will not match anymore at the viewport borders.\n const overscanLineLimit = Math.ceil(OVERSCAN_CHAR_LIMIT / this._bufferService.cols);\n const iterator = this._bufferService.buffer.iterator(\n false, absoluteRowIndexStart, absoluteRowIndexEnd, overscanLineLimit, overscanLineLimit);\n while (iterator.hasNext()) {\n const lineData: IBufferStringIteratorResult = iterator.next();\n for (let i = 0; i < this._linkMatchers.length; i++) {\n this._doLinkifyRow(lineData.range.first, lineData.content, this._linkMatchers[i]);\n }\n }\n\n this._rowsToLinkify.start = undefined;\n this._rowsToLinkify.end = undefined;\n }\n\n /**\n * Registers a link matcher, allowing custom link patterns to be matched and\n * handled.\n * @param regex The regular expression to search for. Specifically, this\n * searches the textContent of the rows. You will want to use \\s to match a\n * space ' ' character for example.\n * @param handler The callback when the link is called.\n * @param options Options for the link matcher.\n * @return The ID of the new matcher, this can be used to deregister.\n */\n public registerLinkMatcher(regex: RegExp, handler: LinkMatcherHandler, options: ILinkMatcherOptions = {}): number {\n if (!handler) {\n throw new Error('handler must be defined');\n }\n const matcher: IRegisteredLinkMatcher = {\n id: this._nextLinkMatcherId++,\n regex,\n handler,\n matchIndex: options.matchIndex,\n validationCallback: options.validationCallback,\n hoverTooltipCallback: options.tooltipCallback,\n hoverLeaveCallback: options.leaveCallback,\n willLinkActivate: options.willLinkActivate,\n priority: options.priority || 0\n };\n this._addLinkMatcherToList(matcher);\n return matcher.id;\n }\n\n /**\n * Inserts a link matcher to the list in the correct position based on the\n * priority of each link matcher. New link matchers of equal priority are\n * considered after older link matchers.\n * @param matcher The link matcher to be added.\n */\n private _addLinkMatcherToList(matcher: IRegisteredLinkMatcher): void {\n if (this._linkMatchers.length === 0) {\n this._linkMatchers.push(matcher);\n return;\n }\n\n for (let i = this._linkMatchers.length - 1; i >= 0; i--) {\n if (matcher.priority <= this._linkMatchers[i].priority) {\n this._linkMatchers.splice(i + 1, 0, matcher);\n return;\n }\n }\n\n this._linkMatchers.splice(0, 0, matcher);\n }\n\n /**\n * Deregisters a link matcher if it has been registered.\n * @param matcherId The link matcher's ID (returned after register)\n * @return Whether a link matcher was found and deregistered.\n */\n public deregisterLinkMatcher(matcherId: number): boolean {\n for (let i = 0; i < this._linkMatchers.length; i++) {\n if (this._linkMatchers[i].id === matcherId) {\n this._linkMatchers.splice(i, 1);\n return true;\n }\n }\n return false;\n }\n\n /**\n * Linkifies a row given a specific handler.\n * @param rowIndex The row index to linkify (absolute index).\n * @param text string content of the unwrapped row.\n * @param matcher The link matcher for this line.\n */\n private _doLinkifyRow(rowIndex: number, text: string, matcher: ILinkMatcher): void {\n // clone regex to do a global search on text\n const rex = new RegExp(matcher.regex.source, (matcher.regex.flags || '') + 'g');\n let match;\n let stringIndex = -1;\n while ((match = rex.exec(text)) !== null) {\n const uri = match[typeof matcher.matchIndex !== 'number' ? 0 : matcher.matchIndex];\n if (!uri) {\n // something matched but does not comply with the given matchIndex\n // since this is most likely a bug the regex itself we simply do nothing here\n this._logService.debug('match found without corresponding matchIndex', match, matcher);\n break;\n }\n\n // Get index, match.index is for the outer match which includes negated chars\n // therefore we cannot use match.index directly, instead we search the position\n // of the match group in text again\n // also correct regex and string search offsets for the next loop run\n stringIndex = text.indexOf(uri, stringIndex + 1);\n rex.lastIndex = stringIndex + uri.length;\n if (stringIndex < 0) {\n // invalid stringIndex (should not have happened)\n break;\n }\n\n // get the buffer index as [absolute row, col] for the match\n const bufferIndex = this._bufferService.buffer.stringIndexToBufferIndex(rowIndex, stringIndex);\n if (bufferIndex[0] < 0) {\n // invalid bufferIndex (should not have happened)\n break;\n }\n\n const line = this._bufferService.buffer.lines.get(bufferIndex[0]);\n if (!line) {\n break;\n }\n\n const attr = line.getFg(bufferIndex[1]);\n const fg = attr ? (attr >> 9) & 0x1ff : undefined;\n\n if (matcher.validationCallback) {\n matcher.validationCallback(uri, isValid => {\n // Discard link if the line has already changed\n if (this._rowsTimeoutId) {\n return;\n }\n if (isValid) {\n this._addLink(bufferIndex[1], bufferIndex[0] - this._bufferService.buffer.ydisp, uri, matcher, fg);\n }\n });\n } else {\n this._addLink(bufferIndex[1], bufferIndex[0] - this._bufferService.buffer.ydisp, uri, matcher, fg);\n }\n }\n }\n\n /**\n * Registers a link to the mouse zone manager.\n * @param x The column the link starts.\n * @param y The row the link is on.\n * @param uri The URI of the link.\n * @param matcher The link matcher for the link.\n * @param fg The link color for hover event.\n */\n private _addLink(x: number, y: number, uri: string, matcher: ILinkMatcher, fg: number | undefined): void {\n if (!this._mouseZoneManager || !this._element) {\n return;\n }\n // FIXME: get cell length from buffer to avoid mismatch after Unicode version change\n const width = this._unicodeService.getStringCellWidth(uri);\n const x1 = x % this._bufferService.cols;\n const y1 = y + Math.floor(x / this._bufferService.cols);\n let x2 = (x1 + width) % this._bufferService.cols;\n let y2 = y1 + Math.floor((x1 + width) / this._bufferService.cols);\n if (x2 === 0) {\n x2 = this._bufferService.cols;\n y2--;\n }\n\n this._mouseZoneManager.add(new MouseZone(\n x1 + 1,\n y1 + 1,\n x2 + 1,\n y2 + 1,\n e => {\n if (matcher.handler) {\n return matcher.handler(e, uri);\n }\n const newWindow = window.open();\n if (newWindow) {\n newWindow.opener = null;\n newWindow.location.href = uri;\n } else {\n console.warn('Opening link blocked as opener could not be cleared');\n }\n },\n () => {\n this._onShowLinkUnderline.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg));\n this._element!.classList.add('xterm-cursor-pointer');\n },\n e => {\n this._onLinkTooltip.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg));\n if (matcher.hoverTooltipCallback) {\n // Note that IViewportRange use 1-based coordinates to align with escape sequences such\n // as CUP which use 1,1 as the default for row/col\n matcher.hoverTooltipCallback(e, uri, { start: { x: x1, y: y1 }, end: { x: x2, y: y2 } });\n }\n },\n () => {\n this._onHideLinkUnderline.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg));\n this._element!.classList.remove('xterm-cursor-pointer');\n if (matcher.hoverLeaveCallback) {\n matcher.hoverLeaveCallback();\n }\n },\n e => {\n if (matcher.willLinkActivate) {\n return matcher.willLinkActivate(e, uri);\n }\n return true;\n }\n ));\n }\n\n private _createLinkHoverEvent(x1: number, y1: number, x2: number, y2: number, fg: number | undefined): ILinkifierEvent {\n return { x1, y1, x2, y2, cols: this._bufferService.cols, fg };\n }\n}\n\nexport class MouseZone implements IMouseZone {\n constructor(\n public x1: number,\n public y1: number,\n public x2: number,\n public y2: number,\n public clickCallback: (e: MouseEvent) => any,\n public hoverCallback: (e: MouseEvent) => any,\n public tooltipCallback: (e: MouseEvent) => any,\n public leaveCallback: () => void,\n public willLinkActivate: (e: MouseEvent) => boolean\n ) {\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ILinkifier2, ILinkProvider, IBufferCellPosition, ILink, ILinkifierEvent, ILinkDecorations } from 'browser/Types';\nimport { IDisposable } from 'common/Types';\nimport { IMouseService, IRenderService } from './services/Services';\nimport { IBufferService } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable, getDisposeArrayDisposable, disposeArray } from 'common/Lifecycle';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\n\ninterface ILinkState {\n decorations: ILinkDecorations;\n isHovered: boolean;\n}\n\ninterface ILinkWithState {\n link: ILink;\n state?: ILinkState;\n}\n\nexport class Linkifier2 extends Disposable implements ILinkifier2 {\n private _element: HTMLElement | undefined;\n private _mouseService: IMouseService | undefined;\n private _renderService: IRenderService | undefined;\n private _linkProviders: ILinkProvider[] = [];\n protected _currentLink: ILinkWithState | undefined;\n private _lastMouseEvent: MouseEvent | undefined;\n private _linkCacheDisposables: IDisposable[] = [];\n private _lastBufferCell: IBufferCellPosition | undefined;\n private _isMouseOut: boolean = true;\n private _activeProviderReplies: Map | undefined;\n private _activeLine: number = -1;\n\n private _onShowLinkUnderline = this.register(new EventEmitter());\n public get onShowLinkUnderline(): IEvent { return this._onShowLinkUnderline.event; }\n private _onHideLinkUnderline = this.register(new EventEmitter());\n public get onHideLinkUnderline(): IEvent { return this._onHideLinkUnderline.event; }\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n super();\n this.register(getDisposeArrayDisposable(this._linkCacheDisposables));\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n this._linkProviders.push(linkProvider);\n return {\n dispose: () => {\n // Remove the link provider from the list\n const providerIndex = this._linkProviders.indexOf(linkProvider);\n\n if (providerIndex !== -1) {\n this._linkProviders.splice(providerIndex, 1);\n }\n }\n };\n }\n\n public attachToDom(element: HTMLElement, mouseService: IMouseService, renderService: IRenderService): void {\n this._element = element;\n this._mouseService = mouseService;\n this._renderService = renderService;\n\n this.register(addDisposableDomListener(this._element, 'mouseleave', () => {\n this._isMouseOut = true;\n this._clearCurrentLink();\n }));\n this.register(addDisposableDomListener(this._element, 'mousemove', this._onMouseMove.bind(this)));\n this.register(addDisposableDomListener(this._element, 'click', this._onClick.bind(this)));\n }\n\n private _onMouseMove(event: MouseEvent): void {\n this._lastMouseEvent = event;\n\n if (!this._element || !this._mouseService) {\n return;\n }\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n this._isMouseOut = false;\n\n // Ignore the event if it's an embedder created hover widget\n const composedPath = event.composedPath() as HTMLElement[];\n for (let i = 0; i < composedPath.length; i++) {\n const target = composedPath[i];\n // Hit Terminal.element, break and continue\n if (target.classList.contains('xterm')) {\n break;\n }\n // It's a hover, don't respect hover event\n if (target.classList.contains('xterm-hover')) {\n return;\n }\n }\n\n if (!this._lastBufferCell || (position.x !== this._lastBufferCell.x || position.y !== this._lastBufferCell.y)) {\n this._onHover(position);\n this._lastBufferCell = position;\n }\n }\n\n private _onHover(position: IBufferCellPosition): void {\n // TODO: This currently does not cache link provider results across wrapped lines, activeLine should be something like `activeRange: {startY, endY}`\n // Check if we need to clear the link\n if (this._activeLine !== position.y) {\n this._clearCurrentLink();\n this._askForLink(position, false);\n return;\n }\n\n // Check the if the link is in the mouse position\n const isCurrentLinkInPosition = this._currentLink && this._linkAtPosition(this._currentLink.link, position);\n if (!isCurrentLinkInPosition) {\n this._clearCurrentLink();\n this._askForLink(position, true);\n }\n }\n\n private _askForLink(position: IBufferCellPosition, useLineCache: boolean): void {\n if (!this._activeProviderReplies || !useLineCache) {\n this._activeProviderReplies?.forEach(reply => {\n reply?.forEach(linkWithState => {\n if (linkWithState.link.dispose) {\n linkWithState.link.dispose();\n }\n });\n });\n this._activeProviderReplies = new Map();\n this._activeLine = position.y;\n }\n let linkProvided = false;\n\n // There is no link cached, so ask for one\n this._linkProviders.forEach((linkProvider, i) => {\n if (useLineCache) {\n const existingReply = this._activeProviderReplies?.get(i);\n // If there isn't a reply, the provider hasn't responded yet.\n\n // TODO: If there isn't a reply yet it means that the provider is still resolving. Ensuring\n // provideLinks isn't triggered again saves ILink.hover firing twice though. This probably\n // needs promises to get fixed\n if (existingReply) {\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n }\n } else {\n linkProvider.provideLinks(position.y, (links: ILink[] | undefined) => {\n if (this._isMouseOut) {\n return;\n }\n const linksWithState: ILinkWithState[] | undefined = links?.map(link => ({ link }));\n this._activeProviderReplies?.set(i, linksWithState);\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n\n // If all providers have responded, remove lower priority links that intersect ranges of\n // higher priority links\n if (this._activeProviderReplies?.size === this._linkProviders.length) {\n this._removeIntersectingLinks(position.y, this._activeProviderReplies);\n }\n });\n }\n });\n }\n\n private _removeIntersectingLinks(y: number, replies: Map): void {\n const occupiedCells = new Set();\n for (let i = 0; i < replies.size; i++) {\n const providerReply = replies.get(i);\n if (!providerReply) {\n continue;\n }\n for (let i = 0; i < providerReply.length; i++) {\n const linkWithState = providerReply[i];\n const startX = linkWithState.link.range.start.y < y ? 0 : linkWithState.link.range.start.x;\n const endX = linkWithState.link.range.end.y > y ? this._bufferService.cols : linkWithState.link.range.end.x;\n for (let x = startX; x <= endX; x++) {\n if (occupiedCells.has(x)) {\n providerReply.splice(i--, 1);\n break;\n }\n occupiedCells.add(x);\n }\n }\n }\n }\n\n private _checkLinkProviderResult(index: number, position: IBufferCellPosition, linkProvided: boolean): boolean {\n if (!this._activeProviderReplies) {\n return linkProvided;\n }\n\n const links = this._activeProviderReplies.get(index);\n\n // Check if every provider before this one has come back undefined\n let hasLinkBefore = false;\n for (let j = 0; j < index; j++) {\n if (!this._activeProviderReplies.has(j) || this._activeProviderReplies.get(j)) {\n hasLinkBefore = true;\n }\n }\n\n // If all providers with higher priority came back undefined, then this provider's link for\n // the position should be used\n if (!hasLinkBefore && links) {\n const linkAtPosition = links.find(link => this._linkAtPosition(link.link, position));\n if (linkAtPosition) {\n linkProvided = true;\n this._handleNewLink(linkAtPosition);\n }\n }\n\n // Check if all the providers have responded\n if (this._activeProviderReplies.size === this._linkProviders.length && !linkProvided) {\n // Respect the order of the link providers\n for (let j = 0; j < this._activeProviderReplies.size; j++) {\n const currentLink = this._activeProviderReplies.get(j)?.find(link => this._linkAtPosition(link.link, position));\n if (currentLink) {\n linkProvided = true;\n this._handleNewLink(currentLink);\n break;\n }\n }\n }\n\n return linkProvided;\n }\n\n private _onClick(event: MouseEvent): void {\n if (!this._element || !this._mouseService || !this._currentLink) {\n return;\n }\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n\n if (!position) {\n return;\n }\n\n if (this._linkAtPosition(this._currentLink.link, position)) {\n this._currentLink.link.activate(event, this._currentLink.link.text);\n }\n }\n\n private _clearCurrentLink(startRow?: number, endRow?: number): void {\n if (!this._element || !this._currentLink || !this._lastMouseEvent) {\n return;\n }\n\n // If we have a start and end row, check that the link is within it\n if (!startRow || !endRow || (this._currentLink.link.range.start.y >= startRow && this._currentLink.link.range.end.y <= endRow)) {\n this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent);\n this._currentLink = undefined;\n disposeArray(this._linkCacheDisposables);\n }\n }\n\n private _handleNewLink(linkWithState: ILinkWithState): void {\n if (!this._element || !this._lastMouseEvent || !this._mouseService) {\n return;\n }\n\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);\n\n if (!position) {\n return;\n }\n\n // Trigger hover if the we have a link at the position\n if (this._linkAtPosition(linkWithState.link, position)) {\n this._currentLink = linkWithState;\n this._currentLink.state = {\n decorations: {\n underline: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.underline,\n pointerCursor: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.pointerCursor\n },\n isHovered: true\n };\n this._linkHover(this._element, linkWithState.link, this._lastMouseEvent);\n\n // Add listener for tracking decorations changes\n linkWithState.link.decorations = {} as ILinkDecorations;\n Object.defineProperties(linkWithState.link.decorations, {\n pointerCursor: {\n get: () => this._currentLink?.state?.decorations.pointerCursor,\n set: v => {\n if (this._currentLink?.state && this._currentLink.state.decorations.pointerCursor !== v) {\n this._currentLink.state.decorations.pointerCursor = v;\n if (this._currentLink.state.isHovered) {\n this._element?.classList.toggle('xterm-cursor-pointer', v);\n }\n }\n }\n },\n underline: {\n get: () => this._currentLink?.state?.decorations.underline,\n set: v => {\n if (this._currentLink?.state && this._currentLink?.state?.decorations.underline !== v) {\n this._currentLink.state.decorations.underline = v;\n if (this._currentLink.state.isHovered) {\n this._fireUnderlineEvent(linkWithState.link, v);\n }\n }\n }\n }\n });\n\n // Add listener for rerendering\n if (this._renderService) {\n this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(e => {\n // When start is 0 a scroll most likely occurred, make sure links above the fold also get\n // cleared.\n const start = e.start === 0 ? 0 : e.start + 1 + this._bufferService.buffer.ydisp;\n this._clearCurrentLink(start, e.end + 1 + this._bufferService.buffer.ydisp);\n }));\n }\n }\n }\n\n protected _linkHover(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = true;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, true);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.add('xterm-cursor-pointer');\n }\n }\n\n if (link.hover) {\n link.hover(event, link.text);\n }\n }\n\n private _fireUnderlineEvent(link: ILink, showEvent: boolean): void {\n const range = link.range;\n const scrollOffset = this._bufferService.buffer.ydisp;\n const event = this._createLinkUnderlineEvent(range.start.x - 1, range.start.y - scrollOffset - 1, range.end.x, range.end.y - scrollOffset - 1, undefined);\n const emitter = showEvent ? this._onShowLinkUnderline : this._onHideLinkUnderline;\n emitter.fire(event);\n }\n\n protected _linkLeave(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = false;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, false);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.remove('xterm-cursor-pointer');\n }\n }\n\n if (link.leave) {\n link.leave(event, link.text);\n }\n }\n\n /**\n * Check if the buffer position is within the link\n * @param link\n * @param position\n */\n private _linkAtPosition(link: ILink, position: IBufferCellPosition): boolean {\n const sameLine = link.range.start.y === link.range.end.y;\n const wrappedFromLeft = link.range.start.y < position.y;\n const wrappedToRight = link.range.end.y > position.y;\n\n // If the start and end have the same y, then the position must be between start and end x\n // If not, then handle each case seperately, depending on which way it wraps\n return ((sameLine && link.range.start.x <= position.x && link.range.end.x >= position.x) ||\n (wrappedFromLeft && link.range.end.x >= position.x) ||\n (wrappedToRight && link.range.start.x <= position.x) ||\n (wrappedFromLeft && wrappedToRight)) &&\n link.range.start.y <= position.y &&\n link.range.end.y >= position.y;\n }\n\n /**\n * Get the buffer position from a mouse event\n * @param event\n */\n private _positionFromMouseEvent(event: MouseEvent, element: HTMLElement, mouseService: IMouseService): IBufferCellPosition | undefined {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }\n\n private _createLinkUnderlineEvent(x1: number, y1: number, x2: number, y2: number, fg: number | undefined): ILinkifierEvent {\n return { x1, y1, x2, y2, cols: this._bufferService.cols, fg };\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n// eslint-disable-next-line prefer-const\nexport let promptLabel = 'Terminal input';\n\n// eslint-disable-next-line prefer-const\nexport let tooMuchOutput = 'Too much output to announce, navigate to rows manually to read';\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IMouseService, ISelectionService } from 'browser/services/Services';\nimport { IMouseZoneManager, IMouseZone } from 'browser/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\n\n/**\n * The MouseZoneManager allows components to register zones within the terminal\n * that trigger hover and click callbacks.\n *\n * This class was intentionally made not so robust initially as the only case it\n * needed to support was single-line links which never overlap. Improvements can\n * be made in the future.\n */\nexport class MouseZoneManager extends Disposable implements IMouseZoneManager {\n private _zones: IMouseZone[] = [];\n\n private _areZonesActive: boolean = false;\n private _mouseMoveListener: (e: MouseEvent) => any;\n private _mouseLeaveListener: (e: MouseEvent) => any;\n private _clickListener: (e: MouseEvent) => any;\n\n private _tooltipTimeout: number | undefined;\n private _currentZone: IMouseZone | undefined;\n private _lastHoverCoords: [number | undefined, number | undefined] = [undefined, undefined];\n private _initialSelectionLength: number = 0;\n\n constructor(\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IMouseService private readonly _mouseService: IMouseService,\n @ISelectionService private readonly _selectionService: ISelectionService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n\n this.register(addDisposableDomListener(this._element, 'mousedown', e => this._onMouseDown(e)));\n\n // These events are expensive, only listen to it when mouse zones are active\n this._mouseMoveListener = e => this._onMouseMove(e);\n this._mouseLeaveListener = e => this._onMouseLeave(e);\n this._clickListener = e => this._onClick(e);\n }\n\n public dispose(): void {\n super.dispose();\n this._deactivate();\n }\n\n public add(zone: IMouseZone): void {\n this._zones.push(zone);\n if (this._zones.length === 1) {\n this._activate();\n }\n }\n\n public clearAll(start?: number, end?: number): void {\n // Exit if there's nothing to clear\n if (this._zones.length === 0) {\n return;\n }\n\n // Clear all if start/end weren't set\n if (!start || !end) {\n start = 0;\n end = this._bufferService.rows - 1;\n }\n\n // Iterate through zones and clear them out if they're within the range\n for (let i = 0; i < this._zones.length; i++) {\n const zone = this._zones[i];\n if ((zone.y1 > start && zone.y1 <= end + 1) ||\n (zone.y2 > start && zone.y2 <= end + 1) ||\n (zone.y1 < start && zone.y2 > end + 1)) {\n if (this._currentZone && this._currentZone === zone) {\n this._currentZone.leaveCallback();\n this._currentZone = undefined;\n }\n this._zones.splice(i--, 1);\n }\n }\n\n // Deactivate the mouse zone manager if all the zones have been removed\n if (this._zones.length === 0) {\n this._deactivate();\n }\n }\n\n private _activate(): void {\n if (!this._areZonesActive) {\n this._areZonesActive = true;\n this._element.addEventListener('mousemove', this._mouseMoveListener);\n this._element.addEventListener('mouseleave', this._mouseLeaveListener);\n this._element.addEventListener('click', this._clickListener);\n }\n }\n\n private _deactivate(): void {\n if (this._areZonesActive) {\n this._areZonesActive = false;\n this._element.removeEventListener('mousemove', this._mouseMoveListener);\n this._element.removeEventListener('mouseleave', this._mouseLeaveListener);\n this._element.removeEventListener('click', this._clickListener);\n }\n }\n\n private _onMouseMove(e: MouseEvent): void {\n // TODO: Ideally this would only clear the hover state when the mouse moves\n // outside of the mouse zone\n if (this._lastHoverCoords[0] !== e.pageX || this._lastHoverCoords[1] !== e.pageY) {\n this._onHover(e);\n // Record the current coordinates\n this._lastHoverCoords = [e.pageX, e.pageY];\n }\n }\n\n private _onHover(e: MouseEvent): void {\n const zone = this._findZoneEventAt(e);\n\n // Do nothing if the zone is the same\n if (zone === this._currentZone) {\n return;\n }\n\n // Fire the hover end callback and cancel any existing timer if a new zone\n // is being hovered\n if (this._currentZone) {\n this._currentZone.leaveCallback();\n this._currentZone = undefined;\n if (this._tooltipTimeout) {\n clearTimeout(this._tooltipTimeout);\n }\n }\n\n // Exit if there is not zone\n if (!zone) {\n return;\n }\n this._currentZone = zone;\n\n // Trigger the hover callback\n if (zone.hoverCallback) {\n zone.hoverCallback(e);\n }\n\n // Restart the tooltip timeout\n this._tooltipTimeout = window.setTimeout(() => this._onTooltip(e), this._optionsService.options.linkTooltipHoverDuration);\n }\n\n private _onTooltip(e: MouseEvent): void {\n this._tooltipTimeout = undefined;\n const zone = this._findZoneEventAt(e);\n if (zone && zone.tooltipCallback) {\n zone.tooltipCallback(e);\n }\n }\n\n private _onMouseDown(e: MouseEvent): void {\n // Store current terminal selection length, to check if we're performing\n // a selection operation\n this._initialSelectionLength = this._getSelectionLength();\n\n // Ignore the event if there are no zones active\n if (!this._areZonesActive) {\n return;\n }\n\n // Find the active zone, prevent event propagation if found to prevent other\n // components from handling the mouse event.\n const zone = this._findZoneEventAt(e);\n if (zone?.willLinkActivate(e)) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n }\n\n private _onMouseLeave(e: MouseEvent): void {\n // Fire the hover end callback and cancel any existing timer if the mouse\n // leaves the terminal element\n if (this._currentZone) {\n this._currentZone.leaveCallback();\n this._currentZone = undefined;\n if (this._tooltipTimeout) {\n clearTimeout(this._tooltipTimeout);\n }\n }\n }\n\n private _onClick(e: MouseEvent): void {\n // Find the active zone and click it if found and no selection was\n // being performed\n const zone = this._findZoneEventAt(e);\n const currentSelectionLength = this._getSelectionLength();\n\n if (zone && currentSelectionLength === this._initialSelectionLength) {\n zone.clickCallback(e);\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n }\n\n private _getSelectionLength(): number {\n const selectionText = this._selectionService.selectionText;\n return selectionText ? selectionText.length : 0;\n }\n\n private _findZoneEventAt(e: MouseEvent): IMouseZone | undefined {\n const coords = this._mouseService.getCoords(e, this._screenElement, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return undefined;\n }\n const x = coords[0];\n const y = coords[1];\n for (let i = 0; i < this._zones.length; i++) {\n const zone = this._zones[i];\n if (zone.y1 === zone.y2) {\n // Single line link\n if (y === zone.y1 && x >= zone.x1 && x < zone.x2) {\n return zone;\n }\n } else {\n // Multi-line link\n if ((y === zone.y1 && x >= zone.x1) ||\n (y === zone.y2 && x < zone.x2) ||\n (y > zone.y1 && y < zone.y2)) {\n return zone;\n }\n }\n }\n return undefined;\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\n\n/**\n * Debounces calls to render terminal rows using animation frames.\n */\nexport class RenderDebouncer implements IDisposable {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n private _animationFrame: number | undefined;\n\n constructor(\n private _renderCallback: (start: number, end: number) => void\n ) {\n }\n\n public dispose(): void {\n if (this._animationFrame) {\n window.cancelAnimationFrame(this._animationFrame);\n this._animationFrame = undefined;\n }\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart !== undefined ? rowStart : 0;\n rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n if (this._animationFrame) {\n return;\n }\n\n this._animationFrame = window.requestAnimationFrame(() => this._innerRefresh());\n }\n\n private _innerRefresh(): void {\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n this._animationFrame = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\n\nexport type ScreenDprListener = (newDevicePixelRatio?: number, oldDevicePixelRatio?: number) => void;\n\n/**\n * The screen device pixel ratio monitor allows listening for when the\n * window.devicePixelRatio value changes. This is done not with polling but with\n * the use of window.matchMedia to watch media queries. When the event fires,\n * the listener will be reattached using a different media query to ensure that\n * any further changes will register.\n *\n * The listener should fire on both window zoom changes and switching to a\n * monitor with a different DPI.\n */\nexport class ScreenDprMonitor extends Disposable {\n private _currentDevicePixelRatio: number = window.devicePixelRatio;\n private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined;\n private _listener: ScreenDprListener | undefined;\n private _resolutionMediaMatchList: MediaQueryList | undefined;\n\n public setListener(listener: ScreenDprListener): void {\n if (this._listener) {\n this.clearListener();\n }\n this._listener = listener;\n this._outerListener = () => {\n if (!this._listener) {\n return;\n }\n this._listener(window.devicePixelRatio, this._currentDevicePixelRatio);\n this._updateDpr();\n };\n this._updateDpr();\n }\n\n public dispose(): void {\n super.dispose();\n this.clearListener();\n }\n\n private _updateDpr(): void {\n if (!this._outerListener) {\n return;\n }\n\n // Clear listeners for old DPR\n this._resolutionMediaMatchList?.removeListener(this._outerListener);\n\n // Add listeners for new DPR\n this._currentDevicePixelRatio = window.devicePixelRatio;\n this._resolutionMediaMatchList = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);\n this._resolutionMediaMatchList.addListener(this._outerListener);\n }\n\n public clearListener(): void {\n if (!this._resolutionMediaMatchList || !this._listener || !this._outerListener) {\n return;\n }\n this._resolutionMediaMatchList.removeListener(this._outerListener);\n this._resolutionMediaMatchList = undefined;\n this._listener = undefined;\n this._outerListener = undefined;\n }\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { ICompositionHelper, ITerminal, IBrowser, CustomKeyEventHandler, ILinkifier, IMouseZoneManager, LinkMatcherHandler, ILinkMatcherOptions, IViewport, ILinkifier2 } from 'browser/Types';\nimport { IRenderer, CharacterJoinerHandler } from 'browser/renderer/Types';\nimport { CompositionHelper } from 'browser/input/CompositionHelper';\nimport { Viewport } from 'browser/Viewport';\nimport { rightClickHandler, moveTextAreaUnderMouseCursor, handlePasteEvent, copyHandler, paste } from 'browser/Clipboard';\nimport { C0 } from 'common/data/EscapeSequences';\nimport { WindowsOptionsReportType } from '../common/InputHandler';\nimport { Renderer } from 'browser/renderer/Renderer';\nimport { Linkifier } from 'browser/Linkifier';\nimport { SelectionService } from 'browser/services/SelectionService';\nimport * as Browser from 'common/Platform';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport * as Strings from 'browser/LocalizableStrings';\nimport { SoundService } from 'browser/services/SoundService';\nimport { MouseZoneManager } from 'browser/MouseZoneManager';\nimport { AccessibilityManager } from './AccessibilityManager';\nimport { ITheme, IMarker, IDisposable, ISelectionPosition, ILinkProvider } from 'xterm';\nimport { DomRenderer } from 'browser/renderer/dom/DomRenderer';\nimport { IKeyboardEvent, KeyboardResultType, CoreMouseEventType, CoreMouseButton, CoreMouseAction, ITerminalOptions, IAnsiColorChangeEvent } from 'common/Types';\nimport { evaluateKeyboardEvent } from 'common/input/Keyboard';\nimport { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { ColorManager } from 'browser/ColorManager';\nimport { RenderService } from 'browser/services/RenderService';\nimport { ICharSizeService, IRenderService, IMouseService, ISelectionService, ISoundService, ICoreBrowserService } from 'browser/services/Services';\nimport { CharSizeService } from 'browser/services/CharSizeService';\nimport { IBuffer } from 'common/buffer/Types';\nimport { MouseService } from 'browser/services/MouseService';\nimport { Linkifier2 } from 'browser/Linkifier2';\nimport { CoreBrowserService } from 'browser/services/CoreBrowserService';\nimport { CoreTerminal } from 'common/CoreTerminal';\nimport { ITerminalOptions as IInitializedTerminalOptions } from 'common/services/Services';\nimport { rgba } from 'browser/Color';\n\n// Let it work inside Node.js for automated testing purposes.\nconst document: Document = (typeof window !== 'undefined') ? window.document : null as any;\n\nexport class Terminal extends CoreTerminal implements ITerminal {\n public textarea: HTMLTextAreaElement | undefined;\n public element: HTMLElement | undefined;\n public screenElement: HTMLElement | undefined;\n\n private _document: Document | undefined;\n private _viewportScrollArea: HTMLElement | undefined;\n private _viewportElement: HTMLElement | undefined;\n private _helperContainer: HTMLElement | undefined;\n private _compositionView: HTMLElement | undefined;\n\n // private _visualBellTimer: number;\n\n public browser: IBrowser = Browser;\n\n // TODO: We should remove options once components adopt optionsService\n public get options(): IInitializedTerminalOptions { return this.optionsService.options; }\n\n private _customKeyEventHandler: CustomKeyEventHandler | undefined;\n\n // browser services\n private _charSizeService: ICharSizeService | undefined;\n private _mouseService: IMouseService | undefined;\n private _renderService: IRenderService | undefined;\n private _selectionService: ISelectionService | undefined;\n private _soundService: ISoundService | undefined;\n\n /**\n * Records whether the keydown event has already been handled and triggered a data event, if so\n * the keypress event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyDownHandled: boolean = false;\n\n public linkifier: ILinkifier;\n public linkifier2: ILinkifier2;\n public viewport: IViewport | undefined;\n private _compositionHelper: ICompositionHelper | undefined;\n private _mouseZoneManager: IMouseZoneManager | undefined;\n private _accessibilityManager: AccessibilityManager | undefined;\n private _colorManager: ColorManager | undefined;\n private _theme: ITheme | undefined;\n\n private _onCursorMove = new EventEmitter();\n public get onCursorMove(): IEvent { return this._onCursorMove.event; }\n private _onKey = new EventEmitter<{ key: string, domEvent: KeyboardEvent }>();\n public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._onKey.event; }\n private _onRender = new EventEmitter<{ start: number, end: number }>();\n public get onRender(): IEvent<{ start: number, end: number }> { return this._onRender.event; }\n private _onSelectionChange = new EventEmitter();\n public get onSelectionChange(): IEvent { return this._onSelectionChange.event; }\n private _onTitleChange = new EventEmitter();\n public get onTitleChange(): IEvent { return this._onTitleChange.event; }\n\n private _onFocus = new EventEmitter();\n public get onFocus(): IEvent { return this._onFocus.event; }\n private _onBlur = new EventEmitter();\n public get onBlur(): IEvent { return this._onBlur.event; }\n private _onA11yCharEmitter = new EventEmitter();\n public get onA11yChar(): IEvent { return this._onA11yCharEmitter.event; }\n private _onA11yTabEmitter = new EventEmitter();\n public get onA11yTab(): IEvent { return this._onA11yTabEmitter.event; }\n\n /**\n * Creates a new `Terminal` object.\n *\n * @param options An object containing a set of options, the available options are:\n * - `cursorBlink` (boolean): Whether the terminal cursor blinks\n * - `cols` (number): The number of columns of the terminal (horizontal size)\n * - `rows` (number): The number of rows of the terminal (vertical size)\n *\n * @public\n * @class Xterm Xterm\n * @alias module:xterm/src/xterm\n */\n constructor(\n options: ITerminalOptions = {}\n ) {\n super(options);\n\n this._setup();\n\n this.linkifier = this._instantiationService.createInstance(Linkifier);\n this.linkifier2 = this.register(this._instantiationService.createInstance(Linkifier2));\n\n // Setup InputHandler listeners\n this.register(this._inputHandler.onRequestBell(() => this.bell()));\n this.register(this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end)));\n this.register(this._inputHandler.onRequestReset(() => this.reset()));\n this.register(this._inputHandler.onRequestScroll((eraseAttr, isWrapped) => this.scroll(eraseAttr, isWrapped || undefined)));\n this.register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));\n this.register(this._inputHandler.onAnsiColorChange((event) => this._changeAnsiColor(event)));\n this.register(forwardEvent(this._inputHandler.onCursorMove, this._onCursorMove));\n this.register(forwardEvent(this._inputHandler.onTitleChange, this._onTitleChange));\n this.register(forwardEvent(this._inputHandler.onA11yChar, this._onA11yCharEmitter));\n this.register(forwardEvent(this._inputHandler.onA11yTab, this._onA11yTabEmitter));\n\n // Setup listeners\n this.register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));\n }\n\n private _changeAnsiColor(event: IAnsiColorChangeEvent): void {\n if (!this._colorManager) { return; }\n\n event.colors.forEach(ansiColor => {\n const color = rgba.toColor(ansiColor.red, ansiColor.green, ansiColor.blue);\n\n this._colorManager!.colors.ansi[ansiColor.colorIndex] = color;\n });\n\n this._renderService?.setColors(this._colorManager!.colors);\n this.viewport?.onThemeChange(this._colorManager!.colors);\n }\n\n public dispose(): void {\n if (this._isDisposed) {\n return;\n }\n super.dispose();\n this._renderService?.dispose();\n this._customKeyEventHandler = undefined;\n this.write = () => { };\n this.element?.parentNode?.removeChild(this.element);\n }\n\n protected _setup(): void {\n super._setup();\n\n this._customKeyEventHandler = undefined;\n }\n\n /**\n * Convenience property to active buffer.\n */\n public get buffer(): IBuffer {\n return this.buffers.active;\n }\n\n /**\n * Focus the terminal. Delegates focus handling to the terminal's DOM element.\n */\n public focus(): void {\n if (this.textarea) {\n this.textarea.focus({ preventScroll: true });\n }\n }\n\n protected _updateOptions(key: string): void {\n super._updateOptions(key);\n\n // TODO: These listeners should be owned by individual components\n switch (key) {\n case 'fontFamily':\n case 'fontSize':\n // When the font changes the size of the cells may change which requires a renderer clear\n this._renderService?.clear();\n this._charSizeService?.measure();\n break;\n case 'cursorBlink':\n case 'cursorStyle':\n // The DOM renderer needs a row refresh to update the cursor styles\n this.refresh(this.buffer.y, this.buffer.y);\n break;\n case 'drawBoldTextInBrightColors':\n case 'letterSpacing':\n case 'lineHeight':\n case 'fontWeight':\n case 'fontWeightBold':\n case 'minimumContrastRatio':\n // When the font changes the size of the cells may change which requires a renderer clear\n if (this._renderService) {\n this._renderService.clear();\n this._renderService.onResize(this.cols, this.rows);\n this.refresh(0, this.rows - 1);\n }\n break;\n case 'rendererType':\n if (this._renderService) {\n this._renderService.setRenderer(this._createRenderer());\n this._renderService.onResize(this.cols, this.rows);\n }\n break;\n case 'scrollback':\n this.viewport?.syncScrollArea();\n break;\n case 'screenReaderMode':\n if (this.optionsService.options.screenReaderMode) {\n if (!this._accessibilityManager && this._renderService) {\n this._accessibilityManager = new AccessibilityManager(this, this._renderService);\n }\n } else {\n this._accessibilityManager?.dispose();\n this._accessibilityManager = undefined;\n }\n break;\n case 'tabStopWidth': this.buffers.setupTabStops(); break;\n case 'theme':\n this._setTheme(this.optionsService.options.theme);\n break;\n }\n }\n\n /**\n * Binds the desired focus behavior on a given terminal object.\n */\n private _onTextAreaFocus(ev: KeyboardEvent): void {\n if (this._coreService.decPrivateModes.sendFocus) {\n this._coreService.triggerDataEvent(C0.ESC + '[I');\n }\n this.updateCursorStyle(ev);\n this.element!.classList.add('focus');\n this._showCursor();\n this._onFocus.fire();\n }\n\n /**\n * Blur the terminal, calling the blur function on the terminal's underlying\n * textarea.\n */\n public blur(): void {\n return this.textarea?.blur();\n }\n\n /**\n * Binds the desired blur behavior on a given terminal object.\n */\n private _onTextAreaBlur(): void {\n // Text can safely be removed on blur. Doing it earlier could interfere with\n // screen readers reading it out.\n this.textarea!.value = '';\n this.refresh(this.buffer.y, this.buffer.y);\n if (this._coreService.decPrivateModes.sendFocus) {\n this._coreService.triggerDataEvent(C0.ESC + '[O');\n }\n this.element!.classList.remove('focus');\n this._onBlur.fire();\n }\n\n private _syncTextArea(): void {\n if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper!.isComposing) {\n return;\n }\n\n const cellHeight = Math.ceil(this._charSizeService!.height * this.optionsService.options.lineHeight);\n const cursorTop = this._bufferService.buffer.y * cellHeight;\n const cursorLeft = this._bufferService.buffer.x * this._charSizeService!.width;\n\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n this.textarea.style.left = cursorLeft + 'px';\n this.textarea.style.top = cursorTop + 'px';\n this.textarea.style.width = this._charSizeService!.width + 'px';\n this.textarea.style.height = cellHeight + 'px';\n this.textarea.style.lineHeight = cellHeight + 'px';\n this.textarea.style.zIndex = '-5';\n }\n\n /**\n * Initialize default behavior\n */\n private _initGlobal(): void {\n this._bindKeys();\n\n // Bind clipboard functionality\n this.register(addDisposableDomListener(this.element!, 'copy', (event: ClipboardEvent) => {\n // If mouse events are active it means the selection manager is disabled and\n // copy should be handled by the host program.\n if (!this.hasSelection()) {\n return;\n }\n copyHandler(event, this._selectionService!);\n }));\n const pasteHandlerWrapper = (event: ClipboardEvent): void => handlePasteEvent(event, this.textarea!, this._coreService);\n this.register(addDisposableDomListener(this.textarea!, 'paste', pasteHandlerWrapper));\n this.register(addDisposableDomListener(this.element!, 'paste', pasteHandlerWrapper));\n\n // Handle right click context menus\n if (Browser.isFirefox) {\n // Firefox doesn't appear to fire the contextmenu event on right click\n this.register(addDisposableDomListener(this.element!, 'mousedown', (event: MouseEvent) => {\n if (event.button === 2) {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }\n }));\n } else {\n this.register(addDisposableDomListener(this.element!, 'contextmenu', (event: MouseEvent) => {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }));\n }\n\n // Move the textarea under the cursor when middle clicking on Linux to ensure\n // middle click to paste selection works. This only appears to work in Chrome\n // at the time is writing.\n if (Browser.isLinux) {\n // Use auxclick event over mousedown the latter doesn't seem to work. Note\n // that the regular click event doesn't fire for the middle mouse button.\n this.register(addDisposableDomListener(this.element!, 'auxclick', (event: MouseEvent) => {\n if (event.button === 1) {\n moveTextAreaUnderMouseCursor(event, this.textarea!, this.screenElement!);\n }\n }));\n }\n }\n\n /**\n * Apply key handling to the terminal\n */\n private _bindKeys(): void {\n this.register(addDisposableDomListener(this.textarea!, 'keyup', (ev: KeyboardEvent) => this._keyUp(ev), true));\n this.register(addDisposableDomListener(this.textarea!, 'keydown', (ev: KeyboardEvent) => this._keyDown(ev), true));\n this.register(addDisposableDomListener(this.textarea!, 'keypress', (ev: KeyboardEvent) => this._keyPress(ev), true));\n this.register(addDisposableDomListener(this.textarea!, 'compositionstart', () => this._compositionHelper!.compositionstart()));\n this.register(addDisposableDomListener(this.textarea!, 'compositionupdate', (e: CompositionEvent) => this._compositionHelper!.compositionupdate(e)));\n this.register(addDisposableDomListener(this.textarea!, 'compositionend', () => this._compositionHelper!.compositionend()));\n this.register(this.onRender(() => this._compositionHelper!.updateCompositionElements()));\n this.register(this.onRender(e => this._queueLinkification(e.start, e.end)));\n }\n\n /**\n * Opens the terminal within an element.\n *\n * @param parent The element to create the terminal within.\n */\n public open(parent: HTMLElement): void {\n if (!parent) {\n throw new Error('Terminal requires a parent element.');\n }\n\n if (!parent.isConnected) {\n this._logService.debug('Terminal.open was called on an element that was not attached to the DOM');\n }\n\n this._document = parent.ownerDocument!;\n\n // Create main element container\n this.element = this._document.createElement('div');\n this.element.dir = 'ltr'; // xterm.css assumes LTR\n this.element.classList.add('terminal');\n this.element.classList.add('xterm');\n this.element.setAttribute('tabindex', '0');\n this.element.setAttribute('role', 'document');\n parent.appendChild(this.element);\n\n // Performance: Use a document fragment to build the terminal\n // viewport and helper elements detached from the DOM\n const fragment = document.createDocumentFragment();\n this._viewportElement = document.createElement('div');\n this._viewportElement.classList.add('xterm-viewport');\n fragment.appendChild(this._viewportElement);\n this._viewportScrollArea = document.createElement('div');\n this._viewportScrollArea.classList.add('xterm-scroll-area');\n this._viewportElement.appendChild(this._viewportScrollArea);\n\n this.screenElement = document.createElement('div');\n this.screenElement.classList.add('xterm-screen');\n // Create the container that will hold helpers like the textarea for\n // capturing DOM Events. Then produce the helpers.\n this._helperContainer = document.createElement('div');\n this._helperContainer.classList.add('xterm-helpers');\n this.screenElement.appendChild(this._helperContainer);\n fragment.appendChild(this.screenElement);\n\n this.textarea = document.createElement('textarea');\n this.textarea.classList.add('xterm-helper-textarea');\n this.textarea.setAttribute('aria-label', Strings.promptLabel);\n this.textarea.setAttribute('aria-multiline', 'false');\n this.textarea.setAttribute('autocorrect', 'off');\n this.textarea.setAttribute('autocapitalize', 'off');\n this.textarea.setAttribute('spellcheck', 'false');\n this.textarea.tabIndex = 0;\n this.register(addDisposableDomListener(this.textarea, 'focus', (ev: KeyboardEvent) => this._onTextAreaFocus(ev)));\n this.register(addDisposableDomListener(this.textarea, 'blur', () => this._onTextAreaBlur()));\n this._helperContainer.appendChild(this.textarea);\n\n const coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea);\n this._instantiationService.setService(ICoreBrowserService, coreBrowserService);\n\n this._charSizeService = this._instantiationService.createInstance(CharSizeService, this._document, this._helperContainer);\n this._instantiationService.setService(ICharSizeService, this._charSizeService);\n\n this._compositionView = document.createElement('div');\n this._compositionView.classList.add('composition-view');\n this._compositionHelper = this._instantiationService.createInstance(CompositionHelper, this.textarea, this._compositionView);\n this._helperContainer.appendChild(this._compositionView);\n\n // Performance: Add viewport and helper elements from the fragment\n this.element.appendChild(fragment);\n\n this._theme = this.options.theme || this._theme;\n this._colorManager = new ColorManager(document, this.options.allowTransparency);\n this.register(this.optionsService.onOptionChange(e => this._colorManager!.onOptionsChange(e)));\n this._colorManager.setTheme(this._theme);\n\n const renderer = this._createRenderer();\n this._renderService = this.register(this._instantiationService.createInstance(RenderService, renderer, this.rows, this.screenElement));\n this._instantiationService.setService(IRenderService, this._renderService);\n this.register(this._renderService.onRenderedBufferChange(e => this._onRender.fire(e)));\n this.onResize(e => this._renderService!.resize(e.cols, e.rows));\n\n this._soundService = this._instantiationService.createInstance(SoundService);\n this._instantiationService.setService(ISoundService, this._soundService);\n this._mouseService = this._instantiationService.createInstance(MouseService);\n this._instantiationService.setService(IMouseService, this._mouseService);\n\n this.viewport = this._instantiationService.createInstance(Viewport,\n (amount: number, suppressEvent: boolean) => this.scrollLines(amount, suppressEvent),\n this._viewportElement,\n this._viewportScrollArea\n );\n this.viewport.onThemeChange(this._colorManager.colors);\n this.register(this._inputHandler.onRequestSyncScrollBar(() => this.viewport!.syncScrollArea()));\n this.register(this.viewport);\n\n this.register(this.onCursorMove(() => {\n this._renderService!.onCursorMove();\n this._syncTextArea();\n }));\n this.register(this.onResize(() => this._renderService!.onResize(this.cols, this.rows)));\n this.register(this.onBlur(() => this._renderService!.onBlur()));\n this.register(this.onFocus(() => this._renderService!.onFocus()));\n this.register(this._renderService.onDimensionsChange(() => this.viewport!.syncScrollArea()));\n\n this._selectionService = this.register(this._instantiationService.createInstance(SelectionService,\n this.element,\n this.screenElement));\n this._instantiationService.setService(ISelectionService, this._selectionService);\n this.register(this._selectionService.onRequestScrollLines(e => this.scrollLines(e.amount, e.suppressScrollEvent)));\n this.register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire()));\n this.register(this._selectionService.onRequestRedraw(e => this._renderService!.onSelectionChanged(e.start, e.end, e.columnSelectMode)));\n this.register(this._selectionService.onLinuxMouseSelection(text => {\n // If there's a new selection, put it into the textarea, focus and select it\n // in order to register it as a selection on the OS. This event is fired\n // only on Linux to enable middle click to paste selection.\n this.textarea!.value = text;\n this.textarea!.focus();\n this.textarea!.select();\n }));\n this.register(this.onScroll(() => {\n this.viewport!.syncScrollArea();\n this._selectionService!.refresh();\n }));\n this.register(addDisposableDomListener(this._viewportElement, 'scroll', () => this._selectionService!.refresh()));\n\n this._mouseZoneManager = this._instantiationService.createInstance(MouseZoneManager, this.element, this.screenElement);\n this.register(this._mouseZoneManager);\n this.register(this.onScroll(() => this._mouseZoneManager!.clearAll()));\n this.linkifier.attachToDom(this.element, this._mouseZoneManager);\n this.linkifier2.attachToDom(this.element, this._mouseService, this._renderService);\n\n // This event listener must be registered aftre MouseZoneManager is created\n this.register(addDisposableDomListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.onMouseDown(e)));\n\n // apply mouse event classes set by escape codes before terminal was attached\n if (this._coreMouseService.areMouseEventsActive) {\n this._selectionService.disable();\n this.element.classList.add('enable-mouse-events');\n } else {\n this._selectionService.enable();\n }\n\n if (this.options.screenReaderMode) {\n // Note that this must be done *after* the renderer is created in order to\n // ensure the correct order of the dprchange event\n this._accessibilityManager = new AccessibilityManager(this, this._renderService);\n }\n\n // Measure the character size\n this._charSizeService.measure();\n\n // Setup loop that draws to screen\n this.refresh(0, this.rows - 1);\n\n // Initialize global actions that need to be taken on the document.\n this._initGlobal();\n\n // Listen for mouse events and translate\n // them into terminal mouse protocols.\n this.bindMouse();\n }\n\n private _createRenderer(): IRenderer {\n switch (this.options.rendererType) {\n case 'canvas': return this._instantiationService.createInstance(Renderer, this._colorManager!.colors, this.screenElement!, this.linkifier, this.linkifier2);\n case 'dom': return this._instantiationService.createInstance(DomRenderer, this._colorManager!.colors, this.element!, this.screenElement!, this._viewportElement!, this.linkifier, this.linkifier2);\n default: throw new Error(`Unrecognized rendererType \"${this.options.rendererType}\"`);\n }\n }\n\n /**\n * Sets the theme on the renderer. The renderer must have been initialized.\n * @param theme The theme to set.\n */\n private _setTheme(theme: ITheme): void {\n this._theme = theme;\n this._colorManager?.setTheme(theme);\n this._renderService?.setColors(this._colorManager!.colors);\n this.viewport?.onThemeChange(this._colorManager!.colors);\n }\n\n /**\n * Bind certain mouse events to the terminal.\n * By default only 3 button + wheel up/down is ativated. For higher buttons\n * no mouse report will be created. Typically the standard actions will be active.\n *\n * There are several reasons not to enable support for higher buttons/wheel:\n * - Button 4 and 5 are typically used for history back and forward navigation,\n * there is no straight forward way to supress/intercept those standard actions.\n * - Support for higher buttons does not work in some platform/browser combinations.\n * - Left/right wheel was not tested.\n * - Emulators vary in mouse button support, typically only 3 buttons and\n * wheel up/down work reliable.\n *\n * TODO: Move mouse event code into its own file.\n */\n public bindMouse(): void {\n const self = this;\n const el = this.element!;\n\n // send event to CoreMouseService\n function sendEvent(ev: MouseEvent | WheelEvent): boolean {\n // get mouse coordinates\n const pos = self._mouseService!.getRawByteCoords(ev, self.screenElement!, self.cols, self.rows);\n if (!pos) {\n return false;\n }\n\n let but: CoreMouseButton;\n let action: CoreMouseAction | undefined;\n switch ((ev).overrideType || ev.type) {\n case 'mousemove':\n action = CoreMouseAction.MOVE;\n if (ev.buttons === undefined) {\n // buttons is not supported on macOS, try to get a value from button instead\n but = CoreMouseButton.NONE;\n if (ev.button !== undefined) {\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n }\n } else {\n // according to MDN buttons only reports up to button 5 (AUX2)\n but = ev.buttons & 1 ? CoreMouseButton.LEFT :\n ev.buttons & 4 ? CoreMouseButton.MIDDLE :\n ev.buttons & 2 ? CoreMouseButton.RIGHT :\n CoreMouseButton.NONE; // fallback to NONE\n }\n break;\n case 'mouseup':\n action = CoreMouseAction.UP;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'mousedown':\n action = CoreMouseAction.DOWN;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'wheel':\n // only UP/DOWN wheel events are respected\n if ((ev as WheelEvent).deltaY !== 0) {\n action = (ev as WheelEvent).deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN;\n }\n but = CoreMouseButton.WHEEL;\n break;\n default:\n // dont handle other event types by accident\n return false;\n }\n\n // exit if we cannot determine valid button/action values\n // do nothing for higher buttons than wheel\n if (action === undefined || but === undefined || but > CoreMouseButton.WHEEL) {\n return false;\n }\n\n return self._coreMouseService.triggerMouseEvent({\n col: pos.x - 33, // FIXME: why -33 here?\n row: pos.y - 33,\n button: but,\n action,\n ctrl: ev.ctrlKey,\n alt: ev.altKey,\n shift: ev.shiftKey\n });\n }\n\n /**\n * Event listener state handling.\n * We listen to the onProtocolChange event of CoreMouseService and put\n * requested listeners in `requestedEvents`. With this the listeners\n * have all bits to do the event listener juggling.\n * Note: 'mousedown' currently is \"always on\" and not managed\n * by onProtocolChange.\n */\n const requestedEvents: { [key: string]: ((ev: Event) => void) | null } = {\n mouseup: null,\n wheel: null,\n mousedrag: null,\n mousemove: null\n };\n const eventListeners: { [key: string]: (ev: any) => void | boolean } = {\n mouseup: (ev: MouseEvent) => {\n sendEvent(ev);\n if (!ev.buttons) {\n // if no other button is held remove global handlers\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n if (requestedEvents.mousedrag) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);\n }\n }\n return this.cancel(ev);\n },\n wheel: (ev: WheelEvent) => {\n sendEvent(ev);\n ev.preventDefault();\n return this.cancel(ev);\n },\n mousedrag: (ev: MouseEvent) => {\n // deal only with move while a button is held\n if (ev.buttons) {\n sendEvent(ev);\n }\n },\n mousemove: (ev: MouseEvent) => {\n // deal only with move without any button\n if (!ev.buttons) {\n sendEvent(ev);\n }\n }\n };\n this.register(this._coreMouseService.onProtocolChange(events => {\n // apply global changes on events\n if (events) {\n if (this.optionsService.options.logLevel === 'debug') {\n this._logService.debug('Binding to mouse events:', this._coreMouseService.explainEvents(events));\n }\n this.element!.classList.add('enable-mouse-events');\n this._selectionService!.disable();\n } else {\n this._logService.debug('Unbinding from mouse events.');\n this.element!.classList.remove('enable-mouse-events');\n this._selectionService!.enable();\n }\n\n // add/remove handlers from requestedEvents\n\n if (!(events & CoreMouseEventType.MOVE)) {\n el.removeEventListener('mousemove', requestedEvents.mousemove!);\n requestedEvents.mousemove = null;\n } else if (!requestedEvents.mousemove) {\n el.addEventListener('mousemove', eventListeners.mousemove);\n requestedEvents.mousemove = eventListeners.mousemove;\n }\n\n if (!(events & CoreMouseEventType.WHEEL)) {\n el.removeEventListener('wheel', requestedEvents.wheel!);\n requestedEvents.wheel = null;\n } else if (!requestedEvents.wheel) {\n el.addEventListener('wheel', eventListeners.wheel, { passive: false });\n requestedEvents.wheel = eventListeners.wheel;\n }\n\n if (!(events & CoreMouseEventType.UP)) {\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n requestedEvents.mouseup = null;\n } else if (!requestedEvents.mouseup) {\n requestedEvents.mouseup = eventListeners.mouseup;\n }\n\n if (!(events & CoreMouseEventType.DRAG)) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag!);\n requestedEvents.mousedrag = null;\n } else if (!requestedEvents.mousedrag) {\n requestedEvents.mousedrag = eventListeners.mousedrag;\n }\n }));\n // force initial onProtocolChange so we dont miss early mouse requests\n this._coreMouseService.activeProtocol = this._coreMouseService.activeProtocol;\n\n /**\n * \"Always on\" event listeners.\n */\n this.register(addDisposableDomListener(el, 'mousedown', (ev: MouseEvent) => {\n ev.preventDefault();\n this.focus();\n\n // Don't send the mouse button to the pty if mouse events are disabled or\n // if the selection manager is having selection forced (ie. a modifier is\n // held).\n if (!this._coreMouseService.areMouseEventsActive || this._selectionService!.shouldForceSelection(ev)) {\n return;\n }\n\n sendEvent(ev);\n\n // Register additional global handlers which should keep reporting outside\n // of the terminal element.\n // Note: Other emulators also do this for 'mousedown' while a button\n // is held, we currently limit 'mousedown' to the terminal only.\n if (requestedEvents.mouseup) {\n this._document!.addEventListener('mouseup', requestedEvents.mouseup);\n }\n if (requestedEvents.mousedrag) {\n this._document!.addEventListener('mousemove', requestedEvents.mousedrag);\n }\n\n return this.cancel(ev);\n }));\n\n this.register(addDisposableDomListener(el, 'wheel', (ev: WheelEvent) => {\n if (!requestedEvents.wheel) {\n // Convert wheel events into up/down events when the buffer does not have scrollback, this\n // enables scrolling in apps hosted in the alt buffer such as vim or tmux.\n if (!this.buffer.hasScrollback) {\n const amount = this.viewport!.getLinesScrolled(ev);\n\n // Do nothing if there's no vertical scroll\n if (amount === 0) {\n return;\n }\n\n // Construct and send sequences\n const sequence = C0.ESC + (this._coreService.decPrivateModes.applicationCursorKeys ? 'O' : '[') + (ev.deltaY < 0 ? 'A' : 'B');\n let data = '';\n for (let i = 0; i < Math.abs(amount); i++) {\n data += sequence;\n }\n this._coreService.triggerDataEvent(data, true);\n }\n return;\n }\n }, { passive: true }));\n\n // allow wheel scrolling in\n // the shell for example\n this.register(addDisposableDomListener(el, 'wheel', (ev: WheelEvent) => {\n if (requestedEvents.wheel) return;\n if (!this.viewport!.onWheel(ev)) {\n return this.cancel(ev);\n }\n }, { passive: false }));\n\n this.register(addDisposableDomListener(el, 'touchstart', (ev: TouchEvent) => {\n if (this._coreMouseService.areMouseEventsActive) return;\n this.viewport!.onTouchStart(ev);\n return this.cancel(ev);\n }, { passive: true }));\n\n this.register(addDisposableDomListener(el, 'touchmove', (ev: TouchEvent) => {\n if (this._coreMouseService.areMouseEventsActive) return;\n if (!this.viewport!.onTouchMove(ev)) {\n return this.cancel(ev);\n }\n }, { passive: false }));\n }\n\n\n /**\n * Tells the renderer to refresh terminal content between two rows (inclusive) at the next\n * opportunity.\n * @param start The row to start from (between 0 and this.rows - 1).\n * @param end The row to end at (between start and this.rows - 1).\n */\n public refresh(start: number, end: number): void {\n this._renderService?.refreshRows(start, end);\n }\n\n /**\n * Queues linkification for the specified rows.\n * @param start The row to start from (between 0 and this.rows - 1).\n * @param end The row to end at (between start and this.rows - 1).\n */\n private _queueLinkification(start: number, end: number): void {\n this.linkifier?.linkifyRows(start, end);\n }\n\n /**\n * Change the cursor style for different selection modes\n */\n public updateCursorStyle(ev: KeyboardEvent): void {\n if (this._selectionService && this._selectionService.shouldColumnSelect(ev)) {\n this.element!.classList.add('column-select');\n } else {\n this.element!.classList.remove('column-select');\n }\n }\n\n /**\n * Display the cursor element\n */\n private _showCursor(): void {\n if (!this._coreService.isCursorInitialized) {\n this._coreService.isCursorInitialized = true;\n this.refresh(this.buffer.y, this.buffer.y);\n }\n }\n\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n super.scrollLines(disp, suppressScrollEvent);\n this.refresh(0, this.rows - 1);\n }\n\n public paste(data: string): void {\n paste(data, this.textarea!, this._coreService);\n }\n\n /**\n * Attaches a custom key event handler which is run before keys are processed,\n * giving consumers of xterm.js ultimate control as to what keys should be\n * processed by the terminal and what keys should not.\n * @param customKeyEventHandler The custom KeyboardEvent handler to attach.\n * This is a function that takes a KeyboardEvent, allowing consumers to stop\n * propagation and/or prevent the default action. The function returns whether\n * the event should be processed by xterm.js.\n */\n public attachCustomKeyEventHandler(customKeyEventHandler: CustomKeyEventHandler): void {\n this._customKeyEventHandler = customKeyEventHandler;\n }\n\n /**\n * Registers a link matcher, allowing custom link patterns to be matched and\n * handled.\n * @param regex The regular expression to search for, specifically\n * this searches the textContent of the rows. You will want to use \\s to match\n * a space ' ' character for example.\n * @param handler The callback when the link is called.\n * @param options Options for the link matcher.\n * @return The ID of the new matcher, this can be used to deregister.\n */\n public registerLinkMatcher(regex: RegExp, handler: LinkMatcherHandler, options?: ILinkMatcherOptions): number {\n const matcherId = this.linkifier.registerLinkMatcher(regex, handler, options);\n this.refresh(0, this.rows - 1);\n return matcherId;\n }\n\n /**\n * Deregisters a link matcher if it has been registered.\n * @param matcherId The link matcher's ID (returned after register)\n */\n public deregisterLinkMatcher(matcherId: number): void {\n if (this.linkifier.deregisterLinkMatcher(matcherId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this.linkifier2.registerLinkProvider(linkProvider);\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number {\n const joinerId = this._renderService!.registerCharacterJoiner(handler);\n this.refresh(0, this.rows - 1);\n return joinerId;\n }\n\n public deregisterCharacterJoiner(joinerId: number): void {\n if (this._renderService!.deregisterCharacterJoiner(joinerId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n\n public get markers(): IMarker[] {\n return this.buffer.markers;\n }\n\n public addMarker(cursorYOffset: number): IMarker | undefined {\n // Disallow markers on the alt buffer\n if (this.buffer !== this.buffers.normal) {\n return;\n }\n\n return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);\n }\n\n /**\n * Gets whether the terminal has an active selection.\n */\n public hasSelection(): boolean {\n return this._selectionService ? this._selectionService.hasSelection : false;\n }\n\n /**\n * Selects text within the terminal.\n * @param column The column the selection starts at..\n * @param row The row the selection starts at.\n * @param length The length of the selection.\n */\n public select(column: number, row: number, length: number): void {\n this._selectionService!.setSelection(column, row, length);\n }\n\n /**\n * Gets the terminal's current selection, this is useful for implementing copy\n * behavior outside of xterm.js.\n */\n public getSelection(): string {\n return this._selectionService ? this._selectionService.selectionText : '';\n }\n\n public getSelectionPosition(): ISelectionPosition | undefined {\n if (!this._selectionService || !this._selectionService.hasSelection) {\n return undefined;\n }\n\n return {\n startColumn: this._selectionService.selectionStart![0],\n startRow: this._selectionService.selectionStart![1],\n endColumn: this._selectionService.selectionEnd![0],\n endRow: this._selectionService.selectionEnd![1]\n };\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._selectionService?.clearSelection();\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._selectionService?.selectAll();\n }\n\n public selectLines(start: number, end: number): void {\n this._selectionService?.selectLines(start, end);\n }\n\n /**\n * Handle a keydown event\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n * @param ev The keydown event to be handled.\n */\n protected _keyDown(event: KeyboardEvent): boolean | undefined {\n this._keyDownHandled = false;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(event) === false) {\n return false;\n }\n\n if (!this._compositionHelper!.keydown(event)) {\n if (this.buffer.ybase !== this.buffer.ydisp) {\n this.scrollToBottom();\n }\n return false;\n }\n\n const result = evaluateKeyboardEvent(event, this._coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);\n\n this.updateCursorStyle(event);\n\n if (result.type === KeyboardResultType.PAGE_DOWN || result.type === KeyboardResultType.PAGE_UP) {\n const scrollCount = this.rows - 1;\n this.scrollLines(result.type === KeyboardResultType.PAGE_UP ? -scrollCount : scrollCount);\n return this.cancel(event, true);\n }\n\n if (result.type === KeyboardResultType.SELECT_ALL) {\n this.selectAll();\n }\n\n if (this._isThirdLevelShift(this.browser, event)) {\n return true;\n }\n\n if (result.cancel) {\n // The event is canceled at the end already, is this necessary?\n this.cancel(event, true);\n }\n\n if (!result.key) {\n return true;\n }\n\n // If ctrl+c or enter is being sent, clear out the textarea. This is done so that screen readers\n // will announce deleted characters. This will not work 100% of the time but it should cover\n // most scenarios.\n if (result.key === C0.ETX || result.key === C0.CR) {\n this.textarea!.value = '';\n }\n\n this._onKey.fire({ key: result.key, domEvent: event });\n this._showCursor();\n this._coreService.triggerDataEvent(result.key, true);\n\n // Cancel events when not in screen reader mode so events don't get bubbled up and handled by\n // other listeners. When screen reader mode is enabled, this could cause issues if the event\n // is handled at a higher level, this is a compromise in order to echo keys to the screen\n // reader.\n if (!this.optionsService.options.screenReaderMode) {\n return this.cancel(event, true);\n }\n\n this._keyDownHandled = true;\n }\n\n private _isThirdLevelShift(browser: IBrowser, ev: IKeyboardEvent): boolean {\n const thirdLevelKey =\n (browser.isMac && !this.options.macOptionIsMeta && ev.altKey && !ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.altKey && ev.ctrlKey && !ev.metaKey);\n\n if (ev.type === 'keypress') {\n return thirdLevelKey;\n }\n\n // Don't invoke for arrows, pageDown, home, backspace, etc. (on non-keypress events)\n return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);\n }\n\n protected _keyUp(ev: KeyboardEvent): void {\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return;\n }\n\n if (!wasModifierKeyOnlyEvent(ev)) {\n this.focus();\n }\n\n this.updateCursorStyle(ev);\n }\n\n /**\n * Handle a keypress event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n * @param ev The keypress event to be handled.\n */\n protected _keyPress(ev: KeyboardEvent): boolean {\n let key;\n\n if (this._keyDownHandled) {\n return false;\n }\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return false;\n }\n\n this.cancel(ev);\n\n if (ev.charCode) {\n key = ev.charCode;\n } else if (ev.which === null || ev.which === undefined) {\n key = ev.keyCode;\n } else if (ev.which !== 0 && ev.charCode !== 0) {\n key = ev.which;\n } else {\n return false;\n }\n\n if (!key || (\n (ev.altKey || ev.ctrlKey || ev.metaKey) && !this._isThirdLevelShift(this.browser, ev)\n )) {\n return false;\n }\n\n key = String.fromCharCode(key);\n\n this._onKey.fire({ key, domEvent: ev });\n this._showCursor();\n this._coreService.triggerDataEvent(key, true);\n\n return true;\n }\n\n /**\n * Ring the bell.\n * Note: We could do sweet things with webaudio here\n */\n public bell(): void {\n if (this._soundBell()) {\n this._soundService!.playBellSound();\n }\n\n // if (this._visualBell()) {\n // this.element.classList.add('visual-bell-active');\n // clearTimeout(this._visualBellTimer);\n // this._visualBellTimer = window.setTimeout(() => {\n // this.element.classList.remove('visual-bell-active');\n // }, 200);\n // }\n }\n\n /**\n * Resizes the terminal.\n *\n * @param x The number of columns to resize to.\n * @param y The number of rows to resize to.\n */\n public resize(x: number, y: number): void {\n if (x === this.cols && y === this.rows) {\n // Check if we still need to measure the char size (fixes #785).\n if (this._charSizeService && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n return;\n }\n\n super.resize(x, y);\n }\n\n private _afterResize(x: number, y: number): void {\n this._charSizeService?.measure();\n\n // Sync the scroll area to make sure scroll events don't fire and scroll the viewport to an\n // invalid location\n this.viewport?.syncScrollArea(true);\n }\n\n /**\n * Clear the entire buffer, making the prompt line the new first line.\n */\n public clear(): void {\n if (this.buffer.ybase === 0 && this.buffer.y === 0) {\n // Don't clear if it's already clear\n return;\n }\n this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);\n this.buffer.lines.length = 1;\n this.buffer.ydisp = 0;\n this.buffer.ybase = 0;\n this.buffer.y = 0;\n for (let i = 1; i < this.rows; i++) {\n this.buffer.lines.push(this.buffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n this.refresh(0, this.rows - 1);\n this._onScroll.fire(this.buffer.ydisp);\n }\n\n /**\n * Reset terminal.\n * Note: Calling this directly from JS is synchronous but does not clear\n * input buffers and does not reset the parser, thus the terminal will\n * continue to apply pending input data.\n * If you need in band reset (synchronous with input data) consider\n * using DECSTR (soft reset, CSI ! p) or RIS instead (hard reset, ESC c).\n */\n public reset(): void {\n /**\n * Since _setup handles a full terminal creation, we have to carry forward\n * a few things that should not reset.\n */\n this.options.rows = this.rows;\n this.options.cols = this.cols;\n const customKeyEventHandler = this._customKeyEventHandler;\n\n this._setup();\n super.reset();\n this._selectionService?.reset();\n\n // reattach\n this._customKeyEventHandler = customKeyEventHandler;\n\n // do a full screen refresh\n this.refresh(0, this.rows - 1);\n this.viewport?.syncScrollArea();\n }\n\n private _reportWindowsOptions(type: WindowsOptionsReportType): void {\n if (!this._renderService) {\n return;\n }\n\n switch (type) {\n case WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:\n const canvasWidth = this._renderService.dimensions.scaledCanvasWidth.toFixed(0);\n const canvasHeight = this._renderService.dimensions.scaledCanvasHeight.toFixed(0);\n this._coreService.triggerDataEvent(`${C0.ESC}[4;${canvasHeight};${canvasWidth}t`);\n break;\n case WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:\n const cellWidth = this._renderService.dimensions.scaledCellWidth.toFixed(0);\n const cellHeight = this._renderService.dimensions.scaledCellHeight.toFixed(0);\n this._coreService.triggerDataEvent(`${C0.ESC}[6;${cellHeight};${cellWidth}t`);\n break;\n }\n }\n\n // TODO: Remove cancel function and cancelEvents option\n public cancel(ev: Event, force?: boolean): boolean | undefined {\n if (!this.options.cancelEvents && !force) {\n return;\n }\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n }\n\n private _visualBell(): boolean {\n return false;\n // return this.options.bellStyle === 'visual' ||\n // this.options.bellStyle === 'both';\n }\n\n private _soundBell(): boolean {\n return this.options.bellStyle === 'sound';\n // return this.options.bellStyle === 'sound' ||\n // this.options.bellStyle === 'both';\n }\n}\n\n/**\n * Helpers\n */\n\nfunction wasModifierKeyOnlyEvent(ev: KeyboardEvent): boolean {\n return ev.keyCode === 16 || // Shift\n ev.keyCode === 17 || // Ctrl\n ev.keyCode === 18; // Alt\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IColorSet, IViewport } from 'browser/Types';\nimport { ICharSizeService, IRenderService } from 'browser/services/Services';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\n\nconst FALLBACK_SCROLL_BAR_WIDTH = 15;\n\n/**\n * Represents the viewport of a terminal, the visible area within the larger buffer of output.\n * Logic for the virtual scroll bar is included in this object.\n */\nexport class Viewport extends Disposable implements IViewport {\n public scrollBarWidth: number = 0;\n private _currentRowHeight: number = 0;\n private _lastRecordedBufferLength: number = 0;\n private _lastRecordedViewportHeight: number = 0;\n private _lastRecordedBufferHeight: number = 0;\n private _lastTouchY: number = 0;\n private _lastScrollTop: number = 0;\n\n // Stores a partial line amount when scrolling, this is used to keep track of how much of a line\n // is scrolled so we can \"scroll\" over partial lines and feel natural on touchpads. This is a\n // quick fix and could have a more robust solution in place that reset the value when needed.\n private _wheelPartialScroll: number = 0;\n\n private _refreshAnimationFrame: number | null = null;\n private _ignoreNextScrollEvent: boolean = false;\n\n constructor(\n private readonly _scrollLines: (amount: number, suppressEvent: boolean) => void,\n private readonly _viewportElement: HTMLElement,\n private readonly _scrollArea: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n // Measure the width of the scrollbar. If it is 0 we can assume it's an OSX overlay scrollbar.\n // Unfortunately the overlay scrollbar would be hidden underneath the screen element in that case,\n // therefore we account for a standard amount to make it visible\n this.scrollBarWidth = (this._viewportElement.offsetWidth - this._scrollArea.offsetWidth) || FALLBACK_SCROLL_BAR_WIDTH;\n this.register(addDisposableDomListener(this._viewportElement, 'scroll', this._onScroll.bind(this)));\n\n // Perform this async to ensure the ICharSizeService is ready.\n setTimeout(() => this.syncScrollArea(), 0);\n }\n\n public onThemeChange(colors: IColorSet): void {\n this._viewportElement.style.backgroundColor = colors.background.css;\n }\n\n /**\n * Refreshes row height, setting line-height, viewport height and scroll area height if\n * necessary.\n */\n private _refresh(immediate: boolean): void {\n if (immediate) {\n this._innerRefresh();\n if (this._refreshAnimationFrame !== null) {\n cancelAnimationFrame(this._refreshAnimationFrame);\n }\n return;\n }\n if (this._refreshAnimationFrame === null) {\n this._refreshAnimationFrame = requestAnimationFrame(() => this._innerRefresh());\n }\n }\n\n private _innerRefresh(): void {\n if (this._charSizeService.height > 0) {\n this._currentRowHeight = this._renderService.dimensions.scaledCellHeight / window.devicePixelRatio;\n this._lastRecordedViewportHeight = this._viewportElement.offsetHeight;\n const newBufferHeight = Math.round(this._currentRowHeight * this._lastRecordedBufferLength) + (this._lastRecordedViewportHeight - this._renderService.dimensions.canvasHeight);\n if (this._lastRecordedBufferHeight !== newBufferHeight) {\n this._lastRecordedBufferHeight = newBufferHeight;\n this._scrollArea.style.height = this._lastRecordedBufferHeight + 'px';\n }\n }\n\n // Sync scrollTop\n const scrollTop = this._bufferService.buffer.ydisp * this._currentRowHeight;\n if (this._viewportElement.scrollTop !== scrollTop) {\n // Ignore the next scroll event which will be triggered by setting the scrollTop as we do not\n // want this event to scroll the terminal\n this._ignoreNextScrollEvent = true;\n this._viewportElement.scrollTop = scrollTop;\n }\n\n this._refreshAnimationFrame = null;\n }\n /**\n * Updates dimensions and synchronizes the scroll area if necessary.\n */\n public syncScrollArea(immediate: boolean = false): void {\n // If buffer height changed\n if (this._lastRecordedBufferLength !== this._bufferService.buffer.lines.length) {\n this._lastRecordedBufferLength = this._bufferService.buffer.lines.length;\n this._refresh(immediate);\n return;\n }\n\n // If viewport height changed\n if (this._lastRecordedViewportHeight !== this._renderService.dimensions.canvasHeight) {\n this._refresh(immediate);\n return;\n }\n\n // If the buffer position doesn't match last scroll top\n const newScrollTop = this._bufferService.buffer.ydisp * this._currentRowHeight;\n if (this._lastScrollTop !== newScrollTop) {\n this._refresh(immediate);\n return;\n }\n\n // If element's scroll top changed, this can happen when hiding the element\n if (this._lastScrollTop !== this._viewportElement.scrollTop) {\n this._refresh(immediate);\n return;\n }\n\n // If row height changed\n if (this._renderService.dimensions.scaledCellHeight / window.devicePixelRatio !== this._currentRowHeight) {\n this._refresh(immediate);\n return;\n }\n }\n\n /**\n * Handles scroll events on the viewport, calculating the new viewport and requesting the\n * terminal to scroll to it.\n * @param ev The scroll event.\n */\n private _onScroll(ev: Event): void {\n // Record current scroll top position\n this._lastScrollTop = this._viewportElement.scrollTop;\n\n // Don't attempt to scroll if the element is not visible, otherwise scrollTop will be corrupt\n // which causes the terminal to scroll the buffer to the top\n if (!this._viewportElement.offsetParent) {\n return;\n }\n\n // Ignore the event if it was flagged to ignore (when the source of the event is from Viewport)\n if (this._ignoreNextScrollEvent) {\n this._ignoreNextScrollEvent = false;\n return;\n }\n\n const newRow = Math.round(this._lastScrollTop / this._currentRowHeight);\n const diff = newRow - this._bufferService.buffer.ydisp;\n this._scrollLines(diff, true);\n }\n\n /**\n * Handles bubbling of scroll event in case the viewport has reached top or bottom\n * @param ev The scroll event.\n * @param amount The amount scrolled\n */\n private _bubbleScroll(ev: Event, amount: number): boolean {\n const scrollPosFromTop = this._viewportElement.scrollTop + this._lastRecordedViewportHeight;\n if ((amount < 0 && this._viewportElement.scrollTop !== 0) ||\n (amount > 0 && scrollPosFromTop < this._lastRecordedBufferHeight)) {\n if (ev.cancelable) {\n ev.preventDefault();\n }\n return false;\n }\n return true;\n }\n\n /**\n * Handles mouse wheel events by adjusting the viewport's scrollTop and delegating the actual\n * scrolling to `onScroll`, this event needs to be attached manually by the consumer of\n * `Viewport`.\n * @param ev The mouse wheel event.\n */\n public onWheel(ev: WheelEvent): boolean {\n const amount = this._getPixelsScrolled(ev);\n if (amount === 0) {\n return false;\n }\n this._viewportElement.scrollTop += amount;\n return this._bubbleScroll(ev, amount);\n }\n\n private _getPixelsScrolled(ev: WheelEvent): number {\n // Do nothing if it's not a vertical scroll event\n if (ev.deltaY === 0) {\n return 0;\n }\n\n // Fallback to WheelEvent.DOM_DELTA_PIXEL\n let amount = this._applyScrollModifier(ev.deltaY, ev);\n if (ev.deltaMode === WheelEvent.DOM_DELTA_LINE) {\n amount *= this._currentRowHeight;\n } else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n amount *= this._currentRowHeight * this._bufferService.rows;\n }\n return amount;\n }\n\n /**\n * Gets the number of pixels scrolled by the mouse event taking into account what type of delta\n * is being used.\n * @param ev The mouse wheel event.\n */\n public getLinesScrolled(ev: WheelEvent): number {\n // Do nothing if it's not a vertical scroll event\n if (ev.deltaY === 0) {\n return 0;\n }\n\n // Fallback to WheelEvent.DOM_DELTA_LINE\n let amount = this._applyScrollModifier(ev.deltaY, ev);\n if (ev.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n amount /= this._currentRowHeight + 0.0; // Prevent integer division\n this._wheelPartialScroll += amount;\n amount = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1);\n this._wheelPartialScroll %= 1;\n } else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n amount *= this._bufferService.rows;\n }\n return amount;\n }\n\n private _applyScrollModifier(amount: number, ev: WheelEvent): number {\n const modifier = this._optionsService.options.fastScrollModifier;\n // Multiply the scroll speed when the modifier is down\n if ((modifier === 'alt' && ev.altKey) ||\n (modifier === 'ctrl' && ev.ctrlKey) ||\n (modifier === 'shift' && ev.shiftKey)) {\n return amount * this._optionsService.options.fastScrollSensitivity * this._optionsService.options.scrollSensitivity;\n }\n\n return amount * this._optionsService.options.scrollSensitivity;\n }\n\n /**\n * Handles the touchstart event, recording the touch occurred.\n * @param ev The touch event.\n */\n public onTouchStart(ev: TouchEvent): void {\n this._lastTouchY = ev.touches[0].pageY;\n }\n\n /**\n * Handles the touchmove event, scrolling the viewport if the position shifted.\n * @param ev The touch event.\n */\n public onTouchMove(ev: TouchEvent): boolean {\n const deltaY = this._lastTouchY - ev.touches[0].pageY;\n this._lastTouchY = ev.touches[0].pageY;\n if (deltaY === 0) {\n return false;\n }\n this._viewportElement.scrollTop += deltaY;\n return this._bubbleScroll(ev, deltaY);\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharSizeService } from 'browser/services/Services';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\n\ninterface IPosition {\n start: number;\n end: number;\n}\n\n/**\n * Encapsulates the logic for handling compositionstart, compositionupdate and compositionend\n * events, displaying the in-progress composition to the UI and forwarding the final composition\n * to the handler.\n */\nexport class CompositionHelper {\n /**\n * Whether input composition is currently happening, eg. via a mobile keyboard, speech input or\n * IME. This variable determines whether the compositionText should be displayed on the UI.\n */\n private _isComposing: boolean;\n public get isComposing(): boolean { return this._isComposing; }\n\n /**\n * The position within the input textarea's value of the current composition.\n */\n private _compositionPosition: IPosition;\n\n /**\n * Whether a composition is in the process of being sent, setting this to false will cancel any\n * in-progress composition.\n */\n private _isSendingComposition: boolean;\n\n /**\n * Data already sent due to keydown event.\n */\n private _dataAlreadySent: string;\n\n constructor(\n private readonly _textarea: HTMLTextAreaElement,\n private readonly _compositionView: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @ICoreService private readonly _coreService: ICoreService\n ) {\n this._isComposing = false;\n this._isSendingComposition = false;\n this._compositionPosition = { start: 0, end: 0 };\n this._dataAlreadySent = '';\n }\n\n /**\n * Handles the compositionstart event, activating the composition view.\n */\n public compositionstart(): void {\n this._isComposing = true;\n this._compositionPosition.start = this._textarea.value.length;\n this._compositionView.textContent = '';\n this._dataAlreadySent = '';\n this._compositionView.classList.add('active');\n }\n\n /**\n * Handles the compositionupdate event, updating the composition view.\n * @param ev The event.\n */\n public compositionupdate(ev: CompositionEvent): void {\n this._compositionView.textContent = ev.data;\n this.updateCompositionElements();\n setTimeout(() => {\n this._compositionPosition.end = this._textarea.value.length;\n }, 0);\n }\n\n /**\n * Handles the compositionend event, hiding the composition view and sending the composition to\n * the handler.\n */\n public compositionend(): void {\n this._finalizeComposition(true);\n }\n\n /**\n * Handles the keydown event, routing any necessary events to the CompositionHelper functions.\n * @param ev The keydown event.\n * @return Whether the Terminal should continue processing the keydown event.\n */\n public keydown(ev: KeyboardEvent): boolean {\n if (this._isComposing || this._isSendingComposition) {\n if (ev.keyCode === 229) {\n // Continue composing if the keyCode is the \"composition character\"\n return false;\n }\n if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {\n // Continue composing if the keyCode is a modifier key\n return false;\n }\n // Finish composition immediately. This is mainly here for the case where enter is\n // pressed and the handler needs to be triggered before the command is executed.\n this._finalizeComposition(false);\n }\n\n if (ev.keyCode === 229) {\n // If the \"composition character\" is used but gets to this point it means a non-composition\n // character (eg. numbers and punctuation) was pressed when the IME was active.\n this._handleAnyTextareaChanges();\n return false;\n }\n\n return true;\n }\n\n /**\n * Finalizes the composition, resuming regular input actions. This is called when a composition\n * is ending.\n * @param waitForPropagation Whether to wait for events to propagate before sending\n * the input. This should be false if a non-composition keystroke is entered before the\n * compositionend event is triggered, such as enter, so that the composition is sent before\n * the command is executed.\n */\n private _finalizeComposition(waitForPropagation: boolean): void {\n this._compositionView.classList.remove('active');\n this._isComposing = false;\n\n if (!waitForPropagation) {\n // Cancel any delayed composition send requests and send the input immediately.\n this._isSendingComposition = false;\n const input = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);\n this._coreService.triggerDataEvent(input, true);\n } else {\n // Make a deep copy of the composition position here as a new compositionstart event may\n // fire before the setTimeout executes.\n const currentCompositionPosition = {\n start: this._compositionPosition.start,\n end: this._compositionPosition.end\n };\n\n // Since composition* events happen before the changes take place in the textarea on most\n // browsers, use a setTimeout with 0ms time to allow the native compositionend event to\n // complete. This ensures the correct character is retrieved.\n // This solution was used because:\n // - The compositionend event's data property is unreliable, at least on Chromium\n // - The last compositionupdate event's data property does not always accurately describe\n // the character, a counter example being Korean where an ending consonsant can move to\n // the following character if the following input is a vowel.\n this._isSendingComposition = true;\n setTimeout(() => {\n // Ensure that the input has not already been sent\n if (this._isSendingComposition) {\n this._isSendingComposition = false;\n let input;\n // Add length of data already sent due to keydown event,\n // otherwise input characters can be duplicated. (Issue #3191)\n currentCompositionPosition.start += this._dataAlreadySent.length;\n if (this._isComposing) {\n // Use the end position to get the string if a new composition has started.\n input = this._textarea.value.substring(currentCompositionPosition.start, currentCompositionPosition.end);\n } else {\n // Don't use the end position here in order to pick up any characters after the\n // composition has finished, for example when typing a non-composition character\n // (eg. 2) after a composition character.\n input = this._textarea.value.substring(currentCompositionPosition.start);\n }\n if (input.length > 0) {\n this._coreService.triggerDataEvent(input, true);\n }\n }\n }, 0);\n }\n }\n\n /**\n * Apply any changes made to the textarea after the current event chain is allowed to complete.\n * This should be called when not currently composing but a keydown event with the \"composition\n * character\" (229) is triggered, in order to allow non-composition text to be entered when an\n * IME is active.\n */\n private _handleAnyTextareaChanges(): void {\n const oldValue = this._textarea.value;\n setTimeout(() => {\n // Ignore if a composition has started since the timeout\n if (!this._isComposing) {\n const newValue = this._textarea.value;\n const diff = newValue.replace(oldValue, '');\n if (diff.length > 0) {\n this._dataAlreadySent = diff;\n this._coreService.triggerDataEvent(diff, true);\n }\n }\n }, 0);\n }\n\n /**\n * Positions the composition view on top of the cursor and the textarea just below it (so the\n * IME helper dialog is positioned correctly).\n * @param dontRecurse Whether to use setTimeout to recursively trigger another update, this is\n * necessary as the IME events across browsers are not consistently triggered.\n */\n public updateCompositionElements(dontRecurse?: boolean): void {\n if (!this._isComposing) {\n return;\n }\n\n if (this._bufferService.buffer.isCursorInViewport) {\n const cellHeight = Math.ceil(this._charSizeService.height * this._optionsService.options.lineHeight);\n const cursorTop = this._bufferService.buffer.y * cellHeight;\n const cursorLeft = this._bufferService.buffer.x * this._charSizeService.width;\n\n this._compositionView.style.left = cursorLeft + 'px';\n this._compositionView.style.top = cursorTop + 'px';\n this._compositionView.style.height = cellHeight + 'px';\n this._compositionView.style.lineHeight = cellHeight + 'px';\n this._compositionView.style.fontFamily = this._optionsService.options.fontFamily;\n this._compositionView.style.fontSize = this._optionsService.options.fontSize + 'px';\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n const compositionViewBounds = this._compositionView.getBoundingClientRect();\n this._textarea.style.left = cursorLeft + 'px';\n this._textarea.style.top = cursorTop + 'px';\n this._textarea.style.width = compositionViewBounds.width + 'px';\n this._textarea.style.height = compositionViewBounds.height + 'px';\n this._textarea.style.lineHeight = compositionViewBounds.height + 'px';\n }\n\n if (!dontRecurse) {\n setTimeout(() => this.updateCompositionElements(true), 0);\n }\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function getCoordsRelativeToElement(event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {\n const rect = element.getBoundingClientRect();\n return [event.clientX - rect.left, event.clientY - rect.top];\n}\n\n/**\n * Gets coordinates within the terminal for a particular mouse event. The result\n * is returned as an array in the form [x, y] instead of an object as it's a\n * little faster and this function is used in some low level code.\n * @param event The mouse event.\n * @param element The terminal's container element.\n * @param colCount The number of columns in the terminal.\n * @param rowCount The number of rows n the terminal.\n * @param isSelection Whether the request is for the selection or not. This will\n * apply an offset to the x value such that the left half of the cell will\n * select that cell and the right half will select the next cell.\n */\nexport function getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, hasValidCharSize: boolean, actualCellWidth: number, actualCellHeight: number, isSelection?: boolean): [number, number] | undefined {\n // Coordinates cannot be measured if there are no valid\n if (!hasValidCharSize) {\n return undefined;\n }\n\n const coords = getCoordsRelativeToElement(event, element);\n if (!coords) {\n return undefined;\n }\n\n coords[0] = Math.ceil((coords[0] + (isSelection ? actualCellWidth / 2 : 0)) / actualCellWidth);\n coords[1] = Math.ceil(coords[1] / actualCellHeight);\n\n // Ensure coordinates are within the terminal viewport. Note that selections\n // need an addition point of precision to cover the end point (as characters\n // cover half of one char and half of the next).\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0));\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount);\n\n return coords;\n}\n\n/**\n * Gets coordinates within the terminal for a particular mouse event, wrapping\n * them to the bounds of the terminal and adding 32 to both the x and y values\n * as expected by xterm.\n */\nexport function getRawByteCoords(coords: [number, number] | undefined): { x: number, y: number } | undefined {\n if (!coords) {\n return undefined;\n }\n\n // xterm sends raw bytes and starts at 32 (SP) for each.\n return { x: coords[0] + 32, y: coords[1] + 32 };\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { C0 } from 'common/data/EscapeSequences';\nimport { IBufferService } from 'common/services/Services';\n\nconst enum Direction {\n UP = 'A',\n DOWN = 'B',\n RIGHT = 'C',\n LEFT = 'D'\n}\n\n/**\n * Concatenates all the arrow sequences together.\n * Resets the starting row to an unwrapped row, moves to the requested row,\n * then moves to requested col.\n */\nexport function moveToCellSequence(targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startX = bufferService.buffer.x;\n const startY = bufferService.buffer.y;\n\n // The alt buffer should try to navigate between rows\n if (!bufferService.buffer.hasScrollback) {\n return resetStartingRow(startX, startY, targetX, targetY, bufferService, applicationCursor) +\n moveToRequestedRow(startY, targetY, bufferService, applicationCursor) +\n moveToRequestedCol(startX, startY, targetX, targetY, bufferService, applicationCursor);\n }\n\n // Only move horizontally for the normal buffer\n let direction;\n if (startY === targetY) {\n direction = startX > targetX ? Direction.LEFT : Direction.RIGHT;\n return repeat(Math.abs(startX - targetX), sequence(direction, applicationCursor));\n }\n direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;\n const rowDifference = Math.abs(startY - targetY);\n const cellsToMove = colsFromRowEnd(startY > targetY ? targetX : startX, bufferService) +\n (rowDifference - 1) * bufferService.cols + 1 /* wrap around 1 row */ +\n colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService);\n return repeat(cellsToMove, sequence(direction, applicationCursor));\n}\n\n/**\n * Find the number of cols from a row beginning to a col.\n */\nfunction colsFromRowBeginning(currX: number, bufferService: IBufferService): number {\n return currX - 1;\n}\n\n/**\n * Find the number of cols from a col to row end.\n */\nfunction colsFromRowEnd(currX: number, bufferService: IBufferService): number {\n return bufferService.cols - currX;\n}\n\n/**\n * If the initial position of the cursor is on a row that is wrapped, move the\n * cursor up to the first row that is not wrapped to have accurate vertical\n * positioning.\n */\nfunction resetStartingRow(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length === 0) {\n return '';\n }\n return repeat(bufferLine(\n startX, startY, startX,\n startY - wrappedRowsForRow(bufferService, startY), false, bufferService\n ).length, sequence(Direction.LEFT, applicationCursor));\n}\n\n/**\n * Using the reset starting and ending row, move to the requested row,\n * ignoring wrapped rows\n */\nfunction moveToRequestedRow(startY: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startRow = startY - wrappedRowsForRow(bufferService, startY);\n const endRow = targetY - wrappedRowsForRow(bufferService, targetY);\n\n const rowsToMove = Math.abs(startRow - endRow) - wrappedRowsCount(startY, targetY, bufferService);\n\n return repeat(rowsToMove, sequence(verticalDirection(startY, targetY), applicationCursor));\n}\n\n/**\n * Move to the requested col on the ending row\n */\nfunction moveToRequestedCol(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n let startRow;\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(bufferService, targetY);\n } else {\n startRow = startY;\n }\n\n const endRow = targetY;\n const direction = horizontalDirection(startX, startY, targetX, targetY, bufferService, applicationCursor);\n\n return repeat(bufferLine(\n startX, startRow, targetX, endRow,\n direction === Direction.RIGHT, bufferService\n ).length, sequence(direction, applicationCursor));\n}\n\n/**\n * Utility functions\n */\n\n/**\n * Calculates the number of wrapped rows between the unwrapped starting and\n * ending rows. These rows need to ignored since the cursor skips over them.\n */\nfunction wrappedRowsCount(startY: number, targetY: number, bufferService: IBufferService): number {\n let wrappedRows = 0;\n const startRow = startY - wrappedRowsForRow(bufferService, startY);\n const endRow = targetY - wrappedRowsForRow(bufferService, targetY);\n\n for (let i = 0; i < Math.abs(startRow - endRow); i++) {\n const direction = verticalDirection(startY, targetY) === Direction.UP ? -1 : 1;\n const line = bufferService.buffer.lines.get(startRow + (direction * i));\n if (line && line.isWrapped) {\n wrappedRows++;\n }\n }\n\n return wrappedRows;\n}\n\n/**\n * Calculates the number of wrapped rows that make up a given row.\n * @param currentRow The row to determine how many wrapped rows make it up\n */\nfunction wrappedRowsForRow(bufferService: IBufferService, currentRow: number): number {\n let rowCount = 0;\n let line = bufferService.buffer.lines.get(currentRow);\n let lineWraps = line && line.isWrapped;\n\n while (lineWraps && currentRow >= 0 && currentRow < bufferService.rows) {\n rowCount++;\n line = bufferService.buffer.lines.get(--currentRow);\n lineWraps = line && line.isWrapped;\n }\n\n return rowCount;\n}\n\n/**\n * Direction determiners\n */\n\n/**\n * Determines if the right or left arrow is needed\n */\nfunction horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {\n let startRow;\n if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(bufferService, targetY);\n } else {\n startRow = startY;\n }\n\n if ((startX < targetX &&\n startRow <= targetY) || // down/right or same y/right\n (startX >= targetX &&\n startRow < targetY)) { // down/left or same y/left\n return Direction.RIGHT;\n }\n return Direction.LEFT;\n}\n\n/**\n * Determines if the up or down arrow is needed\n */\nfunction verticalDirection(startY: number, targetY: number): Direction {\n return startY > targetY ? Direction.UP : Direction.DOWN;\n}\n\n/**\n * Constructs the string of chars in the buffer from a starting row and col\n * to an ending row and col\n * @param startCol The starting column position\n * @param startRow The starting row position\n * @param endCol The ending column position\n * @param endRow The ending row position\n * @param forward Direction to move\n */\nfunction bufferLine(\n startCol: number,\n startRow: number,\n endCol: number,\n endRow: number,\n forward: boolean,\n bufferService: IBufferService\n): string {\n let currentCol = startCol;\n let currentRow = startRow;\n let bufferStr = '';\n\n while (currentCol !== endCol || currentRow !== endRow) {\n currentCol += forward ? 1 : -1;\n\n if (forward && currentCol > bufferService.cols - 1) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n currentCol = 0;\n startCol = 0;\n currentRow++;\n } else if (!forward && currentCol < 0) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, 0, startCol + 1\n );\n currentCol = bufferService.cols - 1;\n startCol = currentCol;\n currentRow--;\n }\n }\n\n return bufferStr + bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n}\n\n/**\n * Constructs the escape sequence for clicking an arrow\n * @param direction The direction to move\n */\nfunction sequence(direction: Direction, applicationCursor: boolean): string {\n const mod = applicationCursor ? 'O' : '[';\n return C0.ESC + mod + direction;\n}\n\n/**\n * Returns a string repeated a given number of times\n * Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n * @param count The number of times to repeat the string\n * @param string The string that is to be repeated\n */\nfunction repeat(count: number, str: string): string {\n count = Math.floor(count);\n let rpt = '';\n for (let i = 0; i < count; i++) {\n rpt += str;\n }\n return rpt;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminalAddon, IDisposable, Terminal } from 'xterm';\n\nexport interface ILoadedAddon {\n instance: ITerminalAddon;\n dispose: () => void;\n isDisposed: boolean;\n}\n\nexport class AddonManager implements IDisposable {\n protected _addons: ILoadedAddon[] = [];\n\n constructor() {\n }\n\n public dispose(): void {\n for (let i = this._addons.length - 1; i >= 0; i--) {\n this._addons[i].instance.dispose();\n }\n }\n\n public loadAddon(terminal: Terminal, instance: ITerminalAddon): void {\n const loadedAddon: ILoadedAddon = {\n instance,\n dispose: instance.dispose,\n isDisposed: false\n };\n this._addons.push(loadedAddon);\n instance.dispose = () => this._wrappedAddonDispose(loadedAddon);\n instance.activate(terminal);\n }\n\n private _wrappedAddonDispose(loadedAddon: ILoadedAddon): void {\n if (loadedAddon.isDisposed) {\n // Do nothing if already disposed\n return;\n }\n let index = -1;\n for (let i = 0; i < this._addons.length; i++) {\n if (this._addons[i] === loadedAddon) {\n index = i;\n break;\n }\n }\n if (index === -1) {\n throw new Error('Could not dispose an addon that has not been loaded');\n }\n loadedAddon.isDisposed = true;\n loadedAddon.dispose.apply(loadedAddon.instance);\n this._addons.splice(index, 1);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Terminal as ITerminalApi, ITerminalOptions, IMarker, IDisposable, ILinkMatcherOptions, ITheme, ILocalizableStrings, ITerminalAddon, ISelectionPosition, IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi, IParser, IFunctionIdentifier, ILinkProvider, IUnicodeHandling, IUnicodeVersionProvider, FontWeight } from 'xterm';\nimport { ITerminal } from 'browser/Types';\nimport { IBufferLine, ICellData } from 'common/Types';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { CellData } from 'common/buffer/CellData';\nimport { Terminal as TerminalCore } from '../Terminal';\nimport * as Strings from '../LocalizableStrings';\nimport { IEvent, EventEmitter } from 'common/EventEmitter';\nimport { AddonManager } from './AddonManager';\nimport { IParams } from 'common/parser/Types';\nimport { BufferSet } from 'common/buffer/BufferSet';\n\nexport class Terminal implements ITerminalApi {\n private _core: ITerminal;\n private _addonManager: AddonManager;\n private _parser: IParser | undefined;\n private _buffer: BufferNamespaceApi | undefined;\n\n constructor(options?: ITerminalOptions) {\n this._core = new TerminalCore(options);\n this._addonManager = new AddonManager();\n }\n\n private _checkProposedApi(): void {\n if (!this._core.optionsService.options.allowProposedApi) {\n throw new Error('You must set the allowProposedApi option to true to use proposed API');\n }\n }\n\n public get onCursorMove(): IEvent { return this._core.onCursorMove; }\n public get onLineFeed(): IEvent { return this._core.onLineFeed; }\n public get onSelectionChange(): IEvent { return this._core.onSelectionChange; }\n public get onData(): IEvent { return this._core.onData; }\n public get onBinary(): IEvent { return this._core.onBinary; }\n public get onTitleChange(): IEvent { return this._core.onTitleChange; }\n public get onScroll(): IEvent { return this._core.onScroll; }\n public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }\n public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }\n public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }\n\n public get element(): HTMLElement | undefined { return this._core.element; }\n public get parser(): IParser {\n this._checkProposedApi();\n if (!this._parser) {\n this._parser = new ParserApi(this._core);\n }\n return this._parser;\n }\n public get unicode(): IUnicodeHandling {\n this._checkProposedApi();\n return new UnicodeApi(this._core);\n }\n public get textarea(): HTMLTextAreaElement | undefined { return this._core.textarea; }\n public get rows(): number { return this._core.rows; }\n public get cols(): number { return this._core.cols; }\n public get buffer(): IBufferNamespaceApi {\n this._checkProposedApi();\n if (!this._buffer) {\n this._buffer = new BufferNamespaceApi(this._core);\n }\n return this._buffer;\n }\n public get markers(): ReadonlyArray {\n this._checkProposedApi();\n return this._core.markers;\n }\n public blur(): void {\n this._core.blur();\n }\n public focus(): void {\n this._core.focus();\n }\n public resize(columns: number, rows: number): void {\n this._verifyIntegers(columns, rows);\n this._core.resize(columns, rows);\n }\n public open(parent: HTMLElement): void {\n this._core.open(parent);\n }\n public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {\n this._core.attachCustomKeyEventHandler(customKeyEventHandler);\n }\n public registerLinkMatcher(regex: RegExp, handler: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions): number {\n this._checkProposedApi();\n return this._core.registerLinkMatcher(regex, handler, options);\n }\n public deregisterLinkMatcher(matcherId: number): void {\n this._checkProposedApi();\n this._core.deregisterLinkMatcher(matcherId);\n }\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n this._checkProposedApi();\n return this._core.registerLinkProvider(linkProvider);\n }\n public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {\n this._checkProposedApi();\n return this._core.registerCharacterJoiner(handler);\n }\n public deregisterCharacterJoiner(joinerId: number): void {\n this._checkProposedApi();\n this._core.deregisterCharacterJoiner(joinerId);\n }\n public registerMarker(cursorYOffset: number): IMarker | undefined {\n this._checkProposedApi();\n this._verifyIntegers(cursorYOffset);\n return this._core.addMarker(cursorYOffset);\n }\n public addMarker(cursorYOffset: number): IMarker | undefined {\n return this.registerMarker(cursorYOffset);\n }\n public hasSelection(): boolean {\n return this._core.hasSelection();\n }\n public select(column: number, row: number, length: number): void {\n this._verifyIntegers(column, row, length);\n this._core.select(column, row, length);\n }\n public getSelection(): string {\n return this._core.getSelection();\n }\n public getSelectionPosition(): ISelectionPosition | undefined {\n return this._core.getSelectionPosition();\n }\n public clearSelection(): void {\n this._core.clearSelection();\n }\n public selectAll(): void {\n this._core.selectAll();\n }\n public selectLines(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.selectLines(start, end);\n }\n public dispose(): void {\n this._addonManager.dispose();\n this._core.dispose();\n }\n public scrollLines(amount: number): void {\n this._verifyIntegers(amount);\n this._core.scrollLines(amount);\n }\n public scrollPages(pageCount: number): void {\n this._verifyIntegers(pageCount);\n this._core.scrollPages(pageCount);\n }\n public scrollToTop(): void {\n this._core.scrollToTop();\n }\n public scrollToBottom(): void {\n this._core.scrollToBottom();\n }\n public scrollToLine(line: number): void {\n this._verifyIntegers(line);\n this._core.scrollToLine(line);\n }\n public clear(): void {\n this._core.clear();\n }\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data, callback);\n }\n public writeUtf8(data: Uint8Array, callback?: () => void): void {\n this._core.write(data, callback);\n }\n public writeln(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data);\n this._core.write('\\r\\n', callback);\n }\n public paste(data: string): void {\n this._core.paste(data);\n }\n public getOption(key: 'bellSound' | 'bellStyle' | 'cursorStyle' | 'fontFamily' | 'logLevel' | 'rendererType' | 'termName' | 'wordSeparator'): string;\n public getOption(key: 'allowTransparency' | 'altClickMovesCursor' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'disableStdin' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'visualBell'): boolean;\n public getOption(key: 'cols' | 'fontSize' | 'letterSpacing' | 'lineHeight' | 'rows' | 'tabStopWidth' | 'scrollback'): number;\n public getOption(key: 'fontWeight' | 'fontWeightBold'): FontWeight;\n public getOption(key: string): any;\n public getOption(key: any): any {\n return this._core.optionsService.getOption(key);\n }\n public setOption(key: 'bellSound' | 'fontFamily' | 'termName' | 'wordSeparator', value: string): void;\n public setOption(key: 'fontWeight' | 'fontWeightBold', value: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number): void;\n public setOption(key: 'logLevel', value: 'debug' | 'info' | 'warn' | 'error' | 'off'): void;\n public setOption(key: 'bellStyle', value: 'none' | 'visual' | 'sound' | 'both'): void;\n public setOption(key: 'cursorStyle', value: 'block' | 'underline' | 'bar'): void;\n public setOption(key: 'allowTransparency' | 'altClickMovesCursor' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'disableStdin' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'visualBell', value: boolean): void;\n public setOption(key: 'fontSize' | 'letterSpacing' | 'lineHeight' | 'tabStopWidth' | 'scrollback', value: number): void;\n public setOption(key: 'theme', value: ITheme): void;\n public setOption(key: 'cols' | 'rows', value: number): void;\n public setOption(key: string, value: any): void;\n public setOption(key: any, value: any): void {\n this._core.optionsService.setOption(key, value);\n }\n public refresh(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.refresh(start, end);\n }\n public reset(): void {\n this._core.reset();\n }\n public loadAddon(addon: ITerminalAddon): void {\n return this._addonManager.loadAddon(this, addon);\n }\n public static get strings(): ILocalizableStrings {\n return Strings;\n }\n\n private _verifyIntegers(...values: number[]): void {\n for (const value of values) {\n if (value === Infinity || isNaN(value) || value % 1 !== 0) {\n throw new Error('This API only accepts integers');\n }\n }\n }\n}\n\nclass BufferApiView implements IBufferApi {\n constructor(\n private _buffer: IBuffer,\n public readonly type: 'normal' | 'alternate'\n ) { }\n\n public init(buffer: IBuffer): BufferApiView {\n this._buffer = buffer;\n return this;\n }\n\n public get cursorY(): number { return this._buffer.y; }\n public get cursorX(): number { return this._buffer.x; }\n public get viewportY(): number { return this._buffer.ydisp; }\n public get baseY(): number { return this._buffer.ybase; }\n public get length(): number { return this._buffer.lines.length; }\n public getLine(y: number): IBufferLineApi | undefined {\n const line = this._buffer.lines.get(y);\n if (!line) {\n return undefined;\n }\n return new BufferLineApiView(line);\n }\n public getNullCell(): IBufferCellApi { return new CellData(); }\n}\n\nclass BufferNamespaceApi implements IBufferNamespaceApi {\n private _normal: BufferApiView;\n private _alternate: BufferApiView;\n private _onBufferChange = new EventEmitter();\n public get onBufferChange(): IEvent { return this._onBufferChange.event; }\n\n constructor(private _core: ITerminal) {\n this._normal = new BufferApiView(this._core.buffers.normal, 'normal');\n this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');\n this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));\n }\n public get active(): IBufferApi {\n if (this._core.buffers.active === this._core.buffers.normal) { return this.normal; }\n if (this._core.buffers.active === this._core.buffers.alt) { return this.alternate; }\n throw new Error('Active buffer is neither normal nor alternate');\n }\n public get normal(): IBufferApi {\n return this._normal.init(this._core.buffers.normal);\n }\n public get alternate(): IBufferApi {\n return this._alternate.init(this._core.buffers.alt);\n }\n}\n\nclass BufferLineApiView implements IBufferLineApi {\n constructor(private _line: IBufferLine) { }\n\n public get isWrapped(): boolean { return this._line.isWrapped; }\n public get length(): number { return this._line.length; }\n public getCell(x: number, cell?: IBufferCellApi): IBufferCellApi | undefined {\n if (x < 0 || x >= this._line.length) {\n return undefined;\n }\n\n if (cell) {\n this._line.loadCell(x, cell);\n return cell;\n }\n return this._line.loadCell(x, new CellData());\n }\n public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {\n return this._line.translateToString(trimRight, startColumn, endColumn);\n }\n}\n\nclass ParserApi implements IParser {\n constructor(private _core: ITerminal) { }\n\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean): IDisposable {\n return this._core.addCsiHandler(id, (params: IParams) => callback(params.toArray()));\n }\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean): IDisposable {\n return this.registerCsiHandler(id, callback);\n }\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean): IDisposable {\n return this._core.addDcsHandler(id, (data: string, params: IParams) => callback(data, params.toArray()));\n }\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean): IDisposable {\n return this.registerDcsHandler(id, callback);\n }\n public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean): IDisposable {\n return this._core.addEscHandler(id, handler);\n }\n public addEscHandler(id: IFunctionIdentifier, handler: () => boolean): IDisposable {\n return this.registerEscHandler(id, handler);\n }\n public registerOscHandler(ident: number, callback: (data: string) => boolean): IDisposable {\n return this._core.addOscHandler(ident, callback);\n }\n public addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable {\n return this.registerOscHandler(ident, callback);\n }\n}\n\nclass UnicodeApi implements IUnicodeHandling {\n constructor(private _core: ITerminal) { }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._core.unicodeService.register(provider);\n }\n\n public get versions(): string[] {\n return this._core.unicodeService.versions;\n }\n\n public get activeVersion(): string {\n return this._core.unicodeService.activeVersion;\n }\n\n public set activeVersion(version: string) {\n this._core.unicodeService.activeVersion = version;\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDimensions, IRenderLayer } from 'browser/renderer/Types';\nimport { ICellData } from 'common/Types';\nimport { DEFAULT_COLOR, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, Attributes } from 'common/buffer/Constants';\nimport { IGlyphIdentifier } from 'browser/renderer/atlas/Types';\nimport { DIM_OPACITY, INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';\nimport { BaseCharAtlas } from 'browser/renderer/atlas/BaseCharAtlas';\nimport { acquireCharAtlas } from 'browser/renderer/atlas/CharAtlasCache';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { IColorSet, IColor } from 'browser/Types';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { throwIfFalsy } from 'browser/renderer/RendererUtils';\nimport { channels, color, rgba } from 'browser/Color';\nimport { removeElementFromParent } from 'browser/Dom';\n\nexport abstract class BaseRenderLayer implements IRenderLayer {\n private _canvas: HTMLCanvasElement;\n protected _ctx!: CanvasRenderingContext2D;\n private _scaledCharWidth: number = 0;\n private _scaledCharHeight: number = 0;\n private _scaledCellWidth: number = 0;\n private _scaledCellHeight: number = 0;\n private _scaledCharLeft: number = 0;\n private _scaledCharTop: number = 0;\n\n protected _charAtlas: BaseCharAtlas | undefined;\n\n /**\n * An object that's reused when drawing glyphs in order to reduce GC.\n */\n private _currentGlyphIdentifier: IGlyphIdentifier = {\n chars: '',\n code: 0,\n bg: 0,\n fg: 0,\n bold: false,\n dim: false,\n italic: false\n };\n\n constructor(\n private _container: HTMLElement,\n id: string,\n zIndex: number,\n private _alpha: boolean,\n protected _colors: IColorSet,\n private _rendererId: number,\n protected readonly _bufferService: IBufferService,\n protected readonly _optionsService: IOptionsService\n ) {\n this._canvas = document.createElement('canvas');\n this._canvas.classList.add(`xterm-${id}-layer`);\n this._canvas.style.zIndex = zIndex.toString();\n this._initCanvas();\n this._container.appendChild(this._canvas);\n }\n\n public dispose(): void {\n removeElementFromParent(this._canvas);\n this._charAtlas?.dispose();\n }\n\n private _initCanvas(): void {\n this._ctx = throwIfFalsy(this._canvas.getContext('2d', {alpha: this._alpha}));\n // Draw the background if this is an opaque layer\n if (!this._alpha) {\n this._clearAll();\n }\n }\n\n public onOptionsChanged(): void {}\n public onBlur(): void {}\n public onFocus(): void {}\n public onCursorMove(): void {}\n public onGridChanged(startRow: number, endRow: number): void {}\n public onSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean = false): void {}\n\n public setColors(colorSet: IColorSet): void {\n this._refreshCharAtlas(colorSet);\n }\n\n protected _setTransparency(alpha: boolean): void {\n // Do nothing when alpha doesn't change\n if (alpha === this._alpha) {\n return;\n }\n\n // Create new canvas and replace old one\n const oldCanvas = this._canvas;\n this._alpha = alpha;\n // Cloning preserves properties\n this._canvas = this._canvas.cloneNode() as HTMLCanvasElement;\n this._initCanvas();\n this._container.replaceChild(this._canvas, oldCanvas);\n\n // Regenerate char atlas and force a full redraw\n this._refreshCharAtlas(this._colors);\n this.onGridChanged(0, this._bufferService.rows - 1);\n }\n\n /**\n * Refreshes the char atlas, aquiring a new one if necessary.\n * @param colorSet The color set to use for the char atlas.\n */\n private _refreshCharAtlas(colorSet: IColorSet): void {\n if (this._scaledCharWidth <= 0 && this._scaledCharHeight <= 0) {\n return;\n }\n this._charAtlas = acquireCharAtlas(this._optionsService.options, this._rendererId, colorSet, this._scaledCharWidth, this._scaledCharHeight);\n this._charAtlas.warmUp();\n }\n\n public resize(dim: IRenderDimensions): void {\n this._scaledCellWidth = dim.scaledCellWidth;\n this._scaledCellHeight = dim.scaledCellHeight;\n this._scaledCharWidth = dim.scaledCharWidth;\n this._scaledCharHeight = dim.scaledCharHeight;\n this._scaledCharLeft = dim.scaledCharLeft;\n this._scaledCharTop = dim.scaledCharTop;\n this._canvas.width = dim.scaledCanvasWidth;\n this._canvas.height = dim.scaledCanvasHeight;\n this._canvas.style.width = `${dim.canvasWidth}px`;\n this._canvas.style.height = `${dim.canvasHeight}px`;\n\n // Draw the background if this is an opaque layer\n if (!this._alpha) {\n this._clearAll();\n }\n\n this._refreshCharAtlas(this._colors);\n }\n\n public abstract reset(): void;\n\n /**\n * Fills 1+ cells completely. This uses the existing fillStyle on the context.\n * @param x The column to start at.\n * @param y The row to start at\n * @param width The number of columns to fill.\n * @param height The number of rows to fill.\n */\n protected _fillCells(x: number, y: number, width: number, height: number): void {\n this._ctx.fillRect(\n x * this._scaledCellWidth,\n y * this._scaledCellHeight,\n width * this._scaledCellWidth,\n height * this._scaledCellHeight);\n }\n\n /**\n * Fills a 1px line (2px on HDPI) at the bottom of the cell. This uses the\n * existing fillStyle on the context.\n * @param x The column to fill.\n * @param y The row to fill.\n */\n protected _fillBottomLineAtCells(x: number, y: number, width: number = 1): void {\n this._ctx.fillRect(\n x * this._scaledCellWidth,\n (y + 1) * this._scaledCellHeight - window.devicePixelRatio - 1 /* Ensure it's drawn within the cell */,\n width * this._scaledCellWidth,\n window.devicePixelRatio);\n }\n\n /**\n * Fills a 1px line (2px on HDPI) at the left of the cell. This uses the\n * existing fillStyle on the context.\n * @param x The column to fill.\n * @param y The row to fill.\n */\n protected _fillLeftLineAtCell(x: number, y: number, width: number): void {\n this._ctx.fillRect(\n x * this._scaledCellWidth,\n y * this._scaledCellHeight,\n window.devicePixelRatio * width,\n this._scaledCellHeight);\n }\n\n /**\n * Strokes a 1px rectangle (2px on HDPI) around a cell. This uses the existing\n * strokeStyle on the context.\n * @param x The column to fill.\n * @param y The row to fill.\n */\n protected _strokeRectAtCell(x: number, y: number, width: number, height: number): void {\n this._ctx.lineWidth = window.devicePixelRatio;\n this._ctx.strokeRect(\n x * this._scaledCellWidth + window.devicePixelRatio / 2,\n y * this._scaledCellHeight + (window.devicePixelRatio / 2),\n width * this._scaledCellWidth - window.devicePixelRatio,\n (height * this._scaledCellHeight) - window.devicePixelRatio);\n }\n\n /**\n * Clears the entire canvas.\n */\n protected _clearAll(): void {\n if (this._alpha) {\n this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\n } else {\n this._ctx.fillStyle = this._colors.background.css;\n this._ctx.fillRect(0, 0, this._canvas.width, this._canvas.height);\n }\n }\n\n /**\n * Clears 1+ cells completely.\n * @param x The column to start at.\n * @param y The row to start at.\n * @param width The number of columns to clear.\n * @param height The number of rows to clear.\n */\n protected _clearCells(x: number, y: number, width: number, height: number): void {\n if (this._alpha) {\n this._ctx.clearRect(\n x * this._scaledCellWidth,\n y * this._scaledCellHeight,\n width * this._scaledCellWidth,\n height * this._scaledCellHeight);\n } else {\n this._ctx.fillStyle = this._colors.background.css;\n this._ctx.fillRect(\n x * this._scaledCellWidth,\n y * this._scaledCellHeight,\n width * this._scaledCellWidth,\n height * this._scaledCellHeight);\n }\n }\n\n /**\n * Draws a truecolor character at the cell. The character will be clipped to\n * ensure that it fits with the cell, including the cell to the right if it's\n * a wide character. This uses the existing fillStyle on the context.\n * @param cell The cell data for the character to draw.\n * @param x The column to draw at.\n * @param y The row to draw at.\n * @param color The color of the character.\n */\n protected _fillCharTrueColor(cell: CellData, x: number, y: number): void {\n this._ctx.font = this._getFont(false, false);\n this._ctx.textBaseline = 'middle';\n this._clipRow(y);\n this._ctx.fillText(\n cell.getChars(),\n x * this._scaledCellWidth + this._scaledCharLeft,\n y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);\n }\n\n /**\n * Draws one or more characters at a cell. If possible this will draw using\n * the character atlas to reduce draw time.\n * @param chars The character or characters.\n * @param code The character code.\n * @param width The width of the characters.\n * @param x The column to draw at.\n * @param y The row to draw at.\n * @param fg The foreground color, in the format stored within the attributes.\n * @param bg The background color, in the format stored within the attributes.\n * This is used to validate whether a cached image can be used.\n * @param bold Whether the text is bold.\n */\n protected _drawChars(cell: ICellData, x: number, y: number): void {\n const contrastColor = this._getContrastColor(cell);\n\n // skip cache right away if we draw in RGB\n // Note: to avoid bad runtime JoinedCellData will be skipped\n // in the cache handler itself (atlasDidDraw == false) and\n // fall through to uncached later down below\n if (contrastColor || cell.isFgRGB() || cell.isBgRGB()) {\n this._drawUncachedChars(cell, x, y, contrastColor);\n return;\n }\n\n let fg;\n let bg;\n if (cell.isInverse()) {\n fg = (cell.isBgDefault()) ? INVERTED_DEFAULT_COLOR : cell.getBgColor();\n bg = (cell.isFgDefault()) ? INVERTED_DEFAULT_COLOR : cell.getFgColor();\n } else {\n bg = (cell.isBgDefault()) ? DEFAULT_COLOR : cell.getBgColor();\n fg = (cell.isFgDefault()) ? DEFAULT_COLOR : cell.getFgColor();\n }\n\n const drawInBrightColor = this._optionsService.options.drawBoldTextInBrightColors && cell.isBold() && fg < 8;\n\n fg += drawInBrightColor ? 8 : 0;\n this._currentGlyphIdentifier.chars = cell.getChars() || WHITESPACE_CELL_CHAR;\n this._currentGlyphIdentifier.code = cell.getCode() || WHITESPACE_CELL_CODE;\n this._currentGlyphIdentifier.bg = bg;\n this._currentGlyphIdentifier.fg = fg;\n this._currentGlyphIdentifier.bold = !!cell.isBold();\n this._currentGlyphIdentifier.dim = !!cell.isDim();\n this._currentGlyphIdentifier.italic = !!cell.isItalic();\n const atlasDidDraw = this._charAtlas && this._charAtlas.draw(\n this._ctx,\n this._currentGlyphIdentifier,\n x * this._scaledCellWidth + this._scaledCharLeft,\n y * this._scaledCellHeight + this._scaledCharTop\n );\n\n if (!atlasDidDraw) {\n this._drawUncachedChars(cell, x, y);\n }\n }\n\n /**\n * Draws one or more characters at one or more cells. The character(s) will be\n * clipped to ensure that they fit with the cell(s), including the cell to the\n * right if the last character is a wide character.\n * @param chars The character.\n * @param width The width of the character.\n * @param fg The foreground color, in the format stored within the attributes.\n * @param x The column to draw at.\n * @param y The row to draw at.\n */\n private _drawUncachedChars(cell: ICellData, x: number, y: number, fgOverride?: IColor): void {\n this._ctx.save();\n this._ctx.font = this._getFont(!!cell.isBold(), !!cell.isItalic());\n this._ctx.textBaseline = 'middle';\n\n if (cell.isInverse()) {\n if (fgOverride) {\n this._ctx.fillStyle = fgOverride.css;\n } else if (cell.isBgDefault()) {\n this._ctx.fillStyle = color.opaque(this._colors.background).css;\n } else if (cell.isBgRGB()) {\n this._ctx.fillStyle = `rgb(${AttributeData.toColorRGB(cell.getBgColor()).join(',')})`;\n } else {\n let bg = cell.getBgColor();\n if (this._optionsService.options.drawBoldTextInBrightColors && cell.isBold() && bg < 8) {\n bg += 8;\n }\n this._ctx.fillStyle = this._colors.ansi[bg].css;\n }\n } else {\n if (fgOverride) {\n this._ctx.fillStyle = fgOverride.css;\n } else if (cell.isFgDefault()) {\n this._ctx.fillStyle = this._colors.foreground.css;\n } else if (cell.isFgRGB()) {\n this._ctx.fillStyle = `rgb(${AttributeData.toColorRGB(cell.getFgColor()).join(',')})`;\n } else {\n let fg = cell.getFgColor();\n if (this._optionsService.options.drawBoldTextInBrightColors && cell.isBold() && fg < 8) {\n fg += 8;\n }\n this._ctx.fillStyle = this._colors.ansi[fg].css;\n }\n }\n\n this._clipRow(y);\n\n // Apply alpha to dim the character\n if (cell.isDim()) {\n this._ctx.globalAlpha = DIM_OPACITY;\n }\n // Draw the character\n this._ctx.fillText(\n cell.getChars(),\n x * this._scaledCellWidth + this._scaledCharLeft,\n y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);\n this._ctx.restore();\n }\n\n /**\n * Clips a row to ensure no pixels will be drawn outside the cells in the row.\n * @param y The row to clip.\n */\n private _clipRow(y: number): void {\n this._ctx.beginPath();\n this._ctx.rect(\n 0,\n y * this._scaledCellHeight,\n this._bufferService.cols * this._scaledCellWidth,\n this._scaledCellHeight);\n this._ctx.clip();\n }\n\n /**\n * Gets the current font.\n * @param isBold If we should use the bold fontWeight.\n */\n protected _getFont(isBold: boolean, isItalic: boolean): string {\n const fontWeight = isBold ? this._optionsService.options.fontWeightBold : this._optionsService.options.fontWeight;\n const fontStyle = isItalic ? 'italic' : '';\n\n return `${fontStyle} ${fontWeight} ${this._optionsService.options.fontSize * window.devicePixelRatio}px ${this._optionsService.options.fontFamily}`;\n }\n\n private _getContrastColor(cell: CellData): IColor | undefined {\n if (this._optionsService.options.minimumContrastRatio === 1) {\n return undefined;\n }\n\n // Try get from cache first\n const adjustedColor = this._colors.contrastCache.getColor(cell.bg, cell.fg);\n if (adjustedColor !== undefined) {\n return adjustedColor || undefined;\n }\n\n let fgColor = cell.getFgColor();\n let fgColorMode = cell.getFgColorMode();\n let bgColor = cell.getBgColor();\n let bgColorMode = cell.getBgColorMode();\n const isInverse = !!cell.isInverse();\n const isBold = !!cell.isInverse();\n if (isInverse) {\n const temp = fgColor;\n fgColor = bgColor;\n bgColor = temp;\n const temp2 = fgColorMode;\n fgColorMode = bgColorMode;\n bgColorMode = temp2;\n }\n\n const bgRgba = this._resolveBackgroundRgba(bgColorMode, bgColor, isInverse);\n const fgRgba = this._resolveForegroundRgba(fgColorMode, fgColor, isInverse, isBold);\n const result = rgba.ensureContrastRatio(bgRgba, fgRgba, this._optionsService.options.minimumContrastRatio);\n\n if (!result) {\n this._colors.contrastCache.setColor(cell.bg, cell.fg, null);\n return undefined;\n }\n\n const color: IColor = {\n css: channels.toCss(\n (result >> 24) & 0xFF,\n (result >> 16) & 0xFF,\n (result >> 8) & 0xFF\n ),\n rgba: result\n };\n this._colors.contrastCache.setColor(cell.bg, cell.fg, color);\n\n return color;\n }\n\n private _resolveBackgroundRgba(bgColorMode: number, bgColor: number, inverse: boolean): number {\n switch (bgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n return this._colors.ansi[bgColor].rgba;\n case Attributes.CM_RGB:\n return bgColor << 8;\n case Attributes.CM_DEFAULT:\n default:\n if (inverse) {\n return this._colors.foreground.rgba;\n }\n return this._colors.background.rgba;\n }\n }\n\n private _resolveForegroundRgba(fgColorMode: number, fgColor: number, inverse: boolean, bold: boolean): number {\n switch (fgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n if (this._optionsService.options.drawBoldTextInBrightColors && bold && fgColor < 8) {\n fgColor += 8;\n }\n return this._colors.ansi[fgColor].rgba;\n case Attributes.CM_RGB:\n return fgColor << 8;\n case Attributes.CM_DEFAULT:\n default:\n if (inverse) {\n return this._colors.background.rgba;\n }\n return this._colors.foreground.rgba;\n }\n }\n}\n\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, CharData } from 'common/Types';\nimport { ICharacterJoinerRegistry, ICharacterJoiner } from 'browser/renderer/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WHITESPACE_CELL_CHAR, Content } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService } from 'common/services/Services';\n\nexport class JoinedCellData extends AttributeData implements ICellData {\n private _width: number;\n // .content carries no meaning for joined CellData, simply nullify it\n // thus we have to overload all other .content accessors\n public content: number = 0;\n public fg: number;\n public bg: number;\n public combinedData: string = '';\n\n constructor(firstCell: ICellData, chars: string, width: number) {\n super();\n this.fg = firstCell.fg;\n this.bg = firstCell.bg;\n this.combinedData = chars;\n this._width = width;\n }\n\n public isCombined(): number {\n // always mark joined cell data as combined\n return Content.IS_COMBINED_MASK;\n }\n\n public getWidth(): number {\n return this._width;\n }\n\n public getChars(): string {\n return this.combinedData;\n }\n\n public getCode(): number {\n // code always gets the highest possible fake codepoint (read as -1)\n // this is needed as code is used by caches as identifier\n return 0x1FFFFF;\n }\n\n public setFromCharData(value: CharData): void {\n throw new Error('not implemented');\n }\n\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n\nexport class CharacterJoinerRegistry implements ICharacterJoinerRegistry {\n\n private _characterJoiners: ICharacterJoiner[] = [];\n private _nextCharacterJoinerId: number = 0;\n private _workCell: CellData = new CellData();\n\n constructor(private _bufferService: IBufferService) { }\n\n public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {\n const joiner: ICharacterJoiner = {\n id: this._nextCharacterJoinerId++,\n handler\n };\n\n this._characterJoiners.push(joiner);\n return joiner.id;\n }\n\n public deregisterCharacterJoiner(joinerId: number): boolean {\n for (let i = 0; i < this._characterJoiners.length; i++) {\n if (this._characterJoiners[i].id === joinerId) {\n this._characterJoiners.splice(i, 1);\n return true;\n }\n }\n\n return false;\n }\n\n public getJoinedCharacters(row: number): [number, number][] {\n if (this._characterJoiners.length === 0) {\n return [];\n }\n\n const line = this._bufferService.buffer.lines.get(row);\n if (!line || line.length === 0) {\n return [];\n }\n\n const ranges: [number, number][] = [];\n const lineStr = line.translateToString(true);\n\n // Because some cells can be represented by multiple javascript characters,\n // we track the cell and the string indexes separately. This allows us to\n // translate the string ranges we get from the joiners back into cell ranges\n // for use when rendering\n let rangeStartColumn = 0;\n let currentStringIndex = 0;\n let rangeStartStringIndex = 0;\n let rangeAttrFG = line.getFg(0);\n let rangeAttrBG = line.getBg(0);\n\n for (let x = 0; x < line.getTrimmedLength(); x++) {\n line.loadCell(x, this._workCell);\n\n if (this._workCell.getWidth() === 0) {\n // If this character is of width 0, skip it.\n continue;\n }\n\n // End of range\n if (this._workCell.fg !== rangeAttrFG || this._workCell.bg !== rangeAttrBG) {\n // If we ended up with a sequence of more than one character,\n // look for ranges to join.\n if (x - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n // Reset our markers for a new range.\n rangeStartColumn = x;\n rangeStartStringIndex = currentStringIndex;\n rangeAttrFG = this._workCell.fg;\n rangeAttrBG = this._workCell.bg;\n }\n\n currentStringIndex += this._workCell.getChars().length || WHITESPACE_CELL_CHAR.length;\n }\n\n // Process any trailing ranges.\n if (this._bufferService.cols - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n return ranges;\n }\n\n /**\n * Given a segment of a line of text, find all ranges of text that should be\n * joined in a single rendering unit. Ranges are internally converted to\n * column ranges, rather than string ranges.\n * @param line String representation of the full line of text\n * @param startIndex Start position of the range to search in the string (inclusive)\n * @param endIndex End position of the range to search in the string (exclusive)\n */\n private _getJoinedRanges(line: string, startIndex: number, endIndex: number, lineData: IBufferLine, startCol: number): [number, number][] {\n const text = line.substring(startIndex, endIndex);\n // At this point we already know that there is at least one joiner so\n // we can just pull its value and assign it directly rather than\n // merging it into an empty array, which incurs unnecessary writes.\n const joinedRanges: [number, number][] = this._characterJoiners[0].handler(text);\n for (let i = 1; i < this._characterJoiners.length; i++) {\n // We merge any overlapping ranges across the different joiners\n const joinerRanges = this._characterJoiners[i].handler(text);\n for (let j = 0; j < joinerRanges.length; j++) {\n CharacterJoinerRegistry._mergeRanges(joinedRanges, joinerRanges[j]);\n }\n }\n this._stringRangesToCellRanges(joinedRanges, lineData, startCol);\n return joinedRanges;\n }\n\n /**\n * Modifies the provided ranges in-place to adjust for variations between\n * string length and cell width so that the range represents a cell range,\n * rather than the string range the joiner provides.\n * @param ranges String ranges containing start (inclusive) and end (exclusive) index\n * @param line Cell data for the relevant line in the terminal\n * @param startCol Offset within the line to start from\n */\n private _stringRangesToCellRanges(ranges: [number, number][], line: IBufferLine, startCol: number): void {\n let currentRangeIndex = 0;\n let currentRangeStarted = false;\n let currentStringIndex = 0;\n let currentRange = ranges[currentRangeIndex];\n\n // If we got through all of the ranges, stop searching\n if (!currentRange) {\n return;\n }\n\n for (let x = startCol; x < this._bufferService.cols; x++) {\n const width = line.getWidth(x);\n const length = line.getString(x).length || WHITESPACE_CELL_CHAR.length;\n\n // We skip zero-width characters when creating the string to join the text\n // so we do the same here\n if (width === 0) {\n continue;\n }\n\n // Adjust the start of the range\n if (!currentRangeStarted && currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n }\n\n // Adjust the end of the range\n if (currentRange[1] <= currentStringIndex) {\n currentRange[1] = x;\n\n // We're finished with this range, so we move to the next one\n currentRange = ranges[++currentRangeIndex];\n\n // If there are no more ranges left, stop searching\n if (!currentRange) {\n break;\n }\n\n // Ranges can be on adjacent characters. Because the end index of the\n // ranges are exclusive, this means that the index for the start of a\n // range can be the same as the end index of the previous range. To\n // account for the start of the next range, we check here just in case.\n if (currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n } else {\n currentRangeStarted = false;\n }\n }\n\n // Adjust the string index based on the character length to line up with\n // the column adjustment\n currentStringIndex += length;\n }\n\n // If there is still a range left at the end, it must extend all the way to\n // the end of the line.\n if (currentRange) {\n currentRange[1] = this._bufferService.cols;\n }\n }\n\n /**\n * Merges the range defined by the provided start and end into the list of\n * existing ranges. The merge is done in place on the existing range for\n * performance and is also returned.\n * @param ranges Existing range list\n * @param newRange Tuple of two numbers representing the new range to merge in.\n * @returns The ranges input with the new range merged in place\n */\n private static _mergeRanges(ranges: [number, number][], newRange: [number, number]): [number, number][] {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ranges.splice(i, 0, newRange);\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 2: New range is either wholly contained within the\n // search range or overlaps with the front of it\n range[0] = Math.min(newRange[0], range[0]);\n return ranges;\n }\n\n if (newRange[0] < range[1]) {\n // Case 3: New range either wholly contains the search range\n // or overlaps with the end of it\n range[0] = Math.min(newRange[0], range[0]);\n inRange = true;\n }\n\n // Case 4: New range starts after the search range\n continue;\n } else {\n if (newRange[1] <= range[0]) {\n // Case 5: New range extends from previous range but doesn't\n // reach the current one\n ranges[i - 1][1] = newRange[1];\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 6: New range extends from prvious range into the\n // current range\n ranges[i - 1][1] = Math.max(newRange[1], range[1]);\n ranges.splice(i, 1);\n return ranges;\n }\n\n // Case 7: New range extends from previous range past the\n // end of the current range\n ranges.splice(i, 1);\n i--;\n }\n }\n\n if (inRange) {\n // Case 8: New range extends past the last existing range\n ranges[ranges.length - 1][1] = newRange[1];\n } else {\n // Case 9: New range starts after the last existing range\n ranges.push(newRange);\n }\n\n return ranges;\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDimensions, IRequestRedrawEvent } from 'browser/renderer/Types';\nimport { BaseRenderLayer } from 'browser/renderer/BaseRenderLayer';\nimport { ICellData } from 'common/Types';\nimport { CellData } from 'common/buffer/CellData';\nimport { IColorSet } from 'browser/Types';\nimport { IBufferService, IOptionsService, ICoreService } from 'common/services/Services';\nimport { IEventEmitter } from 'common/EventEmitter';\nimport { ICoreBrowserService } from 'browser/services/Services';\n\ninterface ICursorState {\n x: number;\n y: number;\n isFocused: boolean;\n style: string;\n width: number;\n}\n\n/**\n * The time between cursor blinks.\n */\nconst BLINK_INTERVAL = 600;\n\nexport class CursorRenderLayer extends BaseRenderLayer {\n private _state: ICursorState;\n private _cursorRenderers: {[key: string]: (x: number, y: number, cell: ICellData) => void};\n private _cursorBlinkStateManager: CursorBlinkStateManager | undefined;\n private _cell: ICellData = new CellData();\n\n constructor(\n container: HTMLElement,\n zIndex: number,\n colors: IColorSet,\n rendererId: number,\n private _onRequestRedraw: IEventEmitter,\n bufferService: IBufferService,\n optionsService: IOptionsService,\n private readonly _coreService: ICoreService,\n private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super(container, 'cursor', zIndex, true, colors, rendererId, bufferService, optionsService);\n this._state = {\n x: 0,\n y: 0,\n isFocused: false,\n style: '',\n width: 0\n };\n this._cursorRenderers = {\n 'bar': this._renderBarCursor.bind(this),\n 'block': this._renderBlockCursor.bind(this),\n 'underline': this._renderUnderlineCursor.bind(this)\n };\n // TODO: Consider initial options? Maybe onOptionsChanged should be called at the end of open?\n }\n\n public resize(dim: IRenderDimensions): void {\n super.resize(dim);\n // Resizing the canvas discards the contents of the canvas so clear state\n this._state = {\n x: 0,\n y: 0,\n isFocused: false,\n style: '',\n width: 0\n };\n }\n\n public reset(): void {\n this._clearCursor();\n if (this._cursorBlinkStateManager) {\n this._cursorBlinkStateManager.dispose();\n this._cursorBlinkStateManager = undefined;\n this.onOptionsChanged();\n }\n }\n\n public onBlur(): void {\n if (this._cursorBlinkStateManager) {\n this._cursorBlinkStateManager.pause();\n }\n this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });\n }\n\n public onFocus(): void {\n if (this._cursorBlinkStateManager) {\n this._cursorBlinkStateManager.resume();\n } else {\n this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });\n }\n }\n\n public onOptionsChanged(): void {\n if (this._optionsService.options.cursorBlink) {\n if (!this._cursorBlinkStateManager) {\n this._cursorBlinkStateManager = new CursorBlinkStateManager(this._coreBrowserService.isFocused, () => {\n this._render(true);\n });\n }\n } else {\n this._cursorBlinkStateManager?.dispose();\n this._cursorBlinkStateManager = undefined;\n }\n // Request a refresh from the terminal as management of rendering is being\n // moved back to the terminal\n this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });\n }\n\n public onCursorMove(): void {\n if (this._cursorBlinkStateManager) {\n this._cursorBlinkStateManager.restartBlinkAnimation();\n }\n }\n\n public onGridChanged(startRow: number, endRow: number): void {\n if (!this._cursorBlinkStateManager || this._cursorBlinkStateManager.isPaused) {\n this._render(false);\n } else {\n this._cursorBlinkStateManager.restartBlinkAnimation();\n }\n }\n\n private _render(triggeredByAnimationFrame: boolean): void {\n // Don't draw the cursor if it's hidden\n if (!this._coreService.isCursorInitialized || this._coreService.isCursorHidden) {\n this._clearCursor();\n return;\n }\n\n const cursorY = this._bufferService.buffer.ybase + this._bufferService.buffer.y;\n const viewportRelativeCursorY = cursorY - this._bufferService.buffer.ydisp;\n\n // Don't draw the cursor if it's off-screen\n if (viewportRelativeCursorY < 0 || viewportRelativeCursorY >= this._bufferService.rows) {\n this._clearCursor();\n return;\n }\n\n // in case cursor.x == cols adjust visual cursor to cols - 1\n const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n this._bufferService.buffer.lines.get(cursorY)!.loadCell(cursorX, this._cell);\n if (this._cell.content === undefined) {\n return;\n }\n\n if (!this._coreBrowserService.isFocused) {\n this._clearCursor();\n this._ctx.save();\n this._ctx.fillStyle = this._colors.cursor.css;\n const cursorStyle = this._optionsService.options.cursorStyle;\n if (cursorStyle && cursorStyle !== 'block') {\n this._cursorRenderers[cursorStyle](cursorX, viewportRelativeCursorY, this._cell);\n } else {\n this._renderBlurCursor(cursorX, viewportRelativeCursorY, this._cell);\n }\n this._ctx.restore();\n this._state.x = cursorX;\n this._state.y = viewportRelativeCursorY;\n this._state.isFocused = false;\n this._state.style = cursorStyle;\n this._state.width = this._cell.getWidth();\n return;\n }\n\n // Don't draw the cursor if it's blinking\n if (this._cursorBlinkStateManager && !this._cursorBlinkStateManager.isCursorVisible) {\n this._clearCursor();\n return;\n }\n\n if (this._state) {\n // The cursor is already in the correct spot, don't redraw\n if (this._state.x === cursorX &&\n this._state.y === viewportRelativeCursorY &&\n this._state.isFocused === this._coreBrowserService.isFocused &&\n this._state.style === this._optionsService.options.cursorStyle &&\n this._state.width === this._cell.getWidth()) {\n return;\n }\n this._clearCursor();\n }\n\n this._ctx.save();\n this._cursorRenderers[this._optionsService.options.cursorStyle || 'block'](cursorX, viewportRelativeCursorY, this._cell);\n this._ctx.restore();\n\n this._state.x = cursorX;\n this._state.y = viewportRelativeCursorY;\n this._state.isFocused = false;\n this._state.style = this._optionsService.options.cursorStyle;\n this._state.width = this._cell.getWidth();\n }\n\n private _clearCursor(): void {\n if (this._state) {\n this._clearCells(this._state.x, this._state.y, this._state.width, 1);\n this._state = {\n x: 0,\n y: 0,\n isFocused: false,\n style: '',\n width: 0\n };\n }\n }\n\n private _renderBarCursor(x: number, y: number, cell: ICellData): void {\n this._ctx.save();\n this._ctx.fillStyle = this._colors.cursor.css;\n this._fillLeftLineAtCell(x, y, this._optionsService.options.cursorWidth);\n this._ctx.restore();\n }\n\n private _renderBlockCursor(x: number, y: number, cell: ICellData): void {\n this._ctx.save();\n this._ctx.fillStyle = this._colors.cursor.css;\n this._fillCells(x, y, cell.getWidth(), 1);\n this._ctx.fillStyle = this._colors.cursorAccent.css;\n this._fillCharTrueColor(cell, x, y);\n this._ctx.restore();\n }\n\n private _renderUnderlineCursor(x: number, y: number, cell: ICellData): void {\n this._ctx.save();\n this._ctx.fillStyle = this._colors.cursor.css;\n this._fillBottomLineAtCells(x, y);\n this._ctx.restore();\n }\n\n private _renderBlurCursor(x: number, y: number, cell: ICellData): void {\n this._ctx.save();\n this._ctx.strokeStyle = this._colors.cursor.css;\n this._strokeRectAtCell(x, y, cell.getWidth(), 1);\n this._ctx.restore();\n }\n}\n\nclass CursorBlinkStateManager {\n public isCursorVisible: boolean;\n\n private _animationFrame: number | undefined;\n private _blinkStartTimeout: number | undefined;\n private _blinkInterval: number | undefined;\n\n /**\n * The time at which the animation frame was restarted, this is used on the\n * next render to restart the timers so they don't need to restart the timers\n * multiple times over a short period.\n */\n private _animationTimeRestarted: number | undefined;\n\n constructor(\n isFocused: boolean,\n private _renderCallback: () => void\n ) {\n this.isCursorVisible = true;\n if (isFocused) {\n this._restartInterval();\n }\n }\n\n public get isPaused(): boolean { return !(this._blinkStartTimeout || this._blinkInterval); }\n\n public dispose(): void {\n if (this._blinkInterval) {\n window.clearInterval(this._blinkInterval);\n this._blinkInterval = undefined;\n }\n if (this._blinkStartTimeout) {\n window.clearTimeout(this._blinkStartTimeout);\n this._blinkStartTimeout = undefined;\n }\n if (this._animationFrame) {\n window.cancelAnimationFrame(this._animationFrame);\n this._animationFrame = undefined;\n }\n }\n\n public restartBlinkAnimation(): void {\n if (this.isPaused) {\n return;\n }\n // Save a timestamp so that the restart can be done on the next interval\n this._animationTimeRestarted = Date.now();\n // Force a cursor render to ensure it's visible and in the correct position\n this.isCursorVisible = true;\n if (!this._animationFrame) {\n this._animationFrame = window.requestAnimationFrame(() => {\n this._renderCallback();\n this._animationFrame = undefined;\n });\n }\n }\n\n private _restartInterval(timeToStart: number = BLINK_INTERVAL): void {\n // Clear any existing interval\n if (this._blinkInterval) {\n window.clearInterval(this._blinkInterval);\n }\n\n // Setup the initial timeout which will hide the cursor, this is done before\n // the regular interval is setup in order to support restarting the blink\n // animation in a lightweight way (without thrashing clearInterval and\n // setInterval).\n this._blinkStartTimeout = window.setTimeout(() => {\n // Check if another animation restart was requested while this was being\n // started\n if (this._animationTimeRestarted) {\n const time = BLINK_INTERVAL - (Date.now() - this._animationTimeRestarted);\n this._animationTimeRestarted = undefined;\n if (time > 0) {\n this._restartInterval(time);\n return;\n }\n }\n\n // Hide the cursor\n this.isCursorVisible = false;\n this._animationFrame = window.requestAnimationFrame(() => {\n this._renderCallback();\n this._animationFrame = undefined;\n });\n\n // Setup the blink interval\n this._blinkInterval = window.setInterval(() => {\n // Adjust the animation time if it was restarted\n if (this._animationTimeRestarted) {\n // calc time diff\n // Make restart interval do a setTimeout initially?\n const time = BLINK_INTERVAL - (Date.now() - this._animationTimeRestarted);\n this._animationTimeRestarted = undefined;\n this._restartInterval(time);\n return;\n }\n\n // Invert visibility and render\n this.isCursorVisible = !this.isCursorVisible;\n this._animationFrame = window.requestAnimationFrame(() => {\n this._renderCallback();\n this._animationFrame = undefined;\n });\n }, BLINK_INTERVAL);\n }, timeToStart);\n }\n\n public pause(): void {\n this.isCursorVisible = true;\n if (this._blinkInterval) {\n window.clearInterval(this._blinkInterval);\n this._blinkInterval = undefined;\n }\n if (this._blinkStartTimeout) {\n window.clearTimeout(this._blinkStartTimeout);\n this._blinkStartTimeout = undefined;\n }\n if (this._animationFrame) {\n window.cancelAnimationFrame(this._animationFrame);\n this._animationFrame = undefined;\n }\n }\n\n public resume(): void {\n // Clear out any existing timers just in case\n this.pause();\n\n this._animationTimeRestarted = undefined;\n this._restartInterval();\n this.restartBlinkAnimation();\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport class GridCache {\n public cache: (T | undefined)[][];\n\n public constructor() {\n this.cache = [];\n }\n\n public resize(width: number, height: number): void {\n for (let x = 0; x < width; x++) {\n if (this.cache.length <= x) {\n this.cache.push([]);\n }\n for (let y = this.cache[x].length; y < height; y++) {\n this.cache[x].push(undefined);\n }\n this.cache[x].length = height;\n }\n this.cache.length = width;\n }\n\n public clear(): void {\n for (let x = 0; x < this.cache.length; x++) {\n for (let y = 0; y < this.cache[x].length; y++) {\n this.cache[x][y] = undefined;\n }\n }\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDimensions } from 'browser/renderer/Types';\nimport { BaseRenderLayer } from './BaseRenderLayer';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';\nimport { is256Color } from 'browser/renderer/atlas/CharAtlasUtils';\nimport { IColorSet, ILinkifierEvent, ILinkifier, ILinkifier2 } from 'browser/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\n\nexport class LinkRenderLayer extends BaseRenderLayer {\n private _state: ILinkifierEvent | undefined;\n\n constructor(\n container: HTMLElement,\n zIndex: number,\n colors: IColorSet,\n rendererId: number,\n linkifier: ILinkifier,\n linkifier2: ILinkifier2,\n bufferService: IBufferService,\n optionsService: IOptionsService\n ) {\n super(container, 'link', zIndex, true, colors, rendererId, bufferService, optionsService);\n linkifier.onShowLinkUnderline(e => this._onShowLinkUnderline(e));\n linkifier.onHideLinkUnderline(e => this._onHideLinkUnderline(e));\n\n linkifier2.onShowLinkUnderline(e => this._onShowLinkUnderline(e));\n linkifier2.onHideLinkUnderline(e => this._onHideLinkUnderline(e));\n }\n\n public resize(dim: IRenderDimensions): void {\n super.resize(dim);\n // Resizing the canvas discards the contents of the canvas so clear state\n this._state = undefined;\n }\n\n public reset(): void {\n this._clearCurrentLink();\n }\n\n private _clearCurrentLink(): void {\n if (this._state) {\n this._clearCells(this._state.x1, this._state.y1, this._state.cols - this._state.x1, 1);\n const middleRowCount = this._state.y2 - this._state.y1 - 1;\n if (middleRowCount > 0) {\n this._clearCells(0, this._state.y1 + 1, this._state.cols, middleRowCount);\n }\n this._clearCells(0, this._state.y2, this._state.x2, 1);\n this._state = undefined;\n }\n }\n\n private _onShowLinkUnderline(e: ILinkifierEvent): void {\n if (e.fg === INVERTED_DEFAULT_COLOR) {\n this._ctx.fillStyle = this._colors.background.css;\n } else if (e.fg && is256Color(e.fg)) {\n // 256 color support\n this._ctx.fillStyle = this._colors.ansi[e.fg].css;\n } else {\n this._ctx.fillStyle = this._colors.foreground.css;\n }\n\n if (e.y1 === e.y2) {\n // Single line link\n this._fillBottomLineAtCells(e.x1, e.y1, e.x2 - e.x1);\n } else {\n // Multi-line link\n this._fillBottomLineAtCells(e.x1, e.y1, e.cols - e.x1);\n for (let y = e.y1 + 1; y < e.y2; y++) {\n this._fillBottomLineAtCells(0, y, e.cols);\n }\n this._fillBottomLineAtCells(0, e.y2, e.x2);\n }\n this._state = e;\n }\n\n private _onHideLinkUnderline(e: ILinkifierEvent): void {\n this._clearCurrentLink();\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { TextRenderLayer } from 'browser/renderer/TextRenderLayer';\nimport { SelectionRenderLayer } from 'browser/renderer/SelectionRenderLayer';\nimport { CursorRenderLayer } from 'browser/renderer/CursorRenderLayer';\nimport { IRenderLayer, IRenderer, IRenderDimensions, CharacterJoinerHandler, ICharacterJoinerRegistry, IRequestRedrawEvent } from 'browser/renderer/Types';\nimport { LinkRenderLayer } from 'browser/renderer/LinkRenderLayer';\nimport { CharacterJoinerRegistry } from 'browser/renderer/CharacterJoinerRegistry';\nimport { Disposable } from 'common/Lifecycle';\nimport { IColorSet, ILinkifier, ILinkifier2 } from 'browser/Types';\nimport { ICharSizeService, ICoreBrowserService } from 'browser/services/Services';\nimport { IBufferService, IOptionsService, ICoreService } from 'common/services/Services';\nimport { removeTerminalFromCache } from 'browser/renderer/atlas/CharAtlasCache';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\n\nlet nextRendererId = 1;\n\nexport class Renderer extends Disposable implements IRenderer {\n private _id = nextRendererId++;\n\n private _renderLayers: IRenderLayer[];\n private _devicePixelRatio: number;\n private _characterJoinerRegistry: ICharacterJoinerRegistry;\n\n public dimensions: IRenderDimensions;\n\n private _onRequestRedraw = new EventEmitter();\n public get onRequestRedraw(): IEvent { return this._onRequestRedraw.event; }\n\n constructor(\n private _colors: IColorSet,\n private readonly _screenElement: HTMLElement,\n linkifier: ILinkifier,\n linkifier2: ILinkifier2,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreService coreService: ICoreService,\n @ICoreBrowserService coreBrowserService: ICoreBrowserService\n ) {\n super();\n const allowTransparency = this._optionsService.options.allowTransparency;\n this._characterJoinerRegistry = new CharacterJoinerRegistry(this._bufferService);\n this._renderLayers = [\n new TextRenderLayer(this._screenElement, 0, this._colors, this._characterJoinerRegistry, allowTransparency, this._id, this._bufferService, _optionsService),\n new SelectionRenderLayer(this._screenElement, 1, this._colors, this._id, this._bufferService, _optionsService),\n new LinkRenderLayer(this._screenElement, 2, this._colors, this._id, linkifier, linkifier2, this._bufferService, _optionsService),\n new CursorRenderLayer(this._screenElement, 3, this._colors, this._id, this._onRequestRedraw, this._bufferService, _optionsService, coreService, coreBrowserService)\n ];\n this.dimensions = {\n scaledCharWidth: 0,\n scaledCharHeight: 0,\n scaledCellWidth: 0,\n scaledCellHeight: 0,\n scaledCharLeft: 0,\n scaledCharTop: 0,\n scaledCanvasWidth: 0,\n scaledCanvasHeight: 0,\n canvasWidth: 0,\n canvasHeight: 0,\n actualCellWidth: 0,\n actualCellHeight: 0\n };\n this._devicePixelRatio = window.devicePixelRatio;\n this._updateDimensions();\n this.onOptionsChanged();\n }\n\n public dispose(): void {\n for (const l of this._renderLayers) {\n l.dispose();\n }\n super.dispose();\n removeTerminalFromCache(this._id);\n }\n\n public onDevicePixelRatioChange(): void {\n // If the device pixel ratio changed, the char atlas needs to be regenerated\n // and the terminal needs to refreshed\n if (this._devicePixelRatio !== window.devicePixelRatio) {\n this._devicePixelRatio = window.devicePixelRatio;\n this.onResize(this._bufferService.cols, this._bufferService.rows);\n }\n }\n\n public setColors(colors: IColorSet): void {\n this._colors = colors;\n // Clear layers and force a full render\n for (const l of this._renderLayers) {\n l.setColors(this._colors);\n l.reset();\n }\n }\n\n public onResize(cols: number, rows: number): void {\n // Update character and canvas dimensions\n this._updateDimensions();\n\n // Resize all render layers\n for (const l of this._renderLayers) {\n l.resize(this.dimensions);\n }\n\n // Resize the screen\n this._screenElement.style.width = `${this.dimensions.canvasWidth}px`;\n this._screenElement.style.height = `${this.dimensions.canvasHeight}px`;\n }\n\n public onCharSizeChanged(): void {\n this.onResize(this._bufferService.cols, this._bufferService.rows);\n }\n\n public onBlur(): void {\n this._runOperation(l => l.onBlur());\n }\n\n public onFocus(): void {\n this._runOperation(l => l.onFocus());\n }\n\n public onSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean = false): void {\n this._runOperation(l => l.onSelectionChanged(start, end, columnSelectMode));\n }\n\n public onCursorMove(): void {\n this._runOperation(l => l.onCursorMove());\n }\n\n public onOptionsChanged(): void {\n this._runOperation(l => l.onOptionsChanged());\n }\n\n public clear(): void {\n this._runOperation(l => l.reset());\n }\n\n private _runOperation(operation: (layer: IRenderLayer) => void): void {\n for (const l of this._renderLayers) {\n operation(l);\n }\n }\n\n /**\n * Performs the refresh loop callback, calling refresh only if a refresh is\n * necessary before queueing up the next one.\n */\n public renderRows(start: number, end: number): void {\n for (const l of this._renderLayers) {\n l.onGridChanged(start, end);\n }\n }\n\n /**\n * Recalculates the character and canvas dimensions.\n */\n private _updateDimensions(): void {\n if (!this._charSizeService.hasValidSize) {\n return;\n }\n\n // Calculate the scaled character width. Width is floored as it must be\n // drawn to an integer grid in order for the CharAtlas \"stamps\" to not be\n // blurry. When text is drawn to the grid not using the CharAtlas, it is\n // clipped to ensure there is no overlap with the next cell.\n this.dimensions.scaledCharWidth = Math.floor(this._charSizeService.width * window.devicePixelRatio);\n\n // Calculate the scaled character height. Height is ceiled in case\n // devicePixelRatio is a floating point number in order to ensure there is\n // enough space to draw the character to the cell.\n this.dimensions.scaledCharHeight = Math.ceil(this._charSizeService.height * window.devicePixelRatio);\n\n // Calculate the scaled cell height, if lineHeight is not 1 then the value\n // will be floored because since lineHeight can never be lower then 1, there\n // is a guarentee that the scaled line height will always be larger than\n // scaled char height.\n this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._optionsService.options.lineHeight);\n\n // Calculate the y coordinate within a cell that text should draw from in\n // order to draw in the center of a cell.\n this.dimensions.scaledCharTop = this._optionsService.options.lineHeight === 1 ? 0 : Math.round((this.dimensions.scaledCellHeight - this.dimensions.scaledCharHeight) / 2);\n\n // Calculate the scaled cell width, taking the letterSpacing into account.\n this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._optionsService.options.letterSpacing);\n\n // Calculate the x coordinate with a cell that text should draw from in\n // order to draw in the center of a cell.\n this.dimensions.scaledCharLeft = Math.floor(this._optionsService.options.letterSpacing / 2);\n\n // Recalculate the canvas dimensions; scaled* define the actual number of\n // pixel in the canvas\n this.dimensions.scaledCanvasHeight = this._bufferService.rows * this.dimensions.scaledCellHeight;\n this.dimensions.scaledCanvasWidth = this._bufferService.cols * this.dimensions.scaledCellWidth;\n\n // The the size of the canvas on the page. It's very important that this\n // rounds to nearest integer and not ceils as browsers often set\n // window.devicePixelRatio as something like 1.100000023841858, when it's\n // actually 1.1. Ceiling causes blurriness as the backing canvas image is 1\n // pixel too large for the canvas element size.\n this.dimensions.canvasHeight = Math.round(this.dimensions.scaledCanvasHeight / window.devicePixelRatio);\n this.dimensions.canvasWidth = Math.round(this.dimensions.scaledCanvasWidth / window.devicePixelRatio);\n\n // Get the _actual_ dimensions of an individual cell. This needs to be\n // derived from the canvasWidth/Height calculated above which takes into\n // account window.devicePixelRatio. ICharSizeService.width/height by itself\n // is insufficient when the page is not at 100% zoom level as it's measured\n // in CSS pixels, but the actual char size on the canvas can differ.\n this.dimensions.actualCellHeight = this.dimensions.canvasHeight / this._bufferService.rows;\n this.dimensions.actualCellWidth = this.dimensions.canvasWidth / this._bufferService.cols;\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number {\n return this._characterJoinerRegistry.registerCharacterJoiner(handler);\n }\n\n public deregisterCharacterJoiner(joinerId: number): boolean {\n return this._characterJoinerRegistry.deregisterCharacterJoiner(joinerId);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function throwIfFalsy(value: T | undefined | null): T {\n if (!value) {\n throw new Error('value must not be falsy');\n }\n return value;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDimensions } from 'browser/renderer/Types';\nimport { BaseRenderLayer } from 'browser/renderer/BaseRenderLayer';\nimport { IColorSet } from 'browser/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\n\ninterface ISelectionState {\n start?: [number, number];\n end?: [number, number];\n columnSelectMode?: boolean;\n ydisp?: number;\n}\n\nexport class SelectionRenderLayer extends BaseRenderLayer {\n private _state!: ISelectionState;\n\n constructor(\n container: HTMLElement,\n zIndex: number,\n colors: IColorSet,\n rendererId: number,\n bufferService: IBufferService,\n optionsService: IOptionsService\n ) {\n super(container, 'selection', zIndex, true, colors, rendererId, bufferService, optionsService);\n this._clearState();\n }\n\n private _clearState(): void {\n this._state = {\n start: undefined,\n end: undefined,\n columnSelectMode: undefined,\n ydisp: undefined\n };\n }\n\n public resize(dim: IRenderDimensions): void {\n super.resize(dim);\n // Resizing the canvas discards the contents of the canvas so clear state\n this._clearState();\n }\n\n public reset(): void {\n if (this._state.start && this._state.end) {\n this._clearState();\n this._clearAll();\n }\n }\n\n public onSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n // Selection has not changed\n if (!this._didStateChange(start, end, columnSelectMode, this._bufferService.buffer.ydisp)) {\n return;\n }\n\n // Remove all selections\n this._clearAll();\n\n // Selection does not exist\n if (!start || !end) {\n this._clearState();\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportStartRow = start[1] - this._bufferService.buffer.ydisp;\n const viewportEndRow = end[1] - this._bufferService.buffer.ydisp;\n const viewportCappedStartRow = Math.max(viewportStartRow, 0);\n const viewportCappedEndRow = Math.min(viewportEndRow, this._bufferService.rows - 1);\n\n // No need to draw the selection\n if (viewportCappedStartRow >= this._bufferService.rows || viewportCappedEndRow < 0) {\n this._state.ydisp = this._bufferService.buffer.ydisp;\n return;\n }\n\n this._ctx.fillStyle = this._colors.selectionTransparent.css;\n\n if (columnSelectMode) {\n const startCol = start[0];\n const width = end[0] - startCol;\n const height = viewportCappedEndRow - viewportCappedStartRow + 1;\n this._fillCells(startCol, viewportCappedStartRow, width, height);\n } else {\n // Draw first row\n const startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n const startRowEndCol = viewportCappedStartRow === viewportEndRow ? end[0] : this._bufferService.cols;\n this._fillCells(startCol, viewportCappedStartRow, startRowEndCol - startCol, 1);\n\n // Draw middle rows\n const middleRowsCount = Math.max(viewportCappedEndRow - viewportCappedStartRow - 1, 0);\n this._fillCells(0, viewportCappedStartRow + 1, this._bufferService.cols, middleRowsCount);\n\n // Draw final row\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n // Only draw viewportEndRow if it's not the same as viewportStartRow\n const endCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols;\n this._fillCells(0, viewportCappedEndRow, endCol, 1);\n }\n }\n\n // Save state for next render\n this._state.start = [start[0], start[1]];\n this._state.end = [end[0], end[1]];\n this._state.columnSelectMode = columnSelectMode;\n this._state.ydisp = this._bufferService.buffer.ydisp;\n }\n\n private _didStateChange(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean, ydisp: number): boolean {\n return !this._areCoordinatesEqual(start, this._state.start) ||\n !this._areCoordinatesEqual(end, this._state.end) ||\n columnSelectMode !== this._state.columnSelectMode ||\n ydisp !== this._state.ydisp;\n }\n\n private _areCoordinatesEqual(coord1: [number, number] | undefined, coord2: [number, number] | undefined): boolean {\n if (!coord1 || !coord2) {\n return false;\n }\n\n return coord1[0] === coord2[0] && coord1[1] === coord2[1];\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharacterJoinerRegistry, IRenderDimensions } from 'browser/renderer/Types';\nimport { CharData, ICellData } from 'common/Types';\nimport { GridCache } from 'browser/renderer/GridCache';\nimport { BaseRenderLayer } from 'browser/renderer/BaseRenderLayer';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { NULL_CELL_CODE, Content } from 'common/buffer/Constants';\nimport { JoinedCellData } from 'browser/renderer/CharacterJoinerRegistry';\nimport { IColorSet } from 'browser/Types';\nimport { CellData } from 'common/buffer/CellData';\nimport { IOptionsService, IBufferService } from 'common/services/Services';\n\n/**\n * This CharData looks like a null character, which will forc a clear and render\n * when the character changes (a regular space ' ' character may not as it's\n * drawn state is a cleared cell).\n */\n// const OVERLAP_OWNED_CHAR_DATA: CharData = [null, '', 0, -1];\n\nexport class TextRenderLayer extends BaseRenderLayer {\n private _state: GridCache;\n private _characterWidth: number = 0;\n private _characterFont: string = '';\n private _characterOverlapCache: { [key: string]: boolean } = {};\n private _characterJoinerRegistry: ICharacterJoinerRegistry;\n private _workCell = new CellData();\n\n constructor(\n container: HTMLElement,\n zIndex: number,\n colors: IColorSet,\n characterJoinerRegistry: ICharacterJoinerRegistry,\n alpha: boolean,\n rendererId: number,\n bufferService: IBufferService,\n optionsService: IOptionsService\n ) {\n super(container, 'text', zIndex, alpha, colors, rendererId, bufferService, optionsService);\n this._state = new GridCache();\n this._characterJoinerRegistry = characterJoinerRegistry;\n }\n\n public resize(dim: IRenderDimensions): void {\n super.resize(dim);\n\n // Clear the character width cache if the font or width has changed\n const terminalFont = this._getFont(false, false);\n if (this._characterWidth !== dim.scaledCharWidth || this._characterFont !== terminalFont) {\n this._characterWidth = dim.scaledCharWidth;\n this._characterFont = terminalFont;\n this._characterOverlapCache = {};\n }\n // Resizing the canvas discards the contents of the canvas so clear state\n this._state.clear();\n this._state.resize(this._bufferService.cols, this._bufferService.rows);\n }\n\n public reset(): void {\n this._state.clear();\n this._clearAll();\n }\n\n private _forEachCell(\n firstRow: number,\n lastRow: number,\n joinerRegistry: ICharacterJoinerRegistry | null,\n callback: (\n cell: ICellData,\n x: number,\n y: number\n ) => void\n ): void {\n for (let y = firstRow; y <= lastRow; y++) {\n const row = y + this._bufferService.buffer.ydisp;\n const line = this._bufferService.buffer.lines.get(row);\n const joinedRanges = joinerRegistry ? joinerRegistry.getJoinedCharacters(row) : [];\n for (let x = 0; x < this._bufferService.cols; x++) {\n line!.loadCell(x, this._workCell);\n let cell = this._workCell;\n\n // If true, indicates that the current character(s) to draw were joined.\n let isJoined = false;\n let lastCharX = x;\n\n // The character to the left is a wide character, drawing is owned by\n // the char at x-1\n if (cell.getWidth() === 0) {\n continue;\n }\n\n // Process any joined character ranges as needed. Because of how the\n // ranges are produced, we know that they are valid for the characters\n // and attributes of our input.\n if (joinedRanges.length > 0 && x === joinedRanges[0][0]) {\n isJoined = true;\n const range = joinedRanges.shift()!;\n\n // We already know the exact start and end column of the joined range,\n // so we get the string and width representing it directly\n\n cell = new JoinedCellData(\n this._workCell,\n line!.translateToString(true, range[0], range[1]),\n range[1] - range[0]\n );\n\n // Skip over the cells occupied by this range in the loop\n lastCharX = range[1] - 1;\n }\n\n // If the character is an overlapping char and the character to the\n // right is a space, take ownership of the cell to the right. We skip\n // this check for joined characters because their rendering likely won't\n // yield the same result as rendering the last character individually.\n if (!isJoined && this._isOverlapping(cell)) {\n // If the character is overlapping, we want to force a re-render on every\n // frame. This is specifically to work around the case where two\n // overlaping chars `a` and `b` are adjacent, the cursor is moved to b and a\n // space is added. Without this, the first half of `b` would never\n // get removed, and `a` would not re-render because it thinks it's\n // already in the correct state.\n // this._state.cache[x][y] = OVERLAP_OWNED_CHAR_DATA;\n if (lastCharX < line!.length - 1 && line!.getCodePoint(lastCharX + 1) === NULL_CELL_CODE) {\n // patch width to 2\n cell.content &= ~Content.WIDTH_MASK;\n cell.content |= 2 << Content.WIDTH_SHIFT;\n // this._clearChar(x + 1, y);\n // The overlapping char's char data will force a clear and render when the\n // overlapping char is no longer to the left of the character and also when\n // the space changes to another character.\n // this._state.cache[x + 1][y] = OVERLAP_OWNED_CHAR_DATA;\n }\n }\n\n callback(\n cell,\n x,\n y\n );\n\n x = lastCharX;\n }\n }\n }\n\n /**\n * Draws the background for a specified range of columns. Tries to batch adjacent cells of the\n * same color together to reduce draw calls.\n */\n private _drawBackground(firstRow: number, lastRow: number): void {\n const ctx = this._ctx;\n const cols = this._bufferService.cols;\n let startX: number = 0;\n let startY: number = 0;\n let prevFillStyle: string | null = null;\n\n ctx.save();\n\n this._forEachCell(firstRow, lastRow, null, (cell, x, y) => {\n // libvte and xterm both draw the background (but not foreground) of invisible characters,\n // so we should too.\n let nextFillStyle = null; // null represents default background color\n\n if (cell.isInverse()) {\n if (cell.isFgDefault()) {\n nextFillStyle = this._colors.foreground.css;\n } else if (cell.isFgRGB()) {\n nextFillStyle = `rgb(${AttributeData.toColorRGB(cell.getFgColor()).join(',')})`;\n } else {\n nextFillStyle = this._colors.ansi[cell.getFgColor()].css;\n }\n } else if (cell.isBgRGB()) {\n nextFillStyle = `rgb(${AttributeData.toColorRGB(cell.getBgColor()).join(',')})`;\n } else if (cell.isBgPalette()) {\n nextFillStyle = this._colors.ansi[cell.getBgColor()].css;\n }\n\n if (prevFillStyle === null) {\n // This is either the first iteration, or the default background was set. Either way, we\n // don't need to draw anything.\n startX = x;\n startY = y;\n }\n\n if (y !== startY) {\n // our row changed, draw the previous row\n ctx.fillStyle = prevFillStyle || '';\n this._fillCells(startX, startY, cols - startX, 1);\n startX = x;\n startY = y;\n } else if (prevFillStyle !== nextFillStyle) {\n // our color changed, draw the previous characters in this row\n ctx.fillStyle = prevFillStyle || '';\n this._fillCells(startX, startY, x - startX, 1);\n startX = x;\n startY = y;\n }\n\n prevFillStyle = nextFillStyle;\n });\n\n // flush the last color we encountered\n if (prevFillStyle !== null) {\n ctx.fillStyle = prevFillStyle;\n this._fillCells(startX, startY, cols - startX, 1);\n }\n\n ctx.restore();\n }\n\n private _drawForeground(firstRow: number, lastRow: number): void {\n this._forEachCell(firstRow, lastRow, this._characterJoinerRegistry, (cell, x, y) => {\n if (cell.isInvisible()) {\n return;\n }\n this._drawChars(cell, x, y);\n if (cell.isUnderline()) {\n this._ctx.save();\n\n if (cell.isInverse()) {\n if (cell.isBgDefault()) {\n this._ctx.fillStyle = this._colors.background.css;\n } else if (cell.isBgRGB()) {\n this._ctx.fillStyle = `rgb(${AttributeData.toColorRGB(cell.getBgColor()).join(',')})`;\n } else {\n let bg = cell.getBgColor();\n if (this._optionsService.options.drawBoldTextInBrightColors && cell.isBold() && bg < 8) {\n bg += 8;\n }\n this._ctx.fillStyle = this._colors.ansi[bg].css;\n }\n } else {\n if (cell.isFgDefault()) {\n this._ctx.fillStyle = this._colors.foreground.css;\n } else if (cell.isFgRGB()) {\n this._ctx.fillStyle = `rgb(${AttributeData.toColorRGB(cell.getFgColor()).join(',')})`;\n } else {\n let fg = cell.getFgColor();\n if (this._optionsService.options.drawBoldTextInBrightColors && cell.isBold() && fg < 8) {\n fg += 8;\n }\n this._ctx.fillStyle = this._colors.ansi[fg].css;\n }\n }\n\n this._fillBottomLineAtCells(x, y, cell.getWidth());\n this._ctx.restore();\n }\n });\n }\n\n public onGridChanged(firstRow: number, lastRow: number): void {\n // Resize has not been called yet\n if (this._state.cache.length === 0) {\n return;\n }\n\n if (this._charAtlas) {\n this._charAtlas.beginFrame();\n }\n\n this._clearCells(0, firstRow, this._bufferService.cols, lastRow - firstRow + 1);\n this._drawBackground(firstRow, lastRow);\n this._drawForeground(firstRow, lastRow);\n }\n\n public onOptionsChanged(): void {\n this._setTransparency(this._optionsService.options.allowTransparency);\n }\n\n /**\n * Whether a character is overlapping to the next cell.\n */\n private _isOverlapping(cell: ICellData): boolean {\n // Only single cell characters can be overlapping, rendering issues can\n // occur without this check\n if (cell.getWidth() !== 1) {\n return false;\n }\n\n // We assume that any ascii character will not overlap\n if (cell.getCode() < 256) {\n return false;\n }\n\n const chars = cell.getChars();\n\n // Deliver from cache if available\n if (this._characterOverlapCache.hasOwnProperty(chars)) {\n return this._characterOverlapCache[chars];\n }\n\n // Setup the font\n this._ctx.save();\n this._ctx.font = this._characterFont;\n\n // Measure the width of the character, but Math.floor it\n // because that is what the renderer does when it calculates\n // the character dimensions we are comparing against\n const overlaps = Math.floor(this._ctx.measureText(chars).width) > this._characterWidth;\n\n // Restore the original context\n this._ctx.restore();\n\n // Cache and return\n this._characterOverlapCache[chars] = overlaps;\n return overlaps;\n }\n\n /**\n * Clear the charcater at the cell specified.\n * @param x The column of the char.\n * @param y The row of the char.\n */\n // private _clearChar(x: number, y: number): void {\n // let colsToClear = 1;\n // // Clear the adjacent character if it was wide\n // const state = this._state.cache[x][y];\n // if (state && state[CHAR_DATA_WIDTH_INDEX] === 2) {\n // colsToClear = 2;\n // }\n // this.clearCells(x, y, colsToClear, 1);\n // }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IGlyphIdentifier } from 'browser/renderer/atlas/Types';\nimport { IDisposable } from 'common/Types';\n\nexport abstract class BaseCharAtlas implements IDisposable {\n private _didWarmUp: boolean = false;\n\n public dispose(): void { }\n\n /**\n * Perform any work needed to warm the cache before it can be used. May be called multiple times.\n * Implement _doWarmUp instead if you only want to get called once.\n */\n public warmUp(): void {\n if (!this._didWarmUp) {\n this._doWarmUp();\n this._didWarmUp = true;\n }\n }\n\n /**\n * Perform any work needed to warm the cache before it can be used. Used by the default\n * implementation of warmUp(), and will only be called once.\n */\n private _doWarmUp(): void { }\n\n /**\n * Called when we start drawing a new frame.\n *\n * TODO: We rely on this getting called by TextRenderLayer. This should really be called by\n * Renderer instead, but we need to make Renderer the source-of-truth for the char atlas, instead\n * of BaseRenderLayer.\n */\n public beginFrame(): void { }\n\n /**\n * May be called before warmUp finishes, however it is okay for the implementation to\n * do nothing and return false in that case.\n *\n * @param ctx Where to draw the character onto.\n * @param glyph Information about what to draw\n * @param x The position on the context to start drawing at\n * @param y The position on the context to start drawing at\n * @returns The success state. True if we drew the character.\n */\n public abstract draw(\n ctx: CanvasRenderingContext2D,\n glyph: IGlyphIdentifier,\n x: number,\n y: number\n ): boolean;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { generateConfig, configEquals } from 'browser/renderer/atlas/CharAtlasUtils';\nimport { BaseCharAtlas } from 'browser/renderer/atlas/BaseCharAtlas';\nimport { DynamicCharAtlas } from 'browser/renderer/atlas/DynamicCharAtlas';\nimport { ICharAtlasConfig } from 'browser/renderer/atlas/Types';\nimport { IColorSet } from 'browser/Types';\nimport { ITerminalOptions } from 'common/services/Services';\n\ninterface ICharAtlasCacheEntry {\n atlas: BaseCharAtlas;\n config: ICharAtlasConfig;\n // N.B. This implementation potentially holds onto copies of the terminal forever, so\n // this may cause memory leaks.\n ownedBy: number[];\n}\n\nconst charAtlasCache: ICharAtlasCacheEntry[] = [];\n\n/**\n * Acquires a char atlas, either generating a new one or returning an existing\n * one that is in use by another terminal.\n */\nexport function acquireCharAtlas(\n options: ITerminalOptions,\n rendererId: number,\n colors: IColorSet,\n scaledCharWidth: number,\n scaledCharHeight: number\n): BaseCharAtlas {\n const newConfig = generateConfig(scaledCharWidth, scaledCharHeight, options, colors);\n\n // Check to see if the renderer already owns this config\n for (let i = 0; i < charAtlasCache.length; i++) {\n const entry = charAtlasCache[i];\n const ownedByIndex = entry.ownedBy.indexOf(rendererId);\n if (ownedByIndex >= 0) {\n if (configEquals(entry.config, newConfig)) {\n return entry.atlas;\n }\n // The configs differ, release the renderer from the entry\n if (entry.ownedBy.length === 1) {\n entry.atlas.dispose();\n charAtlasCache.splice(i, 1);\n } else {\n entry.ownedBy.splice(ownedByIndex, 1);\n }\n break;\n }\n }\n\n // Try match a char atlas from the cache\n for (let i = 0; i < charAtlasCache.length; i++) {\n const entry = charAtlasCache[i];\n if (configEquals(entry.config, newConfig)) {\n // Add the renderer to the cache entry and return\n entry.ownedBy.push(rendererId);\n return entry.atlas;\n }\n }\n\n const newEntry: ICharAtlasCacheEntry = {\n atlas: new DynamicCharAtlas(\n document,\n newConfig\n ),\n config: newConfig,\n ownedBy: [rendererId]\n };\n charAtlasCache.push(newEntry);\n return newEntry.atlas;\n}\n\n/**\n * Removes a terminal reference from the cache, allowing its memory to be freed.\n */\nexport function removeTerminalFromCache(rendererId: number): void {\n for (let i = 0; i < charAtlasCache.length; i++) {\n const index = charAtlasCache[i].ownedBy.indexOf(rendererId);\n if (index !== -1) {\n if (charAtlasCache[i].ownedBy.length === 1) {\n // Remove the cache entry if it's the only renderer\n charAtlasCache[i].atlas.dispose();\n charAtlasCache.splice(i, 1);\n } else {\n // Remove the reference from the cache entry\n charAtlasCache[i].ownedBy.splice(index, 1);\n }\n break;\n }\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharAtlasConfig } from 'browser/renderer/atlas/Types';\nimport { DEFAULT_COLOR } from 'common/buffer/Constants';\nimport { IColorSet, IPartialColorSet } from 'browser/Types';\nimport { ITerminalOptions } from 'common/services/Services';\n\nexport function generateConfig(scaledCharWidth: number, scaledCharHeight: number, options: ITerminalOptions, colors: IColorSet): ICharAtlasConfig {\n // null out some fields that don't matter\n const clonedColors = {\n foreground: colors.foreground,\n background: colors.background,\n cursor: undefined,\n cursorAccent: undefined,\n selection: undefined,\n ansi: colors.ansi\n };\n return {\n devicePixelRatio: window.devicePixelRatio,\n scaledCharWidth,\n scaledCharHeight,\n fontFamily: options.fontFamily,\n fontSize: options.fontSize,\n fontWeight: options.fontWeight,\n fontWeightBold: options.fontWeightBold,\n allowTransparency: options.allowTransparency,\n colors: clonedColors\n };\n}\n\nexport function configEquals(a: ICharAtlasConfig, b: ICharAtlasConfig): boolean {\n for (let i = 0; i < a.colors.ansi.length; i++) {\n if (a.colors.ansi[i].rgba !== b.colors.ansi[i].rgba) {\n return false;\n }\n }\n return a.devicePixelRatio === b.devicePixelRatio &&\n a.fontFamily === b.fontFamily &&\n a.fontSize === b.fontSize &&\n a.fontWeight === b.fontWeight &&\n a.fontWeightBold === b.fontWeightBold &&\n a.allowTransparency === b.allowTransparency &&\n a.scaledCharWidth === b.scaledCharWidth &&\n a.scaledCharHeight === b.scaledCharHeight &&\n a.colors.foreground === b.colors.foreground &&\n a.colors.background === b.colors.background;\n}\n\nexport function is256Color(colorCode: number): boolean {\n return colorCode < DEFAULT_COLOR;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport const INVERTED_DEFAULT_COLOR = 257;\nexport const DIM_OPACITY = 0.5;\n\nexport const CHAR_ATLAS_CELL_SPACING = 1;\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { DIM_OPACITY, INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';\nimport { IGlyphIdentifier, ICharAtlasConfig } from 'browser/renderer/atlas/Types';\nimport { BaseCharAtlas } from 'browser/renderer/atlas/BaseCharAtlas';\nimport { DEFAULT_ANSI_COLORS } from 'browser/ColorManager';\nimport { LRUMap } from 'browser/renderer/atlas/LRUMap';\nimport { isFirefox, isSafari } from 'common/Platform';\nimport { IColor } from 'browser/Types';\nimport { throwIfFalsy } from 'browser/renderer/RendererUtils';\nimport { color } from 'browser/Color';\n\n// In practice we're probably never going to exhaust a texture this large. For debugging purposes,\n// however, it can be useful to set this to a really tiny value, to verify that LRU eviction works.\nconst TEXTURE_WIDTH = 1024;\nconst TEXTURE_HEIGHT = 1024;\n\nconst TRANSPARENT_COLOR = {\n css: 'rgba(0, 0, 0, 0)',\n rgba: 0\n};\n\n// Drawing to the cache is expensive: If we have to draw more than this number of glyphs to the\n// cache in a single frame, give up on trying to cache anything else, and try to finish the current\n// frame ASAP.\n//\n// This helps to limit the amount of damage a program can do when it would otherwise thrash the\n// cache.\nconst FRAME_CACHE_DRAW_LIMIT = 100;\n\n/**\n * The number of milliseconds to wait before generating the ImageBitmap, this is to debounce/batch\n * the operation as window.createImageBitmap is asynchronous.\n */\nconst GLYPH_BITMAP_COMMIT_DELAY = 100;\n\ninterface IGlyphCacheValue {\n index: number;\n isEmpty: boolean;\n inBitmap: boolean;\n}\n\nexport function getGlyphCacheKey(glyph: IGlyphIdentifier): number {\n // Note that this only returns a valid key when code < 256\n // Layout:\n // 0b00000000000000000000000000000001: italic (1)\n // 0b00000000000000000000000000000010: dim (1)\n // 0b00000000000000000000000000000100: bold (1)\n // 0b00000000000000000000111111111000: fg (9)\n // 0b00000000000111111111000000000000: bg (9)\n // 0b00011111111000000000000000000000: code (8)\n // 0b11100000000000000000000000000000: unused (3)\n return glyph.code << 21 | glyph.bg << 12 | glyph.fg << 3 | (glyph.bold ? 0 : 4) + (glyph.dim ? 0 : 2) + (glyph.italic ? 0 : 1);\n}\n\nexport class DynamicCharAtlas extends BaseCharAtlas {\n // An ordered map that we're using to keep track of where each glyph is in the atlas texture.\n // It's ordered so that we can determine when to remove the old entries.\n private _cacheMap: LRUMap;\n\n // The texture that the atlas is drawn to\n private _cacheCanvas: HTMLCanvasElement;\n private _cacheCtx: CanvasRenderingContext2D;\n\n // A temporary context that glyphs are drawn to before being transfered to the atlas.\n private _tmpCtx: CanvasRenderingContext2D;\n\n // The number of characters stored in the atlas by width/height\n private _width: number;\n private _height: number;\n\n private _drawToCacheCount: number = 0;\n\n // An array of glyph keys that are waiting on the bitmap to be generated.\n private _glyphsWaitingOnBitmap: IGlyphCacheValue[] = [];\n\n // The timeout that is used to batch bitmap generation so it's not requested for every new glyph.\n private _bitmapCommitTimeout: number | null = null;\n\n // The bitmap to draw from, this is much faster on other browsers than others.\n private _bitmap: ImageBitmap | null = null;\n\n constructor(document: Document, private _config: ICharAtlasConfig) {\n super();\n this._cacheCanvas = document.createElement('canvas');\n this._cacheCanvas.width = TEXTURE_WIDTH;\n this._cacheCanvas.height = TEXTURE_HEIGHT;\n // The canvas needs alpha because we use clearColor to convert the background color to alpha.\n // It might also contain some characters with transparent backgrounds if allowTransparency is\n // set.\n this._cacheCtx = throwIfFalsy(this._cacheCanvas.getContext('2d', {alpha: true}));\n\n const tmpCanvas = document.createElement('canvas');\n tmpCanvas.width = this._config.scaledCharWidth;\n tmpCanvas.height = this._config.scaledCharHeight;\n this._tmpCtx = throwIfFalsy(tmpCanvas.getContext('2d', {alpha: this._config.allowTransparency}));\n\n this._width = Math.floor(TEXTURE_WIDTH / this._config.scaledCharWidth);\n this._height = Math.floor(TEXTURE_HEIGHT / this._config.scaledCharHeight);\n const capacity = this._width * this._height;\n this._cacheMap = new LRUMap(capacity);\n this._cacheMap.prealloc(capacity);\n\n // This is useful for debugging\n // document.body.appendChild(this._cacheCanvas);\n }\n\n public dispose(): void {\n if (this._bitmapCommitTimeout !== null) {\n window.clearTimeout(this._bitmapCommitTimeout);\n this._bitmapCommitTimeout = null;\n }\n }\n\n public beginFrame(): void {\n this._drawToCacheCount = 0;\n }\n\n public draw(\n ctx: CanvasRenderingContext2D,\n glyph: IGlyphIdentifier,\n x: number,\n y: number\n ): boolean {\n // Space is always an empty cell, special case this as it's so common\n if (glyph.code === 32) {\n return true;\n }\n\n // Exit early for uncachable glyphs\n if (!this._canCache(glyph)) {\n return false;\n }\n\n const glyphKey = getGlyphCacheKey(glyph);\n const cacheValue = this._cacheMap.get(glyphKey);\n if (cacheValue !== null && cacheValue !== undefined) {\n this._drawFromCache(ctx, cacheValue, x, y);\n return true;\n }\n if (this._drawToCacheCount < FRAME_CACHE_DRAW_LIMIT) {\n let index;\n if (this._cacheMap.size < this._cacheMap.capacity) {\n index = this._cacheMap.size;\n } else {\n // we're out of space, so our call to set will delete this item\n index = this._cacheMap.peek()!.index;\n }\n const cacheValue = this._drawToCache(glyph, index);\n this._cacheMap.set(glyphKey, cacheValue);\n this._drawFromCache(ctx, cacheValue, x, y);\n return true;\n }\n return false;\n }\n\n private _canCache(glyph: IGlyphIdentifier): boolean {\n // Only cache ascii and extended characters for now, to be safe. In the future, we could do\n // something more complicated to determine the expected width of a character.\n //\n // If we switch the renderer over to webgl at some point, we may be able to use blending modes\n // to draw overlapping glyphs from the atlas:\n // https://github.com/servo/webrender/issues/464#issuecomment-255632875\n // https://webglfundamentals.org/webgl/lessons/webgl-text-texture.html\n return glyph.code < 256;\n }\n\n private _toCoordinateX(index: number): number {\n return (index % this._width) * this._config.scaledCharWidth;\n }\n\n private _toCoordinateY(index: number): number {\n return Math.floor(index / this._width) * this._config.scaledCharHeight;\n }\n\n private _drawFromCache(\n ctx: CanvasRenderingContext2D,\n cacheValue: IGlyphCacheValue,\n x: number,\n y: number\n ): void {\n // We don't actually need to do anything if this is whitespace.\n if (cacheValue.isEmpty) {\n return;\n }\n const cacheX = this._toCoordinateX(cacheValue.index);\n const cacheY = this._toCoordinateY(cacheValue.index);\n ctx.drawImage(\n cacheValue.inBitmap ? this._bitmap! : this._cacheCanvas,\n cacheX,\n cacheY,\n this._config.scaledCharWidth,\n this._config.scaledCharHeight,\n x,\n y,\n this._config.scaledCharWidth,\n this._config.scaledCharHeight\n );\n }\n\n private _getColorFromAnsiIndex(idx: number): IColor {\n if (idx < this._config.colors.ansi.length) {\n return this._config.colors.ansi[idx];\n }\n return DEFAULT_ANSI_COLORS[idx];\n }\n\n private _getBackgroundColor(glyph: IGlyphIdentifier): IColor {\n if (this._config.allowTransparency) {\n // The background color might have some transparency, so we need to render it as fully\n // transparent in the atlas. Otherwise we'd end up drawing the transparent background twice\n // around the anti-aliased edges of the glyph, and it would look too dark.\n return TRANSPARENT_COLOR;\n }\n if (glyph.bg === INVERTED_DEFAULT_COLOR) {\n return this._config.colors.foreground;\n }\n if (glyph.bg < 256) {\n return this._getColorFromAnsiIndex(glyph.bg);\n }\n return this._config.colors.background;\n }\n\n private _getForegroundColor(glyph: IGlyphIdentifier): IColor {\n if (glyph.fg === INVERTED_DEFAULT_COLOR) {\n return color.opaque(this._config.colors.background);\n }\n if (glyph.fg < 256) {\n // 256 color support\n return this._getColorFromAnsiIndex(glyph.fg);\n }\n return this._config.colors.foreground;\n }\n\n // TODO: We do this (or something similar) in multiple places. We should split this off\n // into a shared function.\n private _drawToCache(glyph: IGlyphIdentifier, index: number): IGlyphCacheValue {\n this._drawToCacheCount++;\n\n this._tmpCtx.save();\n\n // draw the background\n const backgroundColor = this._getBackgroundColor(glyph);\n // Use a 'copy' composite operation to clear any existing glyph out of _tmpCtxWithAlpha, regardless of\n // transparency in backgroundColor\n this._tmpCtx.globalCompositeOperation = 'copy';\n this._tmpCtx.fillStyle = backgroundColor.css;\n this._tmpCtx.fillRect(0, 0, this._config.scaledCharWidth, this._config.scaledCharHeight);\n this._tmpCtx.globalCompositeOperation = 'source-over';\n\n // draw the foreground/glyph\n const fontWeight = glyph.bold ? this._config.fontWeightBold : this._config.fontWeight;\n const fontStyle = glyph.italic ? 'italic' : '';\n this._tmpCtx.font =\n `${fontStyle} ${fontWeight} ${this._config.fontSize * this._config.devicePixelRatio}px ${this._config.fontFamily}`;\n this._tmpCtx.textBaseline = 'middle';\n\n this._tmpCtx.fillStyle = this._getForegroundColor(glyph).css;\n\n // Apply alpha to dim the character\n if (glyph.dim) {\n this._tmpCtx.globalAlpha = DIM_OPACITY;\n }\n // Draw the character\n this._tmpCtx.fillText(glyph.chars, 0, this._config.scaledCharHeight / 2);\n this._tmpCtx.restore();\n\n // clear the background from the character to avoid issues with drawing over the previous\n // character if it extends past it's bounds\n const imageData = this._tmpCtx.getImageData(\n 0, 0, this._config.scaledCharWidth, this._config.scaledCharHeight\n );\n let isEmpty = false;\n if (!this._config.allowTransparency) {\n isEmpty = clearColor(imageData, backgroundColor);\n }\n\n // copy the data from imageData to _cacheCanvas\n const x = this._toCoordinateX(index);\n const y = this._toCoordinateY(index);\n // putImageData doesn't do any blending, so it will overwrite any existing cache entry for us\n this._cacheCtx.putImageData(imageData, x, y);\n\n // Add the glyph and queue it to the bitmap (if the browser supports it)\n const cacheValue = {\n index,\n isEmpty,\n inBitmap: false\n };\n this._addGlyphToBitmap(cacheValue);\n\n return cacheValue;\n }\n\n private _addGlyphToBitmap(cacheValue: IGlyphCacheValue): void {\n // Support is patchy for createImageBitmap at the moment, pass a canvas back\n // if support is lacking as drawImage works there too. Firefox is also\n // included here as ImageBitmap appears both buggy and has horrible\n // performance (tested on v55).\n if (!('createImageBitmap' in window) || isFirefox || isSafari) {\n return;\n }\n\n // Add the glyph to the queue\n this._glyphsWaitingOnBitmap.push(cacheValue);\n\n // Check if bitmap generation timeout already exists\n if (this._bitmapCommitTimeout !== null) {\n return;\n }\n\n this._bitmapCommitTimeout = window.setTimeout(() => this._generateBitmap(), GLYPH_BITMAP_COMMIT_DELAY);\n }\n\n private _generateBitmap(): void {\n const glyphsMovingToBitmap = this._glyphsWaitingOnBitmap;\n this._glyphsWaitingOnBitmap = [];\n window.createImageBitmap(this._cacheCanvas).then(bitmap => {\n // Set bitmap\n this._bitmap = bitmap;\n\n // Mark all new glyphs as in bitmap, excluding glyphs that came in after\n // the bitmap was requested\n for (let i = 0; i < glyphsMovingToBitmap.length; i++) {\n const value = glyphsMovingToBitmap[i];\n // It doesn't matter if the value was already evicted, it will be\n // released from memory after this block if so.\n value.inBitmap = true;\n }\n });\n this._bitmapCommitTimeout = null;\n }\n}\n\n// This is used for debugging the renderer, just swap out `new DynamicCharAtlas` with\n// `new NoneCharAtlas`.\nexport class NoneCharAtlas extends BaseCharAtlas {\n constructor(document: Document, config: ICharAtlasConfig) {\n super();\n }\n\n public draw(\n ctx: CanvasRenderingContext2D,\n glyph: IGlyphIdentifier,\n x: number,\n y: number\n ): boolean {\n return false;\n }\n}\n\n/**\n * Makes a partiicular rgb color in an ImageData completely transparent.\n * @returns True if the result is \"empty\", meaning all pixels are fully transparent.\n */\nfunction clearColor(imageData: ImageData, color: IColor): boolean {\n let isEmpty = true;\n const r = color.rgba >>> 24;\n const g = color.rgba >>> 16 & 0xFF;\n const b = color.rgba >>> 8 & 0xFF;\n for (let offset = 0; offset < imageData.data.length; offset += 4) {\n if (imageData.data[offset] === r &&\n imageData.data[offset + 1] === g &&\n imageData.data[offset + 2] === b) {\n imageData.data[offset + 3] = 0;\n } else {\n isEmpty = false;\n }\n }\n return isEmpty;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\ninterface ILinkedListNode {\n prev: ILinkedListNode | null;\n next: ILinkedListNode | null;\n key: number | null;\n value: T | null;\n}\n\nexport class LRUMap {\n private _map: { [key: number]: ILinkedListNode } = {};\n private _head: ILinkedListNode | null = null;\n private _tail: ILinkedListNode | null = null;\n private _nodePool: ILinkedListNode[] = [];\n public size: number = 0;\n\n constructor(public capacity: number) { }\n\n private _unlinkNode(node: ILinkedListNode): void {\n const prev = node.prev;\n const next = node.next;\n if (node === this._head) {\n this._head = next;\n }\n if (node === this._tail) {\n this._tail = prev;\n }\n if (prev !== null) {\n prev.next = next;\n }\n if (next !== null) {\n next.prev = prev;\n }\n }\n\n private _appendNode(node: ILinkedListNode): void {\n const tail = this._tail;\n if (tail !== null) {\n tail.next = node;\n }\n node.prev = tail;\n node.next = null;\n this._tail = node;\n if (this._head === null) {\n this._head = node;\n }\n }\n\n /**\n * Preallocate a bunch of linked-list nodes. Allocating these nodes ahead of time means that\n * they're more likely to live next to each other in memory, which seems to improve performance.\n *\n * Each empty object only consumes about 60 bytes of memory, so this is pretty cheap, even for\n * large maps.\n */\n public prealloc(count: number): void {\n const nodePool = this._nodePool;\n for (let i = 0; i < count; i++) {\n nodePool.push({\n prev: null,\n next: null,\n key: null,\n value: null\n });\n }\n }\n\n public get(key: number): T | null {\n // This is unsafe: We're assuming our keyspace doesn't overlap with Object.prototype. However,\n // it's faster than calling hasOwnProperty, and in our case, it would never overlap.\n const node = this._map[key];\n if (node !== undefined) {\n this._unlinkNode(node);\n this._appendNode(node);\n return node.value;\n }\n return null;\n }\n\n /**\n * Gets a value from a key without marking it as the most recently used item.\n */\n public peekValue(key: number): T | null {\n const node = this._map[key];\n if (node !== undefined) {\n return node.value;\n }\n return null;\n }\n\n public peek(): T | null {\n const head = this._head;\n return head === null ? null : head.value;\n }\n\n public set(key: number, value: T): void {\n // This is unsafe: See note above.\n let node = this._map[key];\n if (node !== undefined) {\n // already exists, we just need to mutate it and move it to the end of the list\n node = this._map[key];\n this._unlinkNode(node);\n node.value = value;\n } else if (this.size >= this.capacity) {\n // we're out of space: recycle the head node, move it to the tail\n node = this._head!;\n this._unlinkNode(node);\n delete this._map[node.key!];\n node.key = key;\n node.value = value;\n this._map[key] = node;\n } else {\n // make a new element\n const nodePool = this._nodePool;\n if (nodePool.length > 0) {\n // use a preallocated node if we can\n node = nodePool.pop()!;\n node.key = key;\n node.value = value;\n } else {\n node = {\n prev: null,\n next: null,\n key,\n value\n };\n }\n this._map[key] = node;\n this.size++;\n }\n this._appendNode(node);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderer, IRenderDimensions, CharacterJoinerHandler, IRequestRedrawEvent } from 'browser/renderer/Types';\nimport { BOLD_CLASS, ITALIC_CLASS, CURSOR_CLASS, CURSOR_STYLE_BLOCK_CLASS, CURSOR_BLINK_CLASS, CURSOR_STYLE_BAR_CLASS, CURSOR_STYLE_UNDERLINE_CLASS, DomRendererRowFactory } from 'browser/renderer/dom/DomRendererRowFactory';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';\nimport { Disposable } from 'common/Lifecycle';\nimport { IColorSet, ILinkifierEvent, ILinkifier, ILinkifier2 } from 'browser/Types';\nimport { ICharSizeService } from 'browser/services/Services';\nimport { IOptionsService, IBufferService } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { color } from 'browser/Color';\nimport { removeElementFromParent } from 'browser/Dom';\n\nconst TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';\nconst ROW_CONTAINER_CLASS = 'xterm-rows';\nconst FG_CLASS_PREFIX = 'xterm-fg-';\nconst BG_CLASS_PREFIX = 'xterm-bg-';\nconst FOCUS_CLASS = 'xterm-focus';\nconst SELECTION_CLASS = 'xterm-selection';\n\nlet nextTerminalId = 1;\n\n/**\n * A fallback renderer for when canvas is slow. This is not meant to be\n * particularly fast or feature complete, more just stable and usable for when\n * canvas is not an option.\n */\nexport class DomRenderer extends Disposable implements IRenderer {\n private _rowFactory: DomRendererRowFactory;\n private _terminalClass: number = nextTerminalId++;\n\n private _themeStyleElement!: HTMLStyleElement;\n private _dimensionsStyleElement!: HTMLStyleElement;\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[] = [];\n private _selectionContainer: HTMLElement;\n\n public dimensions: IRenderDimensions;\n\n public get onRequestRedraw(): IEvent { return new EventEmitter().event; }\n\n constructor(\n private _colors: IColorSet,\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _viewportElement: HTMLElement,\n private readonly _linkifier: ILinkifier,\n private readonly _linkifier2: ILinkifier2,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n super();\n this._rowContainer = document.createElement('div');\n this._rowContainer.classList.add(ROW_CONTAINER_CLASS);\n this._rowContainer.style.lineHeight = 'normal';\n this._rowContainer.setAttribute('aria-hidden', 'true');\n this._refreshRowElements(this._bufferService.cols, this._bufferService.rows);\n this._selectionContainer = document.createElement('div');\n this._selectionContainer.classList.add(SELECTION_CLASS);\n this._selectionContainer.setAttribute('aria-hidden', 'true');\n\n this.dimensions = {\n scaledCharWidth: 0,\n scaledCharHeight: 0,\n scaledCellWidth: 0,\n scaledCellHeight: 0,\n scaledCharLeft: 0,\n scaledCharTop: 0,\n scaledCanvasWidth: 0,\n scaledCanvasHeight: 0,\n canvasWidth: 0,\n canvasHeight: 0,\n actualCellWidth: 0,\n actualCellHeight: 0\n };\n this._updateDimensions();\n this._injectCss();\n\n this._rowFactory = new DomRendererRowFactory(document, this._optionsService, this._colors);\n\n this._element.classList.add(TERMINAL_CLASS_PREFIX + this._terminalClass);\n this._screenElement.appendChild(this._rowContainer);\n this._screenElement.appendChild(this._selectionContainer);\n\n this._linkifier.onShowLinkUnderline(e => this._onLinkHover(e));\n this._linkifier.onHideLinkUnderline(e => this._onLinkLeave(e));\n\n this._linkifier2.onShowLinkUnderline(e => this._onLinkHover(e));\n this._linkifier2.onHideLinkUnderline(e => this._onLinkLeave(e));\n }\n\n public dispose(): void {\n this._element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);\n\n // Outside influences such as React unmounts may manipulate the DOM before our disposal.\n // https://github.com/xtermjs/xterm.js/issues/2960\n removeElementFromParent(this._rowContainer, this._selectionContainer, this._themeStyleElement, this._dimensionsStyleElement);\n\n super.dispose();\n }\n\n private _updateDimensions(): void {\n this.dimensions.scaledCharWidth = this._charSizeService.width * window.devicePixelRatio;\n this.dimensions.scaledCharHeight = Math.ceil(this._charSizeService.height * window.devicePixelRatio);\n this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._optionsService.options.letterSpacing);\n this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._optionsService.options.lineHeight);\n this.dimensions.scaledCharLeft = 0;\n this.dimensions.scaledCharTop = 0;\n this.dimensions.scaledCanvasWidth = this.dimensions.scaledCellWidth * this._bufferService.cols;\n this.dimensions.scaledCanvasHeight = this.dimensions.scaledCellHeight * this._bufferService.rows;\n this.dimensions.canvasWidth = Math.round(this.dimensions.scaledCanvasWidth / window.devicePixelRatio);\n this.dimensions.canvasHeight = Math.round(this.dimensions.scaledCanvasHeight / window.devicePixelRatio);\n this.dimensions.actualCellWidth = this.dimensions.canvasWidth / this._bufferService.cols;\n this.dimensions.actualCellHeight = this.dimensions.canvasHeight / this._bufferService.rows;\n\n for (const element of this._rowElements) {\n element.style.width = `${this.dimensions.canvasWidth}px`;\n element.style.height = `${this.dimensions.actualCellHeight}px`;\n element.style.lineHeight = `${this.dimensions.actualCellHeight}px`;\n // Make sure rows don't overflow onto following row\n element.style.overflow = 'hidden';\n }\n\n if (!this._dimensionsStyleElement) {\n this._dimensionsStyleElement = document.createElement('style');\n this._screenElement.appendChild(this._dimensionsStyleElement);\n }\n\n const styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} span {` +\n ` display: inline-block;` +\n ` height: 100%;` +\n ` vertical-align: top;` +\n ` width: ${this.dimensions.actualCellWidth}px` +\n `}`;\n\n this._dimensionsStyleElement.textContent = styles;\n\n this._selectionContainer.style.height = this._viewportElement.style.height;\n this._screenElement.style.width = `${this.dimensions.canvasWidth}px`;\n this._screenElement.style.height = `${this.dimensions.canvasHeight}px`;\n }\n\n public setColors(colors: IColorSet): void {\n this._colors = colors;\n this._injectCss();\n }\n\n private _injectCss(): void {\n if (!this._themeStyleElement) {\n this._themeStyleElement = document.createElement('style');\n this._screenElement.appendChild(this._themeStyleElement);\n }\n\n // Base CSS\n let styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} {` +\n ` color: ${this._colors.foreground.css};` +\n ` font-family: ${this._optionsService.options.fontFamily};` +\n ` font-size: ${this._optionsService.options.fontSize}px;` +\n `}`;\n // Text styles\n styles +=\n `${this._terminalSelector} span:not(.${BOLD_CLASS}) {` +\n ` font-weight: ${this._optionsService.options.fontWeight};` +\n `}` +\n `${this._terminalSelector} span.${BOLD_CLASS} {` +\n ` font-weight: ${this._optionsService.options.fontWeightBold};` +\n `}` +\n `${this._terminalSelector} span.${ITALIC_CLASS} {` +\n ` font-style: italic;` +\n `}`;\n // Blink animation\n styles +=\n `@keyframes blink_box_shadow` + `_` + this._terminalClass + ` {` +\n ` 50% {` +\n ` box-shadow: none;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes blink_block` + `_` + this._terminalClass + ` {` +\n ` 0% {` +\n ` background-color: ${this._colors.cursor.css};` +\n ` color: ${this._colors.cursorAccent.css};` +\n ` }` +\n ` 50% {` +\n ` background-color: ${this._colors.cursorAccent.css};` +\n ` color: ${this._colors.cursor.css};` +\n ` }` +\n `}`;\n // Cursor\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}:not(.${FOCUS_CLASS}) .${CURSOR_CLASS}.${CURSOR_STYLE_BLOCK_CLASS} {` +\n ` outline: 1px solid ${this._colors.cursor.css};` +\n ` outline-offset: -1px;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${CURSOR_CLASS}.${CURSOR_BLINK_CLASS}:not(.${CURSOR_STYLE_BLOCK_CLASS}) {` +\n ` animation: blink_box_shadow` + `_` + this._terminalClass + ` 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${CURSOR_CLASS}.${CURSOR_BLINK_CLASS}.${CURSOR_STYLE_BLOCK_CLASS} {` +\n ` animation: blink_block` + `_` + this._terminalClass + ` 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_BLOCK_CLASS} {` +\n ` background-color: ${this._colors.cursor.css};` +\n ` color: ${this._colors.cursorAccent.css};` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_BAR_CLASS} {` +\n ` box-shadow: ${this._optionsService.options.cursorWidth}px 0 0 ${this._colors.cursor.css} inset;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` box-shadow: 0 -1px 0 ${this._colors.cursor.css} inset;` +\n `}`;\n // Selection\n styles +=\n `${this._terminalSelector} .${SELECTION_CLASS} {` +\n ` position: absolute;` +\n ` top: 0;` +\n ` left: 0;` +\n ` z-index: 1;` +\n ` pointer-events: none;` +\n `}` +\n `${this._terminalSelector} .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${this._colors.selectionTransparent.css};` +\n `}`;\n // Colors\n this._colors.ansi.forEach((c, i) => {\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i} { color: ${c.css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${i} { background-color: ${c.css}; }`;\n });\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { color: ${color.opaque(this._colors.background).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { background-color: ${this._colors.foreground.css}; }`;\n\n this._themeStyleElement.textContent = styles;\n }\n\n public onDevicePixelRatioChange(): void {\n this._updateDimensions();\n }\n\n private _refreshRowElements(cols: number, rows: number): void {\n // Add missing elements\n for (let i = this._rowElements.length; i <= rows; i++) {\n const row = document.createElement('div');\n this._rowContainer.appendChild(row);\n this._rowElements.push(row);\n }\n // Remove excess elements\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n }\n\n public onResize(cols: number, rows: number): void {\n this._refreshRowElements(cols, rows);\n this._updateDimensions();\n }\n\n public onCharSizeChanged(): void {\n this._updateDimensions();\n }\n\n public onBlur(): void {\n this._rowContainer.classList.remove(FOCUS_CLASS);\n }\n\n public onFocus(): void {\n this._rowContainer.classList.add(FOCUS_CLASS);\n }\n\n public onSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n // Remove all selections\n while (this._selectionContainer.children.length) {\n this._selectionContainer.removeChild(this._selectionContainer.children[0]);\n }\n\n // Selection does not exist\n if (!start || !end) {\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportStartRow = start[1] - this._bufferService.buffer.ydisp;\n const viewportEndRow = end[1] - this._bufferService.buffer.ydisp;\n const viewportCappedStartRow = Math.max(viewportStartRow, 0);\n const viewportCappedEndRow = Math.min(viewportEndRow, this._bufferService.rows - 1);\n\n // No need to draw the selection\n if (viewportCappedStartRow >= this._bufferService.rows || viewportCappedEndRow < 0) {\n return;\n }\n\n // Create the selections\n const documentFragment = document.createDocumentFragment();\n\n if (columnSelectMode) {\n documentFragment.appendChild(\n this._createSelectionElement(viewportCappedStartRow, start[0], end[0], viewportCappedEndRow - viewportCappedStartRow + 1)\n );\n } else {\n // Draw first row\n const startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n const endCol = viewportCappedStartRow === viewportEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow, startCol, endCol));\n // Draw middle rows\n const middleRowsCount = viewportCappedEndRow - viewportCappedStartRow - 1;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._bufferService.cols, middleRowsCount));\n // Draw final row\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n // Only draw viewportEndRow if it's not the same as viewporttartRow\n const endCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, endCol));\n }\n }\n this._selectionContainer.appendChild(documentFragment);\n }\n\n /**\n * Creates a selection element at the specified position.\n * @param row The row of the selection.\n * @param colStart The start column.\n * @param colEnd The end columns.\n */\n private _createSelectionElement(row: number, colStart: number, colEnd: number, rowCount: number = 1): HTMLElement {\n const element = document.createElement('div');\n element.style.height = `${rowCount * this.dimensions.actualCellHeight}px`;\n element.style.top = `${row * this.dimensions.actualCellHeight}px`;\n element.style.left = `${colStart * this.dimensions.actualCellWidth}px`;\n element.style.width = `${this.dimensions.actualCellWidth * (colEnd - colStart)}px`;\n return element;\n }\n\n public onCursorMove(): void {\n // No-op, the cursor is drawn when rows are drawn\n }\n\n public onOptionsChanged(): void {\n // Force a refresh\n this._updateDimensions();\n this._injectCss();\n }\n\n public clear(): void {\n for (const e of this._rowElements) {\n e.innerText = '';\n }\n }\n\n public renderRows(start: number, end: number): void {\n const cursorAbsoluteY = this._bufferService.buffer.ybase + this._bufferService.buffer.y;\n const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n const cursorBlink = this._optionsService.options.cursorBlink;\n\n for (let y = start; y <= end; y++) {\n const rowElement = this._rowElements[y];\n rowElement.innerText = '';\n\n const row = y + this._bufferService.buffer.ydisp;\n const lineData = this._bufferService.buffer.lines.get(row);\n const cursorStyle = this._optionsService.options.cursorStyle;\n rowElement.appendChild(this._rowFactory.createRow(lineData!, row === cursorAbsoluteY, cursorStyle, cursorX, cursorBlink, this.dimensions.actualCellWidth, this._bufferService.cols));\n }\n }\n\n private get _terminalSelector(): string {\n return `.${TERMINAL_CLASS_PREFIX}${this._terminalClass}`;\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number { return -1; }\n public deregisterCharacterJoiner(joinerId: number): boolean { return false; }\n\n private _onLinkHover(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, true);\n }\n\n private _onLinkLeave(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, false);\n }\n\n private _setCellUnderline(x: number, x2: number, y: number, y2: number, cols: number, enabled: boolean): void {\n while (x !== x2 || y !== y2) {\n const row = this._rowElements[y];\n if (!row) {\n return;\n }\n const span = row.children[x];\n if (span) {\n span.style.textDecoration = enabled ? 'underline' : 'none';\n }\n if (++x >= cols) {\n x = 0;\n y++;\n }\n }\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine } from 'common/Types';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';\nimport { NULL_CELL_CODE, WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { IOptionsService } from 'common/services/Services';\nimport { color, rgba } from 'browser/Color';\nimport { IColorSet, IColor } from 'browser/Types';\n\nexport const BOLD_CLASS = 'xterm-bold';\nexport const DIM_CLASS = 'xterm-dim';\nexport const ITALIC_CLASS = 'xterm-italic';\nexport const UNDERLINE_CLASS = 'xterm-underline';\nexport const CURSOR_CLASS = 'xterm-cursor';\nexport const CURSOR_BLINK_CLASS = 'xterm-cursor-blink';\nexport const CURSOR_STYLE_BLOCK_CLASS = 'xterm-cursor-block';\nexport const CURSOR_STYLE_BAR_CLASS = 'xterm-cursor-bar';\nexport const CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline';\n\nexport class DomRendererRowFactory {\n private _workCell: CellData = new CellData();\n\n constructor(\n private readonly _document: Document,\n private readonly _optionsService: IOptionsService,\n private _colors: IColorSet\n ) {\n }\n\n public setColors(colors: IColorSet): void {\n this._colors = colors;\n }\n\n public createRow(lineData: IBufferLine, isCursorRow: boolean, cursorStyle: string | undefined, cursorX: number, cursorBlink: boolean, cellWidth: number, cols: number): DocumentFragment {\n const fragment = this._document.createDocumentFragment();\n\n // Find the line length first, this prevents the need to output a bunch of\n // empty cells at the end. This cannot easily be integrated into the main\n // loop below because of the colCount feature (which can be removed after we\n // properly support reflow and disallow data to go beyond the right-side of\n // the viewport).\n let lineLength = 0;\n for (let x = Math.min(lineData.length, cols) - 1; x >= 0; x--) {\n if (lineData.loadCell(x, this._workCell).getCode() !== NULL_CELL_CODE || (isCursorRow && x === cursorX)) {\n lineLength = x + 1;\n break;\n }\n }\n\n for (let x = 0; x < lineLength; x++) {\n lineData.loadCell(x, this._workCell);\n const width = this._workCell.getWidth();\n\n // The character to the left is a wide character, drawing is owned by the char at x-1\n if (width === 0) {\n continue;\n }\n\n const charElement = this._document.createElement('span');\n if (width > 1) {\n charElement.style.width = `${cellWidth * width}px`;\n }\n\n if (isCursorRow && x === cursorX) {\n charElement.classList.add(CURSOR_CLASS);\n\n if (cursorBlink) {\n charElement.classList.add(CURSOR_BLINK_CLASS);\n }\n\n switch (cursorStyle) {\n case 'bar':\n charElement.classList.add(CURSOR_STYLE_BAR_CLASS);\n break;\n case 'underline':\n charElement.classList.add(CURSOR_STYLE_UNDERLINE_CLASS);\n break;\n default:\n charElement.classList.add(CURSOR_STYLE_BLOCK_CLASS);\n break;\n }\n }\n\n if (this._workCell.isBold()) {\n charElement.classList.add(BOLD_CLASS);\n }\n\n if (this._workCell.isItalic()) {\n charElement.classList.add(ITALIC_CLASS);\n }\n\n if (this._workCell.isDim()) {\n charElement.classList.add(DIM_CLASS);\n }\n\n if (this._workCell.isUnderline()) {\n charElement.classList.add(UNDERLINE_CLASS);\n }\n\n if (this._workCell.isInvisible()) {\n charElement.textContent = WHITESPACE_CELL_CHAR;\n } else {\n charElement.textContent = this._workCell.getChars() || WHITESPACE_CELL_CHAR;\n }\n\n let fg = this._workCell.getFgColor();\n let fgColorMode = this._workCell.getFgColorMode();\n let bg = this._workCell.getBgColor();\n let bgColorMode = this._workCell.getBgColorMode();\n const isInverse = !!this._workCell.isInverse();\n if (isInverse) {\n const temp = fg;\n fg = bg;\n bg = temp;\n const temp2 = fgColorMode;\n fgColorMode = bgColorMode;\n bgColorMode = temp2;\n }\n\n // Foreground\n switch (fgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n if (this._workCell.isBold() && fg < 8 && this._optionsService.options.drawBoldTextInBrightColors) {\n fg += 8;\n }\n if (!this._applyMinimumContrast(charElement, this._colors.background, this._colors.ansi[fg])) {\n charElement.classList.add(`xterm-fg-${fg}`);\n }\n break;\n case Attributes.CM_RGB:\n const color = rgba.toColor(\n (fg >> 16) & 0xFF,\n (fg >> 8) & 0xFF,\n (fg ) & 0xFF\n );\n if (!this._applyMinimumContrast(charElement, this._colors.background, color)) {\n this._addStyle(charElement, `color:#${padStart(fg.toString(16), '0', 6)}`);\n }\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (!this._applyMinimumContrast(charElement, this._colors.background, this._colors.foreground)) {\n if (isInverse) {\n charElement.classList.add(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);\n }\n }\n }\n\n // Background\n switch (bgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n charElement.classList.add(`xterm-bg-${bg}`);\n break;\n case Attributes.CM_RGB:\n this._addStyle(charElement, `background-color:#${padStart(bg.toString(16), '0', 6)}`);\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (isInverse) {\n charElement.classList.add(`xterm-bg-${INVERTED_DEFAULT_COLOR}`);\n }\n }\n\n fragment.appendChild(charElement);\n }\n return fragment;\n }\n\n private _applyMinimumContrast(element: HTMLElement, bg: IColor, fg: IColor): boolean {\n if (this._optionsService.options.minimumContrastRatio === 1) {\n return false;\n }\n\n // Try get from cache first\n let adjustedColor = this._colors.contrastCache.getColor(this._workCell.bg, this._workCell.fg);\n\n // Calculate and store in cache\n if (adjustedColor === undefined) {\n adjustedColor = color.ensureContrastRatio(bg, fg, this._optionsService.options.minimumContrastRatio);\n this._colors.contrastCache.setColor(this._workCell.bg, this._workCell.fg, adjustedColor ?? null);\n }\n\n if (adjustedColor) {\n this._addStyle(element, `color:${adjustedColor.css}`);\n return true;\n }\n\n return false;\n }\n\n private _addStyle(element: HTMLElement, style: string): void {\n element.setAttribute('style', `${element.getAttribute('style') || ''}${style};`);\n }\n}\n\nfunction padStart(text: string, padChar: string, length: number): string {\n while (text.length < length) {\n text = padChar + text;\n }\n return text;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService } from 'common/services/Services';\n\n/**\n * Represents a selection within the buffer. This model only cares about column\n * and row coordinates, not wide characters.\n */\nexport class SelectionModel {\n /**\n * Whether select all is currently active.\n */\n public isSelectAllActive: boolean = false;\n\n /**\n * The minimal length of the selection from the start position. When double\n * clicking on a word, the word will be selected which makes the selection\n * start at the start of the word and makes this variable the length.\n */\n public selectionStartLength: number = 0;\n\n /**\n * The [x, y] position the selection starts at.\n */\n public selectionStart: [number, number] | undefined;\n\n /**\n * The [x, y] position the selection ends at.\n */\n public selectionEnd: [number, number] | undefined;\n\n constructor(\n private _bufferService: IBufferService\n ) {\n }\n\n /**\n * Clears the current selection.\n */\n public clearSelection(): void {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n }\n\n /**\n * The final selection start, taking into consideration select all.\n */\n public get finalSelectionStart(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [0, 0];\n }\n\n if (!this.selectionEnd || !this.selectionStart) {\n return this.selectionStart;\n }\n\n return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;\n }\n\n /**\n * The final selection end, taking into consideration select all, double click\n * word selection and triple click line selection.\n */\n public get finalSelectionEnd(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];\n }\n\n if (!this.selectionStart) {\n return undefined;\n }\n\n // Use the selection start + length if the end doesn't exist or they're reversed\n if (!this.selectionEnd || this.areSelectionValuesReversed()) {\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [startPlusLength, this.selectionStart[1]];\n }\n\n // Ensure the the word/line is selected after a double/triple click\n if (this.selectionStartLength) {\n // Select the larger of the two when start and end are on the same line\n if (this.selectionEnd[1] === this.selectionStart[1]) {\n return [Math.max(this.selectionStart[0] + this.selectionStartLength, this.selectionEnd[0]), this.selectionEnd[1]];\n }\n }\n return this.selectionEnd;\n }\n\n /**\n * Returns whether the selection start and end are reversed.\n */\n public areSelectionValuesReversed(): boolean {\n const start = this.selectionStart;\n const end = this.selectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n * @return Whether a refresh is necessary.\n */\n public onTrim(amount: number): boolean {\n // Adjust the selection position based on the trimmed amount.\n if (this.selectionStart) {\n this.selectionStart[1] -= amount;\n }\n if (this.selectionEnd) {\n this.selectionEnd[1] -= amount;\n }\n\n // The selection has moved off the buffer, clear it.\n if (this.selectionEnd && this.selectionEnd[1] < 0) {\n this.clearSelection();\n return true;\n }\n\n // If the selection start is trimmed, ensure the start column is 0.\n if (this.selectionStart && this.selectionStart[1] < 0) {\n this.selectionStart[1] = 0;\n }\n return false;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService } from 'common/services/Services';\nimport { IEvent, EventEmitter } from 'common/EventEmitter';\nimport { ICharSizeService } from 'browser/services/Services';\n\nexport class CharSizeService implements ICharSizeService {\n public serviceBrand: undefined;\n\n public width: number = 0;\n public height: number = 0;\n private _measureStrategy: IMeasureStrategy;\n\n public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }\n\n private _onCharSizeChange = new EventEmitter();\n public get onCharSizeChange(): IEvent { return this._onCharSizeChange.event; }\n\n constructor(\n document: Document,\n parentElement: HTMLElement,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n this._measureStrategy = new DomMeasureStrategy(document, parentElement, this._optionsService);\n }\n\n public measure(): void {\n const result = this._measureStrategy.measure();\n if (result.width !== this.width || result.height !== this.height) {\n this.width = result.width;\n this.height = result.height;\n this._onCharSizeChange.fire();\n }\n }\n}\n\ninterface IMeasureStrategy {\n measure(): IReadonlyMeasureResult;\n}\n\ninterface IReadonlyMeasureResult {\n readonly width: number;\n readonly height: number;\n}\n\ninterface IMeasureResult {\n width: number;\n height: number;\n}\n\n// TODO: For supporting browsers we should also provide a CanvasCharDimensionsProvider that uses ctx.measureText\nclass DomMeasureStrategy implements IMeasureStrategy {\n private _result: IMeasureResult = { width: 0, height: 0 };\n private _measureElement: HTMLElement;\n\n constructor(\n private _document: Document,\n private _parentElement: HTMLElement,\n private _optionsService: IOptionsService\n ) {\n this._measureElement = this._document.createElement('span');\n this._measureElement.classList.add('xterm-char-measure-element');\n this._measureElement.textContent = 'W';\n this._measureElement.setAttribute('aria-hidden', 'true');\n this._parentElement.appendChild(this._measureElement);\n }\n\n public measure(): IReadonlyMeasureResult {\n this._measureElement.style.fontFamily = this._optionsService.options.fontFamily;\n this._measureElement.style.fontSize = `${this._optionsService.options.fontSize}px`;\n\n // Note that this triggers a synchronous layout\n const geometry = this._measureElement.getBoundingClientRect();\n\n // If values are 0 then the element is likely currently display:none, in which case we should\n // retain the previous value.\n if (geometry.width !== 0 && geometry.height !== 0) {\n this._result.width = geometry.width;\n this._result.height = Math.ceil(geometry.height);\n }\n\n return this._result;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService } from './Services';\n\nexport class CoreBrowserService implements ICoreBrowserService {\n public serviceBrand: undefined;\n\n constructor(\n private _textarea: HTMLTextAreaElement\n ) {\n }\n\n public get isFocused(): boolean {\n const docOrShadowRoot = this._textarea.getRootNode ? this._textarea.getRootNode() as Document | ShadowRoot : document;\n return docOrShadowRoot.activeElement === this._textarea && document.hasFocus();\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharSizeService, IRenderService, IMouseService } from './Services';\nimport { getCoords, getRawByteCoords } from 'browser/input/Mouse';\n\nexport class MouseService implements IMouseService {\n public serviceBrand: undefined;\n\n constructor(\n @IRenderService private readonly _renderService: IRenderService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService\n ) {\n }\n\n public getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined {\n return getCoords(\n event,\n element,\n colCount,\n rowCount,\n this._charSizeService.hasValidSize,\n this._renderService.dimensions.actualCellWidth,\n this._renderService.dimensions.actualCellHeight,\n isSelection\n );\n }\n\n public getRawByteCoords(event: MouseEvent, element: HTMLElement, colCount: number, rowCount: number): { x: number, y: number } | undefined {\n const coords = this.getCoords(event, element, colCount, rowCount);\n return getRawByteCoords(coords);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderer, IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types';\nimport { RenderDebouncer } from 'browser/RenderDebouncer';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { ScreenDprMonitor } from 'browser/ScreenDprMonitor';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IColorSet } from 'browser/Types';\nimport { IOptionsService, IBufferService } from 'common/services/Services';\nimport { ICharSizeService, IRenderService } from 'browser/services/Services';\n\ninterface ISelectionState {\n start: [number, number] | undefined;\n end: [number, number] | undefined;\n columnSelectMode: boolean;\n}\n\nexport class RenderService extends Disposable implements IRenderService {\n public serviceBrand: undefined;\n\n private _renderDebouncer: RenderDebouncer;\n private _screenDprMonitor: ScreenDprMonitor;\n\n private _isPaused: boolean = false;\n private _needsFullRefresh: boolean = false;\n private _isNextRenderRedrawOnly: boolean = true;\n private _needsSelectionRefresh: boolean = false;\n private _canvasWidth: number = 0;\n private _canvasHeight: number = 0;\n private _selectionState: ISelectionState = {\n start: undefined,\n end: undefined,\n columnSelectMode: false\n };\n\n private _onDimensionsChange = new EventEmitter();\n public get onDimensionsChange(): IEvent { return this._onDimensionsChange.event; }\n private _onRender = new EventEmitter<{ start: number, end: number }>();\n public get onRenderedBufferChange(): IEvent<{ start: number, end: number }> { return this._onRender.event; }\n private _onRefreshRequest = new EventEmitter<{ start: number, end: number }>();\n public get onRefreshRequest(): IEvent<{ start: number, end: number }> { return this._onRefreshRequest.event; }\n\n public get dimensions(): IRenderDimensions { return this._renderer.dimensions; }\n\n constructor(\n private _renderer: IRenderer,\n private _rowCount: number,\n screenElement: HTMLElement,\n @IOptionsService optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IBufferService bufferService: IBufferService\n ) {\n super();\n\n this.register({ dispose: () => this._renderer.dispose() });\n\n this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end));\n this.register(this._renderDebouncer);\n\n this._screenDprMonitor = new ScreenDprMonitor();\n this._screenDprMonitor.setListener(() => this.onDevicePixelRatioChange());\n this.register(this._screenDprMonitor);\n\n this.register(bufferService.onResize(e => this._fullRefresh()));\n this.register(optionsService.onOptionChange(() => this._renderer.onOptionsChanged()));\n this.register(this._charSizeService.onCharSizeChange(() => this.onCharSizeChanged()));\n\n // No need to register this as renderer is explicitly disposed in RenderService.dispose\n this._renderer.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));\n\n // dprchange should handle this case, we need this as well for browsers that don't support the\n // matchMedia query.\n this.register(addDisposableDomListener(window, 'resize', () => this.onDevicePixelRatioChange()));\n\n // Detect whether IntersectionObserver is detected and enable renderer pause\n // and resume based on terminal visibility if so\n if ('IntersectionObserver' in window) {\n const observer = new IntersectionObserver(e => this._onIntersectionChange(e[e.length - 1]), { threshold: 0 });\n observer.observe(screenElement);\n this.register({ dispose: () => observer.disconnect() });\n }\n }\n\n private _onIntersectionChange(entry: IntersectionObserverEntry): void {\n this._isPaused = entry.isIntersecting === undefined ? (entry.intersectionRatio === 0) : !entry.isIntersecting;\n\n // Terminal was hidden on open\n if (!this._isPaused && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n\n if (!this._isPaused && this._needsFullRefresh) {\n this.refreshRows(0, this._rowCount - 1);\n this._needsFullRefresh = false;\n }\n }\n\n public refreshRows(start: number, end: number, isRedrawOnly: boolean = false): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n return;\n }\n if (!isRedrawOnly) {\n this._isNextRenderRedrawOnly = false;\n }\n this._renderDebouncer.refresh(start, end, this._rowCount);\n }\n\n private _renderRows(start: number, end: number): void {\n this._renderer.renderRows(start, end);\n\n // Update selection if needed\n if (this._needsSelectionRefresh) {\n this._renderer.onSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode);\n this._needsSelectionRefresh = false;\n }\n\n // Fire render event only if it was not a redraw\n if (!this._isNextRenderRedrawOnly) {\n this._onRender.fire({ start, end });\n }\n this._isNextRenderRedrawOnly = true;\n }\n\n public resize(cols: number, rows: number): void {\n this._rowCount = rows;\n this._fireOnCanvasResize();\n }\n\n public changeOptions(): void {\n this._renderer.onOptionsChanged();\n this.refreshRows(0, this._rowCount - 1);\n this._fireOnCanvasResize();\n }\n\n private _fireOnCanvasResize(): void {\n // Don't fire the event if the dimensions haven't changed\n if (this._renderer.dimensions.canvasWidth === this._canvasWidth && this._renderer.dimensions.canvasHeight === this._canvasHeight) {\n return;\n }\n this._onDimensionsChange.fire(this._renderer.dimensions);\n }\n\n public dispose(): void {\n super.dispose();\n }\n\n public setRenderer(renderer: IRenderer): void {\n // TODO: RenderService should be the only one to dispose the renderer\n this._renderer.dispose();\n this._renderer = renderer;\n this._renderer.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));\n\n // Force a refresh\n this._needsSelectionRefresh = true;\n this._fullRefresh();\n }\n\n private _fullRefresh(): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n } else {\n this.refreshRows(0, this._rowCount - 1);\n }\n }\n\n public setColors(colors: IColorSet): void {\n this._renderer.setColors(colors);\n this._fullRefresh();\n }\n\n public onDevicePixelRatioChange(): void {\n // Force char size measurement as DomMeasureStrategy(getBoundingClientRect) is not stable\n // when devicePixelRatio changes\n this._charSizeService.measure();\n\n this._renderer.onDevicePixelRatioChange();\n this.refreshRows(0, this._rowCount - 1);\n }\n\n public onResize(cols: number, rows: number): void {\n this._renderer.onResize(cols, rows);\n this._fullRefresh();\n }\n\n // TODO: Is this useful when we have onResize?\n public onCharSizeChanged(): void {\n this._renderer.onCharSizeChanged();\n }\n\n public onBlur(): void {\n this._renderer.onBlur();\n }\n\n public onFocus(): void {\n this._renderer.onFocus();\n }\n\n public onSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionState.start = start;\n this._selectionState.end = end;\n this._selectionState.columnSelectMode = columnSelectMode;\n this._renderer.onSelectionChanged(start, end, columnSelectMode);\n }\n\n public onCursorMove(): void {\n this._renderer.onCursorMove();\n }\n\n public clear(): void {\n this._renderer.clear();\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number {\n return this._renderer.registerCharacterJoiner(handler);\n }\n\n public deregisterCharacterJoiner(joinerId: number): boolean {\n return this._renderer.deregisterCharacterJoiner(joinerId);\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IBufferLine, IDisposable } from 'common/Types';\nimport * as Browser from 'common/Platform';\nimport { SelectionModel } from 'browser/selection/SelectionModel';\nimport { CellData } from 'common/buffer/CellData';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { ICharSizeService, IMouseService, ISelectionService, IRenderService } from 'browser/services/Services';\nimport { IBufferService, IOptionsService, ICoreService } from 'common/services/Services';\nimport { getCoordsRelativeToElement } from 'browser/input/Mouse';\nimport { moveToCellSequence } from 'browser/input/MoveToCell';\nimport { Disposable } from 'common/Lifecycle';\n\n/**\n * The number of pixels the mouse needs to be above or below the viewport in\n * order to scroll at the maximum speed.\n */\nconst DRAG_SCROLL_MAX_THRESHOLD = 50;\n\n/**\n * The maximum scrolling speed\n */\nconst DRAG_SCROLL_MAX_SPEED = 15;\n\n/**\n * The number of milliseconds between drag scroll updates.\n */\nconst DRAG_SCROLL_INTERVAL = 50;\n\n/**\n * The maximum amount of time that can have elapsed for an alt click to move the\n * cursor.\n */\nconst ALT_CLICK_MOVE_CURSOR_TIME = 500;\n\nconst NON_BREAKING_SPACE_CHAR = String.fromCharCode(160);\nconst ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g');\n\n/**\n * Represents a position of a word on a line.\n */\ninterface IWordPosition {\n start: number;\n length: number;\n}\n\n/**\n * A selection mode, this drives how the selection behaves on mouse move.\n */\nexport const enum SelectionMode {\n NORMAL,\n WORD,\n LINE,\n COLUMN\n}\n\n/**\n * A class that manages the selection of the terminal. With help from\n * SelectionModel, SelectionService handles with all logic associated with\n * dealing with the selection, including handling mouse interaction, wide\n * characters and fetching the actual text within the selection. Rendering is\n * not handled by the SelectionService but the onRedrawRequest event is fired\n * when the selection is ready to be redrawn (on an animation frame).\n */\nexport class SelectionService extends Disposable implements ISelectionService {\n public serviceBrand: undefined;\n\n protected _model: SelectionModel;\n\n /**\n * The amount to scroll every drag scroll update (depends on how far the mouse\n * drag is above or below the terminal).\n */\n private _dragScrollAmount: number = 0;\n\n /**\n * The current selection mode.\n */\n protected _activeSelectionMode: SelectionMode;\n\n /**\n * A setInterval timer that is active while the mouse is down whose callback\n * scrolls the viewport when necessary.\n */\n private _dragScrollIntervalTimer: number | undefined;\n\n /**\n * The animation frame ID used for refreshing the selection.\n */\n private _refreshAnimationFrame: number | undefined;\n\n /**\n * Whether selection is enabled.\n */\n private _enabled = true;\n\n private _mouseMoveListener: EventListener;\n private _mouseUpListener: EventListener;\n private _trimListener: IDisposable;\n private _workCell: CellData = new CellData();\n\n private _mouseDownTimeStamp: number = 0;\n private _oldHasSelection: boolean = false;\n private _oldSelectionStart: [number, number] | undefined = undefined;\n private _oldSelectionEnd: [number, number] | undefined = undefined;\n\n private _onLinuxMouseSelection = this.register(new EventEmitter());\n public get onLinuxMouseSelection(): IEvent { return this._onLinuxMouseSelection.event; }\n private _onRedrawRequest = this.register(new EventEmitter());\n public get onRequestRedraw(): IEvent { return this._onRedrawRequest.event; }\n private _onSelectionChange = this.register(new EventEmitter());\n public get onSelectionChange(): IEvent { return this._onSelectionChange.event; }\n private _onRequestScrollLines = this.register(new EventEmitter());\n public get onRequestScrollLines(): IEvent { return this._onRequestScrollLines.event; }\n\n constructor(\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @IMouseService private readonly _mouseService: IMouseService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n // Init listeners\n this._mouseMoveListener = event => this._onMouseMove(event);\n this._mouseUpListener = event => this._onMouseUp(event);\n this._coreService.onUserInput(() => {\n if (this.hasSelection) {\n this.clearSelection();\n }\n });\n this._trimListener = this._bufferService.buffer.lines.onTrim(amount => this._onTrim(amount));\n this.register(this._bufferService.buffers.onBufferActivate(e => this._onBufferActivate(e)));\n\n this.enable();\n\n this._model = new SelectionModel(this._bufferService);\n this._activeSelectionMode = SelectionMode.NORMAL;\n }\n\n public dispose(): void {\n this._removeMouseDownListeners();\n }\n\n public reset(): void {\n this.clearSelection();\n }\n\n /**\n * Disables the selection manager. This is useful for when terminal mouse\n * are enabled.\n */\n public disable(): void {\n this.clearSelection();\n this._enabled = false;\n }\n\n /**\n * Enable the selection manager.\n */\n public enable(): void {\n this._enabled = true;\n }\n\n public get selectionStart(): [number, number] | undefined { return this._model.finalSelectionStart; }\n public get selectionEnd(): [number, number] | undefined { return this._model.finalSelectionEnd; }\n\n /**\n * Gets whether there is an active text selection.\n */\n public get hasSelection(): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }\n\n /**\n * Gets the text currently selected.\n */\n public get selectionText(): string {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return '';\n }\n\n const buffer = this._bufferService.buffer;\n const result: string[] = [];\n\n if (this._activeSelectionMode === SelectionMode.COLUMN) {\n // Ignore zero width selections\n if (start[0] === end[0]) {\n return '';\n }\n\n for (let i = start[1]; i <= end[1]; i++) {\n const lineText = buffer.translateBufferLineToString(i, true, start[0], end[0]);\n result.push(lineText);\n }\n } else {\n // Get first row\n const startRowEndCol = start[1] === end[1] ? end[0] : undefined;\n result.push(buffer.translateBufferLineToString(start[1], true, start[0], startRowEndCol));\n\n // Get middle rows\n for (let i = start[1] + 1; i <= end[1] - 1; i++) {\n const bufferLine = buffer.lines.get(i);\n const lineText = buffer.translateBufferLineToString(i, true);\n if (bufferLine && bufferLine.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n\n // Get final row\n if (start[1] !== end[1]) {\n const bufferLine = buffer.lines.get(end[1]);\n const lineText = buffer.translateBufferLineToString(end[1], true, 0, end[0]);\n if (bufferLine && bufferLine!.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n }\n\n // Format string by replacing non-breaking space chars with regular spaces\n // and joining the array into a multi-line string.\n const formattedResult = result.map(line => {\n return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');\n }).join(Browser.isWindows ? '\\r\\n' : '\\n');\n\n return formattedResult;\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Queues a refresh, redrawing the selection on the next opportunity.\n * @param isLinuxMouseSelection Whether the selection should be registered as a new\n * selection on Linux.\n */\n public refresh(isLinuxMouseSelection?: boolean): void {\n // Queue the refresh for the renderer\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = window.requestAnimationFrame(() => this._refresh());\n }\n\n // If the platform is Linux and the refresh call comes from a mouse event,\n // we need to update the selection for middle click to paste selection.\n if (Browser.isLinux && isLinuxMouseSelection) {\n const selectionText = this.selectionText;\n if (selectionText.length) {\n this._onLinuxMouseSelection.fire(this.selectionText);\n }\n }\n }\n\n /**\n * Fires the refresh event, causing consumers to pick it up and redraw the\n * selection state.\n */\n private _refresh(): void {\n this._refreshAnimationFrame = undefined;\n this._onRedrawRequest.fire({\n start: this._model.finalSelectionStart,\n end: this._model.finalSelectionEnd,\n columnSelectMode: this._activeSelectionMode === SelectionMode.COLUMN\n });\n }\n\n /**\n * Checks if the current click was inside the current selection\n * @param event The mouse event\n */\n private _isClickInSelection(event: MouseEvent): boolean {\n const coords = this._getMouseBufferCoords(event);\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n\n if (!start || !end || !coords) {\n return false;\n }\n\n return this._areCoordsInSelection(coords, start, end);\n }\n\n protected _areCoordsInSelection(coords: [number, number], start: [number, number], end: [number, number]): boolean {\n return (coords[1] > start[1] && coords[1] < end[1]) ||\n (start[1] === end[1] && coords[1] === start[1] && coords[0] >= start[0] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === end[1] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === start[1] && coords[0] >= start[0]);\n }\n\n /**\n * Selects word at the current mouse event coordinates.\n * @param event The mouse event.\n */\n private _selectWordAtCursor(event: MouseEvent): void {\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._selectWordAt(coords, false);\n this._model.selectionEnd = undefined;\n this.refresh(true);\n }\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._model.isSelectAllActive = true;\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n public selectLines(start: number, end: number): void {\n this._model.clearSelection();\n start = Math.max(start, 0);\n end = Math.min(end, this._bufferService.buffer.lines.length - 1);\n this._model.selectionStart = [0, start];\n this._model.selectionEnd = [this._bufferService.cols, end];\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n */\n private _onTrim(amount: number): void {\n const needsRefresh = this._model.onTrim(amount);\n if (needsRefresh) {\n this.refresh();\n }\n }\n\n /**\n * Gets the 0-based [x, y] buffer coordinates of the current mouse event.\n * @param event The mouse event.\n */\n private _getMouseBufferCoords(event: MouseEvent): [number, number] | undefined {\n const coords = this._mouseService.getCoords(event, this._screenElement, this._bufferService.cols, this._bufferService.rows, true);\n if (!coords) {\n return undefined;\n }\n\n // Convert to 0-based\n coords[0]--;\n coords[1]--;\n\n // Convert viewport coords to buffer coords\n coords[1] += this._bufferService.buffer.ydisp;\n return coords;\n }\n\n /**\n * Gets the amount the viewport should be scrolled based on how far out of the\n * terminal the mouse is.\n * @param event The mouse event.\n */\n private _getMouseEventScrollAmount(event: MouseEvent): number {\n let offset = getCoordsRelativeToElement(event, this._screenElement)[1];\n const terminalHeight = this._renderService.dimensions.canvasHeight;\n if (offset >= 0 && offset <= terminalHeight) {\n return 0;\n }\n if (offset > terminalHeight) {\n offset -= terminalHeight;\n }\n\n offset = Math.min(Math.max(offset, -DRAG_SCROLL_MAX_THRESHOLD), DRAG_SCROLL_MAX_THRESHOLD);\n offset /= DRAG_SCROLL_MAX_THRESHOLD;\n return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1));\n }\n\n /**\n * Returns whether the selection manager should force selection, regardless of\n * whether the terminal is in mouse events mode.\n * @param event The mouse event.\n */\n public shouldForceSelection(event: MouseEvent): boolean {\n if (Browser.isMac) {\n return event.altKey && this._optionsService.options.macOptionClickForcesSelection;\n }\n\n return event.shiftKey;\n }\n\n /**\n * Handles te mousedown event, setting up for a new selection.\n * @param event The mousedown event.\n */\n public onMouseDown(event: MouseEvent): void {\n this._mouseDownTimeStamp = event.timeStamp;\n // If we have selection, we want the context menu on right click even if the\n // terminal is in mouse mode.\n if (event.button === 2 && this.hasSelection) {\n return;\n }\n\n // Only action the primary button\n if (event.button !== 0) {\n return;\n }\n\n // Allow selection when using a specific modifier key, even when disabled\n if (!this._enabled) {\n if (!this.shouldForceSelection(event)) {\n return;\n }\n\n // Don't send the mouse down event to the current process, we want to select\n event.stopPropagation();\n }\n\n // Tell the browser not to start a regular selection\n event.preventDefault();\n\n // Reset drag scroll state\n this._dragScrollAmount = 0;\n\n if (this._enabled && event.shiftKey) {\n this._onIncrementalClick(event);\n } else {\n if (event.detail === 1) {\n this._onSingleClick(event);\n } else if (event.detail === 2) {\n this._onDoubleClick(event);\n } else if (event.detail === 3) {\n this._onTripleClick(event);\n }\n }\n\n this._addMouseDownListeners();\n this.refresh(true);\n }\n\n /**\n * Adds listeners when mousedown is triggered.\n */\n private _addMouseDownListeners(): void {\n // Listen on the document so that dragging outside of viewport works\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.addEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.addEventListener('mouseup', this._mouseUpListener);\n }\n this._dragScrollIntervalTimer = window.setInterval(() => this._dragScroll(), DRAG_SCROLL_INTERVAL);\n }\n\n /**\n * Removes the listeners that are registered when mousedown is triggered.\n */\n private _removeMouseDownListeners(): void {\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.removeEventListener('mouseup', this._mouseUpListener);\n }\n clearInterval(this._dragScrollIntervalTimer);\n this._dragScrollIntervalTimer = undefined;\n }\n\n /**\n * Performs an incremental click, setting the selection end position to the mouse\n * position.\n * @param event The mouse event.\n */\n private _onIncrementalClick(event: MouseEvent): void {\n if (this._model.selectionStart) {\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n }\n }\n\n /**\n * Performs a single click, resetting relevant state and setting the selection\n * start position.\n * @param event The mouse event.\n */\n private _onSingleClick(event: MouseEvent): void {\n this._model.selectionStartLength = 0;\n this._model.isSelectAllActive = false;\n this._activeSelectionMode = this.shouldColumnSelect(event) ? SelectionMode.COLUMN : SelectionMode.NORMAL;\n\n // Initialize the new selection\n this._model.selectionStart = this._getMouseBufferCoords(event);\n if (!this._model.selectionStart) {\n return;\n }\n this._model.selectionEnd = undefined;\n\n // Ensure the line exists\n const line = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);\n if (!line) {\n return;\n }\n\n // Return early if the click event is not in the buffer (eg. in scroll bar)\n if (line.length === this._model.selectionStart[0]) {\n return;\n }\n\n // If the mouse is over the second half of a wide character, adjust the\n // selection to cover the whole character\n if (line.hasWidth(this._model.selectionStart[0]) === 0) {\n this._model.selectionStart[0]++;\n }\n }\n\n /**\n * Performs a double click, selecting the current work.\n * @param event The mouse event.\n */\n private _onDoubleClick(event: MouseEvent): void {\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.WORD;\n this._selectWordAt(coords, true);\n }\n }\n\n /**\n * Performs a triple click, selecting the current line and activating line\n * select mode.\n * @param event The mouse event.\n */\n private _onTripleClick(event: MouseEvent): void {\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.LINE;\n this._selectLineAt(coords[1]);\n }\n }\n\n /**\n * Returns whether the selection manager should operate in column select mode\n * @param event the mouse or keyboard event\n */\n public shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean {\n return event.altKey && !(Browser.isMac && this._optionsService.options.macOptionClickForcesSelection);\n }\n\n /**\n * Handles the mousemove event when the mouse button is down, recording the\n * end of the selection and refreshing the selection.\n * @param event The mousemove event.\n */\n private _onMouseMove(event: MouseEvent): void {\n // If the mousemove listener is active it means that a selection is\n // currently being made, we should stop propagation to prevent mouse events\n // to be sent to the pty.\n event.stopImmediatePropagation();\n\n // Do nothing if there is no selection start, this can happen if the first\n // click in the terminal is an incremental click\n if (!this._model.selectionStart) {\n return;\n }\n\n // Record the previous position so we know whether to redraw the selection\n // at the end.\n const previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;\n\n // Set the initial selection end based on the mouse coordinates\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n if (!this._model.selectionEnd) {\n this.refresh(true);\n return;\n }\n\n // Select the entire line if line select mode is active.\n if (this._activeSelectionMode === SelectionMode.LINE) {\n if (this._model.selectionEnd[1] < this._model.selectionStart[1]) {\n this._model.selectionEnd[0] = 0;\n } else {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n } else if (this._activeSelectionMode === SelectionMode.WORD) {\n this._selectToWordAt(this._model.selectionEnd);\n }\n\n // Determine the amount of scrolling that will happen.\n this._dragScrollAmount = this._getMouseEventScrollAmount(event);\n\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n } else if (this._dragScrollAmount < 0) {\n this._model.selectionEnd[0] = 0;\n }\n }\n\n // If the character is a wide character include the cell to the right in the\n // selection. Note that selections at the very end of the line will never\n // have a character.\n const buffer = this._bufferService.buffer;\n if (this._model.selectionEnd[1] < buffer.lines.length) {\n const line = buffer.lines.get(this._model.selectionEnd[1]);\n if (line && line.hasWidth(this._model.selectionEnd[0]) === 0) {\n this._model.selectionEnd[0]++;\n }\n }\n\n // Only draw here if the selection changes.\n if (!previousSelectionEnd ||\n previousSelectionEnd[0] !== this._model.selectionEnd[0] ||\n previousSelectionEnd[1] !== this._model.selectionEnd[1]) {\n this.refresh(true);\n }\n }\n\n /**\n * The callback that occurs every DRAG_SCROLL_INTERVAL ms that does the\n * scrolling of the viewport.\n */\n private _dragScroll(): void {\n if (!this._model.selectionEnd || !this._model.selectionStart) {\n return;\n }\n if (this._dragScrollAmount) {\n this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: false });\n // Re-evaluate selection\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n const buffer = this._bufferService.buffer;\n if (this._dragScrollAmount > 0) {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);\n } else {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = 0;\n }\n this._model.selectionEnd[1] = buffer.ydisp;\n }\n this.refresh();\n }\n }\n\n /**\n * Handles the mouseup event, removing the mousedown listeners.\n * @param event The mouseup event.\n */\n private _onMouseUp(event: MouseEvent): void {\n const timeElapsed = event.timeStamp - this._mouseDownTimeStamp;\n\n this._removeMouseDownListeners();\n\n if (this.selectionText.length <= 1 && timeElapsed < ALT_CLICK_MOVE_CURSOR_TIME && event.altKey && this._optionsService.getOption('altClickMovesCursor')) {\n if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {\n const coordinates = this._mouseService.getCoords(\n event,\n this._element,\n this._bufferService.cols,\n this._bufferService.rows,\n false\n );\n if (coordinates && coordinates[0] !== undefined && coordinates[1] !== undefined) {\n const sequence = moveToCellSequence(coordinates[0] - 1, coordinates[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);\n this._coreService.triggerDataEvent(sequence, true);\n }\n }\n } else {\n this._fireEventIfSelectionChanged();\n }\n }\n\n private _fireEventIfSelectionChanged(): void {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n const hasSelection = !!start && !!end && (start[0] !== end[0] || start[1] !== end[1]);\n\n if (!hasSelection) {\n if (this._oldHasSelection) {\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n return;\n }\n\n // Sanity check, these should not be undefined as there is a selection\n if (!start || !end) {\n return;\n }\n\n if (!this._oldSelectionStart || !this._oldSelectionEnd || (\n start[0] !== this._oldSelectionStart[0] || start[1] !== this._oldSelectionStart[1] ||\n end[0] !== this._oldSelectionEnd[0] || end[1] !== this._oldSelectionEnd[1])) {\n\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n }\n\n private _fireOnSelectionChange(start: [number, number] | undefined, end: [number, number] | undefined, hasSelection: boolean): void {\n this._oldSelectionStart = start;\n this._oldSelectionEnd = end;\n this._oldHasSelection = hasSelection;\n this._onSelectionChange.fire();\n }\n\n private _onBufferActivate(e: {activeBuffer: IBuffer, inactiveBuffer: IBuffer}): void {\n this.clearSelection();\n // Only adjust the selection on trim, shiftElements is rarely used (only in\n // reverseIndex) and delete in a splice is only ever used when the same\n // number of elements was just added. Given this is could actually be\n // beneficial to leave the selection as is for these cases.\n this._trimListener.dispose();\n this._trimListener = e.activeBuffer.lines.onTrim(amount => this._onTrim(amount));\n }\n\n /**\n * Converts a viewport column to the character index on the buffer line, the\n * latter takes into account wide characters.\n * @param coords The coordinates to find the 2 index for.\n */\n private _convertViewportColToCharacterIndex(bufferLine: IBufferLine, coords: [number, number]): number {\n let charIndex = coords[0];\n for (let i = 0; coords[0] >= i; i++) {\n const length = bufferLine.loadCell(i, this._workCell).getChars().length;\n if (this._workCell.getWidth() === 0) {\n // Wide characters aren't included in the line string so decrement the\n // index so the index is back on the wide character.\n charIndex--;\n } else if (length > 1 && coords[0] !== i) {\n // Emojis take up multiple characters, so adjust accordingly. For these\n // we don't want ot include the character at the column as we're\n // returning the start index in the string, not the end index.\n charIndex += length - 1;\n }\n }\n return charIndex;\n }\n\n public setSelection(col: number, row: number, length: number): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this._model.selectionStart = [col, row];\n this._model.selectionStartLength = length;\n this.refresh();\n }\n\n public rightClickSelect(ev: MouseEvent): void {\n if (!this._isClickInSelection(ev)) {\n this._selectWordAtCursor(ev);\n this._fireEventIfSelectionChanged();\n }\n }\n\n /**\n * Gets positional information for the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _getWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean, followWrappedLinesAbove: boolean = true, followWrappedLinesBelow: boolean = true): IWordPosition | undefined {\n // Ensure coords are within viewport (eg. not within scroll bar)\n if (coords[0] >= this._bufferService.cols) {\n return undefined;\n }\n\n const buffer = this._bufferService.buffer;\n const bufferLine = buffer.lines.get(coords[1]);\n if (!bufferLine) {\n return undefined;\n }\n\n const line = buffer.translateBufferLineToString(coords[1], false);\n\n // Get actual index, taking into consideration wide characters\n let startIndex = this._convertViewportColToCharacterIndex(bufferLine, coords);\n let endIndex = startIndex;\n\n // Record offset to be used later\n const charOffset = coords[0] - startIndex;\n let leftWideCharCount = 0;\n let rightWideCharCount = 0;\n let leftLongCharOffset = 0;\n let rightLongCharOffset = 0;\n\n if (line.charAt(startIndex) === ' ') {\n // Expand until non-whitespace is hit\n while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') {\n startIndex--;\n }\n while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') {\n endIndex++;\n }\n } else {\n // Expand until whitespace is hit. This algorithm works by scanning left\n // and right from the starting position, keeping both the index format\n // (line) and the column format (bufferLine) in sync. When a wide\n // character is hit, it is recorded and the column index is adjusted.\n let startCol = coords[0];\n let endCol = coords[0];\n\n // Consider the initial position, skip it and increment the wide char\n // variable\n if (bufferLine.getWidth(startCol) === 0) {\n leftWideCharCount++;\n startCol--;\n }\n if (bufferLine.getWidth(endCol) === 2) {\n rightWideCharCount++;\n endCol++;\n }\n\n // Adjust the end index for characters whose length are > 1 (emojis)\n const length = bufferLine.getString(endCol).length;\n if (length > 1) {\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n\n // Expand the string in both directions until a space is hit\n while (startCol > 0 && startIndex > 0 && !this._isCharWordSeparator(bufferLine.loadCell(startCol - 1, this._workCell))) {\n bufferLine.loadCell(startCol - 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 0) {\n // If the next character is a wide char, record it and skip the column\n leftWideCharCount++;\n startCol--;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n leftLongCharOffset += length - 1;\n startIndex -= length - 1;\n }\n startIndex--;\n startCol--;\n }\n while (endCol < bufferLine.length && endIndex + 1 < line.length && !this._isCharWordSeparator(bufferLine.loadCell(endCol + 1, this._workCell))) {\n bufferLine.loadCell(endCol + 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 2) {\n // If the next character is a wide char, record it and skip the column\n rightWideCharCount++;\n endCol++;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n endIndex++;\n endCol++;\n }\n }\n\n // Incremenet the end index so it is at the start of the next character\n endIndex++;\n\n // Calculate the start _column_, converting the the string indexes back to\n // column coordinates.\n let start =\n startIndex // The index of the selection's start char in the line string\n + charOffset // The difference between the initial char's column and index\n - leftWideCharCount // The number of wide chars left of the initial char\n + leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n\n // Calculate the length in _columns_, converting the the string indexes back\n // to column coordinates.\n let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols\n endIndex // The index of the selection's end char in the line string\n - startIndex // The index of the selection's start char in the line string\n + leftWideCharCount // The number of wide chars left of the initial char\n + rightWideCharCount // The number of wide chars right of the initial char (inclusive)\n - leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n - rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)\n\n if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {\n return undefined;\n }\n\n // Recurse upwards if the line is wrapped and the word wraps to the above line\n if (followWrappedLinesAbove) {\n if (start === 0 && bufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const previousBufferLine = buffer.lines.get(coords[1] - 1);\n if (previousBufferLine && bufferLine.isWrapped && previousBufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const previousLineWordPosition = this._getWordAt([this._bufferService.cols - 1, coords[1] - 1], false, true, false);\n if (previousLineWordPosition) {\n const offset = this._bufferService.cols - previousLineWordPosition.start;\n start -= offset;\n length += offset;\n }\n }\n }\n }\n\n // Recurse downwards if the line is wrapped and the word wraps to the next line\n if (followWrappedLinesBelow) {\n if (start + length === this._bufferService.cols && bufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const nextBufferLine = buffer.lines.get(coords[1] + 1);\n if (nextBufferLine && nextBufferLine.isWrapped && nextBufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const nextLineWordPosition = this._getWordAt([0, coords[1] + 1], false, false, true);\n if (nextLineWordPosition) {\n length += nextLineWordPosition.length;\n }\n }\n }\n }\n\n return { start, length };\n }\n\n /**\n * Selects the word at the coordinates specified.\n * @param coords The coordinates to get the word at.\n * @param allowWhitespaceOnlySelection If whitespace should be selected\n */\n protected _selectWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): void {\n const wordPosition = this._getWordAt(coords, allowWhitespaceOnlySelection);\n if (wordPosition) {\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n coords[1]--;\n }\n this._model.selectionStart = [wordPosition.start, coords[1]];\n this._model.selectionStartLength = wordPosition.length;\n }\n }\n\n /**\n * Sets the selection end to the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _selectToWordAt(coords: [number, number]): void {\n const wordPosition = this._getWordAt(coords, true);\n if (wordPosition) {\n let endRow = coords[1];\n\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n endRow--;\n }\n\n // Adjust wrapped length value, this only needs to happen when values are reversed as in that\n // case we're interested in the start of the word, not the end\n if (!this._model.areSelectionValuesReversed()) {\n while (wordPosition.start + wordPosition.length > this._bufferService.cols) {\n wordPosition.length -= this._bufferService.cols;\n endRow++;\n }\n }\n\n this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : wordPosition.start + wordPosition.length, endRow];\n }\n }\n\n /**\n * Gets whether the character is considered a word separator by the select\n * word logic.\n * @param char The character to check.\n */\n private _isCharWordSeparator(cell: CellData): boolean {\n // Zero width characters are never separators as they are always to the\n // right of wide characters\n if (cell.getWidth() === 0) {\n return false;\n }\n return this._optionsService.options.wordSeparator.indexOf(cell.getChars()) >= 0;\n }\n\n /**\n * Selects the line specified.\n * @param line The line index.\n */\n protected _selectLineAt(line: number): void {\n const wrappedRange = this._bufferService.buffer.getWrappedRangeForLine(line);\n this._model.selectionStart = [0, wrappedRange.first];\n this._model.selectionEnd = [this._bufferService.cols, wrappedRange.last];\n this._model.selectionStartLength = 0;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IEvent } from 'common/EventEmitter';\nimport { IRenderDimensions, IRenderer, CharacterJoinerHandler } from 'browser/renderer/Types';\nimport { IColorSet } from 'browser/Types';\nimport { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport { IDisposable } from 'common/Types';\n\nexport const ICharSizeService = createDecorator('CharSizeService');\nexport interface ICharSizeService {\n serviceBrand: undefined;\n\n readonly width: number;\n readonly height: number;\n readonly hasValidSize: boolean;\n\n readonly onCharSizeChange: IEvent;\n\n measure(): void;\n}\n\nexport const ICoreBrowserService = createDecorator('CoreBrowserService');\nexport interface ICoreBrowserService {\n serviceBrand: undefined;\n\n readonly isFocused: boolean;\n}\n\nexport const IMouseService = createDecorator('MouseService');\nexport interface IMouseService {\n serviceBrand: undefined;\n\n getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined;\n getRawByteCoords(event: MouseEvent, element: HTMLElement, colCount: number, rowCount: number): { x: number, y: number } | undefined;\n}\n\nexport const IRenderService = createDecorator('RenderService');\nexport interface IRenderService extends IDisposable {\n serviceBrand: undefined;\n\n onDimensionsChange: IEvent;\n /**\n * Fires when buffer changes are rendered. This does not fire when only cursor\n * or selections are rendered.\n */\n onRenderedBufferChange: IEvent<{ start: number, end: number }>;\n onRefreshRequest: IEvent<{ start: number, end: number }>;\n\n dimensions: IRenderDimensions;\n\n refreshRows(start: number, end: number): void;\n resize(cols: number, rows: number): void;\n changeOptions(): void;\n setRenderer(renderer: IRenderer): void;\n setColors(colors: IColorSet): void;\n onDevicePixelRatioChange(): void;\n onResize(cols: number, rows: number): void;\n // TODO: Is this useful when we have onResize?\n onCharSizeChanged(): void;\n onBlur(): void;\n onFocus(): void;\n onSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void;\n onCursorMove(): void;\n clear(): void;\n registerCharacterJoiner(handler: CharacterJoinerHandler): number;\n deregisterCharacterJoiner(joinerId: number): boolean;\n}\n\nexport const ISelectionService = createDecorator('SelectionService');\nexport interface ISelectionService {\n serviceBrand: undefined;\n\n readonly selectionText: string;\n readonly hasSelection: boolean;\n readonly selectionStart: [number, number] | undefined;\n readonly selectionEnd: [number, number] | undefined;\n\n readonly onLinuxMouseSelection: IEvent;\n readonly onRequestRedraw: IEvent;\n readonly onRequestScrollLines: IEvent;\n readonly onSelectionChange: IEvent;\n\n disable(): void;\n enable(): void;\n reset(): void;\n setSelection(row: number, col: number, length: number): void;\n selectAll(): void;\n selectLines(start: number, end: number): void;\n clearSelection(): void;\n rightClickSelect(event: MouseEvent): void;\n shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean;\n shouldForceSelection(event: MouseEvent): boolean;\n refresh(isLinuxMouseSelection?: boolean): void;\n onMouseDown(event: MouseEvent): void;\n}\n\nexport const ISoundService = createDecorator('SoundService');\nexport interface ISoundService {\n serviceBrand: undefined;\n\n playBellSound(): void;\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService } from 'common/services/Services';\nimport { ISoundService } from 'browser/services/Services';\n\nexport class SoundService implements ISoundService {\n public serviceBrand: undefined;\n\n private static _audioContext: AudioContext;\n\n public static get audioContext(): AudioContext | null {\n if (!SoundService._audioContext) {\n const audioContextCtor: typeof AudioContext = (window).AudioContext || (window).webkitAudioContext;\n if (!audioContextCtor) {\n console.warn('Web Audio API is not supported by this browser. Consider upgrading to the latest version');\n return null;\n }\n SoundService._audioContext = new audioContextCtor();\n }\n return SoundService._audioContext;\n }\n\n constructor(\n @IOptionsService private _optionsService: IOptionsService\n ) {\n }\n\n public playBellSound(): void {\n const ctx = SoundService.audioContext;\n if (!ctx) {\n return;\n }\n const bellAudioSource = ctx.createBufferSource();\n ctx.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)), (buffer) => {\n bellAudioSource.buffer = buffer;\n bellAudioSource.connect(ctx.destination);\n bellAudioSource.start(0);\n });\n }\n\n private _base64ToArrayBuffer(base64: string): ArrayBuffer {\n const binaryString = window.atob(base64);\n const len = binaryString.length;\n const bytes = new Uint8Array(len);\n\n for (let i = 0; i < len; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n\n return bytes.buffer;\n }\n\n private _removeMimeType(dataURI: string): string {\n // Split the input to get the mime-type and the data itself\n const splitUri = dataURI.split(',');\n\n // Return only the data\n return splitUri[1];\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICircularList } from 'common/Types';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\n\nexport interface IInsertEvent {\n index: number;\n amount: number;\n}\n\nexport interface IDeleteEvent {\n index: number;\n amount: number;\n}\n\n/**\n * Represents a circular list; a list with a maximum size that wraps around when push is called,\n * overriding values at the start of the list.\n */\nexport class CircularList implements ICircularList {\n protected _array: (T | undefined)[];\n private _startIndex: number;\n private _length: number;\n\n public onDeleteEmitter = new EventEmitter();\n public get onDelete(): IEvent { return this.onDeleteEmitter.event; }\n public onInsertEmitter = new EventEmitter();\n public get onInsert(): IEvent { return this.onInsertEmitter.event; }\n public onTrimEmitter = new EventEmitter();\n public get onTrim(): IEvent { return this.onTrimEmitter.event; }\n\n constructor(\n private _maxLength: number\n ) {\n this._array = new Array(this._maxLength);\n this._startIndex = 0;\n this._length = 0;\n }\n\n public get maxLength(): number {\n return this._maxLength;\n }\n\n public set maxLength(newMaxLength: number) {\n // There was no change in maxLength, return early.\n if (this._maxLength === newMaxLength) {\n return;\n }\n\n // Reconstruct array, starting at index 0. Only transfer values from the\n // indexes 0 to length.\n const newArray = new Array(newMaxLength);\n for (let i = 0; i < Math.min(newMaxLength, this.length); i++) {\n newArray[i] = this._array[this._getCyclicIndex(i)];\n }\n this._array = newArray;\n this._maxLength = newMaxLength;\n this._startIndex = 0;\n }\n\n public get length(): number {\n return this._length;\n }\n\n public set length(newLength: number) {\n if (newLength > this._length) {\n for (let i = this._length; i < newLength; i++) {\n this._array[i] = undefined;\n }\n }\n this._length = newLength;\n }\n\n /**\n * Gets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index of the value to get.\n * @return The value corresponding to the index.\n */\n public get(index: number): T | undefined {\n return this._array[this._getCyclicIndex(index)];\n }\n\n /**\n * Sets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index to set.\n * @param value The value to set.\n */\n public set(index: number, value: T | undefined): void {\n this._array[this._getCyclicIndex(index)] = value;\n }\n\n /**\n * Pushes a new value onto the list, wrapping around to the start of the array, overriding index 0\n * if the maximum length is reached.\n * @param value The value to push onto the list.\n */\n public push(value: T): void {\n this._array[this._getCyclicIndex(this._length)] = value;\n if (this._length === this._maxLength) {\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n } else {\n this._length++;\n }\n }\n\n /**\n * Advance ringbuffer index and return current element for recycling.\n * Note: The buffer must be full for this method to work.\n * @throws When the buffer is not full.\n */\n public recycle(): T {\n if (this._length !== this._maxLength) {\n throw new Error('Can only recycle when the buffer is full');\n }\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n return this._array[this._getCyclicIndex(this._length - 1)]!;\n }\n\n /**\n * Ringbuffer is at max length.\n */\n public get isFull(): boolean {\n return this._length === this._maxLength;\n }\n\n /**\n * Removes and returns the last value on the list.\n * @return The popped value.\n */\n public pop(): T | undefined {\n return this._array[this._getCyclicIndex(this._length-- - 1)];\n }\n\n /**\n * Deletes and/or inserts items at a particular index (in that order). Unlike\n * Array.prototype.splice, this operation does not return the deleted items as a new array in\n * order to save creating a new array. Note that this operation may shift all values in the list\n * in the worst case.\n * @param start The index to delete and/or insert.\n * @param deleteCount The number of elements to delete.\n * @param items The items to insert.\n */\n public splice(start: number, deleteCount: number, ...items: T[]): void {\n // Delete items\n if (deleteCount) {\n for (let i = start; i < this._length - deleteCount; i++) {\n this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];\n }\n this._length -= deleteCount;\n this.onDeleteEmitter.fire({index: start, amount: deleteCount});\n }\n\n // Add items\n for (let i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (let i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (items.length) {\n this.onInsertEmitter.fire({index: start, amount: items.length});\n }\n\n // Adjust length as needed\n if (this._length + items.length > this._maxLength) {\n const countToTrim = (this._length + items.length) - this._maxLength;\n this._startIndex += countToTrim;\n this._length = this._maxLength;\n this.onTrimEmitter.fire(countToTrim);\n } else {\n this._length += items.length;\n }\n }\n\n /**\n * Trims a number of items from the start of the list.\n * @param count The number of items to remove.\n */\n public trimStart(count: number): void {\n if (count > this._length) {\n count = this._length;\n }\n this._startIndex += count;\n this._length -= count;\n this.onTrimEmitter.fire(count);\n }\n\n public shiftElements(start: number, count: number, offset: number): void {\n if (count <= 0) {\n return;\n }\n if (start < 0 || start >= this._length) {\n throw new Error('start argument out of range');\n }\n if (start + offset < 0) {\n throw new Error('Cannot shift elements in list beyond index 0');\n }\n\n if (offset > 0) {\n for (let i = count - 1; i >= 0; i--) {\n this.set(start + i + offset, this.get(start + i));\n }\n const expandListBy = (start + count + offset) - this._length;\n if (expandListBy > 0) {\n this._length += expandListBy;\n while (this._length > this._maxLength) {\n this._length--;\n this._startIndex++;\n this.onTrimEmitter.fire(1);\n }\n }\n } else {\n for (let i = 0; i < count; i++) {\n this.set(start + i + offset, this.get(start + i));\n }\n }\n }\n\n /**\n * Gets the cyclic index for the specified regular index. The cyclic index can then be used on the\n * backing array to get the element associated with the regular index.\n * @param index The regular index.\n * @returns The cyclic index.\n */\n private _getCyclicIndex(index: number): number {\n return (this._startIndex + index) % this._maxLength;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/*\n * A simple utility for cloning values\n */\nexport function clone(val: T, depth: number = 5): T {\n if (typeof val !== 'object') {\n return val;\n }\n\n // If we're cloning an array, use an array as the base, otherwise use an object\n const clonedObject: any = Array.isArray(val) ? [] : {};\n\n for (const key in val) {\n // Recursively clone eack item unless we're at the maximum depth\n clonedObject[key] = depth <= 1 ? val[key] : (val[key] ? clone(val[key], depth - 1) : val[key]);\n }\n\n return clonedObject as T;\n}\n","/**\n * Copyright (c) 2014-2020 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, ICoreMouseService, IUnicodeService, IDirtyRowService } from 'common/services/Services';\nimport { InstantiationService } from 'common/services/InstantiationService';\nimport { LogService } from 'common/services/LogService';\nimport { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';\nimport { OptionsService } from 'common/services/OptionsService';\nimport { ITerminalOptions, IDisposable, IBufferLine, IAttributeData, ICoreTerminal } from 'common/Types';\nimport { CoreService } from 'common/services/CoreService';\nimport { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';\nimport { CoreMouseService } from 'common/services/CoreMouseService';\nimport { DirtyRowService } from 'common/services/DirtyRowService';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { CharsetService } from 'common/services/CharsetService';\nimport { updateWindowsModeWrappedState } from 'common/WindowsMode';\nimport { IFunctionIdentifier, IParams } from 'common/parser/Types';\nimport { IBufferSet } from 'common/buffer/Types';\nimport { InputHandler } from 'common/InputHandler';\nimport { WriteBuffer } from 'common/input/WriteBuffer';\n\nexport abstract class CoreTerminal extends Disposable implements ICoreTerminal {\n protected readonly _instantiationService: IInstantiationService;\n protected readonly _bufferService: IBufferService;\n protected readonly _logService: ILogService;\n protected readonly _coreService: ICoreService;\n protected readonly _charsetService: ICharsetService;\n protected readonly _coreMouseService: ICoreMouseService;\n protected readonly _dirtyRowService: IDirtyRowService;\n\n public readonly unicodeService: IUnicodeService;\n public readonly optionsService: IOptionsService;\n\n protected _inputHandler: InputHandler;\n private _writeBuffer: WriteBuffer;\n private _windowsMode: IDisposable | undefined;\n /** An IBufferline to clone/copy from for new blank lines */\n private _cachedBlankLine: IBufferLine | undefined;\n\n private _onBinary = new EventEmitter();\n public get onBinary(): IEvent { return this._onBinary.event; }\n private _onData = new EventEmitter();\n public get onData(): IEvent { return this._onData.event; }\n protected _onLineFeed = new EventEmitter();\n public get onLineFeed(): IEvent { return this._onLineFeed.event; }\n private _onResize = new EventEmitter<{ cols: number, rows: number }>();\n public get onResize(): IEvent<{ cols: number, rows: number }> { return this._onResize.event; }\n protected _onScroll = new EventEmitter();\n public get onScroll(): IEvent { return this._onScroll.event; }\n\n public get cols(): number { return this._bufferService.cols; }\n public get rows(): number { return this._bufferService.rows; }\n public get buffers(): IBufferSet { return this._bufferService.buffers; }\n\n constructor(\n options: ITerminalOptions\n ) {\n super();\n\n // Setup and initialize services\n this._instantiationService = new InstantiationService();\n this.optionsService = new OptionsService(options);\n this._instantiationService.setService(IOptionsService, this.optionsService);\n this._bufferService = this.register(this._instantiationService.createInstance(BufferService));\n this._instantiationService.setService(IBufferService, this._bufferService);\n this._logService = this._instantiationService.createInstance(LogService);\n this._instantiationService.setService(ILogService, this._logService);\n this._coreService = this.register(this._instantiationService.createInstance(CoreService, () => this.scrollToBottom()));\n this._instantiationService.setService(ICoreService, this._coreService);\n this._coreMouseService = this._instantiationService.createInstance(CoreMouseService);\n this._instantiationService.setService(ICoreMouseService, this._coreMouseService);\n this._dirtyRowService = this._instantiationService.createInstance(DirtyRowService);\n this._instantiationService.setService(IDirtyRowService, this._dirtyRowService);\n this.unicodeService = this._instantiationService.createInstance(UnicodeService);\n this._instantiationService.setService(IUnicodeService, this.unicodeService);\n this._charsetService = this._instantiationService.createInstance(CharsetService);\n this._instantiationService.setService(ICharsetService, this._charsetService);\n\n // Register input handler and handle/forward events\n this._inputHandler = new InputHandler(this._bufferService, this._charsetService, this._coreService, this._dirtyRowService, this._logService, this.optionsService, this._coreMouseService, this.unicodeService);\n this.register(forwardEvent(this._inputHandler.onLineFeed, this._onLineFeed));\n this.register(this._inputHandler);\n\n // Setup listeners\n this.register(forwardEvent(this._bufferService.onResize, this._onResize));\n this.register(forwardEvent(this._coreService.onData, this._onData));\n this.register(forwardEvent(this._coreService.onBinary, this._onBinary));\n this.register(this.optionsService.onOptionChange(key => this._updateOptions(key)));\n\n // Setup WriteBuffer\n this._writeBuffer = new WriteBuffer(data => this._inputHandler.parse(data));\n }\n\n public dispose(): void {\n if (this._isDisposed) {\n return;\n }\n super.dispose();\n this._windowsMode?.dispose();\n this._windowsMode = undefined;\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._writeBuffer.write(data, callback);\n }\n\n public writeSync(data: string | Uint8Array): void {\n this._writeBuffer.writeSync(data);\n }\n\n public resize(x: number, y: number): void {\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n x = Math.max(x, MINIMUM_COLS);\n y = Math.max(y, MINIMUM_ROWS);\n\n this._bufferService.resize(x, y);\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n const buffer = this._bufferService.buffer;\n\n let newLine: IBufferLine | undefined;\n newLine = this._cachedBlankLine;\n if (!newLine || newLine.length !== this.cols || newLine.getFg(0) !== eraseAttr.fg || newLine.getBg(0) !== eraseAttr.bg) {\n newLine = buffer.getBlankLine(eraseAttr, isWrapped);\n this._cachedBlankLine = newLine;\n }\n newLine.isWrapped = isWrapped;\n\n const topRow = buffer.ybase + buffer.scrollTop;\n const bottomRow = buffer.ybase + buffer.scrollBottom;\n\n if (buffer.scrollTop === 0) {\n // Determine whether the buffer is going to be trimmed after insertion.\n const willBufferBeTrimmed = buffer.lines.isFull;\n\n // Insert the line using the fastest method\n if (bottomRow === buffer.lines.length - 1) {\n if (willBufferBeTrimmed) {\n buffer.lines.recycle().copyFrom(newLine);\n } else {\n buffer.lines.push(newLine.clone());\n }\n } else {\n buffer.lines.splice(bottomRow + 1, 0, newLine.clone());\n }\n\n // Only adjust ybase and ydisp when the buffer is not trimmed\n if (!willBufferBeTrimmed) {\n buffer.ybase++;\n // Only scroll the ydisp with ybase if the user has not scrolled up\n if (!this._bufferService.isUserScrolling) {\n buffer.ydisp++;\n }\n } else {\n // When the buffer is full and the user has scrolled up, keep the text\n // stable unless ydisp is right at the top\n if (this._bufferService.isUserScrolling) {\n buffer.ydisp = Math.max(buffer.ydisp - 1, 0);\n }\n }\n } else {\n // scrollTop is non-zero which means no line will be going to the\n // scrollback, instead we can just shift them in-place.\n const scrollRegionHeight = bottomRow - topRow + 1 /* as it's zero-based */;\n buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);\n buffer.lines.set(bottomRow, newLine.clone());\n }\n\n // Move the viewport to the bottom of the buffer unless the user is\n // scrolling.\n if (!this._bufferService.isUserScrolling) {\n buffer.ydisp = buffer.ybase;\n }\n\n // Flag rows that need updating\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n\n this._onScroll.fire(buffer.ydisp);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used\n * to avoid unwanted events being handled by the viewport when the event was triggered from the\n * viewport originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n const buffer = this._bufferService.buffer;\n if (disp < 0) {\n if (buffer.ydisp === 0) {\n return;\n }\n this._bufferService.isUserScrolling = true;\n } else if (disp + buffer.ydisp >= buffer.ybase) {\n this._bufferService.isUserScrolling = false;\n }\n\n const oldYdisp = buffer.ydisp;\n buffer.ydisp = Math.max(Math.min(buffer.ydisp + disp, buffer.ybase), 0);\n\n // No change occurred, don't trigger scroll/refresh\n if (oldYdisp === buffer.ydisp) {\n return;\n }\n\n if (!suppressScrollEvent) {\n this._onScroll.fire(buffer.ydisp);\n }\n }\n\n /**\n * Scroll the display of the terminal by a number of pages.\n * @param pageCount The number of pages to scroll (negative scrolls up).\n */\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n /**\n * Scrolls the display of the terminal to the top.\n */\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n /**\n * Scrolls the display of the terminal to the bottom.\n */\n public scrollToBottom(): void {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n /** Add handler for ESC escape sequence. See xterm.d.ts for details. */\n public addEscHandler(id: IFunctionIdentifier, callback: () => boolean): IDisposable {\n return this._inputHandler.addEscHandler(id, callback);\n }\n\n /** Add handler for DCS escape sequence. See xterm.d.ts for details. */\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean): IDisposable {\n return this._inputHandler.addDcsHandler(id, callback);\n }\n\n /** Add handler for CSI escape sequence. See xterm.d.ts for details. */\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean): IDisposable {\n return this._inputHandler.addCsiHandler(id, callback);\n }\n\n /** Add handler for OSC escape sequence. See xterm.d.ts for details. */\n public addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable {\n return this._inputHandler.addOscHandler(ident, callback);\n }\n\n protected _setup(): void {\n if (this.optionsService.options.windowsMode) {\n this._enableWindowsMode();\n }\n }\n\n public reset(): void {\n this._inputHandler.reset();\n this._bufferService.reset();\n this._charsetService.reset();\n this._coreService.reset();\n this._coreMouseService.reset();\n }\n\n protected _updateOptions(key: string): void {\n // TODO: These listeners should be owned by individual components\n switch (key) {\n case 'scrollback':\n this.buffers.resize(this.cols, this.rows);\n break;\n case 'windowsMode':\n if (this.optionsService.options.windowsMode) {\n this._enableWindowsMode();\n } else {\n this._windowsMode?.dispose();\n this._windowsMode = undefined;\n }\n break;\n }\n }\n\n protected _enableWindowsMode(): void {\n if (!this._windowsMode) {\n const disposables: IDisposable[] = [];\n disposables.push(this.onLineFeed(updateWindowsModeWrappedState.bind(null, this._bufferService)));\n disposables.push(this.addCsiHandler({ final: 'H' }, () => {\n updateWindowsModeWrappedState(this._bufferService);\n return false;\n }));\n this._windowsMode = {\n dispose: () => {\n for (const d of disposables) {\n d.dispose();\n }\n }\n };\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\n\ninterface IListener {\n (arg1: T, arg2: U): void;\n}\n\nexport interface IEvent {\n (listener: (arg1: T, arg2: U) => any): IDisposable;\n}\n\nexport interface IEventEmitter {\n event: IEvent;\n fire(arg1: T, arg2: U): void;\n dispose(): void;\n}\n\nexport class EventEmitter implements IEventEmitter {\n private _listeners: IListener[] = [];\n private _event?: IEvent;\n private _disposed: boolean = false;\n\n public get event(): IEvent {\n if (!this._event) {\n this._event = (listener: (arg1: T, arg2: U) => any) => {\n this._listeners.push(listener);\n const disposable = {\n dispose: () => {\n if (!this._disposed) {\n for (let i = 0; i < this._listeners.length; i++) {\n if (this._listeners[i] === listener) {\n this._listeners.splice(i, 1);\n return;\n }\n }\n }\n }\n };\n return disposable;\n };\n }\n return this._event;\n }\n\n public fire(arg1: T, arg2: U): void {\n const queue: IListener[] = [];\n for (let i = 0; i < this._listeners.length; i++) {\n queue.push(this._listeners[i]);\n }\n for (let i = 0; i < queue.length; i++) {\n queue[i].call(undefined, arg1, arg2);\n }\n }\n\n public dispose(): void {\n if (this._listeners) {\n this._listeners.length = 0;\n }\n this._disposed = true;\n }\n}\n\nexport function forwardEvent(from: IEvent, to: IEventEmitter): IDisposable {\n return from(e => to.fire(e));\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IInputHandler, IAttributeData, IDisposable, IWindowOptions, IAnsiColorChangeEvent } from 'common/Types';\nimport { C0, C1 } from 'common/data/EscapeSequences';\nimport { CHARSETS, DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';\nimport { Disposable } from 'common/Lifecycle';\nimport { concat } from 'common/TypedArrayUtils';\nimport { StringToUtf32, stringFromCodePoint, utf32ToString, Utf8ToUtf32 } from 'common/input/TextDecoder';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IFunctionIdentifier } from 'common/parser/Types';\nimport { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { ICoreService, IBufferService, IOptionsService, ILogService, IDirtyRowService, ICoreMouseService, ICharsetService, IUnicodeService } from 'common/services/Services';\nimport { OscHandler } from 'common/parser/OscParser';\nimport { DcsHandler } from 'common/parser/DcsParser';\n\n/**\n * Map collect to glevel. Used in `selectCharset`.\n */\nconst GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2};\n\n/**\n * VT commands done by the parser - FIXME: move this to the parser?\n */\n// @vt: #Y ESC CSI \"Control Sequence Introducer\" \"ESC [\" \"Start of a CSI sequence.\"\n// @vt: #Y ESC OSC \"Operating System Command\" \"ESC ]\" \"Start of an OSC sequence.\"\n// @vt: #Y ESC DCS \"Device Control String\" \"ESC P\" \"Start of a DCS sequence.\"\n// @vt: #Y ESC ST \"String Terminator\" \"ESC \\\" \"Terminator used for string type sequences.\"\n// @vt: #Y ESC PM \"Privacy Message\" \"ESC ^\" \"Start of a privacy message.\"\n// @vt: #Y ESC APC \"Application Program Command\" \"ESC _\" \"Start of an APC sequence.\"\n// @vt: #Y C1 CSI \"Control Sequence Introducer\" \"\\x9B\" \"Start of a CSI sequence.\"\n// @vt: #Y C1 OSC \"Operating System Command\" \"\\x9D\" \"Start of an OSC sequence.\"\n// @vt: #Y C1 DCS \"Device Control String\" \"\\x90\" \"Start of a DCS sequence.\"\n// @vt: #Y C1 ST \"String Terminator\" \"\\x9C\" \"Terminator used for string type sequences.\"\n// @vt: #Y C1 PM \"Privacy Message\" \"\\x9E\" \"Start of a privacy message.\"\n// @vt: #Y C1 APC \"Application Program Command\" \"\\x9F\" \"Start of an APC sequence.\"\n// @vt: #Y C0 NUL \"Null\" \"\\0, \\x00\" \"NUL is ignored.\"\n// @vt: #Y C0 ESC \"Escape\" \"\\e, \\x1B\" \"Start of a sequence. Cancels any other sequence.\"\n\n/**\n * Document common VT features here that are currently unsupported\n */\n// @vt: #N DCS SIXEL \"SIXEL Graphics\" \"DCS Ps ; Ps ; Ps ; q \tPt ST\" \"Draw SIXEL image starting at cursor position.\"\n// @vt: #N OSC 1 \"Set Icon Name\" \"OSC 1 ; Pt BEL\" \"Set icon name.\"\n\n/**\n * Max length of the UTF32 input buffer. Real memory consumption is 4 times higher.\n */\nconst MAX_PARSEBUFFER_LENGTH = 131072;\n\n/**\n * Limit length of title and icon name stacks.\n */\nconst STACK_LIMIT = 10;\n\n// map params to window option\nfunction paramToWindowOption(n: number, opts: IWindowOptions): boolean {\n if (n > 24) {\n return opts.setWinLines || false;\n }\n switch (n) {\n case 1: return !!opts.restoreWin;\n case 2: return !!opts.minimizeWin;\n case 3: return !!opts.setWinPosition;\n case 4: return !!opts.setWinSizePixels;\n case 5: return !!opts.raiseWin;\n case 6: return !!opts.lowerWin;\n case 7: return !!opts.refreshWin;\n case 8: return !!opts.setWinSizeChars;\n case 9: return !!opts.maximizeWin;\n case 10: return !!opts.fullscreenWin;\n case 11: return !!opts.getWinState;\n case 13: return !!opts.getWinPosition;\n case 14: return !!opts.getWinSizePixels;\n case 15: return !!opts.getScreenSizePixels;\n case 16: return !!opts.getCellSizePixels;\n case 18: return !!opts.getWinSizeChars;\n case 19: return !!opts.getScreenSizeChars;\n case 20: return !!opts.getIconTitle;\n case 21: return !!opts.getWinTitle;\n case 22: return !!opts.pushTitle;\n case 23: return !!opts.popTitle;\n case 24: return !!opts.setWinLines;\n }\n return false;\n}\n\nexport enum WindowsOptionsReportType {\n GET_WIN_SIZE_PIXELS = 0,\n GET_CELL_SIZE_PIXELS = 1\n}\n\n/**\n * DCS subparser implementations\n */\n\n/**\n * DCS $ q Pt ST\n * DECRQSS (https://vt100.net/docs/vt510-rm/DECRQSS.html)\n * Request Status String (DECRQSS), VT420 and up.\n * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html)\n *\n * @vt: #P[See limited support below.] DCS DECRQSS \"Request Selection or Setting\" \"DCS $ q Pt ST\" \"Request several terminal settings.\"\n * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the corresponding CSI string,\n * `ESC P 0 ST` for invalid requests.\n *\n * Supported requests and responses:\n *\n * | Type | Request | Response (`Pt`) |\n * | -------------------------------- | ----------------- | ----------------------------------------------------- |\n * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) |\n * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ps ; Ps r` |\n * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Ps SP q` |\n * | Protection Attribute (DECSCA) | `DCS $ q \" q ST` | always reporting `0 \" q` (DECSCA is unsupported) |\n * | Conformance Level (DECSCL) | `DCS $ q \" p ST` | always reporting `61 ; 1 \" p` (DECSCL is unsupported) |\n *\n *\n * TODO:\n * - fix SGR report\n * - either implement DECSCA or remove the report\n * - either check which conformance is better suited or remove the report completely\n * --> we are currently a mixture of all up to VT400 but dont follow anyone strictly\n */\nclass DECRQSS implements IDcsHandler {\n private _data: Uint32Array = new Uint32Array(0);\n\n constructor(\n private _bufferService: IBufferService,\n private _coreService: ICoreService,\n private _logService: ILogService,\n private _optionsService: IOptionsService\n ) { }\n\n public hook(params: IParams): void {\n this._data = new Uint32Array(0);\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n this._data = concat(this._data, data.subarray(start, end));\n }\n\n public unhook(success: boolean): boolean {\n if (!success) {\n this._data = new Uint32Array(0);\n return true;\n }\n const data = utf32ToString(this._data);\n this._data = new Uint32Array(0);\n switch (data) {\n // valid: DCS 1 $ r Pt ST (xterm)\n case '\"q': // DECSCA\n this._coreService.triggerDataEvent(`${C0.ESC}P1$r0\"q${C0.ESC}\\\\`);\n break;\n case '\"p': // DECSCL\n this._coreService.triggerDataEvent(`${C0.ESC}P1$r61;1\"p${C0.ESC}\\\\`);\n break;\n case 'r': // DECSTBM\n const pt = '' + (this._bufferService.buffer.scrollTop + 1) +\n ';' + (this._bufferService.buffer.scrollBottom + 1) + 'r';\n this._coreService.triggerDataEvent(`${C0.ESC}P1$r${pt}${C0.ESC}\\\\`);\n break;\n case 'm': // SGR\n // TODO: report real settings instead of 0m\n this._coreService.triggerDataEvent(`${C0.ESC}P1$r0m${C0.ESC}\\\\`);\n break;\n case ' q': // DECSCUSR\n const STYLES: {[key: string]: number} = {'block': 2, 'underline': 4, 'bar': 6};\n let style = STYLES[this._optionsService.options.cursorStyle];\n style -= this._optionsService.options.cursorBlink ? 1 : 0;\n this._coreService.triggerDataEvent(`${C0.ESC}P1$r${style} q${C0.ESC}\\\\`);\n break;\n default:\n // invalid: DCS 0 $ r Pt ST (xterm)\n this._logService.debug('Unknown DCS $q %s', data);\n this._coreService.triggerDataEvent(`${C0.ESC}P0$r${C0.ESC}\\\\`);\n }\n return true;\n }\n}\n\n/**\n * DCS Ps; Ps| Pt ST\n * DECUDK (https://vt100.net/docs/vt510-rm/DECUDK.html)\n * not supported\n *\n * @vt: #N DCS DECUDK \"User Defined Keys\" \"DCS Ps ; Ps | Pt ST\" \"Definitions for user-defined keys.\"\n */\n\n/**\n * DCS + q Pt ST (xterm)\n * Request Terminfo String\n * not implemented\n *\n * @vt: #N DCS XTGETTCAP \"Request Terminfo String\" \"DCS + q Pt ST\" \"Request Terminfo String.\"\n */\n\n/**\n * DCS + p Pt ST (xterm)\n * Set Terminfo Data\n * not supported\n *\n * @vt: #N DCS XTSETTCAP \"Set Terminfo Data\" \"DCS + p Pt ST\" \"Set Terminfo Data.\"\n */\n\n\n\n/**\n * The terminal's standard implementation of IInputHandler, this handles all\n * input from the Parser.\n *\n * Refer to http://invisible-island.net/xterm/ctlseqs/ctlseqs.html to understand\n * each function's header comment.\n */\nexport class InputHandler extends Disposable implements IInputHandler {\n private _parseBuffer: Uint32Array = new Uint32Array(4096);\n private _stringDecoder: StringToUtf32 = new StringToUtf32();\n private _utf8Decoder: Utf8ToUtf32 = new Utf8ToUtf32();\n private _workCell: CellData = new CellData();\n private _windowTitle = '';\n private _iconName = '';\n protected _windowTitleStack: string[] = [];\n protected _iconNameStack: string[] = [];\n\n private _curAttrData: IAttributeData = DEFAULT_ATTR_DATA.clone();\n private _eraseAttrDataInternal: IAttributeData = DEFAULT_ATTR_DATA.clone();\n\n private _onRequestBell = new EventEmitter();\n public get onRequestBell(): IEvent { return this._onRequestBell.event; }\n private _onRequestRefreshRows = new EventEmitter();\n public get onRequestRefreshRows(): IEvent { return this._onRequestRefreshRows.event; }\n private _onRequestReset = new EventEmitter();\n public get onRequestReset(): IEvent { return this._onRequestReset.event; }\n private _onRequestScroll = new EventEmitter();\n public get onRequestScroll(): IEvent { return this._onRequestScroll.event; }\n private _onRequestSyncScrollBar = new EventEmitter();\n public get onRequestSyncScrollBar(): IEvent { return this._onRequestSyncScrollBar.event; }\n private _onRequestWindowsOptionsReport = new EventEmitter();\n public get onRequestWindowsOptionsReport(): IEvent { return this._onRequestWindowsOptionsReport.event; }\n\n private _onA11yChar = new EventEmitter();\n public get onA11yChar(): IEvent { return this._onA11yChar.event; }\n private _onA11yTab = new EventEmitter();\n public get onA11yTab(): IEvent { return this._onA11yTab.event; }\n private _onCursorMove = new EventEmitter();\n public get onCursorMove(): IEvent { return this._onCursorMove.event; }\n private _onLineFeed = new EventEmitter();\n public get onLineFeed(): IEvent { return this._onLineFeed.event; }\n private _onScroll = new EventEmitter();\n public get onScroll(): IEvent { return this._onScroll.event; }\n private _onTitleChange = new EventEmitter();\n public get onTitleChange(): IEvent { return this._onTitleChange.event; }\n private _onAnsiColorChange = new EventEmitter();\n public get onAnsiColorChange(): IEvent { return this._onAnsiColorChange.event; }\n\n constructor(\n private readonly _bufferService: IBufferService,\n private readonly _charsetService: ICharsetService,\n private readonly _coreService: ICoreService,\n private readonly _dirtyRowService: IDirtyRowService,\n private readonly _logService: ILogService,\n private readonly _optionsService: IOptionsService,\n private readonly _coreMouseService: ICoreMouseService,\n private readonly _unicodeService: IUnicodeService,\n private readonly _parser: IEscapeSequenceParser = new EscapeSequenceParser()\n ) {\n super();\n this.register(this._parser);\n\n /**\n * custom fallback handlers\n */\n this._parser.setCsiHandlerFallback((ident, params) => {\n this._logService.debug('Unknown CSI code: ', { identifier: this._parser.identToString(ident), params: params.toArray() });\n });\n this._parser.setEscHandlerFallback(ident => {\n this._logService.debug('Unknown ESC code: ', { identifier: this._parser.identToString(ident) });\n });\n this._parser.setExecuteHandlerFallback(code => {\n this._logService.debug('Unknown EXECUTE code: ', { code });\n });\n this._parser.setOscHandlerFallback((identifier, action, data) => {\n this._logService.debug('Unknown OSC code: ', { identifier, action, data });\n });\n this._parser.setDcsHandlerFallback((ident, action, payload) => {\n if (action === 'HOOK') {\n payload = payload.toArray();\n }\n this._logService.debug('Unknown DCS code: ', { identifier: this._parser.identToString(ident), action, payload });\n });\n\n /**\n * print handler\n */\n this._parser.setPrintHandler((data, start, end) => this.print(data, start, end));\n\n /**\n * CSI handler\n */\n this._parser.registerCsiHandler({final: '@'}, params => this.insertChars(params));\n this._parser.registerCsiHandler({intermediates: ' ', final: '@'}, params => this.scrollLeft(params));\n this._parser.registerCsiHandler({final: 'A'}, params => this.cursorUp(params));\n this._parser.registerCsiHandler({intermediates: ' ', final: 'A'}, params => this.scrollRight(params));\n this._parser.registerCsiHandler({final: 'B'}, params => this.cursorDown(params));\n this._parser.registerCsiHandler({final: 'C'}, params => this.cursorForward(params));\n this._parser.registerCsiHandler({final: 'D'}, params => this.cursorBackward(params));\n this._parser.registerCsiHandler({final: 'E'}, params => this.cursorNextLine(params));\n this._parser.registerCsiHandler({final: 'F'}, params => this.cursorPrecedingLine(params));\n this._parser.registerCsiHandler({final: 'G'}, params => this.cursorCharAbsolute(params));\n this._parser.registerCsiHandler({final: 'H'}, params => this.cursorPosition(params));\n this._parser.registerCsiHandler({final: 'I'}, params => this.cursorForwardTab(params));\n this._parser.registerCsiHandler({final: 'J'}, params => this.eraseInDisplay(params));\n this._parser.registerCsiHandler({prefix: '?', final: 'J'}, params => this.eraseInDisplay(params));\n this._parser.registerCsiHandler({final: 'K'}, params => this.eraseInLine(params));\n this._parser.registerCsiHandler({prefix: '?', final: 'K'}, params => this.eraseInLine(params));\n this._parser.registerCsiHandler({final: 'L'}, params => this.insertLines(params));\n this._parser.registerCsiHandler({final: 'M'}, params => this.deleteLines(params));\n this._parser.registerCsiHandler({final: 'P'}, params => this.deleteChars(params));\n this._parser.registerCsiHandler({final: 'S'}, params => this.scrollUp(params));\n this._parser.registerCsiHandler({final: 'T'}, params => this.scrollDown(params));\n this._parser.registerCsiHandler({final: 'X'}, params => this.eraseChars(params));\n this._parser.registerCsiHandler({final: 'Z'}, params => this.cursorBackwardTab(params));\n this._parser.registerCsiHandler({final: '`'}, params => this.charPosAbsolute(params));\n this._parser.registerCsiHandler({final: 'a'}, params => this.hPositionRelative(params));\n this._parser.registerCsiHandler({final: 'b'}, params => this.repeatPrecedingCharacter(params));\n this._parser.registerCsiHandler({final: 'c'}, params => this.sendDeviceAttributesPrimary(params));\n this._parser.registerCsiHandler({prefix: '>', final: 'c'}, params => this.sendDeviceAttributesSecondary(params));\n this._parser.registerCsiHandler({final: 'd'}, params => this.linePosAbsolute(params));\n this._parser.registerCsiHandler({final: 'e'}, params => this.vPositionRelative(params));\n this._parser.registerCsiHandler({final: 'f'}, params => this.hVPosition(params));\n this._parser.registerCsiHandler({final: 'g'}, params => this.tabClear(params));\n this._parser.registerCsiHandler({final: 'h'}, params => this.setMode(params));\n this._parser.registerCsiHandler({prefix: '?', final: 'h'}, params => this.setModePrivate(params));\n this._parser.registerCsiHandler({final: 'l'}, params => this.resetMode(params));\n this._parser.registerCsiHandler({prefix: '?', final: 'l'}, params => this.resetModePrivate(params));\n this._parser.registerCsiHandler({final: 'm'}, params => this.charAttributes(params));\n this._parser.registerCsiHandler({final: 'n'}, params => this.deviceStatus(params));\n this._parser.registerCsiHandler({prefix: '?', final: 'n'}, params => this.deviceStatusPrivate(params));\n this._parser.registerCsiHandler({intermediates: '!', final: 'p'}, params => this.softReset(params));\n this._parser.registerCsiHandler({intermediates: ' ', final: 'q'}, params => this.setCursorStyle(params));\n this._parser.registerCsiHandler({final: 'r'}, params => this.setScrollRegion(params));\n this._parser.registerCsiHandler({final: 's'}, params => this.saveCursor(params));\n this._parser.registerCsiHandler({final: 't'}, params => this.windowOptions(params));\n this._parser.registerCsiHandler({final: 'u'}, params => this.restoreCursor(params));\n this._parser.registerCsiHandler({intermediates: '\\'', final: '}'}, params => this.insertColumns(params));\n this._parser.registerCsiHandler({intermediates: '\\'', final: '~'}, params => this.deleteColumns(params));\n\n /**\n * execute handler\n */\n this._parser.setExecuteHandler(C0.BEL, () => this.bell());\n this._parser.setExecuteHandler(C0.LF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.VT, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.FF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn());\n this._parser.setExecuteHandler(C0.BS, () => this.backspace());\n this._parser.setExecuteHandler(C0.HT, () => this.tab());\n this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());\n this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());\n // FIXME: What do to with missing? Old code just added those to print.\n\n this._parser.setExecuteHandler(C1.IND, () => this.index());\n this._parser.setExecuteHandler(C1.NEL, () => this.nextLine());\n this._parser.setExecuteHandler(C1.HTS, () => this.tabSet());\n\n /**\n * OSC handler\n */\n // 0 - icon name + title\n this._parser.registerOscHandler(0, new OscHandler(data => { this.setTitle(data); this.setIconName(data); return true; }));\n // 1 - icon name\n this._parser.registerOscHandler(1, new OscHandler(data => this.setIconName(data)));\n // 2 - title\n this._parser.registerOscHandler(2, new OscHandler(data => this.setTitle(data)));\n // 3 - set property X in the form \"prop=value\"\n // 4 - Change Color Number\n this._parser.registerOscHandler(4, new OscHandler(data => this.setAnsiColor(data)));\n // 5 - Change Special Color Number\n // 6 - Enable/disable Special Color Number c\n // 7 - current directory? (not in xterm spec, see https://gitlab.com/gnachman/iterm2/issues/3939)\n // 10 - Change VT100 text foreground color to Pt.\n // 11 - Change VT100 text background color to Pt.\n // 12 - Change text cursor color to Pt.\n // 13 - Change mouse foreground color to Pt.\n // 14 - Change mouse background color to Pt.\n // 15 - Change Tektronix foreground color to Pt.\n // 16 - Change Tektronix background color to Pt.\n // 17 - Change highlight background color to Pt.\n // 18 - Change Tektronix cursor color to Pt.\n // 19 - Change highlight foreground color to Pt.\n // 46 - Change Log File to Pt.\n // 50 - Set Font to Pt.\n // 51 - reserved for Emacs shell.\n // 52 - Manipulate Selection Data.\n // 104 ; c - Reset Color Number c.\n // 105 ; c - Reset Special Color Number c.\n // 106 ; c; f - Enable/disable Special Color Number c.\n // 110 - Reset VT100 text foreground color.\n // 111 - Reset VT100 text background color.\n // 112 - Reset text cursor color.\n // 113 - Reset mouse foreground color.\n // 114 - Reset mouse background color.\n // 115 - Reset Tektronix foreground color.\n // 116 - Reset Tektronix background color.\n // 117 - Reset highlight color.\n // 118 - Reset Tektronix cursor color.\n // 119 - Reset highlight foreground color.\n\n /**\n * ESC handlers\n */\n this._parser.registerEscHandler({final: '7'}, () => this.saveCursor());\n this._parser.registerEscHandler({final: '8'}, () => this.restoreCursor());\n this._parser.registerEscHandler({final: 'D'}, () => this.index());\n this._parser.registerEscHandler({final: 'E'}, () => this.nextLine());\n this._parser.registerEscHandler({final: 'H'}, () => this.tabSet());\n this._parser.registerEscHandler({final: 'M'}, () => this.reverseIndex());\n this._parser.registerEscHandler({final: '='}, () => this.keypadApplicationMode());\n this._parser.registerEscHandler({final: '>'}, () => this.keypadNumericMode());\n this._parser.registerEscHandler({final: 'c'}, () => this.fullReset());\n this._parser.registerEscHandler({final: 'n'}, () => this.setgLevel(2));\n this._parser.registerEscHandler({final: 'o'}, () => this.setgLevel(3));\n this._parser.registerEscHandler({final: '|'}, () => this.setgLevel(3));\n this._parser.registerEscHandler({final: '}'}, () => this.setgLevel(2));\n this._parser.registerEscHandler({final: '~'}, () => this.setgLevel(1));\n this._parser.registerEscHandler({intermediates: '%', final: '@'}, () => this.selectDefaultCharset());\n this._parser.registerEscHandler({intermediates: '%', final: 'G'}, () => this.selectDefaultCharset());\n for (const flag in CHARSETS) {\n this._parser.registerEscHandler({intermediates: '(', final: flag}, () => this.selectCharset('(' + flag));\n this._parser.registerEscHandler({intermediates: ')', final: flag}, () => this.selectCharset(')' + flag));\n this._parser.registerEscHandler({intermediates: '*', final: flag}, () => this.selectCharset('*' + flag));\n this._parser.registerEscHandler({intermediates: '+', final: flag}, () => this.selectCharset('+' + flag));\n this._parser.registerEscHandler({intermediates: '-', final: flag}, () => this.selectCharset('-' + flag));\n this._parser.registerEscHandler({intermediates: '.', final: flag}, () => this.selectCharset('.' + flag));\n this._parser.registerEscHandler({intermediates: '/', final: flag}, () => this.selectCharset('/' + flag)); // TODO: supported?\n }\n this._parser.registerEscHandler({intermediates: '#', final: '8'}, () => this.screenAlignmentPattern());\n\n /**\n * error handler\n */\n this._parser.setErrorHandler((state: IParsingState) => {\n this._logService.error('Parsing error: ', state);\n return state;\n });\n\n /**\n * DCS handler\n */\n this._parser.registerDcsHandler({intermediates: '$', final: 'q'}, new DECRQSS(this._bufferService, this._coreService, this._logService, this._optionsService));\n }\n\n public dispose(): void {\n super.dispose();\n }\n\n public parse(data: string | Uint8Array): void {\n let buffer = this._bufferService.buffer;\n const cursorStartX = buffer.x;\n const cursorStartY = buffer.y;\n\n this._logService.debug('parsing data', data);\n\n // resize input buffer if needed\n if (this._parseBuffer.length < data.length) {\n if (this._parseBuffer.length < MAX_PARSEBUFFER_LENGTH) {\n this._parseBuffer = new Uint32Array(Math.min(data.length, MAX_PARSEBUFFER_LENGTH));\n }\n }\n\n // Clear the dirty row service so we know which lines changed as a result of parsing\n this._dirtyRowService.clearRange();\n\n // process big data in smaller chunks\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n for (let i = 0; i < data.length; i += MAX_PARSEBUFFER_LENGTH) {\n const end = i + MAX_PARSEBUFFER_LENGTH < data.length ? i + MAX_PARSEBUFFER_LENGTH : data.length;\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data.substring(i, end), this._parseBuffer)\n : this._utf8Decoder.decode(data.subarray(i, end), this._parseBuffer);\n this._parser.parse(this._parseBuffer, len);\n }\n } else {\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data, this._parseBuffer)\n : this._utf8Decoder.decode(data, this._parseBuffer);\n this._parser.parse(this._parseBuffer, len);\n }\n\n buffer = this._bufferService.buffer;\n if (buffer.x !== cursorStartX || buffer.y !== cursorStartY) {\n this._onCursorMove.fire();\n }\n\n // Refresh any dirty rows accumulated as part of parsing\n this._onRequestRefreshRows.fire(this._dirtyRowService.start, this._dirtyRowService.end);\n }\n\n public print(data: Uint32Array, start: number, end: number): void {\n let code: number;\n let chWidth: number;\n const buffer = this._bufferService.buffer;\n const charset = this._charsetService.charset;\n const screenReaderMode = this._optionsService.options.screenReaderMode;\n const cols = this._bufferService.cols;\n const wraparoundMode = this._coreService.decPrivateModes.wraparound;\n const insertMode = this._coreService.modes.insertMode;\n const curAttr = this._curAttrData;\n let bufferRow = buffer.lines.get(buffer.ybase + buffer.y)!;\n\n this._dirtyRowService.markDirty(buffer.y);\n\n // handle wide chars: reset start_cell-1 if we would overwrite the second cell of a wide char\n if (buffer.x && end - start > 0 && bufferRow.getWidth(buffer.x - 1) === 2) {\n bufferRow.setCellFromCodePoint(buffer.x - 1, 0, 1, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n\n for (let pos = start; pos < end; ++pos) {\n code = data[pos];\n\n // calculate print space\n // expensive call, therefore we save width in line buffer\n chWidth = this._unicodeService.wcwidth(code);\n\n // get charset replacement character\n // charset is only defined for ASCII, therefore we only\n // search for an replacement char if code < 127\n if (code < 127 && charset) {\n const ch = charset[String.fromCharCode(code)];\n if (ch) {\n code = ch.charCodeAt(0);\n }\n }\n\n if (screenReaderMode) {\n this._onA11yChar.fire(stringFromCodePoint(code));\n }\n\n // insert combining char at last cursor position\n // buffer.x should never be 0 for a combining char\n // since they always follow a cell consuming char\n // therefore we can test for buffer.x to avoid overflow left\n if (!chWidth && buffer.x) {\n if (!bufferRow.getWidth(buffer.x - 1)) {\n // found empty cell after fullwidth, need to go 2 cells back\n // it is save to step 2 cells back here\n // since an empty cell is only set by fullwidth chars\n bufferRow.addCodepointToCell(buffer.x - 2, code);\n } else {\n bufferRow.addCodepointToCell(buffer.x - 1, code);\n }\n continue;\n }\n\n // goto next line if ch would overflow\n // NOTE: To avoid costly width checks here,\n // the terminal does not allow a cols < 2.\n if (buffer.x + chWidth - 1 >= cols) {\n // autowrap - DECAWM\n // automatically wraps to the beginning of the next line\n if (wraparoundMode) {\n // clear left over cells to the right\n while (buffer.x < cols) {\n bufferRow.setCellFromCodePoint(buffer.x++, 0, 1, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n buffer.x = 0;\n buffer.y++;\n if (buffer.y === buffer.scrollBottom + 1) {\n buffer.y--;\n this._onRequestScroll.fire(this._eraseAttrData(), true);\n } else {\n if (buffer.y >= this._bufferService.rows) {\n buffer.y = this._bufferService.rows - 1;\n }\n // The line already exists (eg. the initial viewport), mark it as a\n // wrapped line\n buffer.lines.get(buffer.ybase + buffer.y)!.isWrapped = true;\n }\n // row changed, get it again\n bufferRow = buffer.lines.get(buffer.ybase + buffer.y)!;\n } else {\n buffer.x = cols - 1;\n if (chWidth === 2) {\n // FIXME: check for xterm behavior\n // What to do here? We got a wide char that does not fit into last cell\n continue;\n }\n }\n }\n\n // insert mode: move characters to right\n if (insertMode) {\n // right shift cells according to the width\n bufferRow.insertCells(buffer.x, chWidth, buffer.getNullCell(curAttr), curAttr);\n // test last cell - since the last cell has only room for\n // a halfwidth char any fullwidth shifted there is lost\n // and will be set to empty cell\n if (bufferRow.getWidth(cols - 1) === 2) {\n bufferRow.setCellFromCodePoint(cols - 1, NULL_CELL_CODE, NULL_CELL_WIDTH, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n }\n\n // write current char to buffer and advance cursor\n bufferRow.setCellFromCodePoint(buffer.x++, code, chWidth, curAttr.fg, curAttr.bg, curAttr.extended);\n\n // fullwidth char - also set next cell to placeholder stub and advance cursor\n // for graphemes bigger than fullwidth we can simply loop to zero\n // we already made sure above, that buffer.x + chWidth will not overflow right\n if (chWidth > 0) {\n while (--chWidth) {\n // other than a regular empty cell a cell following a wide char has no width\n bufferRow.setCellFromCodePoint(buffer.x++, 0, 0, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n }\n }\n // store last char in Parser.precedingCodepoint for REP to work correctly\n // This needs to check whether:\n // - fullwidth + surrogates: reset\n // - combining: only base char gets carried on (bug in xterm?)\n if (end - start > 0) {\n bufferRow.loadCell(buffer.x - 1, this._workCell);\n if (this._workCell.getWidth() === 2 || this._workCell.getCode() > 0xFFFF) {\n this._parser.precedingCodepoint = 0;\n } else if (this._workCell.isCombined()) {\n this._parser.precedingCodepoint = this._workCell.getChars().charCodeAt(0);\n } else {\n this._parser.precedingCodepoint = this._workCell.content;\n }\n }\n\n // handle wide chars: reset cell to the right if it is second cell of a wide char\n if (buffer.x < cols && end - start > 0 && bufferRow.getWidth(buffer.x) === 0 && !bufferRow.hasContent(buffer.x)) {\n bufferRow.setCellFromCodePoint(buffer.x, 0, 1, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n\n this._dirtyRowService.markDirty(buffer.y);\n }\n\n /**\n * Forward addCsiHandler from parser.\n */\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean): IDisposable {\n if (id.final === 't' && !id.prefix && !id.intermediates) {\n // security: always check whether window option is allowed\n return this._parser.registerCsiHandler(id, params => {\n if (!paramToWindowOption(params.params[0], this._optionsService.options.windowOptions)) {\n return true;\n }\n return callback(params);\n });\n }\n return this._parser.registerCsiHandler(id, callback);\n }\n\n /**\n * Forward addDcsHandler from parser.\n */\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean): IDisposable {\n return this._parser.registerDcsHandler(id, new DcsHandler(callback));\n }\n\n /**\n * Forward addEscHandler from parser.\n */\n public addEscHandler(id: IFunctionIdentifier, callback: () => boolean): IDisposable {\n return this._parser.registerEscHandler(id, callback);\n }\n\n /**\n * Forward addOscHandler from parser.\n */\n public addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable {\n return this._parser.registerOscHandler(ident, new OscHandler(callback));\n }\n\n /**\n * BEL\n * Bell (Ctrl-G).\n *\n * @vt: #Y C0 BEL \"Bell\" \"\\a, \\x07\" \"Ring the bell.\"\n * The behavior of the bell is further customizable with `ITerminalOptions.bellStyle`\n * and `ITerminalOptions.bellSound`.\n */\n public bell(): boolean {\n this._onRequestBell.fire();\n return true;\n }\n\n /**\n * LF\n * Line Feed or New Line (NL). (LF is Ctrl-J).\n *\n * @vt: #Y C0 LF \"Line Feed\" \"\\n, \\x0A\" \"Move the cursor one row down, scrolling if needed.\"\n * Scrolling is restricted to scroll margins and will only happen on the bottom line.\n *\n * @vt: #Y C0 VT \"Vertical Tabulation\" \"\\v, \\x0B\" \"Treated as LF.\"\n * @vt: #Y C0 FF \"Form Feed\" \"\\f, \\x0C\" \"Treated as LF.\"\n */\n public lineFeed(): boolean {\n // make buffer local for faster access\n const buffer = this._bufferService.buffer;\n\n this._dirtyRowService.markDirty(buffer.y);\n if (this._optionsService.options.convertEol) {\n buffer.x = 0;\n }\n buffer.y++;\n if (buffer.y === buffer.scrollBottom + 1) {\n buffer.y--;\n this._onRequestScroll.fire(this._eraseAttrData());\n } else if (buffer.y >= this._bufferService.rows) {\n buffer.y = this._bufferService.rows - 1;\n }\n // If the end of the line is hit, prevent this action from wrapping around to the next line.\n if (buffer.x >= this._bufferService.cols) {\n buffer.x--;\n }\n this._dirtyRowService.markDirty(buffer.y);\n\n this._onLineFeed.fire();\n return true;\n }\n\n /**\n * CR\n * Carriage Return (Ctrl-M).\n *\n * @vt: #Y C0 CR \"Carriage Return\" \"\\r, \\x0D\" \"Move the cursor to the beginning of the row.\"\n */\n public carriageReturn(): boolean {\n this._bufferService.buffer.x = 0;\n return true;\n }\n\n /**\n * BS\n * Backspace (Ctrl-H).\n *\n * @vt: #Y C0 BS \"Backspace\" \"\\b, \\x08\" \"Move the cursor one position to the left.\"\n * By default it is not possible to move the cursor past the leftmost position.\n * If `reverse wrap-around` (`CSI ? 45 h`) is set, a previous soft line wrap (DECAWM)\n * can be undone with BS within the scroll margins. In that case the cursor will wrap back\n * to the end of the previous row. Note that it is not possible to peek back into the scrollbuffer\n * with the cursor, thus at the home position (top-leftmost cell) this has no effect.\n */\n public backspace(): boolean {\n const buffer = this._bufferService.buffer;\n\n // reverse wrap-around is disabled\n if (!this._coreService.decPrivateModes.reverseWraparound) {\n this._restrictCursor();\n if (buffer.x > 0) {\n buffer.x--;\n }\n return true;\n }\n\n // reverse wrap-around is enabled\n // other than for normal operation mode, reverse wrap-around allows the cursor\n // to be at x=cols to be able to address the last cell of a row by BS\n this._restrictCursor(this._bufferService.cols);\n\n if (buffer.x > 0) {\n buffer.x--;\n } else {\n /**\n * reverse wrap-around handling:\n * Our implementation deviates from xterm on purpose. Details:\n * - only previous soft NLs can be reversed (isWrapped=true)\n * - only works within scrollborders (top/bottom, left/right not yet supported)\n * - cannot peek into scrollbuffer\n * - any cursor movement sequence keeps working as expected\n */\n if (buffer.x === 0\n && buffer.y > buffer.scrollTop\n && buffer.y <= buffer.scrollBottom\n && buffer.lines.get(buffer.ybase + buffer.y)?.isWrapped)\n {\n buffer.lines.get(buffer.ybase + buffer.y)!.isWrapped = false;\n buffer.y--;\n buffer.x = this._bufferService.cols - 1;\n // find last taken cell - last cell can have 3 different states:\n // - hasContent(true) + hasWidth(1): narrow char - we are done\n // - hasWidth(0): second part of wide char - we are done\n // - hasContent(false) + hasWidth(1): empty cell due to early wrapping wide char, go one cell further back\n const line = buffer.lines.get(buffer.ybase + buffer.y)!;\n if (line.hasWidth(buffer.x) && !line.hasContent(buffer.x)) {\n buffer.x--;\n // We do this only once, since width=1 + hasContent=false currently happens only once before\n // early wrapping of a wide char.\n // This needs to be fixed once we support graphemes taking more than 2 cells.\n }\n }\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * TAB\n * Horizontal Tab (HT) (Ctrl-I).\n *\n * @vt: #Y C0 HT \"Horizontal Tabulation\" \"\\t, \\x09\" \"Move the cursor to the next character tab stop.\"\n */\n public tab(): boolean {\n if (this._bufferService.buffer.x >= this._bufferService.cols) {\n return true;\n }\n const originalX = this._bufferService.buffer.x;\n this._bufferService.buffer.x = this._bufferService.buffer.nextStop();\n if (this._optionsService.options.screenReaderMode) {\n this._onA11yTab.fire(this._bufferService.buffer.x - originalX);\n }\n return true;\n }\n\n /**\n * SO\n * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the\n * G1 character set.\n *\n * @vt: #P[Only limited ISO-2022 charset support.] C0 SO \"Shift Out\" \"\\x0E\" \"Switch to an alternative character set.\"\n */\n public shiftOut(): boolean {\n this._charsetService.setgLevel(1);\n return true;\n }\n\n /**\n * SI\n * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0\n * character set (the default).\n *\n * @vt: #Y C0 SI \"Shift In\" \"\\x0F\" \"Return to regular character set after Shift Out.\"\n */\n public shiftIn(): boolean {\n this._charsetService.setgLevel(0);\n return true;\n }\n\n /**\n * Restrict cursor to viewport size / scroll margin (origin mode).\n */\n private _restrictCursor(maxCol: number = this._bufferService.cols - 1): void {\n this._bufferService.buffer.x = Math.min(maxCol, Math.max(0, this._bufferService.buffer.x));\n this._bufferService.buffer.y = this._coreService.decPrivateModes.origin\n ? Math.min(this._bufferService.buffer.scrollBottom, Math.max(this._bufferService.buffer.scrollTop, this._bufferService.buffer.y))\n : Math.min(this._bufferService.rows - 1, Math.max(0, this._bufferService.buffer.y));\n this._dirtyRowService.markDirty(this._bufferService.buffer.y);\n }\n\n /**\n * Set absolute cursor position.\n */\n private _setCursor(x: number, y: number): void {\n this._dirtyRowService.markDirty(this._bufferService.buffer.y);\n if (this._coreService.decPrivateModes.origin) {\n this._bufferService.buffer.x = x;\n this._bufferService.buffer.y = this._bufferService.buffer.scrollTop + y;\n } else {\n this._bufferService.buffer.x = x;\n this._bufferService.buffer.y = y;\n }\n this._restrictCursor();\n this._dirtyRowService.markDirty(this._bufferService.buffer.y);\n }\n\n /**\n * Set relative cursor position.\n */\n private _moveCursor(x: number, y: number): void {\n // for relative changes we have to make sure we are within 0 .. cols/rows - 1\n // before calculating the new position\n this._restrictCursor();\n this._setCursor(this._bufferService.buffer.x + x, this._bufferService.buffer.y + y);\n }\n\n /**\n * CSI Ps A\n * Cursor Up Ps Times (default = 1) (CUU).\n *\n * @vt: #Y CSI CUU \"Cursor Up\" \"CSI Ps A\" \"Move cursor `Ps` times up (default=1).\"\n * If the cursor would pass the top scroll margin, it will stop there.\n */\n public cursorUp(params: IParams): boolean {\n // stop at scrollTop\n const diffToTop = this._bufferService.buffer.y - this._bufferService.buffer.scrollTop;\n if (diffToTop >= 0) {\n this._moveCursor(0, -Math.min(diffToTop, params.params[0] || 1));\n } else {\n this._moveCursor(0, -(params.params[0] || 1));\n }\n return true;\n }\n\n /**\n * CSI Ps B\n * Cursor Down Ps Times (default = 1) (CUD).\n *\n * @vt: #Y CSI CUD \"Cursor Down\" \"CSI Ps B\" \"Move cursor `Ps` times down (default=1).\"\n * If the cursor would pass the bottom scroll margin, it will stop there.\n */\n public cursorDown(params: IParams): boolean {\n // stop at scrollBottom\n const diffToBottom = this._bufferService.buffer.scrollBottom - this._bufferService.buffer.y;\n if (diffToBottom >= 0) {\n this._moveCursor(0, Math.min(diffToBottom, params.params[0] || 1));\n } else {\n this._moveCursor(0, params.params[0] || 1);\n }\n return true;\n }\n\n /**\n * CSI Ps C\n * Cursor Forward Ps Times (default = 1) (CUF).\n *\n * @vt: #Y CSI CUF \"Cursor Forward\" \"CSI Ps C\" \"Move cursor `Ps` times forward (default=1).\"\n */\n public cursorForward(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Ps D\n * Cursor Backward Ps Times (default = 1) (CUB).\n *\n * @vt: #Y CSI CUB \"Cursor Backward\" \"CSI Ps D\" \"Move cursor `Ps` times backward (default=1).\"\n */\n public cursorBackward(params: IParams): boolean {\n this._moveCursor(-(params.params[0] || 1), 0);\n return true;\n }\n\n /**\n * CSI Ps E\n * Cursor Next Line Ps Times (default = 1) (CNL).\n * Other than cursorDown (CUD) also set the cursor to first column.\n *\n * @vt: #Y CSI CNL \"Cursor Next Line\" \"CSI Ps E\" \"Move cursor `Ps` times down (default=1) and to the first column.\"\n * Same as CUD, additionally places the cursor at the first column.\n */\n public cursorNextLine(params: IParams): boolean {\n this.cursorDown(params);\n this._bufferService.buffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps F\n * Cursor Previous Line Ps Times (default = 1) (CPL).\n * Other than cursorUp (CUU) also set the cursor to first column.\n *\n * @vt: #Y CSI CPL \"Cursor Backward\" \"CSI Ps F\" \"Move cursor `Ps` times up (default=1) and to the first column.\"\n * Same as CUU, additionally places the cursor at the first column.\n */\n public cursorPrecedingLine(params: IParams): boolean {\n this.cursorUp(params);\n this._bufferService.buffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps G\n * Cursor Character Absolute [column] (default = [row,1]) (CHA).\n *\n * @vt: #Y CSI CHA \"Cursor Horizontal Absolute\" \"CSI Ps G\" \"Move cursor to `Ps`-th column of the active row (default=1).\"\n */\n public cursorCharAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y);\n return true;\n }\n\n /**\n * CSI Ps ; Ps H\n * Cursor Position [row;column] (default = [1,1]) (CUP).\n *\n * @vt: #Y CSI CUP \"Cursor Position\" \"CSI Ps ; Ps H\" \"Set cursor to position [`Ps`, `Ps`] (default = [1, 1]).\"\n * If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins.\n * If ORIGIN mode is not set, places the cursor to the absolute position within the viewport.\n * Note that the coordinates are 1-based, thus the top left position starts at `1 ; 1`.\n */\n public cursorPosition(params: IParams): boolean {\n this._setCursor(\n // col\n (params.length >= 2) ? (params.params[1] || 1) - 1 : 0,\n // row\n (params.params[0] || 1) - 1\n );\n return true;\n }\n\n /**\n * CSI Pm ` Character Position Absolute\n * [column] (default = [row,1]) (HPA).\n * Currently same functionality as CHA.\n *\n * @vt: #Y CSI HPA \"Horizontal Position Absolute\" \"CSI Ps ` \" \"Same as CHA.\"\n */\n public charPosAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._bufferService.buffer.y);\n return true;\n }\n\n /**\n * CSI Pm a Character Position Relative\n * [columns] (default = [row,col+1]) (HPR)\n *\n * @vt: #Y CSI HPR \"Horizontal Position Relative\" \"CSI Ps a\" \"Same as CUF.\"\n */\n public hPositionRelative(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Pm d Vertical Position Absolute (VPA)\n * [row] (default = [1,column])\n *\n * @vt: #Y CSI VPA \"Vertical Position Absolute\" \"CSI Ps d\" \"Move cursor to `Ps`-th row (default=1).\"\n */\n public linePosAbsolute(params: IParams): boolean {\n this._setCursor(this._bufferService.buffer.x, (params.params[0] || 1) - 1);\n return true;\n }\n\n /**\n * CSI Pm e Vertical Position Relative (VPR)\n * [rows] (default = [row+1,column])\n * reuse CSI Ps B ?\n *\n * @vt: #Y CSI VPR \"Vertical Position Relative\" \"CSI Ps e\" \"Move cursor `Ps` times down (default=1).\"\n */\n public vPositionRelative(params: IParams): boolean {\n this._moveCursor(0, params.params[0] || 1);\n return true;\n }\n\n /**\n * CSI Ps ; Ps f\n * Horizontal and Vertical Position [row;column] (default =\n * [1,1]) (HVP).\n * Same as CUP.\n *\n * @vt: #Y CSI HVP \"Horizontal and Vertical Position\" \"CSI Ps ; Ps f\" \"Same as CUP.\"\n */\n public hVPosition(params: IParams): boolean {\n this.cursorPosition(params);\n return true;\n }\n\n /**\n * CSI Ps g Tab Clear (TBC).\n * Ps = 0 -> Clear Current Column (default).\n * Ps = 3 -> Clear All.\n * Potentially:\n * Ps = 2 -> Clear Stops on Line.\n * http://vt100.net/annarbor/aaa-ug/section6.html\n *\n * @vt: #Y CSI TBC \"Tab Clear\" \"CSI Ps g\" \"Clear tab stops at current position (0) or all (3) (default=0).\"\n * Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported.\n */\n public tabClear(params: IParams): boolean {\n const param = params.params[0];\n if (param === 0) {\n delete this._bufferService.buffer.tabs[this._bufferService.buffer.x];\n } else if (param === 3) {\n this._bufferService.buffer.tabs = {};\n }\n return true;\n }\n\n /**\n * CSI Ps I\n * Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).\n *\n * @vt: #Y CSI CHT \"Cursor Horizontal Tabulation\" \"CSI Ps I\" \"Move cursor `Ps` times tabs forward (default=1).\"\n */\n public cursorForwardTab(params: IParams): boolean {\n if (this._bufferService.buffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n while (param--) {\n this._bufferService.buffer.x = this._bufferService.buffer.nextStop();\n }\n return true;\n }\n\n /**\n * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).\n *\n * @vt: #Y CSI CBT \"Cursor Backward Tabulation\" \"CSI Ps Z\" \"Move cursor `Ps` tabs backward (default=1).\"\n */\n public cursorBackwardTab(params: IParams): boolean {\n if (this._bufferService.buffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n\n // make buffer local for faster access\n const buffer = this._bufferService.buffer;\n\n while (param--) {\n buffer.x = buffer.prevStop();\n }\n return true;\n }\n\n\n /**\n * Helper method to erase cells in a terminal row.\n * The cell gets replaced with the eraseChar of the terminal.\n * @param y row index\n * @param start first cell index to be erased\n * @param end end - 1 is last erased cell\n */\n private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false): void {\n const line = this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase + y)!;\n line.replaceCells(\n start,\n end,\n this._bufferService.buffer.getNullCell(this._eraseAttrData()),\n this._eraseAttrData()\n );\n if (clearWrap) {\n line.isWrapped = false;\n }\n }\n\n /**\n * Helper method to reset cells in a terminal row.\n * The cell gets replaced with the eraseChar of the terminal and the isWrapped property is set to false.\n * @param y row index\n */\n private _resetBufferLine(y: number): void {\n const line = this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase + y)!;\n line.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n\n /**\n * CSI Ps J Erase in Display (ED).\n * Ps = 0 -> Erase Below (default).\n * Ps = 1 -> Erase Above.\n * Ps = 2 -> Erase All.\n * Ps = 3 -> Erase Saved Lines (xterm).\n * CSI ? Ps J\n * Erase in Display (DECSED).\n * Ps = 0 -> Selective Erase Below (default).\n * Ps = 1 -> Selective Erase Above.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI ED \"Erase In Display\" \"CSI Ps J\" \"Erase various parts of the viewport.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | ------------------------------------------------------------ |\n * | 0 | Erase from the cursor through the end of the viewport. |\n * | 1 | Erase from the beginning of the viewport through the cursor. |\n * | 2 | Erase complete viewport. |\n * | 3 | Erase scrollback. |\n *\n * @vt: #P[Protection attributes are not supported.] CSI DECSED \"Selective Erase In Display\" \"CSI ? Ps J\" \"Currently the same as ED.\"\n */\n public eraseInDisplay(params: IParams): boolean {\n this._restrictCursor();\n let j;\n switch (params.params[0]) {\n case 0:\n j = this._bufferService.buffer.y;\n this._dirtyRowService.markDirty(j);\n this._eraseInBufferLine(j++, this._bufferService.buffer.x, this._bufferService.cols, this._bufferService.buffer.x === 0);\n for (; j < this._bufferService.rows; j++) {\n this._resetBufferLine(j);\n }\n this._dirtyRowService.markDirty(j);\n break;\n case 1:\n j = this._bufferService.buffer.y;\n this._dirtyRowService.markDirty(j);\n // Deleted front part of line and everything before. This line will no longer be wrapped.\n this._eraseInBufferLine(j, 0, this._bufferService.buffer.x + 1, true);\n if (this._bufferService.buffer.x + 1 >= this._bufferService.cols) {\n // Deleted entire previous line. This next line can no longer be wrapped.\n this._bufferService.buffer.lines.get(j + 1)!.isWrapped = false;\n }\n while (j--) {\n this._resetBufferLine(j);\n }\n this._dirtyRowService.markDirty(0);\n break;\n case 2:\n j = this._bufferService.rows;\n this._dirtyRowService.markDirty(j - 1);\n while (j--) {\n this._resetBufferLine(j);\n }\n this._dirtyRowService.markDirty(0);\n break;\n case 3:\n // Clear scrollback (everything not in viewport)\n const scrollBackSize = this._bufferService.buffer.lines.length - this._bufferService.rows;\n if (scrollBackSize > 0) {\n this._bufferService.buffer.lines.trimStart(scrollBackSize);\n this._bufferService.buffer.ybase = Math.max(this._bufferService.buffer.ybase - scrollBackSize, 0);\n this._bufferService.buffer.ydisp = Math.max(this._bufferService.buffer.ydisp - scrollBackSize, 0);\n // Force a scroll event to refresh viewport\n this._onScroll.fire(0);\n }\n break;\n }\n return true;\n }\n\n /**\n * CSI Ps K Erase in Line (EL).\n * Ps = 0 -> Erase to Right (default).\n * Ps = 1 -> Erase to Left.\n * Ps = 2 -> Erase All.\n * CSI ? Ps K\n * Erase in Line (DECSEL).\n * Ps = 0 -> Selective Erase to Right (default).\n * Ps = 1 -> Selective Erase to Left.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI EL \"Erase In Line\" \"CSI Ps K\" \"Erase various parts of the active row.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | -------------------------------------------------------- |\n * | 0 | Erase from the cursor through the end of the row. |\n * | 1 | Erase from the beginning of the line through the cursor. |\n * | 2 | Erase complete line. |\n *\n * @vt: #P[Protection attributes are not supported.] CSI DECSEL \"Selective Erase In Line\" \"CSI ? Ps K\" \"Currently the same as EL.\"\n */\n public eraseInLine(params: IParams): boolean {\n this._restrictCursor();\n switch (params.params[0]) {\n case 0:\n this._eraseInBufferLine(this._bufferService.buffer.y, this._bufferService.buffer.x, this._bufferService.cols);\n break;\n case 1:\n this._eraseInBufferLine(this._bufferService.buffer.y, 0, this._bufferService.buffer.x + 1);\n break;\n case 2:\n this._eraseInBufferLine(this._bufferService.buffer.y, 0, this._bufferService.cols);\n break;\n }\n this._dirtyRowService.markDirty(this._bufferService.buffer.y);\n return true;\n }\n\n /**\n * CSI Ps L\n * Insert Ps Line(s) (default = 1) (IL).\n *\n * @vt: #Y CSI IL \"Insert Line\" \"CSI Ps L\" \"Insert `Ps` blank lines at active row (default=1).\"\n * For every inserted line at the scroll top one line at the scroll bottom gets removed.\n * The cursor is set to the first column.\n * IL has no effect if the cursor is outside the scroll margins.\n */\n public insertLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n // make buffer local for faster access\n const buffer = this._bufferService.buffer;\n\n if (buffer.y > buffer.scrollBottom || buffer.y < buffer.scrollTop) {\n return true;\n }\n\n const row: number = buffer.ybase + buffer.y;\n\n const scrollBottomRowsOffset = this._bufferService.rows - 1 - buffer.scrollBottom;\n const scrollBottomAbsolute = this._bufferService.rows - 1 + buffer.ybase - scrollBottomRowsOffset + 1;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1L\\e[0m'\n // blankLine(true) - xterm/linux behavior\n buffer.lines.splice(scrollBottomAbsolute - 1, 1);\n buffer.lines.splice(row, 0, buffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowService.markRangeDirty(buffer.y, buffer.scrollBottom);\n buffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps M\n * Delete Ps Line(s) (default = 1) (DL).\n *\n * @vt: #Y CSI DL \"Delete Line\" \"CSI Ps M\" \"Delete `Ps` lines at active row (default=1).\"\n * For every deleted line at the scroll top one blank line at the scroll bottom gets appended.\n * The cursor is set to the first column.\n * DL has no effect if the cursor is outside the scroll margins.\n */\n public deleteLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n // make buffer local for faster access\n const buffer = this._bufferService.buffer;\n\n if (buffer.y > buffer.scrollBottom || buffer.y < buffer.scrollTop) {\n return true;\n }\n\n const row: number = buffer.ybase + buffer.y;\n\n let j: number;\n j = this._bufferService.rows - 1 - buffer.scrollBottom;\n j = this._bufferService.rows - 1 + buffer.ybase - j;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1M\\e[0m'\n // blankLine(true) - xterm/linux behavior\n buffer.lines.splice(row, 1);\n buffer.lines.splice(j, 0, buffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowService.markRangeDirty(buffer.y, buffer.scrollBottom);\n buffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps @\n * Insert Ps (Blank) Character(s) (default = 1) (ICH).\n *\n * @vt: #Y CSI ICH \"Insert Characters\" \"CSI Ps @\" \"Insert `Ps` (blank) characters (default = 1).\"\n * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the blank characters.\n * Text between the cursor and right margin moves to the right. Characters moved past the right margin are lost.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public insertChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase + this._bufferService.buffer.y);\n if (line) {\n line.insertCells(\n this._bufferService.buffer.x,\n params.params[0] || 1,\n this._bufferService.buffer.getNullCell(this._eraseAttrData()),\n this._eraseAttrData()\n );\n this._dirtyRowService.markDirty(this._bufferService.buffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps P\n * Delete Ps Character(s) (default = 1) (DCH).\n *\n * @vt: #Y CSI DCH \"Delete Character\" \"CSI Ps P\" \"Delete `Ps` characters (default=1).\"\n * As characters are deleted, the remaining characters between the cursor and right margin move to the left.\n * Character attributes move with the characters. The terminal adds blank characters at the right margin.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public deleteChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase + this._bufferService.buffer.y);\n if (line) {\n line.deleteCells(\n this._bufferService.buffer.x,\n params.params[0] || 1,\n this._bufferService.buffer.getNullCell(this._eraseAttrData()),\n this._eraseAttrData()\n );\n this._dirtyRowService.markDirty(this._bufferService.buffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps S Scroll up Ps lines (default = 1) (SU).\n *\n * @vt: #Y CSI SU \"Scroll Up\" \"CSI Ps S\" \"Scroll `Ps` lines up (default=1).\"\n *\n *\n * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm)\n */\n public scrollUp(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n // make buffer local for faster access\n const buffer = this._bufferService.buffer;\n\n while (param--) {\n buffer.lines.splice(buffer.ybase + buffer.scrollTop, 1);\n buffer.lines.splice(buffer.ybase + buffer.scrollBottom, 0, buffer.getBlankLine(this._eraseAttrData()));\n }\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps T Scroll down Ps lines (default = 1) (SD).\n *\n * @vt: #Y CSI SD \"Scroll Down\" \"CSI Ps T\" \"Scroll `Ps` lines down (default=1).\"\n */\n public scrollDown(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n // make buffer local for faster access\n const buffer = this._bufferService.buffer;\n\n while (param--) {\n buffer.lines.splice(buffer.ybase + buffer.scrollBottom, 1);\n buffer.lines.splice(buffer.ybase + buffer.scrollTop, 0, buffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP @ Scroll left Ps columns (default = 1) (SL) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/00\n * Parameter default value: Pn = 1\n * SL causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the left; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always left shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SL \"Scroll Left\" \"CSI Ps SP @\" \"Scroll viewport `Ps` times to the left.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the left.\n * SL has no effect outside of the scroll margins.\n */\n public scrollLeft(params: IParams): boolean {\n const buffer = this._bufferService.buffer;\n if (buffer.y > buffer.scrollBottom || buffer.y < buffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = buffer.scrollTop; y <= buffer.scrollBottom; ++y) {\n const line = buffer.lines.get(buffer.ybase + y)!;\n line.deleteCells(0, param, buffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n line.isWrapped = false;\n }\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP A Scroll right Ps columns (default = 1) (SR) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/01\n * Parameter default value: Pn = 1\n * SR causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the right; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always right shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SR \"Scroll Right\" \"CSI Ps SP A\" \"Scroll viewport `Ps` times to the right.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the right.\n * Content at the right margin is lost.\n * SL has no effect outside of the scroll margins.\n */\n public scrollRight(params: IParams): boolean {\n const buffer = this._bufferService.buffer;\n if (buffer.y > buffer.scrollBottom || buffer.y < buffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = buffer.scrollTop; y <= buffer.scrollBottom; ++y) {\n const line = buffer.lines.get(buffer.ybase + y)!;\n line.insertCells(0, param, buffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n line.isWrapped = false;\n }\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' }\n * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.\n *\n * @vt: #Y CSI DECIC \"Insert Columns\" \"CSI Ps ' }\" \"Insert `Ps` columns at cursor position.\"\n * DECIC inserts `Ps` times blank columns at the cursor position for all lines with the scroll margins,\n * moving content to the right. Content at the right margin is lost.\n * DECIC has no effect outside the scrolling margins.\n */\n public insertColumns(params: IParams): boolean {\n const buffer = this._bufferService.buffer;\n if (buffer.y > buffer.scrollBottom || buffer.y < buffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = buffer.scrollTop; y <= buffer.scrollBottom; ++y) {\n const line = this._bufferService.buffer.lines.get(buffer.ybase + y)!;\n line.insertCells(buffer.x, param, buffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n line.isWrapped = false;\n }\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' ~\n * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.\n *\n * @vt: #Y CSI DECDC \"Delete Columns\" \"CSI Ps ' ~\" \"Delete `Ps` columns at cursor position.\"\n * DECDC deletes `Ps` times columns at the cursor position for all lines with the scroll margins,\n * moving content to the left. Blank columns are added at the right margin.\n * DECDC has no effect outside the scrolling margins.\n */\n public deleteColumns(params: IParams): boolean {\n const buffer = this._bufferService.buffer;\n if (buffer.y > buffer.scrollBottom || buffer.y < buffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = buffer.scrollTop; y <= buffer.scrollBottom; ++y) {\n const line = buffer.lines.get(buffer.ybase + y)!;\n line.deleteCells(buffer.x, param, buffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n line.isWrapped = false;\n }\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps X\n * Erase Ps Character(s) (default = 1) (ECH).\n *\n * @vt: #Y CSI ECH \"Erase Character\" \"CSI Ps X\" \"Erase `Ps` characters from current cursor position to the right (default=1).\"\n * ED erases `Ps` characters from current cursor position to the right.\n * ED works inside or outside the scrolling margins.\n */\n public eraseChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase + this._bufferService.buffer.y);\n if (line) {\n line.replaceCells(\n this._bufferService.buffer.x,\n this._bufferService.buffer.x + (params.params[0] || 1),\n this._bufferService.buffer.getNullCell(this._eraseAttrData()),\n this._eraseAttrData()\n );\n this._dirtyRowService.markDirty(this._bufferService.buffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps b Repeat the preceding graphic character Ps times (REP).\n * From ECMA 48 (@see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf)\n * Notation: (Pn)\n * Representation: CSI Pn 06/02\n * Parameter default value: Pn = 1\n * REP is used to indicate that the preceding character in the data stream,\n * if it is a graphic character (represented by one or more bit combinations) including SPACE,\n * is to be repeated n times, where n equals the value of Pn.\n * If the character preceding REP is a control function or part of a control function,\n * the effect of REP is not defined by this Standard.\n *\n * Since we propagate the terminal as xterm-256color we have to follow xterm's behavior:\n * - fullwidth + surrogate chars are ignored\n * - for combining chars only the base char gets repeated\n * - text attrs are applied normally\n * - wrap around is respected\n * - any valid sequence resets the carried forward char\n *\n * Note: To get reset on a valid sequence working correctly without much runtime penalty,\n * the preceding codepoint is stored on the parser in `this.print` and reset during `parser.parse`.\n *\n * @vt: #Y CSI REP \"Repeat Preceding Character\" \"CSI Ps b\" \"Repeat preceding character `Ps` times (default=1).\"\n * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is set.\n * REP has no effect if the sequence does not follow a printable ASCII character\n * (NOOP for any other sequence in between or NON ASCII characters).\n */\n public repeatPrecedingCharacter(params: IParams): boolean {\n if (!this._parser.precedingCodepoint) {\n return true;\n }\n // call print to insert the chars and handle correct wrapping\n const length = params.params[0] || 1;\n const data = new Uint32Array(length);\n for (let i = 0; i < length; ++i) {\n data[i] = this._parser.precedingCodepoint;\n }\n this.print(data, 0, data.length);\n return true;\n }\n\n /**\n * CSI Ps c Send Device Attributes (Primary DA).\n * Ps = 0 or omitted -> request attributes from terminal. The\n * response depends on the decTerminalID resource setting.\n * -> CSI ? 1 ; 2 c (``VT100 with Advanced Video Option'')\n * -> CSI ? 1 ; 0 c (``VT101 with No Options'')\n * -> CSI ? 6 c (``VT102'')\n * -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'')\n * The VT100-style response parameters do not mean anything by\n * themselves. VT220 parameters do, telling the host what fea-\n * tures the terminal supports:\n * Ps = 1 -> 132-columns.\n * Ps = 2 -> Printer.\n * Ps = 6 -> Selective erase.\n * Ps = 8 -> User-defined keys.\n * Ps = 9 -> National replacement character sets.\n * Ps = 1 5 -> Technical characters.\n * Ps = 2 2 -> ANSI color, e.g., VT525.\n * Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode).\n *\n * @vt: #Y CSI DA1 \"Primary Device Attributes\" \"CSI c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesPrimary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n if (this._is('xterm') || this._is('rxvt-unicode') || this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?1;2c');\n } else if (this._is('linux')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?6c');\n }\n return true;\n }\n\n /**\n * CSI > Ps c\n * Send Device Attributes (Secondary DA).\n * Ps = 0 or omitted -> request the terminal's identification\n * code. The response depends on the decTerminalID resource set-\n * ting. It should apply only to VT220 and up, but xterm extends\n * this to VT100.\n * -> CSI > Pp ; Pv ; Pc c\n * where Pp denotes the terminal type\n * Pp = 0 -> ``VT100''.\n * Pp = 1 -> ``VT220''.\n * and Pv is the firmware version (for xterm, this was originally\n * the XFree86 patch number, starting with 95). In a DEC termi-\n * nal, Pc indicates the ROM cartridge registration number and is\n * always zero.\n * More information:\n * xterm/charproc.c - line 2012, for more information.\n * vim responds with ^[[?0c or ^[[?1c after the terminal's response (?)\n *\n * @vt: #Y CSI DA2 \"Secondary Device Attributes\" \"CSI > c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesSecondary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n // xterm and urxvt\n // seem to spit this\n // out around ~370 times (?).\n if (this._is('xterm')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>0;276;0c');\n } else if (this._is('rxvt-unicode')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>85;95;0c');\n } else if (this._is('linux')) {\n // not supported by linux console.\n // linux console echoes parameters.\n this._coreService.triggerDataEvent(params.params[0] + 'c');\n } else if (this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>83;40003;0c');\n }\n return true;\n }\n\n /**\n * Evaluate if the current terminal is the given argument.\n * @param term The terminal name to evaluate\n */\n private _is(term: string): boolean {\n return (this._optionsService.options.termName + '').indexOf(term) === 0;\n }\n\n /**\n * CSI Pm h Set Mode (SM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Insert Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Automatic Newline (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI SM \"Set Mode\" \"CSI Pm h\" \"Set various terminal modes.\"\n * Supported param values by SM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Insert Mode (IRM). | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Automatic Newline (LNM). Always off. | #N |\n */\n public setMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = true;\n break;\n case 20:\n // this._t.convertEol = true;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm h\n * DEC Private Mode Set (DECSET).\n * Ps = 1 -> Application Cursor Keys (DECCKM).\n * Ps = 2 -> Designate USASCII for character sets G0-G3\n * (DECANM), and set VT100 mode.\n * Ps = 3 -> 132 Column Mode (DECCOLM).\n * Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).\n * Ps = 5 -> Reverse Video (DECSCNM).\n * Ps = 6 -> Origin Mode (DECOM).\n * Ps = 7 -> Wraparound Mode (DECAWM).\n * Ps = 8 -> Auto-repeat Keys (DECARM).\n * Ps = 9 -> Send Mouse X & Y on button press. See the sec-\n * tion Mouse Tracking.\n * Ps = 1 0 -> Show toolbar (rxvt).\n * Ps = 1 2 -> Start Blinking Cursor (att610).\n * Ps = 1 8 -> Print form feed (DECPFF).\n * Ps = 1 9 -> Set print extent to full screen (DECPEX).\n * Ps = 2 5 -> Show Cursor (DECTCEM).\n * Ps = 3 0 -> Show scrollbar (rxvt).\n * Ps = 3 5 -> Enable font-shifting functions (rxvt).\n * Ps = 3 8 -> Enter Tektronix Mode (DECTEK).\n * Ps = 4 0 -> Allow 80 -> 132 Mode.\n * Ps = 4 1 -> more(1) fix (see curses resource).\n * Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-\n * RCM).\n * Ps = 4 4 -> Turn On Margin Bell.\n * Ps = 4 5 -> Reverse-wraparound Mode.\n * Ps = 4 6 -> Start Logging. This is normally disabled by a\n * compile-time option.\n * Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 6 6 -> Application keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends backspace (DECBKM).\n * Ps = 1 0 0 0 -> Send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Enable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).\n * Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Interpret \"meta\" key, sets eighth bit.\n * (enables the eightBitInput resource).\n * Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-\n * Lock keys. (This enables the numLock resource).\n * Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This\n * enables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete\n * key.\n * Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This\n * enables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Keep selection even if not highlighted.\n * (This enables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Enable Urgency window manager hint when\n * Control-G is received. (This enables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Enable raising of the window when Control-G\n * is received. (enables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate\n * Screen Buffer, clearing it first. (This may be disabled by\n * the titeInhibit resource). This combines the effects of the 1\n * 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based\n * applications rather than the 4 7 mode.\n * Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Set Sun function-key mode.\n * Ps = 1 0 5 2 -> Set HP function-key mode.\n * Ps = 1 0 5 3 -> Set SCO function-key mode.\n * Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Set VT220 keyboard emulation.\n * Ps = 2 0 0 4 -> Set bracketed paste mode.\n * Modes:\n * http: *vt100.net/docs/vt220-rm/chapter4.html\n *\n * @vt: #P[See below for supported modes.] CSI DECSET \"DEC Private Set Mode\" \"CSI ? Pm h\" \"Set various terminal attributes.\"\n * Supported param values by DECSET:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | --------|\n * | 1 | Application Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | #Y |\n * | 3 | 132 Column Mode (DECCOLM). | #Y |\n * | 6 | Origin Mode (DECOM). | #Y |\n * | 7 | Auto-wrap Mode (DECAWM). | #Y |\n * | 8 | Auto-repeat Keys (DECARM). Always on. | #N |\n * | 9 | X10 xterm mouse protocol. | #Y |\n * | 12 | Start Blinking Cursor. | #Y |\n * | 25 | Show Cursor (DECTCEM). | #Y |\n * | 45 | Reverse wrap-around. | #Y |\n * | 47 | Use Alternate Screen Buffer. | #Y |\n * | 66 | Application keypad (DECNKM). | #Y |\n * | 1000 | X11 xterm mouse protocol. | #Y |\n * | 1002 | Use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Use All Motion Mouse Tracking. | #Y |\n * | 1004 | Send FocusIn/FocusOut events | #Y |\n * | 1005 | Enable UTF-8 Mouse Mode. | #N |\n * | 1006 | Enable SGR Mouse Mode. | #Y |\n * | 1015 | Enable urxvt Mouse Mode. | #N |\n * | 1047 | Use Alternate Screen Buffer. | #Y |\n * | 1048 | Save cursor as in DECSC. | #Y |\n * | 1049 | Save cursor and switch to alternate buffer clearing it. | #P[Does not clear the alternate buffer.] |\n * | 2004 | Set bracketed paste mode. | #Y |\n *\n *\n * FIXME: implement DECSCNM, 1049 should clear altbuffer\n */\n public setModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = true;\n break;\n case 2:\n this._charsetService.setgCharset(0, DEFAULT_CHARSET);\n this._charsetService.setgCharset(1, DEFAULT_CHARSET);\n this._charsetService.setgCharset(2, DEFAULT_CHARSET);\n this._charsetService.setgCharset(3, DEFAULT_CHARSET);\n // set VT100 mode here\n break;\n case 3:\n /**\n * DECCOLM - 132 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.options.windowOptions.setWinLines) {\n this._bufferService.resize(132, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = true;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = true;\n break;\n case 12:\n // this.cursorBlink = true;\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = true;\n break;\n case 66:\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n // no release, no motion, no wheel, no modifiers.\n this._coreMouseService.activeProtocol = 'X10';\n break;\n case 1000: // vt200 mouse\n // no motion.\n this._coreMouseService.activeProtocol = 'VT200';\n break;\n case 1002: // button event mouse\n this._coreMouseService.activeProtocol = 'DRAG';\n break;\n case 1003: // any event mouse\n // any event - sends motion events,\n // even if there is no button held down.\n this._coreMouseService.activeProtocol = 'ANY';\n break;\n case 1004: // send focusin/focusout events\n // focusin: ^[[I\n // focusout: ^[[O\n this._coreService.decPrivateModes.sendFocus = true;\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'SGR';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1015 not supported (see #2507)');\n break;\n case 25: // show cursor\n this._coreService.isCursorHidden = false;\n break;\n case 1048: // alt screen cursor\n this.saveCursor();\n break;\n case 1049: // alt screen buffer cursor\n this.saveCursor();\n // FALL-THROUGH\n case 47: // alt screen buffer\n case 1047: // alt screen buffer\n this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = true;\n break;\n }\n }\n return true;\n }\n\n\n /**\n * CSI Pm l Reset Mode (RM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Replace Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Normal Linefeed (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI RM \"Reset Mode\" \"CSI Pm l\" \"Set various terminal attributes.\"\n * Supported param values by RM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Replace Mode (IRM). (default) | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Normal Linefeed (LNM). Always off. | #N |\n *\n *\n * FIXME: why is LNM commented out?\n */\n public resetMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = false;\n break;\n case 20:\n // this._t.convertEol = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm l\n * DEC Private Mode Reset (DECRST).\n * Ps = 1 -> Normal Cursor Keys (DECCKM).\n * Ps = 2 -> Designate VT52 mode (DECANM).\n * Ps = 3 -> 80 Column Mode (DECCOLM).\n * Ps = 4 -> Jump (Fast) Scroll (DECSCLM).\n * Ps = 5 -> Normal Video (DECSCNM).\n * Ps = 6 -> Normal Cursor Mode (DECOM).\n * Ps = 7 -> No Wraparound Mode (DECAWM).\n * Ps = 8 -> No Auto-repeat Keys (DECARM).\n * Ps = 9 -> Don't send Mouse X & Y on button press.\n * Ps = 1 0 -> Hide toolbar (rxvt).\n * Ps = 1 2 -> Stop Blinking Cursor (att610).\n * Ps = 1 8 -> Don't print form feed (DECPFF).\n * Ps = 1 9 -> Limit print to scrolling region (DECPEX).\n * Ps = 2 5 -> Hide Cursor (DECTCEM).\n * Ps = 3 0 -> Don't show scrollbar (rxvt).\n * Ps = 3 5 -> Disable font-shifting functions (rxvt).\n * Ps = 4 0 -> Disallow 80 -> 132 Mode.\n * Ps = 4 1 -> No more(1) fix (see curses resource).\n * Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-\n * NRCM).\n * Ps = 4 4 -> Turn Off Margin Bell.\n * Ps = 4 5 -> No Reverse-wraparound Mode.\n * Ps = 4 6 -> Stop Logging. (This is normally disabled by a\n * compile-time option).\n * Ps = 4 7 -> Use Normal Screen Buffer.\n * Ps = 6 6 -> Numeric keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends delete (DECBKM).\n * Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Disable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Don't scroll to bottom on tty output\n * (rxvt).\n * Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Don't interpret \"meta\" key. (This disables\n * the eightBitInput resource).\n * Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-\n * Lock keys. (This disables the numLock resource).\n * Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key.\n * (This disables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad\n * Delete key.\n * Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key.\n * (This disables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Do not keep selection when not highlighted.\n * (This disables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the PRIMARY selection. (This disables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Disable Urgency window manager hint when\n * Control-G is received. (This disables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Disable raising of the window when Control-\n * G is received. (This disables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen\n * first if in the Alternate Screen. (This may be disabled by\n * the titeInhibit resource).\n * Ps = 1 0 4 8 -> Restore cursor as in DECRC. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor\n * as in DECRC. (This may be disabled by the titeInhibit\n * resource). This combines the effects of the 1 0 4 7 and 1 0\n * 4 8 modes. Use this with terminfo-based applications rather\n * than the 4 7 mode.\n * Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Reset Sun function-key mode.\n * Ps = 1 0 5 2 -> Reset HP function-key mode.\n * Ps = 1 0 5 3 -> Reset SCO function-key mode.\n * Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.\n * Ps = 2 0 0 4 -> Reset bracketed paste mode.\n *\n * @vt: #P[See below for supported modes.] CSI DECRST \"DEC Private Reset Mode\" \"CSI ? Pm l\" \"Reset various terminal attributes.\"\n * Supported param values by DECRST:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | ------- |\n * | 1 | Normal Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate VT52 mode (DECANM). | #N |\n * | 3 | 80 Column Mode (DECCOLM). | #B[Switches to old column width instead of 80.] |\n * | 6 | Normal Cursor Mode (DECOM). | #Y |\n * | 7 | No Wraparound Mode (DECAWM). | #Y |\n * | 8 | No Auto-repeat Keys (DECARM). | #N |\n * | 9 | Don't send Mouse X & Y on button press. | #Y |\n * | 12 | Stop Blinking Cursor. | #Y |\n * | 25 | Hide Cursor (DECTCEM). | #Y |\n * | 45 | No reverse wrap-around. | #Y |\n * | 47 | Use Normal Screen Buffer. | #Y |\n * | 66 | Numeric keypad (DECNKM). | #Y |\n * | 1000 | Don't send Mouse reports. | #Y |\n * | 1002 | Don't use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Don't use All Motion Mouse Tracking. | #Y |\n * | 1004 | Don't send FocusIn/FocusOut events. | #Y |\n * | 1005 | Disable UTF-8 Mouse Mode. | #N |\n * | 1006 | Disable SGR Mouse Mode. | #Y |\n * | 1015 | Disable urxvt Mouse Mode. | #N |\n * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | #Y |\n * | 1048 | Restore cursor as in DECRC. | #Y |\n * | 1049 | Use Normal Screen Buffer and restore cursor. | #Y |\n * | 2004 | Reset bracketed paste mode. | #Y |\n *\n *\n * FIXME: DECCOLM is currently broken (already fixed in window options PR)\n */\n public resetModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = false;\n break;\n case 3:\n /**\n * DECCOLM - 80 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.options.windowOptions.setWinLines) {\n this._bufferService.resize(80, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = false;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = false;\n break;\n case 12:\n // this.cursorBlink = false;\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = false;\n break;\n case 66:\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n case 1000: // vt200 mouse\n case 1002: // button event mouse\n case 1003: // any event mouse\n this._coreMouseService.activeProtocol = 'NONE';\n break;\n case 1004: // send focusin/focusout events\n this._coreService.decPrivateModes.sendFocus = false;\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1015 not supported (see #2507)');\n break;\n case 25: // hide cursor\n this._coreService.isCursorHidden = true;\n break;\n case 1048: // alt screen cursor\n this.restoreCursor();\n break;\n case 1049: // alt screen buffer cursor\n // FALL-THROUGH\n case 47: // normal screen buffer\n case 1047: // normal screen buffer - clearing it first\n // Ensure the selection manager has the correct buffer\n this._bufferService.buffers.activateNormalBuffer();\n if (params.params[i] === 1049) {\n this.restoreCursor();\n }\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * Helper to write color information packed with color mode.\n */\n private _updateAttrColor(color: number, mode: number, c1: number, c2: number, c3: number): number {\n if (mode === 2) {\n color |= Attributes.CM_RGB;\n color &= ~Attributes.RGB_MASK;\n color |= AttributeData.fromColorRGB([c1, c2, c3]);\n } else if (mode === 5) {\n color &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n color |= Attributes.CM_P256 | (c1 & 0xff);\n }\n return color;\n }\n\n /**\n * Helper to extract and apply color params/subparams.\n * Returns advance for params index.\n */\n private _extractColor(params: IParams, pos: number, attr: IAttributeData): number {\n // normalize params\n // meaning: [target, CM, ign, val, val, val]\n // RGB : [ 38/48, 2, ign, r, g, b]\n // P256 : [ 38/48, 5, ign, v, ign, ign]\n const accu = [0, 0, -1, 0, 0, 0];\n\n // alignment placeholder for non color space sequences\n let cSpace = 0;\n\n // return advance we took in params\n let advance = 0;\n\n do {\n accu[advance + cSpace] = params.params[pos + advance];\n if (params.hasSubParams(pos + advance)) {\n const subparams = params.getSubParams(pos + advance)!;\n let i = 0;\n do {\n if (accu[1] === 5) {\n cSpace = 1;\n }\n accu[advance + i + 1 + cSpace] = subparams[i];\n } while (++i < subparams.length && i + advance + 1 + cSpace < accu.length);\n break;\n }\n // exit early if can decide color mode with semicolons\n if ((accu[1] === 5 && advance + cSpace >= 2)\n || (accu[1] === 2 && advance + cSpace >= 5)) {\n break;\n }\n // offset colorSpace slot for semicolon mode\n if (accu[1]) {\n cSpace = 1;\n }\n } while (++advance + pos < params.length && advance + cSpace < accu.length);\n\n // set default values to 0\n for (let i = 2; i < accu.length; ++i) {\n if (accu[i] === -1) {\n accu[i] = 0;\n }\n }\n\n // apply colors\n switch (accu[0]) {\n case 38:\n attr.fg = this._updateAttrColor(attr.fg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 48:\n attr.bg = this._updateAttrColor(attr.bg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 58:\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = this._updateAttrColor(attr.extended.underlineColor, accu[1], accu[3], accu[4], accu[5]);\n }\n\n return advance;\n }\n\n /**\n * SGR 4 subparams:\n * 4:0 - equal to SGR 24 (turn off all underline)\n * 4:1 - equal to SGR 4 (single underline)\n * 4:2 - equal to SGR 21 (double underline)\n * 4:3 - curly underline\n * 4:4 - dotted underline\n * 4:5 - dashed underline\n */\n private _processUnderline(style: number, attr: IAttributeData): void {\n // treat extended attrs as immutable, thus always clone from old one\n // this is needed since the buffer only holds references to it\n attr.extended = attr.extended.clone();\n\n // default to 1 == single underline\n if (!~style || style > 5) {\n style = 1;\n }\n attr.extended.underlineStyle = style;\n attr.fg |= FgFlags.UNDERLINE;\n\n // 0 deactivates underline\n if (style === 0) {\n attr.fg &= ~FgFlags.UNDERLINE;\n }\n\n // update HAS_EXTENDED in BG\n attr.updateExtended();\n }\n\n /**\n * CSI Pm m Character Attributes (SGR).\n *\n * @vt: #P[See below for supported attributes.] CSI SGR \"Select Graphic Rendition\" \"CSI Pm m\" \"Set/Reset various text attributes.\"\n * SGR selects one or more character attributes at the same time. Multiple params (up to 32)\n * are applied in order from left to right. The changed attributes are applied to all new\n * characters received. If you move characters in the viewport by scrolling or any other means,\n * then the attributes move with the characters.\n *\n * Supported param values by SGR:\n *\n * | Param | Meaning | Support |\n * | --------- | -------------------------------------------------------- | ------- |\n * | 0 | Normal (default). Resets any other preceding SGR. | #Y |\n * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | #Y |\n * | 2 | Faint, decreased intensity. | #Y |\n * | 3 | Italic. | #Y |\n * | 4 | Underlined (see below for style support). | #Y |\n * | 5 | Slowly blinking. | #N |\n * | 6 | Rapidly blinking. | #N |\n * | 7 | Inverse. Flips foreground and background color. | #Y |\n * | 8 | Invisible (hidden). | #Y |\n * | 9 | Crossed-out characters. | #N |\n * | 21 | Doubly underlined. | #P[Currently outputs a single underline.] |\n * | 22 | Normal (neither bold nor faint). | #Y |\n * | 23 | No italic. | #Y |\n * | 24 | Not underlined. | #Y |\n * | 25 | Steady (not blinking). | #Y |\n * | 27 | Positive (not inverse). | #Y |\n * | 28 | Visible (not hidden). | #Y |\n * | 29 | Not Crossed-out. | #N |\n * | 30 | Foreground color: Black. | #Y |\n * | 31 | Foreground color: Red. | #Y |\n * | 32 | Foreground color: Green. | #Y |\n * | 33 | Foreground color: Yellow. | #Y |\n * | 34 | Foreground color: Blue. | #Y |\n * | 35 | Foreground color: Magenta. | #Y |\n * | 36 | Foreground color: Cyan. | #Y |\n * | 37 | Foreground color: White. | #Y |\n * | 38 | Foreground color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 39 | Foreground color: Default (original). | #Y |\n * | 40 | Background color: Black. | #Y |\n * | 41 | Background color: Red. | #Y |\n * | 42 | Background color: Green. | #Y |\n * | 43 | Background color: Yellow. | #Y |\n * | 44 | Background color: Blue. | #Y |\n * | 45 | Background color: Magenta. | #Y |\n * | 46 | Background color: Cyan. | #Y |\n * | 47 | Background color: White. | #Y |\n * | 48 | Background color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 49 | Background color: Default (original). | #Y |\n * | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y |\n * | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y |\n *\n * Underline supports subparams to denote the style in the form `4 : x`:\n *\n * | x | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | No underline. Same as `SGR 24 m`. | #Y |\n * | 1 | Single underline. Same as `SGR 4 m`. | #Y |\n * | 2 | Double underline. | #P[Currently outputs a single underline.] |\n * | 3 | Curly underline. | #P[Currently outputs a single underline.] |\n * | 4 | Dotted underline. | #P[Currently outputs a single underline.] |\n * | 5 | Dashed underline. | #P[Currently outputs a single underline.] |\n * | other | Single underline. Same as `SGR 4 m`. | #Y |\n *\n * Extended colors are supported for foreground (Ps=38) and background (Ps=48) as follows:\n *\n * | Ps + 1 | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | Implementation defined. | #N |\n * | 1 | Transparent. | #N |\n * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | #Y |\n * | 3 | CMY color. | #N |\n * | 4 | CMYK color. | #N |\n * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | #Y |\n *\n *\n * FIXME: blinking is implemented in attrs, but not working in renderers?\n * FIXME: remove dead branch for p=100\n */\n public charAttributes(params: IParams): boolean {\n // Optimize a single SGR0.\n if (params.length === 1 && params.params[0] === 0) {\n this._curAttrData.fg = DEFAULT_ATTR_DATA.fg;\n this._curAttrData.bg = DEFAULT_ATTR_DATA.bg;\n return true;\n }\n\n const l = params.length;\n let p;\n const attr = this._curAttrData;\n\n for (let i = 0; i < l; i++) {\n p = params.params[i];\n if (p >= 30 && p <= 37) {\n // fg color 8\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 30);\n } else if (p >= 40 && p <= 47) {\n // bg color 8\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 40);\n } else if (p >= 90 && p <= 97) {\n // fg color 16\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 90) | 8;\n } else if (p >= 100 && p <= 107) {\n // bg color 16\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 100) | 8;\n } else if (p === 0) {\n // default\n attr.fg = DEFAULT_ATTR_DATA.fg;\n attr.bg = DEFAULT_ATTR_DATA.bg;\n } else if (p === 1) {\n // bold text\n attr.fg |= FgFlags.BOLD;\n } else if (p === 3) {\n // italic text\n attr.bg |= BgFlags.ITALIC;\n } else if (p === 4) {\n // underlined text\n attr.fg |= FgFlags.UNDERLINE;\n this._processUnderline(params.hasSubParams(i) ? params.getSubParams(i)![0] : UnderlineStyle.SINGLE, attr);\n } else if (p === 5) {\n // blink\n attr.fg |= FgFlags.BLINK;\n } else if (p === 7) {\n // inverse and positive\n // test with: echo -e '\\e[31m\\e[42mhello\\e[7mworld\\e[27mhi\\e[m'\n attr.fg |= FgFlags.INVERSE;\n } else if (p === 8) {\n // invisible\n attr.fg |= FgFlags.INVISIBLE;\n } else if (p === 2) {\n // dimmed text\n attr.bg |= BgFlags.DIM;\n } else if (p === 21) {\n // double underline\n this._processUnderline(UnderlineStyle.DOUBLE, attr);\n } else if (p === 22) {\n // not bold nor faint\n attr.fg &= ~FgFlags.BOLD;\n attr.bg &= ~BgFlags.DIM;\n } else if (p === 23) {\n // not italic\n attr.bg &= ~BgFlags.ITALIC;\n } else if (p === 24) {\n // not underlined\n attr.fg &= ~FgFlags.UNDERLINE;\n } else if (p === 25) {\n // not blink\n attr.fg &= ~FgFlags.BLINK;\n } else if (p === 27) {\n // not inverse\n attr.fg &= ~FgFlags.INVERSE;\n } else if (p === 28) {\n // not invisible\n attr.fg &= ~FgFlags.INVISIBLE;\n } else if (p === 39) {\n // reset fg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 49) {\n // reset bg\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 38 || p === 48 || p === 58) {\n // fg color 256 and RGB\n i += this._extractColor(params, i, attr);\n } else if (p === 59) {\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = -1;\n attr.updateExtended();\n } else if (p === 100) { // FIXME: dead branch, p=100 already handled above!\n // reset fg/bg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else {\n this._logService.debug('Unknown SGR attribute: %d.', p);\n }\n }\n return true;\n }\n\n /**\n * CSI Ps n Device Status Report (DSR).\n * Ps = 5 -> Status Report. Result (``OK'') is\n * CSI 0 n\n * Ps = 6 -> Report Cursor Position (CPR) [row;column].\n * Result is\n * CSI r ; c R\n * CSI ? Ps n\n * Device Status Report (DSR, DEC-specific).\n * Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI\n * ? r ; c R (assumes page is zero).\n * Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).\n * or CSI ? 1 1 n (not ready).\n * Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)\n * or CSI ? 2 1 n (locked).\n * Ps = 2 6 -> Report Keyboard status as\n * CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).\n * The last two parameters apply to VT400 & up, and denote key-\n * board ready and LK01 respectively.\n * Ps = 5 3 -> Report Locator status as\n * CSI ? 5 3 n Locator available, if compiled-in, or\n * CSI ? 5 0 n No Locator, if not.\n *\n * @vt: #Y CSI DSR \"Device Status Report\" \"CSI Ps n\" \"Request cursor position (CPR) with `Ps` = 6.\"\n */\n public deviceStatus(params: IParams): boolean {\n switch (params.params[0]) {\n case 5:\n // status report\n this._coreService.triggerDataEvent(`${C0.ESC}[0n`);\n break;\n case 6:\n // cursor position\n const y = this._bufferService.buffer.y + 1;\n const x = this._bufferService.buffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[${y};${x}R`);\n break;\n }\n return true;\n }\n\n // @vt: #P[Only CPR is supported.] CSI DECDSR \"DEC Device Status Report\" \"CSI ? Ps n\" \"Only CPR is supported (same as DSR).\"\n public deviceStatusPrivate(params: IParams): boolean {\n // modern xterm doesnt seem to\n // respond to any of these except ?6, 6, and 5\n switch (params.params[0]) {\n case 6:\n // cursor position\n const y = this._bufferService.buffer.y + 1;\n const x = this._bufferService.buffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[?${y};${x}R`);\n break;\n case 15:\n // no printer\n // this.handler(C0.ESC + '[?11n');\n break;\n case 25:\n // dont support user defined keys\n // this.handler(C0.ESC + '[?21n');\n break;\n case 26:\n // north american keyboard\n // this.handler(C0.ESC + '[?27;1;0;0n');\n break;\n case 53:\n // no dec locator/mouse\n // this.handler(C0.ESC + '[?50n');\n break;\n }\n return true;\n }\n\n /**\n * CSI ! p Soft terminal reset (DECSTR).\n * http://vt100.net/docs/vt220-rm/table4-10.html\n *\n * @vt: #Y CSI DECSTR \"Soft Terminal Reset\" \"CSI ! p\" \"Reset several terminal attributes to initial state.\"\n * There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full terminal bootstrap,\n * DECSTR only resets certain attributes. For most needs DECSTR should be sufficient.\n *\n * The following terminal attributes are reset to default values:\n * - IRM is reset (dafault = false)\n * - scroll margins are reset (default = viewport size)\n * - erase attributes are reset to default\n * - charsets are reset\n * - DECSC data is reset to initial values\n * - DECOM is reset to absolute mode\n *\n *\n * FIXME: there are several more attributes missing (see VT520 manual)\n */\n public softReset(params: IParams): boolean {\n this._coreService.isCursorHidden = false;\n this._onRequestSyncScrollBar.fire();\n this._bufferService.buffer.scrollTop = 0;\n this._bufferService.buffer.scrollBottom = this._bufferService.rows - 1;\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._coreService.reset();\n this._charsetService.reset();\n\n // reset DECSC data\n this._bufferService.buffer.savedX = 0;\n this._bufferService.buffer.savedY = this._bufferService.buffer.ybase;\n this._bufferService.buffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._bufferService.buffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._bufferService.buffer.savedCharset = this._charsetService.charset;\n\n // reset DECOM\n this._coreService.decPrivateModes.origin = false;\n return true;\n }\n\n /**\n * CSI Ps SP q Set cursor style (DECSCUSR, VT520).\n * Ps = 0 -> blinking block.\n * Ps = 1 -> blinking block (default).\n * Ps = 2 -> steady block.\n * Ps = 3 -> blinking underline.\n * Ps = 4 -> steady underline.\n * Ps = 5 -> blinking bar (xterm).\n * Ps = 6 -> steady bar (xterm).\n *\n * @vt: #Y CSI DECSCUSR \"Set Cursor Style\" \"CSI Ps SP q\" \"Set cursor style.\"\n * Supported cursor styles:\n * - empty, 0 or 1: steady block\n * - 2: blink block\n * - 3: steady underline\n * - 4: blink underline\n * - 5: steady bar\n * - 6: blink bar\n */\n public setCursorStyle(params: IParams): boolean {\n const param = params.params[0] || 1;\n switch (param) {\n case 1:\n case 2:\n this._optionsService.options.cursorStyle = 'block';\n break;\n case 3:\n case 4:\n this._optionsService.options.cursorStyle = 'underline';\n break;\n case 5:\n case 6:\n this._optionsService.options.cursorStyle = 'bar';\n break;\n }\n const isBlinking = param % 2 === 1;\n this._optionsService.options.cursorBlink = isBlinking;\n return true;\n }\n\n /**\n * CSI Ps ; Ps r\n * Set Scrolling Region [top;bottom] (default = full size of win-\n * dow) (DECSTBM).\n *\n * @vt: #Y CSI DECSTBM \"Set Top and Bottom Margin\" \"CSI Ps ; Ps r\" \"Set top and bottom margins of the viewport [top;bottom] (default = viewport size).\"\n */\n public setScrollRegion(params: IParams): boolean {\n const top = params.params[0] || 1;\n let bottom: number;\n\n if (params.length < 2 || (bottom = params.params[1]) > this._bufferService.rows || bottom === 0) {\n bottom = this._bufferService.rows;\n }\n\n if (bottom > top) {\n this._bufferService.buffer.scrollTop = top - 1;\n this._bufferService.buffer.scrollBottom = bottom - 1;\n this._setCursor(0, 0);\n }\n return true;\n }\n\n /**\n * CSI Ps ; Ps ; Ps t - Various window manipulations and reports (xterm)\n *\n * Note: Only those listed below are supported. All others are left to integrators and\n * need special treatment based on the embedding environment.\n *\n * Ps = 1 4 supported\n * Report xterm text area size in pixels.\n * Result is CSI 4 ; height ; width t\n * Ps = 14 ; 2 not implemented\n * Ps = 16 supported\n * Report xterm character cell size in pixels.\n * Result is CSI 6 ; height ; width t\n * Ps = 18 supported\n * Report the size of the text area in characters.\n * Result is CSI 8 ; height ; width t\n * Ps = 20 supported\n * Report xterm window's icon label.\n * Result is OSC L label ST\n * Ps = 21 supported\n * Report xterm window's title.\n * Result is OSC l label ST\n * Ps = 22 ; 0 -> Save xterm icon and window title on stack. supported\n * Ps = 22 ; 1 -> Save xterm icon title on stack. supported\n * Ps = 22 ; 2 -> Save xterm window title on stack. supported\n * Ps = 23 ; 0 -> Restore xterm icon and window title from stack. supported\n * Ps = 23 ; 1 -> Restore xterm icon title from stack. supported\n * Ps = 23 ; 2 -> Restore xterm window title from stack. supported\n * Ps >= 24 not implemented\n */\n public windowOptions(params: IParams): boolean {\n if (!paramToWindowOption(params.params[0], this._optionsService.options.windowOptions)) {\n return true;\n }\n const second = (params.length > 1) ? params.params[1] : 0;\n switch (params.params[0]) {\n case 14: // GetWinSizePixels, returns CSI 4 ; height ; width t\n if (second !== 2) {\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_WIN_SIZE_PIXELS);\n }\n break;\n case 16: // GetCellSizePixels, returns CSI 6 ; height ; width t\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_CELL_SIZE_PIXELS);\n break;\n case 18: // GetWinSizeChars, returns CSI 8 ; height ; width t\n if (this._bufferService) {\n this._coreService.triggerDataEvent(`${C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);\n }\n break;\n case 22: // PushTitle\n if (second === 0 || second === 2) {\n this._windowTitleStack.push(this._windowTitle);\n if (this._windowTitleStack.length > STACK_LIMIT) {\n this._windowTitleStack.shift();\n }\n }\n if (second === 0 || second === 1) {\n this._iconNameStack.push(this._iconName);\n if (this._iconNameStack.length > STACK_LIMIT) {\n this._iconNameStack.shift();\n }\n }\n break;\n case 23: // PopTitle\n if (second === 0 || second === 2) {\n if (this._windowTitleStack.length) {\n this.setTitle(this._windowTitleStack.pop()!);\n }\n }\n if (second === 0 || second === 1) {\n if (this._iconNameStack.length) {\n this.setIconName(this._iconNameStack.pop()!);\n }\n }\n break;\n }\n return true;\n }\n\n\n /**\n * CSI s\n * ESC 7\n * Save cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCOSC \"Save Cursor\" \"CSI s\" \"Save cursor position, charmap and text attributes.\"\n * @vt: #Y ESC SC \"Save Cursor\" \"ESC 7\" \"Save cursor position, charmap and text attributes.\"\n */\n public saveCursor(params?: IParams): boolean {\n this._bufferService.buffer.savedX = this._bufferService.buffer.x;\n this._bufferService.buffer.savedY = this._bufferService.buffer.ybase + this._bufferService.buffer.y;\n this._bufferService.buffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._bufferService.buffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._bufferService.buffer.savedCharset = this._charsetService.charset;\n return true;\n }\n\n\n /**\n * CSI u\n * ESC 8\n * Restore cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCORC \"Restore Cursor\" \"CSI u\" \"Restore cursor position, charmap and text attributes.\"\n * @vt: #Y ESC RC \"Restore Cursor\" \"ESC 8\" \"Restore cursor position, charmap and text attributes.\"\n */\n public restoreCursor(params?: IParams): boolean {\n this._bufferService.buffer.x = this._bufferService.buffer.savedX || 0;\n this._bufferService.buffer.y = Math.max(this._bufferService.buffer.savedY - this._bufferService.buffer.ybase, 0);\n this._curAttrData.fg = this._bufferService.buffer.savedCurAttrData.fg;\n this._curAttrData.bg = this._bufferService.buffer.savedCurAttrData.bg;\n this._charsetService.charset = (this as any)._savedCharset;\n if (this._bufferService.buffer.savedCharset) {\n this._charsetService.charset = this._bufferService.buffer.savedCharset;\n }\n this._restrictCursor();\n return true;\n }\n\n\n /**\n * OSC 2; ST (set window title)\n * Proxy to set window title.\n *\n * @vt: #P[Icon name is not exposed.] OSC 0 \"Set Windows Title and Icon Name\" \"OSC 0 ; Pt BEL\" \"Set window title and icon name.\"\n * Icon name is not supported. For Window Title see below.\n *\n * @vt: #Y OSC 2 \"Set Windows Title\" \"OSC 2 ; Pt BEL\" \"Set window title.\"\n * xterm.js does not manipulate the title directly, instead exposes changes via the event `Terminal.onTitleChange`.\n */\n public setTitle(data: string): boolean {\n this._windowTitle = data;\n this._onTitleChange.fire(data);\n return true;\n }\n\n /**\n * OSC 1; ST\n * Note: Icon name is not exposed.\n */\n public setIconName(data: string): boolean {\n this._iconName = data;\n return true;\n }\n\n protected _parseAnsiColorChange(data: string): IAnsiColorChangeEvent | null {\n const result: IAnsiColorChangeEvent = { colors: [] };\n // example data: 5;rgb:aa/bb/cc\n const regex = /(\\d+);rgb:([0-9a-f]{2})\\/([0-9a-f]{2})\\/([0-9a-f]{2})/gi;\n let match;\n\n while ((match = regex.exec(data)) !== null) {\n result.colors.push({\n colorIndex: parseInt(match[1]),\n red: parseInt(match[2], 16),\n green: parseInt(match[3], 16),\n blue: parseInt(match[4], 16)\n });\n }\n\n if (result.colors.length === 0) {\n return null;\n }\n\n return result;\n }\n\n /**\n * OSC 4; ; ST (set ANSI color to )\n *\n * @vt: #Y OSC 4 \"Set ANSI color\" \"OSC 4 ; c ; spec BEL\" \"Change color number `c` to the color specified by `spec`.\"\n * `c` is the color index between 0 and 255. `spec` color format is 'rgb:hh/hh/hh' where `h` are hexadecimal digits.\n * There may be multipe c ; spec elements present in the same instruction, e.g. 1;rgb:10/20/30;2;rgb:a0/b0/c0.\n */\n public setAnsiColor(data: string): boolean {\n const event = this._parseAnsiColorChange(data);\n if (event) {\n this._onAnsiColorChange.fire(event);\n }\n else {\n this._logService.warn(`Expected format ;rgb:// but got data: ${data}`);\n }\n return true;\n }\n\n /**\n * ESC E\n * C1.NEL\n * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL)\n * Moves cursor to first position on next line.\n *\n * @vt: #Y C1 NEL \"Next Line\" \"\\x85\" \"Move the cursor to the beginning of the next row.\"\n * @vt: #Y ESC NEL \"Next Line\" \"ESC E\" \"Move the cursor to the beginning of the next row.\"\n */\n public nextLine(): boolean {\n this._bufferService.buffer.x = 0;\n this.index();\n return true;\n }\n\n /**\n * ESC =\n * DEC mnemonic: DECKPAM (https://vt100.net/docs/vt510-rm/DECKPAM.html)\n * Enables the numeric keypad to send application sequences to the host.\n */\n public keypadApplicationMode(): boolean {\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC >\n * DEC mnemonic: DECKPNM (https://vt100.net/docs/vt510-rm/DECKPNM.html)\n * Enables the keypad to send numeric characters to the host.\n */\n public keypadNumericMode(): boolean {\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC % @\n * ESC % G\n * Select default character set. UTF-8 is not supported (string are unicode anyways)\n * therefore ESC % G does the same.\n */\n public selectDefaultCharset(): boolean {\n this._charsetService.setgLevel(0);\n this._charsetService.setgCharset(0, DEFAULT_CHARSET); // US (default)\n return true;\n }\n\n /**\n * ESC ( C\n * Designate G0 Character Set, VT100, ISO 2022.\n * ESC ) C\n * Designate G1 Character Set (ISO 2022, VT100).\n * ESC * C\n * Designate G2 Character Set (ISO 2022, VT220).\n * ESC + C\n * Designate G3 Character Set (ISO 2022, VT220).\n * ESC - C\n * Designate G1 Character Set (VT300).\n * ESC . C\n * Designate G2 Character Set (VT300).\n * ESC / C\n * Designate G3 Character Set (VT300). C = A -> ISO Latin-1 Supplemental. - Supported?\n */\n public selectCharset(collectAndFlag: string): boolean {\n if (collectAndFlag.length !== 2) {\n this.selectDefaultCharset();\n return true;\n }\n if (collectAndFlag[0] === '/') {\n return true; // TODO: Is this supported?\n }\n this._charsetService.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] || DEFAULT_CHARSET);\n return true;\n }\n\n /**\n * ESC D\n * C1.IND\n * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html)\n * Moves the cursor down one line in the same column.\n *\n * @vt: #Y C1 IND \"Index\" \"\\x84\" \"Move the cursor one line down scrolling if needed.\"\n * @vt: #Y ESC IND \"Index\" \"ESC D\" \"Move the cursor one line down scrolling if needed.\"\n */\n public index(): boolean {\n this._restrictCursor();\n const buffer = this._bufferService.buffer;\n this._bufferService.buffer.y++;\n if (buffer.y === buffer.scrollBottom + 1) {\n buffer.y--;\n this._onRequestScroll.fire(this._eraseAttrData());\n } else if (buffer.y >= this._bufferService.rows) {\n buffer.y = this._bufferService.rows - 1;\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * ESC H\n * C1.HTS\n * DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html)\n * Sets a horizontal tab stop at the column position indicated by\n * the value of the active column when the terminal receives an HTS.\n *\n * @vt: #Y C1 HTS \"Horizontal Tabulation Set\" \"\\x88\" \"Places a tab stop at the current cursor position.\"\n * @vt: #Y ESC HTS \"Horizontal Tabulation Set\" \"ESC H\" \"Places a tab stop at the current cursor position.\"\n */\n public tabSet(): boolean {\n this._bufferService.buffer.tabs[this._bufferService.buffer.x] = true;\n return true;\n }\n\n /**\n * ESC M\n * C1.RI\n * DEC mnemonic: HTS\n * Moves the cursor up one line in the same column. If the cursor is at the top margin,\n * the page scrolls down.\n *\n * @vt: #Y ESC IR \"Reverse Index\" \"ESC M\" \"Move the cursor one line up scrolling if needed.\"\n */\n public reverseIndex(): boolean {\n this._restrictCursor();\n const buffer = this._bufferService.buffer;\n if (buffer.y === buffer.scrollTop) {\n // possibly move the code below to term.reverseScroll();\n // test: echo -ne '\\e[1;1H\\e[44m\\eM\\e[0m'\n // blankLine(true) is xterm/linux behavior\n const scrollRegionHeight = buffer.scrollBottom - buffer.scrollTop;\n buffer.lines.shiftElements(buffer.ybase + buffer.y, scrollRegionHeight, 1);\n buffer.lines.set(buffer.ybase + buffer.y, buffer.getBlankLine(this._eraseAttrData()));\n this._dirtyRowService.markRangeDirty(buffer.scrollTop, buffer.scrollBottom);\n } else {\n buffer.y--;\n this._restrictCursor(); // quickfix to not run out of bounds\n }\n return true;\n }\n\n /**\n * ESC c\n * DEC mnemonic: RIS (https://vt100.net/docs/vt510-rm/RIS.html)\n * Reset to initial state.\n */\n public fullReset(): boolean {\n this._parser.reset();\n this._onRequestReset.fire();\n return true;\n }\n\n public reset(): void {\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._eraseAttrDataInternal = DEFAULT_ATTR_DATA.clone();\n }\n\n /**\n * back_color_erase feature for xterm.\n */\n private _eraseAttrData(): IAttributeData {\n this._eraseAttrDataInternal.bg &= ~(Attributes.CM_MASK | 0xFFFFFF);\n this._eraseAttrDataInternal.bg |= this._curAttrData.bg & ~0xFC000000;\n return this._eraseAttrDataInternal;\n }\n\n /**\n * ESC n\n * ESC o\n * ESC |\n * ESC }\n * ESC ~\n * DEC mnemonic: LS (https://vt100.net/docs/vt510-rm/LS.html)\n * When you use a locking shift, the character set remains in GL or GR until\n * you use another locking shift. (partly supported)\n */\n public setgLevel(level: number): boolean {\n this._charsetService.setgLevel(level);\n return true;\n }\n\n /**\n * ESC # 8\n * DEC mnemonic: DECALN (https://vt100.net/docs/vt510-rm/DECALN.html)\n * This control function fills the complete screen area with\n * a test pattern (E) used for adjusting screen alignment.\n *\n * @vt: #Y ESC DECALN \"Screen Alignment Pattern\" \"ESC # 8\" \"Fill viewport with a test pattern (E).\"\n */\n public screenAlignmentPattern(): boolean {\n // prepare cell data\n const cell = new CellData();\n cell.content = 1 << Content.WIDTH_SHIFT | 'E'.charCodeAt(0);\n cell.fg = this._curAttrData.fg;\n cell.bg = this._curAttrData.bg;\n\n const buffer = this._bufferService.buffer;\n\n this._setCursor(0, 0);\n for (let yOffset = 0; yOffset < this._bufferService.rows; ++yOffset) {\n const row = buffer.ybase + buffer.y + yOffset;\n const line = buffer.lines.get(row);\n if (line) {\n line.fill(cell);\n line.isWrapped = false;\n }\n }\n this._dirtyRowService.markAllDirty();\n this._setCursor(0, 0);\n return true;\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\n\n/**\n * A base class that can be extended to provide convenience methods for managing the lifecycle of an\n * object and its components.\n */\nexport abstract class Disposable implements IDisposable {\n protected _disposables: IDisposable[] = [];\n protected _isDisposed: boolean = false;\n\n constructor() {\n }\n\n /**\n * Disposes the object, triggering the `dispose` method on all registered IDisposables.\n */\n public dispose(): void {\n this._isDisposed = true;\n for (const d of this._disposables) {\n d.dispose();\n }\n this._disposables.length = 0;\n }\n\n /**\n * Registers a disposable object.\n * @param d The disposable to register.\n * @returns The disposable.\n */\n public register(d: T): T {\n this._disposables.push(d);\n return d;\n }\n\n /**\n * Unregisters a disposable object if it has been registered, if not do\n * nothing.\n * @param d The disposable to unregister.\n */\n public unregister(d: T): void {\n const index = this._disposables.indexOf(d);\n if (index !== -1) {\n this._disposables.splice(index, 1);\n }\n }\n}\n\n/**\n * Dispose of all disposables in an array and set its length to 0.\n */\nexport function disposeArray(disposables: IDisposable[]): void {\n for (const d of disposables) {\n d.dispose();\n }\n disposables.length = 0;\n}\n\n/**\n * Creates a disposable that will dispose of an array of disposables when disposed.\n */\nexport function getDisposeArrayDisposable(array: IDisposable[]): IDisposable {\n return { dispose: () => disposeArray(array) };\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\ninterface INavigator {\n userAgent: string;\n language: string;\n platform: string;\n}\n\n// We're declaring a navigator global here as we expect it in all runtimes (node and browser), but\n// we want this module to live in common.\ndeclare const navigator: INavigator;\n\nconst isNode = (typeof navigator === 'undefined') ? true : false;\nconst userAgent = (isNode) ? 'node' : navigator.userAgent;\nconst platform = (isNode) ? 'node' : navigator.platform;\n\nexport const isFirefox = userAgent.includes('Firefox');\nexport const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);\n\n// Find the users platform. We use this to interpret the meta key\n// and ISO third level shifts.\n// http://stackoverflow.com/q/19877924/577598\nexport const isMac = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].includes(platform);\nexport const isIpad = platform === 'iPad';\nexport const isIphone = platform === 'iPhone';\nexport const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform);\nexport const isLinux = platform.indexOf('Linux') >= 0;\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;\n\n\n/**\n * polyfill for TypedArray.fill\n * This is needed to support .fill in all safari versions and IE 11.\n */\nexport function fill(array: T, value: number, start?: number, end?: number): T {\n // all modern engines that support .fill\n if (array.fill) {\n return array.fill(value, start, end) as T;\n }\n return fillFallback(array, value, start, end);\n}\n\nexport function fillFallback(array: T, value: number, start: number = 0, end: number = array.length): T {\n // safari and IE 11\n // since IE 11 does not support Array.prototype.fill either\n // we cannot use the suggested polyfill from MDN\n // instead we simply fall back to looping\n if (start >= array.length) {\n return array;\n }\n start = (array.length + start) % array.length;\n if (end >= array.length) {\n end = array.length;\n } else {\n end = (array.length + end) % array.length;\n }\n for (let i = start; i < end; ++i) {\n array[i] = value;\n }\n return array;\n}\n\n/**\n * Concat two typed arrays `a` and `b`.\n * Returns a new typed array.\n */\nexport function concat(a: T, b: T): T {\n const result = new (a.constructor as any)(a.length + b.length);\n result.set(a);\n result.set(b, a.length);\n return result;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';\nimport { IBufferService } from 'common/services/Services';\n\nexport function updateWindowsModeWrappedState(bufferService: IBufferService): void {\n // Winpty does not support wraparound mode which means that lines will never\n // be marked as wrapped. This causes issues for things like copying a line\n // retaining the wrapped new line characters or if consumers are listening\n // in on the data stream.\n //\n // The workaround for this is to listen to every incoming line feed and mark\n // the line as wrapped if the last character in the previous line is not a\n // space. This is certainly not without its problems, but generally on\n // Windows when text reaches the end of the terminal it's likely going to be\n // wrapped.\n const line = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y - 1);\n const lastChar = line?.get(bufferService.cols - 1);\n\n const nextLine = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y);\n if (nextLine && lastChar) {\n nextLine.isWrapped = (lastChar[CHAR_DATA_CODE_INDEX] !== NULL_CELL_CODE && lastChar[CHAR_DATA_CODE_INDEX] !== WHITESPACE_CELL_CODE);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/Types';\nimport { Attributes, FgFlags, BgFlags, UnderlineStyle } from 'common/buffer/Constants';\n\nexport class AttributeData implements IAttributeData {\n public static toColorRGB(value: number): IColorRGB {\n return [\n value >>> Attributes.RED_SHIFT & 255,\n value >>> Attributes.GREEN_SHIFT & 255,\n value & 255\n ];\n }\n\n public static fromColorRGB(value: IColorRGB): number {\n return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;\n }\n\n public clone(): IAttributeData {\n const newObj = new AttributeData();\n newObj.fg = this.fg;\n newObj.bg = this.bg;\n newObj.extended = this.extended.clone();\n return newObj;\n }\n\n // data\n public fg = 0;\n public bg = 0;\n public extended = new ExtendedAttrs();\n\n // flags\n public isInverse(): number { return this.fg & FgFlags.INVERSE; }\n public isBold(): number { return this.fg & FgFlags.BOLD; }\n public isUnderline(): number { return this.fg & FgFlags.UNDERLINE; }\n public isBlink(): number { return this.fg & FgFlags.BLINK; }\n public isInvisible(): number { return this.fg & FgFlags.INVISIBLE; }\n public isItalic(): number { return this.bg & BgFlags.ITALIC; }\n public isDim(): number { return this.bg & BgFlags.DIM; }\n\n // color modes\n public getFgColorMode(): number { return this.fg & Attributes.CM_MASK; }\n public getBgColorMode(): number { return this.bg & Attributes.CM_MASK; }\n public isFgRGB(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isBgRGB(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isFgPalette(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.fg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isBgPalette(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.bg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isFgDefault(): boolean { return (this.fg & Attributes.CM_MASK) === 0; }\n public isBgDefault(): boolean { return (this.bg & Attributes.CM_MASK) === 0; }\n public isAttributeDefault(): boolean { return this.fg === 0 && this.bg === 0; }\n\n // colors\n public getFgColor(): number {\n switch (this.fg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.fg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.fg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n public getBgColor(): number {\n switch (this.bg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.bg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.bg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n\n // extended attrs\n public hasExtendedAttrs(): number {\n return this.bg & BgFlags.HAS_EXTENDED;\n }\n public updateExtended(): void {\n if (this.extended.isEmpty()) {\n this.bg &= ~BgFlags.HAS_EXTENDED;\n } else {\n this.bg |= BgFlags.HAS_EXTENDED;\n }\n }\n public getUnderlineColor(): number {\n if ((this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor) {\n switch (this.extended.underlineColor & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.extended.underlineColor & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.extended.underlineColor & Attributes.RGB_MASK;\n default: return this.getFgColor();\n }\n }\n return this.getFgColor();\n }\n public getUnderlineColorMode(): number {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? this.extended.underlineColor & Attributes.CM_MASK\n : this.getFgColorMode();\n }\n public isUnderlineColorRGB(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_RGB\n : this.isFgRGB();\n }\n public isUnderlineColorPalette(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P16\n || (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P256\n : this.isFgPalette();\n }\n public isUnderlineColorDefault(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === 0\n : this.isFgDefault();\n }\n public getUnderlineStyle(): UnderlineStyle {\n return this.fg & FgFlags.UNDERLINE\n ? (this.bg & BgFlags.HAS_EXTENDED ? this.extended.underlineStyle : UnderlineStyle.SINGLE)\n : UnderlineStyle.NONE;\n }\n}\n\n\n/**\n * Extended attributes for a cell.\n * Holds information about different underline styles and color.\n */\nexport class ExtendedAttrs implements IExtendedAttrs {\n constructor(\n // underline style, NONE is empty\n public underlineStyle: UnderlineStyle = UnderlineStyle.NONE,\n // underline color, -1 is empty (same as FG)\n public underlineColor: number = -1\n ) {}\n\n public clone(): IExtendedAttrs {\n return new ExtendedAttrs(this.underlineStyle, this.underlineColor);\n }\n\n /**\n * Convenient method to indicate whether the object holds no additional information,\n * that needs to be persistant in the buffer.\n */\n public isEmpty(): boolean {\n return this.underlineStyle === UnderlineStyle.NONE;\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CircularList, IInsertEvent } from 'common/CircularList';\nimport { IBuffer, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult } from 'common/buffer/Types';\nimport { IBufferLine, ICellData, IAttributeData, ICharset } from 'common/Types';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { CellData } from 'common/buffer/CellData';\nimport { NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from 'common/buffer/Constants';\nimport { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from 'common/buffer/BufferReflow';\nimport { Marker } from 'common/buffer/Marker';\nimport { IOptionsService, IBufferService } from 'common/services/Services';\nimport { DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { ExtendedAttrs } from 'common/buffer/AttributeData';\n\nexport const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1\n\n/**\n * This class represents a terminal buffer (an internal state of the terminal), where the\n * following information is stored (in high-level):\n * - text content of this particular buffer\n * - cursor position\n * - scroll position\n */\nexport class Buffer implements IBuffer {\n public lines: CircularList;\n public ydisp: number = 0;\n public ybase: number = 0;\n public y: number = 0;\n public x: number = 0;\n public scrollBottom: number;\n public scrollTop: number;\n // TODO: Type me\n public tabs: any;\n public savedY: number = 0;\n public savedX: number = 0;\n public savedCurAttrData = DEFAULT_ATTR_DATA.clone();\n public savedCharset: ICharset | undefined = DEFAULT_CHARSET;\n public markers: Marker[] = [];\n private _nullCell: ICellData = CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]);\n private _cols: number;\n private _rows: number;\n\n constructor(\n private _hasScrollback: boolean,\n private _optionsService: IOptionsService,\n private _bufferService: IBufferService\n ) {\n this._cols = this._bufferService.cols;\n this._rows = this._bufferService.rows;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n public getNullCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._nullCell.fg = attr.fg;\n this._nullCell.bg = attr.bg;\n this._nullCell.extended = attr.extended;\n } else {\n this._nullCell.fg = 0;\n this._nullCell.bg = 0;\n this._nullCell.extended = new ExtendedAttrs();\n }\n return this._nullCell;\n }\n\n public getWhitespaceCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._whitespaceCell.fg = attr.fg;\n this._whitespaceCell.bg = attr.bg;\n this._whitespaceCell.extended = attr.extended;\n } else {\n this._whitespaceCell.fg = 0;\n this._whitespaceCell.bg = 0;\n this._whitespaceCell.extended = new ExtendedAttrs();\n }\n return this._whitespaceCell;\n }\n\n public getBlankLine(attr: IAttributeData, isWrapped?: boolean): IBufferLine {\n return new BufferLine(this._bufferService.cols, this.getNullCell(attr), isWrapped);\n }\n\n public get hasScrollback(): boolean {\n return this._hasScrollback && this.lines.maxLength > this._rows;\n }\n\n public get isCursorInViewport(): boolean {\n const absoluteY = this.ybase + this.y;\n const relativeY = absoluteY - this.ydisp;\n return (relativeY >= 0 && relativeY < this._rows);\n }\n\n /**\n * Gets the correct buffer length based on the rows provided, the terminal's\n * scrollback and whether this buffer is flagged to have scrollback or not.\n * @param rows The terminal rows to use in the calculation.\n */\n private _getCorrectBufferLength(rows: number): number {\n if (!this._hasScrollback) {\n return rows;\n }\n\n const correctBufferLength = rows + this._optionsService.options.scrollback;\n\n return correctBufferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBufferLength;\n }\n\n /**\n * Fills the buffer's viewport with blank lines.\n */\n public fillViewportRows(fillAttr?: IAttributeData): void {\n if (this.lines.length === 0) {\n if (fillAttr === undefined) {\n fillAttr = DEFAULT_ATTR_DATA;\n }\n let i = this._rows;\n while (i--) {\n this.lines.push(this.getBlankLine(fillAttr));\n }\n }\n }\n\n /**\n * Clears the buffer to it's initial state, discarding all previous data.\n */\n public clear(): void {\n this.ydisp = 0;\n this.ybase = 0;\n this.y = 0;\n this.x = 0;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n /**\n * Resizes the buffer, adjusting its data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n // store reference to null cell with default attrs\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n\n // Increase max length if needed before adjustments to allow space to fill\n // as required.\n const newMaxLength = this._getCorrectBufferLength(newRows);\n if (newMaxLength > this.lines.maxLength) {\n this.lines.maxLength = newMaxLength;\n }\n\n // The following adjustments should only happen if the buffer has been\n // initialized/filled.\n if (this.lines.length > 0) {\n // Deal with columns increasing (reducing needs to happen after reflow)\n if (this._cols < newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n\n // Resize rows in both directions as needed\n let addToY = 0;\n if (this._rows < newRows) {\n for (let y = this._rows; y < newRows; y++) {\n if (this.lines.length < newRows + this.ybase) {\n if (this._optionsService.options.windowsMode) {\n // Just add the new missing rows on Windows as conpty reprints the screen with it's\n // view of the world. Once a line enters scrollback for conpty it remains there\n this.lines.push(new BufferLine(newCols, nullCell));\n } else {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n // There is room above the buffer and there are no empty elements below the line,\n // scroll up\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n // Viewport is at the top of the buffer, must increase downwards\n this.ydisp--;\n }\n } else {\n // Add a blank line if there is no buffer left at the top to scroll to, or if there\n // are blank lines after the cursor\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n }\n }\n }\n } else { // (this._rows >= newRows)\n for (let y = this._rows; y > newRows; y--) {\n if (this.lines.length > newRows + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n // The line is a blank line below the cursor, remove it\n this.lines.pop();\n } else {\n // The line is the cursor, scroll down\n this.ybase++;\n this.ydisp++;\n }\n }\n }\n }\n\n // Reduce max length if needed after adjustments, this is done after as it\n // would otherwise cut data from the bottom of the buffer.\n if (newMaxLength < this.lines.maxLength) {\n // Trim from the top of the buffer and adjust ybase and ydisp.\n const amountToTrim = this.lines.length - newMaxLength;\n if (amountToTrim > 0) {\n this.lines.trimStart(amountToTrim);\n this.ybase = Math.max(this.ybase - amountToTrim, 0);\n this.ydisp = Math.max(this.ydisp - amountToTrim, 0);\n this.savedY = Math.max(this.savedY - amountToTrim, 0);\n }\n this.lines.maxLength = newMaxLength;\n }\n\n // Make sure that the cursor stays on screen\n this.x = Math.min(this.x, newCols - 1);\n this.y = Math.min(this.y, newRows - 1);\n if (addToY) {\n this.y += addToY;\n }\n this.savedX = Math.min(this.savedX, newCols - 1);\n\n this.scrollTop = 0;\n }\n\n this.scrollBottom = newRows - 1;\n\n if (this._isReflowEnabled) {\n this._reflow(newCols, newRows);\n\n // Trim the end of the line off if cols shrunk\n if (this._cols > newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n }\n\n this._cols = newCols;\n this._rows = newRows;\n }\n\n private get _isReflowEnabled(): boolean {\n return this._hasScrollback && !this._optionsService.options.windowsMode;\n }\n\n private _reflow(newCols: number, newRows: number): void {\n if (this._cols === newCols) {\n return;\n }\n\n // Iterate through rows, ignore the last one as it cannot be wrapped\n if (newCols > this._cols) {\n this._reflowLarger(newCols, newRows);\n } else {\n this._reflowSmaller(newCols, newRows);\n }\n }\n\n private _reflowLarger(newCols: number, newRows: number): void {\n const toRemove: number[] = reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(DEFAULT_ATTR_DATA));\n if (toRemove.length > 0) {\n const newLayoutResult = reflowLargerCreateNewLayout(this.lines, toRemove);\n reflowLargerApplyNewLayout(this.lines, newLayoutResult.layout);\n this._reflowLargerAdjustViewport(newCols, newRows, newLayoutResult.countRemoved);\n }\n }\n\n private _reflowLargerAdjustViewport(newCols: number, newRows: number, countRemoved: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Adjust viewport based on number of items removed\n let viewportAdjustments = countRemoved;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y > 0) {\n this.y--;\n }\n if (this.lines.length < newRows) {\n // Add an extra row at the bottom of the viewport\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n } else {\n if (this.ydisp === this.ybase) {\n this.ydisp--;\n }\n this.ybase--;\n }\n }\n this.savedY = Math.max(this.savedY - countRemoved, 0);\n }\n\n private _reflowSmaller(newCols: number, newRows: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Gather all BufferLines that need to be inserted into the Buffer here so that they can be\n // batched up and only committed once\n const toInsert = [];\n let countToInsert = 0;\n // Go backwards as many lines may be trimmed and this will avoid considering them\n for (let y = this.lines.length - 1; y >= 0; y--) {\n // Check whether this line is a problem\n let nextLine = this.lines.get(y) as BufferLine;\n if (!nextLine || !nextLine.isWrapped && nextLine.getTrimmedLength() <= newCols) {\n continue;\n }\n\n // Gather wrapped lines and adjust y to be the starting line\n const wrappedLines: BufferLine[] = [nextLine];\n while (nextLine.isWrapped && y > 0) {\n nextLine = this.lines.get(--y) as BufferLine;\n wrappedLines.unshift(nextLine);\n }\n\n // If these lines contain the cursor don't touch them, the program will handle fixing up\n // wrapped lines with the cursor\n const absoluteY = this.ybase + this.y;\n if (absoluteY >= y && absoluteY < y + wrappedLines.length) {\n continue;\n }\n\n const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength();\n const destLineLengths = reflowSmallerGetNewLineLengths(wrappedLines, this._cols, newCols);\n const linesToAdd = destLineLengths.length - wrappedLines.length;\n let trimmedLines: number;\n if (this.ybase === 0 && this.y !== this.lines.length - 1) {\n // If the top section of the buffer is not yet filled\n trimmedLines = Math.max(0, this.y - this.lines.maxLength + linesToAdd);\n } else {\n trimmedLines = Math.max(0, this.lines.length - this.lines.maxLength + linesToAdd);\n }\n\n // Add the new lines\n const newLines: BufferLine[] = [];\n for (let i = 0; i < linesToAdd; i++) {\n const newLine = this.getBlankLine(DEFAULT_ATTR_DATA, true) as BufferLine;\n newLines.push(newLine);\n }\n if (newLines.length > 0) {\n toInsert.push({\n // countToInsert here gets the actual index, taking into account other inserted items.\n // using this we can iterate through the list forwards\n start: y + wrappedLines.length + countToInsert,\n newLines\n });\n countToInsert += newLines.length;\n }\n wrappedLines.push(...newLines);\n\n // Copy buffer data to new locations, this needs to happen backwards to do in-place\n let destLineIndex = destLineLengths.length - 1; // Math.floor(cellsNeeded / newCols);\n let destCol = destLineLengths[destLineIndex]; // cellsNeeded % newCols;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n let srcLineIndex = wrappedLines.length - linesToAdd - 1;\n let srcCol = lastLineLength;\n while (srcLineIndex >= 0) {\n const cellsToCopy = Math.min(srcCol, destCol);\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol - cellsToCopy, destCol - cellsToCopy, cellsToCopy, true);\n destCol -= cellsToCopy;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n srcCol -= cellsToCopy;\n if (srcCol === 0) {\n srcLineIndex--;\n const wrappedLinesIndex = Math.max(srcLineIndex, 0);\n srcCol = getWrappedLineTrimmedLength(wrappedLines, wrappedLinesIndex, this._cols);\n }\n }\n\n // Null out the end of the line ends if a wide character wrapped to the following line\n for (let i = 0; i < wrappedLines.length; i++) {\n if (destLineLengths[i] < newCols) {\n wrappedLines[i].setCell(destLineLengths[i], nullCell);\n }\n }\n\n // Adjust viewport as needed\n let viewportAdjustments = linesToAdd - trimmedLines;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y < newRows - 1) {\n this.y++;\n this.lines.pop();\n } else {\n this.ybase++;\n this.ydisp++;\n }\n } else {\n // Ensure ybase does not exceed its maximum value\n if (this.ybase < Math.min(this.lines.maxLength, this.lines.length + countToInsert) - newRows) {\n if (this.ybase === this.ydisp) {\n this.ydisp++;\n }\n this.ybase++;\n }\n }\n }\n this.savedY = Math.min(this.savedY + linesToAdd, this.ybase + newRows - 1);\n }\n\n // Rearrange lines in the buffer if there are any insertions, this is done at the end rather\n // than earlier so that it's a single O(n) pass through the buffer, instead of O(n^2) from many\n // costly calls to CircularList.splice.\n if (toInsert.length > 0) {\n // Record buffer insert events and then play them back backwards so that the indexes are\n // correct\n const insertEvents: IInsertEvent[] = [];\n\n // Record original lines so they don't get overridden when we rearrange the list\n const originalLines: BufferLine[] = [];\n for (let i = 0; i < this.lines.length; i++) {\n originalLines.push(this.lines.get(i) as BufferLine);\n }\n const originalLinesLength = this.lines.length;\n\n let originalLineIndex = originalLinesLength - 1;\n let nextToInsertIndex = 0;\n let nextToInsert = toInsert[nextToInsertIndex];\n this.lines.length = Math.min(this.lines.maxLength, this.lines.length + countToInsert);\n let countInsertedSoFar = 0;\n for (let i = Math.min(this.lines.maxLength - 1, originalLinesLength + countToInsert - 1); i >= 0; i--) {\n if (nextToInsert && nextToInsert.start > originalLineIndex + countInsertedSoFar) {\n // Insert extra lines here, adjusting i as needed\n for (let nextI = nextToInsert.newLines.length - 1; nextI >= 0; nextI--) {\n this.lines.set(i--, nextToInsert.newLines[nextI]);\n }\n i++;\n\n // Create insert events for later\n insertEvents.push({\n index: originalLineIndex + 1,\n amount: nextToInsert.newLines.length\n });\n\n countInsertedSoFar += nextToInsert.newLines.length;\n nextToInsert = toInsert[++nextToInsertIndex];\n } else {\n this.lines.set(i, originalLines[originalLineIndex--]);\n }\n }\n\n // Update markers\n let insertCountEmitted = 0;\n for (let i = insertEvents.length - 1; i >= 0; i--) {\n insertEvents[i].index += insertCountEmitted;\n this.lines.onInsertEmitter.fire(insertEvents[i]);\n insertCountEmitted += insertEvents[i].amount;\n }\n const amountToTrim = Math.max(0, originalLinesLength + countToInsert - this.lines.maxLength);\n if (amountToTrim > 0) {\n this.lines.onTrimEmitter.fire(amountToTrim);\n }\n }\n }\n\n // private _reflowSmallerGetLinesNeeded()\n\n /**\n * Translates a string index back to a BufferIndex.\n * To get the correct buffer position the string must start at `startCol` 0\n * (default in translateBufferLineToString).\n * The method also works on wrapped line strings given rows were not trimmed.\n * The method operates on the CharData string length, there are no\n * additional content or boundary checks. Therefore the string and the buffer\n * should not be altered in between.\n * TODO: respect trim flag after fixing #1685\n * @param lineIndex line index the string was retrieved from\n * @param stringIndex index within the string\n * @param startCol column offset the string was retrieved from\n */\n public stringIndexToBufferIndex(lineIndex: number, stringIndex: number, trimRight: boolean = false): BufferIndex {\n while (stringIndex) {\n const line = this.lines.get(lineIndex);\n if (!line) {\n return [-1, -1];\n }\n const length = (trimRight) ? line.getTrimmedLength() : line.length;\n for (let i = 0; i < length; ++i) {\n if (line.get(i)[CHAR_DATA_WIDTH_INDEX]) {\n // empty cells report a string length of 0, but get replaced\n // with a whitespace in translateToString, thus replace with 1\n stringIndex -= line.get(i)[CHAR_DATA_CHAR_INDEX].length || 1;\n }\n if (stringIndex < 0) {\n return [lineIndex, i];\n }\n }\n lineIndex++;\n }\n return [lineIndex, 0];\n }\n\n /**\n * Translates a buffer line to a string, with optional start and end columns.\n * Wide characters will count as two columns in the resulting string. This\n * function is useful for getting the actual text underneath the raw selection\n * position.\n * @param line The line being translated.\n * @param trimRight Whether to trim whitespace to the right.\n * @param startCol The column to start at.\n * @param endCol The column to end at.\n */\n public translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol: number = 0, endCol?: number): string {\n const line = this.lines.get(lineIndex);\n if (!line) {\n return '';\n }\n return line.translateToString(trimRight, startCol, endCol);\n }\n\n public getWrappedRangeForLine(y: number): { first: number, last: number } {\n let first = y;\n let last = y;\n // Scan upwards for wrapped lines\n while (first > 0 && this.lines.get(first)!.isWrapped) {\n first--;\n }\n // Scan downwards for wrapped lines\n while (last + 1 < this.lines.length && this.lines.get(last + 1)!.isWrapped) {\n last++;\n }\n return { first, last };\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n if (i !== null && i !== undefined) {\n if (!this.tabs[i]) {\n i = this.prevStop(i);\n }\n } else {\n this.tabs = {};\n i = 0;\n }\n\n for (; i < this._cols; i += this._optionsService.options.tabStopWidth) {\n this.tabs[i] = true;\n }\n }\n\n /**\n * Move the cursor to the previous tab stop from the given position (default is current).\n * @param x The position to move the cursor to the previous tab stop.\n */\n public prevStop(x?: number): number {\n if (x === null || x === undefined) {\n x = this.x;\n }\n while (!this.tabs[--x] && x > 0);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Move the cursor one tab stop forward from the given position (default is current).\n * @param x The position to move the cursor one tab stop forward.\n */\n public nextStop(x?: number): number {\n if (x === null || x === undefined) {\n x = this.x;\n }\n while (!this.tabs[++x] && x < this._cols);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n public addMarker(y: number): Marker {\n const marker = new Marker(y);\n this.markers.push(marker);\n marker.register(this.lines.onTrim(amount => {\n marker.line -= amount;\n // The marker should be disposed when the line is trimmed from the buffer\n if (marker.line < 0) {\n marker.dispose();\n }\n }));\n marker.register(this.lines.onInsert(event => {\n if (marker.line >= event.index) {\n marker.line += event.amount;\n }\n }));\n marker.register(this.lines.onDelete(event => {\n // Delete the marker if it's within the range\n if (marker.line >= event.index && marker.line < event.index + event.amount) {\n marker.dispose();\n }\n\n // Shift the marker if it's after the deleted range\n if (marker.line > event.index) {\n marker.line -= event.amount;\n }\n }));\n marker.register(marker.onDispose(() => this._removeMarker(marker)));\n return marker;\n }\n\n private _removeMarker(marker: Marker): void {\n this.markers.splice(this.markers.indexOf(marker), 1);\n }\n\n public iterator(trimRight: boolean, startIndex?: number, endIndex?: number, startOverscan?: number, endOverscan?: number): IBufferStringIterator {\n return new BufferStringIterator(this, trimRight, startIndex, endIndex, startOverscan, endOverscan);\n }\n}\n\n/**\n * Iterator to get unwrapped content strings from the buffer.\n * The iterator returns at least the string data between the borders\n * `startIndex` and `endIndex` (exclusive) and will expand the lines\n * by `startOverscan` to the top and by `endOverscan` to the bottom,\n * if no new line was found in between.\n * It will never read/return string data beyond `startIndex - startOverscan`\n * or `endIndex + endOverscan`. Therefore the first and last line might be truncated.\n * It is possible to always get the full string for the first and last line as well\n * by setting the overscan values to the actual buffer length. This not recommended\n * since it might return the whole buffer within a single string in a worst case scenario.\n */\nexport class BufferStringIterator implements IBufferStringIterator {\n private _current: number;\n\n constructor (\n private _buffer: IBuffer,\n private _trimRight: boolean,\n private _startIndex: number = 0,\n private _endIndex: number = _buffer.lines.length,\n private _startOverscan: number = 0,\n private _endOverscan: number = 0\n ) {\n if (this._startIndex < 0) {\n this._startIndex = 0;\n }\n if (this._endIndex > this._buffer.lines.length) {\n this._endIndex = this._buffer.lines.length;\n }\n this._current = this._startIndex;\n }\n\n public hasNext(): boolean {\n return this._current < this._endIndex;\n }\n\n public next(): IBufferStringIteratorResult {\n const range = this._buffer.getWrappedRangeForLine(this._current);\n // limit search window to overscan value at both borders\n if (range.first < this._startIndex - this._startOverscan) {\n range.first = this._startIndex - this._startOverscan;\n }\n if (range.last > this._endIndex + this._endOverscan) {\n range.last = this._endIndex + this._endOverscan;\n }\n // limit to current buffer length\n range.first = Math.max(range.first, 0);\n range.last = Math.min(range.last, this._buffer.lines.length);\n let content = '';\n for (let i = range.first; i <= range.last; ++i) {\n content += this._buffer.translateBufferLineToString(i, this._trimRight);\n }\n this._current = range.last + 1;\n return {range, content};\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IBufferLine, ICellData, IAttributeData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, WHITESPACE_CELL_CHAR, Content, BgFlags } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\n\n/**\n * buffer memory layout:\n *\n * | uint32_t | uint32_t | uint32_t |\n * | `content` | `FG` | `BG` |\n * | wcwidth(2) comb(1) codepoint(21) | flags(8) R(8) G(8) B(8) | flags(8) R(8) G(8) B(8) |\n */\n\n\n/** typed array slots taken by one cell */\nconst CELL_SIZE = 3;\n\n/**\n * Cell member indices.\n *\n * Direct access:\n * `content = data[column * CELL_SIZE + Cell.CONTENT];`\n * `fg = data[column * CELL_SIZE + Cell.FG];`\n * `bg = data[column * CELL_SIZE + Cell.BG];`\n */\nconst enum Cell {\n CONTENT = 0,\n FG = 1, // currently simply holds all known attrs\n BG = 2 // currently unused\n}\n\nexport const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());\n\n/**\n * Typed array based bufferline implementation.\n *\n * There are 2 ways to insert data into the cell buffer:\n * - `setCellFromCodepoint` + `addCodepointToCell`\n * Use these for data that is already UTF32.\n * Used during normal input in `InputHandler` for faster buffer access.\n * - `setCell`\n * This method takes a CellData object and stores the data in the buffer.\n * Use `CellData.fromCharData` to create the CellData object (e.g. from JS string).\n *\n * To retrieve data from the buffer use either one of the primitive methods\n * (if only one particular value is needed) or `loadCell`. For `loadCell` in a loop\n * memory allocs / GC pressure can be greatly reduced by reusing the CellData object.\n */\nexport class BufferLine implements IBufferLine {\n protected _data: Uint32Array;\n protected _combined: {[index: number]: string} = {};\n protected _extendedAttrs: {[index: number]: ExtendedAttrs} = {};\n public length: number;\n\n constructor(cols: number, fillCellData?: ICellData, public isWrapped: boolean = false) {\n this._data = new Uint32Array(cols * CELL_SIZE);\n const cell = fillCellData || CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n for (let i = 0; i < cols; ++i) {\n this.setCell(i, cell);\n }\n this.length = cols;\n }\n\n /**\n * Get cell data CharData.\n * @deprecated\n */\n public get(index: number): CharData {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n return [\n this._data[index * CELL_SIZE + Cell.FG],\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index]\n : (cp) ? stringFromCodePoint(cp) : '',\n content >> Content.WIDTH_SHIFT,\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index].charCodeAt(this._combined[index].length - 1)\n : cp\n ];\n }\n\n /**\n * Set cell data from CharData.\n * @deprecated\n */\n public set(index: number, value: CharData): void {\n this._data[index * CELL_SIZE + Cell.FG] = value[CHAR_DATA_ATTR_INDEX];\n if (value[CHAR_DATA_CHAR_INDEX].length > 1) {\n this._combined[index] = value[1];\n this._data[index * CELL_SIZE + Cell.CONTENT] = index | Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n } else {\n this._data[index * CELL_SIZE + Cell.CONTENT] = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n\n /**\n * primitive getters\n * use these when only one value is needed, otherwise use `loadCell`\n */\n public getWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT;\n }\n\n /** Test whether content has width. */\n public hasWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.WIDTH_MASK;\n }\n\n /** Get FG cell component. */\n public getFg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.FG];\n }\n\n /** Get BG cell component. */\n public getBg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG];\n }\n\n /**\n * Test whether contains any chars.\n * Basically an empty has no content, but other cells might differ in FG/BG\n * from real empty cells.\n * */\n public hasContent(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK;\n }\n\n /**\n * Get codepoint of the cell.\n * To be in line with `code` in CharData this either returns\n * a single UTF32 codepoint or the last codepoint of a combined string.\n */\n public getCodePoint(index: number): number {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index].charCodeAt(this._combined[index].length - 1);\n }\n return content & Content.CODEPOINT_MASK;\n }\n\n /** Test whether the cell contains a combined string. */\n public isCombined(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.IS_COMBINED_MASK;\n }\n\n /** Returns the string content of the cell. */\n public getString(index: number): string {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index];\n }\n if (content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(content & Content.CODEPOINT_MASK);\n }\n // return empty string for empty cells\n return '';\n }\n\n /**\n * Load data at `index` into `cell`. This is used to access cells in a way that's more friendly\n * to GC as it significantly reduced the amount of new objects/references needed.\n */\n public loadCell(index: number, cell: ICellData): ICellData {\n const startIndex = index * CELL_SIZE;\n cell.content = this._data[startIndex + Cell.CONTENT];\n cell.fg = this._data[startIndex + Cell.FG];\n cell.bg = this._data[startIndex + Cell.BG];\n if (cell.content & Content.IS_COMBINED_MASK) {\n cell.combinedData = this._combined[index];\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n cell.extended = this._extendedAttrs[index];\n }\n return cell;\n }\n\n /**\n * Set data at `index` to `cell`.\n */\n public setCell(index: number, cell: ICellData): void {\n if (cell.content & Content.IS_COMBINED_MASK) {\n this._combined[index] = cell.combinedData;\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = cell.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = cell.content;\n this._data[index * CELL_SIZE + Cell.FG] = cell.fg;\n this._data[index * CELL_SIZE + Cell.BG] = cell.bg;\n }\n\n /**\n * Set cell data from input handler.\n * Since the input handler see the incoming chars as UTF32 codepoints,\n * it gets an optimized access method.\n */\n public setCellFromCodePoint(index: number, codePoint: number, width: number, fg: number, bg: number, eAttrs: IExtendedAttrs): void {\n if (bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = eAttrs;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = codePoint | (width << Content.WIDTH_SHIFT);\n this._data[index * CELL_SIZE + Cell.FG] = fg;\n this._data[index * CELL_SIZE + Cell.BG] = bg;\n }\n\n /**\n * Add a codepoint to a cell from input handler.\n * During input stage combining chars with a width of 0 follow and stack\n * onto a leading char. Since we already set the attrs\n * by the previous `setDataFromCodePoint` call, we can omit it here.\n */\n public addCodepointToCell(index: number, codePoint: number): void {\n let content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n // we already have a combined string, simply add\n this._combined[index] += stringFromCodePoint(codePoint);\n } else {\n if (content & Content.CODEPOINT_MASK) {\n // normal case for combining chars:\n // - move current leading char + new one into combined string\n // - set combined flag\n this._combined[index] = stringFromCodePoint(content & Content.CODEPOINT_MASK) + stringFromCodePoint(codePoint);\n content &= ~Content.CODEPOINT_MASK; // set codepoint in buffer to 0\n content |= Content.IS_COMBINED_MASK;\n } else {\n // should not happen - we actually have no data in the cell yet\n // simply set the data in the cell buffer with a width of 1\n content = codePoint | (1 << Content.WIDTH_SHIFT);\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = content;\n }\n }\n\n public insertCells(pos: number, n: number, fillCellData: ICellData, eraseAttr?: IAttributeData): void {\n pos %= this.length;\n\n // handle fullwidth at pos: reset cell one to the left if pos is second cell of a wide char\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodePoint(pos - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n\n if (n < this.length - pos) {\n const cell = new CellData();\n for (let i = this.length - pos - n - 1; i >= 0; --i) {\n this.setCell(pos + n + i, this.loadCell(pos + i, cell));\n }\n for (let i = 0; i < n; ++i) {\n this.setCell(pos + i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at line end: reset last cell if it is first cell of a wide char\n if (this.getWidth(this.length - 1) === 2) {\n this.setCellFromCodePoint(this.length - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n }\n\n public deleteCells(pos: number, n: number, fillCellData: ICellData, eraseAttr?: IAttributeData): void {\n pos %= this.length;\n if (n < this.length - pos) {\n const cell = new CellData();\n for (let i = 0; i < this.length - pos - n; ++i) {\n this.setCell(pos + i, this.loadCell(pos + n + i, cell));\n }\n for (let i = this.length - n; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at pos:\n // - reset pos-1 if wide char\n // - reset pos if width==0 (previous second cell of a wide char)\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodePoint(pos - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n if (this.getWidth(pos) === 0 && !this.hasContent(pos)) {\n this.setCellFromCodePoint(pos, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n }\n\n public replaceCells(start: number, end: number, fillCellData: ICellData, eraseAttr?: IAttributeData): void {\n // handle fullwidth at start: reset cell one to the left if start is second cell of a wide char\n if (start && this.getWidth(start - 1) === 2) {\n this.setCellFromCodePoint(start - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n // handle fullwidth at last cell + 1: reset to empty cell if it is second part of a wide char\n if (end < this.length && this.getWidth(end - 1) === 2) {\n this.setCellFromCodePoint(end, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n\n while (start < end && start < this.length) {\n this.setCell(start++, fillCellData);\n }\n }\n\n public resize(cols: number, fillCellData: ICellData): void {\n if (cols === this.length) {\n return;\n }\n if (cols > this.length) {\n const data = new Uint32Array(cols * CELL_SIZE);\n if (this.length) {\n if (cols * CELL_SIZE < this._data.length) {\n data.set(this._data.subarray(0, cols * CELL_SIZE));\n } else {\n data.set(this._data);\n }\n }\n this._data = data;\n for (let i = this.length; i < cols; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n if (cols) {\n const data = new Uint32Array(cols * CELL_SIZE);\n data.set(this._data.subarray(0, cols * CELL_SIZE));\n this._data = data;\n // Remove any cut off combined data, FIXME: repeat this for extended attrs\n const keys = Object.keys(this._combined);\n for (let i = 0; i < keys.length; i++) {\n const key = parseInt(keys[i], 10);\n if (key >= cols) {\n delete this._combined[key];\n }\n }\n } else {\n this._data = new Uint32Array(0);\n this._combined = {};\n }\n }\n this.length = cols;\n }\n\n /** fill a line with fillCharData */\n public fill(fillCellData: ICellData): void {\n this._combined = {};\n this._extendedAttrs = {};\n for (let i = 0; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n /** alter to a full copy of line */\n public copyFrom(line: BufferLine): void {\n if (this.length !== line.length) {\n this._data = new Uint32Array(line._data);\n } else {\n // use high speed copy if lengths are equal\n this._data.set(line._data);\n }\n this.length = line.length;\n this._combined = {};\n for (const el in line._combined) {\n this._combined[el] = line._combined[el];\n }\n this._extendedAttrs = {};\n for (const el in line._extendedAttrs) {\n this._extendedAttrs[el] = line._extendedAttrs[el];\n }\n this.isWrapped = line.isWrapped;\n }\n\n /** create a new clone */\n public clone(): IBufferLine {\n const newLine = new BufferLine(0);\n newLine._data = new Uint32Array(this._data);\n newLine.length = this.length;\n for (const el in this._combined) {\n newLine._combined[el] = this._combined[el];\n }\n for (const el in this._extendedAttrs) {\n newLine._extendedAttrs[el] = this._extendedAttrs[el];\n }\n newLine.isWrapped = this.isWrapped;\n return newLine;\n }\n\n public getTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public copyCellsFrom(src: BufferLine, srcCol: number, destCol: number, length: number, applyInReverse: boolean): void {\n const srcData = src._data;\n if (applyInReverse) {\n for (let cell = length - 1; cell >= 0; cell--) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n }\n } else {\n for (let cell = 0; cell < length; cell++) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n }\n }\n\n // Move any combined data over as needed, FIXME: repeat for extended attrs\n const srcCombinedKeys = Object.keys(src._combined);\n for (let i = 0; i < srcCombinedKeys.length; i++) {\n const key = parseInt(srcCombinedKeys[i], 10);\n if (key >= srcCol) {\n this._combined[key - srcCol + destCol] = src._combined[key];\n }\n }\n }\n\n public translateToString(trimRight: boolean = false, startCol: number = 0, endCol: number = this.length): string {\n if (trimRight) {\n endCol = Math.min(endCol, this.getTrimmedLength());\n }\n let result = '';\n while (startCol < endCol) {\n const content = this._data[startCol * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n result += (content & Content.IS_COMBINED_MASK) ? this._combined[startCol] : (cp) ? stringFromCodePoint(cp) : WHITESPACE_CELL_CHAR;\n startCol += (content >> Content.WIDTH_SHIFT) || 1; // always advance by 1\n }\n return result;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { BufferLine } from 'common/buffer/BufferLine';\nimport { CircularList } from 'common/CircularList';\nimport { IBufferLine, ICellData } from 'common/Types';\n\nexport interface INewLayoutResult {\n layout: number[];\n countRemoved: number;\n}\n\n/**\n * Evaluates and returns indexes to be removed after a reflow larger occurs. Lines will be removed\n * when a wrapped line unwraps.\n * @param lines The buffer lines.\n * @param newCols The columns after resize.\n */\nexport function reflowLargerGetLinesToRemove(lines: CircularList, oldCols: number, newCols: number, bufferAbsoluteY: number, nullCell: ICellData): number[] {\n // Gather all BufferLines that need to be removed from the Buffer here so that they can be\n // batched up and only committed once\n const toRemove: number[] = [];\n\n for (let y = 0; y < lines.length - 1; y++) {\n // Check if this row is wrapped\n let i = y;\n let nextLine = lines.get(++i) as BufferLine;\n if (!nextLine.isWrapped) {\n continue;\n }\n\n // Check how many lines it's wrapped for\n const wrappedLines: BufferLine[] = [lines.get(y) as BufferLine];\n while (i < lines.length && nextLine.isWrapped) {\n wrappedLines.push(nextLine);\n nextLine = lines.get(++i) as BufferLine;\n }\n\n // If these lines contain the cursor don't touch them, the program will handle fixing up wrapped\n // lines with the cursor\n if (bufferAbsoluteY >= y && bufferAbsoluteY < i) {\n y += wrappedLines.length - 1;\n continue;\n }\n\n // Copy buffer data to new locations\n let destLineIndex = 0;\n let destCol = getWrappedLineTrimmedLength(wrappedLines, destLineIndex, oldCols);\n let srcLineIndex = 1;\n let srcCol = 0;\n while (srcLineIndex < wrappedLines.length) {\n const srcTrimmedTineLength = getWrappedLineTrimmedLength(wrappedLines, srcLineIndex, oldCols);\n const srcRemainingCells = srcTrimmedTineLength - srcCol;\n const destRemainingCells = newCols - destCol;\n const cellsToCopy = Math.min(srcRemainingCells, destRemainingCells);\n\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol, destCol, cellsToCopy, false);\n\n destCol += cellsToCopy;\n if (destCol === newCols) {\n destLineIndex++;\n destCol = 0;\n }\n srcCol += cellsToCopy;\n if (srcCol === srcTrimmedTineLength) {\n srcLineIndex++;\n srcCol = 0;\n }\n\n // Make sure the last cell isn't wide, if it is copy it to the current dest\n if (destCol === 0 && destLineIndex !== 0) {\n if (wrappedLines[destLineIndex - 1].getWidth(newCols - 1) === 2) {\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[destLineIndex - 1], newCols - 1, destCol++, 1, false);\n // Null out the end of the last row\n wrappedLines[destLineIndex - 1].setCell(newCols - 1, nullCell);\n }\n }\n }\n\n // Clear out remaining cells or fragments could remain;\n wrappedLines[destLineIndex].replaceCells(destCol, newCols, nullCell);\n\n // Work backwards and remove any rows at the end that only contain null cells\n let countToRemove = 0;\n for (let i = wrappedLines.length - 1; i > 0; i--) {\n if (i > destLineIndex || wrappedLines[i].getTrimmedLength() === 0) {\n countToRemove++;\n } else {\n break;\n }\n }\n\n if (countToRemove > 0) {\n toRemove.push(y + wrappedLines.length - countToRemove); // index\n toRemove.push(countToRemove);\n }\n\n y += wrappedLines.length - 1;\n }\n return toRemove;\n}\n\n/**\n * Creates and return the new layout for lines given an array of indexes to be removed.\n * @param lines The buffer lines.\n * @param toRemove The indexes to remove.\n */\nexport function reflowLargerCreateNewLayout(lines: CircularList, toRemove: number[]): INewLayoutResult {\n const layout: number[] = [];\n // First iterate through the list and get the actual indexes to use for rows\n let nextToRemoveIndex = 0;\n let nextToRemoveStart = toRemove[nextToRemoveIndex];\n let countRemovedSoFar = 0;\n for (let i = 0; i < lines.length; i++) {\n if (nextToRemoveStart === i) {\n const countToRemove = toRemove[++nextToRemoveIndex];\n\n // Tell markers that there was a deletion\n lines.onDeleteEmitter.fire({\n index: i - countRemovedSoFar,\n amount: countToRemove\n });\n\n i += countToRemove - 1;\n countRemovedSoFar += countToRemove;\n nextToRemoveStart = toRemove[++nextToRemoveIndex];\n } else {\n layout.push(i);\n }\n }\n return {\n layout,\n countRemoved: countRemovedSoFar\n };\n}\n\n/**\n * Applies a new layout to the buffer. This essentially does the same as many splice calls but it's\n * done all at once in a single iteration through the list since splice is very expensive.\n * @param lines The buffer lines.\n * @param newLayout The new layout to apply.\n */\nexport function reflowLargerApplyNewLayout(lines: CircularList, newLayout: number[]): void {\n // Record original lines so they don't get overridden when we rearrange the list\n const newLayoutLines: BufferLine[] = [];\n for (let i = 0; i < newLayout.length; i++) {\n newLayoutLines.push(lines.get(newLayout[i]) as BufferLine);\n }\n\n // Rearrange the list\n for (let i = 0; i < newLayoutLines.length; i++) {\n lines.set(i, newLayoutLines[i]);\n }\n lines.length = newLayout.length;\n}\n\n/**\n * Gets the new line lengths for a given wrapped line. The purpose of this function it to pre-\n * compute the wrapping points since wide characters may need to be wrapped onto the following line.\n * This function will return an array of numbers of where each line wraps to, the resulting array\n * will only contain the values `newCols` (when the line does not end with a wide character) and\n * `newCols - 1` (when the line does end with a wide character), except for the last value which\n * will contain the remaining items to fill the line.\n *\n * Calling this with a `newCols` value of `1` will lock up.\n *\n * @param wrappedLines The wrapped lines to evaluate.\n * @param oldCols The columns before resize.\n * @param newCols The columns after resize.\n */\nexport function reflowSmallerGetNewLineLengths(wrappedLines: BufferLine[], oldCols: number, newCols: number): number[] {\n const newLineLengths: number[] = [];\n const cellsNeeded = wrappedLines.map((l, i) => getWrappedLineTrimmedLength(wrappedLines, i, oldCols)).reduce((p, c) => p + c);\n\n // Use srcCol and srcLine to find the new wrapping point, use that to get the cellsAvailable and\n // linesNeeded\n let srcCol = 0;\n let srcLine = 0;\n let cellsAvailable = 0;\n while (cellsAvailable < cellsNeeded) {\n if (cellsNeeded - cellsAvailable < newCols) {\n // Add the final line and exit the loop\n newLineLengths.push(cellsNeeded - cellsAvailable);\n break;\n }\n srcCol += newCols;\n const oldTrimmedLength = getWrappedLineTrimmedLength(wrappedLines, srcLine, oldCols);\n if (srcCol > oldTrimmedLength) {\n srcCol -= oldTrimmedLength;\n srcLine++;\n }\n const endsWithWide = wrappedLines[srcLine].getWidth(srcCol - 1) === 2;\n if (endsWithWide) {\n srcCol--;\n }\n const lineLength = endsWithWide ? newCols - 1 : newCols;\n newLineLengths.push(lineLength);\n cellsAvailable += lineLength;\n }\n\n return newLineLengths;\n}\n\nexport function getWrappedLineTrimmedLength(lines: BufferLine[], i: number, cols: number): number {\n // If this is the last row in the wrapped line, get the actual trimmed length\n if (i === lines.length - 1) {\n return lines[i].getTrimmedLength();\n }\n // Detect whether the following line starts with a wide character and the end of the current line\n // is null, if so then we can be pretty sure the null character should be excluded from the line\n // length]\n const endsInNull = !(lines[i].hasContent(cols - 1)) && lines[i].getWidth(cols - 1) === 1;\n const followingLineStartsWithWide = lines[i + 1].getWidth(0) === 2;\n if (endsInNull && followingLineStartsWithWide) {\n return cols - 1;\n }\n return cols;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IAttributeData } from 'common/Types';\nimport { Buffer } from 'common/buffer/Buffer';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { IOptionsService, IBufferService } from 'common/services/Services';\nimport { Disposable } from 'common/Lifecycle';\n\n/**\n * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and\n * provides also utilities for working with them.\n */\nexport class BufferSet extends Disposable implements IBufferSet {\n private _normal!: Buffer;\n private _alt!: Buffer;\n private _activeBuffer!: Buffer;\n\n private _onBufferActivate = this.register(new EventEmitter<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}>());\n public get onBufferActivate(): IEvent<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}> { return this._onBufferActivate.event; }\n\n /**\n * Create a new BufferSet for the given terminal.\n * @param _terminal - The terminal the BufferSet will belong to\n */\n constructor(\n private readonly _optionsService: IOptionsService,\n private readonly _bufferService: IBufferService\n ) {\n super();\n this.reset();\n }\n\n public reset(): void {\n this._normal = new Buffer(true, this._optionsService, this._bufferService);\n this._normal.fillViewportRows();\n\n // The alt buffer should never have scrollback.\n // See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer\n this._alt = new Buffer(false, this._optionsService, this._bufferService);\n this._activeBuffer = this._normal;\n\n this.setupTabStops();\n }\n\n /**\n * Returns the alt Buffer of the BufferSet\n */\n public get alt(): Buffer {\n return this._alt;\n }\n\n /**\n * Returns the normal Buffer of the BufferSet\n */\n public get active(): Buffer {\n return this._activeBuffer;\n }\n\n /**\n * Returns the currently active Buffer of the BufferSet\n */\n public get normal(): Buffer {\n return this._normal;\n }\n\n /**\n * Sets the normal Buffer of the BufferSet as its currently active Buffer\n */\n public activateNormalBuffer(): void {\n if (this._activeBuffer === this._normal) {\n return;\n }\n this._normal.x = this._alt.x;\n this._normal.y = this._alt.y;\n // The alt buffer should always be cleared when we switch to the normal\n // buffer. This frees up memory since the alt buffer should always be new\n // when activated.\n this._alt.clear();\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n }\n\n /**\n * Sets the alt Buffer of the BufferSet as its currently active Buffer\n */\n public activateAltBuffer(fillAttr?: IAttributeData): void {\n if (this._activeBuffer === this._alt) {\n return;\n }\n // Since the alt buffer is always cleared when the normal buffer is\n // activated, we want to fill it when switching to it.\n this._alt.fillViewportRows(fillAttr);\n this._alt.x = this._normal.x;\n this._alt.y = this._normal.y;\n this._activeBuffer = this._alt;\n this._onBufferActivate.fire({\n activeBuffer: this._alt,\n inactiveBuffer: this._normal\n });\n }\n\n /**\n * Resizes both normal and alt buffers, adjusting their data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n this._normal.resize(newCols, newRows);\n this._alt.resize(newCols, newRows);\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n this._normal.setupTabStops(i);\n this._alt.setupTabStops(i);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, ICellData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\n\n/**\n * CellData - represents a single Cell in the terminal buffer.\n */\nexport class CellData extends AttributeData implements ICellData {\n /** Helper to create CellData from CharData. */\n public static fromCharData(value: CharData): CellData {\n const obj = new CellData();\n obj.setFromCharData(value);\n return obj;\n }\n /** Primitives from terminal buffer. */\n public content = 0;\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n public combinedData = '';\n /** Whether cell contains a combined string. */\n public isCombined(): number {\n return this.content & Content.IS_COMBINED_MASK;\n }\n /** Width of the cell. */\n public getWidth(): number {\n return this.content >> Content.WIDTH_SHIFT;\n }\n /** JS string of the content. */\n public getChars(): string {\n if (this.content & Content.IS_COMBINED_MASK) {\n return this.combinedData;\n }\n if (this.content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(this.content & Content.CODEPOINT_MASK);\n }\n return '';\n }\n /**\n * Codepoint of cell\n * Note this returns the UTF32 codepoint of single chars,\n * if content is a combined string it returns the codepoint\n * of the last char in string to be in line with code in CharData.\n * */\n public getCode(): number {\n return (this.isCombined())\n ? this.combinedData.charCodeAt(this.combinedData.length - 1)\n : this.content & Content.CODEPOINT_MASK;\n }\n /** Set data from CharData */\n public setFromCharData(value: CharData): void {\n this.fg = value[CHAR_DATA_ATTR_INDEX];\n this.bg = 0;\n let combined = false;\n // surrogates and combined strings need special treatment\n if (value[CHAR_DATA_CHAR_INDEX].length > 2) {\n combined = true;\n }\n else if (value[CHAR_DATA_CHAR_INDEX].length === 2) {\n const code = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0);\n // if the 2-char string is a surrogate create single codepoint\n // everything else is combined\n if (0xD800 <= code && code <= 0xDBFF) {\n const second = value[CHAR_DATA_CHAR_INDEX].charCodeAt(1);\n if (0xDC00 <= second && second <= 0xDFFF) {\n this.content = ((code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n else {\n combined = true;\n }\n }\n else {\n combined = true;\n }\n }\n else {\n this.content = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n if (combined) {\n this.combinedData = value[CHAR_DATA_CHAR_INDEX];\n this.content = Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n /** Get data as CharData. */\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport const DEFAULT_COLOR = 256;\nexport const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);\n\nexport const CHAR_DATA_ATTR_INDEX = 0;\nexport const CHAR_DATA_CHAR_INDEX = 1;\nexport const CHAR_DATA_WIDTH_INDEX = 2;\nexport const CHAR_DATA_CODE_INDEX = 3;\n\n/**\n * Null cell - a real empty cell (containing nothing).\n * Note that code should always be 0 for a null cell as\n * several test condition of the buffer line rely on this.\n */\nexport const NULL_CELL_CHAR = '';\nexport const NULL_CELL_WIDTH = 1;\nexport const NULL_CELL_CODE = 0;\n\n/**\n * Whitespace cell.\n * This is meant as a replacement for empty cells when needed\n * during rendering lines to preserve correct aligment.\n */\nexport const WHITESPACE_CELL_CHAR = ' ';\nexport const WHITESPACE_CELL_WIDTH = 1;\nexport const WHITESPACE_CELL_CODE = 32;\n\n/**\n * Bitmasks for accessing data in `content`.\n */\nexport const enum Content {\n /**\n * bit 1..21 codepoint, max allowed in UTF32 is 0x10FFFF (21 bits taken)\n * read: `codepoint = content & Content.codepointMask;`\n * write: `content |= codepoint & Content.codepointMask;`\n * shortcut if precondition `codepoint <= 0x10FFFF` is met:\n * `content |= codepoint;`\n */\n CODEPOINT_MASK = 0x1FFFFF,\n\n /**\n * bit 22 flag indication whether a cell contains combined content\n * read: `isCombined = content & Content.isCombined;`\n * set: `content |= Content.isCombined;`\n * clear: `content &= ~Content.isCombined;`\n */\n IS_COMBINED_MASK = 0x200000, // 1 << 21\n\n /**\n * bit 1..22 mask to check whether a cell contains any string data\n * we need to check for codepoint and isCombined bits to see\n * whether a cell contains anything\n * read: `isEmpty = !(content & Content.hasContent)`\n */\n HAS_CONTENT_MASK = 0x3FFFFF,\n\n /**\n * bit 23..24 wcwidth value of cell, takes 2 bits (ranges from 0..2)\n * read: `width = (content & Content.widthMask) >> Content.widthShift;`\n * `hasWidth = content & Content.widthMask;`\n * as long as wcwidth is highest value in `content`:\n * `width = content >> Content.widthShift;`\n * write: `content |= (width << Content.widthShift) & Content.widthMask;`\n * shortcut if precondition `0 <= width <= 3` is met:\n * `content |= width << Content.widthShift;`\n */\n WIDTH_MASK = 0xC00000, // 3 << 22\n WIDTH_SHIFT = 22\n}\n\nexport const enum Attributes {\n /**\n * bit 1..8 blue in RGB, color in P256 and P16\n */\n BLUE_MASK = 0xFF,\n BLUE_SHIFT = 0,\n PCOLOR_MASK = 0xFF,\n PCOLOR_SHIFT = 0,\n\n /**\n * bit 9..16 green in RGB\n */\n GREEN_MASK = 0xFF00,\n GREEN_SHIFT = 8,\n\n /**\n * bit 17..24 red in RGB\n */\n RED_MASK = 0xFF0000,\n RED_SHIFT = 16,\n\n /**\n * bit 25..26 color mode: DEFAULT (0) | P16 (1) | P256 (2) | RGB (3)\n */\n CM_MASK = 0x3000000,\n CM_DEFAULT = 0,\n CM_P16 = 0x1000000,\n CM_P256 = 0x2000000,\n CM_RGB = 0x3000000,\n\n /**\n * bit 1..24 RGB room\n */\n RGB_MASK = 0xFFFFFF\n}\n\nexport const enum FgFlags {\n /**\n * bit 27..31 (32th bit unused)\n */\n INVERSE = 0x4000000,\n BOLD = 0x8000000,\n UNDERLINE = 0x10000000,\n BLINK = 0x20000000,\n INVISIBLE = 0x40000000\n}\n\nexport const enum BgFlags {\n /**\n * bit 27..32 (upper 3 unused)\n */\n ITALIC = 0x4000000,\n DIM = 0x8000000,\n HAS_EXTENDED = 0x10000000\n}\n\nexport const enum UnderlineStyle {\n NONE = 0,\n SINGLE = 1,\n DOUBLE = 2,\n CURLY = 3,\n DOTTED = 4,\n DASHED = 5\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { IMarker } from 'common/Types';\n\nexport class Marker extends Disposable implements IMarker {\n private static _nextId = 1;\n\n private _id: number = Marker._nextId++;\n public isDisposed: boolean = false;\n\n public get id(): number { return this._id; }\n\n private _onDispose = new EventEmitter();\n public get onDispose(): IEvent { return this._onDispose.event; }\n\n constructor(\n public line: number\n ) {\n super();\n }\n\n public dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n this.line = -1;\n // Emit before super.dispose such that dispose listeners get a change to react\n this._onDispose.fire();\n super.dispose();\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharset } from 'common/Types';\n\n/**\n * The character sets supported by the terminal. These enable several languages\n * to be represented within the terminal with only 8-bit encoding. See ISO 2022\n * for a discussion on character sets. Only VT100 character sets are supported.\n */\nexport const CHARSETS: { [key: string]: ICharset | undefined } = {};\n\n/**\n * The default character set, US.\n */\nexport const DEFAULT_CHARSET: ICharset | undefined = CHARSETS['B'];\n\n/**\n * DEC Special Character and Line Drawing Set.\n * Reference: http://vt100.net/docs/vt102-ug/table5-13.html\n * A lot of curses apps use this if they see TERM=xterm.\n * testing: echo -e '\\e(0a\\e(B'\n * The xterm output sometimes seems to conflict with the\n * reference above. xterm seems in line with the reference\n * when running vttest however.\n * The table below now uses xterm's output from vttest.\n */\nCHARSETS['0'] = {\n '`': '\\u25c6', // '◆'\n 'a': '\\u2592', // '▒'\n 'b': '\\u2409', // '␉' (HT)\n 'c': '\\u240c', // '␌' (FF)\n 'd': '\\u240d', // '␍' (CR)\n 'e': '\\u240a', // '␊' (LF)\n 'f': '\\u00b0', // '°'\n 'g': '\\u00b1', // '±'\n 'h': '\\u2424', // '␤' (NL)\n 'i': '\\u240b', // '␋' (VT)\n 'j': '\\u2518', // '┘'\n 'k': '\\u2510', // '┐'\n 'l': '\\u250c', // '┌'\n 'm': '\\u2514', // '└'\n 'n': '\\u253c', // '┼'\n 'o': '\\u23ba', // '⎺'\n 'p': '\\u23bb', // '⎻'\n 'q': '\\u2500', // '─'\n 'r': '\\u23bc', // '⎼'\n 's': '\\u23bd', // '⎽'\n 't': '\\u251c', // '├'\n 'u': '\\u2524', // '┤'\n 'v': '\\u2534', // '┴'\n 'w': '\\u252c', // '┬'\n 'x': '\\u2502', // '│'\n 'y': '\\u2264', // '≤'\n 'z': '\\u2265', // '≥'\n '{': '\\u03c0', // 'π'\n '|': '\\u2260', // '≠'\n '}': '\\u00a3', // '£'\n '~': '\\u00b7' // '·'\n};\n\n/**\n * British character set\n * ESC (A\n * Reference: http://vt100.net/docs/vt220-rm/table2-5.html\n */\nCHARSETS['A'] = {\n '#': '£'\n};\n\n/**\n * United States character set\n * ESC (B\n */\nCHARSETS['B'] = undefined;\n\n/**\n * Dutch character set\n * ESC (4\n * Reference: http://vt100.net/docs/vt220-rm/table2-6.html\n */\nCHARSETS['4'] = {\n '#': '£',\n '@': '¾',\n '[': 'ij',\n '\\\\': '½',\n ']': '|',\n '{': '¨',\n '|': 'f',\n '}': '¼',\n '~': '´'\n};\n\n/**\n * Finnish character set\n * ESC (C or ESC (5\n * Reference: http://vt100.net/docs/vt220-rm/table2-7.html\n */\nCHARSETS['C'] =\nCHARSETS['5'] = {\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Å',\n '^': 'Ü',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * French character set\n * ESC (R\n * Reference: http://vt100.net/docs/vt220-rm/table2-8.html\n */\nCHARSETS['R'] = {\n '#': '£',\n '@': 'à',\n '[': '°',\n '\\\\': 'ç',\n ']': '§',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': '¨'\n};\n\n/**\n * French Canadian character set\n * ESC (Q\n * Reference: http://vt100.net/docs/vt220-rm/table2-9.html\n */\nCHARSETS['Q'] = {\n '@': 'à',\n '[': 'â',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n '`': 'ô',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': 'û'\n};\n\n/**\n * German character set\n * ESC (K\n * Reference: http://vt100.net/docs/vt220-rm/table2-10.html\n */\nCHARSETS['K'] = {\n '@': '§',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Ü',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'ß'\n};\n\n/**\n * Italian character set\n * ESC (Y\n * Reference: http://vt100.net/docs/vt220-rm/table2-11.html\n */\nCHARSETS['Y'] = {\n '#': '£',\n '@': '§',\n '[': '°',\n '\\\\': 'ç',\n ']': 'é',\n '`': 'ù',\n '{': 'à',\n '|': 'ò',\n '}': 'è',\n '~': 'ì'\n};\n\n/**\n * Norwegian/Danish character set\n * ESC (E or ESC (6\n * Reference: http://vt100.net/docs/vt220-rm/table2-12.html\n */\nCHARSETS['E'] =\nCHARSETS['6'] = {\n '@': 'Ä',\n '[': 'Æ',\n '\\\\': 'Ø',\n ']': 'Å',\n '^': 'Ü',\n '`': 'ä',\n '{': 'æ',\n '|': 'ø',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * Spanish character set\n * ESC (Z\n * Reference: http://vt100.net/docs/vt220-rm/table2-13.html\n */\nCHARSETS['Z'] = {\n '#': '£',\n '@': '§',\n '[': '¡',\n '\\\\': 'Ñ',\n ']': '¿',\n '{': '°',\n '|': 'ñ',\n '}': 'ç'\n};\n\n/**\n * Swedish character set\n * ESC (H or ESC (7\n * Reference: http://vt100.net/docs/vt220-rm/table2-14.html\n */\nCHARSETS['H'] =\nCHARSETS['7'] = {\n '@': 'É',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Å',\n '^': 'Ü',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * Swiss character set\n * ESC (=\n * Reference: http://vt100.net/docs/vt220-rm/table2-15.html\n */\nCHARSETS['='] = {\n '#': 'ù',\n '@': 'à',\n '[': 'é',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n '_': 'è',\n '`': 'ô',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'û'\n};\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * C0 control codes\n * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n */\nexport namespace C0 {\n /** Null (Caret = ^@, C = \\0) */\n export const NUL = '\\x00';\n /** Start of Heading (Caret = ^A) */\n export const SOH = '\\x01';\n /** Start of Text (Caret = ^B) */\n export const STX = '\\x02';\n /** End of Text (Caret = ^C) */\n export const ETX = '\\x03';\n /** End of Transmission (Caret = ^D) */\n export const EOT = '\\x04';\n /** Enquiry (Caret = ^E) */\n export const ENQ = '\\x05';\n /** Acknowledge (Caret = ^F) */\n export const ACK = '\\x06';\n /** Bell (Caret = ^G, C = \\a) */\n export const BEL = '\\x07';\n /** Backspace (Caret = ^H, C = \\b) */\n export const BS = '\\x08';\n /** Character Tabulation, Horizontal Tabulation (Caret = ^I, C = \\t) */\n export const HT = '\\x09';\n /** Line Feed (Caret = ^J, C = \\n) */\n export const LF = '\\x0a';\n /** Line Tabulation, Vertical Tabulation (Caret = ^K, C = \\v) */\n export const VT = '\\x0b';\n /** Form Feed (Caret = ^L, C = \\f) */\n export const FF = '\\x0c';\n /** Carriage Return (Caret = ^M, C = \\r) */\n export const CR = '\\x0d';\n /** Shift Out (Caret = ^N) */\n export const SO = '\\x0e';\n /** Shift In (Caret = ^O) */\n export const SI = '\\x0f';\n /** Data Link Escape (Caret = ^P) */\n export const DLE = '\\x10';\n /** Device Control One (XON) (Caret = ^Q) */\n export const DC1 = '\\x11';\n /** Device Control Two (Caret = ^R) */\n export const DC2 = '\\x12';\n /** Device Control Three (XOFF) (Caret = ^S) */\n export const DC3 = '\\x13';\n /** Device Control Four (Caret = ^T) */\n export const DC4 = '\\x14';\n /** Negative Acknowledge (Caret = ^U) */\n export const NAK = '\\x15';\n /** Synchronous Idle (Caret = ^V) */\n export const SYN = '\\x16';\n /** End of Transmission Block (Caret = ^W) */\n export const ETB = '\\x17';\n /** Cancel (Caret = ^X) */\n export const CAN = '\\x18';\n /** End of Medium (Caret = ^Y) */\n export const EM = '\\x19';\n /** Substitute (Caret = ^Z) */\n export const SUB = '\\x1a';\n /** Escape (Caret = ^[, C = \\e) */\n export const ESC = '\\x1b';\n /** File Separator (Caret = ^\\) */\n export const FS = '\\x1c';\n /** Group Separator (Caret = ^]) */\n export const GS = '\\x1d';\n /** Record Separator (Caret = ^^) */\n export const RS = '\\x1e';\n /** Unit Separator (Caret = ^_) */\n export const US = '\\x1f';\n /** Space */\n export const SP = '\\x20';\n /** Delete (Caret = ^?) */\n export const DEL = '\\x7f';\n}\n\n/**\n * C1 control codes\n * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n */\nexport namespace C1 {\n /** padding character */\n export const PAD = '\\x80';\n /** High Octet Preset */\n export const HOP = '\\x81';\n /** Break Permitted Here */\n export const BPH = '\\x82';\n /** No Break Here */\n export const NBH = '\\x83';\n /** Index */\n export const IND = '\\x84';\n /** Next Line */\n export const NEL = '\\x85';\n /** Start of Selected Area */\n export const SSA = '\\x86';\n /** End of Selected Area */\n export const ESA = '\\x87';\n /** Horizontal Tabulation Set */\n export const HTS = '\\x88';\n /** Horizontal Tabulation With Justification */\n export const HTJ = '\\x89';\n /** Vertical Tabulation Set */\n export const VTS = '\\x8a';\n /** Partial Line Down */\n export const PLD = '\\x8b';\n /** Partial Line Up */\n export const PLU = '\\x8c';\n /** Reverse Index */\n export const RI = '\\x8d';\n /** Single-Shift 2 */\n export const SS2 = '\\x8e';\n /** Single-Shift 3 */\n export const SS3 = '\\x8f';\n /** Device Control String */\n export const DCS = '\\x90';\n /** Private Use 1 */\n export const PU1 = '\\x91';\n /** Private Use 2 */\n export const PU2 = '\\x92';\n /** Set Transmit State */\n export const STS = '\\x93';\n /** Destructive backspace, intended to eliminate ambiguity about meaning of BS. */\n export const CCH = '\\x94';\n /** Message Waiting */\n export const MW = '\\x95';\n /** Start of Protected Area */\n export const SPA = '\\x96';\n /** End of Protected Area */\n export const EPA = '\\x97';\n /** Start of String */\n export const SOS = '\\x98';\n /** Single Graphic Character Introducer */\n export const SGCI = '\\x99';\n /** Single Character Introducer */\n export const SCI = '\\x9a';\n /** Control Sequence Introducer */\n export const CSI = '\\x9b';\n /** String Terminator */\n export const ST = '\\x9c';\n /** Operating System Command */\n export const OSC = '\\x9d';\n /** Privacy Message */\n export const PM = '\\x9e';\n /** Application Program Command */\n export const APC = '\\x9f';\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n// reg + shift key mappings for digits and special chars\nconst KEYCODE_KEY_MAPPINGS: { [key: number]: [string, string]} = {\n // digits 0-9\n 48: ['0', ')'],\n 49: ['1', '!'],\n 50: ['2', '@'],\n 51: ['3', '#'],\n 52: ['4', '$'],\n 53: ['5', '%'],\n 54: ['6', '^'],\n 55: ['7', '&'],\n 56: ['8', '*'],\n 57: ['9', '('],\n\n // special chars\n 186: [';', ':'],\n 187: ['=', '+'],\n 188: [',', '<'],\n 189: ['-', '_'],\n 190: ['.', '>'],\n 191: ['/', '?'],\n 192: ['`', '~'],\n 219: ['[', '{'],\n 220: ['\\\\', '|'],\n 221: [']', '}'],\n 222: ['\\'', '\"']\n};\n\nexport function evaluateKeyboardEvent(\n ev: IKeyboardEvent,\n applicationCursorMode: boolean,\n isMac: boolean,\n macOptionIsMeta: boolean\n): IKeyboardResult {\n const result: IKeyboardResult = {\n type: KeyboardResultType.SEND_KEY,\n // Whether to cancel event propagation (NOTE: this may not be needed since the event is\n // canceled at the end of keyDown\n cancel: false,\n // The new key even to emit\n key: undefined\n };\n const modifiers = (ev.shiftKey ? 1 : 0) | (ev.altKey ? 2 : 0) | (ev.ctrlKey ? 4 : 0) | (ev.metaKey ? 8 : 0);\n switch (ev.keyCode) {\n case 0:\n if (ev.key === 'UIKeyInputUpArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n }\n else if (ev.key === 'UIKeyInputLeftArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n }\n else if (ev.key === 'UIKeyInputRightArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n }\n else if (ev.key === 'UIKeyInputDownArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n }\n break;\n case 8:\n // backspace\n if (ev.shiftKey) {\n result.key = C0.BS; // ^H\n break;\n } else if (ev.altKey) {\n result.key = C0.ESC + C0.DEL; // \\e ^?\n break;\n }\n result.key = C0.DEL; // ^?\n break;\n case 9:\n // tab\n if (ev.shiftKey) {\n result.key = C0.ESC + '[Z';\n break;\n }\n result.key = C0.HT;\n result.cancel = true;\n break;\n case 13:\n // return/enter\n result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;\n result.cancel = true;\n break;\n case 27:\n // escape\n result.key = C0.ESC;\n if (ev.altKey) {\n result.key = C0.ESC + C0.ESC;\n }\n result.cancel = true;\n break;\n case 37:\n // left-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'D';\n // HACK: Make Alt + left-arrow behave like Ctrl + left-arrow: move one word backwards\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (result.key === C0.ESC + '[1;3D') {\n result.key = C0.ESC + (isMac ? 'b' : '[1;5D');\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n break;\n case 39:\n // right-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'C';\n // HACK: Make Alt + right-arrow behave like Ctrl + right-arrow: move one word forward\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (result.key === C0.ESC + '[1;3C') {\n result.key = C0.ESC + (isMac ? 'f' : '[1;5C');\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n break;\n case 38:\n // up-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A';\n // HACK: Make Alt + up-arrow behave like Ctrl + up-arrow\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (!isMac && result.key === C0.ESC + '[1;3A') {\n result.key = C0.ESC + '[1;5A';\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n break;\n case 40:\n // down-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B';\n // HACK: Make Alt + down-arrow behave like Ctrl + down-arrow\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (!isMac && result.key === C0.ESC + '[1;3B') {\n result.key = C0.ESC + '[1;5B';\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n break;\n case 45:\n // insert\n if (!ev.shiftKey && !ev.ctrlKey) {\n // or + are used to\n // copy-paste on some systems.\n result.key = C0.ESC + '[2~';\n }\n break;\n case 46:\n // delete\n if (modifiers) {\n result.key = C0.ESC + '[3;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[3~';\n }\n break;\n case 36:\n // home\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'H';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OH';\n } else {\n result.key = C0.ESC + '[H';\n }\n break;\n case 35:\n // end\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'F';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OF';\n } else {\n result.key = C0.ESC + '[F';\n }\n break;\n case 33:\n // page up\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_UP;\n } else {\n result.key = C0.ESC + '[5~';\n }\n break;\n case 34:\n // page down\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_DOWN;\n } else {\n result.key = C0.ESC + '[6~';\n }\n break;\n case 112:\n // F1-F12\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'P';\n } else {\n result.key = C0.ESC + 'OP';\n }\n break;\n case 113:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'Q';\n } else {\n result.key = C0.ESC + 'OQ';\n }\n break;\n case 114:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'R';\n } else {\n result.key = C0.ESC + 'OR';\n }\n break;\n case 115:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'S';\n } else {\n result.key = C0.ESC + 'OS';\n }\n break;\n case 116:\n if (modifiers) {\n result.key = C0.ESC + '[15;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[15~';\n }\n break;\n case 117:\n if (modifiers) {\n result.key = C0.ESC + '[17;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[17~';\n }\n break;\n case 118:\n if (modifiers) {\n result.key = C0.ESC + '[18;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[18~';\n }\n break;\n case 119:\n if (modifiers) {\n result.key = C0.ESC + '[19;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[19~';\n }\n break;\n case 120:\n if (modifiers) {\n result.key = C0.ESC + '[20;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[20~';\n }\n break;\n case 121:\n if (modifiers) {\n result.key = C0.ESC + '[21;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[21~';\n }\n break;\n case 122:\n if (modifiers) {\n result.key = C0.ESC + '[23;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[23~';\n }\n break;\n case 123:\n if (modifiers) {\n result.key = C0.ESC + '[24;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[24~';\n }\n break;\n default:\n // a-z and space\n if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {\n if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n result.key = String.fromCharCode(ev.keyCode - 64);\n } else if (ev.keyCode === 32) {\n result.key = C0.NUL;\n } else if (ev.keyCode >= 51 && ev.keyCode <= 55) {\n // escape, file sep, group sep, record sep, unit sep\n result.key = String.fromCharCode(ev.keyCode - 51 + 27);\n } else if (ev.keyCode === 56) {\n result.key = C0.DEL;\n } else if (ev.keyCode === 219) {\n result.key = C0.ESC;\n } else if (ev.keyCode === 220) {\n result.key = C0.FS;\n } else if (ev.keyCode === 221) {\n result.key = C0.GS;\n }\n } else if ((!isMac || macOptionIsMeta) && ev.altKey && !ev.metaKey) {\n // On macOS this is a third level shift when !macOptionIsMeta. Use instead.\n const keyMapping = KEYCODE_KEY_MAPPINGS[ev.keyCode];\n const key = keyMapping && keyMapping[!ev.shiftKey ? 0 : 1];\n if (key) {\n result.key = C0.ESC + key;\n } else if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n const keyCode = ev.ctrlKey ? ev.keyCode - 64 : ev.keyCode + 32;\n result.key = C0.ESC + String.fromCharCode(keyCode);\n }\n } else if (isMac && !ev.altKey && !ev.ctrlKey && !ev.shiftKey && ev.metaKey) {\n if (ev.keyCode === 65) { // cmd + a\n result.type = KeyboardResultType.SELECT_ALL;\n }\n } else if (ev.key && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.keyCode >= 48 && ev.key.length === 1) {\n // Include only keys that that result in a _single_ character; don't include num lock, volume up, etc.\n result.key = ev.key;\n } else if (ev.key && ev.ctrlKey) {\n if (ev.key === '_') { // ^_\n result.key = C0.US;\n }\n }\n break;\n }\n\n return result;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Polyfill - Convert UTF32 codepoint into JS string.\n * Note: The built-in String.fromCodePoint happens to be much slower\n * due to additional sanity checks. We can avoid them since\n * we always operate on legal UTF32 (granted by the input decoders)\n * and use this faster version instead.\n */\nexport function stringFromCodePoint(codePoint: number): string {\n if (codePoint > 0xFFFF) {\n codePoint -= 0x10000;\n return String.fromCharCode((codePoint >> 10) + 0xD800) + String.fromCharCode((codePoint % 0x400) + 0xDC00);\n }\n return String.fromCharCode(codePoint);\n}\n\n/**\n * Convert UTF32 char codes into JS string.\n * Basically the same as `stringFromCodePoint` but for multiple codepoints\n * in a loop (which is a lot faster).\n */\nexport function utf32ToString(data: Uint32Array, start: number = 0, end: number = data.length): string {\n let result = '';\n for (let i = start; i < end; ++i) {\n let codepoint = data[i];\n if (codepoint > 0xFFFF) {\n // JS strings are encoded as UTF16, thus a non BMP codepoint gets converted into a surrogate pair\n // conversion rules:\n // - subtract 0x10000 from code point, leaving a 20 bit number\n // - add high 10 bits to 0xD800 --> first surrogate\n // - add low 10 bits to 0xDC00 --> second surrogate\n codepoint -= 0x10000;\n result += String.fromCharCode((codepoint >> 10) + 0xD800) + String.fromCharCode((codepoint % 0x400) + 0xDC00);\n } else {\n result += String.fromCharCode(codepoint);\n }\n }\n return result;\n}\n\n/**\n * StringToUtf32 - decodes UTF16 sequences into UTF32 codepoints.\n * To keep the decoder in line with JS strings it handles single surrogates as UCS2.\n */\nexport class StringToUtf32 {\n private _interim: number = 0;\n\n /**\n * Clears interim and resets decoder to clean state.\n */\n public clear(): void {\n this._interim = 0;\n }\n\n /**\n * Decode JS string to UTF32 codepoints.\n * The methods assumes stream input and will store partly transmitted\n * surrogate pairs and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided input data does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: string, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let startPos = 0;\n\n // handle leftover surrogate high\n if (this._interim) {\n const second = input.charCodeAt(startPos++);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (this._interim - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = this._interim;\n target[size++] = second;\n }\n this._interim = 0;\n }\n\n for (let i = startPos; i < length; ++i) {\n const code = input.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n this._interim = code;\n return size;\n }\n const second = input.charCodeAt(i);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = code;\n target[size++] = second;\n }\n continue;\n }\n if (code === 0xFEFF) {\n // BOM\n continue;\n }\n target[size++] = code;\n }\n return size;\n }\n}\n\n/**\n * Utf8Decoder - decodes UTF8 byte sequences into UTF32 codepoints.\n */\nexport class Utf8ToUtf32 {\n public interim: Uint8Array = new Uint8Array(3);\n\n /**\n * Clears interim bytes and resets decoder to clean state.\n */\n public clear(): void {\n this.interim.fill(0);\n }\n\n /**\n * Decodes UTF8 byte sequences in `input` to UTF32 codepoints in `target`.\n * The methods assumes stream input and will store partly transmitted bytes\n * and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided data chunk does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: Uint8Array, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let byte1: number;\n let byte2: number;\n let byte3: number;\n let byte4: number;\n let codepoint = 0;\n let startPos = 0;\n\n // handle leftover bytes\n if (this.interim[0]) {\n let discardInterim = false;\n let cp = this.interim[0];\n cp &= ((((cp & 0xE0) === 0xC0)) ? 0x1F : (((cp & 0xF0) === 0xE0)) ? 0x0F : 0x07);\n let pos = 0;\n let tmp: number;\n while ((tmp = this.interim[++pos] & 0x3F) && pos < 4) {\n cp <<= 6;\n cp |= tmp;\n }\n // missing bytes - read ahead from input\n const type = (((this.interim[0] & 0xE0) === 0xC0)) ? 2 : (((this.interim[0] & 0xF0) === 0xE0)) ? 3 : 4;\n const missing = type - pos;\n while (startPos < missing) {\n if (startPos >= length) {\n return 0;\n }\n tmp = input[startPos++];\n if ((tmp & 0xC0) !== 0x80) {\n // wrong continuation, discard interim bytes completely\n startPos--;\n discardInterim = true;\n break;\n } else {\n // need to save so we can continue short inputs in next call\n this.interim[pos++] = tmp;\n cp <<= 6;\n cp |= tmp & 0x3F;\n }\n }\n if (!discardInterim) {\n // final test is type dependent\n if (type === 2) {\n if (cp < 0x80) {\n // wrong starter byte\n startPos--;\n } else {\n target[size++] = cp;\n }\n } else if (type === 3) {\n if (cp < 0x0800 || (cp >= 0xD800 && cp <= 0xDFFF) || cp === 0xFEFF) {\n // illegal codepoint or BOM\n } else {\n target[size++] = cp;\n }\n } else {\n if (cp < 0x010000 || cp > 0x10FFFF) {\n // illegal codepoint\n } else {\n target[size++] = cp;\n }\n }\n }\n this.interim.fill(0);\n }\n\n // loop through input\n const fourStop = length - 4;\n let i = startPos;\n while (i < length) {\n /**\n * ASCII shortcut with loop unrolled to 4 consecutive ASCII chars.\n * This is a compromise between speed gain for ASCII\n * and penalty for non ASCII:\n * For best ASCII performance the char should be stored directly into target,\n * but even a single attempt to write to target and compare afterwards\n * penalizes non ASCII really bad (-50%), thus we load the char into byteX first,\n * which reduces ASCII performance by ~15%.\n * This trial for ASCII reduces non ASCII performance by ~10% which seems acceptible\n * compared to the gains.\n * Note that this optimization only takes place for 4 consecutive ASCII chars,\n * for any shorter it bails out. Worst case - all 4 bytes being read but\n * thrown away due to the last being a non ASCII char (-10% performance).\n */\n while (i < fourStop\n && !((byte1 = input[i]) & 0x80)\n && !((byte2 = input[i + 1]) & 0x80)\n && !((byte3 = input[i + 2]) & 0x80)\n && !((byte4 = input[i + 3]) & 0x80))\n {\n target[size++] = byte1;\n target[size++] = byte2;\n target[size++] = byte3;\n target[size++] = byte4;\n i += 4;\n }\n\n // reread byte1\n byte1 = input[i++];\n\n // 1 byte\n if (byte1 < 0x80) {\n target[size++] = byte1;\n\n // 2 bytes\n } else if ((byte1 & 0xE0) === 0xC0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x1F) << 6 | (byte2 & 0x3F);\n if (codepoint < 0x80) {\n // wrong starter byte\n i--;\n continue;\n }\n target[size++] = codepoint;\n\n // 3 bytes\n } else if ((byte1 & 0xF0) === 0xE0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F);\n if (codepoint < 0x0800 || (codepoint >= 0xD800 && codepoint <= 0xDFFF) || codepoint === 0xFEFF) {\n // illegal codepoint or BOM, no i-- here\n continue;\n }\n target[size++] = codepoint;\n\n // 4 bytes\n } else if ((byte1 & 0xF8) === 0xF0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n this.interim[2] = byte3;\n return size;\n }\n byte4 = input[i++];\n if ((byte4 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x07) << 18 | (byte2 & 0x3F) << 12 | (byte3 & 0x3F) << 6 | (byte4 & 0x3F);\n if (codepoint < 0x010000 || codepoint > 0x10FFFF) {\n // illegal codepoint, no i-- here\n continue;\n }\n target[size++] = codepoint;\n } else {\n // illegal byte, just skip\n }\n }\n return size;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IUnicodeVersionProvider } from 'common/services/Services';\nimport { fill } from 'common/TypedArrayUtils';\n\ntype CharWidth = 0 | 1 | 2;\n\nconst BMP_COMBINING = [\n [0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489],\n [0x0591, 0x05BD], [0x05BF, 0x05BF], [0x05C1, 0x05C2],\n [0x05C4, 0x05C5], [0x05C7, 0x05C7], [0x0600, 0x0603],\n [0x0610, 0x0615], [0x064B, 0x065E], [0x0670, 0x0670],\n [0x06D6, 0x06E4], [0x06E7, 0x06E8], [0x06EA, 0x06ED],\n [0x070F, 0x070F], [0x0711, 0x0711], [0x0730, 0x074A],\n [0x07A6, 0x07B0], [0x07EB, 0x07F3], [0x0901, 0x0902],\n [0x093C, 0x093C], [0x0941, 0x0948], [0x094D, 0x094D],\n [0x0951, 0x0954], [0x0962, 0x0963], [0x0981, 0x0981],\n [0x09BC, 0x09BC], [0x09C1, 0x09C4], [0x09CD, 0x09CD],\n [0x09E2, 0x09E3], [0x0A01, 0x0A02], [0x0A3C, 0x0A3C],\n [0x0A41, 0x0A42], [0x0A47, 0x0A48], [0x0A4B, 0x0A4D],\n [0x0A70, 0x0A71], [0x0A81, 0x0A82], [0x0ABC, 0x0ABC],\n [0x0AC1, 0x0AC5], [0x0AC7, 0x0AC8], [0x0ACD, 0x0ACD],\n [0x0AE2, 0x0AE3], [0x0B01, 0x0B01], [0x0B3C, 0x0B3C],\n [0x0B3F, 0x0B3F], [0x0B41, 0x0B43], [0x0B4D, 0x0B4D],\n [0x0B56, 0x0B56], [0x0B82, 0x0B82], [0x0BC0, 0x0BC0],\n [0x0BCD, 0x0BCD], [0x0C3E, 0x0C40], [0x0C46, 0x0C48],\n [0x0C4A, 0x0C4D], [0x0C55, 0x0C56], [0x0CBC, 0x0CBC],\n [0x0CBF, 0x0CBF], [0x0CC6, 0x0CC6], [0x0CCC, 0x0CCD],\n [0x0CE2, 0x0CE3], [0x0D41, 0x0D43], [0x0D4D, 0x0D4D],\n [0x0DCA, 0x0DCA], [0x0DD2, 0x0DD4], [0x0DD6, 0x0DD6],\n [0x0E31, 0x0E31], [0x0E34, 0x0E3A], [0x0E47, 0x0E4E],\n [0x0EB1, 0x0EB1], [0x0EB4, 0x0EB9], [0x0EBB, 0x0EBC],\n [0x0EC8, 0x0ECD], [0x0F18, 0x0F19], [0x0F35, 0x0F35],\n [0x0F37, 0x0F37], [0x0F39, 0x0F39], [0x0F71, 0x0F7E],\n [0x0F80, 0x0F84], [0x0F86, 0x0F87], [0x0F90, 0x0F97],\n [0x0F99, 0x0FBC], [0x0FC6, 0x0FC6], [0x102D, 0x1030],\n [0x1032, 0x1032], [0x1036, 0x1037], [0x1039, 0x1039],\n [0x1058, 0x1059], [0x1160, 0x11FF], [0x135F, 0x135F],\n [0x1712, 0x1714], [0x1732, 0x1734], [0x1752, 0x1753],\n [0x1772, 0x1773], [0x17B4, 0x17B5], [0x17B7, 0x17BD],\n [0x17C6, 0x17C6], [0x17C9, 0x17D3], [0x17DD, 0x17DD],\n [0x180B, 0x180D], [0x18A9, 0x18A9], [0x1920, 0x1922],\n [0x1927, 0x1928], [0x1932, 0x1932], [0x1939, 0x193B],\n [0x1A17, 0x1A18], [0x1B00, 0x1B03], [0x1B34, 0x1B34],\n [0x1B36, 0x1B3A], [0x1B3C, 0x1B3C], [0x1B42, 0x1B42],\n [0x1B6B, 0x1B73], [0x1DC0, 0x1DCA], [0x1DFE, 0x1DFF],\n [0x200B, 0x200F], [0x202A, 0x202E], [0x2060, 0x2063],\n [0x206A, 0x206F], [0x20D0, 0x20EF], [0x302A, 0x302F],\n [0x3099, 0x309A], [0xA806, 0xA806], [0xA80B, 0xA80B],\n [0xA825, 0xA826], [0xFB1E, 0xFB1E], [0xFE00, 0xFE0F],\n [0xFE20, 0xFE23], [0xFEFF, 0xFEFF], [0xFFF9, 0xFFFB]\n];\nconst HIGH_COMBINING = [\n [0x10A01, 0x10A03], [0x10A05, 0x10A06], [0x10A0C, 0x10A0F],\n [0x10A38, 0x10A3A], [0x10A3F, 0x10A3F], [0x1D167, 0x1D169],\n [0x1D173, 0x1D182], [0x1D185, 0x1D18B], [0x1D1AA, 0x1D1AD],\n [0x1D242, 0x1D244], [0xE0001, 0xE0001], [0xE0020, 0xE007F],\n [0xE0100, 0xE01EF]\n];\n\n// BMP lookup table, lazy initialized during first addon loading\nlet table: Uint8Array;\n\nfunction bisearch(ucs: number, data: number[][]): boolean {\n let min = 0;\n let max = data.length - 1;\n let mid;\n if (ucs < data[0][0] || ucs > data[max][1]) {\n return false;\n }\n while (max >= min) {\n mid = (min + max) >> 1;\n if (ucs > data[mid][1]) {\n min = mid + 1;\n } else if (ucs < data[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n}\n\nexport class UnicodeV6 implements IUnicodeVersionProvider {\n public readonly version = '6';\n\n constructor() {\n // init lookup table once\n if (!table) {\n table = new Uint8Array(65536);\n fill(table, 1);\n table[0] = 0;\n // control chars\n fill(table, 0, 1, 32);\n fill(table, 0, 0x7f, 0xa0);\n\n // apply wide char rules first\n // wide chars\n fill(table, 2, 0x1100, 0x1160);\n table[0x2329] = 2;\n table[0x232a] = 2;\n fill(table, 2, 0x2e80, 0xa4d0);\n table[0x303f] = 1; // wrongly in last line\n\n fill(table, 2, 0xac00, 0xd7a4);\n fill(table, 2, 0xf900, 0xfb00);\n fill(table, 2, 0xfe10, 0xfe1a);\n fill(table, 2, 0xfe30, 0xfe70);\n fill(table, 2, 0xff00, 0xff61);\n fill(table, 2, 0xffe0, 0xffe7);\n\n // apply combining last to ensure we overwrite\n // wrongly wide set chars:\n // the original algo evals combining first and falls\n // through to wide check so we simply do here the opposite\n // combining 0\n for (let r = 0; r < BMP_COMBINING.length; ++r) {\n fill(table, 0, BMP_COMBINING[r][0], BMP_COMBINING[r][1] + 1);\n }\n }\n }\n\n public wcwidth(num: number): CharWidth {\n if (num < 32) return 0;\n if (num < 127) return 1;\n if (num < 65536) return table[num] as CharWidth;\n if (bisearch(num, HIGH_COMBINING)) return 0;\n if ((num >= 0x20000 && num <= 0x2fffd) || (num >= 0x30000 && num <= 0x3fffd)) return 2;\n return 1;\n }\n}\n","\n/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\ndeclare const setTimeout: (handler: () => void, timeout?: number) => void;\n\n/**\n * Safety watermark to avoid memory exhaustion and browser engine crash on fast data input.\n * Enable flow control to avoid this limit and make sure that your backend correctly\n * propagates this to the underlying pty. (see docs for further instructions)\n * Since this limit is meant as a safety parachute to prevent browser crashs,\n * it is set to a very high number. Typically xterm.js gets unresponsive with\n * a 100 times lower number (>500 kB).\n */\nconst DISCARD_WATERMARK = 50000000; // ~50 MB\n\n/**\n * The max number of ms to spend on writes before allowing the renderer to\n * catch up with a 0ms setTimeout. A value of < 33 to keep us close to\n * 30fps, and a value of < 16 to try to run at 60fps. Of course, the real FPS\n * depends on the time it takes for the renderer to draw the frame.\n */\nconst WRITE_TIMEOUT_MS = 12;\n\n/**\n * Threshold of max held chunks in the write buffer, that were already processed.\n * This is a tradeoff between extensive write buffer shifts (bad runtime) and high\n * memory consumption by data thats not used anymore.\n */\nconst WRITE_BUFFER_LENGTH_THRESHOLD = 50;\n\nexport class WriteBuffer {\n private _writeBuffer: (string | Uint8Array)[] = [];\n private _callbacks: ((() => void) | undefined)[] = [];\n private _pendingData = 0;\n private _bufferOffset = 0;\n\n constructor(private _action: (data: string | Uint8Array) => void) { }\n\n public writeSync(data: string | Uint8Array): void {\n // force sync processing on pending data chunks to avoid in-band data scrambling\n // does the same as innerWrite but without event loop\n if (this._writeBuffer.length) {\n for (let i = this._bufferOffset; i < this._writeBuffer.length; ++i) {\n const data = this._writeBuffer[i];\n const cb = this._callbacks[i];\n this._action(data);\n if (cb) cb();\n }\n // reset all to avoid reprocessing of chunks with scheduled innerWrite call\n this._writeBuffer = [];\n this._callbacks = [];\n this._pendingData = 0;\n // stop scheduled innerWrite by offset > length condition\n this._bufferOffset = 0x7FFFFFFF;\n }\n // handle current data chunk\n this._action(data);\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n if (this._pendingData > DISCARD_WATERMARK) {\n throw new Error('write data discarded, use flow control to avoid losing data');\n }\n\n // schedule chunk processing for next event loop run\n if (!this._writeBuffer.length) {\n this._bufferOffset = 0;\n setTimeout(() => this._innerWrite());\n }\n\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n }\n\n protected _innerWrite(): void {\n const startTime = Date.now();\n while (this._writeBuffer.length > this._bufferOffset) {\n const data = this._writeBuffer[this._bufferOffset];\n const cb = this._callbacks[this._bufferOffset];\n this._bufferOffset++;\n\n this._action(data);\n this._pendingData -= data.length;\n if (cb) cb();\n\n if (Date.now() - startTime >= WRITE_TIMEOUT_MS) {\n break;\n }\n }\n if (this._writeBuffer.length > this._bufferOffset) {\n // Allow renderer to catch up before processing the next batch\n // trim already processed chunks if we are above threshold\n if (this._bufferOffset > WRITE_BUFFER_LENGTH_THRESHOLD) {\n this._writeBuffer = this._writeBuffer.slice(this._bufferOffset);\n this._callbacks = this._callbacks.slice(this._bufferOffset);\n this._bufferOffset = 0;\n }\n setTimeout(() => this._innerWrite(), 0);\n } else {\n this._writeBuffer = [];\n this._callbacks = [];\n this._pendingData = 0;\n this._bufferOffset = 0;\n }\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Internal states of EscapeSequenceParser.\n */\nexport const enum ParserState {\n GROUND = 0,\n ESCAPE = 1,\n ESCAPE_INTERMEDIATE = 2,\n CSI_ENTRY = 3,\n CSI_PARAM = 4,\n CSI_INTERMEDIATE = 5,\n CSI_IGNORE = 6,\n SOS_PM_APC_STRING = 7,\n OSC_STRING = 8,\n DCS_ENTRY = 9,\n DCS_PARAM = 10,\n DCS_IGNORE = 11,\n DCS_INTERMEDIATE = 12,\n DCS_PASSTHROUGH = 13\n}\n\n/**\n* Internal actions of EscapeSequenceParser.\n*/\nexport const enum ParserAction {\n IGNORE = 0,\n ERROR = 1,\n PRINT = 2,\n EXECUTE = 3,\n OSC_START = 4,\n OSC_PUT = 5,\n OSC_END = 6,\n CSI_DISPATCH = 7,\n PARAM = 8,\n COLLECT = 9,\n ESC_DISPATCH = 10,\n CLEAR = 11,\n DCS_HOOK = 12,\n DCS_PUT = 13,\n DCS_UNHOOK = 14\n}\n\n/**\n * Internal states of OscParser.\n */\nexport const enum OscState {\n START = 0,\n ID = 1,\n PAYLOAD = 2,\n ABORT = 3\n}\n\n// payload limit for OSC and DCS\nexport const PAYLOAD_LIMIT = 10000000;\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType } from 'common/parser/Types';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { Params } from 'common/parser/Params';\nimport { PAYLOAD_LIMIT } from 'common/parser/Constants';\n\nconst EMPTY_HANDLERS: IDcsHandler[] = [];\n\nexport class DcsParser implements IDcsParser {\n private _handlers: IHandlerCollection = Object.create(null);\n private _active: IDcsHandler[] = EMPTY_HANDLERS;\n private _ident: number = 0;\n private _handlerFb: DcsFallbackHandlerType = () => {};\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => {};\n this._active = EMPTY_HANDLERS;\n }\n\n public registerHandler(ident: number, handler: IDcsHandler): IDisposable {\n if (this._handlers[ident] === undefined) {\n this._handlers[ident] = [];\n }\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n\n public setHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public reset(): void {\n if (this._active.length) {\n this.unhook(false);\n }\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n\n public hook(ident: number, params: IParams): void {\n // always reset leftover handlers\n this.reset();\n this._ident = ident;\n this._active = this._handlers[ident] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._ident, 'HOOK', params);\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].hook(params);\n }\n }\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public unhook(success: boolean): void {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'UNHOOK', success);\n } else {\n let j = this._active.length - 1;\n for (; j >= 0; j--) {\n if (this._active[j].unhook(success)) {\n break;\n }\n }\n j--;\n // cleanup left over handlers\n for (; j >= 0; j--) {\n this._active[j].unhook(false);\n }\n }\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n}\n\n// predefine empty params as [0] (ZDM)\nconst EMPTY_PARAMS = new Params();\nEMPTY_PARAMS.addParam(0);\n\n/**\n * Convenient class to create a DCS handler from a single callback function.\n * Note: The payload is currently limited to 50 MB (hardcoded).\n */\nexport class DcsHandler implements IDcsHandler {\n private _data = '';\n private _params: IParams = EMPTY_PARAMS;\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string, params: IParams) => boolean) {}\n\n public hook(params: IParams): void {\n // since we need to preserve params until `unhook`, we have to clone it\n // (only borrowed from parser and spans multiple parser states)\n // perf optimization:\n // clone only, if we have non empty params, otherwise stick with default\n this._params = (params.length > 1 || params.params[0]) ? params.clone() : EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > PAYLOAD_LIMIT) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public unhook(success: boolean): boolean {\n let ret = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data, this._params);\n }\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType } from 'common/parser/Types';\nimport { ParserState, ParserAction } from 'common/parser/Constants';\nimport { Disposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { fill } from 'common/TypedArrayUtils';\nimport { Params } from 'common/parser/Params';\nimport { OscParser } from 'common/parser/OscParser';\nimport { DcsParser } from 'common/parser/DcsParser';\n\n/**\n * Table values are generated like this:\n * index: currentState << TableValue.INDEX_STATE_SHIFT | charCode\n * value: action << TableValue.TRANSITION_ACTION_SHIFT | nextState\n */\nconst enum TableAccess {\n TRANSITION_ACTION_SHIFT = 4,\n TRANSITION_STATE_MASK = 15,\n INDEX_STATE_SHIFT = 8\n}\n\n/**\n * Transition table for EscapeSequenceParser.\n */\nexport class TransitionTable {\n public table: Uint8Array;\n\n constructor(length: number) {\n this.table = new Uint8Array(length);\n }\n\n /**\n * Set default transition.\n * @param action default action\n * @param next default next state\n */\n public setDefault(action: ParserAction, next: ParserState): void {\n fill(this.table, action << TableAccess.TRANSITION_ACTION_SHIFT | next);\n }\n\n /**\n * Add a transition to the transition table.\n * @param code input character code\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public add(code: number, state: ParserState, action: ParserAction, next: ParserState): void {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | code] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n\n /**\n * Add transitions for multiple input character codes.\n * @param codes input character code array\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public addMany(codes: number[], state: ParserState, action: ParserAction, next: ParserState): void {\n for (let i = 0; i < codes.length; i++) {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | codes[i]] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n }\n}\n\n\n// Pseudo-character placeholder for printable non-ascii characters (unicode).\nconst NON_ASCII_PRINTABLE = 0xA0;\n\n\n/**\n * VT500 compatible transition table.\n * Taken from https://vt100.net/emu/dec_ansi_parser.\n */\nexport const VT500_TRANSITION_TABLE = (function (): TransitionTable {\n const table: TransitionTable = new TransitionTable(4095);\n\n // range macro for byte\n const BYTE_VALUES = 256;\n const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused: any, i: number) => i);\n const r = (start: number, end: number): number[] => blueprint.slice(start, end);\n\n // Default definitions.\n const PRINTABLES = r(0x20, 0x7f); // 0x20 (SP) included, 0x7F (DEL) excluded\n const EXECUTABLES = r(0x00, 0x18);\n EXECUTABLES.push(0x19);\n EXECUTABLES.push.apply(EXECUTABLES, r(0x1c, 0x20));\n\n const states: number[] = r(ParserState.GROUND, ParserState.DCS_PASSTHROUGH + 1);\n let state: any;\n\n // set default transition\n table.setDefault(ParserAction.ERROR, ParserState.GROUND);\n // printables\n table.addMany(PRINTABLES, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n // global anywhere rules\n for (state in states) {\n table.addMany([0x18, 0x1a, 0x99, 0x9a], state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x80, 0x90), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x90, 0x98), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.add(0x9c, state, ParserAction.IGNORE, ParserState.GROUND); // ST as terminator\n table.add(0x1b, state, ParserAction.CLEAR, ParserState.ESCAPE); // ESC\n table.add(0x9d, state, ParserAction.OSC_START, ParserState.OSC_STRING); // OSC\n table.addMany([0x98, 0x9e, 0x9f], state, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.add(0x9b, state, ParserAction.CLEAR, ParserState.CSI_ENTRY); // CSI\n table.add(0x90, state, ParserAction.CLEAR, ParserState.DCS_ENTRY); // DCS\n }\n // rules for executables and 7f\n table.addMany(EXECUTABLES, ParserState.GROUND, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(EXECUTABLES, ParserState.ESCAPE, ParserAction.EXECUTE, ParserState.ESCAPE);\n table.add(0x7f, ParserState.ESCAPE, ParserAction.IGNORE, ParserState.ESCAPE);\n table.addMany(EXECUTABLES, ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n table.addMany(EXECUTABLES, ParserState.CSI_ENTRY, ParserAction.EXECUTE, ParserState.CSI_ENTRY);\n table.add(0x7f, ParserState.CSI_ENTRY, ParserAction.IGNORE, ParserState.CSI_ENTRY);\n table.addMany(EXECUTABLES, ParserState.CSI_PARAM, ParserAction.EXECUTE, ParserState.CSI_PARAM);\n table.add(0x7f, ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_PARAM);\n table.addMany(EXECUTABLES, ParserState.CSI_IGNORE, ParserAction.EXECUTE, ParserState.CSI_IGNORE);\n table.addMany(EXECUTABLES, ParserState.CSI_INTERMEDIATE, ParserAction.EXECUTE, ParserState.CSI_INTERMEDIATE);\n table.add(0x7f, ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.ESCAPE_INTERMEDIATE, ParserAction.EXECUTE, ParserState.ESCAPE_INTERMEDIATE);\n table.add(0x7f, ParserState.ESCAPE_INTERMEDIATE, ParserAction.IGNORE, ParserState.ESCAPE_INTERMEDIATE);\n // osc\n table.add(0x5d, ParserState.ESCAPE, ParserAction.OSC_START, ParserState.OSC_STRING);\n table.addMany(PRINTABLES, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(0x7f, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.addMany([0x9c, 0x1b, 0x18, 0x1a, 0x07], ParserState.OSC_STRING, ParserAction.OSC_END, ParserState.GROUND);\n table.addMany(r(0x1c, 0x20), ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n // sos/pm/apc does nothing\n table.addMany([0x58, 0x5e, 0x5f], ParserState.ESCAPE, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.addMany(PRINTABLES, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.addMany(EXECUTABLES, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.add(0x9c, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.GROUND);\n table.add(0x7f, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n // csi entries\n table.add(0x5b, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.CSI_ENTRY);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_ENTRY, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_ENTRY, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_PARAM, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_PARAM, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x20, 0x40), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(0x7f, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.CSI_INTERMEDIATE, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_INTERMEDIATE, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_PARAM, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n // esc_intermediate\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE_INTERMEDIATE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x30, 0x7f), ParserState.ESCAPE_INTERMEDIATE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x50), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x51, 0x58), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany([0x59, 0x5a, 0x5c], ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x60, 0x7f), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n // dcs entry\n table.add(0x50, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.DCS_ENTRY);\n table.addMany(EXECUTABLES, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.add(0x7f, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x20, 0x30), ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_ENTRY, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_PARAM);\n table.addMany(EXECUTABLES, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x80), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(EXECUTABLES, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.add(0x7f, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_PARAM, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_PARAM, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.add(0x7f, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_INTERMEDIATE, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_INTERMEDIATE, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_PARAM, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_ENTRY, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(EXECUTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.addMany(PRINTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.add(0x7f, ParserState.DCS_PASSTHROUGH, ParserAction.IGNORE, ParserState.DCS_PASSTHROUGH);\n table.addMany([0x1b, 0x9c, 0x18, 0x1a], ParserState.DCS_PASSTHROUGH, ParserAction.DCS_UNHOOK, ParserState.GROUND);\n // special handling of unicode chars\n table.add(NON_ASCII_PRINTABLE, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n table.add(NON_ASCII_PRINTABLE, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(NON_ASCII_PRINTABLE, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n return table;\n})();\n\n\n/**\n * EscapeSequenceParser.\n * This class implements the ANSI/DEC compatible parser described by\n * Paul Williams (https://vt100.net/emu/dec_ansi_parser).\n *\n * To implement custom ANSI compliant escape sequences it is not needed to\n * alter this parser, instead consider registering a custom handler.\n * For non ANSI compliant sequences change the transition table with\n * the optional `transitions` constructor argument and\n * reimplement the `parse` method.\n *\n * This parser is currently hardcoded to operate in ZDM (Zero Default Mode)\n * as suggested by the original parser, thus empty parameters are set to 0.\n * This this is not in line with the latest ECMA-48 specification\n * (ZDM was part of the early specs and got completely removed later on).\n *\n * Other than the original parser from vt100.net this parser supports\n * sub parameters in digital parameters separated by colons. Empty sub parameters\n * are set to -1 (no ZDM for sub parameters).\n *\n * About prefix and intermediate bytes:\n * This parser follows the assumptions of the vt100.net parser with these restrictions:\n * - only one prefix byte is allowed as first parameter byte, byte range 0x3c .. 0x3f\n * - max. two intermediates are respected, byte range 0x20 .. 0x2f\n * Note that this is not in line with ECMA-48 which does not limit either of those.\n * Furthermore ECMA-48 allows the prefix byte range at any param byte position. Currently\n * there are no known sequences that follow the broader definition of the specification.\n *\n * TODO: implement error recovery hook via error handler return values\n */\nexport class EscapeSequenceParser extends Disposable implements IEscapeSequenceParser {\n public initialState: number;\n public currentState: number;\n public precedingCodepoint: number;\n\n // buffers over several parse calls\n protected _params: Params;\n protected _collect: number;\n\n // handler lookup containers\n protected _printHandler: PrintHandlerType;\n protected _executeHandlers: {[flag: number]: ExecuteHandlerType};\n protected _csiHandlers: IHandlerCollection;\n protected _escHandlers: IHandlerCollection;\n protected _oscParser: IOscParser;\n protected _dcsParser: IDcsParser;\n protected _errorHandler: (state: IParsingState) => IParsingState;\n\n // fallback handlers\n protected _printHandlerFb: PrintFallbackHandlerType;\n protected _executeHandlerFb: ExecuteFallbackHandlerType;\n protected _csiHandlerFb: CsiFallbackHandlerType;\n protected _escHandlerFb: EscFallbackHandlerType;\n protected _errorHandlerFb: (state: IParsingState) => IParsingState;\n\n constructor(\n protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE\n ) {\n super();\n\n this.initialState = ParserState.GROUND;\n this.currentState = this.initialState;\n this._params = new Params(); // defaults to 32 storable params/subparams\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingCodepoint = 0;\n\n // set default fallback handlers and handler lookup containers\n this._printHandlerFb = (data, start, end): void => { };\n this._executeHandlerFb = (code: number): void => { };\n this._csiHandlerFb = (ident: number, params: IParams): void => { };\n this._escHandlerFb = (ident: number): void => { };\n this._errorHandlerFb = (state: IParsingState): IParsingState => state;\n this._printHandler = this._printHandlerFb;\n this._executeHandlers = Object.create(null);\n this._csiHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n this._oscParser = new OscParser();\n this._dcsParser = new DcsParser();\n this._errorHandler = this._errorHandlerFb;\n\n // swallow 7bit ST (ESC+\\)\n this.registerEscHandler({final: '\\\\'}, () => true);\n }\n\n protected _identifier(id: IFunctionIdentifier, finalRange: number[] = [0x40, 0x7e]): number {\n let res = 0;\n if (id.prefix) {\n if (id.prefix.length > 1) {\n throw new Error('only one byte as prefix supported');\n }\n res = id.prefix.charCodeAt(0);\n if (res && 0x3c > res || res > 0x3f) {\n throw new Error('prefix must be in range 0x3c .. 0x3f');\n }\n }\n if (id.intermediates) {\n if (id.intermediates.length > 2) {\n throw new Error('only two bytes as intermediates are supported');\n }\n for (let i = 0; i < id.intermediates.length; ++i) {\n const intermediate = id.intermediates.charCodeAt(i);\n if (0x20 > intermediate || intermediate > 0x2f) {\n throw new Error('intermediate must be in range 0x20 .. 0x2f');\n }\n res <<= 8;\n res |= intermediate;\n }\n }\n if (id.final.length !== 1) {\n throw new Error('final must be a single byte');\n }\n const finalCode = id.final.charCodeAt(0);\n if (finalRange[0] > finalCode || finalCode > finalRange[1]) {\n throw new Error(`final must be in range ${finalRange[0]} .. ${finalRange[1]}`);\n }\n res <<= 8;\n res |= finalCode;\n\n return res;\n }\n\n public identToString(ident: number): string {\n const res: string[] = [];\n while (ident) {\n res.push(String.fromCharCode(ident & 0xFF));\n ident >>= 8;\n }\n return res.reverse().join('');\n }\n\n public dispose(): void {\n this._csiHandlers = Object.create(null);\n this._executeHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n this._oscParser.dispose();\n this._dcsParser.dispose();\n }\n\n public setPrintHandler(handler: PrintHandlerType): void {\n this._printHandler = handler;\n }\n public clearPrintHandler(): void {\n this._printHandler = this._printHandlerFb;\n }\n\n public registerEscHandler(id: IFunctionIdentifier, handler: EscHandlerType): IDisposable {\n const ident = this._identifier(id, [0x30, 0x7e]);\n if (this._escHandlers[ident] === undefined) {\n this._escHandlers[ident] = [];\n }\n const handlerList = this._escHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearEscHandler(id: IFunctionIdentifier): void {\n if (this._escHandlers[this._identifier(id, [0x30, 0x7e])]) delete this._escHandlers[this._identifier(id, [0x30, 0x7e])];\n }\n public setEscHandlerFallback(handler: EscFallbackHandlerType): void {\n this._escHandlerFb = handler;\n }\n\n public setExecuteHandler(flag: string, handler: ExecuteHandlerType): void {\n this._executeHandlers[flag.charCodeAt(0)] = handler;\n }\n public clearExecuteHandler(flag: string): void {\n if (this._executeHandlers[flag.charCodeAt(0)]) delete this._executeHandlers[flag.charCodeAt(0)];\n }\n public setExecuteHandlerFallback(handler: ExecuteFallbackHandlerType): void {\n this._executeHandlerFb = handler;\n }\n\n public registerCsiHandler(id: IFunctionIdentifier, handler: CsiHandlerType): IDisposable {\n const ident = this._identifier(id);\n if (this._csiHandlers[ident] === undefined) {\n this._csiHandlers[ident] = [];\n }\n const handlerList = this._csiHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearCsiHandler(id: IFunctionIdentifier): void {\n if (this._csiHandlers[this._identifier(id)]) delete this._csiHandlers[this._identifier(id)];\n }\n public setCsiHandlerFallback(callback: (ident: number, params: IParams) => void): void {\n this._csiHandlerFb = callback;\n }\n\n public registerDcsHandler(id: IFunctionIdentifier, handler: IDcsHandler): IDisposable {\n return this._dcsParser.registerHandler(this._identifier(id), handler);\n }\n public clearDcsHandler(id: IFunctionIdentifier): void {\n this._dcsParser.clearHandler(this._identifier(id));\n }\n public setDcsHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._dcsParser.setHandlerFallback(handler);\n }\n\n public registerOscHandler(ident: number, handler: IOscHandler): IDisposable {\n return this._oscParser.registerHandler(ident, handler);\n }\n public clearOscHandler(ident: number): void {\n this._oscParser.clearHandler(ident);\n }\n public setOscHandlerFallback(handler: OscFallbackHandlerType): void {\n this._oscParser.setHandlerFallback(handler);\n }\n\n public setErrorHandler(callback: (state: IParsingState) => IParsingState): void {\n this._errorHandler = callback;\n }\n public clearErrorHandler(): void {\n this._errorHandler = this._errorHandlerFb;\n }\n\n public reset(): void {\n this.currentState = this.initialState;\n this._oscParser.reset();\n this._dcsParser.reset();\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingCodepoint = 0;\n }\n\n\n\n /**\n * Parse UTF32 codepoints in `data` up to `length`.\n *\n * Note: For several actions with high data load the parsing is optimized\n * by using local read ahead loops with hardcoded conditions to\n * avoid costly table lookups. Make sure that any change of table values\n * will be reflected in the loop conditions as well and vice versa.\n * Affected states/actions:\n * - GROUND:PRINT\n * - CSI_PARAM:PARAM\n * - DCS_PARAM:PARAM\n * - OSC_STRING:OSC_PUT\n * - DCS_PASSTHROUGH:DCS_PUT\n */\n public parse(data: Uint32Array, length: number): void {\n let code = 0;\n let transition = 0;\n let currentState = this.currentState;\n const osc = this._oscParser;\n const dcs = this._dcsParser;\n let collect = this._collect;\n const params = this._params;\n const table: Uint8Array = this._transitions.table;\n\n // process input string\n for (let i = 0; i < length; ++i) {\n code = data[i];\n\n // normal transition & action lookup\n transition = table[currentState << TableAccess.INDEX_STATE_SHIFT | (code < 0xa0 ? code : NON_ASCII_PRINTABLE)];\n switch (transition >> TableAccess.TRANSITION_ACTION_SHIFT) {\n case ParserAction.PRINT:\n // read ahead with loop unrolling\n // Note: 0x20 (SP) is included, 0x7F (DEL) is excluded\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.EXECUTE:\n if (this._executeHandlers[code]) this._executeHandlers[code]();\n else this._executeHandlerFb(code);\n this.precedingCodepoint = 0;\n break;\n case ParserAction.IGNORE:\n break;\n case ParserAction.ERROR:\n const inject: IParsingState = this._errorHandler(\n {\n position: i,\n code,\n currentState,\n collect,\n params,\n abort: false\n });\n if (inject.abort) return;\n // inject values: currently not implemented\n break;\n case ParserAction.CSI_DISPATCH:\n // Trigger CSI Handler\n const handlers = this._csiHandlers[collect << 8 | code];\n let j = handlers ? handlers.length - 1 : -1;\n for (; j >= 0; j--) {\n // true means success and to stop bubbling\n if (handlers[j](params)) {\n break;\n }\n }\n if (j < 0) {\n this._csiHandlerFb(collect << 8 | code, params);\n }\n this.precedingCodepoint = 0;\n break;\n case ParserAction.PARAM:\n // inner loop: digits (0x30 - 0x39) and ; (0x3b) and : (0x3a)\n do {\n switch (code) {\n case 0x3b:\n params.addParam(0); // ZDM\n break;\n case 0x3a:\n params.addSubParam(-1);\n break;\n default: // 0x30 - 0x39\n params.addDigit(code - 48);\n }\n } while (++i < length && (code = data[i]) > 0x2f && code < 0x3c);\n i--;\n break;\n case ParserAction.COLLECT:\n collect <<= 8;\n collect |= code;\n break;\n case ParserAction.ESC_DISPATCH:\n const handlersEsc = this._escHandlers[collect << 8 | code];\n let jj = handlersEsc ? handlersEsc.length - 1 : -1;\n for (; jj >= 0; jj--) {\n // true means success and to stop bubbling\n if (handlersEsc[jj]()) {\n break;\n }\n }\n if (jj < 0) {\n this._escHandlerFb(collect << 8 | code);\n }\n this.precedingCodepoint = 0;\n break;\n case ParserAction.CLEAR:\n params.reset();\n params.addParam(0); // ZDM\n collect = 0;\n break;\n case ParserAction.DCS_HOOK:\n dcs.hook(collect << 8 | code, params);\n break;\n case ParserAction.DCS_PUT:\n // inner loop - exit DCS_PUT: 0x18, 0x1a, 0x1b, 0x7f, 0x80 - 0x9f\n // unhook triggered by: 0x1b, 0x9c (success) and 0x18, 0x1a (abort)\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n dcs.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.DCS_UNHOOK:\n dcs.unhook(code !== 0x18 && code !== 0x1a);\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n params.reset();\n params.addParam(0); // ZDM\n collect = 0;\n this.precedingCodepoint = 0;\n break;\n case ParserAction.OSC_START:\n osc.start();\n break;\n case ParserAction.OSC_PUT:\n // inner loop: 0x20 (SP) included, 0x7F (DEL) included\n for (let j = i + 1; ; j++) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n osc.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.OSC_END:\n osc.end(code !== 0x18 && code !== 0x1a);\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n params.reset();\n params.addParam(0); // ZDM\n collect = 0;\n this.precedingCodepoint = 0;\n break;\n }\n currentState = transition & TableAccess.TRANSITION_STATE_MASK;\n }\n\n // save collected intermediates\n this._collect = collect;\n\n // save state\n this.currentState = currentState;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser } from 'common/parser/Types';\nimport { OscState, PAYLOAD_LIMIT } from 'common/parser/Constants';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { IDisposable } from 'common/Types';\n\nconst EMPTY_HANDLERS: IOscHandler[] = [];\n\nexport class OscParser implements IOscParser {\n private _state = OscState.START;\n private _active = EMPTY_HANDLERS;\n private _id = -1;\n private _handlers: IHandlerCollection = Object.create(null);\n private _handlerFb: OscFallbackHandlerType = () => { };\n\n public registerHandler(ident: number, handler: IOscHandler): IDisposable {\n if (this._handlers[ident] === undefined) {\n this._handlers[ident] = [];\n }\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n public setHandlerFallback(handler: OscFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => {};\n this._active = EMPTY_HANDLERS;\n }\n\n public reset(): void {\n // cleanup handlers if payload was already sent\n if (this._state === OscState.PAYLOAD) {\n this.end(false);\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n\n private _start(): void {\n this._active = this._handlers[this._id] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._id, 'START');\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].start();\n }\n }\n }\n\n private _put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._id, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n private _end(success: boolean): void {\n // other than the old code we always have to call .end\n // to keep the bubbling we use `success` to indicate\n // whether a handler should execute\n if (!this._active.length) {\n this._handlerFb(this._id, 'END', success);\n } else {\n let j = this._active.length - 1;\n for (; j >= 0; j--) {\n if (this._active[j].end(success)) {\n break;\n }\n }\n j--;\n // cleanup left over handlers\n for (; j >= 0; j--) {\n this._active[j].end(false);\n }\n }\n }\n\n public start(): void {\n // always reset leftover handlers\n this.reset();\n this._state = OscState.ID;\n }\n\n /**\n * Put data to current OSC command.\n * Expects the identifier of the OSC command in the form\n * OSC id ; payload ST/BEL\n * Payload chunks are not further processed and get\n * directly passed to the handlers.\n */\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._state === OscState.ABORT) {\n return;\n }\n if (this._state === OscState.ID) {\n while (start < end) {\n const code = data[start++];\n if (code === 0x3b) {\n this._state = OscState.PAYLOAD;\n this._start();\n break;\n }\n if (code < 0x30 || 0x39 < code) {\n this._state = OscState.ABORT;\n return;\n }\n if (this._id === -1) {\n this._id = 0;\n }\n this._id = this._id * 10 + code - 48;\n }\n }\n if (this._state === OscState.PAYLOAD && end - start > 0) {\n this._put(data, start, end);\n }\n }\n\n /**\n * Indicates end of an OSC command.\n * Whether the OSC got aborted or finished normally\n * is indicated by `success`.\n */\n public end(success: boolean): void {\n if (this._state === OscState.START) {\n return;\n }\n // do nothing if command was faulty\n if (this._state !== OscState.ABORT) {\n // if we are still in ID state and get an early end\n // means that the command has no payload thus we still have\n // to announce START and send END right after\n if (this._state === OscState.ID) {\n this._start();\n }\n this._end(success);\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n}\n\n/**\n * Convenient class to allow attaching string based handler functions\n * as OSC handlers.\n */\nexport class OscHandler implements IOscHandler {\n private _data = '';\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string) => boolean) {}\n\n public start(): void {\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > PAYLOAD_LIMIT) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public end(success: boolean): boolean {\n let ret = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data);\n }\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IParams, ParamsArray } from 'common/parser/Types';\n\n// max value supported for a single param/subparam (clamped to positive int32 range)\nconst MAX_VALUE = 0x7FFFFFFF;\n// max allowed subparams for a single sequence (hardcoded limitation)\nconst MAX_SUBPARAMS = 256;\n\n/**\n * Params storage class.\n * This type is used by the parser to accumulate sequence parameters and sub parameters\n * and transmit them to the input handler actions.\n *\n * NOTES:\n * - params object for action handlers is borrowed, use `.toArray` or `.clone` to get a copy\n * - never read beyond `params.length - 1` (likely to contain arbitrary data)\n * - `.getSubParams` returns a borrowed typed array, use `.getSubParamsAll` for cloned sub params\n * - hardcoded limitations:\n * - max. value for a single (sub) param is 2^31 - 1 (greater values are clamped to that)\n * - max. 256 sub params possible\n * - negative values are not allowed beside -1 (placeholder for default value)\n *\n * About ZDM (Zero Default Mode):\n * ZDM is not orchestrated by this class. If the parser is in ZDM,\n * it should add 0 for empty params, otherwise -1. This does not apply\n * to subparams, empty subparams should always be added with -1.\n */\nexport class Params implements IParams {\n // params store and length\n public params: Int32Array;\n public length: number;\n\n // sub params store and length\n protected _subParams: Int32Array;\n protected _subParamsLength: number;\n\n // sub params offsets from param: param idx --> [start, end] offset\n private _subParamsIdx: Uint16Array;\n private _rejectDigits: boolean;\n private _rejectSubDigits: boolean;\n private _digitIsSub: boolean;\n\n /**\n * Create a `Params` type from JS array representation.\n */\n public static fromArray(values: ParamsArray): Params {\n const params = new Params();\n if (!values.length) {\n return params;\n }\n // skip leading sub params\n for (let i = (values[0] instanceof Array) ? 1 : 0; i < values.length; ++i) {\n const value = values[i];\n if (value instanceof Array) {\n for (let k = 0; k < value.length; ++k) {\n params.addSubParam(value[k]);\n }\n } else {\n params.addParam(value);\n }\n }\n return params;\n }\n\n /**\n * @param maxLength max length of storable parameters\n * @param maxSubParamsLength max length of storable sub parameters\n */\n constructor(public maxLength: number = 32, public maxSubParamsLength: number = 32) {\n if (maxSubParamsLength > MAX_SUBPARAMS) {\n throw new Error('maxSubParamsLength must not be greater than 256');\n }\n this.params = new Int32Array(maxLength);\n this.length = 0;\n this._subParams = new Int32Array(maxSubParamsLength);\n this._subParamsLength = 0;\n this._subParamsIdx = new Uint16Array(maxLength);\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Clone object.\n */\n public clone(): Params {\n const newParams = new Params(this.maxLength, this.maxSubParamsLength);\n newParams.params.set(this.params);\n newParams.length = this.length;\n newParams._subParams.set(this._subParams);\n newParams._subParamsLength = this._subParamsLength;\n newParams._subParamsIdx.set(this._subParamsIdx);\n newParams._rejectDigits = this._rejectDigits;\n newParams._rejectSubDigits = this._rejectSubDigits;\n newParams._digitIsSub = this._digitIsSub;\n return newParams;\n }\n\n /**\n * Get a JS array representation of the current parameters and sub parameters.\n * The array is structured as follows:\n * sequence: \"1;2:3:4;5::6\"\n * array : [1, 2, [3, 4], 5, [-1, 6]]\n */\n public toArray(): ParamsArray {\n const res: ParamsArray = [];\n for (let i = 0; i < this.length; ++i) {\n res.push(this.params[i]);\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n res.push(Array.prototype.slice.call(this._subParams, start, end));\n }\n }\n return res;\n }\n\n /**\n * Reset to initial empty state.\n */\n public reset(): void {\n this.length = 0;\n this._subParamsLength = 0;\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Add a parameter value.\n * `Params` only stores up to `maxLength` parameters, any later\n * parameter will be ignored.\n * Note: VT devices only stored up to 16 values, xterm seems to\n * store up to 30.\n */\n public addParam(value: number): void {\n this._digitIsSub = false;\n if (this.length >= this.maxLength) {\n this._rejectDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength;\n this.params[this.length++] = value > MAX_VALUE ? MAX_VALUE : value;\n }\n\n /**\n * Add a sub parameter value.\n * The sub parameter is automatically associated with the last parameter value.\n * Thus it is not possible to add a subparameter without any parameter added yet.\n * `Params` only stores up to `subParamsLength` sub parameters, any later\n * sub parameter will be ignored.\n */\n public addSubParam(value: number): void {\n this._digitIsSub = true;\n if (!this.length) {\n return;\n }\n if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength) {\n this._rejectSubDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParams[this._subParamsLength++] = value > MAX_VALUE ? MAX_VALUE : value;\n this._subParamsIdx[this.length - 1]++;\n }\n\n /**\n * Whether parameter at index `idx` has sub parameters.\n */\n public hasSubParams(idx: number): boolean {\n return ((this._subParamsIdx[idx] & 0xFF) - (this._subParamsIdx[idx] >> 8) > 0);\n }\n\n /**\n * Return sub parameters for parameter at index `idx`.\n * Note: The values are borrowed, thus you need to copy\n * the values if you need to hold them in nonlocal scope.\n */\n public getSubParams(idx: number): Int32Array | null {\n const start = this._subParamsIdx[idx] >> 8;\n const end = this._subParamsIdx[idx] & 0xFF;\n if (end - start > 0) {\n return this._subParams.subarray(start, end);\n }\n return null;\n }\n\n /**\n * Return all sub parameters as {idx: subparams} mapping.\n * Note: The values are not borrowed.\n */\n public getSubParamsAll(): {[idx: number]: Int32Array} {\n const result: {[idx: number]: Int32Array} = {};\n for (let i = 0; i < this.length; ++i) {\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n result[i] = this._subParams.slice(start, end);\n }\n }\n return result;\n }\n\n /**\n * Add a single digit value to current parameter.\n * This is used by the parser to account digits on a char by char basis.\n */\n public addDigit(value: number): void {\n let length;\n if (this._rejectDigits\n || !(length = this._digitIsSub ? this._subParamsLength : this.length)\n || (this._digitIsSub && this._rejectSubDigits)\n ) {\n return;\n }\n\n const store = this._digitIsSub ? this._subParams : this.params;\n const cur = store[length - 1];\n store[length - 1] = ~cur ? Math.min(cur * 10 + value, MAX_VALUE) : value;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { BufferSet } from 'common/buffer/BufferSet';\nimport { IBufferSet, IBuffer } from 'common/buffer/Types';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\n\nexport const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars\nexport const MINIMUM_ROWS = 1;\n\nexport class BufferService extends Disposable implements IBufferService {\n public serviceBrand: any;\n\n public cols: number;\n public rows: number;\n public buffers: IBufferSet;\n /** Whether the user is scrolling (locks the scroll position) */\n public isUserScrolling: boolean = false;\n\n private _onResize = new EventEmitter<{ cols: number, rows: number }>();\n public get onResize(): IEvent<{ cols: number, rows: number }> { return this._onResize.event; }\n\n public get buffer(): IBuffer { return this.buffers.active; }\n\n constructor(\n @IOptionsService private _optionsService: IOptionsService\n ) {\n super();\n this.cols = Math.max(_optionsService.options.cols, MINIMUM_COLS);\n this.rows = Math.max(_optionsService.options.rows, MINIMUM_ROWS);\n this.buffers = new BufferSet(_optionsService, this);\n }\n\n public dispose(): void {\n super.dispose();\n this.buffers.dispose();\n }\n\n public resize(cols: number, rows: number): void {\n this.cols = cols;\n this.rows = rows;\n this.buffers.resize(cols, rows);\n this.buffers.setupTabStops(this.cols);\n this._onResize.fire({ cols, rows });\n }\n\n public reset(): void {\n this.buffers.reset();\n this.isUserScrolling = false;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharsetService } from 'common/services/Services';\nimport { ICharset } from 'common/Types';\n\nexport class CharsetService implements ICharsetService {\n public serviceBrand: any;\n\n public charset: ICharset | undefined;\n public glevel: number = 0;\n\n private _charsets: (ICharset | undefined)[] = [];\n\n public reset(): void {\n this.charset = undefined;\n this._charsets = [];\n this.glevel = 0;\n }\n\n public setgLevel(g: number): void {\n this.glevel = g;\n this.charset = this._charsets[g];\n }\n\n public setgCharset(g: number, charset: ICharset | undefined): void {\n this._charsets[g] = charset;\n if (this.glevel === g) {\n this.charset = charset;\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, ICoreService, ICoreMouseService } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';\n\n/**\n * Supported default protocols.\n */\nconst DEFAULT_PROTOCOLS: {[key: string]: ICoreMouseProtocol} = {\n /**\n * NONE\n * Events: none\n * Modifiers: none\n */\n NONE: {\n events: CoreMouseEventType.NONE,\n restrict: () => false\n },\n /**\n * X10\n * Events: mousedown\n * Modifiers: none\n */\n X10: {\n events: CoreMouseEventType.DOWN,\n restrict: (e: ICoreMouseEvent) => {\n // no wheel, no move, no up\n if (e.button === CoreMouseButton.WHEEL || e.action !== CoreMouseAction.DOWN) {\n return false;\n }\n // no modifiers\n e.ctrl = false;\n e.alt = false;\n e.shift = false;\n return true;\n }\n },\n /**\n * VT200\n * Events: mousedown / mouseup / wheel\n * Modifiers: all\n */\n VT200: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL,\n restrict: (e: ICoreMouseEvent) => {\n // no move\n if (e.action === CoreMouseAction.MOVE) {\n return false;\n }\n return true;\n }\n },\n /**\n * DRAG\n * Events: mousedown / mouseup / wheel / mousedrag\n * Modifiers: all\n */\n DRAG: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL | CoreMouseEventType.DRAG,\n restrict: (e: ICoreMouseEvent) => {\n // no move without button\n if (e.action === CoreMouseAction.MOVE && e.button === CoreMouseButton.NONE) {\n return false;\n }\n return true;\n }\n },\n /**\n * ANY\n * Events: all mouse related events\n * Modifiers: all\n */\n ANY: {\n events:\n CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL\n | CoreMouseEventType.DRAG | CoreMouseEventType.MOVE,\n restrict: (e: ICoreMouseEvent) => true\n }\n};\n\nconst enum Modifiers {\n SHIFT = 4,\n ALT = 8,\n CTRL = 16\n}\n\n// helper for default encoders to generate the event code.\nfunction eventCode(e: ICoreMouseEvent, isSGR: boolean): number {\n let code = (e.ctrl ? Modifiers.CTRL : 0) | (e.shift ? Modifiers.SHIFT : 0) | (e.alt ? Modifiers.ALT : 0);\n if (e.button === CoreMouseButton.WHEEL) {\n code |= 64;\n code |= e.action;\n } else {\n code |= e.button & 3;\n if (e.button & 4) {\n code |= 64;\n }\n if (e.button & 8) {\n code |= 128;\n }\n if (e.action === CoreMouseAction.MOVE) {\n code |= CoreMouseAction.MOVE;\n } else if (e.action === CoreMouseAction.UP && !isSGR) {\n // special case - only SGR can report button on release\n // all others have to go with NONE\n code |= CoreMouseButton.NONE;\n }\n }\n return code;\n}\n\nconst S = String.fromCharCode;\n\n/**\n * Supported default encodings.\n */\nconst DEFAULT_ENCODINGS: {[key: string]: CoreMouseEncoding} = {\n /**\n * DEFAULT - CSI M Pb Px Py\n * Single byte encoding for coords and event code.\n * Can encode values up to 223 (1-based).\n */\n DEFAULT: (e: ICoreMouseEvent) => {\n const params = [eventCode(e, false) + 32, e.col + 32, e.row + 32];\n // supress mouse report if we exceed addressible range\n // Note this is handled differently by emulators\n // - xterm: sends 0;0 coords instead\n // - vte, konsole: no report\n if (params[0] > 255 || params[1] > 255 || params[2] > 255) {\n return '';\n }\n return `\\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`;\n },\n /**\n * SGR - CSI < Pb ; Px ; Py M|m\n * No encoding limitation.\n * Can report button on release and works with a well formed sequence.\n */\n SGR: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.col};${e.row}${final}`;\n }\n};\n\n/**\n * CoreMouseService\n *\n * Provides mouse tracking reports with different protocols and encodings.\n * - protocols: NONE (default), X10, VT200, DRAG, ANY\n * - encodings: DEFAULT, SGR (UTF8, URXVT removed in #2507)\n *\n * Custom protocols/encodings can be added by `addProtocol` / `addEncoding`.\n * To activate a protocol/encoding, set `activeProtocol` / `activeEncoding`.\n * Switching a protocol will send a notification event `onProtocolChange`\n * with a list of needed events to track.\n *\n * The service handles the mouse tracking state and decides whether to send\n * a tracking report to the backend based on protocol and encoding limitations.\n * To send a mouse event call `triggerMouseEvent`.\n */\nexport class CoreMouseService implements ICoreMouseService {\n private _protocols: {[name: string]: ICoreMouseProtocol} = {};\n private _encodings: {[name: string]: CoreMouseEncoding} = {};\n private _activeProtocol: string = '';\n private _activeEncoding: string = '';\n private _onProtocolChange = new EventEmitter();\n private _lastEvent: ICoreMouseEvent | null = null;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService\n ) {\n // register default protocols and encodings\n for (const name of Object.keys(DEFAULT_PROTOCOLS)) this.addProtocol(name, DEFAULT_PROTOCOLS[name]);\n for (const name of Object.keys(DEFAULT_ENCODINGS)) this.addEncoding(name, DEFAULT_ENCODINGS[name]);\n // call reset to set defaults\n this.reset();\n }\n\n public addProtocol(name: string, protocol: ICoreMouseProtocol): void {\n this._protocols[name] = protocol;\n }\n\n public addEncoding(name: string, encoding: CoreMouseEncoding): void {\n this._encodings[name] = encoding;\n }\n\n public get activeProtocol(): string {\n return this._activeProtocol;\n }\n\n public get areMouseEventsActive(): boolean {\n return this._protocols[this._activeProtocol].events !== 0;\n }\n\n public set activeProtocol(name: string) {\n if (!this._protocols[name]) {\n throw new Error(`unknown protocol \"${name}\"`);\n }\n this._activeProtocol = name;\n this._onProtocolChange.fire(this._protocols[name].events);\n }\n\n public get activeEncoding(): string {\n return this._activeEncoding;\n }\n\n public set activeEncoding(name: string) {\n if (!this._encodings[name]) {\n throw new Error(`unknown encoding \"${name}\"`);\n }\n this._activeEncoding = name;\n }\n\n public reset(): void {\n this.activeProtocol = 'NONE';\n this.activeEncoding = 'DEFAULT';\n this._lastEvent = null;\n }\n\n /**\n * Event to announce changes in mouse tracking.\n */\n public get onProtocolChange(): IEvent {\n return this._onProtocolChange.event;\n }\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n public triggerMouseEvent(e: ICoreMouseEvent): boolean {\n // range check for col/row\n if (e.col < 0 || e.col >= this._bufferService.cols\n || e.row < 0 || e.row >= this._bufferService.rows) {\n return false;\n }\n\n // filter nonsense combinations of button + action\n if (e.button === CoreMouseButton.WHEEL && e.action === CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button === CoreMouseButton.NONE && e.action !== CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button !== CoreMouseButton.WHEEL && (e.action === CoreMouseAction.LEFT || e.action === CoreMouseAction.RIGHT)) {\n return false;\n }\n\n // report 1-based coords\n e.col++;\n e.row++;\n\n // debounce move at grid level\n if (e.action === CoreMouseAction.MOVE && this._lastEvent && this._compareEvents(this._lastEvent, e)) {\n return false;\n }\n\n // apply protocol restrictions\n if (!this._protocols[this._activeProtocol].restrict(e)) {\n return false;\n }\n\n // encode report and send\n const report = this._encodings[this._activeEncoding](e);\n if (report) {\n // always send DEFAULT as binary data\n if (this._activeEncoding === 'DEFAULT') {\n this._coreService.triggerBinaryEvent(report);\n } else {\n this._coreService.triggerDataEvent(report, true);\n }\n }\n\n this._lastEvent = e;\n\n return true;\n }\n\n public explainEvents(events: CoreMouseEventType): {[event: string]: boolean} {\n return {\n down: !!(events & CoreMouseEventType.DOWN),\n up: !!(events & CoreMouseEventType.UP),\n drag: !!(events & CoreMouseEventType.DRAG),\n move: !!(events & CoreMouseEventType.MOVE),\n wheel: !!(events & CoreMouseEventType.WHEEL)\n };\n }\n\n private _compareEvents(e1: ICoreMouseEvent, e2: ICoreMouseEvent): boolean {\n if (e1.col !== e2.col) return false;\n if (e1.row !== e2.row) return false;\n if (e1.button !== e2.button) return false;\n if (e1.action !== e2.action) return false;\n if (e1.ctrl !== e2.ctrl) return false;\n if (e1.alt !== e2.alt) return false;\n if (e1.shift !== e2.shift) return false;\n return true;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreService, ILogService, IOptionsService, IBufferService } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { IDecPrivateModes, IModes } from 'common/Types';\nimport { clone } from 'common/Clone';\nimport { Disposable } from 'common/Lifecycle';\n\nconst DEFAULT_MODES: IModes = Object.freeze({\n insertMode: false\n});\n\nconst DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({\n applicationCursorKeys: false,\n applicationKeypad: false,\n bracketedPasteMode: false,\n origin: false,\n reverseWraparound: false,\n sendFocus: false,\n wraparound: true // defaults: xterm - true, vt100 - false\n});\n\nexport class CoreService extends Disposable implements ICoreService {\n public serviceBrand: any;\n\n public isCursorInitialized: boolean = false;\n public isCursorHidden: boolean = false;\n public modes: IModes;\n public decPrivateModes: IDecPrivateModes;\n\n // Circular dependency, this must be unset or memory will leak after Terminal.dispose\n private _scrollToBottom: (() => void) | undefined;\n\n private _onData = this.register(new EventEmitter());\n public get onData(): IEvent { return this._onData.event; }\n private _onUserInput = this.register(new EventEmitter());\n public get onUserInput(): IEvent { return this._onUserInput.event; }\n private _onBinary = this.register(new EventEmitter());\n public get onBinary(): IEvent { return this._onBinary.event; }\n\n constructor(\n // TODO: Move this into a service\n scrollToBottom: () => void,\n @IBufferService private readonly _bufferService: IBufferService,\n @ILogService private readonly _logService: ILogService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this._scrollToBottom = scrollToBottom;\n this.register({ dispose: () => this._scrollToBottom = undefined });\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n }\n\n public reset(): void {\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n }\n\n public triggerDataEvent(data: string, wasUserInput: boolean = false): void {\n // Prevents all events to pty process if stdin is disabled\n if (this._optionsService.options.disableStdin) {\n return;\n }\n\n // Input is being sent to the terminal, the terminal should focus the prompt.\n const buffer = this._bufferService.buffer;\n if (buffer.ybase !== buffer.ydisp) {\n this._scrollToBottom!();\n }\n\n // Fire onUserInput so listeners can react as well (eg. clear selection)\n if (wasUserInput) {\n this._onUserInput.fire();\n }\n\n // Fire onData API\n this._logService.debug(`sending data \"${data}\"`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onData.fire(data);\n }\n\n public triggerBinaryEvent(data: string): void {\n if (this._optionsService.options.disableStdin) {\n return;\n }\n this._logService.debug(`sending binary \"${data}\"`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onBinary.fire(data);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService, IDirtyRowService } from 'common/services/Services';\n\nexport class DirtyRowService implements IDirtyRowService {\n public serviceBrand: any;\n\n private _start!: number;\n private _end!: number;\n\n public get start(): number { return this._start; }\n public get end(): number { return this._end; }\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n this.clearRange();\n }\n\n public clearRange(): void {\n this._start = this._bufferService.buffer.y;\n this._end = this._bufferService.buffer.y;\n }\n\n public markDirty(y: number): void {\n if (y < this._start) {\n this._start = y;\n } else if (y > this._end) {\n this._end = y;\n }\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n if (y1 > y2) {\n const temp = y1;\n y1 = y2;\n y2 = temp;\n }\n if (y1 < this._start) {\n this._start = y1;\n }\n if (y2 > this._end) {\n this._end = y2;\n }\n }\n\n public markAllDirty(): void {\n this.markRangeDirty(0, this._bufferService.rows - 1);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInstantiationService, IServiceIdentifier } from 'common/services/Services';\nimport { getServiceDependencies } from 'common/services/ServiceRegistry';\n\nexport class ServiceCollection {\n\n private _entries = new Map, any>();\n\n constructor(...entries: [IServiceIdentifier, any][]) {\n for (const [id, service] of entries) {\n this.set(id, service);\n }\n }\n\n public set(id: IServiceIdentifier, instance: T): T {\n const result = this._entries.get(id);\n this._entries.set(id, instance);\n return result;\n }\n\n public forEach(callback: (id: IServiceIdentifier, instance: any) => any): void {\n this._entries.forEach((value, key) => callback(key, value));\n }\n\n public has(id: IServiceIdentifier): boolean {\n return this._entries.has(id);\n }\n\n public get(id: IServiceIdentifier): T | undefined {\n return this._entries.get(id);\n }\n}\n\nexport class InstantiationService implements IInstantiationService {\n private readonly _services: ServiceCollection = new ServiceCollection();\n\n constructor() {\n this._services.set(IInstantiationService, this);\n }\n\n public setService(id: IServiceIdentifier, instance: T): void {\n this._services.set(id, instance);\n }\n\n public getService(id: IServiceIdentifier): T | undefined {\n return this._services.get(id);\n }\n\n public createInstance(ctor: any, ...args: any[]): T {\n const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);\n\n const serviceArgs: any[] = [];\n for (const dependency of serviceDependencies) {\n const service = this._services.get(dependency.id);\n if (!service) {\n throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`);\n }\n serviceArgs.push(service);\n }\n\n const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;\n\n // check for argument mismatches, adjust static args if needed\n if (args.length !== firstServiceArgPos) {\n throw new Error(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);\n }\n\n // now create the instance\n return new ctor(...[...args, ...serviceArgs]);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ILogService, IOptionsService } from 'common/services/Services';\n\ntype LogType = (message?: any, ...optionalParams: any[]) => void;\n\ninterface IConsole {\n log: LogType;\n error: LogType;\n info: LogType;\n trace: LogType;\n warn: LogType;\n}\n\n// console is available on both node.js and browser contexts but the common\n// module doesn't depend on them so we need to explicitly declare it.\ndeclare const console: IConsole;\n\n\nexport enum LogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n OFF = 4\n}\n\nconst optionsKeyToLogLevel: { [key: string]: LogLevel } = {\n debug: LogLevel.DEBUG,\n info: LogLevel.INFO,\n warn: LogLevel.WARN,\n error: LogLevel.ERROR,\n off: LogLevel.OFF\n};\n\nconst LOG_PREFIX = 'xterm.js: ';\n\nexport class LogService implements ILogService {\n public serviceBrand: any;\n\n private _logLevel!: LogLevel;\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n this._updateLogLevel();\n this._optionsService.onOptionChange(key => {\n if (key === 'logLevel') {\n this._updateLogLevel();\n }\n });\n }\n\n private _updateLogLevel(): void {\n this._logLevel = optionsKeyToLogLevel[this._optionsService.options.logLevel];\n }\n\n private _evalLazyOptionalParams(optionalParams: any[]): void {\n for (let i = 0; i < optionalParams.length; i++) {\n if (typeof optionalParams[i] === 'function') {\n optionalParams[i] = optionalParams[i]();\n }\n }\n }\n\n private _log(type: LogType, message: string, optionalParams: any[]): void {\n this._evalLazyOptionalParams(optionalParams);\n type.call(console, LOG_PREFIX + message, ...optionalParams);\n }\n\n public debug(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevel.DEBUG) {\n this._log(console.log, message, optionalParams);\n }\n }\n\n public info(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevel.INFO) {\n this._log(console.info, message, optionalParams);\n }\n }\n\n public warn(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevel.WARN) {\n this._log(console.warn, message, optionalParams);\n }\n }\n\n public error(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevel.ERROR) {\n this._log(console.error, message, optionalParams);\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService, ITerminalOptions, IPartialTerminalOptions, FontWeight } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { isMac } from 'common/Platform';\nimport { clone } from 'common/Clone';\n\n// Source: https://freesound.org/people/altemark/sounds/45759/\n// This sound is released under the Creative Commons Attribution 3.0 Unported\n// (CC BY 3.0) license. It was created by 'altemark'. No modifications have been\n// made, apart from the conversion to base64.\nexport const DEFAULT_BELL_SOUND = 'data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq';\n\n// TODO: Freeze?\nexport const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({\n cols: 80,\n rows: 24,\n cursorBlink: false,\n cursorStyle: 'block',\n cursorWidth: 1,\n bellSound: DEFAULT_BELL_SOUND,\n bellStyle: 'none',\n drawBoldTextInBrightColors: true,\n fastScrollModifier: 'alt',\n fastScrollSensitivity: 5,\n fontFamily: 'courier-new, courier, monospace',\n fontSize: 15,\n fontWeight: 'normal',\n fontWeightBold: 'bold',\n lineHeight: 1.0,\n linkTooltipHoverDuration: 500,\n letterSpacing: 0,\n logLevel: 'info',\n scrollback: 1000,\n scrollSensitivity: 1,\n screenReaderMode: false,\n macOptionIsMeta: false,\n macOptionClickForcesSelection: false,\n minimumContrastRatio: 1,\n disableStdin: false,\n allowProposedApi: true,\n allowTransparency: false,\n tabStopWidth: 8,\n theme: {},\n rightClickSelectsWord: isMac,\n rendererType: 'canvas',\n windowOptions: {},\n windowsMode: false,\n wordSeparator: ' ()[]{}\\',\"`',\n altClickMovesCursor: true,\n convertEol: false,\n termName: 'xterm',\n cancelEvents: false\n});\n\nconst FONT_WEIGHT_OPTIONS: Extract[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\n\n/**\n * The set of options that only have an effect when set in the Terminal constructor.\n */\nconst CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows'];\n\nexport class OptionsService implements IOptionsService {\n public serviceBrand: any;\n\n public options: ITerminalOptions;\n\n private _onOptionChange = new EventEmitter();\n public get onOptionChange(): IEvent { return this._onOptionChange.event; }\n\n constructor(options: IPartialTerminalOptions) {\n this.options = clone(DEFAULT_OPTIONS);\n for (const k of Object.keys(options)) {\n if (k in this.options) {\n try {\n const newValue = options[k as keyof IPartialTerminalOptions] as any;\n this.options[k] = this._sanitizeAndValidateOption(k, newValue);\n } catch (e) {\n console.error(e);\n }\n }\n }\n }\n\n public setOption(key: string, value: any): void {\n if (!(key in DEFAULT_OPTIONS)) {\n throw new Error('No option with key \"' + key + '\"');\n }\n if (CONSTRUCTOR_ONLY_OPTIONS.includes(key)) {\n throw new Error(`Option \"${key}\" can only be set in the constructor`);\n }\n if (this.options[key] === value) {\n return;\n }\n\n value = this._sanitizeAndValidateOption(key, value);\n\n // Don't fire an option change event if they didn't change\n if (this.options[key] === value) {\n return;\n }\n\n this.options[key] = value;\n this._onOptionChange.fire(key);\n }\n\n private _sanitizeAndValidateOption(key: string, value: any): any {\n switch (key) {\n case 'bellStyle':\n case 'cursorStyle':\n case 'rendererType':\n case 'wordSeparator':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n break;\n case 'fontWeight':\n case 'fontWeightBold':\n if (typeof value === 'number' && 1 <= value && value <= 1000) {\n // already valid numeric value\n break;\n }\n value = FONT_WEIGHT_OPTIONS.includes(value) ? value : DEFAULT_OPTIONS[key];\n break;\n case 'cursorWidth':\n value = Math.floor(value);\n // Fall through for bounds check\n case 'lineHeight':\n case 'tabStopWidth':\n if (value < 1) {\n throw new Error(`${key} cannot be less than 1, value: ${value}`);\n }\n break;\n case 'minimumContrastRatio':\n value = Math.max(1, Math.min(21, Math.round(value * 10) / 10));\n break;\n case 'scrollback':\n value = Math.min(value, 4294967295);\n if (value < 0) {\n throw new Error(`${key} cannot be less than 0, value: ${value}`);\n }\n break;\n case 'fastScrollSensitivity':\n case 'scrollSensitivity':\n if (value <= 0) {\n throw new Error(`${key} cannot be less than or equal to 0, value: ${value}`);\n }\n break;\n }\n return value;\n }\n\n public getOption(key: string): any {\n if (!(key in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${key}\"`);\n }\n return this.options[key];\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IServiceIdentifier } from 'common/services/Services';\n\nconst DI_TARGET = 'di$target';\nconst DI_DEPENDENCIES = 'di$dependencies';\n\nexport const serviceRegistry: Map> = new Map();\n\nexport function getServiceDependencies(ctor: any): { id: IServiceIdentifier, index: number, optional: boolean }[] {\n return ctor[DI_DEPENDENCIES] || [];\n}\n\nexport function createDecorator(id: string): IServiceIdentifier {\n if (serviceRegistry.has(id)) {\n return serviceRegistry.get(id)!;\n }\n\n const decorator: any = function (target: Function, key: string, index: number): any {\n if (arguments.length !== 3) {\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\n }\n\n storeServiceDependency(decorator, target, index);\n };\n\n decorator.toString = () => id;\n\n serviceRegistry.set(id, decorator);\n return decorator;\n}\n\nfunction storeServiceDependency(id: Function, target: Function, index: number): void {\n if ((target as any)[DI_TARGET] === target) {\n (target as any)[DI_DEPENDENCIES].push({ id, index });\n } else {\n (target as any)[DI_DEPENDENCIES] = [{ id, index }];\n (target as any)[DI_TARGET] = target;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IEvent } from 'common/EventEmitter';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes } from 'common/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\n\nexport const IBufferService = createDecorator('BufferService');\nexport interface IBufferService {\n serviceBrand: undefined;\n\n readonly cols: number;\n readonly rows: number;\n readonly buffer: IBuffer;\n readonly buffers: IBufferSet;\n isUserScrolling: boolean;\n\n onResize: IEvent<{ cols: number, rows: number }>;\n\n resize(cols: number, rows: number): void;\n reset(): void;\n}\n\nexport const ICoreMouseService = createDecorator('CoreMouseService');\nexport interface ICoreMouseService {\n activeProtocol: string;\n activeEncoding: string;\n areMouseEventsActive: boolean;\n addProtocol(name: string, protocol: ICoreMouseProtocol): void;\n addEncoding(name: string, encoding: CoreMouseEncoding): void;\n reset(): void;\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n triggerMouseEvent(event: ICoreMouseEvent): boolean;\n\n /**\n * Event to announce changes in mouse tracking.\n */\n onProtocolChange: IEvent;\n\n /**\n * Human readable version of mouse events.\n */\n explainEvents(events: CoreMouseEventType): { [event: string]: boolean };\n}\n\nexport const ICoreService = createDecorator('CoreService');\nexport interface ICoreService {\n serviceBrand: undefined;\n\n /**\n * Initially the cursor will not be visible until the first time the terminal\n * is focused.\n */\n isCursorInitialized: boolean;\n isCursorHidden: boolean;\n\n readonly modes: IModes;\n readonly decPrivateModes: IDecPrivateModes;\n\n readonly onData: IEvent;\n readonly onUserInput: IEvent;\n readonly onBinary: IEvent;\n\n reset(): void;\n\n /**\n * Triggers the onData event in the public API.\n * @param data The data that is being emitted.\n * @param wasFromUser Whether the data originated from the user (as opposed to\n * resulting from parsing incoming data). When true this will also:\n * - Scroll to the bottom of the buffer.s\n * - Fire the `onUserInput` event (so selection can be cleared).\n */\n triggerDataEvent(data: string, wasUserInput?: boolean): void;\n\n /**\n * Triggers the onBinary event in the public API.\n * @param data The data that is being emitted.\n */\n triggerBinaryEvent(data: string): void;\n}\n\nexport const ICharsetService = createDecorator('CharsetService');\nexport interface ICharsetService {\n serviceBrand: undefined;\n\n charset: ICharset | undefined;\n readonly glevel: number;\n\n reset(): void;\n\n /**\n * Set the G level of the terminal.\n * @param g\n */\n setgLevel(g: number): void;\n\n /**\n * Set the charset for the given G level of the terminal.\n * @param g\n * @param charset\n */\n setgCharset(g: number, charset: ICharset | undefined): void;\n}\n\nexport const IDirtyRowService = createDecorator('DirtyRowService');\nexport interface IDirtyRowService {\n serviceBrand: undefined;\n\n readonly start: number;\n readonly end: number;\n\n clearRange(): void;\n markDirty(y: number): void;\n markRangeDirty(y1: number, y2: number): void;\n markAllDirty(): void;\n}\n\nexport interface IServiceIdentifier {\n (...args: any[]): void;\n type: T;\n}\n\nexport interface IBrandedService {\n serviceBrand: undefined;\n}\n\ntype GetLeadingNonServiceArgs =\n Args extends [...IBrandedService[]] ? []\n : Args extends [infer A1, ...IBrandedService[]] ? [A1]\n : Args extends [infer A1, infer A2, ...IBrandedService[]] ? [A1, A2]\n : Args extends [infer A1, infer A2, infer A3, ...IBrandedService[]] ? [A1, A2, A3]\n : Args extends [infer A1, infer A2, infer A3, infer A4, ...IBrandedService[]] ? [A1, A2, A3, A4]\n : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, ...IBrandedService[]] ? [A1, A2, A3, A4, A5]\n : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6]\n : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6, A7]\n : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7, infer A8, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6, A7, A8]\n : never;\n\nexport const IInstantiationService = createDecorator('InstantiationService');\nexport interface IInstantiationService {\n setService(id: IServiceIdentifier, instance: T): void;\n getService(id: IServiceIdentifier): T | undefined;\n createInstance any, R extends InstanceType>(t: Ctor, ...args: GetLeadingNonServiceArgs>): R;\n}\n\nexport const ILogService = createDecorator('LogService');\nexport interface ILogService {\n serviceBrand: undefined;\n\n debug(message: any, ...optionalParams: any[]): void;\n info(message: any, ...optionalParams: any[]): void;\n warn(message: any, ...optionalParams: any[]): void;\n error(message: any, ...optionalParams: any[]): void;\n}\n\nexport const IOptionsService = createDecorator('OptionsService');\nexport interface IOptionsService {\n serviceBrand: undefined;\n\n readonly options: ITerminalOptions;\n\n readonly onOptionChange: IEvent;\n\n setOption(key: string, value: T): void;\n getOption(key: string): T | undefined;\n}\n\nexport type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';\nexport type RendererType = 'dom' | 'canvas';\n\nexport interface IPartialTerminalOptions {\n altClickMovesCursor?: boolean;\n allowTransparency?: boolean;\n bellSound?: string;\n bellStyle?: 'none' | 'sound' /* | 'visual' | 'both' */;\n cols?: number;\n cursorBlink?: boolean;\n cursorStyle?: 'block' | 'underline' | 'bar';\n cursorWidth?: number;\n disableStdin?: boolean;\n drawBoldTextInBrightColors?: boolean;\n fastScrollModifier?: 'alt' | 'ctrl' | 'shift';\n fastScrollSensitivity?: number;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: FontWeight;\n fontWeightBold?: FontWeight;\n letterSpacing?: number;\n lineHeight?: number;\n logLevel?: LogLevel;\n macOptionIsMeta?: boolean;\n macOptionClickForcesSelection?: boolean;\n rendererType?: RendererType;\n rightClickSelectsWord?: boolean;\n rows?: number;\n screenReaderMode?: boolean;\n scrollback?: number;\n scrollSensitivity?: number;\n tabStopWidth?: number;\n theme?: ITheme;\n windowsMode?: boolean;\n wordSeparator?: string;\n windowOptions?: IWindowOptions;\n}\n\nexport interface ITerminalOptions {\n allowProposedApi: boolean;\n allowTransparency: boolean;\n altClickMovesCursor: boolean;\n bellSound: string;\n bellStyle: 'none' | 'sound' /* | 'visual' | 'both' */;\n cols: number;\n cursorBlink: boolean;\n cursorStyle: 'block' | 'underline' | 'bar';\n cursorWidth: number;\n disableStdin: boolean;\n drawBoldTextInBrightColors: boolean;\n fastScrollModifier: 'alt' | 'ctrl' | 'shift' | undefined;\n fastScrollSensitivity: number;\n fontSize: number;\n fontFamily: string;\n fontWeight: FontWeight;\n fontWeightBold: FontWeight;\n letterSpacing: number;\n lineHeight: number;\n linkTooltipHoverDuration: number;\n logLevel: LogLevel;\n macOptionIsMeta: boolean;\n macOptionClickForcesSelection: boolean;\n minimumContrastRatio: number;\n rendererType: RendererType;\n rightClickSelectsWord: boolean;\n rows: number;\n screenReaderMode: boolean;\n scrollback: number;\n scrollSensitivity: number;\n tabStopWidth: number;\n theme: ITheme;\n windowsMode: boolean;\n windowOptions: IWindowOptions;\n wordSeparator: string;\n\n [key: string]: any;\n cancelEvents: boolean;\n convertEol: boolean;\n termName: string;\n}\n\nexport interface ITheme {\n foreground?: string;\n background?: string;\n cursor?: string;\n cursorAccent?: string;\n selection?: string;\n black?: string;\n red?: string;\n green?: string;\n yellow?: string;\n blue?: string;\n magenta?: string;\n cyan?: string;\n white?: string;\n brightBlack?: string;\n brightRed?: string;\n brightGreen?: string;\n brightYellow?: string;\n brightBlue?: string;\n brightMagenta?: string;\n brightCyan?: string;\n brightWhite?: string;\n}\n\nexport const IUnicodeService = createDecorator('UnicodeService');\nexport interface IUnicodeService {\n serviceBrand: undefined;\n /** Register an Unicode version provider. */\n register(provider: IUnicodeVersionProvider): void;\n /** Registered Unicode versions. */\n readonly versions: string[];\n /** Currently active version. */\n activeVersion: string;\n /** Event triggered, when activate version changed. */\n readonly onChange: IEvent;\n\n /**\n * Unicode version dependent\n */\n wcwidth(codepoint: number): number;\n getStringCellWidth(s: string): number;\n}\n\nexport interface IUnicodeVersionProvider {\n readonly version: string;\n wcwidth(ucs: number): 0 | 1 | 2;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IUnicodeService, IUnicodeVersionProvider } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { UnicodeV6 } from 'common/input/UnicodeV6';\n\n\nexport class UnicodeService implements IUnicodeService {\n public serviceBrand: any;\n\n private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);\n private _active: string = '';\n private _activeProvider: IUnicodeVersionProvider;\n private _onChange = new EventEmitter();\n public get onChange(): IEvent { return this._onChange.event; }\n\n constructor() {\n const defaultProvider = new UnicodeV6();\n this.register(defaultProvider);\n this._active = defaultProvider.version;\n this._activeProvider = defaultProvider;\n }\n\n public get versions(): string[] {\n return Object.keys(this._providers);\n }\n\n public get activeVersion(): string {\n return this._active;\n }\n\n public set activeVersion(version: string) {\n if (!this._providers[version]) {\n throw new Error(`unknown Unicode version \"${version}\"`);\n }\n this._active = version;\n this._activeProvider = this._providers[version];\n this._onChange.fire(version);\n }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._providers[provider.version] = provider;\n }\n\n /**\n * Unicode version dependent interface.\n */\n public wcwidth(num: number): number {\n return this._activeProvider.wcwidth(num);\n }\n\n public getStringCellWidth(s: string): number {\n let result = 0;\n const length = s.length;\n for (let i = 0; i < length; ++i) {\n let code = s.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n // this should not happen with strings retrieved from\n // Buffer.translateToString as it converts from UTF-32\n // and therefore always should contain the second part\n // for any other string we still have to handle it somehow:\n // simply treat the lonely surrogate first as a single char (UCS-2 behavior)\n return result + this.wcwidth(code);\n }\n const second = s.charCodeAt(i);\n // convert surrogate pair to high codepoint only for valid second part (UTF-16)\n // otherwise treat them independently (UCS-2 behavior)\n if (0xDC00 <= second && second <= 0xDFFF) {\n code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n result += this.wcwidth(second);\n }\n }\n result += this.wcwidth(code);\n }\n return result;\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(4389);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"xterm.js","mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,EACvE,CACA,CATD,CASGC,MAAM,WACT,M,wHCLA,gBAGA,UACA,UACA,UACA,SACA,UAEA,UASA,MAAaC,UAA6B,EAAAC,WA0BxCC,YACmBC,EACAC,GAEjBC,QAHiB,KAAAF,UAAAA,EACA,KAAAC,eAAAA,EAvBX,KAAAE,qBAA+B,EAiB/B,KAAAC,gBAA4B,GAE5B,KAAAC,iBAA2B,GAOjCC,KAAKC,uBAAyBC,SAASC,cAAc,OACrDH,KAAKC,uBAAuBG,UAAUC,IAAI,uBAC1CL,KAAKC,uBAAuBK,SAAW,EAEvCN,KAAKO,cAAgBL,SAASC,cAAc,OAC5CH,KAAKO,cAAcC,aAAa,OAAQ,QACxCR,KAAKO,cAAcH,UAAUC,IAAI,4BACjCL,KAAKS,aAAe,GACpB,IAAK,IAAIpB,EAAI,EAAGA,EAAIW,KAAKN,UAAUgB,KAAMrB,IACvCW,KAAKS,aAAapB,GAAKW,KAAKW,+BAC5BX,KAAKO,cAAcK,YAAYZ,KAAKS,aAAapB,IAmBnD,GAhBAW,KAAKa,0BAA4BC,GAAKd,KAAKe,qBAAqBD,EAAG,GACnEd,KAAKgB,6BAA+BF,GAAKd,KAAKe,qBAAqBD,EAAG,GACtEd,KAAKS,aAAa,GAAGQ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KAAK+/D,MAAMv6D,QAAQvD,EAAOC,EAC5B,CACO4U,QACL9W,KAAK+/D,MAAMjpD,OACb,CACO0O,oBACLxlB,KAAK+/D,MAAMv6C,mBACb,CACO05C,UAAU+K,GACf,OAAOjqE,KAAK4oE,cAAc1J,UAAUl/D,KAAMiqE,EAC5C,CACkBC,qBAChB,OAAOjlE,CACT,CAEQ4kE,mBAAmBpjB,GACzB,IAAK,MAAMv/C,KAASu/C,EAClB,GAAIv/C,IAAUijE,KAAY34B,MAAMtqC,IAAUA,EAAQ,GAAM,EACtD,MAAM,IAAIvF,MAAM,iCAGtB,CAEQooE,2BAA2BtjB,GACjC,IAAK,MAAMv/C,KAASu/C,EAClB,GAAIv/C,IAAUA,IAAUijE,KAAY34B,MAAMtqC,IAAUA,EAAQ,GAAM,GAAKA,EAAQ,GAC7E,MAAM,IAAIvF,MAAM,0CAGtB,E","sources":["webpack://xterm/webpack/universalModuleDefinition","webpack://xterm/./src/browser/AccessibilityManager.ts","webpack://xterm/./src/browser/Clipboard.ts","webpack://xterm/./src/browser/ColorContrastCache.ts","webpack://xterm/./src/browser/Dom.ts","webpack://xterm/./src/browser/Lifecycle.ts","webpack://xterm/./src/browser/Linkifier2.ts","webpack://xterm/./src/browser/LocalizableStrings.ts","webpack://xterm/./src/browser/OscLinkProvider.ts","webpack://xterm/./src/browser/RenderDebouncer.ts","webpack://xterm/./src/browser/ScreenDprMonitor.ts","webpack://xterm/./src/browser/Terminal.ts","webpack://xterm/./src/browser/TimeBasedDebouncer.ts","webpack://xterm/./src/browser/Viewport.ts","webpack://xterm/./src/browser/decorations/BufferDecorationRenderer.ts","webpack://xterm/./src/browser/decorations/ColorZoneStore.ts","webpack://xterm/./src/browser/decorations/OverviewRulerRenderer.ts","webpack://xterm/./src/browser/input/CompositionHelper.ts","webpack://xterm/./src/browser/input/Mouse.ts","webpack://xterm/./src/browser/input/MoveToCell.ts","webpack://xterm/./src/browser/renderer/dom/DomRenderer.ts","webpack://xterm/./src/browser/renderer/dom/DomRendererRowFactory.ts","webpack://xterm/./src/browser/renderer/shared/Constants.ts","webpack://xterm/./src/browser/renderer/shared/RendererUtils.ts","webpack://xterm/./src/browser/selection/SelectionModel.ts","webpack://xterm/./src/browser/services/CharSizeService.ts","webpack://xterm/./src/browser/services/CharacterJoinerService.ts","webpack://xterm/./src/browser/services/CoreBrowserService.ts","webpack://xterm/./src/browser/services/MouseService.ts","webpack://xterm/./src/browser/services/RenderService.ts","webpack://xterm/./src/browser/services/SelectionService.ts","webpack://xterm/./src/browser/services/Services.ts","webpack://xterm/./src/browser/services/ThemeService.ts","webpack://xterm/./src/common/CircularList.ts","webpack://xterm/./src/common/Clone.ts","webpack://xterm/./src/common/Color.ts","webpack://xterm/./src/common/CoreTerminal.ts","webpack://xterm/./src/common/EventEmitter.ts","webpack://xterm/./src/common/InputHandler.ts","webpack://xterm/./src/common/Lifecycle.ts","webpack://xterm/./src/common/MultiKeyMap.ts","webpack://xterm/./src/common/Platform.ts","webpack://xterm/./src/common/SortedList.ts","webpack://xterm/./src/common/TaskQueue.ts","webpack://xterm/./src/common/WindowsMode.ts","webpack://xterm/./src/common/buffer/AttributeData.ts","webpack://xterm/./src/common/buffer/Buffer.ts","webpack://xterm/./src/common/buffer/BufferLine.ts","webpack://xterm/./src/common/buffer/BufferRange.ts","webpack://xterm/./src/common/buffer/BufferReflow.ts","webpack://xterm/./src/common/buffer/BufferSet.ts","webpack://xterm/./src/common/buffer/CellData.ts","webpack://xterm/./src/common/buffer/Constants.ts","webpack://xterm/./src/common/buffer/Marker.ts","webpack://xterm/./src/common/data/Charsets.ts","webpack://xterm/./src/common/data/EscapeSequences.ts","webpack://xterm/./src/common/input/Keyboard.ts","webpack://xterm/./src/common/input/TextDecoder.ts","webpack://xterm/./src/common/input/UnicodeV6.ts","webpack://xterm/./src/common/input/WriteBuffer.ts","webpack://xterm/./src/common/input/XParseColor.ts","webpack://xterm/./src/common/parser/Constants.ts","webpack://xterm/./src/common/parser/DcsParser.ts","webpack://xterm/./src/common/parser/EscapeSequenceParser.ts","webpack://xterm/./src/common/parser/OscParser.ts","webpack://xterm/./src/common/parser/Params.ts","webpack://xterm/./src/common/public/AddonManager.ts","webpack://xterm/./src/common/public/BufferApiView.ts","webpack://xterm/./src/common/public/BufferLineApiView.ts","webpack://xterm/./src/common/public/BufferNamespaceApi.ts","webpack://xterm/./src/common/public/ParserApi.ts","webpack://xterm/./src/common/public/UnicodeApi.ts","webpack://xterm/./src/common/services/BufferService.ts","webpack://xterm/./src/common/services/CharsetService.ts","webpack://xterm/./src/common/services/CoreMouseService.ts","webpack://xterm/./src/common/services/CoreService.ts","webpack://xterm/./src/common/services/DecorationService.ts","webpack://xterm/./src/common/services/InstantiationService.ts","webpack://xterm/./src/common/services/LogService.ts","webpack://xterm/./src/common/services/OptionsService.ts","webpack://xterm/./src/common/services/OscLinkService.ts","webpack://xterm/./src/common/services/ServiceRegistry.ts","webpack://xterm/./src/common/services/Services.ts","webpack://xterm/./src/common/services/UnicodeService.ts","webpack://xterm/webpack/bootstrap","webpack://xterm/./src/browser/public/Terminal.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(self, function() {\nreturn ","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { ITerminal, IRenderDebouncer } from 'browser/Types';\nimport { IBuffer } from 'common/buffer/Types';\nimport { isMac } from 'common/Platform';\nimport { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { ScreenDprMonitor } from 'browser/ScreenDprMonitor';\nimport { IRenderService } from 'browser/services/Services';\nimport { removeElementFromParent } from 'browser/Dom';\n\nconst MAX_ROWS_TO_READ = 20;\n\nconst enum BoundaryPosition {\n TOP,\n BOTTOM\n}\n\nexport class AccessibilityManager extends Disposable {\n private _accessibilityTreeRoot: HTMLElement;\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[];\n private _liveRegion: HTMLElement;\n private _liveRegionLineCount: number = 0;\n\n private _renderRowsDebouncer: IRenderDebouncer;\n private _screenDprMonitor: ScreenDprMonitor;\n\n private _topBoundaryFocusListener: (e: FocusEvent) => void;\n private _bottomBoundaryFocusListener: (e: FocusEvent) => void;\n\n /**\n * This queue has a character pushed to it for keys that are pressed, if the\n * next character added to the terminal is equal to the key char then it is\n * not announced (added to live region) because it has already been announced\n * by the textarea event (which cannot be canceled). There are some race\n * condition cases if there is typing while data is streaming, but this covers\n * the main case of typing into the prompt and inputting the answer to a\n * question (Y/N, etc.).\n */\n private _charsToConsume: string[] = [];\n\n private _charsToAnnounce: string = '';\n\n constructor(\n private readonly _terminal: ITerminal,\n private readonly _renderService: IRenderService\n ) {\n super();\n this._accessibilityTreeRoot = document.createElement('div');\n this._accessibilityTreeRoot.classList.add('xterm-accessibility');\n this._accessibilityTreeRoot.tabIndex = 0;\n\n this._rowContainer = document.createElement('div');\n this._rowContainer.setAttribute('role', 'list');\n this._rowContainer.classList.add('xterm-accessibility-tree');\n this._rowElements = [];\n for (let i = 0; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n\n this._topBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.TOP);\n this._bottomBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.BOTTOM);\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._refreshRowsDimensions();\n this._accessibilityTreeRoot.appendChild(this._rowContainer);\n\n this._renderRowsDebouncer = new TimeBasedDebouncer(this._renderRows.bind(this));\n this._refreshRows();\n\n this._liveRegion = document.createElement('div');\n this._liveRegion.classList.add('live-region');\n this._liveRegion.setAttribute('aria-live', 'assertive');\n this._accessibilityTreeRoot.appendChild(this._liveRegion);\n\n if (!this._terminal.element) {\n throw new Error('Cannot enable accessibility before Terminal.open');\n }\n this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityTreeRoot);\n\n this.register(this._renderRowsDebouncer);\n this.register(this._terminal.onResize(e => this._handleResize(e.rows)));\n this.register(this._terminal.onRender(e => this._refreshRows(e.start, e.end)));\n this.register(this._terminal.onScroll(() => this._refreshRows()));\n // Line feed is an issue as the prompt won't be read out after a command is run\n this.register(this._terminal.onA11yChar(char => this._handleChar(char)));\n this.register(this._terminal.onLineFeed(() => this._handleChar('\\n')));\n this.register(this._terminal.onA11yTab(spaceCount => this._handleTab(spaceCount)));\n this.register(this._terminal.onKey(e => this._handleKey(e.key)));\n this.register(this._terminal.onBlur(() => this._clearLiveRegion()));\n this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions()));\n\n this._screenDprMonitor = new ScreenDprMonitor(window);\n this.register(this._screenDprMonitor);\n this._screenDprMonitor.setListener(() => this._refreshRowsDimensions());\n // This shouldn't be needed on modern browsers but is present in case the\n // media query that drives the ScreenDprMonitor isn't supported\n this.register(addDisposableDomListener(window, 'resize', () => this._refreshRowsDimensions()));\n this.register(toDisposable(() => {\n removeElementFromParent(this._accessibilityTreeRoot);\n this._rowElements.length = 0;\n }));\n }\n\n private _handleBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {\n const boundaryElement = e.target as HTMLElement;\n const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];\n\n // Don't scroll if the buffer top has reached the end in that direction\n const posInSet = boundaryElement.getAttribute('aria-posinset');\n const lastRowPos = position === BoundaryPosition.TOP ? '1' : `${this._terminal.buffer.lines.length}`;\n if (posInSet === lastRowPos) {\n return;\n }\n\n // Don't scroll when the last focused item was not the second row (focus is going the other\n // direction)\n if (e.relatedTarget !== beforeBoundaryElement) {\n return;\n }\n\n // Remove old boundary element from array\n let topBoundaryElement: HTMLElement;\n let bottomBoundaryElement: HTMLElement;\n if (position === BoundaryPosition.TOP) {\n topBoundaryElement = boundaryElement;\n bottomBoundaryElement = this._rowElements.pop()!;\n this._rowContainer.removeChild(bottomBoundaryElement);\n } else {\n topBoundaryElement = this._rowElements.shift()!;\n bottomBoundaryElement = boundaryElement;\n this._rowContainer.removeChild(topBoundaryElement);\n }\n\n // Remove listeners from old boundary elements\n topBoundaryElement.removeEventListener('focus', this._topBoundaryFocusListener);\n bottomBoundaryElement.removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Add new element to array/DOM\n if (position === BoundaryPosition.TOP) {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.unshift(newElement);\n this._rowContainer.insertAdjacentElement('afterbegin', newElement);\n } else {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.push(newElement);\n this._rowContainer.appendChild(newElement);\n }\n\n // Add listeners to new boundary elements\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Scroll up\n this._terminal.scrollLines(position === BoundaryPosition.TOP ? -1 : 1);\n\n // Focus new boundary before element\n this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2].focus();\n\n // Prevent the standard behavior\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n private _handleResize(rows: number): void {\n // Remove bottom boundary listener\n this._rowElements[this._rowElements.length - 1].removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Grow rows as required\n for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n // Shrink rows as required\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n\n // Add bottom boundary listener\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._refreshRowsDimensions();\n }\n\n private _createAccessibilityTreeNode(): HTMLElement {\n const element = document.createElement('div');\n element.setAttribute('role', 'listitem');\n element.tabIndex = -1;\n this._refreshRowDimensions(element);\n return element;\n }\n\n private _handleTab(spaceCount: number): void {\n for (let i = 0; i < spaceCount; i++) {\n this._handleChar(' ');\n }\n }\n\n private _handleChar(char: string): void {\n if (this._liveRegionLineCount < MAX_ROWS_TO_READ + 1) {\n if (this._charsToConsume.length > 0) {\n // Have the screen reader ignore the char if it was just input\n const shiftedChar = this._charsToConsume.shift();\n if (shiftedChar !== char) {\n this._charsToAnnounce += char;\n }\n } else {\n this._charsToAnnounce += char;\n }\n\n if (char === '\\n') {\n this._liveRegionLineCount++;\n if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {\n this._liveRegion.textContent += Strings.tooMuchOutput;\n }\n }\n\n // Only detach/attach on mac as otherwise messages can go unaccounced\n if (isMac) {\n if (this._liveRegion.textContent && this._liveRegion.textContent.length > 0 && !this._liveRegion.parentNode) {\n setTimeout(() => {\n this._accessibilityTreeRoot.appendChild(this._liveRegion);\n }, 0);\n }\n }\n }\n }\n\n private _clearLiveRegion(): void {\n this._liveRegion.textContent = '';\n this._liveRegionLineCount = 0;\n\n // Only detach/attach on mac as otherwise messages can go unaccounced\n if (isMac) {\n removeElementFromParent(this._liveRegion);\n }\n }\n\n private _handleKey(keyChar: string): void {\n this._clearLiveRegion();\n // Only add the char if there is no control character.\n if (!/\\p{Control}/u.test(keyChar)) {\n this._charsToConsume.push(keyChar);\n }\n }\n\n private _refreshRows(start?: number, end?: number): void {\n this._renderRowsDebouncer.refresh(start, end, this._terminal.rows);\n }\n\n private _renderRows(start: number, end: number): void {\n const buffer: IBuffer = this._terminal.buffer;\n const setSize = buffer.lines.length.toString();\n for (let i = start; i <= end; i++) {\n const lineData = buffer.translateBufferLineToString(buffer.ydisp + i, true);\n const posInSet = (buffer.ydisp + i + 1).toString();\n const element = this._rowElements[i];\n if (element) {\n if (lineData.length === 0) {\n element.innerText = '\\u00a0';\n } else {\n element.textContent = lineData;\n }\n element.setAttribute('aria-posinset', posInSet);\n element.setAttribute('aria-setsize', setSize);\n }\n }\n this._announceCharacters();\n }\n\n private _refreshRowsDimensions(): void {\n if (!this._renderService.dimensions.css.cell.height) {\n return;\n }\n this._accessibilityTreeRoot.style.width = `${this._renderService.dimensions.css.canvas.width}px`;\n if (this._rowElements.length !== this._terminal.rows) {\n this._handleResize(this._terminal.rows);\n }\n for (let i = 0; i < this._terminal.rows; i++) {\n this._refreshRowDimensions(this._rowElements[i]);\n }\n }\n\n private _refreshRowDimensions(element: HTMLElement): void {\n element.style.height = `${this._renderService.dimensions.css.cell.height}px`;\n }\n\n private _announceCharacters(): void {\n if (this._charsToAnnounce.length === 0) {\n return;\n }\n this._liveRegion.textContent += this._charsToAnnounce;\n this._charsToAnnounce = '';\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ISelectionService } from 'browser/services/Services';\nimport { ICoreService } from 'common/services/Services';\n\n/**\n * Prepares text to be pasted into the terminal by normalizing the line endings\n * @param text The pasted text that needs processing before inserting into the terminal\n */\nexport function prepareTextForTerminal(text: string): string {\n return text.replace(/\\r?\\n/g, '\\r');\n}\n\n/**\n * Bracket text for paste, if necessary, as per https://cirw.in/blog/bracketed-paste\n * @param text The pasted text to bracket\n */\nexport function bracketTextForPaste(text: string, bracketedPasteMode: boolean): string {\n if (bracketedPasteMode) {\n return '\\x1b[200~' + text + '\\x1b[201~';\n }\n return text;\n}\n\n/**\n * Binds copy functionality to the given terminal.\n * @param ev The original copy event to be handled\n */\nexport function copyHandler(ev: ClipboardEvent, selectionService: ISelectionService): void {\n if (ev.clipboardData) {\n ev.clipboardData.setData('text/plain', selectionService.selectionText);\n }\n // Prevent or the original text will be copied.\n ev.preventDefault();\n}\n\n/**\n * Redirect the clipboard's data to the terminal's input handler.\n */\nexport function handlePasteEvent(ev: ClipboardEvent, textarea: HTMLTextAreaElement, coreService: ICoreService): void {\n ev.stopPropagation();\n if (ev.clipboardData) {\n const text = ev.clipboardData.getData('text/plain');\n paste(text, textarea, coreService);\n }\n}\n\nexport function paste(text: string, textarea: HTMLTextAreaElement, coreService: ICoreService): void {\n text = prepareTextForTerminal(text);\n text = bracketTextForPaste(text, coreService.decPrivateModes.bracketedPasteMode);\n coreService.triggerDataEvent(text, true);\n textarea.value = '';\n}\n\n/**\n * Moves the textarea under the mouse cursor and focuses it.\n * @param ev The original right click event to be handled.\n * @param textarea The terminal's textarea.\n */\nexport function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement): void {\n\n // Calculate textarea position relative to the screen element\n const pos = screenElement.getBoundingClientRect();\n const left = ev.clientX - pos.left - 10;\n const top = ev.clientY - pos.top - 10;\n\n // Bring textarea at the cursor position\n textarea.style.width = '20px';\n textarea.style.height = '20px';\n textarea.style.left = `${left}px`;\n textarea.style.top = `${top}px`;\n textarea.style.zIndex = '1000';\n\n textarea.focus();\n}\n\n/**\n * Bind to right-click event and allow right-click copy and paste.\n */\nexport function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement, selectionService: ISelectionService, shouldSelectWord: boolean): void {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n\n // Get textarea ready to copy from the context menu\n textarea.value = selectionService.selectionText;\n textarea.select();\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColorContrastCache } from 'browser/Types';\nimport { IColor } from 'common/Types';\nimport { TwoKeyMap } from 'common/MultiKeyMap';\n\nexport class ColorContrastCache implements IColorContrastCache {\n private _color: TwoKeyMap = new TwoKeyMap();\n private _css: TwoKeyMap = new TwoKeyMap();\n\n public setCss(bg: number, fg: number, value: string | null): void {\n this._css.set(bg, fg, value);\n }\n\n public getCss(bg: number, fg: number): string | null | undefined {\n return this._css.get(bg, fg);\n }\n\n public setColor(bg: number, fg: number, value: IColor | null): void {\n this._color.set(bg, fg, value);\n }\n\n public getColor(bg: number, fg: number): IColor | null | undefined {\n return this._color.get(bg, fg);\n }\n\n public clear(): void {\n this._color.clear();\n this._css.clear();\n }\n}\n","/**\n * Copyright (c) 2020 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function removeElementFromParent(...elements: (HTMLElement | undefined)[]): void {\n for (const e of elements) {\n e?.parentElement?.removeChild(e);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\n\n/**\n * Adds a disposable listener to a node in the DOM, returning the disposable.\n * @param node The node to add a listener to.\n * @param type The event type.\n * @param handler The handler for the listener.\n * @param options The boolean or options object to pass on to the event\n * listener.\n */\nexport function addDisposableDomListener(\n node: Element | Window | Document,\n type: string,\n handler: (e: any) => void,\n options?: boolean | AddEventListenerOptions\n): IDisposable {\n node.addEventListener(type, handler, options);\n let disposed = false;\n return {\n dispose: () => {\n if (disposed) {\n return;\n }\n disposed = true;\n node.removeEventListener(type, handler, options);\n }\n };\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ILinkifier2, ILinkProvider, IBufferCellPosition, ILink, ILinkifierEvent, ILinkDecorations, ILinkWithState } from 'browser/Types';\nimport { IDisposable } from 'common/Types';\nimport { IMouseService, IRenderService } from './services/Services';\nimport { IBufferService } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable, getDisposeArrayDisposable, disposeArray, toDisposable } from 'common/Lifecycle';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\n\nexport class Linkifier2 extends Disposable implements ILinkifier2 {\n private _element: HTMLElement | undefined;\n private _mouseService: IMouseService | undefined;\n private _renderService: IRenderService | undefined;\n private _linkProviders: ILinkProvider[] = [];\n public get currentLink(): ILinkWithState | undefined { return this._currentLink; }\n protected _currentLink: ILinkWithState | undefined;\n private _mouseDownLink: ILinkWithState | undefined;\n private _lastMouseEvent: MouseEvent | undefined;\n private _linkCacheDisposables: IDisposable[] = [];\n private _lastBufferCell: IBufferCellPosition | undefined;\n private _isMouseOut: boolean = true;\n private _activeProviderReplies: Map | undefined;\n private _activeLine: number = -1;\n\n private readonly _onShowLinkUnderline = this.register(new EventEmitter());\n public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;\n private readonly _onHideLinkUnderline = this.register(new EventEmitter());\n public readonly onHideLinkUnderline = this._onHideLinkUnderline.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n super();\n this.register(getDisposeArrayDisposable(this._linkCacheDisposables));\n this.register(toDisposable(() => {\n this._lastMouseEvent = undefined;\n }));\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n this._linkProviders.push(linkProvider);\n return {\n dispose: () => {\n // Remove the link provider from the list\n const providerIndex = this._linkProviders.indexOf(linkProvider);\n\n if (providerIndex !== -1) {\n this._linkProviders.splice(providerIndex, 1);\n }\n }\n };\n }\n\n public attachToDom(element: HTMLElement, mouseService: IMouseService, renderService: IRenderService): void {\n this._element = element;\n this._mouseService = mouseService;\n this._renderService = renderService;\n\n this.register(addDisposableDomListener(this._element, 'mouseleave', () => {\n this._isMouseOut = true;\n this._clearCurrentLink();\n }));\n this.register(addDisposableDomListener(this._element, 'mousemove', this._handleMouseMove.bind(this)));\n this.register(addDisposableDomListener(this._element, 'mousedown', this._handleMouseDown.bind(this)));\n this.register(addDisposableDomListener(this._element, 'mouseup', this._handleMouseUp.bind(this)));\n }\n\n private _handleMouseMove(event: MouseEvent): void {\n this._lastMouseEvent = event;\n\n if (!this._element || !this._mouseService) {\n return;\n }\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n this._isMouseOut = false;\n\n // Ignore the event if it's an embedder created hover widget\n const composedPath = event.composedPath() as HTMLElement[];\n for (let i = 0; i < composedPath.length; i++) {\n const target = composedPath[i];\n // Hit Terminal.element, break and continue\n if (target.classList.contains('xterm')) {\n break;\n }\n // It's a hover, don't respect hover event\n if (target.classList.contains('xterm-hover')) {\n return;\n }\n }\n\n if (!this._lastBufferCell || (position.x !== this._lastBufferCell.x || position.y !== this._lastBufferCell.y)) {\n this._handleHover(position);\n this._lastBufferCell = position;\n }\n }\n\n private _handleHover(position: IBufferCellPosition): void {\n // TODO: This currently does not cache link provider results across wrapped lines, activeLine should be something like `activeRange: {startY, endY}`\n // Check if we need to clear the link\n if (this._activeLine !== position.y) {\n this._clearCurrentLink();\n this._askForLink(position, false);\n return;\n }\n\n // Check the if the link is in the mouse position\n const isCurrentLinkInPosition = this._currentLink && this._linkAtPosition(this._currentLink.link, position);\n if (!isCurrentLinkInPosition) {\n this._clearCurrentLink();\n this._askForLink(position, true);\n }\n }\n\n private _askForLink(position: IBufferCellPosition, useLineCache: boolean): void {\n if (!this._activeProviderReplies || !useLineCache) {\n this._activeProviderReplies?.forEach(reply => {\n reply?.forEach(linkWithState => {\n if (linkWithState.link.dispose) {\n linkWithState.link.dispose();\n }\n });\n });\n this._activeProviderReplies = new Map();\n this._activeLine = position.y;\n }\n let linkProvided = false;\n\n // There is no link cached, so ask for one\n for (const [i, linkProvider] of this._linkProviders.entries()) {\n if (useLineCache) {\n const existingReply = this._activeProviderReplies?.get(i);\n // If there isn't a reply, the provider hasn't responded yet.\n\n // TODO: If there isn't a reply yet it means that the provider is still resolving. Ensuring\n // provideLinks isn't triggered again saves ILink.hover firing twice though. This probably\n // needs promises to get fixed\n if (existingReply) {\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n }\n } else {\n linkProvider.provideLinks(position.y, (links: ILink[] | undefined) => {\n if (this._isMouseOut) {\n return;\n }\n const linksWithState: ILinkWithState[] | undefined = links?.map(link => ({ link }));\n this._activeProviderReplies?.set(i, linksWithState);\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n\n // If all providers have responded, remove lower priority links that intersect ranges of\n // higher priority links\n if (this._activeProviderReplies?.size === this._linkProviders.length) {\n this._removeIntersectingLinks(position.y, this._activeProviderReplies);\n }\n });\n }\n }\n }\n\n private _removeIntersectingLinks(y: number, replies: Map): void {\n const occupiedCells = new Set();\n for (let i = 0; i < replies.size; i++) {\n const providerReply = replies.get(i);\n if (!providerReply) {\n continue;\n }\n for (let i = 0; i < providerReply.length; i++) {\n const linkWithState = providerReply[i];\n const startX = linkWithState.link.range.start.y < y ? 0 : linkWithState.link.range.start.x;\n const endX = linkWithState.link.range.end.y > y ? this._bufferService.cols : linkWithState.link.range.end.x;\n for (let x = startX; x <= endX; x++) {\n if (occupiedCells.has(x)) {\n providerReply.splice(i--, 1);\n break;\n }\n occupiedCells.add(x);\n }\n }\n }\n }\n\n private _checkLinkProviderResult(index: number, position: IBufferCellPosition, linkProvided: boolean): boolean {\n if (!this._activeProviderReplies) {\n return linkProvided;\n }\n\n const links = this._activeProviderReplies.get(index);\n\n // Check if every provider before this one has come back undefined\n let hasLinkBefore = false;\n for (let j = 0; j < index; j++) {\n if (!this._activeProviderReplies.has(j) || this._activeProviderReplies.get(j)) {\n hasLinkBefore = true;\n }\n }\n\n // If all providers with higher priority came back undefined, then this provider's link for\n // the position should be used\n if (!hasLinkBefore && links) {\n const linkAtPosition = links.find(link => this._linkAtPosition(link.link, position));\n if (linkAtPosition) {\n linkProvided = true;\n this._handleNewLink(linkAtPosition);\n }\n }\n\n // Check if all the providers have responded\n if (this._activeProviderReplies.size === this._linkProviders.length && !linkProvided) {\n // Respect the order of the link providers\n for (let j = 0; j < this._activeProviderReplies.size; j++) {\n const currentLink = this._activeProviderReplies.get(j)?.find(link => this._linkAtPosition(link.link, position));\n if (currentLink) {\n linkProvided = true;\n this._handleNewLink(currentLink);\n break;\n }\n }\n }\n\n return linkProvided;\n }\n\n private _handleMouseDown(): void {\n this._mouseDownLink = this._currentLink;\n }\n\n private _handleMouseUp(event: MouseEvent): void {\n if (!this._element || !this._mouseService || !this._currentLink) {\n return;\n }\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n\n if (this._mouseDownLink === this._currentLink && this._linkAtPosition(this._currentLink.link, position)) {\n this._currentLink.link.activate(event, this._currentLink.link.text);\n }\n }\n\n private _clearCurrentLink(startRow?: number, endRow?: number): void {\n if (!this._element || !this._currentLink || !this._lastMouseEvent) {\n return;\n }\n\n // If we have a start and end row, check that the link is within it\n if (!startRow || !endRow || (this._currentLink.link.range.start.y >= startRow && this._currentLink.link.range.end.y <= endRow)) {\n this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent);\n this._currentLink = undefined;\n disposeArray(this._linkCacheDisposables);\n }\n }\n\n private _handleNewLink(linkWithState: ILinkWithState): void {\n if (!this._element || !this._lastMouseEvent || !this._mouseService) {\n return;\n }\n\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);\n\n if (!position) {\n return;\n }\n\n // Trigger hover if the we have a link at the position\n if (this._linkAtPosition(linkWithState.link, position)) {\n this._currentLink = linkWithState;\n this._currentLink.state = {\n decorations: {\n underline: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.underline,\n pointerCursor: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.pointerCursor\n },\n isHovered: true\n };\n this._linkHover(this._element, linkWithState.link, this._lastMouseEvent);\n\n // Add listener for tracking decorations changes\n linkWithState.link.decorations = {} as ILinkDecorations;\n Object.defineProperties(linkWithState.link.decorations, {\n pointerCursor: {\n get: () => this._currentLink?.state?.decorations.pointerCursor,\n set: v => {\n if (this._currentLink?.state && this._currentLink.state.decorations.pointerCursor !== v) {\n this._currentLink.state.decorations.pointerCursor = v;\n if (this._currentLink.state.isHovered) {\n this._element?.classList.toggle('xterm-cursor-pointer', v);\n }\n }\n }\n },\n underline: {\n get: () => this._currentLink?.state?.decorations.underline,\n set: v => {\n if (this._currentLink?.state && this._currentLink?.state?.decorations.underline !== v) {\n this._currentLink.state.decorations.underline = v;\n if (this._currentLink.state.isHovered) {\n this._fireUnderlineEvent(linkWithState.link, v);\n }\n }\n }\n }\n });\n\n // Add listener for rerendering\n if (this._renderService) {\n this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e => {\n // When start is 0 a scroll most likely occurred, make sure links above the fold also get\n // cleared.\n const start = e.start === 0 ? 0 : e.start + 1 + this._bufferService.buffer.ydisp;\n const oldEvent = this._currentLink ? this._lastMouseEvent : undefined;\n this._clearCurrentLink(start, e.end + 1 + this._bufferService.buffer.ydisp);\n if (oldEvent && this._element) {\n // re-eval previously active link after changes\n const position = this._positionFromMouseEvent(oldEvent, this._element, this._mouseService!);\n if (position) {\n this._askForLink(position, false);\n }\n }\n }));\n }\n }\n }\n\n protected _linkHover(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = true;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, true);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.add('xterm-cursor-pointer');\n }\n }\n\n if (link.hover) {\n link.hover(event, link.text);\n }\n }\n\n private _fireUnderlineEvent(link: ILink, showEvent: boolean): void {\n const range = link.range;\n const scrollOffset = this._bufferService.buffer.ydisp;\n const event = this._createLinkUnderlineEvent(range.start.x - 1, range.start.y - scrollOffset - 1, range.end.x, range.end.y - scrollOffset - 1, undefined);\n const emitter = showEvent ? this._onShowLinkUnderline : this._onHideLinkUnderline;\n emitter.fire(event);\n }\n\n protected _linkLeave(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = false;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, false);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.remove('xterm-cursor-pointer');\n }\n }\n\n if (link.leave) {\n link.leave(event, link.text);\n }\n }\n\n /**\n * Check if the buffer position is within the link\n * @param link\n * @param position\n */\n private _linkAtPosition(link: ILink, position: IBufferCellPosition): boolean {\n const lower = link.range.start.y * this._bufferService.cols + link.range.start.x;\n const upper = link.range.end.y * this._bufferService.cols + link.range.end.x;\n const current = position.y * this._bufferService.cols + position.x;\n return (lower <= current && current <= upper);\n }\n\n /**\n * Get the buffer position from a mouse event\n * @param event\n */\n private _positionFromMouseEvent(event: MouseEvent, element: HTMLElement, mouseService: IMouseService): IBufferCellPosition | undefined {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }\n\n private _createLinkUnderlineEvent(x1: number, y1: number, x2: number, y2: number, fg: number | undefined): ILinkifierEvent {\n return { x1, y1, x2, y2, cols: this._bufferService.cols, fg };\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n// This file contains strings that get exported in the API so they can be localized\n\n// eslint-disable-next-line prefer-const\nexport let promptLabel = 'Terminal input';\n\n// eslint-disable-next-line prefer-const\nexport let tooMuchOutput = 'Too much output to announce, navigate to rows manually to read';\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILink, ILinkProvider } from 'browser/Types';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService, IOptionsService, IOscLinkService } from 'common/services/Services';\n\nexport class OscLinkProvider implements ILinkProvider {\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IOscLinkService private readonly _oscLinkService: IOscLinkService\n ) {\n }\n\n public provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void {\n const line = this._bufferService.buffer.lines.get(y - 1);\n if (!line) {\n callback(undefined);\n return;\n }\n\n const result: ILink[] = [];\n const linkHandler = this._optionsService.rawOptions.linkHandler;\n const cell = new CellData();\n const lineLength = line.getTrimmedLength();\n let currentLinkId = -1;\n let currentStart = -1;\n let finishLink = false;\n for (let x = 0; x < lineLength; x++) {\n // Minor optimization, only check for content if there isn't a link in case the link ends with\n // a null cell\n if (currentStart === -1 && !line.hasContent(x)) {\n continue;\n }\n\n line.loadCell(x, cell);\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n if (currentStart === -1) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n continue;\n } else {\n finishLink = cell.extended.urlId !== currentLinkId;\n }\n } else {\n if (currentStart !== -1) {\n finishLink = true;\n }\n }\n\n if (finishLink || (currentStart !== -1 && x === lineLength - 1)) {\n const text = this._oscLinkService.getLinkData(currentLinkId)?.uri;\n if (text) {\n // These ranges are 1-based\n const range: IBufferRange = {\n start: {\n x: currentStart + 1,\n y\n },\n end: {\n // Offset end x if it's a link that ends on the last cell in the line\n x: x + (!finishLink && x === lineLength - 1 ? 1 : 0),\n y\n }\n };\n\n let ignoreLink = false;\n if (!linkHandler?.allowNonHttpProtocols) {\n try {\n const parsed = new URL(text);\n if (!['http:', 'https:'].includes(parsed.protocol)) {\n ignoreLink = true;\n }\n } catch (e) {\n // Ignore invalid URLs to prevent unexpected behaviors\n ignoreLink = true;\n }\n }\n\n if (!ignoreLink) {\n // OSC links always use underline and pointer decorations\n result.push({\n text,\n range,\n activate: (e, text) => (linkHandler ? linkHandler.activate(e, text, range) : defaultActivate(e, text)),\n hover: (e, text) => linkHandler?.hover?.(e, text, range),\n leave: (e, text) => linkHandler?.leave?.(e, text, range)\n });\n }\n }\n finishLink = false;\n\n // Clear link or start a new link if one starts immediately\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n } else {\n currentStart = -1;\n currentLinkId = -1;\n }\n }\n }\n\n // TODO: Handle fetching and returning other link ranges to underline other links with the same id\n callback(result);\n }\n}\n\nfunction defaultActivate(e: MouseEvent, uri: string): void {\n const answer = confirm(`Do you want to navigate to ${uri}?\\n\\nWARNING: This link could potentially be dangerous`);\n if (answer) {\n const newWindow = window.open();\n if (newWindow) {\n try {\n newWindow.opener = null;\n } catch {\n // no-op, Electron can throw\n }\n newWindow.location.href = uri;\n } else {\n console.warn('Opening link blocked as opener could not be cleared');\n }\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\n\n/**\n * Debounces calls to render terminal rows using animation frames.\n */\nexport class RenderDebouncer implements IRenderDebouncerWithCallback {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n private _animationFrame: number | undefined;\n private _refreshCallbacks: FrameRequestCallback[] = [];\n\n constructor(\n private _parentWindow: Window,\n private _renderCallback: (start: number, end: number) => void\n ) {\n }\n\n public dispose(): void {\n if (this._animationFrame) {\n this._parentWindow.cancelAnimationFrame(this._animationFrame);\n this._animationFrame = undefined;\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n this._refreshCallbacks.push(callback);\n if (!this._animationFrame) {\n this._animationFrame = this._parentWindow.requestAnimationFrame(() => this._innerRefresh());\n }\n return this._animationFrame;\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart !== undefined ? rowStart : 0;\n rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n if (this._animationFrame) {\n return;\n }\n\n this._animationFrame = this._parentWindow.requestAnimationFrame(() => this._innerRefresh());\n }\n\n private _innerRefresh(): void {\n this._animationFrame = undefined;\n\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n this._runRefreshCallbacks();\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n this._runRefreshCallbacks();\n }\n\n private _runRefreshCallbacks(): void {\n for (const callback of this._refreshCallbacks) {\n callback(0);\n }\n this._refreshCallbacks = [];\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable, toDisposable } from 'common/Lifecycle';\n\nexport type ScreenDprListener = (newDevicePixelRatio?: number, oldDevicePixelRatio?: number) => void;\n\n/**\n * The screen device pixel ratio monitor allows listening for when the\n * window.devicePixelRatio value changes. This is done not with polling but with\n * the use of window.matchMedia to watch media queries. When the event fires,\n * the listener will be reattached using a different media query to ensure that\n * any further changes will register.\n *\n * The listener should fire on both window zoom changes and switching to a\n * monitor with a different DPI.\n */\nexport class ScreenDprMonitor extends Disposable {\n private _currentDevicePixelRatio: number;\n private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined;\n private _listener: ScreenDprListener | undefined;\n private _resolutionMediaMatchList: MediaQueryList | undefined;\n\n constructor(private _parentWindow: Window) {\n super();\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this.register(toDisposable(() => {\n this.clearListener();\n }));\n }\n\n public setListener(listener: ScreenDprListener): void {\n if (this._listener) {\n this.clearListener();\n }\n this._listener = listener;\n this._outerListener = () => {\n if (!this._listener) {\n return;\n }\n this._listener(this._parentWindow.devicePixelRatio, this._currentDevicePixelRatio);\n this._updateDpr();\n };\n this._updateDpr();\n }\n\n private _updateDpr(): void {\n if (!this._outerListener) {\n return;\n }\n\n // Clear listeners for old DPR\n this._resolutionMediaMatchList?.removeListener(this._outerListener);\n\n // Add listeners for new DPR\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`);\n this._resolutionMediaMatchList.addListener(this._outerListener);\n }\n\n public clearListener(): void {\n if (!this._resolutionMediaMatchList || !this._listener || !this._outerListener) {\n return;\n }\n this._resolutionMediaMatchList.removeListener(this._outerListener);\n this._resolutionMediaMatchList = undefined;\n this._listener = undefined;\n this._outerListener = undefined;\n }\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { ICompositionHelper, ITerminal, IBrowser, CustomKeyEventHandler, IViewport, ILinkifier2, CharacterJoinerHandler, IBufferRange } from 'browser/Types';\nimport { IRenderer } from 'browser/renderer/shared/Types';\nimport { CompositionHelper } from 'browser/input/CompositionHelper';\nimport { Viewport } from 'browser/Viewport';\nimport { rightClickHandler, moveTextAreaUnderMouseCursor, handlePasteEvent, copyHandler, paste } from 'browser/Clipboard';\nimport { C0, C1_ESCAPED } from 'common/data/EscapeSequences';\nimport { WindowsOptionsReportType } from '../common/InputHandler';\nimport { SelectionService } from 'browser/services/SelectionService';\nimport * as Browser from 'common/Platform';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport * as Strings from 'browser/LocalizableStrings';\nimport { AccessibilityManager } from './AccessibilityManager';\nimport { ITheme, IMarker, IDisposable, ILinkProvider, IDecorationOptions, IDecoration } from 'xterm';\nimport { DomRenderer } from 'browser/renderer/dom/DomRenderer';\nimport { KeyboardResultType, CoreMouseEventType, CoreMouseButton, CoreMouseAction, ITerminalOptions, ScrollSource, IColorEvent, ColorIndex, ColorRequestType } from 'common/Types';\nimport { evaluateKeyboardEvent } from 'common/input/Keyboard';\nimport { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { RenderService } from 'browser/services/RenderService';\nimport { ICharSizeService, IRenderService, IMouseService, ISelectionService, ICoreBrowserService, ICharacterJoinerService, IThemeService } from 'browser/services/Services';\nimport { CharSizeService } from 'browser/services/CharSizeService';\nimport { IBuffer } from 'common/buffer/Types';\nimport { MouseService } from 'browser/services/MouseService';\nimport { Linkifier2 } from 'browser/Linkifier2';\nimport { CoreBrowserService } from 'browser/services/CoreBrowserService';\nimport { CoreTerminal } from 'common/CoreTerminal';\nimport { color, rgba } from 'common/Color';\nimport { CharacterJoinerService } from 'browser/services/CharacterJoinerService';\nimport { toRgbString } from 'common/input/XParseColor';\nimport { BufferDecorationRenderer } from 'browser/decorations/BufferDecorationRenderer';\nimport { OverviewRulerRenderer } from 'browser/decorations/OverviewRulerRenderer';\nimport { DecorationService } from 'common/services/DecorationService';\nimport { IDecorationService } from 'common/services/Services';\nimport { OscLinkProvider } from 'browser/OscLinkProvider';\nimport { toDisposable } from 'common/Lifecycle';\nimport { ThemeService } from 'browser/services/ThemeService';\n\n// Let it work inside Node.js for automated testing purposes.\nconst document: Document = (typeof window !== 'undefined') ? window.document : null as any;\n\nexport class Terminal extends CoreTerminal implements ITerminal {\n public textarea: HTMLTextAreaElement | undefined;\n public element: HTMLElement | undefined;\n public screenElement: HTMLElement | undefined;\n\n private _document: Document | undefined;\n private _viewportScrollArea: HTMLElement | undefined;\n private _viewportElement: HTMLElement | undefined;\n private _helperContainer: HTMLElement | undefined;\n private _compositionView: HTMLElement | undefined;\n\n private _overviewRulerRenderer: OverviewRulerRenderer | undefined;\n\n // private _visualBellTimer: number;\n\n public browser: IBrowser = Browser as any;\n\n private _customKeyEventHandler: CustomKeyEventHandler | undefined;\n\n // browser services\n private _decorationService: DecorationService;\n private _charSizeService: ICharSizeService | undefined;\n private _coreBrowserService: ICoreBrowserService | undefined;\n private _mouseService: IMouseService | undefined;\n private _renderService: IRenderService | undefined;\n private _themeService: IThemeService | undefined;\n private _characterJoinerService: ICharacterJoinerService | undefined;\n private _selectionService: ISelectionService | undefined;\n\n /**\n * Records whether the keydown event has already been handled and triggered a data event, if so\n * the keypress event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyDownHandled: boolean = false;\n\n /**\n * Records whether a keydown event has occured since the last keyup event, i.e. whether a key\n * is currently \"pressed\".\n */\n private _keyDownSeen: boolean = false;\n\n /**\n * Records whether the keypress event has already been handled and triggered a data event, if so\n * the input event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyPressHandled: boolean = false;\n\n /**\n * Records whether there has been a keydown event for a dead key without a corresponding keydown\n * event for the composed/alternative character. If we cancel the keydown event for the dead key,\n * no events will be emitted for the final character.\n */\n private _unprocessedDeadKey: boolean = false;\n\n public linkifier2: ILinkifier2;\n public viewport: IViewport | undefined;\n private _compositionHelper: ICompositionHelper | undefined;\n private _accessibilityManager: AccessibilityManager | undefined;\n\n private readonly _onCursorMove = this.register(new EventEmitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onKey = this.register(new EventEmitter<{ key: string, domEvent: KeyboardEvent }>());\n public readonly onKey = this._onKey.event;\n private readonly _onRender = this.register(new EventEmitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onSelectionChange = this.register(new EventEmitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onTitleChange = this.register(new EventEmitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onBell = this.register(new EventEmitter());\n public readonly onBell = this._onBell.event;\n\n private _onFocus = this.register(new EventEmitter());\n public get onFocus(): IEvent { return this._onFocus.event; }\n private _onBlur = this.register(new EventEmitter());\n public get onBlur(): IEvent { return this._onBlur.event; }\n private _onA11yCharEmitter = this.register(new EventEmitter());\n public get onA11yChar(): IEvent { return this._onA11yCharEmitter.event; }\n private _onA11yTabEmitter = this.register(new EventEmitter());\n public get onA11yTab(): IEvent { return this._onA11yTabEmitter.event; }\n private _onWillOpen = this.register(new EventEmitter());\n public get onWillOpen(): IEvent { return this._onWillOpen.event; }\n\n /**\n * Creates a new `Terminal` object.\n *\n * @param options An object containing a set of options, the available options are:\n * - `cursorBlink` (boolean): Whether the terminal cursor blinks\n * - `cols` (number): The number of columns of the terminal (horizontal size)\n * - `rows` (number): The number of rows of the terminal (vertical size)\n *\n * @public\n * @class Xterm Xterm\n * @alias module:xterm/src/xterm\n */\n constructor(\n options: Partial = {}\n ) {\n super(options);\n\n this._setup();\n\n this.linkifier2 = this.register(this._instantiationService.createInstance(Linkifier2));\n this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(OscLinkProvider));\n this._decorationService = this._instantiationService.createInstance(DecorationService);\n this._instantiationService.setService(IDecorationService, this._decorationService);\n\n // Setup InputHandler listeners\n this.register(this._inputHandler.onRequestBell(() => this._onBell.fire()));\n this.register(this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end)));\n this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus()));\n this.register(this._inputHandler.onRequestReset(() => this.reset()));\n this.register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));\n this.register(this._inputHandler.onColor((event) => this._handleColorEvent(event)));\n this.register(forwardEvent(this._inputHandler.onCursorMove, this._onCursorMove));\n this.register(forwardEvent(this._inputHandler.onTitleChange, this._onTitleChange));\n this.register(forwardEvent(this._inputHandler.onA11yChar, this._onA11yCharEmitter));\n this.register(forwardEvent(this._inputHandler.onA11yTab, this._onA11yTabEmitter));\n\n // Setup listeners\n this.register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));\n\n this.register(toDisposable(() => {\n this._customKeyEventHandler = undefined;\n this.element?.parentNode?.removeChild(this.element);\n }));\n }\n\n /**\n * Handle color event from inputhandler for OSC 4|104 | 10|110 | 11|111 | 12|112.\n * An event from OSC 4|104 may contain multiple set or report requests, and multiple\n * or none restore requests (resetting all),\n * while an event from OSC 10|110 | 11|111 | 12|112 always contains a single request.\n */\n private _handleColorEvent(event: IColorEvent): void {\n if (!this._themeService) return;\n for (const req of event) {\n let acc: 'foreground' | 'background' | 'cursor' | 'ansi';\n let ident = '';\n switch (req.index) {\n case ColorIndex.FOREGROUND: // OSC 10 | 110\n acc = 'foreground';\n ident = '10';\n break;\n case ColorIndex.BACKGROUND: // OSC 11 | 111\n acc = 'background';\n ident = '11';\n break;\n case ColorIndex.CURSOR: // OSC 12 | 112\n acc = 'cursor';\n ident = '12';\n break;\n default: // OSC 4 | 104\n // we can skip the [0..255] range check here (already done in inputhandler)\n acc = 'ansi';\n ident = '4;' + req.index;\n }\n switch (req.type) {\n case ColorRequestType.REPORT:\n const channels = color.toColorRGB(acc === 'ansi'\n ? this._themeService.colors.ansi[req.index]\n : this._themeService.colors[acc]);\n this.coreService.triggerDataEvent(`${C0.ESC}]${ident};${toRgbString(channels)}${C1_ESCAPED.ST}`);\n break;\n case ColorRequestType.SET:\n if (acc === 'ansi') {\n this._themeService.modifyColors(colors => colors.ansi[req.index] = rgba.toColor(...req.color));\n } else {\n const narrowedAcc = acc;\n this._themeService.modifyColors(colors => colors[narrowedAcc] = rgba.toColor(...req.color));\n }\n break;\n case ColorRequestType.RESTORE:\n this._themeService.restoreColor(req.index);\n break;\n }\n }\n }\n\n protected _setup(): void {\n super._setup();\n\n this._customKeyEventHandler = undefined;\n }\n\n /**\n * Convenience property to active buffer.\n */\n public get buffer(): IBuffer {\n return this.buffers.active;\n }\n\n /**\n * Focus the terminal. Delegates focus handling to the terminal's DOM element.\n */\n public focus(): void {\n if (this.textarea) {\n this.textarea.focus({ preventScroll: true });\n }\n }\n\n private _handleScreenReaderModeOptionChange(value: boolean): void {\n if (value) {\n if (!this._accessibilityManager && this._renderService) {\n this._accessibilityManager = new AccessibilityManager(this, this._renderService);\n }\n } else {\n this._accessibilityManager?.dispose();\n this._accessibilityManager = undefined;\n }\n }\n\n /**\n * Binds the desired focus behavior on a given terminal object.\n */\n private _handleTextAreaFocus(ev: KeyboardEvent): void {\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n }\n this.updateCursorStyle(ev);\n this.element!.classList.add('focus');\n this._showCursor();\n this._onFocus.fire();\n }\n\n /**\n * Blur the terminal, calling the blur function on the terminal's underlying\n * textarea.\n */\n public blur(): void {\n return this.textarea?.blur();\n }\n\n /**\n * Binds the desired blur behavior on a given terminal object.\n */\n private _handleTextAreaBlur(): void {\n // Text can safely be removed on blur. Doing it earlier could interfere with\n // screen readers reading it out.\n this.textarea!.value = '';\n this.refresh(this.buffer.y, this.buffer.y);\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n this.element!.classList.remove('focus');\n this._onBlur.fire();\n }\n\n private _syncTextArea(): void {\n if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper!.isComposing || !this._renderService) {\n return;\n }\n const cursorY = this.buffer.ybase + this.buffer.y;\n const bufferLine = this.buffer.lines.get(cursorY);\n if (!bufferLine) {\n return;\n }\n const cursorX = Math.min(this.buffer.x, this.cols - 1);\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const width = bufferLine.getWidth(cursorX);\n const cellWidth = this._renderService.dimensions.css.cell.width * width;\n const cursorTop = this.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n this.textarea.style.left = cursorLeft + 'px';\n this.textarea.style.top = cursorTop + 'px';\n this.textarea.style.width = cellWidth + 'px';\n this.textarea.style.height = cellHeight + 'px';\n this.textarea.style.lineHeight = cellHeight + 'px';\n this.textarea.style.zIndex = '-5';\n }\n\n /**\n * Initialize default behavior\n */\n private _initGlobal(): void {\n this._bindKeys();\n\n // Bind clipboard functionality\n this.register(addDisposableDomListener(this.element!, 'copy', (event: ClipboardEvent) => {\n // If mouse events are active it means the selection manager is disabled and\n // copy should be handled by the host program.\n if (!this.hasSelection()) {\n return;\n }\n copyHandler(event, this._selectionService!);\n }));\n const pasteHandlerWrapper = (event: ClipboardEvent): void => handlePasteEvent(event, this.textarea!, this.coreService);\n this.register(addDisposableDomListener(this.textarea!, 'paste', pasteHandlerWrapper));\n this.register(addDisposableDomListener(this.element!, 'paste', pasteHandlerWrapper));\n\n // Handle right click context menus\n if (Browser.isFirefox) {\n // Firefox doesn't appear to fire the contextmenu event on right click\n this.register(addDisposableDomListener(this.element!, 'mousedown', (event: MouseEvent) => {\n if (event.button === 2) {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }\n }));\n } else {\n this.register(addDisposableDomListener(this.element!, 'contextmenu', (event: MouseEvent) => {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }));\n }\n\n // Move the textarea under the cursor when middle clicking on Linux to ensure\n // middle click to paste selection works. This only appears to work in Chrome\n // at the time is writing.\n if (Browser.isLinux) {\n // Use auxclick event over mousedown the latter doesn't seem to work. Note\n // that the regular click event doesn't fire for the middle mouse button.\n this.register(addDisposableDomListener(this.element!, 'auxclick', (event: MouseEvent) => {\n if (event.button === 1) {\n moveTextAreaUnderMouseCursor(event, this.textarea!, this.screenElement!);\n }\n }));\n }\n }\n\n /**\n * Apply key handling to the terminal\n */\n private _bindKeys(): void {\n this.register(addDisposableDomListener(this.textarea!, 'keyup', (ev: KeyboardEvent) => this._keyUp(ev), true));\n this.register(addDisposableDomListener(this.textarea!, 'keydown', (ev: KeyboardEvent) => this._keyDown(ev), true));\n this.register(addDisposableDomListener(this.textarea!, 'keypress', (ev: KeyboardEvent) => this._keyPress(ev), true));\n this.register(addDisposableDomListener(this.textarea!, 'compositionstart', () => this._compositionHelper!.compositionstart()));\n this.register(addDisposableDomListener(this.textarea!, 'compositionupdate', (e: CompositionEvent) => this._compositionHelper!.compositionupdate(e)));\n this.register(addDisposableDomListener(this.textarea!, 'compositionend', () => this._compositionHelper!.compositionend()));\n this.register(addDisposableDomListener(this.textarea!, 'input', (ev: InputEvent) => this._inputEvent(ev), true));\n this.register(this.onRender(() => this._compositionHelper!.updateCompositionElements()));\n }\n\n /**\n * Opens the terminal within an element.\n *\n * @param parent The element to create the terminal within.\n */\n public open(parent: HTMLElement): void {\n if (!parent) {\n throw new Error('Terminal requires a parent element.');\n }\n\n if (!parent.isConnected) {\n this._logService.debug('Terminal.open was called on an element that was not attached to the DOM');\n }\n\n this._document = parent.ownerDocument!;\n\n // Create main element container\n this.element = this._document.createElement('div');\n this.element.dir = 'ltr'; // xterm.css assumes LTR\n this.element.classList.add('terminal');\n this.element.classList.add('xterm');\n this.element.setAttribute('tabindex', '0');\n parent.appendChild(this.element);\n\n // Performance: Use a document fragment to build the terminal\n // viewport and helper elements detached from the DOM\n const fragment = document.createDocumentFragment();\n this._viewportElement = document.createElement('div');\n this._viewportElement.classList.add('xterm-viewport');\n fragment.appendChild(this._viewportElement);\n\n this._viewportScrollArea = document.createElement('div');\n this._viewportScrollArea.classList.add('xterm-scroll-area');\n this._viewportElement.appendChild(this._viewportScrollArea);\n\n this.screenElement = document.createElement('div');\n this.screenElement.classList.add('xterm-screen');\n // Create the container that will hold helpers like the textarea for\n // capturing DOM Events. Then produce the helpers.\n this._helperContainer = document.createElement('div');\n this._helperContainer.classList.add('xterm-helpers');\n this.screenElement.appendChild(this._helperContainer);\n fragment.appendChild(this.screenElement);\n\n this.textarea = document.createElement('textarea');\n this.textarea.classList.add('xterm-helper-textarea');\n this.textarea.setAttribute('aria-label', Strings.promptLabel);\n if (!Browser.isChromeOS) {\n // ChromeVox on ChromeOS does not like this. See\n // https://issuetracker.google.com/issues/260170397\n this.textarea.setAttribute('aria-multiline', 'false');\n }\n this.textarea.setAttribute('autocorrect', 'off');\n this.textarea.setAttribute('autocapitalize', 'off');\n this.textarea.setAttribute('spellcheck', 'false');\n this.textarea.tabIndex = 0;\n\n // Register the core browser service before the generic textarea handlers are registered so it\n // handles them first. Otherwise the renderers may use the wrong focus state.\n this._coreBrowserService = this._instantiationService.createInstance(CoreBrowserService, this.textarea, this._document.defaultView ?? window);\n this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);\n\n this.register(addDisposableDomListener(this.textarea, 'focus', (ev: KeyboardEvent) => this._handleTextAreaFocus(ev)));\n this.register(addDisposableDomListener(this.textarea, 'blur', () => this._handleTextAreaBlur()));\n this._helperContainer.appendChild(this.textarea);\n\n\n this._charSizeService = this._instantiationService.createInstance(CharSizeService, this._document, this._helperContainer);\n this._instantiationService.setService(ICharSizeService, this._charSizeService);\n\n this._themeService = this._instantiationService.createInstance(ThemeService);\n this._instantiationService.setService(IThemeService, this._themeService);\n\n this._characterJoinerService = this._instantiationService.createInstance(CharacterJoinerService);\n this._instantiationService.setService(ICharacterJoinerService, this._characterJoinerService);\n\n this._renderService = this.register(this._instantiationService.createInstance(RenderService, this.rows, this.screenElement));\n this._instantiationService.setService(IRenderService, this._renderService);\n this.register(this._renderService.onRenderedViewportChange(e => this._onRender.fire(e)));\n this.onResize(e => this._renderService!.resize(e.cols, e.rows));\n\n this._compositionView = document.createElement('div');\n this._compositionView.classList.add('composition-view');\n this._compositionHelper = this._instantiationService.createInstance(CompositionHelper, this.textarea, this._compositionView);\n this._helperContainer.appendChild(this._compositionView);\n\n // Performance: Add viewport and helper elements from the fragment\n this.element.appendChild(fragment);\n\n try {\n this._onWillOpen.fire(this.element);\n }\n catch { /* fails to load addon for some reason */ }\n if (!this._renderService.hasRenderer()) {\n this._renderService.setRenderer(this._createRenderer());\n }\n\n this._mouseService = this._instantiationService.createInstance(MouseService);\n this._instantiationService.setService(IMouseService, this._mouseService);\n\n this.viewport = this._instantiationService.createInstance(Viewport,\n (amount: number) => this.scrollLines(amount, true, ScrollSource.VIEWPORT),\n this._viewportElement,\n this._viewportScrollArea\n );\n this.register(this._inputHandler.onRequestSyncScrollBar(() => this.viewport!.syncScrollArea()));\n this.register(this.viewport);\n\n this.register(this.onCursorMove(() => {\n this._renderService!.handleCursorMove();\n this._syncTextArea();\n }));\n this.register(this.onResize(() => this._renderService!.handleResize(this.cols, this.rows)));\n this.register(this.onBlur(() => this._renderService!.handleBlur()));\n this.register(this.onFocus(() => this._renderService!.handleFocus()));\n this.register(this._renderService.onDimensionsChange(() => this.viewport!.syncScrollArea()));\n\n this._selectionService = this.register(this._instantiationService.createInstance(SelectionService,\n this.element,\n this.screenElement,\n this.linkifier2\n ));\n this._instantiationService.setService(ISelectionService, this._selectionService);\n this.register(this._selectionService.onRequestScrollLines(e => this.scrollLines(e.amount, e.suppressScrollEvent)));\n this.register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire()));\n this.register(this._selectionService.onRequestRedraw(e => this._renderService!.handleSelectionChanged(e.start, e.end, e.columnSelectMode)));\n this.register(this._selectionService.onLinuxMouseSelection(text => {\n // If there's a new selection, put it into the textarea, focus and select it\n // in order to register it as a selection on the OS. This event is fired\n // only on Linux to enable middle click to paste selection.\n this.textarea!.value = text;\n this.textarea!.focus();\n this.textarea!.select();\n }));\n this.register(this._onScroll.event(ev => {\n this.viewport!.syncScrollArea();\n this._selectionService!.refresh();\n }));\n this.register(addDisposableDomListener(this._viewportElement, 'scroll', () => this._selectionService!.refresh()));\n\n this.linkifier2.attachToDom(this.screenElement, this._mouseService, this._renderService);\n this.register(this._instantiationService.createInstance(BufferDecorationRenderer, this.screenElement));\n this.register(addDisposableDomListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.handleMouseDown(e)));\n\n // apply mouse event classes set by escape codes before terminal was attached\n if (this.coreMouseService.areMouseEventsActive) {\n this._selectionService.disable();\n this.element.classList.add('enable-mouse-events');\n } else {\n this._selectionService.enable();\n }\n\n if (this.options.screenReaderMode) {\n // Note that this must be done *after* the renderer is created in order to\n // ensure the correct order of the dprchange event\n this._accessibilityManager = new AccessibilityManager(this, this._renderService);\n }\n this.register(this.optionsService.onSpecificOptionChange('screenReaderMode', e => this._handleScreenReaderModeOptionChange(e)));\n\n if (this.options.overviewRulerWidth) {\n this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n this.optionsService.onSpecificOptionChange('overviewRulerWidth', value => {\n if (!this._overviewRulerRenderer && value && this._viewportElement && this.screenElement) {\n this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n });\n // Measure the character size\n this._charSizeService.measure();\n\n // Setup loop that draws to screen\n this.refresh(0, this.rows - 1);\n\n // Initialize global actions that need to be taken on the document.\n this._initGlobal();\n\n // Listen for mouse events and translate\n // them into terminal mouse protocols.\n this.bindMouse();\n }\n\n private _createRenderer(): IRenderer {\n return this._instantiationService.createInstance(DomRenderer, this.element!, this.screenElement!, this._viewportElement!, this.linkifier2);\n }\n\n /**\n * Bind certain mouse events to the terminal.\n * By default only 3 button + wheel up/down is ativated. For higher buttons\n * no mouse report will be created. Typically the standard actions will be active.\n *\n * There are several reasons not to enable support for higher buttons/wheel:\n * - Button 4 and 5 are typically used for history back and forward navigation,\n * there is no straight forward way to supress/intercept those standard actions.\n * - Support for higher buttons does not work in some platform/browser combinations.\n * - Left/right wheel was not tested.\n * - Emulators vary in mouse button support, typically only 3 buttons and\n * wheel up/down work reliable.\n *\n * TODO: Move mouse event code into its own file.\n */\n public bindMouse(): void {\n const self = this;\n const el = this.element!;\n\n // send event to CoreMouseService\n function sendEvent(ev: MouseEvent | WheelEvent): boolean {\n // get mouse coordinates\n const pos = self._mouseService!.getMouseReportCoords(ev, self.screenElement!);\n if (!pos) {\n return false;\n }\n\n let but: CoreMouseButton;\n let action: CoreMouseAction | undefined;\n switch ((ev as any).overrideType || ev.type) {\n case 'mousemove':\n action = CoreMouseAction.MOVE;\n if (ev.buttons === undefined) {\n // buttons is not supported on macOS, try to get a value from button instead\n but = CoreMouseButton.NONE;\n if (ev.button !== undefined) {\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n }\n } else {\n // according to MDN buttons only reports up to button 5 (AUX2)\n but = ev.buttons & 1 ? CoreMouseButton.LEFT :\n ev.buttons & 4 ? CoreMouseButton.MIDDLE :\n ev.buttons & 2 ? CoreMouseButton.RIGHT :\n CoreMouseButton.NONE; // fallback to NONE\n }\n break;\n case 'mouseup':\n action = CoreMouseAction.UP;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'mousedown':\n action = CoreMouseAction.DOWN;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'wheel':\n const amount = self.viewport!.getLinesScrolled(ev as WheelEvent);\n\n if (amount === 0) {\n return false;\n }\n\n action = (ev as WheelEvent).deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN;\n but = CoreMouseButton.WHEEL;\n break;\n default:\n // dont handle other event types by accident\n return false;\n }\n\n // exit if we cannot determine valid button/action values\n // do nothing for higher buttons than wheel\n if (action === undefined || but === undefined || but > CoreMouseButton.WHEEL) {\n return false;\n }\n\n return self.coreMouseService.triggerMouseEvent({\n col: pos.col,\n row: pos.row,\n x: pos.x,\n y: pos.y,\n button: but,\n action,\n ctrl: ev.ctrlKey,\n alt: ev.altKey,\n shift: ev.shiftKey\n });\n }\n\n /**\n * Event listener state handling.\n * We listen to the onProtocolChange event of CoreMouseService and put\n * requested listeners in `requestedEvents`. With this the listeners\n * have all bits to do the event listener juggling.\n * Note: 'mousedown' currently is \"always on\" and not managed\n * by onProtocolChange.\n */\n const requestedEvents: { [key: string]: ((ev: Event) => void) | null } = {\n mouseup: null,\n wheel: null,\n mousedrag: null,\n mousemove: null\n };\n const eventListeners: { [key: string]: (ev: any) => void | boolean } = {\n mouseup: (ev: MouseEvent) => {\n sendEvent(ev);\n if (!ev.buttons) {\n // if no other button is held remove global handlers\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n if (requestedEvents.mousedrag) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);\n }\n }\n return this.cancel(ev);\n },\n wheel: (ev: WheelEvent) => {\n sendEvent(ev);\n return this.cancel(ev, true);\n },\n mousedrag: (ev: MouseEvent) => {\n // deal only with move while a button is held\n if (ev.buttons) {\n sendEvent(ev);\n }\n },\n mousemove: (ev: MouseEvent) => {\n // deal only with move without any button\n if (!ev.buttons) {\n sendEvent(ev);\n }\n }\n };\n this.register(this.coreMouseService.onProtocolChange(events => {\n // apply global changes on events\n if (events) {\n if (this.optionsService.rawOptions.logLevel === 'debug') {\n this._logService.debug('Binding to mouse events:', this.coreMouseService.explainEvents(events));\n }\n this.element!.classList.add('enable-mouse-events');\n this._selectionService!.disable();\n } else {\n this._logService.debug('Unbinding from mouse events.');\n this.element!.classList.remove('enable-mouse-events');\n this._selectionService!.enable();\n }\n\n // add/remove handlers from requestedEvents\n\n if (!(events & CoreMouseEventType.MOVE)) {\n el.removeEventListener('mousemove', requestedEvents.mousemove!);\n requestedEvents.mousemove = null;\n } else if (!requestedEvents.mousemove) {\n el.addEventListener('mousemove', eventListeners.mousemove);\n requestedEvents.mousemove = eventListeners.mousemove;\n }\n\n if (!(events & CoreMouseEventType.WHEEL)) {\n el.removeEventListener('wheel', requestedEvents.wheel!);\n requestedEvents.wheel = null;\n } else if (!requestedEvents.wheel) {\n el.addEventListener('wheel', eventListeners.wheel, { passive: false });\n requestedEvents.wheel = eventListeners.wheel;\n }\n\n if (!(events & CoreMouseEventType.UP)) {\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n requestedEvents.mouseup = null;\n } else if (!requestedEvents.mouseup) {\n requestedEvents.mouseup = eventListeners.mouseup;\n }\n\n if (!(events & CoreMouseEventType.DRAG)) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag!);\n requestedEvents.mousedrag = null;\n } else if (!requestedEvents.mousedrag) {\n requestedEvents.mousedrag = eventListeners.mousedrag;\n }\n }));\n // force initial onProtocolChange so we dont miss early mouse requests\n this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol;\n\n /**\n * \"Always on\" event listeners.\n */\n this.register(addDisposableDomListener(el, 'mousedown', (ev: MouseEvent) => {\n ev.preventDefault();\n this.focus();\n\n // Don't send the mouse button to the pty if mouse events are disabled or\n // if the selection manager is having selection forced (ie. a modifier is\n // held).\n if (!this.coreMouseService.areMouseEventsActive || this._selectionService!.shouldForceSelection(ev)) {\n return;\n }\n\n sendEvent(ev);\n\n // Register additional global handlers which should keep reporting outside\n // of the terminal element.\n // Note: Other emulators also do this for 'mousedown' while a button\n // is held, we currently limit 'mousedown' to the terminal only.\n if (requestedEvents.mouseup) {\n this._document!.addEventListener('mouseup', requestedEvents.mouseup);\n }\n if (requestedEvents.mousedrag) {\n this._document!.addEventListener('mousemove', requestedEvents.mousedrag);\n }\n\n return this.cancel(ev);\n }));\n\n this.register(addDisposableDomListener(el, 'wheel', (ev: WheelEvent) => {\n // do nothing, if app side handles wheel itself\n if (requestedEvents.wheel) return;\n\n if (!this.buffer.hasScrollback) {\n // Convert wheel events into up/down events when the buffer does not have scrollback, this\n // enables scrolling in apps hosted in the alt buffer such as vim or tmux.\n const amount = this.viewport!.getLinesScrolled(ev);\n\n // Do nothing if there's no vertical scroll\n if (amount === 0) {\n return;\n }\n\n // Construct and send sequences\n const sequence = C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? 'O' : '[') + (ev.deltaY < 0 ? 'A' : 'B');\n let data = '';\n for (let i = 0; i < Math.abs(amount); i++) {\n data += sequence;\n }\n this.coreService.triggerDataEvent(data, true);\n return this.cancel(ev, true);\n }\n\n // normal viewport scrolling\n // conditionally stop event, if the viewport still had rows to scroll within\n if (this.viewport!.handleWheel(ev)) {\n return this.cancel(ev);\n }\n }, { passive: false }));\n\n this.register(addDisposableDomListener(el, 'touchstart', (ev: TouchEvent) => {\n if (this.coreMouseService.areMouseEventsActive) return;\n this.viewport!.handleTouchStart(ev);\n return this.cancel(ev);\n }, { passive: true }));\n\n this.register(addDisposableDomListener(el, 'touchmove', (ev: TouchEvent) => {\n if (this.coreMouseService.areMouseEventsActive) return;\n if (!this.viewport!.handleTouchMove(ev)) {\n return this.cancel(ev);\n }\n }, { passive: false }));\n }\n\n\n /**\n * Tells the renderer to refresh terminal content between two rows (inclusive) at the next\n * opportunity.\n * @param start The row to start from (between 0 and this.rows - 1).\n * @param end The row to end at (between start and this.rows - 1).\n */\n public refresh(start: number, end: number): void {\n this._renderService?.refreshRows(start, end);\n }\n\n /**\n * Change the cursor style for different selection modes\n */\n public updateCursorStyle(ev: KeyboardEvent): void {\n if (this._selectionService?.shouldColumnSelect(ev)) {\n this.element!.classList.add('column-select');\n } else {\n this.element!.classList.remove('column-select');\n }\n }\n\n /**\n * Display the cursor element\n */\n private _showCursor(): void {\n if (!this.coreService.isCursorInitialized) {\n this.coreService.isCursorInitialized = true;\n this.refresh(this.buffer.y, this.buffer.y);\n }\n }\n\n public scrollLines(disp: number, suppressScrollEvent?: boolean, source = ScrollSource.TERMINAL): void {\n super.scrollLines(disp, suppressScrollEvent, source);\n this.refresh(0, this.rows - 1);\n }\n\n public paste(data: string): void {\n paste(data, this.textarea!, this.coreService);\n }\n\n /**\n * Attaches a custom key event handler which is run before keys are processed,\n * giving consumers of xterm.js ultimate control as to what keys should be\n * processed by the terminal and what keys should not.\n * @param customKeyEventHandler The custom KeyboardEvent handler to attach.\n * This is a function that takes a KeyboardEvent, allowing consumers to stop\n * propagation and/or prevent the default action. The function returns whether\n * the event should be processed by xterm.js.\n */\n public attachCustomKeyEventHandler(customKeyEventHandler: CustomKeyEventHandler): void {\n this._customKeyEventHandler = customKeyEventHandler;\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this.linkifier2.registerLinkProvider(linkProvider);\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n const joinerId = this._characterJoinerService.register(handler);\n this.refresh(0, this.rows - 1);\n return joinerId;\n }\n\n public deregisterCharacterJoiner(joinerId: number): void {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n if (this._characterJoinerService.deregister(joinerId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n\n public get markers(): IMarker[] {\n return this.buffer.markers;\n }\n\n public addMarker(cursorYOffset: number): IMarker | undefined {\n return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);\n }\n\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n return this._decorationService.registerDecoration(decorationOptions);\n }\n\n /**\n * Gets whether the terminal has an active selection.\n */\n public hasSelection(): boolean {\n return this._selectionService ? this._selectionService.hasSelection : false;\n }\n\n /**\n * Selects text within the terminal.\n * @param column The column the selection starts at..\n * @param row The row the selection starts at.\n * @param length The length of the selection.\n */\n public select(column: number, row: number, length: number): void {\n this._selectionService!.setSelection(column, row, length);\n }\n\n /**\n * Gets the terminal's current selection, this is useful for implementing copy\n * behavior outside of xterm.js.\n */\n public getSelection(): string {\n return this._selectionService ? this._selectionService.selectionText : '';\n }\n\n public getSelectionPosition(): IBufferRange | undefined {\n if (!this._selectionService || !this._selectionService.hasSelection) {\n return undefined;\n }\n\n return {\n start: {\n x: this._selectionService.selectionStart![0],\n y: this._selectionService.selectionStart![1]\n },\n end: {\n x: this._selectionService.selectionEnd![0],\n y: this._selectionService.selectionEnd![1]\n }\n };\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._selectionService?.clearSelection();\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._selectionService?.selectAll();\n }\n\n public selectLines(start: number, end: number): void {\n this._selectionService?.selectLines(start, end);\n }\n\n /**\n * Handle a keydown [KeyboardEvent].\n *\n * [KeyboardEvent]: https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n */\n protected _keyDown(event: KeyboardEvent): boolean | undefined {\n this._keyDownHandled = false;\n this._keyDownSeen = true;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(event) === false) {\n return false;\n }\n\n // Ignore composing with Alt key on Mac when macOptionIsMeta is enabled\n const shouldIgnoreComposition = this.browser.isMac && this.options.macOptionIsMeta && event.altKey;\n\n if (!shouldIgnoreComposition && !this._compositionHelper!.keydown(event)) {\n if (this.options.scrollOnUserInput && this.buffer.ybase !== this.buffer.ydisp) {\n this._bufferService.scrollToBottom();\n }\n return false;\n }\n\n if (!shouldIgnoreComposition && (event.key === 'Dead' || event.key === 'AltGraph')) {\n this._unprocessedDeadKey = true;\n }\n\n const result = evaluateKeyboardEvent(event, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);\n\n this.updateCursorStyle(event);\n\n if (result.type === KeyboardResultType.PAGE_DOWN || result.type === KeyboardResultType.PAGE_UP) {\n const scrollCount = this.rows - 1;\n this.scrollLines(result.type === KeyboardResultType.PAGE_UP ? -scrollCount : scrollCount);\n return this.cancel(event, true);\n }\n\n if (result.type === KeyboardResultType.SELECT_ALL) {\n this.selectAll();\n }\n\n if (this._isThirdLevelShift(this.browser, event)) {\n return true;\n }\n\n if (result.cancel) {\n // The event is canceled at the end already, is this necessary?\n this.cancel(event, true);\n }\n\n if (!result.key) {\n return true;\n }\n\n // HACK: Process A-Z in the keypress event to fix an issue with macOS IMEs where lower case\n // letters cannot be input while caps lock is on.\n if (event.key && !event.ctrlKey && !event.altKey && !event.metaKey && event.key.length === 1) {\n if (event.key.charCodeAt(0) >= 65 && event.key.charCodeAt(0) <= 90) {\n return true;\n }\n }\n\n if (this._unprocessedDeadKey) {\n this._unprocessedDeadKey = false;\n return true;\n }\n\n // If ctrl+c or enter is being sent, clear out the textarea. This is done so that screen readers\n // will announce deleted characters. This will not work 100% of the time but it should cover\n // most scenarios.\n if (result.key === C0.ETX || result.key === C0.CR) {\n this.textarea!.value = '';\n }\n\n this._onKey.fire({ key: result.key, domEvent: event });\n this._showCursor();\n this.coreService.triggerDataEvent(result.key, true);\n\n // Cancel events when not in screen reader mode so events don't get bubbled up and handled by\n // other listeners. When screen reader mode is enabled, we don't cancel them (unless ctrl or alt\n // is also depressed) so that the cursor textarea can be updated, which triggers the screen\n // reader to read it.\n if (!this.optionsService.rawOptions.screenReaderMode || event.altKey || event.ctrlKey) {\n return this.cancel(event, true);\n }\n\n this._keyDownHandled = true;\n }\n\n private _isThirdLevelShift(browser: IBrowser, ev: KeyboardEvent): boolean {\n const thirdLevelKey =\n (browser.isMac && !this.options.macOptionIsMeta && ev.altKey && !ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.altKey && ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.getModifierState('AltGraph'));\n\n if (ev.type === 'keypress') {\n return thirdLevelKey;\n }\n\n // Don't invoke for arrows, pageDown, home, backspace, etc. (on non-keypress events)\n return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);\n }\n\n protected _keyUp(ev: KeyboardEvent): void {\n this._keyDownSeen = false;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return;\n }\n\n if (!wasModifierKeyOnlyEvent(ev)) {\n this.focus();\n }\n\n this.updateCursorStyle(ev);\n this._keyPressHandled = false;\n }\n\n /**\n * Handle a keypress event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n * @param ev The keypress event to be handled.\n */\n protected _keyPress(ev: KeyboardEvent): boolean {\n let key;\n\n this._keyPressHandled = false;\n\n if (this._keyDownHandled) {\n return false;\n }\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return false;\n }\n\n this.cancel(ev);\n\n if (ev.charCode) {\n key = ev.charCode;\n } else if (ev.which === null || ev.which === undefined) {\n key = ev.keyCode;\n } else if (ev.which !== 0 && ev.charCode !== 0) {\n key = ev.which;\n } else {\n return false;\n }\n\n if (!key || (\n (ev.altKey || ev.ctrlKey || ev.metaKey) && !this._isThirdLevelShift(this.browser, ev)\n )) {\n return false;\n }\n\n key = String.fromCharCode(key);\n\n this._onKey.fire({ key, domEvent: ev });\n this._showCursor();\n this.coreService.triggerDataEvent(key, true);\n\n this._keyPressHandled = true;\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n return true;\n }\n\n /**\n * Handle an input event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/Web/API/InputEvent\n * @param ev The input event to be handled.\n */\n protected _inputEvent(ev: InputEvent): boolean {\n // Only support emoji IMEs when screen reader mode is disabled as the event must bubble up to\n // support reading out character input which can doubling up input characters\n // Based on these event traces: https://github.com/xtermjs/xterm.js/issues/3679\n if (ev.data && ev.inputType === 'insertText' && (!ev.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {\n if (this._keyPressHandled) {\n return false;\n }\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n const text = ev.data;\n this.coreService.triggerDataEvent(text, true);\n\n this.cancel(ev);\n return true;\n }\n\n return false;\n }\n\n /**\n * Resizes the terminal.\n *\n * @param x The number of columns to resize to.\n * @param y The number of rows to resize to.\n */\n public resize(x: number, y: number): void {\n if (x === this.cols && y === this.rows) {\n // Check if we still need to measure the char size (fixes #785).\n if (this._charSizeService && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n return;\n }\n\n super.resize(x, y);\n }\n\n private _afterResize(x: number, y: number): void {\n this._charSizeService?.measure();\n\n // Sync the scroll area to make sure scroll events don't fire and scroll the viewport to an\n // invalid location\n this.viewport?.syncScrollArea(true);\n }\n\n /**\n * Clear the entire buffer, making the prompt line the new first line.\n */\n public clear(): void {\n if (this.buffer.ybase === 0 && this.buffer.y === 0) {\n // Don't clear if it's already clear\n return;\n }\n this.buffer.clearAllMarkers();\n this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);\n this.buffer.lines.length = 1;\n this.buffer.ydisp = 0;\n this.buffer.ybase = 0;\n this.buffer.y = 0;\n for (let i = 1; i < this.rows; i++) {\n this.buffer.lines.push(this.buffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n this.refresh(0, this.rows - 1);\n this._onScroll.fire({ position: this.buffer.ydisp, source: ScrollSource.TERMINAL });\n }\n\n /**\n * Reset terminal.\n * Note: Calling this directly from JS is synchronous but does not clear\n * input buffers and does not reset the parser, thus the terminal will\n * continue to apply pending input data.\n * If you need in band reset (synchronous with input data) consider\n * using DECSTR (soft reset, CSI ! p) or RIS instead (hard reset, ESC c).\n */\n public reset(): void {\n /**\n * Since _setup handles a full terminal creation, we have to carry forward\n * a few things that should not reset.\n */\n this.options.rows = this.rows;\n this.options.cols = this.cols;\n const customKeyEventHandler = this._customKeyEventHandler;\n\n this._setup();\n super.reset();\n this._selectionService?.reset();\n this._decorationService.reset();\n\n // reattach\n this._customKeyEventHandler = customKeyEventHandler;\n\n // do a full screen refresh\n this.refresh(0, this.rows - 1);\n this.viewport?.syncScrollArea();\n }\n\n public clearTextureAtlas(): void {\n this._renderService?.clearTextureAtlas();\n }\n\n private _reportFocus(): void {\n if (this.element?.classList.contains('focus')) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n } else {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n }\n\n private _reportWindowsOptions(type: WindowsOptionsReportType): void {\n if (!this._renderService) {\n return;\n }\n\n switch (type) {\n case WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:\n const canvasWidth = this._renderService.dimensions.css.canvas.width.toFixed(0);\n const canvasHeight = this._renderService.dimensions.css.canvas.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[4;${canvasHeight};${canvasWidth}t`);\n break;\n case WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:\n const cellWidth = this._renderService.dimensions.css.cell.width.toFixed(0);\n const cellHeight = this._renderService.dimensions.css.cell.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[6;${cellHeight};${cellWidth}t`);\n break;\n }\n }\n\n // TODO: Remove cancel function and cancelEvents option\n public cancel(ev: Event, force?: boolean): boolean | undefined {\n if (!this.options.cancelEvents && !force) {\n return;\n }\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n }\n}\n\n/**\n * Helpers\n */\n\nfunction wasModifierKeyOnlyEvent(ev: KeyboardEvent): boolean {\n return ev.keyCode === 16 || // Shift\n ev.keyCode === 17 || // Ctrl\n ev.keyCode === 18; // Alt\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nconst RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second\n\nimport { IRenderDebouncer } from 'browser/Types';\n\n/**\n * Debounces calls to update screen readers to update at most once configurable interval of time.\n */\nexport class TimeBasedDebouncer implements IRenderDebouncer {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n\n // The last moment that the Terminal was refreshed at\n private _lastRefreshMs = 0;\n // Whether a trailing refresh should be triggered due to a refresh request that was throttled\n private _additionalRefreshRequested = false;\n\n private _refreshTimeoutID: number | undefined;\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _debounceThresholdMS = RENDER_DEBOUNCE_THRESHOLD_MS\n ) {\n }\n\n public dispose(): void {\n if (this._refreshTimeoutID) {\n clearTimeout(this._refreshTimeoutID);\n }\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart !== undefined ? rowStart : 0;\n rowEnd = rowEnd !== undefined ? rowEnd : this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n // Only refresh if the time since last refresh is above a threshold, otherwise wait for\n // enough time to pass before refreshing again.\n const refreshRequestTime: number = Date.now();\n if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {\n // Enough time has lapsed since the last refresh; refresh immediately\n this._lastRefreshMs = refreshRequestTime;\n this._innerRefresh();\n } else if (!this._additionalRefreshRequested) {\n // This is the first additional request throttled; set up trailing refresh\n const elapsed = refreshRequestTime - this._lastRefreshMs;\n const waitPeriodBeforeTrailingRefresh = this._debounceThresholdMS - elapsed;\n this._additionalRefreshRequested = true;\n\n this._refreshTimeoutID = window.setTimeout(() => {\n this._lastRefreshMs = Date.now();\n this._innerRefresh();\n this._additionalRefreshRequested = false;\n this._refreshTimeoutID = undefined; // No longer need to clear the timeout\n }, waitPeriodBeforeTrailingRefresh);\n }\n }\n\n private _innerRefresh(): void {\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n }\n}\n\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IColorSet, IViewport, ReadonlyColorSet } from 'browser/Types';\nimport { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IRenderDimensions } from 'browser/renderer/shared/Types';\n\nconst FALLBACK_SCROLL_BAR_WIDTH = 15;\n\ninterface ISmoothScrollState {\n startTime: number;\n origin: number;\n target: number;\n}\n\n/**\n * Represents the viewport of a terminal, the visible area within the larger buffer of output.\n * Logic for the virtual scroll bar is included in this object.\n */\nexport class Viewport extends Disposable implements IViewport {\n public scrollBarWidth: number = 0;\n private _currentRowHeight: number = 0;\n private _currentDeviceCellHeight: number = 0;\n private _lastRecordedBufferLength: number = 0;\n private _lastRecordedViewportHeight: number = 0;\n private _lastRecordedBufferHeight: number = 0;\n private _lastTouchY: number = 0;\n private _lastScrollTop: number = 0;\n private _activeBuffer: IBuffer;\n private _renderDimensions: IRenderDimensions;\n\n // Stores a partial line amount when scrolling, this is used to keep track of how much of a line\n // is scrolled so we can \"scroll\" over partial lines and feel natural on touchpads. This is a\n // quick fix and could have a more robust solution in place that reset the value when needed.\n private _wheelPartialScroll: number = 0;\n\n private _refreshAnimationFrame: number | null = null;\n private _ignoreNextScrollEvent: boolean = false;\n private _smoothScrollState: ISmoothScrollState = {\n startTime: 0,\n origin: -1,\n target: -1\n };\n\n constructor(\n private readonly _scrollLines: (amount: number) => void,\n private readonly _viewportElement: HTMLElement,\n private readonly _scrollArea: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IRenderService private readonly _renderService: IRenderService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IThemeService themeService: IThemeService\n ) {\n super();\n\n // Measure the width of the scrollbar. If it is 0 we can assume it's an OSX overlay scrollbar.\n // Unfortunately the overlay scrollbar would be hidden underneath the screen element in that case,\n // therefore we account for a standard amount to make it visible\n this.scrollBarWidth = (this._viewportElement.offsetWidth - this._scrollArea.offsetWidth) || FALLBACK_SCROLL_BAR_WIDTH;\n this.register(addDisposableDomListener(this._viewportElement, 'scroll', this._handleScroll.bind(this)));\n\n // Track properties used in performance critical code manually to avoid using slow getters\n this._activeBuffer = this._bufferService.buffer;\n this.register(this._bufferService.buffers.onBufferActivate(e => this._activeBuffer = e.activeBuffer));\n this._renderDimensions = this._renderService.dimensions;\n this.register(this._renderService.onDimensionsChange(e => this._renderDimensions = e));\n\n this._handleThemeChange(themeService.colors);\n this.register(themeService.onChangeColors(e => this._handleThemeChange(e)));\n this.register(this._optionsService.onSpecificOptionChange('scrollback', () => this.syncScrollArea()));\n\n // Perform this async to ensure the ICharSizeService is ready.\n setTimeout(() => this.syncScrollArea(), 0);\n }\n\n private _handleThemeChange(colors: ReadonlyColorSet): void {\n this._viewportElement.style.backgroundColor = colors.background.css;\n }\n\n /**\n * Refreshes row height, setting line-height, viewport height and scroll area height if\n * necessary.\n */\n private _refresh(immediate: boolean): void {\n if (immediate) {\n this._innerRefresh();\n if (this._refreshAnimationFrame !== null) {\n this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame);\n }\n return;\n }\n if (this._refreshAnimationFrame === null) {\n this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n }\n\n private _innerRefresh(): void {\n if (this._charSizeService.height > 0) {\n this._currentRowHeight = this._renderService.dimensions.device.cell.height / this._coreBrowserService.dpr;\n this._currentDeviceCellHeight = this._renderService.dimensions.device.cell.height;\n this._lastRecordedViewportHeight = this._viewportElement.offsetHeight;\n const newBufferHeight = Math.round(this._currentRowHeight * this._lastRecordedBufferLength) + (this._lastRecordedViewportHeight - this._renderService.dimensions.css.canvas.height);\n if (this._lastRecordedBufferHeight !== newBufferHeight) {\n this._lastRecordedBufferHeight = newBufferHeight;\n this._scrollArea.style.height = this._lastRecordedBufferHeight + 'px';\n }\n }\n\n // Sync scrollTop\n const scrollTop = this._bufferService.buffer.ydisp * this._currentRowHeight;\n if (this._viewportElement.scrollTop !== scrollTop) {\n // Ignore the next scroll event which will be triggered by setting the scrollTop as we do not\n // want this event to scroll the terminal\n this._ignoreNextScrollEvent = true;\n this._viewportElement.scrollTop = scrollTop;\n }\n\n this._refreshAnimationFrame = null;\n }\n\n /**\n * Updates dimensions and synchronizes the scroll area if necessary.\n */\n public syncScrollArea(immediate: boolean = false): void {\n // If buffer height changed\n if (this._lastRecordedBufferLength !== this._bufferService.buffer.lines.length) {\n this._lastRecordedBufferLength = this._bufferService.buffer.lines.length;\n this._refresh(immediate);\n return;\n }\n\n // If viewport height changed\n if (this._lastRecordedViewportHeight !== this._renderService.dimensions.css.canvas.height) {\n this._refresh(immediate);\n return;\n }\n\n // If the buffer position doesn't match last scroll top\n if (this._lastScrollTop !== this._activeBuffer.ydisp * this._currentRowHeight) {\n this._refresh(immediate);\n return;\n }\n\n // If row height changed\n if (this._renderDimensions.device.cell.height !== this._currentDeviceCellHeight) {\n this._refresh(immediate);\n return;\n }\n }\n\n /**\n * Handles scroll events on the viewport, calculating the new viewport and requesting the\n * terminal to scroll to it.\n * @param ev The scroll event.\n */\n private _handleScroll(ev: Event): void {\n // Record current scroll top position\n this._lastScrollTop = this._viewportElement.scrollTop;\n\n // Don't attempt to scroll if the element is not visible, otherwise scrollTop will be corrupt\n // which causes the terminal to scroll the buffer to the top\n if (!this._viewportElement.offsetParent) {\n return;\n }\n\n // Ignore the event if it was flagged to ignore (when the source of the event is from Viewport)\n if (this._ignoreNextScrollEvent) {\n this._ignoreNextScrollEvent = false;\n // Still trigger the scroll so lines get refreshed\n this._scrollLines(0);\n return;\n }\n\n const newRow = Math.round(this._lastScrollTop / this._currentRowHeight);\n const diff = newRow - this._bufferService.buffer.ydisp;\n this._scrollLines(diff);\n }\n\n private _smoothScroll(): void {\n // Check valid state\n if (this._isDisposed || this._smoothScrollState.origin === -1 || this._smoothScrollState.target === -1) {\n return;\n }\n\n // Calculate position complete\n const percent = this._smoothScrollPercent();\n this._viewportElement.scrollTop = this._smoothScrollState.origin + Math.round(percent * (this._smoothScrollState.target - this._smoothScrollState.origin));\n\n // Continue or finish smooth scroll\n if (percent < 1) {\n this._coreBrowserService.window.requestAnimationFrame(() => this._smoothScroll());\n } else {\n this._clearSmoothScrollState();\n }\n }\n\n private _smoothScrollPercent(): number {\n if (!this._optionsService.rawOptions.smoothScrollDuration || !this._smoothScrollState.startTime) {\n return 1;\n }\n return Math.max(Math.min((Date.now() - this._smoothScrollState.startTime) / this._optionsService.rawOptions.smoothScrollDuration, 1), 0);\n }\n\n private _clearSmoothScrollState(): void {\n this._smoothScrollState.startTime = 0;\n this._smoothScrollState.origin = -1;\n this._smoothScrollState.target = -1;\n }\n\n /**\n * Handles bubbling of scroll event in case the viewport has reached top or bottom\n * @param ev The scroll event.\n * @param amount The amount scrolled\n */\n private _bubbleScroll(ev: Event, amount: number): boolean {\n const scrollPosFromTop = this._viewportElement.scrollTop + this._lastRecordedViewportHeight;\n if ((amount < 0 && this._viewportElement.scrollTop !== 0) ||\n (amount > 0 && scrollPosFromTop < this._lastRecordedBufferHeight)) {\n if (ev.cancelable) {\n ev.preventDefault();\n }\n return false;\n }\n return true;\n }\n\n /**\n * Handles mouse wheel events by adjusting the viewport's scrollTop and delegating the actual\n * scrolling to `onScroll`, this event needs to be attached manually by the consumer of\n * `Viewport`.\n * @param ev The mouse wheel event.\n */\n public handleWheel(ev: WheelEvent): boolean {\n const amount = this._getPixelsScrolled(ev);\n if (amount === 0) {\n return false;\n }\n if (!this._optionsService.rawOptions.smoothScrollDuration) {\n this._viewportElement.scrollTop += amount;\n } else {\n this._smoothScrollState.startTime = Date.now();\n if (this._smoothScrollPercent() < 1) {\n this._smoothScrollState.origin = this._viewportElement.scrollTop;\n if (this._smoothScrollState.target === -1) {\n this._smoothScrollState.target = this._viewportElement.scrollTop + amount;\n } else {\n this._smoothScrollState.target += amount;\n }\n this._smoothScrollState.target = Math.max(Math.min(this._smoothScrollState.target, this._viewportElement.scrollHeight), 0);\n this._smoothScroll();\n } else {\n this._clearSmoothScrollState();\n }\n }\n return this._bubbleScroll(ev, amount);\n }\n\n private _getPixelsScrolled(ev: WheelEvent): number {\n // Do nothing if it's not a vertical scroll event\n if (ev.deltaY === 0 || ev.shiftKey) {\n return 0;\n }\n\n // Fallback to WheelEvent.DOM_DELTA_PIXEL\n let amount = this._applyScrollModifier(ev.deltaY, ev);\n if (ev.deltaMode === WheelEvent.DOM_DELTA_LINE) {\n amount *= this._currentRowHeight;\n } else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n amount *= this._currentRowHeight * this._bufferService.rows;\n }\n return amount;\n }\n\n /**\n * Gets the number of pixels scrolled by the mouse event taking into account what type of delta\n * is being used.\n * @param ev The mouse wheel event.\n */\n public getLinesScrolled(ev: WheelEvent): number {\n // Do nothing if it's not a vertical scroll event\n if (ev.deltaY === 0 || ev.shiftKey) {\n return 0;\n }\n\n // Fallback to WheelEvent.DOM_DELTA_LINE\n let amount = this._applyScrollModifier(ev.deltaY, ev);\n if (ev.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n amount /= this._currentRowHeight + 0.0; // Prevent integer division\n this._wheelPartialScroll += amount;\n amount = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1);\n this._wheelPartialScroll %= 1;\n } else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n amount *= this._bufferService.rows;\n }\n return amount;\n }\n\n private _applyScrollModifier(amount: number, ev: WheelEvent): number {\n const modifier = this._optionsService.rawOptions.fastScrollModifier;\n // Multiply the scroll speed when the modifier is down\n if ((modifier === 'alt' && ev.altKey) ||\n (modifier === 'ctrl' && ev.ctrlKey) ||\n (modifier === 'shift' && ev.shiftKey)) {\n return amount * this._optionsService.rawOptions.fastScrollSensitivity * this._optionsService.rawOptions.scrollSensitivity;\n }\n\n return amount * this._optionsService.rawOptions.scrollSensitivity;\n }\n\n /**\n * Handles the touchstart event, recording the touch occurred.\n * @param ev The touch event.\n */\n public handleTouchStart(ev: TouchEvent): void {\n this._lastTouchY = ev.touches[0].pageY;\n }\n\n /**\n * Handles the touchmove event, scrolling the viewport if the position shifted.\n * @param ev The touch event.\n */\n public handleTouchMove(ev: TouchEvent): boolean {\n const deltaY = this._lastTouchY - ev.touches[0].pageY;\n this._lastTouchY = ev.touches[0].pageY;\n if (deltaY === 0) {\n return false;\n }\n this._viewportElement.scrollTop += deltaY;\n return this._bubbleScroll(ev, deltaY);\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IRenderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services';\n\nexport class BufferDecorationRenderer extends Disposable {\n private readonly _container: HTMLElement;\n private readonly _decorationElements: Map = new Map();\n\n private _animationFrame: number | undefined;\n private _altBufferIsActive: boolean = false;\n private _dimensionsChanged: boolean = false;\n\n constructor(\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n this._container = document.createElement('div');\n this._container.classList.add('xterm-decoration-container');\n this._screenElement.appendChild(this._container);\n\n this.register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations()));\n this.register(this._renderService.onDimensionsChange(() => {\n this._dimensionsChanged = true;\n this._queueRefresh();\n }));\n this.register(addDisposableDomListener(window, 'resize', () => this._queueRefresh()));\n this.register(this._bufferService.buffers.onBufferActivate(() => {\n this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt;\n }));\n this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh()));\n this.register(this._decorationService.onDecorationRemoved(decoration => this._removeDecoration(decoration)));\n this.register(toDisposable(() => {\n this._container.remove();\n this._decorationElements.clear();\n }));\n }\n\n private _queueRefresh(): void {\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._renderService.addRefreshCallback(() => {\n this._doRefreshDecorations();\n this._animationFrame = undefined;\n });\n }\n\n private _doRefreshDecorations(): void {\n for (const decoration of this._decorationService.decorations) {\n this._renderDecoration(decoration);\n }\n this._dimensionsChanged = false;\n }\n\n private _renderDecoration(decoration: IInternalDecoration): void {\n this._refreshStyle(decoration);\n if (this._dimensionsChanged) {\n this._refreshXPosition(decoration);\n }\n }\n\n private _createElement(decoration: IInternalDecoration): HTMLElement {\n const element = document.createElement('div');\n element.classList.add('xterm-decoration');\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${(decoration.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n\n const x = decoration.options.x ?? 0;\n if (x && x > this._bufferService.cols) {\n // exceeded the container width, so hide\n element.style.display = 'none';\n }\n this._refreshXPosition(decoration, element);\n\n return element;\n }\n\n private _refreshStyle(decoration: IInternalDecoration): void {\n const line = decoration.marker.line - this._bufferService.buffers.active.ydisp;\n if (line < 0 || line >= this._bufferService.rows) {\n // outside of viewport\n if (decoration.element) {\n decoration.element.style.display = 'none';\n decoration.onRenderEmitter.fire(decoration.element);\n }\n } else {\n let element = this._decorationElements.get(decoration);\n if (!element) {\n element = this._createElement(decoration);\n decoration.element = element;\n this._decorationElements.set(decoration, element);\n this._container.appendChild(element);\n }\n element.style.top = `${line * this._renderService.dimensions.css.cell.height}px`;\n element.style.display = this._altBufferIsActive ? 'none' : 'block';\n decoration.onRenderEmitter.fire(element);\n }\n }\n\n private _refreshXPosition(decoration: IInternalDecoration, element: HTMLElement | undefined = decoration.element): void {\n if (!element) {\n return;\n }\n const x = decoration.options.x ?? 0;\n if ((decoration.options.anchor || 'left') === 'right') {\n element.style.right = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n } else {\n element.style.left = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n }\n }\n\n private _removeDecoration(decoration: IInternalDecoration): void {\n this._decorationElements.get(decoration)?.remove();\n this._decorationElements.delete(decoration);\n decoration.dispose();\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInternalDecoration } from 'common/services/Services';\n\nexport interface IColorZoneStore {\n readonly zones: IColorZone[];\n clear(): void;\n addDecoration(decoration: IInternalDecoration): void;\n /**\n * Sets the amount of padding in lines that will be added between zones, if new lines intersect\n * the padding they will be merged into the same zone.\n */\n setPadding(padding: { [position: string]: number }): void;\n}\n\nexport interface IColorZone {\n /** Color in a format supported by canvas' fillStyle. */\n color: string;\n position: 'full' | 'left' | 'center' | 'right' | undefined;\n startBufferLine: number;\n endBufferLine: number;\n}\n\ninterface IMinimalDecorationForColorZone {\n marker: Pick;\n options: Pick;\n}\n\nexport class ColorZoneStore implements IColorZoneStore {\n private _zones: IColorZone[] = [];\n\n // The zone pool is used to keep zone objects from being freed between clearing the color zone\n // store and fetching the zones. This helps reduce GC pressure since the color zones are\n // accumulated on potentially every scroll event.\n private _zonePool: IColorZone[] = [];\n private _zonePoolIndex = 0;\n\n private _linePadding: { [position: string]: number } = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n };\n\n public get zones(): IColorZone[] {\n // Trim the zone pool to free unused memory\n this._zonePool.length = Math.min(this._zonePool.length, this._zones.length);\n return this._zones;\n }\n\n public clear(): void {\n this._zones.length = 0;\n this._zonePoolIndex = 0;\n }\n\n public addDecoration(decoration: IMinimalDecorationForColorZone): void {\n if (!decoration.options.overviewRulerOptions) {\n return;\n }\n for (const z of this._zones) {\n if (z.color === decoration.options.overviewRulerOptions.color &&\n z.position === decoration.options.overviewRulerOptions.position) {\n if (this._lineIntersectsZone(z, decoration.marker.line)) {\n return;\n }\n if (this._lineAdjacentToZone(z, decoration.marker.line, decoration.options.overviewRulerOptions.position)) {\n this._addLineToZone(z, decoration.marker.line);\n return;\n }\n }\n }\n // Create using zone pool if possible\n if (this._zonePoolIndex < this._zonePool.length) {\n this._zonePool[this._zonePoolIndex].color = decoration.options.overviewRulerOptions.color;\n this._zonePool[this._zonePoolIndex].position = decoration.options.overviewRulerOptions.position;\n this._zonePool[this._zonePoolIndex].startBufferLine = decoration.marker.line;\n this._zonePool[this._zonePoolIndex].endBufferLine = decoration.marker.line;\n this._zones.push(this._zonePool[this._zonePoolIndex++]);\n return;\n }\n // Create\n this._zones.push({\n color: decoration.options.overviewRulerOptions.color,\n position: decoration.options.overviewRulerOptions.position,\n startBufferLine: decoration.marker.line,\n endBufferLine: decoration.marker.line\n });\n this._zonePool.push(this._zones[this._zones.length - 1]);\n this._zonePoolIndex++;\n }\n\n public setPadding(padding: { [position: string]: number }): void {\n this._linePadding = padding;\n }\n\n private _lineIntersectsZone(zone: IColorZone, line: number): boolean {\n return (\n line >= zone.startBufferLine &&\n line <= zone.endBufferLine\n );\n }\n\n private _lineAdjacentToZone(zone: IColorZone, line: number, position: IColorZone['position']): boolean {\n return (\n (line >= zone.startBufferLine - this._linePadding[position || 'full']) &&\n (line <= zone.endBufferLine + this._linePadding[position || 'full'])\n );\n }\n\n private _addLineToZone(zone: IColorZone, line: number): void {\n zone.startBufferLine = Math.min(zone.startBufferLine, line);\n zone.endBufferLine = Math.max(zone.endBufferLine, line);\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';\n\n// Helper objects to avoid excessive calculation and garbage collection during rendering. These are\n// static values for each render and can be accessed using the decoration position as the key.\nconst drawHeight = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawWidth = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawX = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\n\nexport class OverviewRulerRenderer extends Disposable {\n private readonly _canvas: HTMLCanvasElement;\n private readonly _ctx: CanvasRenderingContext2D;\n private readonly _colorZoneStore: IColorZoneStore = new ColorZoneStore();\n private get _width(): number {\n return this._optionsService.options.overviewRulerWidth || 0;\n }\n private _animationFrame: number | undefined;\n\n private _shouldUpdateDimensions: boolean | undefined = true;\n private _shouldUpdateAnchor: boolean | undefined = true;\n private _lastKnownBufferLength: number = 0;\n\n private _containerHeight: number | undefined;\n\n constructor(\n private readonly _viewportElement: HTMLElement,\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreBrowserService private readonly _coreBrowseService: ICoreBrowserService\n ) {\n super();\n this._canvas = document.createElement('canvas');\n this._canvas.classList.add('xterm-decoration-overview-ruler');\n this._refreshCanvasDimensions();\n this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement);\n const ctx = this._canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Ctx cannot be null');\n } else {\n this._ctx = ctx;\n }\n this._registerDecorationListeners();\n this._registerBufferChangeListeners();\n this._registerDimensionChangeListeners();\n this.register(toDisposable(() => {\n this._canvas?.remove();\n }));\n }\n\n /**\n * On decoration add or remove, redraw\n */\n private _registerDecorationListeners(): void {\n this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));\n this.register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(undefined, true)));\n }\n\n /**\n * On buffer change, redraw\n * and hide the canvas if the alt buffer is active\n */\n private _registerBufferChangeListeners(): void {\n this.register(this._renderService.onRenderedViewportChange(() => this._queueRefresh()));\n this.register(this._bufferService.buffers.onBufferActivate(() => {\n this._canvas!.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';\n }));\n this.register(this._bufferService.onScroll(() => {\n if (this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length) {\n this._refreshDrawHeightConstants();\n this._refreshColorZonePadding();\n }\n }));\n }\n /**\n * On dimension change, update canvas dimensions\n * and then redraw\n */\n private _registerDimensionChangeListeners(): void {\n // container height changed\n this.register(this._renderService.onRender((): void => {\n if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {\n this._queueRefresh(true);\n this._containerHeight = this._screenElement.clientHeight;\n }\n }));\n // overview ruler width changed\n this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true)));\n // device pixel ratio changed\n this.register(addDisposableDomListener(this._coreBrowseService.window, 'resize', () => this._queueRefresh(true)));\n // set the canvas dimensions\n this._queueRefresh(true);\n }\n\n private _refreshDrawConstants(): void {\n // width\n const outerWidth = Math.floor(this._canvas.width / 3);\n const innerWidth = Math.ceil(this._canvas.width / 3);\n drawWidth.full = this._canvas.width;\n drawWidth.left = outerWidth;\n drawWidth.center = innerWidth;\n drawWidth.right = outerWidth;\n // height\n this._refreshDrawHeightConstants();\n // x\n drawX.full = 0;\n drawX.left = 0;\n drawX.center = drawWidth.left;\n drawX.right = drawWidth.left + drawWidth.center;\n }\n\n private _refreshDrawHeightConstants(): void {\n drawHeight.full = Math.round(2 * this._coreBrowseService.dpr);\n // Calculate actual pixels per line\n const pixelsPerLine = this._canvas.height / this._bufferService.buffer.lines.length;\n // Clamp actual pixels within a range\n const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * this._coreBrowseService.dpr);\n drawHeight.left = nonFullHeight;\n drawHeight.center = nonFullHeight;\n drawHeight.right = nonFullHeight;\n }\n\n private _refreshColorZonePadding(): void {\n this._colorZoneStore.setPadding({\n full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.full),\n left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.left),\n center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.center),\n right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.right)\n });\n this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length;\n }\n\n private _refreshCanvasDimensions(): void {\n this._canvas.style.width = `${this._width}px`;\n this._canvas.width = Math.round(this._width * this._coreBrowseService.dpr);\n this._canvas.style.height = `${this._screenElement.clientHeight}px`;\n this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowseService.dpr);\n this._refreshDrawConstants();\n this._refreshColorZonePadding();\n }\n\n private _refreshDecorations(): void {\n if (this._shouldUpdateDimensions) {\n this._refreshCanvasDimensions();\n }\n this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\n this._colorZoneStore.clear();\n for (const decoration of this._decorationService.decorations) {\n this._colorZoneStore.addDecoration(decoration);\n }\n this._ctx.lineWidth = 1;\n const zones = this._colorZoneStore.zones;\n for (const zone of zones) {\n if (zone.position !== 'full') {\n this._renderColorZone(zone);\n }\n }\n for (const zone of zones) {\n if (zone.position === 'full') {\n this._renderColorZone(zone);\n }\n }\n this._shouldUpdateDimensions = false;\n this._shouldUpdateAnchor = false;\n }\n\n private _renderColorZone(zone: IColorZone): void {\n this._ctx.fillStyle = zone.color;\n this._ctx.fillRect(\n /* x */ drawX[zone.position || 'full'],\n /* y */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n (zone.startBufferLine / this._bufferService.buffers.active.lines.length) - drawHeight[zone.position || 'full'] / 2\n ),\n /* w */ drawWidth[zone.position || 'full'],\n /* h */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n ((zone.endBufferLine - zone.startBufferLine) / this._bufferService.buffers.active.lines.length) + drawHeight[zone.position || 'full']\n )\n );\n }\n\n private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {\n this._shouldUpdateDimensions = updateCanvasDimensions || this._shouldUpdateDimensions;\n this._shouldUpdateAnchor = updateAnchor || this._shouldUpdateAnchor;\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._coreBrowseService.window.requestAnimationFrame(() => {\n this._refreshDecorations();\n this._animationFrame = undefined;\n });\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderService } from 'browser/services/Services';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { C0 } from 'common/data/EscapeSequences';\n\ninterface IPosition {\n start: number;\n end: number;\n}\n\n/**\n * Encapsulates the logic for handling compositionstart, compositionupdate and compositionend\n * events, displaying the in-progress composition to the UI and forwarding the final composition\n * to the handler.\n */\nexport class CompositionHelper {\n /**\n * Whether input composition is currently happening, eg. via a mobile keyboard, speech input or\n * IME. This variable determines whether the compositionText should be displayed on the UI.\n */\n private _isComposing: boolean;\n public get isComposing(): boolean { return this._isComposing; }\n\n /**\n * The position within the input textarea's value of the current composition.\n */\n private _compositionPosition: IPosition;\n\n /**\n * Whether a composition is in the process of being sent, setting this to false will cancel any\n * in-progress composition.\n */\n private _isSendingComposition: boolean;\n\n /**\n * Data already sent due to keydown event.\n */\n private _dataAlreadySent: string;\n\n constructor(\n private readonly _textarea: HTMLTextAreaElement,\n private readonly _compositionView: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreService private readonly _coreService: ICoreService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n this._isComposing = false;\n this._isSendingComposition = false;\n this._compositionPosition = { start: 0, end: 0 };\n this._dataAlreadySent = '';\n }\n\n /**\n * Handles the compositionstart event, activating the composition view.\n */\n public compositionstart(): void {\n this._isComposing = true;\n this._compositionPosition.start = this._textarea.value.length;\n this._compositionView.textContent = '';\n this._dataAlreadySent = '';\n this._compositionView.classList.add('active');\n }\n\n /**\n * Handles the compositionupdate event, updating the composition view.\n * @param ev The event.\n */\n public compositionupdate(ev: Pick): void {\n this._compositionView.textContent = ev.data;\n this.updateCompositionElements();\n setTimeout(() => {\n this._compositionPosition.end = this._textarea.value.length;\n }, 0);\n }\n\n /**\n * Handles the compositionend event, hiding the composition view and sending the composition to\n * the handler.\n */\n public compositionend(): void {\n this._finalizeComposition(true);\n }\n\n /**\n * Handles the keydown event, routing any necessary events to the CompositionHelper functions.\n * @param ev The keydown event.\n * @returns Whether the Terminal should continue processing the keydown event.\n */\n public keydown(ev: KeyboardEvent): boolean {\n if (this._isComposing || this._isSendingComposition) {\n if (ev.keyCode === 229) {\n // Continue composing if the keyCode is the \"composition character\"\n return false;\n }\n if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {\n // Continue composing if the keyCode is a modifier key\n return false;\n }\n // Finish composition immediately. This is mainly here for the case where enter is\n // pressed and the handler needs to be triggered before the command is executed.\n this._finalizeComposition(false);\n }\n\n if (ev.keyCode === 229) {\n // If the \"composition character\" is used but gets to this point it means a non-composition\n // character (eg. numbers and punctuation) was pressed when the IME was active.\n this._handleAnyTextareaChanges();\n return false;\n }\n\n return true;\n }\n\n /**\n * Finalizes the composition, resuming regular input actions. This is called when a composition\n * is ending.\n * @param waitForPropagation Whether to wait for events to propagate before sending\n * the input. This should be false if a non-composition keystroke is entered before the\n * compositionend event is triggered, such as enter, so that the composition is sent before\n * the command is executed.\n */\n private _finalizeComposition(waitForPropagation: boolean): void {\n this._compositionView.classList.remove('active');\n this._isComposing = false;\n\n if (!waitForPropagation) {\n // Cancel any delayed composition send requests and send the input immediately.\n this._isSendingComposition = false;\n const input = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);\n this._coreService.triggerDataEvent(input, true);\n } else {\n // Make a deep copy of the composition position here as a new compositionstart event may\n // fire before the setTimeout executes.\n const currentCompositionPosition = {\n start: this._compositionPosition.start,\n end: this._compositionPosition.end\n };\n\n // Since composition* events happen before the changes take place in the textarea on most\n // browsers, use a setTimeout with 0ms time to allow the native compositionend event to\n // complete. This ensures the correct character is retrieved.\n // This solution was used because:\n // - The compositionend event's data property is unreliable, at least on Chromium\n // - The last compositionupdate event's data property does not always accurately describe\n // the character, a counter example being Korean where an ending consonsant can move to\n // the following character if the following input is a vowel.\n this._isSendingComposition = true;\n setTimeout(() => {\n // Ensure that the input has not already been sent\n if (this._isSendingComposition) {\n this._isSendingComposition = false;\n let input;\n // Add length of data already sent due to keydown event,\n // otherwise input characters can be duplicated. (Issue #3191)\n currentCompositionPosition.start += this._dataAlreadySent.length;\n if (this._isComposing) {\n // Use the end position to get the string if a new composition has started.\n input = this._textarea.value.substring(currentCompositionPosition.start, currentCompositionPosition.end);\n } else {\n // Don't use the end position here in order to pick up any characters after the\n // composition has finished, for example when typing a non-composition character\n // (eg. 2) after a composition character.\n input = this._textarea.value.substring(currentCompositionPosition.start);\n }\n if (input.length > 0) {\n this._coreService.triggerDataEvent(input, true);\n }\n }\n }, 0);\n }\n }\n\n /**\n * Apply any changes made to the textarea after the current event chain is allowed to complete.\n * This should be called when not currently composing but a keydown event with the \"composition\n * character\" (229) is triggered, in order to allow non-composition text to be entered when an\n * IME is active.\n */\n private _handleAnyTextareaChanges(): void {\n const oldValue = this._textarea.value;\n setTimeout(() => {\n // Ignore if a composition has started since the timeout\n if (!this._isComposing) {\n const newValue = this._textarea.value;\n\n const diff = newValue.replace(oldValue, '');\n\n this._dataAlreadySent = diff;\n\n if (newValue.length > oldValue.length) {\n this._coreService.triggerDataEvent(diff, true);\n } else if (newValue.length < oldValue.length) {\n this._coreService.triggerDataEvent(`${C0.DEL}`, true);\n } else if ((newValue.length === oldValue.length) && (newValue !== oldValue)) {\n this._coreService.triggerDataEvent(newValue, true);\n }\n\n }\n }, 0);\n }\n\n /**\n * Positions the composition view on top of the cursor and the textarea just below it (so the\n * IME helper dialog is positioned correctly).\n * @param dontRecurse Whether to use setTimeout to recursively trigger another update, this is\n * necessary as the IME events across browsers are not consistently triggered.\n */\n public updateCompositionElements(dontRecurse?: boolean): void {\n if (!this._isComposing) {\n return;\n }\n\n if (this._bufferService.buffer.isCursorInViewport) {\n const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const cursorTop = this._bufferService.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n this._compositionView.style.left = cursorLeft + 'px';\n this._compositionView.style.top = cursorTop + 'px';\n this._compositionView.style.height = cellHeight + 'px';\n this._compositionView.style.lineHeight = cellHeight + 'px';\n this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + 'px';\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n const compositionViewBounds = this._compositionView.getBoundingClientRect();\n this._textarea.style.left = cursorLeft + 'px';\n this._textarea.style.top = cursorTop + 'px';\n // Ensure the text area is at least 1x1, otherwise certain IMEs may break\n this._textarea.style.width = Math.max(compositionViewBounds.width, 1) + 'px';\n this._textarea.style.height = Math.max(compositionViewBounds.height, 1) + 'px';\n this._textarea.style.lineHeight = compositionViewBounds.height + 'px';\n }\n\n if (!dontRecurse) {\n setTimeout(() => this.updateCompositionElements(true), 0);\n }\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function getCoordsRelativeToElement(window: Pick, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {\n const rect = element.getBoundingClientRect();\n const elementStyle = window.getComputedStyle(element);\n const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'));\n const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'));\n return [\n event.clientX - rect.left - leftPadding,\n event.clientY - rect.top - topPadding\n ];\n}\n\n/**\n * Gets coordinates within the terminal for a particular mouse event. The result\n * is returned as an array in the form [x, y] instead of an object as it's a\n * little faster and this function is used in some low level code.\n * @param window The window object the element belongs to.\n * @param event The mouse event.\n * @param element The terminal's container element.\n * @param colCount The number of columns in the terminal.\n * @param rowCount The number of rows n the terminal.\n * @param hasValidCharSize Whether there is a valid character size available.\n * @param cssCellWidth The cell width device pixel render dimensions.\n * @param cssCellHeight The cell height device pixel render dimensions.\n * @param isSelection Whether the request is for the selection or not. This will\n * apply an offset to the x value such that the left half of the cell will\n * select that cell and the right half will select the next cell.\n */\nexport function getCoords(window: Pick, event: Pick, element: HTMLElement, colCount: number, rowCount: number, hasValidCharSize: boolean, cssCellWidth: number, cssCellHeight: number, isSelection?: boolean): [number, number] | undefined {\n // Coordinates cannot be measured if there are no valid\n if (!hasValidCharSize) {\n return undefined;\n }\n\n const coords = getCoordsRelativeToElement(window, event, element);\n if (!coords) {\n return undefined;\n }\n\n coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);\n coords[1] = Math.ceil(coords[1] / cssCellHeight);\n\n // Ensure coordinates are within the terminal viewport. Note that selections\n // need an addition point of precision to cover the end point (as characters\n // cover half of one char and half of the next).\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0));\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount);\n\n return coords;\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { C0 } from 'common/data/EscapeSequences';\nimport { IBufferService } from 'common/services/Services';\n\nconst enum Direction {\n UP = 'A',\n DOWN = 'B',\n RIGHT = 'C',\n LEFT = 'D'\n}\n\n/**\n * Concatenates all the arrow sequences together.\n * Resets the starting row to an unwrapped row, moves to the requested row,\n * then moves to requested col.\n */\nexport function moveToCellSequence(targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startX = bufferService.buffer.x;\n const startY = bufferService.buffer.y;\n\n // The alt buffer should try to navigate between rows\n if (!bufferService.buffer.hasScrollback) {\n return resetStartingRow(startX, startY, targetX, targetY, bufferService, applicationCursor) +\n moveToRequestedRow(startY, targetY, bufferService, applicationCursor) +\n moveToRequestedCol(startX, startY, targetX, targetY, bufferService, applicationCursor);\n }\n\n // Only move horizontally for the normal buffer\n let direction;\n if (startY === targetY) {\n direction = startX > targetX ? Direction.LEFT : Direction.RIGHT;\n return repeat(Math.abs(startX - targetX), sequence(direction, applicationCursor));\n }\n direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;\n const rowDifference = Math.abs(startY - targetY);\n const cellsToMove = colsFromRowEnd(startY > targetY ? targetX : startX, bufferService) +\n (rowDifference - 1) * bufferService.cols + 1 /* wrap around 1 row */ +\n colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService);\n return repeat(cellsToMove, sequence(direction, applicationCursor));\n}\n\n/**\n * Find the number of cols from a row beginning to a col.\n */\nfunction colsFromRowBeginning(currX: number, bufferService: IBufferService): number {\n return currX - 1;\n}\n\n/**\n * Find the number of cols from a col to row end.\n */\nfunction colsFromRowEnd(currX: number, bufferService: IBufferService): number {\n return bufferService.cols - currX;\n}\n\n/**\n * If the initial position of the cursor is on a row that is wrapped, move the\n * cursor up to the first row that is not wrapped to have accurate vertical\n * positioning.\n */\nfunction resetStartingRow(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length === 0) {\n return '';\n }\n return repeat(bufferLine(\n startX, startY, startX,\n startY - wrappedRowsForRow(startY, bufferService), false, bufferService\n ).length, sequence(Direction.LEFT, applicationCursor));\n}\n\n/**\n * Using the reset starting and ending row, move to the requested row,\n * ignoring wrapped rows\n */\nfunction moveToRequestedRow(startY: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n const rowsToMove = Math.abs(startRow - endRow) - wrappedRowsCount(startY, targetY, bufferService);\n\n return repeat(rowsToMove, sequence(verticalDirection(startY, targetY), applicationCursor));\n}\n\n/**\n * Move to the requested col on the ending row\n */\nfunction moveToRequestedCol(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n let startRow;\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n const endRow = targetY;\n const direction = horizontalDirection(startX, startY, targetX, targetY, bufferService, applicationCursor);\n\n return repeat(bufferLine(\n startX, startRow, targetX, endRow,\n direction === Direction.RIGHT, bufferService\n ).length, sequence(direction, applicationCursor));\n}\n\n/**\n * Utility functions\n */\n\n/**\n * Calculates the number of wrapped rows between the unwrapped starting and\n * ending rows. These rows need to ignored since the cursor skips over them.\n */\nfunction wrappedRowsCount(startY: number, targetY: number, bufferService: IBufferService): number {\n let wrappedRows = 0;\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n for (let i = 0; i < Math.abs(startRow - endRow); i++) {\n const direction = verticalDirection(startY, targetY) === Direction.UP ? -1 : 1;\n const line = bufferService.buffer.lines.get(startRow + (direction * i));\n if (line?.isWrapped) {\n wrappedRows++;\n }\n }\n\n return wrappedRows;\n}\n\n/**\n * Calculates the number of wrapped rows that make up a given row.\n * @param currentRow The row to determine how many wrapped rows make it up\n */\nfunction wrappedRowsForRow(currentRow: number, bufferService: IBufferService): number {\n let rowCount = 0;\n let line = bufferService.buffer.lines.get(currentRow);\n let lineWraps = line?.isWrapped;\n\n while (lineWraps && currentRow >= 0 && currentRow < bufferService.rows) {\n rowCount++;\n line = bufferService.buffer.lines.get(--currentRow);\n lineWraps = line?.isWrapped;\n }\n\n return rowCount;\n}\n\n/**\n * Direction determiners\n */\n\n/**\n * Determines if the right or left arrow is needed\n */\nfunction horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {\n let startRow;\n if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n if ((startX < targetX &&\n startRow <= targetY) || // down/right or same y/right\n (startX >= targetX &&\n startRow < targetY)) { // down/left or same y/left\n return Direction.RIGHT;\n }\n return Direction.LEFT;\n}\n\n/**\n * Determines if the up or down arrow is needed\n */\nfunction verticalDirection(startY: number, targetY: number): Direction {\n return startY > targetY ? Direction.UP : Direction.DOWN;\n}\n\n/**\n * Constructs the string of chars in the buffer from a starting row and col\n * to an ending row and col\n * @param startCol The starting column position\n * @param startRow The starting row position\n * @param endCol The ending column position\n * @param endRow The ending row position\n * @param forward Direction to move\n */\nfunction bufferLine(\n startCol: number,\n startRow: number,\n endCol: number,\n endRow: number,\n forward: boolean,\n bufferService: IBufferService\n): string {\n let currentCol = startCol;\n let currentRow = startRow;\n let bufferStr = '';\n\n while (currentCol !== endCol || currentRow !== endRow) {\n currentCol += forward ? 1 : -1;\n\n if (forward && currentCol > bufferService.cols - 1) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n currentCol = 0;\n startCol = 0;\n currentRow++;\n } else if (!forward && currentCol < 0) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, 0, startCol + 1\n );\n currentCol = bufferService.cols - 1;\n startCol = currentCol;\n currentRow--;\n }\n }\n\n return bufferStr + bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n}\n\n/**\n * Constructs the escape sequence for clicking an arrow\n * @param direction The direction to move\n */\nfunction sequence(direction: Direction, applicationCursor: boolean): string {\n const mod = applicationCursor ? 'O' : '[';\n return C0.ESC + mod + direction;\n}\n\n/**\n * Returns a string repeated a given number of times\n * Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n * @param count The number of times to repeat the string\n * @param str The string that is to be repeated\n */\nfunction repeat(count: number, str: string): string {\n count = Math.floor(count);\n let rpt = '';\n for (let i = 0; i < count; i++) {\n rpt += str;\n }\n return rpt;\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { removeElementFromParent } from 'browser/Dom';\nimport { BOLD_CLASS, CURSOR_BLINK_CLASS, CURSOR_CLASS, CURSOR_STYLE_BAR_CLASS, CURSOR_STYLE_BLOCK_CLASS, CURSOR_STYLE_UNDERLINE_CLASS, DomRendererRowFactory, ITALIC_CLASS } from 'browser/renderer/dom/DomRendererRowFactory';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';\nimport { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';\nimport { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { ILinkifier2, ILinkifierEvent, ReadonlyColorSet } from 'browser/Types';\nimport { color } from 'common/Color';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, IInstantiationService, IOptionsService } from 'common/services/Services';\n\nconst TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';\nconst ROW_CONTAINER_CLASS = 'xterm-rows';\nconst FG_CLASS_PREFIX = 'xterm-fg-';\nconst BG_CLASS_PREFIX = 'xterm-bg-';\nconst FOCUS_CLASS = 'xterm-focus';\nconst SELECTION_CLASS = 'xterm-selection';\n\nlet nextTerminalId = 1;\n\n/**\n * A fallback renderer for when canvas is slow. This is not meant to be\n * particularly fast or feature complete, more just stable and usable for when\n * canvas is not an option.\n */\nexport class DomRenderer extends Disposable implements IRenderer {\n private _rowFactory: DomRendererRowFactory;\n private _terminalClass: number = nextTerminalId++;\n\n private _themeStyleElement!: HTMLStyleElement;\n private _dimensionsStyleElement!: HTMLStyleElement;\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[] = [];\n private _selectionContainer: HTMLElement;\n private _cellToRowElements: Int16Array[] = [];\n\n public dimensions: IRenderDimensions;\n\n public readonly onRequestRedraw = this.register(new EventEmitter()).event;\n\n constructor(\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _viewportElement: HTMLElement,\n private readonly _linkifier2: ILinkifier2,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IThemeService themeService: IThemeService\n ) {\n super();\n this._rowContainer = document.createElement('div');\n this._rowContainer.classList.add(ROW_CONTAINER_CLASS);\n this._rowContainer.style.lineHeight = 'normal';\n this._rowContainer.setAttribute('aria-hidden', 'true');\n this._refreshRowElements(this._bufferService.cols, this._bufferService.rows);\n this._selectionContainer = document.createElement('div');\n this._selectionContainer.classList.add(SELECTION_CLASS);\n this._selectionContainer.setAttribute('aria-hidden', 'true');\n\n this.dimensions = createRenderDimensions();\n this._updateDimensions();\n this.register(this._optionsService.onOptionChange(() => this._handleOptionsChanged()));\n\n this.register(themeService.onChangeColors(e => this._injectCss(e)));\n this._injectCss(themeService.colors);\n\n this._rowFactory = instantiationService.createInstance(DomRendererRowFactory, document);\n\n this._element.classList.add(TERMINAL_CLASS_PREFIX + this._terminalClass);\n this._screenElement.appendChild(this._rowContainer);\n this._screenElement.appendChild(this._selectionContainer);\n\n this.register(this._linkifier2.onShowLinkUnderline(e => this._handleLinkHover(e)));\n this.register(this._linkifier2.onHideLinkUnderline(e => this._handleLinkLeave(e)));\n\n this.register(toDisposable(() => {\n this._element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);\n\n // Outside influences such as React unmounts may manipulate the DOM before our disposal.\n // https://github.com/xtermjs/xterm.js/issues/2960\n removeElementFromParent(this._rowContainer, this._selectionContainer, this._themeStyleElement, this._dimensionsStyleElement);\n }));\n }\n\n private _updateDimensions(): void {\n const dpr = this._coreBrowserService.dpr;\n this.dimensions.device.char.width = this._charSizeService.width * dpr;\n this.dimensions.device.char.height = Math.ceil(this._charSizeService.height * dpr);\n this.dimensions.device.cell.width = this.dimensions.device.char.width + Math.round(this._optionsService.rawOptions.letterSpacing);\n this.dimensions.device.cell.height = Math.floor(this.dimensions.device.char.height * this._optionsService.rawOptions.lineHeight);\n this.dimensions.device.char.left = 0;\n this.dimensions.device.char.top = 0;\n this.dimensions.device.canvas.width = this.dimensions.device.cell.width * this._bufferService.cols;\n this.dimensions.device.canvas.height = this.dimensions.device.cell.height * this._bufferService.rows;\n this.dimensions.css.canvas.width = Math.round(this.dimensions.device.canvas.width / dpr);\n this.dimensions.css.canvas.height = Math.round(this.dimensions.device.canvas.height / dpr);\n this.dimensions.css.cell.width = this.dimensions.css.canvas.width / this._bufferService.cols;\n this.dimensions.css.cell.height = this.dimensions.css.canvas.height / this._bufferService.rows;\n\n for (const element of this._rowElements) {\n element.style.width = `${this.dimensions.css.canvas.width}px`;\n element.style.height = `${this.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this.dimensions.css.cell.height}px`;\n // Make sure rows don't overflow onto following row\n element.style.overflow = 'hidden';\n }\n\n if (!this._dimensionsStyleElement) {\n this._dimensionsStyleElement = document.createElement('style');\n this._screenElement.appendChild(this._dimensionsStyleElement);\n }\n\n const styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} span {` +\n ` display: inline-block;` +\n ` height: 100%;` +\n ` vertical-align: top;` +\n ` width: ${this.dimensions.css.cell.width}px` +\n `}`;\n\n this._dimensionsStyleElement.textContent = styles;\n\n this._selectionContainer.style.height = this._viewportElement.style.height;\n this._screenElement.style.width = `${this.dimensions.css.canvas.width}px`;\n this._screenElement.style.height = `${this.dimensions.css.canvas.height}px`;\n }\n\n private _injectCss(colors: ReadonlyColorSet): void {\n if (!this._themeStyleElement) {\n this._themeStyleElement = document.createElement('style');\n this._screenElement.appendChild(this._themeStyleElement);\n }\n\n // Base CSS\n let styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} {` +\n ` color: ${colors.foreground.css};` +\n ` font-family: ${this._optionsService.rawOptions.fontFamily};` +\n ` font-size: ${this._optionsService.rawOptions.fontSize}px;` +\n `}`;\n // Text styles\n styles +=\n `${this._terminalSelector} span:not(.${BOLD_CLASS}) {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeight};` +\n `}` +\n `${this._terminalSelector} span.${BOLD_CLASS} {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeightBold};` +\n `}` +\n `${this._terminalSelector} span.${ITALIC_CLASS} {` +\n ` font-style: italic;` +\n `}`;\n // Blink animation\n styles +=\n `@keyframes blink_box_shadow` + `_` + this._terminalClass + ` {` +\n ` 50% {` +\n ` box-shadow: none;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes blink_block` + `_` + this._terminalClass + ` {` +\n ` 0% {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n ` }` +\n ` 50% {` +\n ` background-color: ${colors.cursorAccent.css};` +\n ` color: ${colors.cursor.css};` +\n ` }` +\n `}`;\n // Cursor\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}:not(.${FOCUS_CLASS}) .${CURSOR_CLASS}.${CURSOR_STYLE_BLOCK_CLASS} {` +\n ` outline: 1px solid ${colors.cursor.css};` +\n ` outline-offset: -1px;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${CURSOR_CLASS}.${CURSOR_BLINK_CLASS}:not(.${CURSOR_STYLE_BLOCK_CLASS}) {` +\n ` animation: blink_box_shadow` + `_` + this._terminalClass + ` 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${CURSOR_CLASS}.${CURSOR_BLINK_CLASS}.${CURSOR_STYLE_BLOCK_CLASS} {` +\n ` animation: blink_block` + `_` + this._terminalClass + ` 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_BLOCK_CLASS} {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_BAR_CLASS} {` +\n ` box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${colors.cursor.css} inset;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${CURSOR_CLASS}.${CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` box-shadow: 0 -1px 0 ${colors.cursor.css} inset;` +\n `}`;\n // Selection\n styles +=\n `${this._terminalSelector} .${SELECTION_CLASS} {` +\n ` position: absolute;` +\n ` top: 0;` +\n ` left: 0;` +\n ` z-index: 1;` +\n ` pointer-events: none;` +\n `}` +\n `${this._terminalSelector}.focus .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionBackgroundOpaque.css};` +\n `}` +\n `${this._terminalSelector} .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionInactiveBackgroundOpaque.css};` +\n `}`;\n // Colors\n for (const [i, c] of colors.ansi.entries()) {\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i} { color: ${c.css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${i} { background-color: ${c.css}; }`;\n }\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { color: ${color.opaque(colors.background).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { background-color: ${colors.foreground.css}; }`;\n\n this._themeStyleElement.textContent = styles;\n }\n\n public handleDevicePixelRatioChange(): void {\n this._updateDimensions();\n }\n\n private _refreshRowElements(cols: number, rows: number): void {\n // Add missing elements\n for (let i = this._rowElements.length; i <= rows; i++) {\n const row = document.createElement('div');\n this._rowContainer.appendChild(row);\n this._rowElements.push(row);\n }\n // Remove excess elements\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n }\n\n public handleResize(cols: number, rows: number): void {\n this._refreshRowElements(cols, rows);\n this._updateDimensions();\n }\n\n public handleCharSizeChanged(): void {\n this._updateDimensions();\n }\n\n public handleBlur(): void {\n this._rowContainer.classList.remove(FOCUS_CLASS);\n }\n\n public handleFocus(): void {\n this._rowContainer.classList.add(FOCUS_CLASS);\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n // Remove all selections\n while (this._selectionContainer.children.length) {\n this._selectionContainer.removeChild(this._selectionContainer.children[0]);\n }\n\n this._rowFactory.handleSelectionChanged(start, end, columnSelectMode);\n this.renderRows(0, this._bufferService.rows - 1);\n\n // Selection does not exist\n if (!start || !end) {\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportStartRow = start[1] - this._bufferService.buffer.ydisp;\n const viewportEndRow = end[1] - this._bufferService.buffer.ydisp;\n const viewportCappedStartRow = Math.max(viewportStartRow, 0);\n const viewportCappedEndRow = Math.min(viewportEndRow, this._bufferService.rows - 1);\n\n // No need to draw the selection\n if (viewportCappedStartRow >= this._bufferService.rows || viewportCappedEndRow < 0) {\n return;\n }\n\n // Create the selections\n const documentFragment = document.createDocumentFragment();\n\n if (columnSelectMode) {\n const isXFlipped = start[0] > end[0];\n documentFragment.appendChild(\n this._createSelectionElement(viewportCappedStartRow, isXFlipped ? end[0] : start[0], isXFlipped ? start[0] : end[0], viewportCappedEndRow - viewportCappedStartRow + 1)\n );\n } else {\n // Draw first row\n const startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n const endCol = viewportCappedStartRow === viewportEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow, startCol, endCol));\n // Draw middle rows\n const middleRowsCount = viewportCappedEndRow - viewportCappedStartRow - 1;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._bufferService.cols, middleRowsCount));\n // Draw final row\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n // Only draw viewportEndRow if it's not the same as viewporttartRow\n const endCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, endCol));\n }\n }\n this._selectionContainer.appendChild(documentFragment);\n }\n\n /**\n * Creates a selection element at the specified position.\n * @param row The row of the selection.\n * @param colStart The start column.\n * @param colEnd The end columns.\n */\n private _createSelectionElement(row: number, colStart: number, colEnd: number, rowCount: number = 1): HTMLElement {\n const element = document.createElement('div');\n element.style.height = `${rowCount * this.dimensions.css.cell.height}px`;\n element.style.top = `${row * this.dimensions.css.cell.height}px`;\n element.style.left = `${colStart * this.dimensions.css.cell.width}px`;\n element.style.width = `${this.dimensions.css.cell.width * (colEnd - colStart)}px`;\n return element;\n }\n\n public handleCursorMove(): void {\n // No-op, the cursor is drawn when rows are drawn\n }\n\n private _handleOptionsChanged(): void {\n // Force a refresh\n this._updateDimensions();\n }\n\n public clear(): void {\n for (const e of this._rowElements) {\n /**\n * NOTE: This used to be `e.innerText = '';` but that doesn't work when using `jsdom` and `@testing-library/react`\n *\n * references:\n * - https://github.com/testing-library/react-testing-library/issues/1146\n * - https://github.com/jsdom/jsdom/issues/1245\n */\n e.replaceChildren();\n }\n }\n\n public renderRows(start: number, end: number): void {\n const cursorAbsoluteY = this._bufferService.buffer.ybase + this._bufferService.buffer.y;\n const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n\n for (let y = start; y <= end; y++) {\n const rowElement = this._rowElements[y];\n const row = y + this._bufferService.buffer.ydisp;\n const lineData = this._bufferService.buffer.lines.get(row);\n const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n if (!this._cellToRowElements[y] || this._cellToRowElements[y].length !== this._bufferService.cols) {\n this._cellToRowElements[y] = new Int16Array(this._bufferService.cols);\n }\n rowElement.replaceChildren(this._rowFactory.createRow(lineData!, row, row === cursorAbsoluteY, cursorStyle, cursorX, cursorBlink, this.dimensions.css.cell.width, this._bufferService.cols, this._cellToRowElements[y]));\n }\n }\n\n private get _terminalSelector(): string {\n return `.${TERMINAL_CLASS_PREFIX}${this._terminalClass}`;\n }\n\n private _handleLinkHover(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, true);\n }\n\n private _handleLinkLeave(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, false);\n }\n\n private _setCellUnderline(x: number, x2: number, y: number, y2: number, cols: number, enabled: boolean): void {\n x = this._cellToRowElements[y][x];\n x2 = this._cellToRowElements[y2][x2];\n\n if (x === -1 || x2 === -1) {\n return;\n }\n\n while (x !== x2 || y !== y2) {\n const row = this._rowElements[y];\n if (!row) {\n return;\n }\n const span = row.children[x] as HTMLElement;\n if (span) {\n span.style.textDecoration = enabled ? 'underline' : 'none';\n }\n if (++x >= cols) {\n x = 0;\n y++;\n }\n }\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, IColor } from 'common/Types';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';\nimport { NULL_CELL_CODE, WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { color, rgba } from 'common/Color';\nimport { IColorSet, ReadonlyColorSet } from 'browser/Types';\nimport { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { JoinedCellData } from 'browser/services/CharacterJoinerService';\nimport { excludeFromContrastRatioDemands } from 'browser/renderer/shared/RendererUtils';\nimport { AttributeData } from 'common/buffer/AttributeData';\n\nexport const BOLD_CLASS = 'xterm-bold';\nexport const DIM_CLASS = 'xterm-dim';\nexport const ITALIC_CLASS = 'xterm-italic';\nexport const UNDERLINE_CLASS = 'xterm-underline';\nexport const STRIKETHROUGH_CLASS = 'xterm-strikethrough';\nexport const CURSOR_CLASS = 'xterm-cursor';\nexport const CURSOR_BLINK_CLASS = 'xterm-cursor-blink';\nexport const CURSOR_STYLE_BLOCK_CLASS = 'xterm-cursor-block';\nexport const CURSOR_STYLE_BAR_CLASS = 'xterm-cursor-bar';\nexport const CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline';\n\nexport class DomRendererRowFactory {\n private _workCell: CellData = new CellData();\n\n private _selectionStart: [number, number] | undefined;\n private _selectionEnd: [number, number] | undefined;\n private _columnSelectMode: boolean = false;\n\n constructor(\n private readonly _document: Document,\n @ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @ICoreService private readonly _coreService: ICoreService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IThemeService private readonly _themeService: IThemeService\n ) {}\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionStart = start;\n this._selectionEnd = end;\n this._columnSelectMode = columnSelectMode;\n }\n\n public createRow(lineData: IBufferLine, row: number, isCursorRow: boolean, cursorStyle: string | undefined, cursorX: number, cursorBlink: boolean, cellWidth: number, cols: number, cellMap: Int16Array): DocumentFragment {\n // NOTE: `cellMap` maps cell positions to a span element index in a row.\n // All positions should be updated, even skipped ones after wide chars or left overs at the end,\n // otherwise the mouse hover logic might mark the wrong elements as underlined.\n\n const fragment = this._document.createDocumentFragment();\n\n const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);\n // Find the line length first, this prevents the need to output a bunch of\n // empty cells at the end. This cannot easily be integrated into the main\n // loop below because of the colCount feature (which can be removed after we\n // properly support reflow and disallow data to go beyond the right-side of\n // the viewport).\n let lineLength = 0;\n for (let x = Math.min(lineData.length, cols) - 1; x >= 0; x--) {\n if (lineData.loadCell(x, this._workCell).getCode() !== NULL_CELL_CODE || (isCursorRow && x === cursorX)) {\n lineLength = x + 1;\n break;\n }\n }\n\n const colors = this._themeService.colors;\n let elemIndex = -1;\n\n let x = 0;\n for (; x < lineLength; x++) {\n lineData.loadCell(x, this._workCell);\n let width = this._workCell.getWidth();\n\n // The character to the left is a wide character, drawing is owned by the char at x-1\n // still have to update cellMap with current element index\n if (width === 0) {\n cellMap[x] = elemIndex;\n continue;\n }\n\n // If true, indicates that the current character(s) to draw were joined.\n let isJoined = false;\n let lastCharX = x;\n\n // Process any joined character ranges as needed. Because of how the\n // ranges are produced, we know that they are valid for the characters\n // and attributes of our input.\n let cell = this._workCell;\n if (joinedRanges.length > 0 && x === joinedRanges[0][0]) {\n isJoined = true;\n const range = joinedRanges.shift()!;\n\n // We already know the exact start and end column of the joined range,\n // so we get the string and width representing it directly\n cell = new JoinedCellData(\n this._workCell,\n lineData.translateToString(true, range[0], range[1]),\n range[1] - range[0]\n );\n\n // Skip over the cells occupied by this range in the loop\n lastCharX = range[1] - 1;\n\n // Recalculate width\n width = cell.getWidth();\n }\n\n const charElement = this._document.createElement('span');\n if (width > 1) {\n charElement.style.width = `${cellWidth * width}px`;\n }\n\n if (isJoined) {\n // Ligatures in the DOM renderer must use display inline, as they may not show with\n // inline-block if they are outside the bounds of the element\n charElement.style.display = 'inline';\n\n // The DOM renderer colors the background of the cursor but for ligatures all cells are\n // joined. The workaround here is to show a cursor around the whole ligature so it shows up,\n // the cursor looks the same when on any character of the ligature though\n if (cursorX >= x && cursorX <= lastCharX) {\n cursorX = x;\n }\n }\n\n if (!this._coreService.isCursorHidden && isCursorRow && x === cursorX) {\n charElement.classList.add(CURSOR_CLASS);\n\n if (cursorBlink) {\n charElement.classList.add(CURSOR_BLINK_CLASS);\n }\n\n switch (cursorStyle) {\n case 'bar':\n charElement.classList.add(CURSOR_STYLE_BAR_CLASS);\n break;\n case 'underline':\n charElement.classList.add(CURSOR_STYLE_UNDERLINE_CLASS);\n break;\n default:\n charElement.classList.add(CURSOR_STYLE_BLOCK_CLASS);\n break;\n }\n }\n\n if (cell.isBold()) {\n charElement.classList.add(BOLD_CLASS);\n }\n\n if (cell.isItalic()) {\n charElement.classList.add(ITALIC_CLASS);\n }\n\n if (cell.isDim()) {\n charElement.classList.add(DIM_CLASS);\n }\n\n if (cell.isInvisible()) {\n charElement.textContent = WHITESPACE_CELL_CHAR;\n } else {\n charElement.textContent = cell.getChars() || WHITESPACE_CELL_CHAR;\n }\n\n if (cell.isUnderline()) {\n charElement.classList.add(`${UNDERLINE_CLASS}-${cell.extended.underlineStyle}`);\n if (charElement.textContent === ' ') {\n charElement.textContent = '\\xa0'; // =  \n }\n if (!cell.isUnderlineColorDefault()) {\n if (cell.isUnderlineColorRGB()) {\n charElement.style.textDecorationColor = `rgb(${AttributeData.toColorRGB(cell.getUnderlineColor()).join(',')})`;\n } else {\n let fg = cell.getUnderlineColor();\n if (this._optionsService.rawOptions.drawBoldTextInBrightColors && cell.isBold() && fg < 8) {\n fg += 8;\n }\n charElement.style.textDecorationColor = colors.ansi[fg].css;\n }\n }\n }\n\n if (cell.isStrikethrough()) {\n charElement.classList.add(STRIKETHROUGH_CLASS);\n }\n\n let fg = cell.getFgColor();\n let fgColorMode = cell.getFgColorMode();\n let bg = cell.getBgColor();\n let bgColorMode = cell.getBgColorMode();\n const isInverse = !!cell.isInverse();\n if (isInverse) {\n const temp = fg;\n fg = bg;\n bg = temp;\n const temp2 = fgColorMode;\n fgColorMode = bgColorMode;\n bgColorMode = temp2;\n }\n\n // Apply any decoration foreground/background overrides, this must happen after inverse has\n // been applied\n let bgOverride: IColor | undefined;\n let fgOverride: IColor | undefined;\n let isTop = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n if (d.options.layer !== 'top' && isTop) {\n return;\n }\n if (d.backgroundColorRGB) {\n bgColorMode = Attributes.CM_RGB;\n bg = d.backgroundColorRGB.rgba >> 8 & 0xFFFFFF;\n bgOverride = d.backgroundColorRGB;\n }\n if (d.foregroundColorRGB) {\n fgColorMode = Attributes.CM_RGB;\n fg = d.foregroundColorRGB.rgba >> 8 & 0xFFFFFF;\n fgOverride = d.foregroundColorRGB;\n }\n isTop = d.options.layer === 'top';\n });\n\n // Apply selection foreground if applicable\n const isInSelection = this._isCellInSelection(x, row);\n if (!isTop) {\n if (colors.selectionForeground && isInSelection) {\n fgColorMode = Attributes.CM_RGB;\n fg = colors.selectionForeground.rgba >> 8 & 0xFFFFFF;\n fgOverride = colors.selectionForeground;\n }\n }\n\n // If in the selection, force the element to be above the selection to improve contrast and\n // support opaque selections\n if (isInSelection) {\n bgOverride = this._coreBrowserService.isFocused ? colors.selectionBackgroundOpaque : colors.selectionInactiveBackgroundOpaque;\n isTop = true;\n }\n\n // If it's a top decoration, render above the selection\n if (isTop) {\n charElement.classList.add(`xterm-decoration-top`);\n }\n\n // Background\n let resolvedBg: IColor;\n switch (bgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n resolvedBg = colors.ansi[bg];\n charElement.classList.add(`xterm-bg-${bg}`);\n break;\n case Attributes.CM_RGB:\n resolvedBg = rgba.toColor(bg >> 16, bg >> 8 & 0xFF, bg & 0xFF);\n this._addStyle(charElement, `background-color:#${padStart((bg >>> 0).toString(16), '0', 6)}`);\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (isInverse) {\n resolvedBg = colors.foreground;\n charElement.classList.add(`xterm-bg-${INVERTED_DEFAULT_COLOR}`);\n } else {\n resolvedBg = colors.background;\n }\n }\n\n // If there is no background override by now it's the original color, so apply dim if needed\n if (!bgOverride) {\n if (cell.isDim()) {\n bgOverride = color.multiplyOpacity(resolvedBg, 0.5);\n }\n }\n\n // Foreground\n switch (fgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n if (cell.isBold() && fg < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors) {\n fg += 8;\n }\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.ansi[fg], cell, bgOverride, undefined)) {\n charElement.classList.add(`xterm-fg-${fg}`);\n }\n break;\n case Attributes.CM_RGB:\n const color = rgba.toColor(\n (fg >> 16) & 0xFF,\n (fg >> 8) & 0xFF,\n (fg ) & 0xFF\n );\n if (!this._applyMinimumContrast(charElement, resolvedBg, color, cell, bgOverride, fgOverride)) {\n this._addStyle(charElement, `color:#${padStart(fg.toString(16), '0', 6)}`);\n }\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.foreground, cell, bgOverride, undefined)) {\n if (isInverse) {\n charElement.classList.add(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);\n }\n }\n }\n\n fragment.appendChild(charElement);\n cellMap[x] = ++elemIndex;\n\n x = lastCharX;\n }\n\n // since the loop above might exit early not handling all cells,\n // also set remaining cell positions to last element index\n if (x < cols - 1) {\n cellMap.subarray(x).fill(++elemIndex);\n }\n\n return fragment;\n }\n\n private _applyMinimumContrast(element: HTMLElement, bg: IColor, fg: IColor, cell: ICellData, bgOverride: IColor | undefined, fgOverride: IColor | undefined): boolean {\n if (this._optionsService.rawOptions.minimumContrastRatio === 1 || excludeFromContrastRatioDemands(cell.getCode())) {\n return false;\n }\n\n // Try get from cache first, only use the cache when there are no decoration overrides\n let adjustedColor: IColor | undefined | null = undefined;\n if (!bgOverride && !fgOverride) {\n adjustedColor = this._themeService.colors.contrastCache.getColor(bg.rgba, fg.rgba);\n }\n\n // Calculate and store in cache\n if (adjustedColor === undefined) {\n adjustedColor = color.ensureContrastRatio(bgOverride || bg, fgOverride || fg, this._optionsService.rawOptions.minimumContrastRatio);\n this._themeService.colors.contrastCache.setColor((bgOverride || bg).rgba, (fgOverride || fg).rgba, adjustedColor ?? null);\n }\n\n if (adjustedColor) {\n this._addStyle(element, `color:${adjustedColor.css}`);\n return true;\n }\n\n return false;\n }\n\n private _addStyle(element: HTMLElement, style: string): void {\n element.setAttribute('style', `${element.getAttribute('style') || ''}${style};`);\n }\n\n private _isCellInSelection(x: number, y: number): boolean {\n const start = this._selectionStart;\n const end = this._selectionEnd;\n if (!start || !end) {\n return false;\n }\n if (this._columnSelectMode) {\n if (start[0] <= end[0]) {\n return x >= start[0] && y >= start[1] &&\n x < end[0] && y <= end[1];\n }\n return x < start[0] && y >= start[1] &&\n x >= end[0] && y <= end[1];\n }\n return (y > start[1] && y < end[1]) ||\n (start[1] === end[1] && y === start[1] && x >= start[0] && x < end[0]) ||\n (start[1] < end[1] && y === end[1] && x < end[0]) ||\n (start[1] < end[1] && y === start[1] && x >= start[0]);\n }\n}\n\nfunction padStart(text: string, padChar: string, length: number): string {\n while (text.length < length) {\n text = padChar + text;\n }\n return text;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isFirefox, isLegacyEdge } from 'common/Platform';\n\nexport const INVERTED_DEFAULT_COLOR = 257;\n\nexport const DIM_OPACITY = 0.5;\n// The text baseline is set conditionally by browser. Using 'ideographic' for Firefox or Legacy Edge would\n// result in truncated text (Issue 3353). Using 'bottom' for Chrome would result in slightly\n// unaligned Powerline fonts (PR 3356#issuecomment-850928179).\nexport const TEXT_BASELINE: CanvasTextBaseline = isFirefox || isLegacyEdge ? 'bottom' : 'ideographic';\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDimensions, IOffset, IRenderDimensions } from 'browser/renderer/shared/Types';\n\nexport function throwIfFalsy(value: T | undefined | null): T {\n if (!value) {\n throw new Error('value must not be falsy');\n }\n return value;\n}\n\nexport function isPowerlineGlyph(codepoint: number): boolean {\n // Only return true for Powerline symbols which require\n // different padding and should be excluded from minimum contrast\n // ratio standards\n return 0xE0A4 <= codepoint && codepoint <= 0xE0D6;\n}\n\nexport function isRestrictedPowerlineGlyph(codepoint: number): boolean {\n return 0xE0B0 <= codepoint && codepoint <= 0xE0B7;\n}\n\nfunction isBoxOrBlockGlyph(codepoint: number): boolean {\n return 0x2500 <= codepoint && codepoint <= 0x259F;\n}\n\nexport function excludeFromContrastRatioDemands(codepoint: number): boolean {\n return isPowerlineGlyph(codepoint) || isBoxOrBlockGlyph(codepoint);\n}\n\nexport function createRenderDimensions(): IRenderDimensions {\n return {\n css: {\n canvas: createDimension(),\n cell: createDimension()\n },\n device: {\n canvas: createDimension(),\n cell: createDimension(),\n char: {\n width: 0,\n height: 0,\n left: 0,\n top: 0\n }\n }\n };\n}\n\nfunction createDimension(): IDimensions {\n return {\n width: 0,\n height: 0\n };\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService } from 'common/services/Services';\n\n/**\n * Represents a selection within the buffer. This model only cares about column\n * and row coordinates, not wide characters.\n */\nexport class SelectionModel {\n /**\n * Whether select all is currently active.\n */\n public isSelectAllActive: boolean = false;\n\n /**\n * The minimal length of the selection from the start position. When double\n * clicking on a word, the word will be selected which makes the selection\n * start at the start of the word and makes this variable the length.\n */\n public selectionStartLength: number = 0;\n\n /**\n * The [x, y] position the selection starts at.\n */\n public selectionStart: [number, number] | undefined;\n\n /**\n * The [x, y] position the selection ends at.\n */\n public selectionEnd: [number, number] | undefined;\n\n constructor(\n private _bufferService: IBufferService\n ) {\n }\n\n /**\n * Clears the current selection.\n */\n public clearSelection(): void {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n }\n\n /**\n * The final selection start, taking into consideration select all.\n */\n public get finalSelectionStart(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [0, 0];\n }\n\n if (!this.selectionEnd || !this.selectionStart) {\n return this.selectionStart;\n }\n\n return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;\n }\n\n /**\n * The final selection end, taking into consideration select all, double click\n * word selection and triple click line selection.\n */\n public get finalSelectionEnd(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];\n }\n\n if (!this.selectionStart) {\n return undefined;\n }\n\n // Use the selection start + length if the end doesn't exist or they're reversed\n if (!this.selectionEnd || this.areSelectionValuesReversed()) {\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n // Ensure the trailing EOL isn't included when the selection ends on the right edge\n if (startPlusLength % this._bufferService.cols === 0) {\n return [this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols) - 1];\n }\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [startPlusLength, this.selectionStart[1]];\n }\n\n // Ensure the the word/line is selected after a double/triple click\n if (this.selectionStartLength) {\n // Select the larger of the two when start and end are on the same line\n if (this.selectionEnd[1] === this.selectionStart[1]) {\n // Keep the whole wrapped word/line selected if the content wraps multiple lines\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [Math.max(startPlusLength, this.selectionEnd[0]), this.selectionEnd[1]];\n }\n }\n return this.selectionEnd;\n }\n\n /**\n * Returns whether the selection start and end are reversed.\n */\n public areSelectionValuesReversed(): boolean {\n const start = this.selectionStart;\n const end = this.selectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n * @returns Whether a refresh is necessary.\n */\n public handleTrim(amount: number): boolean {\n // Adjust the selection position based on the trimmed amount.\n if (this.selectionStart) {\n this.selectionStart[1] -= amount;\n }\n if (this.selectionEnd) {\n this.selectionEnd[1] -= amount;\n }\n\n // The selection has moved off the buffer, clear it.\n if (this.selectionEnd && this.selectionEnd[1] < 0) {\n this.clearSelection();\n return true;\n }\n\n // If the selection start is trimmed, ensure the start column is 0.\n if (this.selectionStart && this.selectionStart[1] < 0) {\n this.selectionStart[1] = 0;\n }\n return false;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService } from 'common/services/Services';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { ICharSizeService } from 'browser/services/Services';\nimport { Disposable } from 'common/Lifecycle';\nimport { ITerminalOptions } from 'common/Types';\n\nexport class CharSizeService extends Disposable implements ICharSizeService {\n public serviceBrand: undefined;\n\n public width: number = 0;\n public height: number = 0;\n private _measureStrategy: IMeasureStrategy;\n\n public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }\n\n private readonly _onCharSizeChange = this.register(new EventEmitter());\n public readonly onCharSizeChange = this._onCharSizeChange.event;\n\n constructor(\n document: Document,\n parentElement: HTMLElement,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this._measureStrategy = new DomMeasureStrategy(document, parentElement, this._optionsService);\n this.register(this._optionsService.onMultipleOptionChange(['fontFamily', 'fontSize'], () => this.measure()));\n }\n\n public measure(): void {\n const result = this._measureStrategy.measure();\n if (result.width !== this.width || result.height !== this.height) {\n this.width = result.width;\n this.height = result.height;\n this._onCharSizeChange.fire();\n }\n }\n}\n\ninterface IMeasureStrategy {\n measure(): IReadonlyMeasureResult;\n}\n\ninterface IReadonlyMeasureResult {\n readonly width: number;\n readonly height: number;\n}\n\ninterface IMeasureResult {\n width: number;\n height: number;\n}\n\n// TODO: For supporting browsers we should also provide a CanvasCharDimensionsProvider that uses ctx.measureText\nclass DomMeasureStrategy implements IMeasureStrategy {\n private _result: IMeasureResult = { width: 0, height: 0 };\n private _measureElement: HTMLElement;\n\n constructor(\n private _document: Document,\n private _parentElement: HTMLElement,\n private _optionsService: IOptionsService\n ) {\n this._measureElement = this._document.createElement('span');\n this._measureElement.classList.add('xterm-char-measure-element');\n this._measureElement.textContent = 'W';\n this._measureElement.setAttribute('aria-hidden', 'true');\n this._parentElement.appendChild(this._measureElement);\n }\n\n public measure(): IReadonlyMeasureResult {\n this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`;\n\n // Note that this triggers a synchronous layout\n const geometry = this._measureElement.getBoundingClientRect();\n\n // If values are 0 then the element is likely currently display:none, in which case we should\n // retain the previous value.\n if (geometry.width !== 0 && geometry.height !== 0) {\n this._result.width = geometry.width;\n this._result.height = Math.ceil(geometry.height);\n }\n\n return this._result;\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, CharData } from 'common/Types';\nimport { ICharacterJoiner } from 'browser/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WHITESPACE_CELL_CHAR, Content } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService } from 'common/services/Services';\nimport { ICharacterJoinerService } from 'browser/services/Services';\n\nexport class JoinedCellData extends AttributeData implements ICellData {\n private _width: number;\n // .content carries no meaning for joined CellData, simply nullify it\n // thus we have to overload all other .content accessors\n public content: number = 0;\n public fg: number;\n public bg: number;\n public combinedData: string = '';\n\n constructor(firstCell: ICellData, chars: string, width: number) {\n super();\n this.fg = firstCell.fg;\n this.bg = firstCell.bg;\n this.combinedData = chars;\n this._width = width;\n }\n\n public isCombined(): number {\n // always mark joined cell data as combined\n return Content.IS_COMBINED_MASK;\n }\n\n public getWidth(): number {\n return this._width;\n }\n\n public getChars(): string {\n return this.combinedData;\n }\n\n public getCode(): number {\n // code always gets the highest possible fake codepoint (read as -1)\n // this is needed as code is used by caches as identifier\n return 0x1FFFFF;\n }\n\n public setFromCharData(value: CharData): void {\n throw new Error('not implemented');\n }\n\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n\nexport class CharacterJoinerService implements ICharacterJoinerService {\n public serviceBrand: undefined;\n\n private _characterJoiners: ICharacterJoiner[] = [];\n private _nextCharacterJoinerId: number = 0;\n private _workCell: CellData = new CellData();\n\n constructor(\n @IBufferService private _bufferService: IBufferService\n ) { }\n\n public register(handler: (text: string) => [number, number][]): number {\n const joiner: ICharacterJoiner = {\n id: this._nextCharacterJoinerId++,\n handler\n };\n\n this._characterJoiners.push(joiner);\n return joiner.id;\n }\n\n public deregister(joinerId: number): boolean {\n for (let i = 0; i < this._characterJoiners.length; i++) {\n if (this._characterJoiners[i].id === joinerId) {\n this._characterJoiners.splice(i, 1);\n return true;\n }\n }\n\n return false;\n }\n\n public getJoinedCharacters(row: number): [number, number][] {\n if (this._characterJoiners.length === 0) {\n return [];\n }\n\n const line = this._bufferService.buffer.lines.get(row);\n if (!line || line.length === 0) {\n return [];\n }\n\n const ranges: [number, number][] = [];\n const lineStr = line.translateToString(true);\n\n // Because some cells can be represented by multiple javascript characters,\n // we track the cell and the string indexes separately. This allows us to\n // translate the string ranges we get from the joiners back into cell ranges\n // for use when rendering\n let rangeStartColumn = 0;\n let currentStringIndex = 0;\n let rangeStartStringIndex = 0;\n let rangeAttrFG = line.getFg(0);\n let rangeAttrBG = line.getBg(0);\n\n for (let x = 0; x < line.getTrimmedLength(); x++) {\n line.loadCell(x, this._workCell);\n\n if (this._workCell.getWidth() === 0) {\n // If this character is of width 0, skip it.\n continue;\n }\n\n // End of range\n if (this._workCell.fg !== rangeAttrFG || this._workCell.bg !== rangeAttrBG) {\n // If we ended up with a sequence of more than one character,\n // look for ranges to join.\n if (x - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n // Reset our markers for a new range.\n rangeStartColumn = x;\n rangeStartStringIndex = currentStringIndex;\n rangeAttrFG = this._workCell.fg;\n rangeAttrBG = this._workCell.bg;\n }\n\n currentStringIndex += this._workCell.getChars().length || WHITESPACE_CELL_CHAR.length;\n }\n\n // Process any trailing ranges.\n if (this._bufferService.cols - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n return ranges;\n }\n\n /**\n * Given a segment of a line of text, find all ranges of text that should be\n * joined in a single rendering unit. Ranges are internally converted to\n * column ranges, rather than string ranges.\n * @param line String representation of the full line of text\n * @param startIndex Start position of the range to search in the string (inclusive)\n * @param endIndex End position of the range to search in the string (exclusive)\n */\n private _getJoinedRanges(line: string, startIndex: number, endIndex: number, lineData: IBufferLine, startCol: number): [number, number][] {\n const text = line.substring(startIndex, endIndex);\n // At this point we already know that there is at least one joiner so\n // we can just pull its value and assign it directly rather than\n // merging it into an empty array, which incurs unnecessary writes.\n let allJoinedRanges: [number, number][] = [];\n try {\n allJoinedRanges = this._characterJoiners[0].handler(text);\n } catch (error) {\n console.error(error);\n }\n for (let i = 1; i < this._characterJoiners.length; i++) {\n // We merge any overlapping ranges across the different joiners\n try {\n const joinerRanges = this._characterJoiners[i].handler(text);\n for (let j = 0; j < joinerRanges.length; j++) {\n CharacterJoinerService._mergeRanges(allJoinedRanges, joinerRanges[j]);\n }\n } catch (error) {\n console.error(error);\n }\n }\n this._stringRangesToCellRanges(allJoinedRanges, lineData, startCol);\n return allJoinedRanges;\n }\n\n /**\n * Modifies the provided ranges in-place to adjust for variations between\n * string length and cell width so that the range represents a cell range,\n * rather than the string range the joiner provides.\n * @param ranges String ranges containing start (inclusive) and end (exclusive) index\n * @param line Cell data for the relevant line in the terminal\n * @param startCol Offset within the line to start from\n */\n private _stringRangesToCellRanges(ranges: [number, number][], line: IBufferLine, startCol: number): void {\n let currentRangeIndex = 0;\n let currentRangeStarted = false;\n let currentStringIndex = 0;\n let currentRange = ranges[currentRangeIndex];\n\n // If we got through all of the ranges, stop searching\n if (!currentRange) {\n return;\n }\n\n for (let x = startCol; x < this._bufferService.cols; x++) {\n const width = line.getWidth(x);\n const length = line.getString(x).length || WHITESPACE_CELL_CHAR.length;\n\n // We skip zero-width characters when creating the string to join the text\n // so we do the same here\n if (width === 0) {\n continue;\n }\n\n // Adjust the start of the range\n if (!currentRangeStarted && currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n }\n\n // Adjust the end of the range\n if (currentRange[1] <= currentStringIndex) {\n currentRange[1] = x;\n\n // We're finished with this range, so we move to the next one\n currentRange = ranges[++currentRangeIndex];\n\n // If there are no more ranges left, stop searching\n if (!currentRange) {\n break;\n }\n\n // Ranges can be on adjacent characters. Because the end index of the\n // ranges are exclusive, this means that the index for the start of a\n // range can be the same as the end index of the previous range. To\n // account for the start of the next range, we check here just in case.\n if (currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n } else {\n currentRangeStarted = false;\n }\n }\n\n // Adjust the string index based on the character length to line up with\n // the column adjustment\n currentStringIndex += length;\n }\n\n // If there is still a range left at the end, it must extend all the way to\n // the end of the line.\n if (currentRange) {\n currentRange[1] = this._bufferService.cols;\n }\n }\n\n /**\n * Merges the range defined by the provided start and end into the list of\n * existing ranges. The merge is done in place on the existing range for\n * performance and is also returned.\n * @param ranges Existing range list\n * @param newRange Tuple of two numbers representing the new range to merge in.\n * @returns The ranges input with the new range merged in place\n */\n private static _mergeRanges(ranges: [number, number][], newRange: [number, number]): [number, number][] {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ranges.splice(i, 0, newRange);\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 2: New range is either wholly contained within the\n // search range or overlaps with the front of it\n range[0] = Math.min(newRange[0], range[0]);\n return ranges;\n }\n\n if (newRange[0] < range[1]) {\n // Case 3: New range either wholly contains the search range\n // or overlaps with the end of it\n range[0] = Math.min(newRange[0], range[0]);\n inRange = true;\n }\n\n // Case 4: New range starts after the search range\n continue;\n } else {\n if (newRange[1] <= range[0]) {\n // Case 5: New range extends from previous range but doesn't\n // reach the current one\n ranges[i - 1][1] = newRange[1];\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 6: New range extends from prvious range into the\n // current range\n ranges[i - 1][1] = Math.max(newRange[1], range[1]);\n ranges.splice(i, 1);\n return ranges;\n }\n\n // Case 7: New range extends from previous range past the\n // end of the current range\n ranges.splice(i, 1);\n i--;\n }\n }\n\n if (inRange) {\n // Case 8: New range extends past the last existing range\n ranges[ranges.length - 1][1] = newRange[1];\n } else {\n // Case 9: New range starts after the last existing range\n ranges.push(newRange);\n }\n\n return ranges;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService } from './Services';\n\nexport class CoreBrowserService implements ICoreBrowserService {\n public serviceBrand: undefined;\n\n private _isFocused = false;\n private _cachedIsFocused: boolean | undefined = undefined;\n\n constructor(\n private _textarea: HTMLTextAreaElement,\n public readonly window: Window & typeof globalThis\n ) {\n this._textarea.addEventListener('focus', () => this._isFocused = true);\n this._textarea.addEventListener('blur', () => this._isFocused = false);\n }\n\n public get dpr(): number {\n return this.window.devicePixelRatio;\n }\n\n public get isFocused(): boolean {\n if (this._cachedIsFocused === undefined) {\n this._cachedIsFocused = this._isFocused && this._textarea.ownerDocument.hasFocus();\n queueMicrotask(() => this._cachedIsFocused = undefined);\n }\n return this._cachedIsFocused;\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharSizeService, IRenderService, IMouseService } from './Services';\nimport { getCoords, getCoordsRelativeToElement } from 'browser/input/Mouse';\n\nexport class MouseService implements IMouseService {\n public serviceBrand: undefined;\n\n constructor(\n @IRenderService private readonly _renderService: IRenderService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService\n ) {\n }\n\n public getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined {\n return getCoords(\n window,\n event,\n element,\n colCount,\n rowCount,\n this._charSizeService.hasValidSize,\n this._renderService.dimensions.css.cell.width,\n this._renderService.dimensions.css.cell.height,\n isSelection\n );\n }\n\n public getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined {\n const coords = getCoordsRelativeToElement(window, event, element);\n\n // due to rounding issues in zoom states pixel values might be negative or overflow actual canvas\n // ignore those events effectively narrowing mouse area a tiny bit at the edges\n if (!this._charSizeService.hasValidSize\n || coords[0] < 0\n || coords[1] < 0\n || coords[0] >= this._renderService.dimensions.css.canvas.width\n || coords[1] >= this._renderService.dimensions.css.canvas.height) {\n return undefined;\n }\n\n return {\n col: Math.floor(coords[0] / this._renderService.dimensions.css.cell.width),\n row: Math.floor(coords[1] / this._renderService.dimensions.css.cell.height),\n x: Math.floor(coords[0]),\n y: Math.floor(coords[1])\n };\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderer, IRenderDimensions } from 'browser/renderer/shared/Types';\nimport { RenderDebouncer } from 'browser/RenderDebouncer';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { ScreenDprMonitor } from 'browser/ScreenDprMonitor';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IColorSet, IRenderDebouncerWithCallback, ReadonlyColorSet } from 'browser/Types';\nimport { IOptionsService, IBufferService, IDecorationService } from 'common/services/Services';\nimport { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { DebouncedIdleTask } from 'common/TaskQueue';\nimport { ThemeService } from 'browser/services/ThemeService';\n\ninterface ISelectionState {\n start: [number, number] | undefined;\n end: [number, number] | undefined;\n columnSelectMode: boolean;\n}\n\nexport class RenderService extends Disposable implements IRenderService {\n public serviceBrand: undefined;\n\n private _renderer: IRenderer | undefined;\n private _renderDebouncer: IRenderDebouncerWithCallback;\n private _screenDprMonitor: ScreenDprMonitor;\n private _pausedResizeTask = new DebouncedIdleTask();\n\n private _isPaused: boolean = false;\n private _needsFullRefresh: boolean = false;\n private _isNextRenderRedrawOnly: boolean = true;\n private _needsSelectionRefresh: boolean = false;\n private _canvasWidth: number = 0;\n private _canvasHeight: number = 0;\n private _selectionState: ISelectionState = {\n start: undefined,\n end: undefined,\n columnSelectMode: false\n };\n\n private readonly _onDimensionsChange = this.register(new EventEmitter());\n public readonly onDimensionsChange = this._onDimensionsChange.event;\n private readonly _onRenderedViewportChange = this.register(new EventEmitter<{ start: number, end: number }>());\n public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;\n private readonly _onRender = this.register(new EventEmitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onRefreshRequest = this.register(new EventEmitter<{ start: number, end: number }>());\n public readonly onRefreshRequest = this._onRefreshRequest.event;\n\n public get dimensions(): IRenderDimensions { return this._renderer!.dimensions; }\n\n constructor(\n private _rowCount: number,\n screenElement: HTMLElement,\n @IOptionsService optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IDecorationService decorationService: IDecorationService,\n @IBufferService bufferService: IBufferService,\n @ICoreBrowserService coreBrowserService: ICoreBrowserService,\n @IThemeService themeService: IThemeService\n ) {\n super();\n\n this.register({ dispose: () => this._renderer?.dispose() });\n\n this._renderDebouncer = new RenderDebouncer(coreBrowserService.window, (start, end) => this._renderRows(start, end));\n this.register(this._renderDebouncer);\n\n this._screenDprMonitor = new ScreenDprMonitor(coreBrowserService.window);\n this._screenDprMonitor.setListener(() => this.handleDevicePixelRatioChange());\n this.register(this._screenDprMonitor);\n\n this.register(bufferService.onResize(() => this._fullRefresh()));\n this.register(bufferService.buffers.onBufferActivate(() => this._renderer?.clear()));\n this.register(optionsService.onOptionChange(() => this._handleOptionsChanged()));\n this.register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged()));\n\n // Do a full refresh whenever any decoration is added or removed. This may not actually result\n // in changes but since decorations should be used sparingly or added/removed all in the same\n // frame this should have minimal performance impact.\n this.register(decorationService.onDecorationRegistered(() => this._fullRefresh()));\n this.register(decorationService.onDecorationRemoved(() => this._fullRefresh()));\n\n // Clear the renderer when the a change that could affect glyphs occurs\n this.register(optionsService.onMultipleOptionChange([\n 'customGlyphs',\n 'drawBoldTextInBrightColors',\n 'letterSpacing',\n 'lineHeight',\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'fontWeightBold',\n 'minimumContrastRatio'\n ], () => {\n this.clear();\n this.handleResize(bufferService.cols, bufferService.rows);\n this._fullRefresh();\n }));\n\n // Refresh the cursor line when the cursor changes\n this.register(optionsService.onMultipleOptionChange([\n 'cursorBlink',\n 'cursorStyle'\n ], () => this.refreshRows(bufferService.buffer.y, bufferService.buffer.y, true)));\n\n // dprchange should handle this case, we need this as well for browsers that don't support the\n // matchMedia query.\n this.register(addDisposableDomListener(coreBrowserService.window, 'resize', () => this.handleDevicePixelRatioChange()));\n\n this.register(themeService.onChangeColors(() => this._fullRefresh()));\n\n // Detect whether IntersectionObserver is detected and enable renderer pause\n // and resume based on terminal visibility if so\n if ('IntersectionObserver' in coreBrowserService.window) {\n const observer = new coreBrowserService.window.IntersectionObserver(e => this._handleIntersectionChange(e[e.length - 1]), { threshold: 0 });\n observer.observe(screenElement);\n this.register({ dispose: () => observer.disconnect() });\n }\n }\n\n private _handleIntersectionChange(entry: IntersectionObserverEntry): void {\n this._isPaused = entry.isIntersecting === undefined ? (entry.intersectionRatio === 0) : !entry.isIntersecting;\n\n // Terminal was hidden on open\n if (!this._isPaused && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n\n if (!this._isPaused && this._needsFullRefresh) {\n this._pausedResizeTask.flush();\n this.refreshRows(0, this._rowCount - 1);\n this._needsFullRefresh = false;\n }\n }\n\n public refreshRows(start: number, end: number, isRedrawOnly: boolean = false): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n return;\n }\n if (!isRedrawOnly) {\n this._isNextRenderRedrawOnly = false;\n }\n this._renderDebouncer.refresh(start, end, this._rowCount);\n }\n\n private _renderRows(start: number, end: number): void {\n if (!this._renderer) {\n return;\n }\n this._renderer.renderRows(start, end);\n\n // Update selection if needed\n if (this._needsSelectionRefresh) {\n this._renderer.handleSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode);\n this._needsSelectionRefresh = false;\n }\n\n // Fire render event only if it was not a redraw\n if (!this._isNextRenderRedrawOnly) {\n this._onRenderedViewportChange.fire({ start, end });\n }\n this._onRender.fire({ start, end });\n this._isNextRenderRedrawOnly = true;\n }\n\n public resize(cols: number, rows: number): void {\n this._rowCount = rows;\n this._fireOnCanvasResize();\n }\n\n private _handleOptionsChanged(): void {\n if (!this._renderer) {\n return;\n }\n this.refreshRows(0, this._rowCount - 1);\n this._fireOnCanvasResize();\n }\n\n private _fireOnCanvasResize(): void {\n if (!this._renderer) {\n return;\n }\n // Don't fire the event if the dimensions haven't changed\n if (this._renderer.dimensions.css.canvas.width === this._canvasWidth && this._renderer.dimensions.css.canvas.height === this._canvasHeight) {\n return;\n }\n this._onDimensionsChange.fire(this._renderer.dimensions);\n }\n\n public hasRenderer(): boolean {\n return !!this._renderer;\n }\n\n public setRenderer(renderer: IRenderer): void {\n // TODO: RenderService should be the only one to dispose the renderer\n this._renderer?.dispose();\n this._renderer = renderer;\n this._renderer.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));\n\n // Force a refresh\n this._needsSelectionRefresh = true;\n this._fullRefresh();\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n return this._renderDebouncer.addRefreshCallback(callback);\n }\n\n private _fullRefresh(): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n } else {\n this.refreshRows(0, this._rowCount - 1);\n }\n }\n\n public clearTextureAtlas(): void {\n if (!this._renderer) {\n return;\n }\n this._renderer.clearTextureAtlas?.();\n this._fullRefresh();\n }\n\n public handleDevicePixelRatioChange(): void {\n // Force char size measurement as DomMeasureStrategy(getBoundingClientRect) is not stable\n // when devicePixelRatio changes\n this._charSizeService.measure();\n\n if (!this._renderer) {\n return;\n }\n this._renderer.handleDevicePixelRatioChange();\n this.refreshRows(0, this._rowCount - 1);\n }\n\n public handleResize(cols: number, rows: number): void {\n if (!this._renderer) {\n return;\n }\n if (this._isPaused) {\n this._pausedResizeTask.set(() => this._renderer!.handleResize(cols, rows));\n } else {\n this._renderer.handleResize(cols, rows);\n }\n this._fullRefresh();\n }\n\n // TODO: Is this useful when we have onResize?\n public handleCharSizeChanged(): void {\n this._renderer?.handleCharSizeChanged();\n }\n\n public handleBlur(): void {\n this._renderer?.handleBlur();\n }\n\n public handleFocus(): void {\n this._renderer?.handleFocus();\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionState.start = start;\n this._selectionState.end = end;\n this._selectionState.columnSelectMode = columnSelectMode;\n this._renderer?.handleSelectionChanged(start, end, columnSelectMode);\n }\n\n public handleCursorMove(): void {\n this._renderer?.handleCursorMove();\n }\n\n public clear(): void {\n this._renderer?.clear();\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IBufferLine, IDisposable } from 'common/Types';\nimport * as Browser from 'common/Platform';\nimport { SelectionModel } from 'browser/selection/SelectionModel';\nimport { CellData } from 'common/buffer/CellData';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { IMouseService, ISelectionService, IRenderService, ICoreBrowserService } from 'browser/services/Services';\nimport { IBufferRange, ILinkifier2 } from 'browser/Types';\nimport { IBufferService, IOptionsService, ICoreService } from 'common/services/Services';\nimport { getCoordsRelativeToElement } from 'browser/input/Mouse';\nimport { moveToCellSequence } from 'browser/input/MoveToCell';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { getRangeLength } from 'common/buffer/BufferRange';\n\n/**\n * The number of pixels the mouse needs to be above or below the viewport in\n * order to scroll at the maximum speed.\n */\nconst DRAG_SCROLL_MAX_THRESHOLD = 50;\n\n/**\n * The maximum scrolling speed\n */\nconst DRAG_SCROLL_MAX_SPEED = 15;\n\n/**\n * The number of milliseconds between drag scroll updates.\n */\nconst DRAG_SCROLL_INTERVAL = 50;\n\n/**\n * The maximum amount of time that can have elapsed for an alt click to move the\n * cursor.\n */\nconst ALT_CLICK_MOVE_CURSOR_TIME = 500;\n\nconst NON_BREAKING_SPACE_CHAR = String.fromCharCode(160);\nconst ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g');\n\n/**\n * Represents a position of a word on a line.\n */\ninterface IWordPosition {\n start: number;\n length: number;\n}\n\n/**\n * A selection mode, this drives how the selection behaves on mouse move.\n */\nexport const enum SelectionMode {\n NORMAL,\n WORD,\n LINE,\n COLUMN\n}\n\n/**\n * A class that manages the selection of the terminal. With help from\n * SelectionModel, SelectionService handles with all logic associated with\n * dealing with the selection, including handling mouse interaction, wide\n * characters and fetching the actual text within the selection. Rendering is\n * not handled by the SelectionService but the onRedrawRequest event is fired\n * when the selection is ready to be redrawn (on an animation frame).\n */\nexport class SelectionService extends Disposable implements ISelectionService {\n public serviceBrand: undefined;\n\n protected _model: SelectionModel;\n\n /**\n * The amount to scroll every drag scroll update (depends on how far the mouse\n * drag is above or below the terminal).\n */\n private _dragScrollAmount: number = 0;\n\n /**\n * The current selection mode.\n */\n protected _activeSelectionMode: SelectionMode;\n\n /**\n * A setInterval timer that is active while the mouse is down whose callback\n * scrolls the viewport when necessary.\n */\n private _dragScrollIntervalTimer: number | undefined;\n\n /**\n * The animation frame ID used for refreshing the selection.\n */\n private _refreshAnimationFrame: number | undefined;\n\n /**\n * Whether selection is enabled.\n */\n private _enabled = true;\n\n private _mouseMoveListener: EventListener;\n private _mouseUpListener: EventListener;\n private _trimListener: IDisposable;\n private _workCell: CellData = new CellData();\n\n private _mouseDownTimeStamp: number = 0;\n private _oldHasSelection: boolean = false;\n private _oldSelectionStart: [number, number] | undefined = undefined;\n private _oldSelectionEnd: [number, number] | undefined = undefined;\n\n private readonly _onLinuxMouseSelection = this.register(new EventEmitter());\n public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;\n private readonly _onRedrawRequest = this.register(new EventEmitter());\n public readonly onRequestRedraw = this._onRedrawRequest.event;\n private readonly _onSelectionChange = this.register(new EventEmitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onRequestScrollLines = this.register(new EventEmitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n constructor(\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _linkifier: ILinkifier2,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @IMouseService private readonly _mouseService: IMouseService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n\n // Init listeners\n this._mouseMoveListener = event => this._handleMouseMove(event as MouseEvent);\n this._mouseUpListener = event => this._handleMouseUp(event as MouseEvent);\n this._coreService.onUserInput(() => {\n if (this.hasSelection) {\n this.clearSelection();\n }\n });\n this._trimListener = this._bufferService.buffer.lines.onTrim(amount => this._handleTrim(amount));\n this.register(this._bufferService.buffers.onBufferActivate(e => this._handleBufferActivate(e)));\n\n this.enable();\n\n this._model = new SelectionModel(this._bufferService);\n this._activeSelectionMode = SelectionMode.NORMAL;\n\n this.register(toDisposable(() => {\n this._removeMouseDownListeners();\n }));\n }\n\n public reset(): void {\n this.clearSelection();\n }\n\n /**\n * Disables the selection manager. This is useful for when terminal mouse\n * are enabled.\n */\n public disable(): void {\n this.clearSelection();\n this._enabled = false;\n }\n\n /**\n * Enable the selection manager.\n */\n public enable(): void {\n this._enabled = true;\n }\n\n public get selectionStart(): [number, number] | undefined { return this._model.finalSelectionStart; }\n public get selectionEnd(): [number, number] | undefined { return this._model.finalSelectionEnd; }\n\n /**\n * Gets whether there is an active text selection.\n */\n public get hasSelection(): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }\n\n /**\n * Gets the text currently selected.\n */\n public get selectionText(): string {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return '';\n }\n\n const buffer = this._bufferService.buffer;\n const result: string[] = [];\n\n if (this._activeSelectionMode === SelectionMode.COLUMN) {\n // Ignore zero width selections\n if (start[0] === end[0]) {\n return '';\n }\n\n // For column selection it's not enough to rely on final selection's swapping of reversed\n // values, it also needs the x coordinates to swap independently of the y coordinate is needed\n const startCol = start[0] < end[0] ? start[0] : end[0];\n const endCol = start[0] < end[0] ? end[0] : start[0];\n for (let i = start[1]; i <= end[1]; i++) {\n const lineText = buffer.translateBufferLineToString(i, true, startCol, endCol);\n result.push(lineText);\n }\n } else {\n // Get first row\n const startRowEndCol = start[1] === end[1] ? end[0] : undefined;\n result.push(buffer.translateBufferLineToString(start[1], true, start[0], startRowEndCol));\n\n // Get middle rows\n for (let i = start[1] + 1; i <= end[1] - 1; i++) {\n const bufferLine = buffer.lines.get(i);\n const lineText = buffer.translateBufferLineToString(i, true);\n if (bufferLine?.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n\n // Get final row\n if (start[1] !== end[1]) {\n const bufferLine = buffer.lines.get(end[1]);\n const lineText = buffer.translateBufferLineToString(end[1], true, 0, end[0]);\n if (bufferLine && bufferLine!.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n }\n\n // Format string by replacing non-breaking space chars with regular spaces\n // and joining the array into a multi-line string.\n const formattedResult = result.map(line => {\n return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');\n }).join(Browser.isWindows ? '\\r\\n' : '\\n');\n\n return formattedResult;\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Queues a refresh, redrawing the selection on the next opportunity.\n * @param isLinuxMouseSelection Whether the selection should be registered as a new\n * selection on Linux.\n */\n public refresh(isLinuxMouseSelection?: boolean): void {\n // Queue the refresh for the renderer\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh());\n }\n\n // If the platform is Linux and the refresh call comes from a mouse event,\n // we need to update the selection for middle click to paste selection.\n if (Browser.isLinux && isLinuxMouseSelection) {\n const selectionText = this.selectionText;\n if (selectionText.length) {\n this._onLinuxMouseSelection.fire(this.selectionText);\n }\n }\n }\n\n /**\n * Fires the refresh event, causing consumers to pick it up and redraw the\n * selection state.\n */\n private _refresh(): void {\n this._refreshAnimationFrame = undefined;\n this._onRedrawRequest.fire({\n start: this._model.finalSelectionStart,\n end: this._model.finalSelectionEnd,\n columnSelectMode: this._activeSelectionMode === SelectionMode.COLUMN\n });\n }\n\n /**\n * Checks if the current click was inside the current selection\n * @param event The mouse event\n */\n private _isClickInSelection(event: MouseEvent): boolean {\n const coords = this._getMouseBufferCoords(event);\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n\n if (!start || !end || !coords) {\n return false;\n }\n\n return this._areCoordsInSelection(coords, start, end);\n }\n\n public isCellInSelection(x: number, y: number): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return this._areCoordsInSelection([x, y], start, end);\n }\n\n protected _areCoordsInSelection(coords: [number, number], start: [number, number], end: [number, number]): boolean {\n return (coords[1] > start[1] && coords[1] < end[1]) ||\n (start[1] === end[1] && coords[1] === start[1] && coords[0] >= start[0] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === end[1] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === start[1] && coords[0] >= start[0]);\n }\n\n /**\n * Selects word at the current mouse event coordinates.\n * @param event The mouse event.\n */\n private _selectWordAtCursor(event: MouseEvent, allowWhitespaceOnlySelection: boolean): boolean {\n // Check if there is a link under the cursor first and select that if so\n const range = this._linkifier.currentLink?.link?.range;\n if (range) {\n this._model.selectionStart = [range.start.x - 1, range.start.y - 1];\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n this._model.selectionEnd = undefined;\n return true;\n }\n\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._selectWordAt(coords, allowWhitespaceOnlySelection);\n this._model.selectionEnd = undefined;\n return true;\n }\n return false;\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._model.isSelectAllActive = true;\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n public selectLines(start: number, end: number): void {\n this._model.clearSelection();\n start = Math.max(start, 0);\n end = Math.min(end, this._bufferService.buffer.lines.length - 1);\n this._model.selectionStart = [0, start];\n this._model.selectionEnd = [this._bufferService.cols, end];\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n */\n private _handleTrim(amount: number): void {\n const needsRefresh = this._model.handleTrim(amount);\n if (needsRefresh) {\n this.refresh();\n }\n }\n\n /**\n * Gets the 0-based [x, y] buffer coordinates of the current mouse event.\n * @param event The mouse event.\n */\n private _getMouseBufferCoords(event: MouseEvent): [number, number] | undefined {\n const coords = this._mouseService.getCoords(event, this._screenElement, this._bufferService.cols, this._bufferService.rows, true);\n if (!coords) {\n return undefined;\n }\n\n // Convert to 0-based\n coords[0]--;\n coords[1]--;\n\n // Convert viewport coords to buffer coords\n coords[1] += this._bufferService.buffer.ydisp;\n return coords;\n }\n\n /**\n * Gets the amount the viewport should be scrolled based on how far out of the\n * terminal the mouse is.\n * @param event The mouse event.\n */\n private _getMouseEventScrollAmount(event: MouseEvent): number {\n let offset = getCoordsRelativeToElement(this._coreBrowserService.window, event, this._screenElement)[1];\n const terminalHeight = this._renderService.dimensions.css.canvas.height;\n if (offset >= 0 && offset <= terminalHeight) {\n return 0;\n }\n if (offset > terminalHeight) {\n offset -= terminalHeight;\n }\n\n offset = Math.min(Math.max(offset, -DRAG_SCROLL_MAX_THRESHOLD), DRAG_SCROLL_MAX_THRESHOLD);\n offset /= DRAG_SCROLL_MAX_THRESHOLD;\n return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1));\n }\n\n /**\n * Returns whether the selection manager should force selection, regardless of\n * whether the terminal is in mouse events mode.\n * @param event The mouse event.\n */\n public shouldForceSelection(event: MouseEvent): boolean {\n if (Browser.isMac) {\n return event.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection;\n }\n\n return event.shiftKey;\n }\n\n /**\n * Handles te mousedown event, setting up for a new selection.\n * @param event The mousedown event.\n */\n public handleMouseDown(event: MouseEvent): void {\n this._mouseDownTimeStamp = event.timeStamp;\n // If we have selection, we want the context menu on right click even if the\n // terminal is in mouse mode.\n if (event.button === 2 && this.hasSelection) {\n return;\n }\n\n // Only action the primary button\n if (event.button !== 0) {\n return;\n }\n\n // Allow selection when using a specific modifier key, even when disabled\n if (!this._enabled) {\n if (!this.shouldForceSelection(event)) {\n return;\n }\n\n // Don't send the mouse down event to the current process, we want to select\n event.stopPropagation();\n }\n\n // Tell the browser not to start a regular selection\n event.preventDefault();\n\n // Reset drag scroll state\n this._dragScrollAmount = 0;\n\n if (this._enabled && event.shiftKey) {\n this._handleIncrementalClick(event);\n } else {\n if (event.detail === 1) {\n this._handleSingleClick(event);\n } else if (event.detail === 2) {\n this._handleDoubleClick(event);\n } else if (event.detail === 3) {\n this._handleTripleClick(event);\n }\n }\n\n this._addMouseDownListeners();\n this.refresh(true);\n }\n\n /**\n * Adds listeners when mousedown is triggered.\n */\n private _addMouseDownListeners(): void {\n // Listen on the document so that dragging outside of viewport works\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.addEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.addEventListener('mouseup', this._mouseUpListener);\n }\n this._dragScrollIntervalTimer = this._coreBrowserService.window.setInterval(() => this._dragScroll(), DRAG_SCROLL_INTERVAL);\n }\n\n /**\n * Removes the listeners that are registered when mousedown is triggered.\n */\n private _removeMouseDownListeners(): void {\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.removeEventListener('mouseup', this._mouseUpListener);\n }\n this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer);\n this._dragScrollIntervalTimer = undefined;\n }\n\n /**\n * Performs an incremental click, setting the selection end position to the mouse\n * position.\n * @param event The mouse event.\n */\n private _handleIncrementalClick(event: MouseEvent): void {\n if (this._model.selectionStart) {\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n }\n }\n\n /**\n * Performs a single click, resetting relevant state and setting the selection\n * start position.\n * @param event The mouse event.\n */\n private _handleSingleClick(event: MouseEvent): void {\n this._model.selectionStartLength = 0;\n this._model.isSelectAllActive = false;\n this._activeSelectionMode = this.shouldColumnSelect(event) ? SelectionMode.COLUMN : SelectionMode.NORMAL;\n\n // Initialize the new selection\n this._model.selectionStart = this._getMouseBufferCoords(event);\n if (!this._model.selectionStart) {\n return;\n }\n this._model.selectionEnd = undefined;\n\n // Ensure the line exists\n const line = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);\n if (!line) {\n return;\n }\n\n // Return early if the click event is not in the buffer (eg. in scroll bar)\n if (line.length === this._model.selectionStart[0]) {\n return;\n }\n\n // If the mouse is over the second half of a wide character, adjust the\n // selection to cover the whole character\n if (line.hasWidth(this._model.selectionStart[0]) === 0) {\n this._model.selectionStart[0]++;\n }\n }\n\n /**\n * Performs a double click, selecting the current word.\n * @param event The mouse event.\n */\n private _handleDoubleClick(event: MouseEvent): void {\n if (this._selectWordAtCursor(event, true)) {\n this._activeSelectionMode = SelectionMode.WORD;\n }\n }\n\n /**\n * Performs a triple click, selecting the current line and activating line\n * select mode.\n * @param event The mouse event.\n */\n private _handleTripleClick(event: MouseEvent): void {\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.LINE;\n this._selectLineAt(coords[1]);\n }\n }\n\n /**\n * Returns whether the selection manager should operate in column select mode\n * @param event the mouse or keyboard event\n */\n public shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean {\n return event.altKey && !(Browser.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection);\n }\n\n /**\n * Handles the mousemove event when the mouse button is down, recording the\n * end of the selection and refreshing the selection.\n * @param event The mousemove event.\n */\n private _handleMouseMove(event: MouseEvent): void {\n // If the mousemove listener is active it means that a selection is\n // currently being made, we should stop propagation to prevent mouse events\n // to be sent to the pty.\n event.stopImmediatePropagation();\n\n // Do nothing if there is no selection start, this can happen if the first\n // click in the terminal is an incremental click\n if (!this._model.selectionStart) {\n return;\n }\n\n // Record the previous position so we know whether to redraw the selection\n // at the end.\n const previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;\n\n // Set the initial selection end based on the mouse coordinates\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n if (!this._model.selectionEnd) {\n this.refresh(true);\n return;\n }\n\n // Select the entire line if line select mode is active.\n if (this._activeSelectionMode === SelectionMode.LINE) {\n if (this._model.selectionEnd[1] < this._model.selectionStart[1]) {\n this._model.selectionEnd[0] = 0;\n } else {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n } else if (this._activeSelectionMode === SelectionMode.WORD) {\n this._selectToWordAt(this._model.selectionEnd);\n }\n\n // Determine the amount of scrolling that will happen.\n this._dragScrollAmount = this._getMouseEventScrollAmount(event);\n\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n } else if (this._dragScrollAmount < 0) {\n this._model.selectionEnd[0] = 0;\n }\n }\n\n // If the character is a wide character include the cell to the right in the\n // selection. Note that selections at the very end of the line will never\n // have a character.\n const buffer = this._bufferService.buffer;\n if (this._model.selectionEnd[1] < buffer.lines.length) {\n const line = buffer.lines.get(this._model.selectionEnd[1]);\n if (line && line.hasWidth(this._model.selectionEnd[0]) === 0) {\n this._model.selectionEnd[0]++;\n }\n }\n\n // Only draw here if the selection changes.\n if (!previousSelectionEnd ||\n previousSelectionEnd[0] !== this._model.selectionEnd[0] ||\n previousSelectionEnd[1] !== this._model.selectionEnd[1]) {\n this.refresh(true);\n }\n }\n\n /**\n * The callback that occurs every DRAG_SCROLL_INTERVAL ms that does the\n * scrolling of the viewport.\n */\n private _dragScroll(): void {\n if (!this._model.selectionEnd || !this._model.selectionStart) {\n return;\n }\n if (this._dragScrollAmount) {\n this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: false });\n // Re-evaluate selection\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n const buffer = this._bufferService.buffer;\n if (this._dragScrollAmount > 0) {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);\n } else {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = 0;\n }\n this._model.selectionEnd[1] = buffer.ydisp;\n }\n this.refresh();\n }\n }\n\n /**\n * Handles the mouseup event, removing the mousedown listeners.\n * @param event The mouseup event.\n */\n private _handleMouseUp(event: MouseEvent): void {\n const timeElapsed = event.timeStamp - this._mouseDownTimeStamp;\n\n this._removeMouseDownListeners();\n\n if (this.selectionText.length <= 1 && timeElapsed < ALT_CLICK_MOVE_CURSOR_TIME && event.altKey && this._optionsService.rawOptions.altClickMovesCursor) {\n if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {\n const coordinates = this._mouseService.getCoords(\n event,\n this._element,\n this._bufferService.cols,\n this._bufferService.rows,\n false\n );\n if (coordinates && coordinates[0] !== undefined && coordinates[1] !== undefined) {\n const sequence = moveToCellSequence(coordinates[0] - 1, coordinates[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);\n this._coreService.triggerDataEvent(sequence, true);\n }\n }\n } else {\n this._fireEventIfSelectionChanged();\n }\n }\n\n private _fireEventIfSelectionChanged(): void {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n const hasSelection = !!start && !!end && (start[0] !== end[0] || start[1] !== end[1]);\n\n if (!hasSelection) {\n if (this._oldHasSelection) {\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n return;\n }\n\n // Sanity check, these should not be undefined as there is a selection\n if (!start || !end) {\n return;\n }\n\n if (!this._oldSelectionStart || !this._oldSelectionEnd || (\n start[0] !== this._oldSelectionStart[0] || start[1] !== this._oldSelectionStart[1] ||\n end[0] !== this._oldSelectionEnd[0] || end[1] !== this._oldSelectionEnd[1])) {\n\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n }\n\n private _fireOnSelectionChange(start: [number, number] | undefined, end: [number, number] | undefined, hasSelection: boolean): void {\n this._oldSelectionStart = start;\n this._oldSelectionEnd = end;\n this._oldHasSelection = hasSelection;\n this._onSelectionChange.fire();\n }\n\n private _handleBufferActivate(e: {activeBuffer: IBuffer, inactiveBuffer: IBuffer}): void {\n this.clearSelection();\n // Only adjust the selection on trim, shiftElements is rarely used (only in\n // reverseIndex) and delete in a splice is only ever used when the same\n // number of elements was just added. Given this is could actually be\n // beneficial to leave the selection as is for these cases.\n this._trimListener.dispose();\n this._trimListener = e.activeBuffer.lines.onTrim(amount => this._handleTrim(amount));\n }\n\n /**\n * Converts a viewport column (0 to cols - 1) to the character index on the\n * buffer line, the latter takes into account wide and null characters.\n * @param bufferLine The buffer line to use.\n * @param x The x index in the buffer line to convert.\n */\n private _convertViewportColToCharacterIndex(bufferLine: IBufferLine, x: number): number {\n let charIndex = x;\n for (let i = 0; x >= i; i++) {\n const length = bufferLine.loadCell(i, this._workCell).getChars().length;\n if (this._workCell.getWidth() === 0) {\n // Wide characters aren't included in the line string so decrement the\n // index so the index is back on the wide character.\n charIndex--;\n } else if (length > 1 && x !== i) {\n // Emojis take up multiple characters, so adjust accordingly. For these\n // we don't want ot include the character at the column as we're\n // returning the start index in the string, not the end index.\n charIndex += length - 1;\n }\n }\n return charIndex;\n }\n\n public setSelection(col: number, row: number, length: number): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this._model.selectionStart = [col, row];\n this._model.selectionStartLength = length;\n this.refresh();\n this._fireEventIfSelectionChanged();\n }\n\n public rightClickSelect(ev: MouseEvent): void {\n if (!this._isClickInSelection(ev)) {\n if (this._selectWordAtCursor(ev, false)) {\n this.refresh(true);\n }\n this._fireEventIfSelectionChanged();\n }\n }\n\n /**\n * Gets positional information for the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _getWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean, followWrappedLinesAbove: boolean = true, followWrappedLinesBelow: boolean = true): IWordPosition | undefined {\n // Ensure coords are within viewport (eg. not within scroll bar)\n if (coords[0] >= this._bufferService.cols) {\n return undefined;\n }\n\n const buffer = this._bufferService.buffer;\n const bufferLine = buffer.lines.get(coords[1]);\n if (!bufferLine) {\n return undefined;\n }\n\n const line = buffer.translateBufferLineToString(coords[1], false);\n\n // Get actual index, taking into consideration wide characters\n let startIndex = this._convertViewportColToCharacterIndex(bufferLine, coords[0]);\n let endIndex = startIndex;\n\n // Record offset to be used later\n const charOffset = coords[0] - startIndex;\n let leftWideCharCount = 0;\n let rightWideCharCount = 0;\n let leftLongCharOffset = 0;\n let rightLongCharOffset = 0;\n\n if (line.charAt(startIndex) === ' ') {\n // Expand until non-whitespace is hit\n while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') {\n startIndex--;\n }\n while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') {\n endIndex++;\n }\n } else {\n // Expand until whitespace is hit. This algorithm works by scanning left\n // and right from the starting position, keeping both the index format\n // (line) and the column format (bufferLine) in sync. When a wide\n // character is hit, it is recorded and the column index is adjusted.\n let startCol = coords[0];\n let endCol = coords[0];\n\n // Consider the initial position, skip it and increment the wide char\n // variable\n if (bufferLine.getWidth(startCol) === 0) {\n leftWideCharCount++;\n startCol--;\n }\n if (bufferLine.getWidth(endCol) === 2) {\n rightWideCharCount++;\n endCol++;\n }\n\n // Adjust the end index for characters whose length are > 1 (emojis)\n const length = bufferLine.getString(endCol).length;\n if (length > 1) {\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n\n // Expand the string in both directions until a space is hit\n while (startCol > 0 && startIndex > 0 && !this._isCharWordSeparator(bufferLine.loadCell(startCol - 1, this._workCell))) {\n bufferLine.loadCell(startCol - 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 0) {\n // If the next character is a wide char, record it and skip the column\n leftWideCharCount++;\n startCol--;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n leftLongCharOffset += length - 1;\n startIndex -= length - 1;\n }\n startIndex--;\n startCol--;\n }\n while (endCol < bufferLine.length && endIndex + 1 < line.length && !this._isCharWordSeparator(bufferLine.loadCell(endCol + 1, this._workCell))) {\n bufferLine.loadCell(endCol + 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 2) {\n // If the next character is a wide char, record it and skip the column\n rightWideCharCount++;\n endCol++;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n endIndex++;\n endCol++;\n }\n }\n\n // Incremenet the end index so it is at the start of the next character\n endIndex++;\n\n // Calculate the start _column_, converting the the string indexes back to\n // column coordinates.\n let start =\n startIndex // The index of the selection's start char in the line string\n + charOffset // The difference between the initial char's column and index\n - leftWideCharCount // The number of wide chars left of the initial char\n + leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n\n // Calculate the length in _columns_, converting the the string indexes back\n // to column coordinates.\n let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols\n endIndex // The index of the selection's end char in the line string\n - startIndex // The index of the selection's start char in the line string\n + leftWideCharCount // The number of wide chars left of the initial char\n + rightWideCharCount // The number of wide chars right of the initial char (inclusive)\n - leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n - rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)\n\n if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {\n return undefined;\n }\n\n // Recurse upwards if the line is wrapped and the word wraps to the above line\n if (followWrappedLinesAbove) {\n if (start === 0 && bufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const previousBufferLine = buffer.lines.get(coords[1] - 1);\n if (previousBufferLine && bufferLine.isWrapped && previousBufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const previousLineWordPosition = this._getWordAt([this._bufferService.cols - 1, coords[1] - 1], false, true, false);\n if (previousLineWordPosition) {\n const offset = this._bufferService.cols - previousLineWordPosition.start;\n start -= offset;\n length += offset;\n }\n }\n }\n }\n\n // Recurse downwards if the line is wrapped and the word wraps to the next line\n if (followWrappedLinesBelow) {\n if (start + length === this._bufferService.cols && bufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const nextBufferLine = buffer.lines.get(coords[1] + 1);\n if (nextBufferLine?.isWrapped && nextBufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const nextLineWordPosition = this._getWordAt([0, coords[1] + 1], false, false, true);\n if (nextLineWordPosition) {\n length += nextLineWordPosition.length;\n }\n }\n }\n }\n\n return { start, length };\n }\n\n /**\n * Selects the word at the coordinates specified.\n * @param coords The coordinates to get the word at.\n * @param allowWhitespaceOnlySelection If whitespace should be selected\n */\n protected _selectWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): void {\n const wordPosition = this._getWordAt(coords, allowWhitespaceOnlySelection);\n if (wordPosition) {\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n coords[1]--;\n }\n this._model.selectionStart = [wordPosition.start, coords[1]];\n this._model.selectionStartLength = wordPosition.length;\n }\n }\n\n /**\n * Sets the selection end to the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _selectToWordAt(coords: [number, number]): void {\n const wordPosition = this._getWordAt(coords, true);\n if (wordPosition) {\n let endRow = coords[1];\n\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n endRow--;\n }\n\n // Adjust wrapped length value, this only needs to happen when values are reversed as in that\n // case we're interested in the start of the word, not the end\n if (!this._model.areSelectionValuesReversed()) {\n while (wordPosition.start + wordPosition.length > this._bufferService.cols) {\n wordPosition.length -= this._bufferService.cols;\n endRow++;\n }\n }\n\n this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : wordPosition.start + wordPosition.length, endRow];\n }\n }\n\n /**\n * Gets whether the character is considered a word separator by the select\n * word logic.\n * @param cell The cell to check.\n */\n private _isCharWordSeparator(cell: CellData): boolean {\n // Zero width characters are never separators as they are always to the\n // right of wide characters\n if (cell.getWidth() === 0) {\n return false;\n }\n return this._optionsService.rawOptions.wordSeparator.indexOf(cell.getChars()) >= 0;\n }\n\n /**\n * Selects the line specified.\n * @param line The line index.\n */\n protected _selectLineAt(line: number): void {\n const wrappedRange = this._bufferService.buffer.getWrappedRangeForLine(line);\n const range: IBufferRange = {\n start: { x: 0, y: wrappedRange.first },\n end: { x: this._bufferService.cols - 1, y: wrappedRange.last }\n };\n this._model.selectionStart = [0, wrappedRange.first];\n this._model.selectionEnd = undefined;\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IEvent } from 'common/EventEmitter';\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { IColorSet, ReadonlyColorSet } from 'browser/Types';\nimport { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport { ColorIndex, IDisposable } from 'common/Types';\nimport { ITheme } from 'common/services/Services';\n\nexport const ICharSizeService = createDecorator('CharSizeService');\nexport interface ICharSizeService {\n serviceBrand: undefined;\n\n readonly width: number;\n readonly height: number;\n readonly hasValidSize: boolean;\n\n readonly onCharSizeChange: IEvent;\n\n measure(): void;\n}\n\nexport const ICoreBrowserService = createDecorator('CoreBrowserService');\nexport interface ICoreBrowserService {\n serviceBrand: undefined;\n\n readonly isFocused: boolean;\n /**\n * Parent window that the terminal is rendered into. DOM and rendering APIs\n * (e.g. requestAnimationFrame) should be invoked in the context of this\n * window.\n */\n readonly window: Window & typeof globalThis;\n /**\n * Helper for getting the devicePixelRatio of the parent window.\n */\n readonly dpr: number;\n}\n\nexport const IMouseService = createDecorator('MouseService');\nexport interface IMouseService {\n serviceBrand: undefined;\n\n getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined;\n getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined;\n}\n\nexport const IRenderService = createDecorator('RenderService');\nexport interface IRenderService extends IDisposable {\n serviceBrand: undefined;\n\n onDimensionsChange: IEvent;\n /**\n * Fires when buffer changes are rendered. This does not fire when only cursor\n * or selections are rendered.\n */\n onRenderedViewportChange: IEvent<{ start: number, end: number }>;\n /**\n * Fires on render\n */\n onRender: IEvent<{ start: number, end: number }>;\n onRefreshRequest: IEvent<{ start: number, end: number }>;\n\n dimensions: IRenderDimensions;\n\n addRefreshCallback(callback: FrameRequestCallback): number;\n\n refreshRows(start: number, end: number): void;\n clearTextureAtlas(): void;\n resize(cols: number, rows: number): void;\n hasRenderer(): boolean;\n setRenderer(renderer: IRenderer): void;\n handleDevicePixelRatioChange(): void;\n handleResize(cols: number, rows: number): void;\n handleCharSizeChanged(): void;\n handleBlur(): void;\n handleFocus(): void;\n handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void;\n handleCursorMove(): void;\n clear(): void;\n}\n\nexport const ISelectionService = createDecorator('SelectionService');\nexport interface ISelectionService {\n serviceBrand: undefined;\n\n readonly selectionText: string;\n readonly hasSelection: boolean;\n readonly selectionStart: [number, number] | undefined;\n readonly selectionEnd: [number, number] | undefined;\n\n readonly onLinuxMouseSelection: IEvent;\n readonly onRequestRedraw: IEvent;\n readonly onRequestScrollLines: IEvent;\n readonly onSelectionChange: IEvent;\n\n disable(): void;\n enable(): void;\n reset(): void;\n setSelection(row: number, col: number, length: number): void;\n selectAll(): void;\n selectLines(start: number, end: number): void;\n clearSelection(): void;\n rightClickSelect(event: MouseEvent): void;\n shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean;\n shouldForceSelection(event: MouseEvent): boolean;\n refresh(isLinuxMouseSelection?: boolean): void;\n handleMouseDown(event: MouseEvent): void;\n isCellInSelection(x: number, y: number): boolean;\n}\n\nexport const ICharacterJoinerService = createDecorator('CharacterJoinerService');\nexport interface ICharacterJoinerService {\n serviceBrand: undefined;\n\n register(handler: (text: string) => [number, number][]): number;\n deregister(joinerId: number): boolean;\n getJoinedCharacters(row: number): [number, number][];\n}\n\nexport const IThemeService = createDecorator('ThemeService');\nexport interface IThemeService {\n serviceBrand: undefined;\n\n readonly colors: ReadonlyColorSet;\n\n readonly onChangeColors: IEvent;\n\n restoreColor(slot?: ColorIndex): void;\n /**\n * Allows external modifying of colors in the theme, this is used instead of {@link colors} to\n * prevent accidental writes.\n */\n modifyColors(callback: (colors: IColorSet) => void): void;\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ColorContrastCache } from 'browser/ColorContrastCache';\nimport { IThemeService } from 'browser/services/Services';\nimport { IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';\nimport { channels, color, css, NULL_COLOR } from 'common/Color';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { IOptionsService, ITheme } from 'common/services/Services';\nimport { ColorIndex, IColor } from 'common/Types';\n\ninterface IRestoreColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n ansi: IColor[];\n}\n\n\nconst DEFAULT_FOREGROUND = css.toColor('#ffffff');\nconst DEFAULT_BACKGROUND = css.toColor('#000000');\nconst DEFAULT_CURSOR = css.toColor('#ffffff');\nconst DEFAULT_CURSOR_ACCENT = css.toColor('#000000');\nconst DEFAULT_SELECTION = {\n css: 'rgba(255, 255, 255, 0.3)',\n rgba: 0xFFFFFF4D\n};\n\n// An IIFE to generate DEFAULT_ANSI_COLORS.\nexport const DEFAULT_ANSI_COLORS = Object.freeze((() => {\n const colors = [\n // dark:\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 // bright:\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')\n ];\n\n // Fill in the remaining 240 ANSI colors.\n // Generate colors (16-231)\n const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];\n for (let i = 0; i < 216; i++) {\n const r = v[(i / 36) % 6 | 0];\n const g = v[(i / 6) % 6 | 0];\n const b = v[i % 6];\n colors.push({\n css: channels.toCss(r, g, b),\n rgba: channels.toRgba(r, g, b)\n });\n }\n\n // Generate greys (232-255)\n for (let i = 0; i < 24; i++) {\n const c = 8 + i * 10;\n colors.push({\n css: channels.toCss(c, c, c),\n rgba: channels.toRgba(c, c, c)\n });\n }\n\n return colors;\n})());\n\nexport class ThemeService extends Disposable implements IThemeService {\n public serviceBrand: undefined;\n\n private _colors: IColorSet;\n private _contrastCache: IColorContrastCache;\n private _restoreColors!: IRestoreColorSet;\n\n public get colors(): ReadonlyColorSet { return this._colors; }\n\n private readonly _onChangeColors = this.register(new EventEmitter());\n public readonly onChangeColors = this._onChangeColors.event;\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n\n this._contrastCache = new ColorContrastCache();\n this._colors = {\n foreground: DEFAULT_FOREGROUND,\n background: DEFAULT_BACKGROUND,\n cursor: DEFAULT_CURSOR,\n cursorAccent: DEFAULT_CURSOR_ACCENT,\n selectionForeground: undefined,\n selectionBackgroundTransparent: DEFAULT_SELECTION,\n selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,\n selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n ansi: DEFAULT_ANSI_COLORS.slice(),\n contrastCache: this._contrastCache\n };\n this._updateRestoreColors();\n this._setTheme(this._optionsService.rawOptions.theme);\n\n this.register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));\n this.register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));\n }\n\n /**\n * Sets the terminal's theme.\n * @param theme The theme to use. If a partial theme is provided then default\n * colors will be used where colors are not defined.\n */\n private _setTheme(theme: ITheme = {}): void {\n const colors = this._colors;\n colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND);\n colors.background = parseColor(theme.background, DEFAULT_BACKGROUND);\n colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR);\n colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT);\n colors.selectionBackgroundTransparent = parseColor(theme.selectionBackground, DEFAULT_SELECTION);\n colors.selectionBackgroundOpaque = color.blend(colors.background, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundTransparent = parseColor(theme.selectionInactiveBackground, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundOpaque = color.blend(colors.background, colors.selectionInactiveBackgroundTransparent);\n colors.selectionForeground = theme.selectionForeground ? parseColor(theme.selectionForeground, NULL_COLOR) : undefined;\n if (colors.selectionForeground === NULL_COLOR) {\n colors.selectionForeground = undefined;\n }\n\n /**\n * If selection color is opaque, blend it with background with 0.3 opacity\n * Issue #2737\n */\n if (color.isOpaque(colors.selectionBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionBackgroundTransparent = color.opacity(colors.selectionBackgroundTransparent, opacity);\n }\n if (color.isOpaque(colors.selectionInactiveBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionInactiveBackgroundTransparent = color.opacity(colors.selectionInactiveBackgroundTransparent, opacity);\n }\n colors.ansi = DEFAULT_ANSI_COLORS.slice();\n colors.ansi[0] = parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);\n colors.ansi[1] = parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);\n colors.ansi[2] = parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);\n colors.ansi[3] = parseColor(theme.yellow, DEFAULT_ANSI_COLORS[3]);\n colors.ansi[4] = parseColor(theme.blue, DEFAULT_ANSI_COLORS[4]);\n colors.ansi[5] = parseColor(theme.magenta, DEFAULT_ANSI_COLORS[5]);\n colors.ansi[6] = parseColor(theme.cyan, DEFAULT_ANSI_COLORS[6]);\n colors.ansi[7] = parseColor(theme.white, DEFAULT_ANSI_COLORS[7]);\n colors.ansi[8] = parseColor(theme.brightBlack, DEFAULT_ANSI_COLORS[8]);\n colors.ansi[9] = parseColor(theme.brightRed, DEFAULT_ANSI_COLORS[9]);\n colors.ansi[10] = parseColor(theme.brightGreen, DEFAULT_ANSI_COLORS[10]);\n colors.ansi[11] = parseColor(theme.brightYellow, DEFAULT_ANSI_COLORS[11]);\n colors.ansi[12] = parseColor(theme.brightBlue, DEFAULT_ANSI_COLORS[12]);\n colors.ansi[13] = parseColor(theme.brightMagenta, DEFAULT_ANSI_COLORS[13]);\n colors.ansi[14] = parseColor(theme.brightCyan, DEFAULT_ANSI_COLORS[14]);\n colors.ansi[15] = parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);\n if (theme.extendedAnsi) {\n const colorCount = Math.min(colors.ansi.length - 16, theme.extendedAnsi.length);\n for (let i = 0; i < colorCount; i++) {\n colors.ansi[i + 16] = parseColor(theme.extendedAnsi[i], DEFAULT_ANSI_COLORS[i + 16]);\n }\n }\n // Clear our the cache\n this._contrastCache.clear();\n this._updateRestoreColors();\n this._onChangeColors.fire(this.colors);\n }\n\n public restoreColor(slot?: ColorIndex): void {\n this._restoreColor(slot);\n this._onChangeColors.fire(this.colors);\n }\n\n private _restoreColor(slot: ColorIndex | undefined): void {\n // unset slot restores all ansi colors\n if (slot === undefined) {\n for (let i = 0; i < this._restoreColors.ansi.length; ++i) {\n this._colors.ansi[i] = this._restoreColors.ansi[i];\n }\n return;\n }\n switch (slot) {\n case ColorIndex.FOREGROUND:\n this._colors.foreground = this._restoreColors.foreground;\n break;\n case ColorIndex.BACKGROUND:\n this._colors.background = this._restoreColors.background;\n break;\n case ColorIndex.CURSOR:\n this._colors.cursor = this._restoreColors.cursor;\n break;\n default:\n this._colors.ansi[slot] = this._restoreColors.ansi[slot];\n }\n }\n\n public modifyColors(callback: (colors: IColorSet) => void): void {\n callback(this._colors);\n // Assume the change happened\n this._onChangeColors.fire(this.colors);\n }\n\n private _updateRestoreColors(): void {\n this._restoreColors = {\n foreground: this._colors.foreground,\n background: this._colors.background,\n cursor: this._colors.cursor,\n ansi: this._colors.ansi.slice()\n };\n }\n}\n\nfunction parseColor(\n cssString: string | undefined,\n fallback: IColor\n): IColor {\n if (cssString !== undefined) {\n try {\n return css.toColor(cssString);\n } catch {\n // no-op\n }\n }\n return fallback;\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICircularList } from 'common/Types';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\n\nexport interface IInsertEvent {\n index: number;\n amount: number;\n}\n\nexport interface IDeleteEvent {\n index: number;\n amount: number;\n}\n\n/**\n * Represents a circular list; a list with a maximum size that wraps around when push is called,\n * overriding values at the start of the list.\n */\nexport class CircularList extends Disposable implements ICircularList {\n protected _array: (T | undefined)[];\n private _startIndex: number;\n private _length: number;\n\n public readonly onDeleteEmitter = this.register(new EventEmitter());\n public readonly onDelete = this.onDeleteEmitter.event;\n public readonly onInsertEmitter = this.register(new EventEmitter());\n public readonly onInsert = this.onInsertEmitter.event;\n public readonly onTrimEmitter = this.register(new EventEmitter());\n public readonly onTrim = this.onTrimEmitter.event;\n\n constructor(\n private _maxLength: number\n ) {\n super();\n this._array = new Array(this._maxLength);\n this._startIndex = 0;\n this._length = 0;\n }\n\n public get maxLength(): number {\n return this._maxLength;\n }\n\n public set maxLength(newMaxLength: number) {\n // There was no change in maxLength, return early.\n if (this._maxLength === newMaxLength) {\n return;\n }\n\n // Reconstruct array, starting at index 0. Only transfer values from the\n // indexes 0 to length.\n const newArray = new Array(newMaxLength);\n for (let i = 0; i < Math.min(newMaxLength, this.length); i++) {\n newArray[i] = this._array[this._getCyclicIndex(i)];\n }\n this._array = newArray;\n this._maxLength = newMaxLength;\n this._startIndex = 0;\n }\n\n public get length(): number {\n return this._length;\n }\n\n public set length(newLength: number) {\n if (newLength > this._length) {\n for (let i = this._length; i < newLength; i++) {\n this._array[i] = undefined;\n }\n }\n this._length = newLength;\n }\n\n /**\n * Gets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index of the value to get.\n * @returns The value corresponding to the index.\n */\n public get(index: number): T | undefined {\n return this._array[this._getCyclicIndex(index)];\n }\n\n /**\n * Sets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index to set.\n * @param value The value to set.\n */\n public set(index: number, value: T | undefined): void {\n this._array[this._getCyclicIndex(index)] = value;\n }\n\n /**\n * Pushes a new value onto the list, wrapping around to the start of the array, overriding index 0\n * if the maximum length is reached.\n * @param value The value to push onto the list.\n */\n public push(value: T): void {\n this._array[this._getCyclicIndex(this._length)] = value;\n if (this._length === this._maxLength) {\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n } else {\n this._length++;\n }\n }\n\n /**\n * Advance ringbuffer index and return current element for recycling.\n * Note: The buffer must be full for this method to work.\n * @throws When the buffer is not full.\n */\n public recycle(): T {\n if (this._length !== this._maxLength) {\n throw new Error('Can only recycle when the buffer is full');\n }\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n return this._array[this._getCyclicIndex(this._length - 1)]!;\n }\n\n /**\n * Ringbuffer is at max length.\n */\n public get isFull(): boolean {\n return this._length === this._maxLength;\n }\n\n /**\n * Removes and returns the last value on the list.\n * @returns The popped value.\n */\n public pop(): T | undefined {\n return this._array[this._getCyclicIndex(this._length-- - 1)];\n }\n\n /**\n * Deletes and/or inserts items at a particular index (in that order). Unlike\n * Array.prototype.splice, this operation does not return the deleted items as a new array in\n * order to save creating a new array. Note that this operation may shift all values in the list\n * in the worst case.\n * @param start The index to delete and/or insert.\n * @param deleteCount The number of elements to delete.\n * @param items The items to insert.\n */\n public splice(start: number, deleteCount: number, ...items: T[]): void {\n // Delete items\n if (deleteCount) {\n for (let i = start; i < this._length - deleteCount; i++) {\n this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];\n }\n this._length -= deleteCount;\n this.onDeleteEmitter.fire({ index: start, amount: deleteCount });\n }\n\n // Add items\n for (let i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (let i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (items.length) {\n this.onInsertEmitter.fire({ index: start, amount: items.length });\n }\n\n // Adjust length as needed\n if (this._length + items.length > this._maxLength) {\n const countToTrim = (this._length + items.length) - this._maxLength;\n this._startIndex += countToTrim;\n this._length = this._maxLength;\n this.onTrimEmitter.fire(countToTrim);\n } else {\n this._length += items.length;\n }\n }\n\n /**\n * Trims a number of items from the start of the list.\n * @param count The number of items to remove.\n */\n public trimStart(count: number): void {\n if (count > this._length) {\n count = this._length;\n }\n this._startIndex += count;\n this._length -= count;\n this.onTrimEmitter.fire(count);\n }\n\n public shiftElements(start: number, count: number, offset: number): void {\n if (count <= 0) {\n return;\n }\n if (start < 0 || start >= this._length) {\n throw new Error('start argument out of range');\n }\n if (start + offset < 0) {\n throw new Error('Cannot shift elements in list beyond index 0');\n }\n\n if (offset > 0) {\n for (let i = count - 1; i >= 0; i--) {\n this.set(start + i + offset, this.get(start + i));\n }\n const expandListBy = (start + count + offset) - this._length;\n if (expandListBy > 0) {\n this._length += expandListBy;\n while (this._length > this._maxLength) {\n this._length--;\n this._startIndex++;\n this.onTrimEmitter.fire(1);\n }\n }\n } else {\n for (let i = 0; i < count; i++) {\n this.set(start + i + offset, this.get(start + i));\n }\n }\n }\n\n /**\n * Gets the cyclic index for the specified regular index. The cyclic index can then be used on the\n * backing array to get the element associated with the regular index.\n * @param index The regular index.\n * @returns The cyclic index.\n */\n private _getCyclicIndex(index: number): number {\n return (this._startIndex + index) % this._maxLength;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/*\n * A simple utility for cloning values\n */\nexport function clone(val: T, depth: number = 5): T {\n if (typeof val !== 'object') {\n return val;\n }\n\n // If we're cloning an array, use an array as the base, otherwise use an object\n const clonedObject: any = Array.isArray(val) ? [] : {};\n\n for (const key in val) {\n // Recursively clone eack item unless we're at the maximum depth\n clonedObject[key] = depth <= 1 ? val[key] : (val[key] && clone(val[key], depth - 1));\n }\n\n return clonedObject as T;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isNode } from 'common/Platform';\nimport { IColor, IColorRGB } from 'common/Types';\n\nlet $r = 0;\nlet $g = 0;\nlet $b = 0;\nlet $a = 0;\n\nexport const NULL_COLOR: IColor = {\n css: '#00000000',\n rgba: 0\n};\n\n/**\n * Helper functions where the source type is \"channels\" (individual color channels as numbers).\n */\nexport namespace channels {\n export function toCss(r: number, g: number, b: number, a?: number): string {\n if (a !== undefined) {\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}${toPaddedHex(a)}`;\n }\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}`;\n }\n\n export function toRgba(r: number, g: number, b: number, a: number = 0xFF): number {\n // Note: The aggregated number is RGBA32 (BE), thus needs to be converted to ABGR32\n // on LE systems, before it can be used for direct 32-bit buffer writes.\n // >>> 0 forces an unsigned int\n return (r << 24 | g << 16 | b << 8 | a) >>> 0;\n }\n}\n\n/**\n * Helper functions where the source type is `IColor`.\n */\nexport namespace color {\n export function blend(bg: IColor, fg: IColor): IColor {\n $a = (fg.rgba & 0xFF) / 255;\n if ($a === 1) {\n return {\n css: fg.css,\n rgba: fg.rgba\n };\n }\n const fgR = (fg.rgba >> 24) & 0xFF;\n const fgG = (fg.rgba >> 16) & 0xFF;\n const fgB = (fg.rgba >> 8) & 0xFF;\n const bgR = (bg.rgba >> 24) & 0xFF;\n const bgG = (bg.rgba >> 16) & 0xFF;\n const bgB = (bg.rgba >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n const css = channels.toCss($r, $g, $b);\n const rgba = channels.toRgba($r, $g, $b);\n return { css, rgba };\n }\n\n export function isOpaque(color: IColor): boolean {\n return (color.rgba & 0xFF) === 0xFF;\n }\n\n export function ensureContrastRatio(bg: IColor, fg: IColor, ratio: number): IColor | undefined {\n const result = rgba.ensureContrastRatio(bg.rgba, fg.rgba, ratio);\n if (!result) {\n return undefined;\n }\n return rgba.toColor(\n (result >> 24 & 0xFF),\n (result >> 16 & 0xFF),\n (result >> 8 & 0xFF)\n );\n }\n\n export function opaque(color: IColor): IColor {\n const rgbaColor = (color.rgba | 0xFF) >>> 0;\n [$r, $g, $b] = rgba.toChannels(rgbaColor);\n return {\n css: channels.toCss($r, $g, $b),\n rgba: rgbaColor\n };\n }\n\n export function opacity(color: IColor, opacity: number): IColor {\n $a = Math.round(opacity * 0xFF);\n [$r, $g, $b] = rgba.toChannels(color.rgba);\n return {\n css: channels.toCss($r, $g, $b, $a),\n rgba: channels.toRgba($r, $g, $b, $a)\n };\n }\n\n export function multiplyOpacity(color: IColor, factor: number): IColor {\n $a = color.rgba & 0xFF;\n return opacity(color, ($a * factor) / 0xFF);\n }\n\n export function toColorRGB(color: IColor): IColorRGB {\n return [(color.rgba >> 24) & 0xFF, (color.rgba >> 16) & 0xFF, (color.rgba >> 8) & 0xFF];\n }\n}\n\n/**\n * Helper functions where the source type is \"css\" (string: '#rgb', '#rgba', '#rrggbb', '#rrggbbaa').\n */\nexport namespace css {\n let $ctx: CanvasRenderingContext2D | undefined;\n let $litmusColor: CanvasGradient | undefined;\n if (!isNode) {\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n const ctx = canvas.getContext('2d', {\n willReadFrequently: true\n });\n if (ctx) {\n $ctx = ctx;\n $ctx.globalCompositeOperation = 'copy';\n $litmusColor = $ctx.createLinearGradient(0, 0, 1, 1);\n }\n }\n\n /**\n * Converts a css string to an IColor, this should handle all valid CSS color strings and will\n * throw if it's invalid. The ideal format to use is `#rrggbb[aa]` as it's the fastest to parse.\n *\n * Only `#rgb[a]`, `#rrggbb[aa]`, `rgb()` and `rgba()` formats are supported when run in a Node\n * environment.\n */\n export function toColor(css: string): IColor {\n // Formats: #rgb[a] and #rrggbb[aa]\n if (css.match(/#[\\da-f]{3,8}/i)) {\n switch (css.length) {\n case 4: { // #rgb\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n return rgba.toColor($r, $g, $b);\n }\n case 5: { // #rgba\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n $a = parseInt(css.slice(4, 5).repeat(2), 16);\n return rgba.toColor($r, $g, $b, $a);\n }\n case 7: // #rrggbb\n return {\n css,\n rgba: (parseInt(css.slice(1), 16) << 8 | 0xFF) >>> 0\n };\n case 9: // #rrggbbaa\n return {\n css,\n rgba: parseInt(css.slice(1), 16) >>> 0\n };\n }\n }\n\n // Formats: rgb() or rgba()\n const rgbaMatch = css.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);\n if (rgbaMatch) {\n $r = parseInt(rgbaMatch[1]);\n $g = parseInt(rgbaMatch[2]);\n $b = parseInt(rgbaMatch[3]);\n $a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);\n return rgba.toColor($r, $g, $b, $a);\n }\n\n // Validate the context is available for canvas-based color parsing\n if (!$ctx || !$litmusColor) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Validate the color using canvas fillStyle\n // See https://html.spec.whatwg.org/multipage/canvas.html#fill-and-stroke-styles\n $ctx.fillStyle = $litmusColor;\n $ctx.fillStyle = css;\n if (typeof $ctx.fillStyle !== 'string') {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n $ctx.fillRect(0, 0, 1, 1);\n [$r, $g, $b, $a] = $ctx.getImageData(0, 0, 1, 1).data;\n\n // Validate the color is non-transparent as color hue gets lost when drawn to the canvas\n if ($a !== 0xFF) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Extract the color from the canvas' fillStyle property which exposes the color value in rgba()\n // format\n // See https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color\n return {\n rgba: channels.toRgba($r, $g, $b, $a),\n css\n };\n }\n}\n\n/**\n * Helper functions where the source type is \"rgb\" (number: 0xrrggbb).\n */\nexport namespace rgb {\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param rgb The color to use.\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance(rgb: number): number {\n return relativeLuminance2(\n (rgb >> 16) & 0xFF,\n (rgb >> 8 ) & 0xFF,\n (rgb ) & 0xFF);\n }\n\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param r The red channel (0x00 to 0xFF).\n * @param g The green channel (0x00 to 0xFF).\n * @param b The blue channel (0x00 to 0xFF).\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance2(r: number, g: number, b: number): number {\n const rs = r / 255;\n const gs = g / 255;\n const bs = b / 255;\n const rr = rs <= 0.03928 ? rs / 12.92 : Math.pow((rs + 0.055) / 1.055, 2.4);\n const rg = gs <= 0.03928 ? gs / 12.92 : Math.pow((gs + 0.055) / 1.055, 2.4);\n const rb = bs <= 0.03928 ? bs / 12.92 : Math.pow((bs + 0.055) / 1.055, 2.4);\n return rr * 0.2126 + rg * 0.7152 + rb * 0.0722;\n }\n}\n\n/**\n * Helper functions where the source type is \"rgba\" (number: 0xrrggbbaa).\n */\nexport namespace rgba {\n /**\n * Given a foreground color and a background color, either increase or reduce the luminance of the\n * foreground color until the specified contrast ratio is met. If pure white or black is hit\n * without the contrast ratio being met, go the other direction using the background color as the\n * foreground color and take either the first or second result depending on which has the higher\n * contrast ratio.\n *\n * `undefined` will be returned if the contrast ratio is already met.\n *\n * @param bgRgba The background color in rgba format.\n * @param fgRgba The foreground color in rgba format.\n * @param ratio The contrast ratio to achieve.\n */\n export function ensureContrastRatio(bgRgba: number, fgRgba: number, ratio: number): number | undefined {\n const bgL = rgb.relativeLuminance(bgRgba >> 8);\n const fgL = rgb.relativeLuminance(fgRgba >> 8);\n const cr = contrastRatio(bgL, fgL);\n if (cr < ratio) {\n if (fgL < bgL) {\n const resultA = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n const resultA = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n return undefined;\n }\n\n export function reduceLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to reducing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR > 0 || fgG > 0 || fgB > 0)) {\n // Reduce by 10% until the ratio is hit\n fgR -= Math.max(0, Math.ceil(fgR * 0.1));\n fgG -= Math.max(0, Math.ceil(fgG * 0.1));\n fgB -= Math.max(0, Math.ceil(fgB * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function increaseLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to increasing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR < 0xFF || fgG < 0xFF || fgB < 0xFF)) {\n // Increase by 10% until the ratio is hit\n fgR = Math.min(0xFF, fgR + Math.ceil((255 - fgR) * 0.1));\n fgG = Math.min(0xFF, fgG + Math.ceil((255 - fgG) * 0.1));\n fgB = Math.min(0xFF, fgB + Math.ceil((255 - fgB) * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n // FIXME: Move this to channels NS?\n export function toChannels(value: number): [number, number, number, number] {\n return [(value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF];\n }\n\n export function toColor(r: number, g: number, b: number, a?: number): IColor {\n return {\n css: channels.toCss(r, g, b, a),\n rgba: channels.toRgba(r, g, b, a)\n };\n }\n}\n\nexport function toPaddedHex(c: number): string {\n const s = c.toString(16);\n return s.length < 2 ? '0' + s : s;\n}\n\n/**\n * Gets the contrast ratio between two relative luminance values.\n * @param l1 The first relative luminance.\n * @param l2 The first relative luminance.\n * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef\n */\nexport function contrastRatio(l1: number, l2: number): number {\n if (l1 < l2) {\n return (l2 + 0.05) / (l1 + 0.05);\n }\n return (l1 + 0.05) / (l2 + 0.05);\n}\n","/**\n * Copyright (c) 2014-2020 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, ICoreMouseService, IUnicodeService, LogLevelEnum, ITerminalOptions, IOscLinkService } from 'common/services/Services';\nimport { InstantiationService } from 'common/services/InstantiationService';\nimport { LogService } from 'common/services/LogService';\nimport { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';\nimport { OptionsService } from 'common/services/OptionsService';\nimport { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent, ScrollSource } from 'common/Types';\nimport { CoreService } from 'common/services/CoreService';\nimport { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';\nimport { CoreMouseService } from 'common/services/CoreMouseService';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { CharsetService } from 'common/services/CharsetService';\nimport { updateWindowsModeWrappedState } from 'common/WindowsMode';\nimport { IFunctionIdentifier, IParams } from 'common/parser/Types';\nimport { IBufferSet } from 'common/buffer/Types';\nimport { InputHandler } from 'common/InputHandler';\nimport { WriteBuffer } from 'common/input/WriteBuffer';\nimport { OscLinkService } from 'common/services/OscLinkService';\n\n// Only trigger this warning a single time per session\nlet hasWriteSyncWarnHappened = false;\n\nexport abstract class CoreTerminal extends Disposable implements ICoreTerminal {\n protected readonly _instantiationService: IInstantiationService;\n protected readonly _bufferService: IBufferService;\n protected readonly _logService: ILogService;\n protected readonly _charsetService: ICharsetService;\n protected readonly _oscLinkService: IOscLinkService;\n\n public readonly coreMouseService: ICoreMouseService;\n public readonly coreService: ICoreService;\n public readonly unicodeService: IUnicodeService;\n public readonly optionsService: IOptionsService;\n\n protected _inputHandler: InputHandler;\n private _writeBuffer: WriteBuffer;\n private _windowsMode: IDisposable | undefined;\n\n private readonly _onBinary = this.register(new EventEmitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onData = this.register(new EventEmitter());\n public readonly onData = this._onData.event;\n protected _onLineFeed = this.register(new EventEmitter());\n public readonly onLineFeed = this._onLineFeed.event;\n private readonly _onResize = this.register(new EventEmitter<{ cols: number, rows: number }>());\n public readonly onResize = this._onResize.event;\n protected readonly _onWriteParsed = this.register(new EventEmitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n /**\n * Internally we track the source of the scroll but this is meaningless outside the library so\n * it's filtered out.\n */\n protected _onScrollApi?: EventEmitter;\n protected _onScroll = this.register(new EventEmitter());\n public get onScroll(): IEvent {\n if (!this._onScrollApi) {\n this._onScrollApi = this.register(new EventEmitter());\n this._onScroll.event(ev => {\n this._onScrollApi?.fire(ev.position);\n });\n }\n return this._onScrollApi.event;\n }\n\n public get cols(): number { return this._bufferService.cols; }\n public get rows(): number { return this._bufferService.rows; }\n public get buffers(): IBufferSet { return this._bufferService.buffers; }\n public get options(): Required { return this.optionsService.options; }\n public set options(options: ITerminalOptions) {\n for (const key in options) {\n this.optionsService.options[key] = options[key];\n }\n }\n\n constructor(\n options: Partial\n ) {\n super();\n\n // Setup and initialize services\n this._instantiationService = new InstantiationService();\n this.optionsService = this.register(new OptionsService(options));\n this._instantiationService.setService(IOptionsService, this.optionsService);\n this._bufferService = this.register(this._instantiationService.createInstance(BufferService));\n this._instantiationService.setService(IBufferService, this._bufferService);\n this._logService = this.register(this._instantiationService.createInstance(LogService));\n this._instantiationService.setService(ILogService, this._logService);\n this.coreService = this.register(this._instantiationService.createInstance(CoreService));\n this._instantiationService.setService(ICoreService, this.coreService);\n this.coreMouseService = this.register(this._instantiationService.createInstance(CoreMouseService));\n this._instantiationService.setService(ICoreMouseService, this.coreMouseService);\n this.unicodeService = this.register(this._instantiationService.createInstance(UnicodeService));\n this._instantiationService.setService(IUnicodeService, this.unicodeService);\n this._charsetService = this._instantiationService.createInstance(CharsetService);\n this._instantiationService.setService(ICharsetService, this._charsetService);\n this._oscLinkService = this._instantiationService.createInstance(OscLinkService);\n this._instantiationService.setService(IOscLinkService, this._oscLinkService);\n\n // Register input handler and handle/forward events\n this._inputHandler = this.register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));\n this.register(forwardEvent(this._inputHandler.onLineFeed, this._onLineFeed));\n this.register(this._inputHandler);\n\n // Setup listeners\n this.register(forwardEvent(this._bufferService.onResize, this._onResize));\n this.register(forwardEvent(this.coreService.onData, this._onData));\n this.register(forwardEvent(this.coreService.onBinary, this._onBinary));\n this.register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom()));\n this.register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));\n this.register(this.optionsService.onSpecificOptionChange('windowsMode', e => this._handleWindowsModeOptionChange(e)));\n this.register(this._bufferService.onScroll(event => {\n this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: ScrollSource.TERMINAL });\n this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);\n }));\n this.register(this._inputHandler.onScroll(event => {\n this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: ScrollSource.TERMINAL });\n this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);\n }));\n\n // Setup WriteBuffer\n this._writeBuffer = this.register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));\n this.register(forwardEvent(this._writeBuffer.onWriteParsed, this._onWriteParsed));\n\n this.register(toDisposable(() => {\n this._windowsMode?.dispose();\n this._windowsMode = undefined;\n }));\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._writeBuffer.write(data, callback);\n }\n\n /**\n * Write data to terminal synchonously.\n *\n * This method is unreliable with async parser handlers, thus should not\n * be used anymore. If you need blocking semantics on data input consider\n * `write` with a callback instead.\n *\n * @deprecated Unreliable, will be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n if (this._logService.logLevel <= LogLevelEnum.WARN && !hasWriteSyncWarnHappened) {\n this._logService.warn('writeSync is unreliable and will be removed soon.');\n hasWriteSyncWarnHappened = true;\n }\n this._writeBuffer.writeSync(data, maxSubsequentCalls);\n }\n\n public resize(x: number, y: number): void {\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n x = Math.max(x, MINIMUM_COLS);\n y = Math.max(y, MINIMUM_ROWS);\n\n this._bufferService.resize(x, y);\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n this._bufferService.scroll(eraseAttr, isWrapped);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used\n * to avoid unwanted events being handled by the viewport when the event was triggered from the\n * viewport originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean, source?: ScrollSource): void {\n this._bufferService.scrollLines(disp, suppressScrollEvent, source);\n }\n\n /**\n * Scroll the display of the terminal by a number of pages.\n * @param pageCount The number of pages to scroll (negative scrolls up).\n */\n public scrollPages(pageCount: number): void {\n this._bufferService.scrollPages(pageCount);\n }\n\n /**\n * Scrolls the display of the terminal to the top.\n */\n public scrollToTop(): void {\n this._bufferService.scrollToTop();\n }\n\n /**\n * Scrolls the display of the terminal to the bottom.\n */\n public scrollToBottom(): void {\n this._bufferService.scrollToBottom();\n }\n\n public scrollToLine(line: number): void {\n this._bufferService.scrollToLine(line);\n }\n\n /** Add handler for ESC escape sequence. See xterm.d.ts for details. */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._inputHandler.registerEscHandler(id, callback);\n }\n\n /** Add handler for DCS escape sequence. See xterm.d.ts for details. */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerDcsHandler(id, callback);\n }\n\n /** Add handler for CSI escape sequence. See xterm.d.ts for details. */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerCsiHandler(id, callback);\n }\n\n /** Add handler for OSC escape sequence. See xterm.d.ts for details. */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._inputHandler.registerOscHandler(ident, callback);\n }\n\n protected _setup(): void {\n if (this.optionsService.rawOptions.windowsMode) {\n this._enableWindowsMode();\n }\n }\n\n public reset(): void {\n this._inputHandler.reset();\n this._bufferService.reset();\n this._charsetService.reset();\n this.coreService.reset();\n this.coreMouseService.reset();\n }\n\n private _handleWindowsModeOptionChange(value: boolean): void {\n if (value) {\n this._enableWindowsMode();\n } else {\n this._windowsMode?.dispose();\n this._windowsMode = undefined;\n }\n }\n\n protected _enableWindowsMode(): void {\n if (!this._windowsMode) {\n const disposables: IDisposable[] = [];\n disposables.push(this.onLineFeed(updateWindowsModeWrappedState.bind(null, this._bufferService)));\n disposables.push(this.registerCsiHandler({ final: 'H' }, () => {\n updateWindowsModeWrappedState(this._bufferService);\n return false;\n }));\n this._windowsMode = {\n dispose: () => {\n for (const d of disposables) {\n d.dispose();\n }\n }\n };\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\n\ninterface IListener {\n (arg1: T, arg2: U): void;\n}\n\nexport interface IEvent {\n (listener: (arg1: T, arg2: U) => any): IDisposable;\n}\n\nexport interface IEventEmitter {\n event: IEvent;\n fire(arg1: T, arg2: U): void;\n dispose(): void;\n}\n\nexport class EventEmitter implements IEventEmitter {\n private _listeners: IListener[] = [];\n private _event?: IEvent;\n private _disposed: boolean = false;\n\n public get event(): IEvent {\n if (!this._event) {\n this._event = (listener: (arg1: T, arg2: U) => any) => {\n this._listeners.push(listener);\n const disposable = {\n dispose: () => {\n if (!this._disposed) {\n for (let i = 0; i < this._listeners.length; i++) {\n if (this._listeners[i] === listener) {\n this._listeners.splice(i, 1);\n return;\n }\n }\n }\n }\n };\n return disposable;\n };\n }\n return this._event;\n }\n\n public fire(arg1: T, arg2: U): void {\n const queue: IListener[] = [];\n for (let i = 0; i < this._listeners.length; i++) {\n queue.push(this._listeners[i]);\n }\n for (let i = 0; i < queue.length; i++) {\n queue[i].call(undefined, arg1, arg2);\n }\n }\n\n public dispose(): void {\n if (this._listeners) {\n this._listeners.length = 0;\n }\n this._disposed = true;\n }\n}\n\nexport function forwardEvent(from: IEvent, to: IEventEmitter): IDisposable {\n return from(e => to.fire(e));\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IInputHandler, IAttributeData, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType } from 'common/Types';\nimport { C0, C1 } from 'common/data/EscapeSequences';\nimport { CHARSETS, DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';\nimport { Disposable } from 'common/Lifecycle';\nimport { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from 'common/input/TextDecoder';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from 'common/parser/Types';\nimport { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { ICoreService, IBufferService, IOptionsService, ILogService, ICoreMouseService, ICharsetService, IUnicodeService, LogLevelEnum, IOscLinkService } from 'common/services/Services';\nimport { OscHandler } from 'common/parser/OscParser';\nimport { DcsHandler } from 'common/parser/DcsParser';\nimport { IBuffer } from 'common/buffer/Types';\nimport { parseColor } from 'common/input/XParseColor';\n\n/**\n * Map collect to glevel. Used in `selectCharset`.\n */\nconst GLEVEL: { [key: string]: number } = { '(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2 };\n\n/**\n * VT commands done by the parser - FIXME: move this to the parser?\n */\n// @vt: #Y ESC CSI \"Control Sequence Introducer\" \"ESC [\" \"Start of a CSI sequence.\"\n// @vt: #Y ESC OSC \"Operating System Command\" \"ESC ]\" \"Start of an OSC sequence.\"\n// @vt: #Y ESC DCS \"Device Control String\" \"ESC P\" \"Start of a DCS sequence.\"\n// @vt: #Y ESC ST \"String Terminator\" \"ESC \\\" \"Terminator used for string type sequences.\"\n// @vt: #Y ESC PM \"Privacy Message\" \"ESC ^\" \"Start of a privacy message.\"\n// @vt: #Y ESC APC \"Application Program Command\" \"ESC _\" \"Start of an APC sequence.\"\n// @vt: #Y C1 CSI \"Control Sequence Introducer\" \"\\x9B\" \"Start of a CSI sequence.\"\n// @vt: #Y C1 OSC \"Operating System Command\" \"\\x9D\" \"Start of an OSC sequence.\"\n// @vt: #Y C1 DCS \"Device Control String\" \"\\x90\" \"Start of a DCS sequence.\"\n// @vt: #Y C1 ST \"String Terminator\" \"\\x9C\" \"Terminator used for string type sequences.\"\n// @vt: #Y C1 PM \"Privacy Message\" \"\\x9E\" \"Start of a privacy message.\"\n// @vt: #Y C1 APC \"Application Program Command\" \"\\x9F\" \"Start of an APC sequence.\"\n// @vt: #Y C0 NUL \"Null\" \"\\0, \\x00\" \"NUL is ignored.\"\n// @vt: #Y C0 ESC \"Escape\" \"\\e, \\x1B\" \"Start of a sequence. Cancels any other sequence.\"\n\n/**\n * Document xterm VT features here that are currently unsupported\n */\n// @vt: #E[Supported via xterm-addon-image.] DCS SIXEL \"SIXEL Graphics\" \"DCS Ps ; Ps ; Ps ; q \tPt ST\" \"Draw SIXEL image.\"\n// @vt: #N DCS DECUDK \"User Defined Keys\" \"DCS Ps ; Ps \\| Pt ST\" \"Definitions for user-defined keys.\"\n// @vt: #N DCS XTGETTCAP \"Request Terminfo String\" \"DCS + q Pt ST\" \"Request Terminfo String.\"\n// @vt: #N DCS XTSETTCAP \"Set Terminfo Data\" \"DCS + p Pt ST\" \"Set Terminfo Data.\"\n// @vt: #N OSC 1 \"Set Icon Name\" \"OSC 1 ; Pt BEL\" \"Set icon name.\"\n\n/**\n * Max length of the UTF32 input buffer. Real memory consumption is 4 times higher.\n */\nconst MAX_PARSEBUFFER_LENGTH = 131072;\n\n/**\n * Limit length of title and icon name stacks.\n */\nconst STACK_LIMIT = 10;\n\n// map params to window option\nfunction paramToWindowOption(n: number, opts: IWindowOptions): boolean {\n if (n > 24) {\n return opts.setWinLines || false;\n }\n switch (n) {\n case 1: return !!opts.restoreWin;\n case 2: return !!opts.minimizeWin;\n case 3: return !!opts.setWinPosition;\n case 4: return !!opts.setWinSizePixels;\n case 5: return !!opts.raiseWin;\n case 6: return !!opts.lowerWin;\n case 7: return !!opts.refreshWin;\n case 8: return !!opts.setWinSizeChars;\n case 9: return !!opts.maximizeWin;\n case 10: return !!opts.fullscreenWin;\n case 11: return !!opts.getWinState;\n case 13: return !!opts.getWinPosition;\n case 14: return !!opts.getWinSizePixels;\n case 15: return !!opts.getScreenSizePixels;\n case 16: return !!opts.getCellSizePixels;\n case 18: return !!opts.getWinSizeChars;\n case 19: return !!opts.getScreenSizeChars;\n case 20: return !!opts.getIconTitle;\n case 21: return !!opts.getWinTitle;\n case 22: return !!opts.pushTitle;\n case 23: return !!opts.popTitle;\n case 24: return !!opts.setWinLines;\n }\n return false;\n}\n\nexport enum WindowsOptionsReportType {\n GET_WIN_SIZE_PIXELS = 0,\n GET_CELL_SIZE_PIXELS = 1\n}\n\n// create a warning log if an async handler takes longer than the limit (in ms)\nconst SLOW_ASYNC_LIMIT = 5000;\n\n// Work variables to avoid garbage collection\nlet $temp = 0;\n\n/**\n * The terminal's standard implementation of IInputHandler, this handles all\n * input from the Parser.\n *\n * Refer to http://invisible-island.net/xterm/ctlseqs/ctlseqs.html to understand\n * each function's header comment.\n */\nexport class InputHandler extends Disposable implements IInputHandler {\n private _parseBuffer: Uint32Array = new Uint32Array(4096);\n private _stringDecoder: StringToUtf32 = new StringToUtf32();\n private _utf8Decoder: Utf8ToUtf32 = new Utf8ToUtf32();\n private _workCell: CellData = new CellData();\n private _windowTitle = '';\n private _iconName = '';\n private _dirtyRowTracker: IDirtyRowTracker;\n protected _windowTitleStack: string[] = [];\n protected _iconNameStack: string[] = [];\n\n private _curAttrData: IAttributeData = DEFAULT_ATTR_DATA.clone();\n public getAttrData(): IAttributeData { return this._curAttrData; }\n private _eraseAttrDataInternal: IAttributeData = DEFAULT_ATTR_DATA.clone();\n\n private _activeBuffer: IBuffer;\n\n private readonly _onRequestBell = this.register(new EventEmitter());\n public readonly onRequestBell = this._onRequestBell.event;\n private readonly _onRequestRefreshRows = this.register(new EventEmitter());\n public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;\n private readonly _onRequestReset = this.register(new EventEmitter());\n public readonly onRequestReset = this._onRequestReset.event;\n private readonly _onRequestSendFocus = this.register(new EventEmitter());\n public readonly onRequestSendFocus = this._onRequestSendFocus.event;\n private readonly _onRequestSyncScrollBar = this.register(new EventEmitter());\n public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;\n private readonly _onRequestWindowsOptionsReport = this.register(new EventEmitter());\n public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;\n\n private readonly _onA11yChar = this.register(new EventEmitter());\n public readonly onA11yChar = this._onA11yChar.event;\n private readonly _onA11yTab = this.register(new EventEmitter());\n public readonly onA11yTab = this._onA11yTab.event;\n private readonly _onCursorMove = this.register(new EventEmitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onLineFeed = this.register(new EventEmitter());\n public readonly onLineFeed = this._onLineFeed.event;\n private readonly _onScroll = this.register(new EventEmitter());\n public readonly onScroll = this._onScroll.event;\n private readonly _onTitleChange = this.register(new EventEmitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onColor = this.register(new EventEmitter());\n public readonly onColor = this._onColor.event;\n\n private _parseStack: IParseStack = {\n paused: false,\n cursorStartX: 0,\n cursorStartY: 0,\n decodedLength: 0,\n position: 0\n };\n\n constructor(\n private readonly _bufferService: IBufferService,\n private readonly _charsetService: ICharsetService,\n private readonly _coreService: ICoreService,\n private readonly _logService: ILogService,\n private readonly _optionsService: IOptionsService,\n private readonly _oscLinkService: IOscLinkService,\n private readonly _coreMouseService: ICoreMouseService,\n private readonly _unicodeService: IUnicodeService,\n private readonly _parser: IEscapeSequenceParser = new EscapeSequenceParser()\n ) {\n super();\n this.register(this._parser);\n this._dirtyRowTracker = new DirtyRowTracker(this._bufferService);\n\n // Track properties used in performance critical code manually to avoid using slow getters\n this._activeBuffer = this._bufferService.buffer;\n this.register(this._bufferService.buffers.onBufferActivate(e => this._activeBuffer = e.activeBuffer));\n\n /**\n * custom fallback handlers\n */\n this._parser.setCsiHandlerFallback((ident, params) => {\n this._logService.debug('Unknown CSI code: ', { identifier: this._parser.identToString(ident), params: params.toArray() });\n });\n this._parser.setEscHandlerFallback(ident => {\n this._logService.debug('Unknown ESC code: ', { identifier: this._parser.identToString(ident) });\n });\n this._parser.setExecuteHandlerFallback(code => {\n this._logService.debug('Unknown EXECUTE code: ', { code });\n });\n this._parser.setOscHandlerFallback((identifier, action, data) => {\n this._logService.debug('Unknown OSC code: ', { identifier, action, data });\n });\n this._parser.setDcsHandlerFallback((ident, action, payload) => {\n if (action === 'HOOK') {\n payload = payload.toArray();\n }\n this._logService.debug('Unknown DCS code: ', { identifier: this._parser.identToString(ident), action, payload });\n });\n\n /**\n * print handler\n */\n this._parser.setPrintHandler((data, start, end) => this.print(data, start, end));\n\n /**\n * CSI handler\n */\n this._parser.registerCsiHandler({ final: '@' }, params => this.insertChars(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: '@' }, params => this.scrollLeft(params));\n this._parser.registerCsiHandler({ final: 'A' }, params => this.cursorUp(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'A' }, params => this.scrollRight(params));\n this._parser.registerCsiHandler({ final: 'B' }, params => this.cursorDown(params));\n this._parser.registerCsiHandler({ final: 'C' }, params => this.cursorForward(params));\n this._parser.registerCsiHandler({ final: 'D' }, params => this.cursorBackward(params));\n this._parser.registerCsiHandler({ final: 'E' }, params => this.cursorNextLine(params));\n this._parser.registerCsiHandler({ final: 'F' }, params => this.cursorPrecedingLine(params));\n this._parser.registerCsiHandler({ final: 'G' }, params => this.cursorCharAbsolute(params));\n this._parser.registerCsiHandler({ final: 'H' }, params => this.cursorPosition(params));\n this._parser.registerCsiHandler({ final: 'I' }, params => this.cursorForwardTab(params));\n this._parser.registerCsiHandler({ final: 'J' }, params => this.eraseInDisplay(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'J' }, params => this.eraseInDisplay(params, true));\n this._parser.registerCsiHandler({ final: 'K' }, params => this.eraseInLine(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'K' }, params => this.eraseInLine(params, true));\n this._parser.registerCsiHandler({ final: 'L' }, params => this.insertLines(params));\n this._parser.registerCsiHandler({ final: 'M' }, params => this.deleteLines(params));\n this._parser.registerCsiHandler({ final: 'P' }, params => this.deleteChars(params));\n this._parser.registerCsiHandler({ final: 'S' }, params => this.scrollUp(params));\n this._parser.registerCsiHandler({ final: 'T' }, params => this.scrollDown(params));\n this._parser.registerCsiHandler({ final: 'X' }, params => this.eraseChars(params));\n this._parser.registerCsiHandler({ final: 'Z' }, params => this.cursorBackwardTab(params));\n this._parser.registerCsiHandler({ final: '`' }, params => this.charPosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'a' }, params => this.hPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'b' }, params => this.repeatPrecedingCharacter(params));\n this._parser.registerCsiHandler({ final: 'c' }, params => this.sendDeviceAttributesPrimary(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'c' }, params => this.sendDeviceAttributesSecondary(params));\n this._parser.registerCsiHandler({ final: 'd' }, params => this.linePosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'e' }, params => this.vPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'f' }, params => this.hVPosition(params));\n this._parser.registerCsiHandler({ final: 'g' }, params => this.tabClear(params));\n this._parser.registerCsiHandler({ final: 'h' }, params => this.setMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'h' }, params => this.setModePrivate(params));\n this._parser.registerCsiHandler({ final: 'l' }, params => this.resetMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'l' }, params => this.resetModePrivate(params));\n this._parser.registerCsiHandler({ final: 'm' }, params => this.charAttributes(params));\n this._parser.registerCsiHandler({ final: 'n' }, params => this.deviceStatus(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'n' }, params => this.deviceStatusPrivate(params));\n this._parser.registerCsiHandler({ intermediates: '!', final: 'p' }, params => this.softReset(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'q' }, params => this.setCursorStyle(params));\n this._parser.registerCsiHandler({ final: 'r' }, params => this.setScrollRegion(params));\n this._parser.registerCsiHandler({ final: 's' }, params => this.saveCursor(params));\n this._parser.registerCsiHandler({ final: 't' }, params => this.windowOptions(params));\n this._parser.registerCsiHandler({ final: 'u' }, params => this.restoreCursor(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '}' }, params => this.insertColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '~' }, params => this.deleteColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\"', final: 'q' }, params => this.selectProtected(params));\n this._parser.registerCsiHandler({ intermediates: '$', final: 'p' }, params => this.requestMode(params, true));\n this._parser.registerCsiHandler({ prefix: '?', intermediates: '$', final: 'p' }, params => this.requestMode(params, false));\n\n /**\n * execute handler\n */\n this._parser.setExecuteHandler(C0.BEL, () => this.bell());\n this._parser.setExecuteHandler(C0.LF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.VT, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.FF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn());\n this._parser.setExecuteHandler(C0.BS, () => this.backspace());\n this._parser.setExecuteHandler(C0.HT, () => this.tab());\n this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());\n this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());\n // FIXME: What do to with missing? Old code just added those to print.\n\n this._parser.setExecuteHandler(C1.IND, () => this.index());\n this._parser.setExecuteHandler(C1.NEL, () => this.nextLine());\n this._parser.setExecuteHandler(C1.HTS, () => this.tabSet());\n\n /**\n * OSC handler\n */\n // 0 - icon name + title\n this._parser.registerOscHandler(0, new OscHandler(data => { this.setTitle(data); this.setIconName(data); return true; }));\n // 1 - icon name\n this._parser.registerOscHandler(1, new OscHandler(data => this.setIconName(data)));\n // 2 - title\n this._parser.registerOscHandler(2, new OscHandler(data => this.setTitle(data)));\n // 3 - set property X in the form \"prop=value\"\n // 4 - Change Color Number\n this._parser.registerOscHandler(4, new OscHandler(data => this.setOrReportIndexedColor(data)));\n // 5 - Change Special Color Number\n // 6 - Enable/disable Special Color Number c\n // 7 - current directory? (not in xterm spec, see https://gitlab.com/gnachman/iterm2/issues/3939)\n // 8 - create hyperlink (not in xterm spec, see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)\n this._parser.registerOscHandler(8, new OscHandler(data => this.setHyperlink(data)));\n // 10 - Change VT100 text foreground color to Pt.\n this._parser.registerOscHandler(10, new OscHandler(data => this.setOrReportFgColor(data)));\n // 11 - Change VT100 text background color to Pt.\n this._parser.registerOscHandler(11, new OscHandler(data => this.setOrReportBgColor(data)));\n // 12 - Change text cursor color to Pt.\n this._parser.registerOscHandler(12, new OscHandler(data => this.setOrReportCursorColor(data)));\n // 13 - Change mouse foreground color to Pt.\n // 14 - Change mouse background color to Pt.\n // 15 - Change Tektronix foreground color to Pt.\n // 16 - Change Tektronix background color to Pt.\n // 17 - Change highlight background color to Pt.\n // 18 - Change Tektronix cursor color to Pt.\n // 19 - Change highlight foreground color to Pt.\n // 46 - Change Log File to Pt.\n // 50 - Set Font to Pt.\n // 51 - reserved for Emacs shell.\n // 52 - Manipulate Selection Data.\n // 104 ; c - Reset Color Number c.\n this._parser.registerOscHandler(104, new OscHandler(data => this.restoreIndexedColor(data)));\n // 105 ; c - Reset Special Color Number c.\n // 106 ; c; f - Enable/disable Special Color Number c.\n // 110 - Reset VT100 text foreground color.\n this._parser.registerOscHandler(110, new OscHandler(data => this.restoreFgColor(data)));\n // 111 - Reset VT100 text background color.\n this._parser.registerOscHandler(111, new OscHandler(data => this.restoreBgColor(data)));\n // 112 - Reset text cursor color.\n this._parser.registerOscHandler(112, new OscHandler(data => this.restoreCursorColor(data)));\n // 113 - Reset mouse foreground color.\n // 114 - Reset mouse background color.\n // 115 - Reset Tektronix foreground color.\n // 116 - Reset Tektronix background color.\n // 117 - Reset highlight color.\n // 118 - Reset Tektronix cursor color.\n // 119 - Reset highlight foreground color.\n\n /**\n * ESC handlers\n */\n this._parser.registerEscHandler({ final: '7' }, () => this.saveCursor());\n this._parser.registerEscHandler({ final: '8' }, () => this.restoreCursor());\n this._parser.registerEscHandler({ final: 'D' }, () => this.index());\n this._parser.registerEscHandler({ final: 'E' }, () => this.nextLine());\n this._parser.registerEscHandler({ final: 'H' }, () => this.tabSet());\n this._parser.registerEscHandler({ final: 'M' }, () => this.reverseIndex());\n this._parser.registerEscHandler({ final: '=' }, () => this.keypadApplicationMode());\n this._parser.registerEscHandler({ final: '>' }, () => this.keypadNumericMode());\n this._parser.registerEscHandler({ final: 'c' }, () => this.fullReset());\n this._parser.registerEscHandler({ final: 'n' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: 'o' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '|' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '}' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: '~' }, () => this.setgLevel(1));\n this._parser.registerEscHandler({ intermediates: '%', final: '@' }, () => this.selectDefaultCharset());\n this._parser.registerEscHandler({ intermediates: '%', final: 'G' }, () => this.selectDefaultCharset());\n for (const flag in CHARSETS) {\n this._parser.registerEscHandler({ intermediates: '(', final: flag }, () => this.selectCharset('(' + flag));\n this._parser.registerEscHandler({ intermediates: ')', final: flag }, () => this.selectCharset(')' + flag));\n this._parser.registerEscHandler({ intermediates: '*', final: flag }, () => this.selectCharset('*' + flag));\n this._parser.registerEscHandler({ intermediates: '+', final: flag }, () => this.selectCharset('+' + flag));\n this._parser.registerEscHandler({ intermediates: '-', final: flag }, () => this.selectCharset('-' + flag));\n this._parser.registerEscHandler({ intermediates: '.', final: flag }, () => this.selectCharset('.' + flag));\n this._parser.registerEscHandler({ intermediates: '/', final: flag }, () => this.selectCharset('/' + flag)); // TODO: supported?\n }\n this._parser.registerEscHandler({ intermediates: '#', final: '8' }, () => this.screenAlignmentPattern());\n\n /**\n * error handler\n */\n this._parser.setErrorHandler((state: IParsingState) => {\n this._logService.error('Parsing error: ', state);\n return state;\n });\n\n /**\n * DCS handler\n */\n this._parser.registerDcsHandler({ intermediates: '$', final: 'q' }, new DcsHandler((data, params) => this.requestStatusString(data, params)));\n }\n\n /**\n * Async parse support.\n */\n private _preserveStack(cursorStartX: number, cursorStartY: number, decodedLength: number, position: number): void {\n this._parseStack.paused = true;\n this._parseStack.cursorStartX = cursorStartX;\n this._parseStack.cursorStartY = cursorStartY;\n this._parseStack.decodedLength = decodedLength;\n this._parseStack.position = position;\n }\n\n private _logSlowResolvingAsync(p: Promise): void {\n // log a limited warning about an async handler taking too long\n if (this._logService.logLevel <= LogLevelEnum.WARN) {\n Promise.race([p, new Promise((res, rej) => setTimeout(() => rej('#SLOW_TIMEOUT'), SLOW_ASYNC_LIMIT))])\n .catch(err => {\n if (err !== '#SLOW_TIMEOUT') {\n throw err;\n }\n console.warn(`async parser handler taking longer than ${SLOW_ASYNC_LIMIT} ms`);\n });\n }\n }\n\n private _getCurrentLinkId(): number {\n return this._curAttrData.extended.urlId;\n }\n\n /**\n * Parse call with async handler support.\n *\n * Whether the stack state got preserved for the next call, is indicated by the return value:\n * - undefined (void):\n * all handlers were sync, no stack save, continue normally with next chunk\n * - Promise\\:\n * execution stopped at async handler, stack saved, continue with\n * same chunk and the promise resolve value as `promiseResult` until the method returns `undefined`\n *\n * Note: This method should only be called by `Terminal.write` to ensure correct execution order and\n * proper continuation of async parser handlers.\n */\n public parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise {\n let result: void | Promise;\n let cursorStartX = this._activeBuffer.x;\n let cursorStartY = this._activeBuffer.y;\n let start = 0;\n const wasPaused = this._parseStack.paused;\n\n if (wasPaused) {\n // assumption: _parseBuffer never mutates between async calls\n if (result = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, promiseResult)) {\n this._logSlowResolvingAsync(result);\n return result;\n }\n cursorStartX = this._parseStack.cursorStartX;\n cursorStartY = this._parseStack.cursorStartY;\n this._parseStack.paused = false;\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n start = this._parseStack.position + MAX_PARSEBUFFER_LENGTH;\n }\n }\n\n // Log debug data, the log level gate is to prevent extra work in this hot path\n if (this._logService.logLevel <= LogLevelEnum.DEBUG) {\n this._logService.debug(`parsing data${typeof data === 'string' ? ` \"${data}\"` : ` \"${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}\"`}`, typeof data === 'string'\n ? data.split('').map(e => e.charCodeAt(0))\n : data\n );\n }\n\n // resize input buffer if needed\n if (this._parseBuffer.length < data.length) {\n if (this._parseBuffer.length < MAX_PARSEBUFFER_LENGTH) {\n this._parseBuffer = new Uint32Array(Math.min(data.length, MAX_PARSEBUFFER_LENGTH));\n }\n }\n\n // Clear the dirty row service so we know which lines changed as a result of parsing\n // Important: do not clear between async calls, otherwise we lost pending update information.\n if (!wasPaused) {\n this._dirtyRowTracker.clearRange();\n }\n\n // process big data in smaller chunks\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n for (let i = start; i < data.length; i += MAX_PARSEBUFFER_LENGTH) {\n const end = i + MAX_PARSEBUFFER_LENGTH < data.length ? i + MAX_PARSEBUFFER_LENGTH : data.length;\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data.substring(i, end), this._parseBuffer)\n : this._utf8Decoder.decode(data.subarray(i, end), this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, i);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n } else {\n if (!wasPaused) {\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data, this._parseBuffer)\n : this._utf8Decoder.decode(data, this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, 0);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n }\n\n if (this._activeBuffer.x !== cursorStartX || this._activeBuffer.y !== cursorStartY) {\n this._onCursorMove.fire();\n }\n\n // Refresh any dirty rows accumulated as part of parsing\n this._onRequestRefreshRows.fire(this._dirtyRowTracker.start, this._dirtyRowTracker.end);\n }\n\n public print(data: Uint32Array, start: number, end: number): void {\n let code: number;\n let chWidth: number;\n const charset = this._charsetService.charset;\n const screenReaderMode = this._optionsService.rawOptions.screenReaderMode;\n const cols = this._bufferService.cols;\n const wraparoundMode = this._coreService.decPrivateModes.wraparound;\n const insertMode = this._coreService.modes.insertMode;\n const curAttr = this._curAttrData;\n let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n // handle wide chars: reset start_cell-1 if we would overwrite the second cell of a wide char\n if (this._activeBuffer.x && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x - 1) === 2) {\n bufferRow.setCellFromCodePoint(this._activeBuffer.x - 1, 0, 1, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n\n for (let pos = start; pos < end; ++pos) {\n code = data[pos];\n\n // calculate print space\n // expensive call, therefore we save width in line buffer\n chWidth = this._unicodeService.wcwidth(code);\n\n // get charset replacement character\n // charset is only defined for ASCII, therefore we only\n // search for an replacement char if code < 127\n if (code < 127 && charset) {\n const ch = charset[String.fromCharCode(code)];\n if (ch) {\n code = ch.charCodeAt(0);\n }\n }\n\n if (screenReaderMode) {\n this._onA11yChar.fire(stringFromCodePoint(code));\n }\n if (this._getCurrentLinkId()) {\n this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y);\n }\n\n // insert combining char at last cursor position\n // this._activeBuffer.x should never be 0 for a combining char\n // since they always follow a cell consuming char\n // therefore we can test for this._activeBuffer.x to avoid overflow left\n if (!chWidth && this._activeBuffer.x) {\n if (!bufferRow.getWidth(this._activeBuffer.x - 1)) {\n // found empty cell after fullwidth, need to go 2 cells back\n // it is save to step 2 cells back here\n // since an empty cell is only set by fullwidth chars\n bufferRow.addCodepointToCell(this._activeBuffer.x - 2, code);\n } else {\n bufferRow.addCodepointToCell(this._activeBuffer.x - 1, code);\n }\n continue;\n }\n\n // goto next line if ch would overflow\n // NOTE: To avoid costly width checks here,\n // the terminal does not allow a cols < 2.\n if (this._activeBuffer.x + chWidth - 1 >= cols) {\n // autowrap - DECAWM\n // automatically wraps to the beginning of the next line\n if (wraparoundMode) {\n // clear left over cells to the right\n while (this._activeBuffer.x < cols) {\n bufferRow.setCellFromCodePoint(this._activeBuffer.x++, 0, 1, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n this._activeBuffer.x = 0;\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData(), true);\n } else {\n if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n // The line already exists (eg. the initial viewport), mark it as a\n // wrapped line\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = true;\n }\n // row changed, get it again\n bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n } else {\n this._activeBuffer.x = cols - 1;\n if (chWidth === 2) {\n // FIXME: check for xterm behavior\n // What to do here? We got a wide char that does not fit into last cell\n continue;\n }\n }\n }\n\n // insert mode: move characters to right\n if (insertMode) {\n // right shift cells according to the width\n bufferRow.insertCells(this._activeBuffer.x, chWidth, this._activeBuffer.getNullCell(curAttr), curAttr);\n // test last cell - since the last cell has only room for\n // a halfwidth char any fullwidth shifted there is lost\n // and will be set to empty cell\n if (bufferRow.getWidth(cols - 1) === 2) {\n bufferRow.setCellFromCodePoint(cols - 1, NULL_CELL_CODE, NULL_CELL_WIDTH, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n }\n\n // write current char to buffer and advance cursor\n bufferRow.setCellFromCodePoint(this._activeBuffer.x++, code, chWidth, curAttr.fg, curAttr.bg, curAttr.extended);\n\n // fullwidth char - also set next cell to placeholder stub and advance cursor\n // for graphemes bigger than fullwidth we can simply loop to zero\n // we already made sure above, that this._activeBuffer.x + chWidth will not overflow right\n if (chWidth > 0) {\n while (--chWidth) {\n // other than a regular empty cell a cell following a wide char has no width\n bufferRow.setCellFromCodePoint(this._activeBuffer.x++, 0, 0, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n }\n }\n // store last char in Parser.precedingCodepoint for REP to work correctly\n // This needs to check whether:\n // - fullwidth + surrogates: reset\n // - combining: only base char gets carried on (bug in xterm?)\n if (end - start > 0) {\n bufferRow.loadCell(this._activeBuffer.x - 1, this._workCell);\n if (this._workCell.getWidth() === 2 || this._workCell.getCode() > 0xFFFF) {\n this._parser.precedingCodepoint = 0;\n } else if (this._workCell.isCombined()) {\n this._parser.precedingCodepoint = this._workCell.getChars().charCodeAt(0);\n } else {\n this._parser.precedingCodepoint = this._workCell.content;\n }\n }\n\n // handle wide chars: reset cell to the right if it is second cell of a wide char\n if (this._activeBuffer.x < cols && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x) === 0 && !bufferRow.hasContent(this._activeBuffer.x)) {\n bufferRow.setCellFromCodePoint(this._activeBuffer.x, 0, 1, curAttr.fg, curAttr.bg, curAttr.extended);\n }\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Forward registerCsiHandler from parser.\n */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n if (id.final === 't' && !id.prefix && !id.intermediates) {\n // security: always check whether window option is allowed\n return this._parser.registerCsiHandler(id, params => {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n return callback(params);\n });\n }\n return this._parser.registerCsiHandler(id, callback);\n }\n\n /**\n * Forward registerDcsHandler from parser.\n */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._parser.registerDcsHandler(id, new DcsHandler(callback));\n }\n\n /**\n * Forward registerEscHandler from parser.\n */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._parser.registerEscHandler(id, callback);\n }\n\n /**\n * Forward registerOscHandler from parser.\n */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._parser.registerOscHandler(ident, new OscHandler(callback));\n }\n\n /**\n * BEL\n * Bell (Ctrl-G).\n *\n * @vt: #Y C0 BEL \"Bell\" \"\\a, \\x07\" \"Ring the bell.\"\n * The behavior of the bell is further customizable with `ITerminalOptions.bellStyle`\n * and `ITerminalOptions.bellSound`.\n */\n public bell(): boolean {\n this._onRequestBell.fire();\n return true;\n }\n\n /**\n * LF\n * Line Feed or New Line (NL). (LF is Ctrl-J).\n *\n * @vt: #Y C0 LF \"Line Feed\" \"\\n, \\x0A\" \"Move the cursor one row down, scrolling if needed.\"\n * Scrolling is restricted to scroll margins and will only happen on the bottom line.\n *\n * @vt: #Y C0 VT \"Vertical Tabulation\" \"\\v, \\x0B\" \"Treated as LF.\"\n * @vt: #Y C0 FF \"Form Feed\" \"\\f, \\x0C\" \"Treated as LF.\"\n */\n public lineFeed(): boolean {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._optionsService.rawOptions.convertEol) {\n this._activeBuffer.x = 0;\n }\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n // If the end of the line is hit, prevent this action from wrapping around to the next line.\n if (this._activeBuffer.x >= this._bufferService.cols) {\n this._activeBuffer.x--;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n this._onLineFeed.fire();\n return true;\n }\n\n /**\n * CR\n * Carriage Return (Ctrl-M).\n *\n * @vt: #Y C0 CR \"Carriage Return\" \"\\r, \\x0D\" \"Move the cursor to the beginning of the row.\"\n */\n public carriageReturn(): boolean {\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * BS\n * Backspace (Ctrl-H).\n *\n * @vt: #Y C0 BS \"Backspace\" \"\\b, \\x08\" \"Move the cursor one position to the left.\"\n * By default it is not possible to move the cursor past the leftmost position.\n * If `reverse wrap-around` (`CSI ? 45 h`) is set, a previous soft line wrap (DECAWM)\n * can be undone with BS within the scroll margins. In that case the cursor will wrap back\n * to the end of the previous row. Note that it is not possible to peek back into the scrollbuffer\n * with the cursor, thus at the home position (top-leftmost cell) this has no effect.\n */\n public backspace(): boolean {\n // reverse wrap-around is disabled\n if (!this._coreService.decPrivateModes.reverseWraparound) {\n this._restrictCursor();\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n }\n return true;\n }\n\n // reverse wrap-around is enabled\n // other than for normal operation mode, reverse wrap-around allows the cursor\n // to be at x=cols to be able to address the last cell of a row by BS\n this._restrictCursor(this._bufferService.cols);\n\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n } else {\n /**\n * reverse wrap-around handling:\n * Our implementation deviates from xterm on purpose. Details:\n * - only previous soft NLs can be reversed (isWrapped=true)\n * - only works within scrollborders (top/bottom, left/right not yet supported)\n * - cannot peek into scrollbuffer\n * - any cursor movement sequence keeps working as expected\n */\n if (this._activeBuffer.x === 0\n && this._activeBuffer.y > this._activeBuffer.scrollTop\n && this._activeBuffer.y <= this._activeBuffer.scrollBottom\n && this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)?.isWrapped) {\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n this._activeBuffer.y--;\n this._activeBuffer.x = this._bufferService.cols - 1;\n // find last taken cell - last cell can have 3 different states:\n // - hasContent(true) + hasWidth(1): narrow char - we are done\n // - hasWidth(0): second part of wide char - we are done\n // - hasContent(false) + hasWidth(1): empty cell due to early wrapping wide char, go one cell further back\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n if (line.hasWidth(this._activeBuffer.x) && !line.hasContent(this._activeBuffer.x)) {\n this._activeBuffer.x--;\n // We do this only once, since width=1 + hasContent=false currently happens only once before\n // early wrapping of a wide char.\n // This needs to be fixed once we support graphemes taking more than 2 cells.\n }\n }\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * TAB\n * Horizontal Tab (HT) (Ctrl-I).\n *\n * @vt: #Y C0 HT \"Horizontal Tabulation\" \"\\t, \\x09\" \"Move the cursor to the next character tab stop.\"\n */\n public tab(): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n const originalX = this._activeBuffer.x;\n this._activeBuffer.x = this._activeBuffer.nextStop();\n if (this._optionsService.rawOptions.screenReaderMode) {\n this._onA11yTab.fire(this._activeBuffer.x - originalX);\n }\n return true;\n }\n\n /**\n * SO\n * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the\n * G1 character set.\n *\n * @vt: #P[Only limited ISO-2022 charset support.] C0 SO \"Shift Out\" \"\\x0E\" \"Switch to an alternative character set.\"\n */\n public shiftOut(): boolean {\n this._charsetService.setgLevel(1);\n return true;\n }\n\n /**\n * SI\n * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0\n * character set (the default).\n *\n * @vt: #Y C0 SI \"Shift In\" \"\\x0F\" \"Return to regular character set after Shift Out.\"\n */\n public shiftIn(): boolean {\n this._charsetService.setgLevel(0);\n return true;\n }\n\n /**\n * Restrict cursor to viewport size / scroll margin (origin mode).\n */\n private _restrictCursor(maxCol: number = this._bufferService.cols - 1): void {\n this._activeBuffer.x = Math.min(maxCol, Math.max(0, this._activeBuffer.x));\n this._activeBuffer.y = this._coreService.decPrivateModes.origin\n ? Math.min(this._activeBuffer.scrollBottom, Math.max(this._activeBuffer.scrollTop, this._activeBuffer.y))\n : Math.min(this._bufferService.rows - 1, Math.max(0, this._activeBuffer.y));\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set absolute cursor position.\n */\n private _setCursor(x: number, y: number): void {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._coreService.decPrivateModes.origin) {\n this._activeBuffer.x = x;\n this._activeBuffer.y = this._activeBuffer.scrollTop + y;\n } else {\n this._activeBuffer.x = x;\n this._activeBuffer.y = y;\n }\n this._restrictCursor();\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set relative cursor position.\n */\n private _moveCursor(x: number, y: number): void {\n // for relative changes we have to make sure we are within 0 .. cols/rows - 1\n // before calculating the new position\n this._restrictCursor();\n this._setCursor(this._activeBuffer.x + x, this._activeBuffer.y + y);\n }\n\n /**\n * CSI Ps A\n * Cursor Up Ps Times (default = 1) (CUU).\n *\n * @vt: #Y CSI CUU \"Cursor Up\" \"CSI Ps A\" \"Move cursor `Ps` times up (default=1).\"\n * If the cursor would pass the top scroll margin, it will stop there.\n */\n public cursorUp(params: IParams): boolean {\n // stop at scrollTop\n const diffToTop = this._activeBuffer.y - this._activeBuffer.scrollTop;\n if (diffToTop >= 0) {\n this._moveCursor(0, -Math.min(diffToTop, params.params[0] || 1));\n } else {\n this._moveCursor(0, -(params.params[0] || 1));\n }\n return true;\n }\n\n /**\n * CSI Ps B\n * Cursor Down Ps Times (default = 1) (CUD).\n *\n * @vt: #Y CSI CUD \"Cursor Down\" \"CSI Ps B\" \"Move cursor `Ps` times down (default=1).\"\n * If the cursor would pass the bottom scroll margin, it will stop there.\n */\n public cursorDown(params: IParams): boolean {\n // stop at scrollBottom\n const diffToBottom = this._activeBuffer.scrollBottom - this._activeBuffer.y;\n if (diffToBottom >= 0) {\n this._moveCursor(0, Math.min(diffToBottom, params.params[0] || 1));\n } else {\n this._moveCursor(0, params.params[0] || 1);\n }\n return true;\n }\n\n /**\n * CSI Ps C\n * Cursor Forward Ps Times (default = 1) (CUF).\n *\n * @vt: #Y CSI CUF \"Cursor Forward\" \"CSI Ps C\" \"Move cursor `Ps` times forward (default=1).\"\n */\n public cursorForward(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Ps D\n * Cursor Backward Ps Times (default = 1) (CUB).\n *\n * @vt: #Y CSI CUB \"Cursor Backward\" \"CSI Ps D\" \"Move cursor `Ps` times backward (default=1).\"\n */\n public cursorBackward(params: IParams): boolean {\n this._moveCursor(-(params.params[0] || 1), 0);\n return true;\n }\n\n /**\n * CSI Ps E\n * Cursor Next Line Ps Times (default = 1) (CNL).\n * Other than cursorDown (CUD) also set the cursor to first column.\n *\n * @vt: #Y CSI CNL \"Cursor Next Line\" \"CSI Ps E\" \"Move cursor `Ps` times down (default=1) and to the first column.\"\n * Same as CUD, additionally places the cursor at the first column.\n */\n public cursorNextLine(params: IParams): boolean {\n this.cursorDown(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps F\n * Cursor Previous Line Ps Times (default = 1) (CPL).\n * Other than cursorUp (CUU) also set the cursor to first column.\n *\n * @vt: #Y CSI CPL \"Cursor Backward\" \"CSI Ps F\" \"Move cursor `Ps` times up (default=1) and to the first column.\"\n * Same as CUU, additionally places the cursor at the first column.\n */\n public cursorPrecedingLine(params: IParams): boolean {\n this.cursorUp(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps G\n * Cursor Character Absolute [column] (default = [row,1]) (CHA).\n *\n * @vt: #Y CSI CHA \"Cursor Horizontal Absolute\" \"CSI Ps G\" \"Move cursor to `Ps`-th column of the active row (default=1).\"\n */\n public cursorCharAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps ; Ps H\n * Cursor Position [row;column] (default = [1,1]) (CUP).\n *\n * @vt: #Y CSI CUP \"Cursor Position\" \"CSI Ps ; Ps H\" \"Set cursor to position [`Ps`, `Ps`] (default = [1, 1]).\"\n * If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins.\n * If ORIGIN mode is not set, places the cursor to the absolute position within the viewport.\n * Note that the coordinates are 1-based, thus the top left position starts at `1 ; 1`.\n */\n public cursorPosition(params: IParams): boolean {\n this._setCursor(\n // col\n (params.length >= 2) ? (params.params[1] || 1) - 1 : 0,\n // row\n (params.params[0] || 1) - 1\n );\n return true;\n }\n\n /**\n * CSI Pm ` Character Position Absolute\n * [column] (default = [row,1]) (HPA).\n * Currently same functionality as CHA.\n *\n * @vt: #Y CSI HPA \"Horizontal Position Absolute\" \"CSI Ps ` \" \"Same as CHA.\"\n */\n public charPosAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Pm a Character Position Relative\n * [columns] (default = [row,col+1]) (HPR)\n *\n * @vt: #Y CSI HPR \"Horizontal Position Relative\" \"CSI Ps a\" \"Same as CUF.\"\n */\n public hPositionRelative(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Pm d Vertical Position Absolute (VPA)\n * [row] (default = [1,column])\n *\n * @vt: #Y CSI VPA \"Vertical Position Absolute\" \"CSI Ps d\" \"Move cursor to `Ps`-th row (default=1).\"\n */\n public linePosAbsolute(params: IParams): boolean {\n this._setCursor(this._activeBuffer.x, (params.params[0] || 1) - 1);\n return true;\n }\n\n /**\n * CSI Pm e Vertical Position Relative (VPR)\n * [rows] (default = [row+1,column])\n * reuse CSI Ps B ?\n *\n * @vt: #Y CSI VPR \"Vertical Position Relative\" \"CSI Ps e\" \"Move cursor `Ps` times down (default=1).\"\n */\n public vPositionRelative(params: IParams): boolean {\n this._moveCursor(0, params.params[0] || 1);\n return true;\n }\n\n /**\n * CSI Ps ; Ps f\n * Horizontal and Vertical Position [row;column] (default =\n * [1,1]) (HVP).\n * Same as CUP.\n *\n * @vt: #Y CSI HVP \"Horizontal and Vertical Position\" \"CSI Ps ; Ps f\" \"Same as CUP.\"\n */\n public hVPosition(params: IParams): boolean {\n this.cursorPosition(params);\n return true;\n }\n\n /**\n * CSI Ps g Tab Clear (TBC).\n * Ps = 0 -> Clear Current Column (default).\n * Ps = 3 -> Clear All.\n * Potentially:\n * Ps = 2 -> Clear Stops on Line.\n * http://vt100.net/annarbor/aaa-ug/section6.html\n *\n * @vt: #Y CSI TBC \"Tab Clear\" \"CSI Ps g\" \"Clear tab stops at current position (0) or all (3) (default=0).\"\n * Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported.\n */\n public tabClear(params: IParams): boolean {\n const param = params.params[0];\n if (param === 0) {\n delete this._activeBuffer.tabs[this._activeBuffer.x];\n } else if (param === 3) {\n this._activeBuffer.tabs = {};\n }\n return true;\n }\n\n /**\n * CSI Ps I\n * Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).\n *\n * @vt: #Y CSI CHT \"Cursor Horizontal Tabulation\" \"CSI Ps I\" \"Move cursor `Ps` times tabs forward (default=1).\"\n */\n public cursorForwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.nextStop();\n }\n return true;\n }\n\n /**\n * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).\n *\n * @vt: #Y CSI CBT \"Cursor Backward Tabulation\" \"CSI Ps Z\" \"Move cursor `Ps` tabs backward (default=1).\"\n */\n public cursorBackwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.prevStop();\n }\n return true;\n }\n\n /**\n * CSI Ps \" q Select Character Protection Attribute (DECSCA).\n *\n * @vt: #Y CSI DECSCA \"Select Character Protection Attribute\" \"CSI Ps \" q\" \"Whether DECSED and DECSEL can erase (0=default, 2) or not (1).\"\n */\n public selectProtected(params: IParams): boolean {\n const p = params.params[0];\n if (p === 1) this._curAttrData.bg |= BgFlags.PROTECTED;\n if (p === 2 || p === 0) this._curAttrData.bg &= ~BgFlags.PROTECTED;\n return true;\n }\n\n\n /**\n * Helper method to erase cells in a terminal row.\n * The cell gets replaced with the eraseChar of the terminal.\n * @param y The row index relative to the viewport.\n * @param start The start x index of the range to be erased.\n * @param end The end x index of the range to be erased (exclusive).\n * @param clearWrap clear the isWrapped flag\n * @param respectProtect Whether to respect the protection attribute (DECSCA).\n */\n private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.replaceCells(\n start,\n end,\n this._activeBuffer.getNullCell(this._eraseAttrData()),\n this._eraseAttrData(),\n respectProtect\n );\n if (clearWrap) {\n line.isWrapped = false;\n }\n }\n\n /**\n * Helper method to reset cells in a terminal row.\n * The cell gets replaced with the eraseChar of the terminal and the isWrapped property is set to false.\n * @param y row index\n */\n private _resetBufferLine(y: number, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), respectProtect);\n this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + y);\n line.isWrapped = false;\n }\n\n /**\n * CSI Ps J Erase in Display (ED).\n * Ps = 0 -> Erase Below (default).\n * Ps = 1 -> Erase Above.\n * Ps = 2 -> Erase All.\n * Ps = 3 -> Erase Saved Lines (xterm).\n * CSI ? Ps J\n * Erase in Display (DECSED).\n * Ps = 0 -> Selective Erase Below (default).\n * Ps = 1 -> Selective Erase Above.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI ED \"Erase In Display\" \"CSI Ps J\" \"Erase various parts of the viewport.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | ------------------------------------------------------------ |\n * | 0 | Erase from the cursor through the end of the viewport. |\n * | 1 | Erase from the beginning of the viewport through the cursor. |\n * | 2 | Erase complete viewport. |\n * | 3 | Erase scrollback. |\n *\n * @vt: #Y CSI DECSED \"Selective Erase In Display\" \"CSI ? Ps J\" \"Same as ED with respecting protection flag.\"\n */\n public eraseInDisplay(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n let j;\n switch (params.params[0]) {\n case 0:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n this._eraseInBufferLine(j++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n for (; j < this._bufferService.rows; j++) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(j);\n break;\n case 1:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n // Deleted front part of line and everything before. This line will no longer be wrapped.\n this._eraseInBufferLine(j, 0, this._activeBuffer.x + 1, true, respectProtect);\n if (this._activeBuffer.x + 1 >= this._bufferService.cols) {\n // Deleted entire previous line. This next line can no longer be wrapped.\n this._activeBuffer.lines.get(j + 1)!.isWrapped = false;\n }\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n break;\n case 2:\n j = this._bufferService.rows;\n this._dirtyRowTracker.markDirty(j - 1);\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n break;\n case 3:\n // Clear scrollback (everything not in viewport)\n const scrollBackSize = this._activeBuffer.lines.length - this._bufferService.rows;\n if (scrollBackSize > 0) {\n this._activeBuffer.lines.trimStart(scrollBackSize);\n this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - scrollBackSize, 0);\n this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - scrollBackSize, 0);\n // Force a scroll event to refresh viewport\n this._onScroll.fire(0);\n }\n break;\n }\n return true;\n }\n\n /**\n * CSI Ps K Erase in Line (EL).\n * Ps = 0 -> Erase to Right (default).\n * Ps = 1 -> Erase to Left.\n * Ps = 2 -> Erase All.\n * CSI ? Ps K\n * Erase in Line (DECSEL).\n * Ps = 0 -> Selective Erase to Right (default).\n * Ps = 1 -> Selective Erase to Left.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI EL \"Erase In Line\" \"CSI Ps K\" \"Erase various parts of the active row.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | -------------------------------------------------------- |\n * | 0 | Erase from the cursor through the end of the row. |\n * | 1 | Erase from the beginning of the line through the cursor. |\n * | 2 | Erase complete line. |\n *\n * @vt: #Y CSI DECSEL \"Selective Erase In Line\" \"CSI ? Ps K\" \"Same as EL with respecting protecting flag.\"\n */\n public eraseInLine(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n switch (params.params[0]) {\n case 0:\n this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n break;\n case 1:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, respectProtect);\n break;\n case 2:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, respectProtect);\n break;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps L\n * Insert Ps Line(s) (default = 1) (IL).\n *\n * @vt: #Y CSI IL \"Insert Line\" \"CSI Ps L\" \"Insert `Ps` blank lines at active row (default=1).\"\n * For every inserted line at the scroll top one line at the scroll bottom gets removed.\n * The cursor is set to the first column.\n * IL has no effect if the cursor is outside the scroll margins.\n */\n public insertLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n const scrollBottomRowsOffset = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n const scrollBottomAbsolute = this._bufferService.rows - 1 + this._activeBuffer.ybase - scrollBottomRowsOffset + 1;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1L\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(scrollBottomAbsolute - 1, 1);\n this._activeBuffer.lines.splice(row, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps M\n * Delete Ps Line(s) (default = 1) (DL).\n *\n * @vt: #Y CSI DL \"Delete Line\" \"CSI Ps M\" \"Delete `Ps` lines at active row (default=1).\"\n * For every deleted line at the scroll top one blank line at the scroll bottom gets appended.\n * The cursor is set to the first column.\n * DL has no effect if the cursor is outside the scroll margins.\n */\n public deleteLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n let j: number;\n j = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n j = this._bufferService.rows - 1 + this._activeBuffer.ybase - j;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1M\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(row, 1);\n this._activeBuffer.lines.splice(j, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps @\n * Insert Ps (Blank) Character(s) (default = 1) (ICH).\n *\n * @vt: #Y CSI ICH \"Insert Characters\" \"CSI Ps @\" \"Insert `Ps` (blank) characters (default = 1).\"\n * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the blank characters.\n * Text between the cursor and right margin moves to the right. Characters moved past the right margin are lost.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public insertChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.insertCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData()),\n this._eraseAttrData()\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps P\n * Delete Ps Character(s) (default = 1) (DCH).\n *\n * @vt: #Y CSI DCH \"Delete Character\" \"CSI Ps P\" \"Delete `Ps` characters (default=1).\"\n * As characters are deleted, the remaining characters between the cursor and right margin move to the left.\n * Character attributes move with the characters. The terminal adds blank characters at the right margin.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public deleteChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.deleteCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData()),\n this._eraseAttrData()\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps S Scroll up Ps lines (default = 1) (SU).\n *\n * @vt: #Y CSI SU \"Scroll Up\" \"CSI Ps S\" \"Scroll `Ps` lines up (default=1).\"\n *\n *\n * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm)\n */\n public scrollUp(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps T Scroll down Ps lines (default = 1) (SD).\n *\n * @vt: #Y CSI SD \"Scroll Down\" \"CSI Ps T\" \"Scroll `Ps` lines down (default=1).\"\n */\n public scrollDown(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP @ Scroll left Ps columns (default = 1) (SL) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/00\n * Parameter default value: Pn = 1\n * SL causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the left; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always left shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SL \"Scroll Left\" \"CSI Ps SP @\" \"Scroll viewport `Ps` times to the left.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the left.\n * SL has no effect outside of the scroll margins.\n */\n public scrollLeft(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP A Scroll right Ps columns (default = 1) (SR) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/01\n * Parameter default value: Pn = 1\n * SR causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the right; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always right shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SR \"Scroll Right\" \"CSI Ps SP A\" \"Scroll viewport `Ps` times to the right.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the right.\n * Content at the right margin is lost.\n * SL has no effect outside of the scroll margins.\n */\n public scrollRight(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' }\n * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.\n *\n * @vt: #Y CSI DECIC \"Insert Columns\" \"CSI Ps ' }\" \"Insert `Ps` columns at cursor position.\"\n * DECIC inserts `Ps` times blank columns at the cursor position for all lines with the scroll margins,\n * moving content to the right. Content at the right margin is lost.\n * DECIC has no effect outside the scrolling margins.\n */\n public insertColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' ~\n * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.\n *\n * @vt: #Y CSI DECDC \"Delete Columns\" \"CSI Ps ' ~\" \"Delete `Ps` columns at cursor position.\"\n * DECDC deletes `Ps` times columns at the cursor position for all lines with the scroll margins,\n * moving content to the left. Blank columns are added at the right margin.\n * DECDC has no effect outside the scrolling margins.\n */\n public deleteColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData());\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps X\n * Erase Ps Character(s) (default = 1) (ECH).\n *\n * @vt: #Y CSI ECH \"Erase Character\" \"CSI Ps X\" \"Erase `Ps` characters from current cursor position to the right (default=1).\"\n * ED erases `Ps` characters from current cursor position to the right.\n * ED works inside or outside the scrolling margins.\n */\n public eraseChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.replaceCells(\n this._activeBuffer.x,\n this._activeBuffer.x + (params.params[0] || 1),\n this._activeBuffer.getNullCell(this._eraseAttrData()),\n this._eraseAttrData()\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps b Repeat the preceding graphic character Ps times (REP).\n * From ECMA 48 (@see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf)\n * Notation: (Pn)\n * Representation: CSI Pn 06/02\n * Parameter default value: Pn = 1\n * REP is used to indicate that the preceding character in the data stream,\n * if it is a graphic character (represented by one or more bit combinations) including SPACE,\n * is to be repeated n times, where n equals the value of Pn.\n * If the character preceding REP is a control function or part of a control function,\n * the effect of REP is not defined by this Standard.\n *\n * Since we propagate the terminal as xterm-256color we have to follow xterm's behavior:\n * - fullwidth + surrogate chars are ignored\n * - for combining chars only the base char gets repeated\n * - text attrs are applied normally\n * - wrap around is respected\n * - any valid sequence resets the carried forward char\n *\n * Note: To get reset on a valid sequence working correctly without much runtime penalty,\n * the preceding codepoint is stored on the parser in `this.print` and reset during `parser.parse`.\n *\n * @vt: #Y CSI REP \"Repeat Preceding Character\" \"CSI Ps b\" \"Repeat preceding character `Ps` times (default=1).\"\n * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is set.\n * REP has no effect if the sequence does not follow a printable ASCII character\n * (NOOP for any other sequence in between or NON ASCII characters).\n */\n public repeatPrecedingCharacter(params: IParams): boolean {\n if (!this._parser.precedingCodepoint) {\n return true;\n }\n // call print to insert the chars and handle correct wrapping\n const length = params.params[0] || 1;\n const data = new Uint32Array(length);\n for (let i = 0; i < length; ++i) {\n data[i] = this._parser.precedingCodepoint;\n }\n this.print(data, 0, data.length);\n return true;\n }\n\n /**\n * CSI Ps c Send Device Attributes (Primary DA).\n * Ps = 0 or omitted -> request attributes from terminal. The\n * response depends on the decTerminalID resource setting.\n * -> CSI ? 1 ; 2 c (``VT100 with Advanced Video Option'')\n * -> CSI ? 1 ; 0 c (``VT101 with No Options'')\n * -> CSI ? 6 c (``VT102'')\n * -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'')\n * The VT100-style response parameters do not mean anything by\n * themselves. VT220 parameters do, telling the host what fea-\n * tures the terminal supports:\n * Ps = 1 -> 132-columns.\n * Ps = 2 -> Printer.\n * Ps = 6 -> Selective erase.\n * Ps = 8 -> User-defined keys.\n * Ps = 9 -> National replacement character sets.\n * Ps = 1 5 -> Technical characters.\n * Ps = 2 2 -> ANSI color, e.g., VT525.\n * Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode).\n *\n * @vt: #Y CSI DA1 \"Primary Device Attributes\" \"CSI c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesPrimary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n if (this._is('xterm') || this._is('rxvt-unicode') || this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?1;2c');\n } else if (this._is('linux')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?6c');\n }\n return true;\n }\n\n /**\n * CSI > Ps c\n * Send Device Attributes (Secondary DA).\n * Ps = 0 or omitted -> request the terminal's identification\n * code. The response depends on the decTerminalID resource set-\n * ting. It should apply only to VT220 and up, but xterm extends\n * this to VT100.\n * -> CSI > Pp ; Pv ; Pc c\n * where Pp denotes the terminal type\n * Pp = 0 -> ``VT100''.\n * Pp = 1 -> ``VT220''.\n * and Pv is the firmware version (for xterm, this was originally\n * the XFree86 patch number, starting with 95). In a DEC termi-\n * nal, Pc indicates the ROM cartridge registration number and is\n * always zero.\n * More information:\n * xterm/charproc.c - line 2012, for more information.\n * vim responds with ^[[?0c or ^[[?1c after the terminal's response (?)\n *\n * @vt: #Y CSI DA2 \"Secondary Device Attributes\" \"CSI > c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesSecondary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n // xterm and urxvt\n // seem to spit this\n // out around ~370 times (?).\n if (this._is('xterm')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>0;276;0c');\n } else if (this._is('rxvt-unicode')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>85;95;0c');\n } else if (this._is('linux')) {\n // not supported by linux console.\n // linux console echoes parameters.\n this._coreService.triggerDataEvent(params.params[0] + 'c');\n } else if (this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>83;40003;0c');\n }\n return true;\n }\n\n /**\n * Evaluate if the current terminal is the given argument.\n * @param term The terminal name to evaluate\n */\n private _is(term: string): boolean {\n return (this._optionsService.rawOptions.termName + '').indexOf(term) === 0;\n }\n\n /**\n * CSI Pm h Set Mode (SM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Insert Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Automatic Newline (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI SM \"Set Mode\" \"CSI Pm h\" \"Set various terminal modes.\"\n * Supported param values by SM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Insert Mode (IRM). | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Automatic Newline (LNM). | #Y |\n */\n public setMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = true;\n break;\n case 20:\n this._optionsService.options.convertEol = true;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm h\n * DEC Private Mode Set (DECSET).\n * Ps = 1 -> Application Cursor Keys (DECCKM).\n * Ps = 2 -> Designate USASCII for character sets G0-G3\n * (DECANM), and set VT100 mode.\n * Ps = 3 -> 132 Column Mode (DECCOLM).\n * Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).\n * Ps = 5 -> Reverse Video (DECSCNM).\n * Ps = 6 -> Origin Mode (DECOM).\n * Ps = 7 -> Wraparound Mode (DECAWM).\n * Ps = 8 -> Auto-repeat Keys (DECARM).\n * Ps = 9 -> Send Mouse X & Y on button press. See the sec-\n * tion Mouse Tracking.\n * Ps = 1 0 -> Show toolbar (rxvt).\n * Ps = 1 2 -> Start Blinking Cursor (att610).\n * Ps = 1 8 -> Print form feed (DECPFF).\n * Ps = 1 9 -> Set print extent to full screen (DECPEX).\n * Ps = 2 5 -> Show Cursor (DECTCEM).\n * Ps = 3 0 -> Show scrollbar (rxvt).\n * Ps = 3 5 -> Enable font-shifting functions (rxvt).\n * Ps = 3 8 -> Enter Tektronix Mode (DECTEK).\n * Ps = 4 0 -> Allow 80 -> 132 Mode.\n * Ps = 4 1 -> more(1) fix (see curses resource).\n * Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-\n * RCM).\n * Ps = 4 4 -> Turn On Margin Bell.\n * Ps = 4 5 -> Reverse-wraparound Mode.\n * Ps = 4 6 -> Start Logging. This is normally disabled by a\n * compile-time option.\n * Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 6 6 -> Application keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends backspace (DECBKM).\n * Ps = 1 0 0 0 -> Send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Enable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).\n * Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Interpret \"meta\" key, sets eighth bit.\n * (enables the eightBitInput resource).\n * Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-\n * Lock keys. (This enables the numLock resource).\n * Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This\n * enables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete\n * key.\n * Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This\n * enables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Keep selection even if not highlighted.\n * (This enables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Enable Urgency window manager hint when\n * Control-G is received. (This enables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Enable raising of the window when Control-G\n * is received. (enables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate\n * Screen Buffer, clearing it first. (This may be disabled by\n * the titeInhibit resource). This combines the effects of the 1\n * 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based\n * applications rather than the 4 7 mode.\n * Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Set Sun function-key mode.\n * Ps = 1 0 5 2 -> Set HP function-key mode.\n * Ps = 1 0 5 3 -> Set SCO function-key mode.\n * Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Set VT220 keyboard emulation.\n * Ps = 2 0 0 4 -> Set bracketed paste mode.\n * Modes:\n * http: *vt100.net/docs/vt220-rm/chapter4.html\n *\n * @vt: #P[See below for supported modes.] CSI DECSET \"DEC Private Set Mode\" \"CSI ? Pm h\" \"Set various terminal attributes.\"\n * Supported param values by DECSET:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | --------|\n * | 1 | Application Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | #Y |\n * | 3 | 132 Column Mode (DECCOLM). | #Y |\n * | 6 | Origin Mode (DECOM). | #Y |\n * | 7 | Auto-wrap Mode (DECAWM). | #Y |\n * | 8 | Auto-repeat Keys (DECARM). Always on. | #N |\n * | 9 | X10 xterm mouse protocol. | #Y |\n * | 12 | Start Blinking Cursor. | #Y |\n * | 25 | Show Cursor (DECTCEM). | #Y |\n * | 45 | Reverse wrap-around. | #Y |\n * | 47 | Use Alternate Screen Buffer. | #Y |\n * | 66 | Application keypad (DECNKM). | #Y |\n * | 1000 | X11 xterm mouse protocol. | #Y |\n * | 1002 | Use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Use All Motion Mouse Tracking. | #Y |\n * | 1004 | Send FocusIn/FocusOut events | #Y |\n * | 1005 | Enable UTF-8 Mouse Mode. | #N |\n * | 1006 | Enable SGR Mouse Mode. | #Y |\n * | 1015 | Enable urxvt Mouse Mode. | #N |\n * | 1016 | Enable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Alternate Screen Buffer. | #Y |\n * | 1048 | Save cursor as in DECSC. | #Y |\n * | 1049 | Save cursor and switch to alternate buffer clearing it. | #P[Does not clear the alternate buffer.] |\n * | 2004 | Set bracketed paste mode. | #Y |\n *\n *\n * FIXME: implement DECSCNM, 1049 should clear altbuffer\n */\n public setModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = true;\n break;\n case 2:\n this._charsetService.setgCharset(0, DEFAULT_CHARSET);\n this._charsetService.setgCharset(1, DEFAULT_CHARSET);\n this._charsetService.setgCharset(2, DEFAULT_CHARSET);\n this._charsetService.setgCharset(3, DEFAULT_CHARSET);\n // set VT100 mode here\n break;\n case 3:\n /**\n * DECCOLM - 132 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(132, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = true;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = true;\n break;\n case 12:\n this._optionsService.options.cursorBlink = true;\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = true;\n break;\n case 66:\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n // no release, no motion, no wheel, no modifiers.\n this._coreMouseService.activeProtocol = 'X10';\n break;\n case 1000: // vt200 mouse\n // no motion.\n this._coreMouseService.activeProtocol = 'VT200';\n break;\n case 1002: // button event mouse\n this._coreMouseService.activeProtocol = 'DRAG';\n break;\n case 1003: // any event mouse\n // any event - sends motion events,\n // even if there is no button held down.\n this._coreMouseService.activeProtocol = 'ANY';\n break;\n case 1004: // send focusin/focusout events\n // focusin: ^[[I\n // focusout: ^[[O\n this._coreService.decPrivateModes.sendFocus = true;\n this._onRequestSendFocus.fire();\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'SGR';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'SGR_PIXELS';\n break;\n case 25: // show cursor\n this._coreService.isCursorHidden = false;\n break;\n case 1048: // alt screen cursor\n this.saveCursor();\n break;\n case 1049: // alt screen buffer cursor\n this.saveCursor();\n // FALL-THROUGH\n case 47: // alt screen buffer\n case 1047: // alt screen buffer\n this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = true;\n break;\n }\n }\n return true;\n }\n\n\n /**\n * CSI Pm l Reset Mode (RM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Replace Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Normal Linefeed (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI RM \"Reset Mode\" \"CSI Pm l\" \"Set various terminal attributes.\"\n * Supported param values by RM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Replace Mode (IRM). (default) | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Normal Linefeed (LNM). | #Y |\n *\n *\n * FIXME: why is LNM commented out?\n */\n public resetMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = false;\n break;\n case 20:\n this._optionsService.options.convertEol = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm l\n * DEC Private Mode Reset (DECRST).\n * Ps = 1 -> Normal Cursor Keys (DECCKM).\n * Ps = 2 -> Designate VT52 mode (DECANM).\n * Ps = 3 -> 80 Column Mode (DECCOLM).\n * Ps = 4 -> Jump (Fast) Scroll (DECSCLM).\n * Ps = 5 -> Normal Video (DECSCNM).\n * Ps = 6 -> Normal Cursor Mode (DECOM).\n * Ps = 7 -> No Wraparound Mode (DECAWM).\n * Ps = 8 -> No Auto-repeat Keys (DECARM).\n * Ps = 9 -> Don't send Mouse X & Y on button press.\n * Ps = 1 0 -> Hide toolbar (rxvt).\n * Ps = 1 2 -> Stop Blinking Cursor (att610).\n * Ps = 1 8 -> Don't print form feed (DECPFF).\n * Ps = 1 9 -> Limit print to scrolling region (DECPEX).\n * Ps = 2 5 -> Hide Cursor (DECTCEM).\n * Ps = 3 0 -> Don't show scrollbar (rxvt).\n * Ps = 3 5 -> Disable font-shifting functions (rxvt).\n * Ps = 4 0 -> Disallow 80 -> 132 Mode.\n * Ps = 4 1 -> No more(1) fix (see curses resource).\n * Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-\n * NRCM).\n * Ps = 4 4 -> Turn Off Margin Bell.\n * Ps = 4 5 -> No Reverse-wraparound Mode.\n * Ps = 4 6 -> Stop Logging. (This is normally disabled by a\n * compile-time option).\n * Ps = 4 7 -> Use Normal Screen Buffer.\n * Ps = 6 6 -> Numeric keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends delete (DECBKM).\n * Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Disable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Don't scroll to bottom on tty output\n * (rxvt).\n * Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Don't interpret \"meta\" key. (This disables\n * the eightBitInput resource).\n * Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-\n * Lock keys. (This disables the numLock resource).\n * Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key.\n * (This disables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad\n * Delete key.\n * Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key.\n * (This disables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Do not keep selection when not highlighted.\n * (This disables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the PRIMARY selection. (This disables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Disable Urgency window manager hint when\n * Control-G is received. (This disables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Disable raising of the window when Control-\n * G is received. (This disables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen\n * first if in the Alternate Screen. (This may be disabled by\n * the titeInhibit resource).\n * Ps = 1 0 4 8 -> Restore cursor as in DECRC. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor\n * as in DECRC. (This may be disabled by the titeInhibit\n * resource). This combines the effects of the 1 0 4 7 and 1 0\n * 4 8 modes. Use this with terminfo-based applications rather\n * than the 4 7 mode.\n * Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Reset Sun function-key mode.\n * Ps = 1 0 5 2 -> Reset HP function-key mode.\n * Ps = 1 0 5 3 -> Reset SCO function-key mode.\n * Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.\n * Ps = 2 0 0 4 -> Reset bracketed paste mode.\n *\n * @vt: #P[See below for supported modes.] CSI DECRST \"DEC Private Reset Mode\" \"CSI ? Pm l\" \"Reset various terminal attributes.\"\n * Supported param values by DECRST:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | ------- |\n * | 1 | Normal Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate VT52 mode (DECANM). | #N |\n * | 3 | 80 Column Mode (DECCOLM). | #B[Switches to old column width instead of 80.] |\n * | 6 | Normal Cursor Mode (DECOM). | #Y |\n * | 7 | No Wraparound Mode (DECAWM). | #Y |\n * | 8 | No Auto-repeat Keys (DECARM). | #N |\n * | 9 | Don't send Mouse X & Y on button press. | #Y |\n * | 12 | Stop Blinking Cursor. | #Y |\n * | 25 | Hide Cursor (DECTCEM). | #Y |\n * | 45 | No reverse wrap-around. | #Y |\n * | 47 | Use Normal Screen Buffer. | #Y |\n * | 66 | Numeric keypad (DECNKM). | #Y |\n * | 1000 | Don't send Mouse reports. | #Y |\n * | 1002 | Don't use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Don't use All Motion Mouse Tracking. | #Y |\n * | 1004 | Don't send FocusIn/FocusOut events. | #Y |\n * | 1005 | Disable UTF-8 Mouse Mode. | #N |\n * | 1006 | Disable SGR Mouse Mode. | #Y |\n * | 1015 | Disable urxvt Mouse Mode. | #N |\n * | 1016 | Disable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | #Y |\n * | 1048 | Restore cursor as in DECRC. | #Y |\n * | 1049 | Use Normal Screen Buffer and restore cursor. | #Y |\n * | 2004 | Reset bracketed paste mode. | #Y |\n *\n *\n * FIXME: DECCOLM is currently broken (already fixed in window options PR)\n */\n public resetModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = false;\n break;\n case 3:\n /**\n * DECCOLM - 80 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(80, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = false;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = false;\n break;\n case 12:\n this._optionsService.options.cursorBlink = false;\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = false;\n break;\n case 66:\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n case 1000: // vt200 mouse\n case 1002: // button event mouse\n case 1003: // any event mouse\n this._coreMouseService.activeProtocol = 'NONE';\n break;\n case 1004: // send focusin/focusout events\n this._coreService.decPrivateModes.sendFocus = false;\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 25: // hide cursor\n this._coreService.isCursorHidden = true;\n break;\n case 1048: // alt screen cursor\n this.restoreCursor();\n break;\n case 1049: // alt screen buffer cursor\n // FALL-THROUGH\n case 47: // normal screen buffer\n case 1047: // normal screen buffer - clearing it first\n // Ensure the selection manager has the correct buffer\n this._bufferService.buffers.activateNormalBuffer();\n if (params.params[i] === 1049) {\n this.restoreCursor();\n }\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI Ps $ p Request ANSI Mode (DECRQM).\n *\n * Reports CSI Ps; Pm $ y (DECRPM), where Ps is the mode number as in SM/RM,\n * and Pm is the mode value:\n * 0 - not recognized\n * 1 - set\n * 2 - reset\n * 3 - permanently set\n * 4 - permanently reset\n *\n * @vt: #Y CSI DECRQM \"Request Mode\" \"CSI Ps $p\" \"Request mode state.\"\n * Returns a report as `CSI Ps; Pm $ y` (DECRPM), where `Ps` is the mode number as in SM/RM\n * or DECSET/DECRST, and `Pm` is the mode value:\n * - 0: not recognized\n * - 1: set\n * - 2: reset\n * - 3: permanently set\n * - 4: permanently reset\n *\n * For modes not understood xterm.js always returns `notRecognized`. In general this means,\n * that a certain operation mode is not implemented and cannot be used.\n *\n * Modes changing the active terminal buffer (47, 1047, 1049) are not subqueried\n * and only report, whether the alternate buffer is set.\n *\n * Mouse encodings and mouse protocols are handled mutual exclusive,\n * thus only one of each of those can be set at a given time.\n *\n * There is a chance, that some mode reports are not fully in line with xterm.js' behavior,\n * e.g. if the default implementation already exposes a certain behavior. If you find\n * discrepancies in the mode reports, please file a bug.\n */\n public requestMode(params: IParams, ansi: boolean): boolean {\n // return value as in DECRPM\n const enum V {\n NOT_RECOGNIZED = 0,\n SET = 1,\n RESET = 2,\n PERMANENTLY_SET = 3,\n PERMANENTLY_RESET = 4\n }\n\n // access helpers\n const dm = this._coreService.decPrivateModes;\n const { activeProtocol: mouseProtocol, activeEncoding: mouseEncoding } = this._coreMouseService;\n const cs = this._coreService;\n const { buffers, cols } = this._bufferService;\n const { active, alt } = buffers;\n const opts = this._optionsService.rawOptions;\n\n const f = (m: number, v: V): boolean => {\n cs.triggerDataEvent(`${C0.ESC}[${ansi ? '' : '?'}${m};${v}$y`);\n return true;\n };\n const b2v = (value: boolean): V => value ? V.SET : V.RESET;\n\n const p = params.params[0];\n\n if (ansi) {\n if (p === 2) return f(p, V.PERMANENTLY_SET);\n if (p === 4) return f(p, b2v(cs.modes.insertMode));\n if (p === 12) return f(p, V.PERMANENTLY_RESET);\n if (p === 20) return f(p, b2v(opts.convertEol));\n return f(p, V.NOT_RECOGNIZED);\n }\n\n if (p === 1) return f(p, b2v(dm.applicationCursorKeys));\n if (p === 3) return f(p, opts.windowOptions.setWinLines ? (cols === 80 ? V.RESET : cols === 132 ? V.SET : V.NOT_RECOGNIZED) : V.NOT_RECOGNIZED);\n if (p === 6) return f(p, b2v(dm.origin));\n if (p === 7) return f(p, b2v(dm.wraparound));\n if (p === 8) return f(p, V.PERMANENTLY_SET);\n if (p === 9) return f(p, b2v(mouseProtocol === 'X10'));\n if (p === 12) return f(p, b2v(opts.cursorBlink));\n if (p === 25) return f(p, b2v(!cs.isCursorHidden));\n if (p === 45) return f(p, b2v(dm.reverseWraparound));\n if (p === 66) return f(p, b2v(dm.applicationKeypad));\n if (p === 1000) return f(p, b2v(mouseProtocol === 'VT200'));\n if (p === 1002) return f(p, b2v(mouseProtocol === 'DRAG'));\n if (p === 1003) return f(p, b2v(mouseProtocol === 'ANY'));\n if (p === 1004) return f(p, b2v(dm.sendFocus));\n if (p === 1005) return f(p, V.PERMANENTLY_RESET);\n if (p === 1006) return f(p, b2v(mouseEncoding === 'SGR'));\n if (p === 1015) return f(p, V.PERMANENTLY_RESET);\n if (p === 1016) return f(p, b2v(mouseEncoding === 'SGR_PIXELS'));\n if (p === 1048) return f(p, V.SET); // xterm always returns SET here\n if (p === 47 || p === 1047 || p === 1049) return f(p, b2v(active === alt));\n if (p === 2004) return f(p, b2v(dm.bracketedPasteMode));\n return f(p, V.NOT_RECOGNIZED);\n }\n\n /**\n * Helper to write color information packed with color mode.\n */\n private _updateAttrColor(color: number, mode: number, c1: number, c2: number, c3: number): number {\n if (mode === 2) {\n color |= Attributes.CM_RGB;\n color &= ~Attributes.RGB_MASK;\n color |= AttributeData.fromColorRGB([c1, c2, c3]);\n } else if (mode === 5) {\n color &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n color |= Attributes.CM_P256 | (c1 & 0xff);\n }\n return color;\n }\n\n /**\n * Helper to extract and apply color params/subparams.\n * Returns advance for params index.\n */\n private _extractColor(params: IParams, pos: number, attr: IAttributeData): number {\n // normalize params\n // meaning: [target, CM, ign, val, val, val]\n // RGB : [ 38/48, 2, ign, r, g, b]\n // P256 : [ 38/48, 5, ign, v, ign, ign]\n const accu = [0, 0, -1, 0, 0, 0];\n\n // alignment placeholder for non color space sequences\n let cSpace = 0;\n\n // return advance we took in params\n let advance = 0;\n\n do {\n accu[advance + cSpace] = params.params[pos + advance];\n if (params.hasSubParams(pos + advance)) {\n const subparams = params.getSubParams(pos + advance)!;\n let i = 0;\n do {\n if (accu[1] === 5) {\n cSpace = 1;\n }\n accu[advance + i + 1 + cSpace] = subparams[i];\n } while (++i < subparams.length && i + advance + 1 + cSpace < accu.length);\n break;\n }\n // exit early if can decide color mode with semicolons\n if ((accu[1] === 5 && advance + cSpace >= 2)\n || (accu[1] === 2 && advance + cSpace >= 5)) {\n break;\n }\n // offset colorSpace slot for semicolon mode\n if (accu[1]) {\n cSpace = 1;\n }\n } while (++advance + pos < params.length && advance + cSpace < accu.length);\n\n // set default values to 0\n for (let i = 2; i < accu.length; ++i) {\n if (accu[i] === -1) {\n accu[i] = 0;\n }\n }\n\n // apply colors\n switch (accu[0]) {\n case 38:\n attr.fg = this._updateAttrColor(attr.fg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 48:\n attr.bg = this._updateAttrColor(attr.bg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 58:\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = this._updateAttrColor(attr.extended.underlineColor, accu[1], accu[3], accu[4], accu[5]);\n }\n\n return advance;\n }\n\n /**\n * SGR 4 subparams:\n * 4:0 - equal to SGR 24 (turn off all underline)\n * 4:1 - equal to SGR 4 (single underline)\n * 4:2 - equal to SGR 21 (double underline)\n * 4:3 - curly underline\n * 4:4 - dotted underline\n * 4:5 - dashed underline\n */\n private _processUnderline(style: number, attr: IAttributeData): void {\n // treat extended attrs as immutable, thus always clone from old one\n // this is needed since the buffer only holds references to it\n attr.extended = attr.extended.clone();\n\n // default to 1 == single underline\n if (!~style || style > 5) {\n style = 1;\n }\n attr.extended.underlineStyle = style;\n attr.fg |= FgFlags.UNDERLINE;\n\n // 0 deactivates underline\n if (style === 0) {\n attr.fg &= ~FgFlags.UNDERLINE;\n }\n\n // update HAS_EXTENDED in BG\n attr.updateExtended();\n }\n\n private _processSGR0(attr: IAttributeData): void {\n attr.fg = DEFAULT_ATTR_DATA.fg;\n attr.bg = DEFAULT_ATTR_DATA.bg;\n attr.extended = attr.extended.clone();\n // Reset underline style and color. Note that we don't want to reset other\n // fields such as the url id.\n attr.extended.underlineStyle = UnderlineStyle.NONE;\n attr.extended.underlineColor &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.updateExtended();\n }\n\n /**\n * CSI Pm m Character Attributes (SGR).\n *\n * @vt: #P[See below for supported attributes.] CSI SGR \"Select Graphic Rendition\" \"CSI Pm m\" \"Set/Reset various text attributes.\"\n * SGR selects one or more character attributes at the same time. Multiple params (up to 32)\n * are applied in order from left to right. The changed attributes are applied to all new\n * characters received. If you move characters in the viewport by scrolling or any other means,\n * then the attributes move with the characters.\n *\n * Supported param values by SGR:\n *\n * | Param | Meaning | Support |\n * | --------- | -------------------------------------------------------- | ------- |\n * | 0 | Normal (default). Resets any other preceding SGR. | #Y |\n * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | #Y |\n * | 2 | Faint, decreased intensity. | #Y |\n * | 3 | Italic. | #Y |\n * | 4 | Underlined (see below for style support). | #Y |\n * | 5 | Slowly blinking. | #N |\n * | 6 | Rapidly blinking. | #N |\n * | 7 | Inverse. Flips foreground and background color. | #Y |\n * | 8 | Invisible (hidden). | #Y |\n * | 9 | Crossed-out characters (strikethrough). | #Y |\n * | 21 | Doubly underlined. | #Y |\n * | 22 | Normal (neither bold nor faint). | #Y |\n * | 23 | No italic. | #Y |\n * | 24 | Not underlined. | #Y |\n * | 25 | Steady (not blinking). | #Y |\n * | 27 | Positive (not inverse). | #Y |\n * | 28 | Visible (not hidden). | #Y |\n * | 29 | Not Crossed-out (strikethrough). | #Y |\n * | 30 | Foreground color: Black. | #Y |\n * | 31 | Foreground color: Red. | #Y |\n * | 32 | Foreground color: Green. | #Y |\n * | 33 | Foreground color: Yellow. | #Y |\n * | 34 | Foreground color: Blue. | #Y |\n * | 35 | Foreground color: Magenta. | #Y |\n * | 36 | Foreground color: Cyan. | #Y |\n * | 37 | Foreground color: White. | #Y |\n * | 38 | Foreground color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 39 | Foreground color: Default (original). | #Y |\n * | 40 | Background color: Black. | #Y |\n * | 41 | Background color: Red. | #Y |\n * | 42 | Background color: Green. | #Y |\n * | 43 | Background color: Yellow. | #Y |\n * | 44 | Background color: Blue. | #Y |\n * | 45 | Background color: Magenta. | #Y |\n * | 46 | Background color: Cyan. | #Y |\n * | 47 | Background color: White. | #Y |\n * | 48 | Background color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 49 | Background color: Default (original). | #Y |\n * | 58 | Underline color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y |\n * | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y |\n *\n * Underline supports subparams to denote the style in the form `4 : x`:\n *\n * | x | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | No underline. Same as `SGR 24 m`. | #Y |\n * | 1 | Single underline. Same as `SGR 4 m`. | #Y |\n * | 2 | Double underline. | #Y |\n * | 3 | Curly underline. | #Y |\n * | 4 | Dotted underline. | #Y |\n * | 5 | Dashed underline. | #Y |\n * | other | Single underline. Same as `SGR 4 m`. | #Y |\n *\n * Extended colors are supported for foreground (Ps=38), background (Ps=48) and underline (Ps=58) as follows:\n *\n * | Ps + 1 | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | Implementation defined. | #N |\n * | 1 | Transparent. | #N |\n * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | #Y |\n * | 3 | CMY color. | #N |\n * | 4 | CMYK color. | #N |\n * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | #Y |\n *\n *\n * FIXME: blinking is implemented in attrs, but not working in renderers?\n * FIXME: remove dead branch for p=100\n */\n public charAttributes(params: IParams): boolean {\n // Optimize a single SGR0.\n if (params.length === 1 && params.params[0] === 0) {\n this._processSGR0(this._curAttrData);\n return true;\n }\n\n const l = params.length;\n let p;\n const attr = this._curAttrData;\n\n for (let i = 0; i < l; i++) {\n p = params.params[i];\n if (p >= 30 && p <= 37) {\n // fg color 8\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 30);\n } else if (p >= 40 && p <= 47) {\n // bg color 8\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 40);\n } else if (p >= 90 && p <= 97) {\n // fg color 16\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 90) | 8;\n } else if (p >= 100 && p <= 107) {\n // bg color 16\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 100) | 8;\n } else if (p === 0) {\n // default\n this._processSGR0(attr);\n } else if (p === 1) {\n // bold text\n attr.fg |= FgFlags.BOLD;\n } else if (p === 3) {\n // italic text\n attr.bg |= BgFlags.ITALIC;\n } else if (p === 4) {\n // underlined text\n attr.fg |= FgFlags.UNDERLINE;\n this._processUnderline(params.hasSubParams(i) ? params.getSubParams(i)![0] : UnderlineStyle.SINGLE, attr);\n } else if (p === 5) {\n // blink\n attr.fg |= FgFlags.BLINK;\n } else if (p === 7) {\n // inverse and positive\n // test with: echo -e '\\e[31m\\e[42mhello\\e[7mworld\\e[27mhi\\e[m'\n attr.fg |= FgFlags.INVERSE;\n } else if (p === 8) {\n // invisible\n attr.fg |= FgFlags.INVISIBLE;\n } else if (p === 9) {\n // strikethrough\n attr.fg |= FgFlags.STRIKETHROUGH;\n } else if (p === 2) {\n // dimmed text\n attr.bg |= BgFlags.DIM;\n } else if (p === 21) {\n // double underline\n this._processUnderline(UnderlineStyle.DOUBLE, attr);\n } else if (p === 22) {\n // not bold nor faint\n attr.fg &= ~FgFlags.BOLD;\n attr.bg &= ~BgFlags.DIM;\n } else if (p === 23) {\n // not italic\n attr.bg &= ~BgFlags.ITALIC;\n } else if (p === 24) {\n // not underlined\n attr.fg &= ~FgFlags.UNDERLINE;\n this._processUnderline(UnderlineStyle.NONE, attr);\n } else if (p === 25) {\n // not blink\n attr.fg &= ~FgFlags.BLINK;\n } else if (p === 27) {\n // not inverse\n attr.fg &= ~FgFlags.INVERSE;\n } else if (p === 28) {\n // not invisible\n attr.fg &= ~FgFlags.INVISIBLE;\n } else if (p === 29) {\n // not strikethrough\n attr.fg &= ~FgFlags.STRIKETHROUGH;\n } else if (p === 39) {\n // reset fg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 49) {\n // reset bg\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 38 || p === 48 || p === 58) {\n // fg color 256 and RGB\n i += this._extractColor(params, i, attr);\n } else if (p === 59) {\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = -1;\n attr.updateExtended();\n } else if (p === 100) { // FIXME: dead branch, p=100 already handled above!\n // reset fg/bg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else {\n this._logService.debug('Unknown SGR attribute: %d.', p);\n }\n }\n return true;\n }\n\n /**\n * CSI Ps n Device Status Report (DSR).\n * Ps = 5 -> Status Report. Result (``OK'') is\n * CSI 0 n\n * Ps = 6 -> Report Cursor Position (CPR) [row;column].\n * Result is\n * CSI r ; c R\n * CSI ? Ps n\n * Device Status Report (DSR, DEC-specific).\n * Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI\n * ? r ; c R (assumes page is zero).\n * Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).\n * or CSI ? 1 1 n (not ready).\n * Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)\n * or CSI ? 2 1 n (locked).\n * Ps = 2 6 -> Report Keyboard status as\n * CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).\n * The last two parameters apply to VT400 & up, and denote key-\n * board ready and LK01 respectively.\n * Ps = 5 3 -> Report Locator status as\n * CSI ? 5 3 n Locator available, if compiled-in, or\n * CSI ? 5 0 n No Locator, if not.\n *\n * @vt: #Y CSI DSR \"Device Status Report\" \"CSI Ps n\" \"Request cursor position (CPR) with `Ps` = 6.\"\n */\n public deviceStatus(params: IParams): boolean {\n switch (params.params[0]) {\n case 5:\n // status report\n this._coreService.triggerDataEvent(`${C0.ESC}[0n`);\n break;\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[${y};${x}R`);\n break;\n }\n return true;\n }\n\n // @vt: #P[Only CPR is supported.] CSI DECDSR \"DEC Device Status Report\" \"CSI ? Ps n\" \"Only CPR is supported (same as DSR).\"\n public deviceStatusPrivate(params: IParams): boolean {\n // modern xterm doesnt seem to\n // respond to any of these except ?6, 6, and 5\n switch (params.params[0]) {\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[?${y};${x}R`);\n break;\n case 15:\n // no printer\n // this.handler(C0.ESC + '[?11n');\n break;\n case 25:\n // dont support user defined keys\n // this.handler(C0.ESC + '[?21n');\n break;\n case 26:\n // north american keyboard\n // this.handler(C0.ESC + '[?27;1;0;0n');\n break;\n case 53:\n // no dec locator/mouse\n // this.handler(C0.ESC + '[?50n');\n break;\n }\n return true;\n }\n\n /**\n * CSI ! p Soft terminal reset (DECSTR).\n * http://vt100.net/docs/vt220-rm/table4-10.html\n *\n * @vt: #Y CSI DECSTR \"Soft Terminal Reset\" \"CSI ! p\" \"Reset several terminal attributes to initial state.\"\n * There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full terminal bootstrap,\n * DECSTR only resets certain attributes. For most needs DECSTR should be sufficient.\n *\n * The following terminal attributes are reset to default values:\n * - IRM is reset (dafault = false)\n * - scroll margins are reset (default = viewport size)\n * - erase attributes are reset to default\n * - charsets are reset\n * - DECSC data is reset to initial values\n * - DECOM is reset to absolute mode\n *\n *\n * FIXME: there are several more attributes missing (see VT520 manual)\n */\n public softReset(params: IParams): boolean {\n this._coreService.isCursorHidden = false;\n this._onRequestSyncScrollBar.fire();\n this._activeBuffer.scrollTop = 0;\n this._activeBuffer.scrollBottom = this._bufferService.rows - 1;\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._coreService.reset();\n this._charsetService.reset();\n\n // reset DECSC data\n this._activeBuffer.savedX = 0;\n this._activeBuffer.savedY = this._activeBuffer.ybase;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n\n // reset DECOM\n this._coreService.decPrivateModes.origin = false;\n return true;\n }\n\n /**\n * CSI Ps SP q Set cursor style (DECSCUSR, VT520).\n * Ps = 0 -> blinking block.\n * Ps = 1 -> blinking block (default).\n * Ps = 2 -> steady block.\n * Ps = 3 -> blinking underline.\n * Ps = 4 -> steady underline.\n * Ps = 5 -> blinking bar (xterm).\n * Ps = 6 -> steady bar (xterm).\n *\n * @vt: #Y CSI DECSCUSR \"Set Cursor Style\" \"CSI Ps SP q\" \"Set cursor style.\"\n * Supported cursor styles:\n * - empty, 0 or 1: steady block\n * - 2: blink block\n * - 3: steady underline\n * - 4: blink underline\n * - 5: steady bar\n * - 6: blink bar\n */\n public setCursorStyle(params: IParams): boolean {\n const param = params.params[0] || 1;\n switch (param) {\n case 1:\n case 2:\n this._optionsService.options.cursorStyle = 'block';\n break;\n case 3:\n case 4:\n this._optionsService.options.cursorStyle = 'underline';\n break;\n case 5:\n case 6:\n this._optionsService.options.cursorStyle = 'bar';\n break;\n }\n const isBlinking = param % 2 === 1;\n this._optionsService.options.cursorBlink = isBlinking;\n return true;\n }\n\n /**\n * CSI Ps ; Ps r\n * Set Scrolling Region [top;bottom] (default = full size of win-\n * dow) (DECSTBM).\n *\n * @vt: #Y CSI DECSTBM \"Set Top and Bottom Margin\" \"CSI Ps ; Ps r\" \"Set top and bottom margins of the viewport [top;bottom] (default = viewport size).\"\n */\n public setScrollRegion(params: IParams): boolean {\n const top = params.params[0] || 1;\n let bottom: number;\n\n if (params.length < 2 || (bottom = params.params[1]) > this._bufferService.rows || bottom === 0) {\n bottom = this._bufferService.rows;\n }\n\n if (bottom > top) {\n this._activeBuffer.scrollTop = top - 1;\n this._activeBuffer.scrollBottom = bottom - 1;\n this._setCursor(0, 0);\n }\n return true;\n }\n\n /**\n * CSI Ps ; Ps ; Ps t - Various window manipulations and reports (xterm)\n *\n * Note: Only those listed below are supported. All others are left to integrators and\n * need special treatment based on the embedding environment.\n *\n * Ps = 1 4 supported\n * Report xterm text area size in pixels.\n * Result is CSI 4 ; height ; width t\n * Ps = 14 ; 2 not implemented\n * Ps = 16 supported\n * Report xterm character cell size in pixels.\n * Result is CSI 6 ; height ; width t\n * Ps = 18 supported\n * Report the size of the text area in characters.\n * Result is CSI 8 ; height ; width t\n * Ps = 20 supported\n * Report xterm window's icon label.\n * Result is OSC L label ST\n * Ps = 21 supported\n * Report xterm window's title.\n * Result is OSC l label ST\n * Ps = 22 ; 0 -> Save xterm icon and window title on stack. supported\n * Ps = 22 ; 1 -> Save xterm icon title on stack. supported\n * Ps = 22 ; 2 -> Save xterm window title on stack. supported\n * Ps = 23 ; 0 -> Restore xterm icon and window title from stack. supported\n * Ps = 23 ; 1 -> Restore xterm icon title from stack. supported\n * Ps = 23 ; 2 -> Restore xterm window title from stack. supported\n * Ps >= 24 not implemented\n */\n public windowOptions(params: IParams): boolean {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n const second = (params.length > 1) ? params.params[1] : 0;\n switch (params.params[0]) {\n case 14: // GetWinSizePixels, returns CSI 4 ; height ; width t\n if (second !== 2) {\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_WIN_SIZE_PIXELS);\n }\n break;\n case 16: // GetCellSizePixels, returns CSI 6 ; height ; width t\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_CELL_SIZE_PIXELS);\n break;\n case 18: // GetWinSizeChars, returns CSI 8 ; height ; width t\n if (this._bufferService) {\n this._coreService.triggerDataEvent(`${C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);\n }\n break;\n case 22: // PushTitle\n if (second === 0 || second === 2) {\n this._windowTitleStack.push(this._windowTitle);\n if (this._windowTitleStack.length > STACK_LIMIT) {\n this._windowTitleStack.shift();\n }\n }\n if (second === 0 || second === 1) {\n this._iconNameStack.push(this._iconName);\n if (this._iconNameStack.length > STACK_LIMIT) {\n this._iconNameStack.shift();\n }\n }\n break;\n case 23: // PopTitle\n if (second === 0 || second === 2) {\n if (this._windowTitleStack.length) {\n this.setTitle(this._windowTitleStack.pop()!);\n }\n }\n if (second === 0 || second === 1) {\n if (this._iconNameStack.length) {\n this.setIconName(this._iconNameStack.pop()!);\n }\n }\n break;\n }\n return true;\n }\n\n\n /**\n * CSI s\n * ESC 7\n * Save cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCOSC \"Save Cursor\" \"CSI s\" \"Save cursor position, charmap and text attributes.\"\n * @vt: #Y ESC SC \"Save Cursor\" \"ESC 7\" \"Save cursor position, charmap and text attributes.\"\n */\n public saveCursor(params?: IParams): boolean {\n this._activeBuffer.savedX = this._activeBuffer.x;\n this._activeBuffer.savedY = this._activeBuffer.ybase + this._activeBuffer.y;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n return true;\n }\n\n\n /**\n * CSI u\n * ESC 8\n * Restore cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCORC \"Restore Cursor\" \"CSI u\" \"Restore cursor position, charmap and text attributes.\"\n * @vt: #Y ESC RC \"Restore Cursor\" \"ESC 8\" \"Restore cursor position, charmap and text attributes.\"\n */\n public restoreCursor(params?: IParams): boolean {\n this._activeBuffer.x = this._activeBuffer.savedX || 0;\n this._activeBuffer.y = Math.max(this._activeBuffer.savedY - this._activeBuffer.ybase, 0);\n this._curAttrData.fg = this._activeBuffer.savedCurAttrData.fg;\n this._curAttrData.bg = this._activeBuffer.savedCurAttrData.bg;\n this._charsetService.charset = (this as any)._savedCharset;\n if (this._activeBuffer.savedCharset) {\n this._charsetService.charset = this._activeBuffer.savedCharset;\n }\n this._restrictCursor();\n return true;\n }\n\n\n /**\n * OSC 2; ST (set window title)\n * Proxy to set window title.\n *\n * @vt: #P[Icon name is not exposed.] OSC 0 \"Set Windows Title and Icon Name\" \"OSC 0 ; Pt BEL\" \"Set window title and icon name.\"\n * Icon name is not supported. For Window Title see below.\n *\n * @vt: #Y OSC 2 \"Set Windows Title\" \"OSC 2 ; Pt BEL\" \"Set window title.\"\n * xterm.js does not manipulate the title directly, instead exposes changes via the event `Terminal.onTitleChange`.\n */\n public setTitle(data: string): boolean {\n this._windowTitle = data;\n this._onTitleChange.fire(data);\n return true;\n }\n\n /**\n * OSC 1; ST\n * Note: Icon name is not exposed.\n */\n public setIconName(data: string): boolean {\n this._iconName = data;\n return true;\n }\n\n /**\n * OSC 4; ; ST (set ANSI color to )\n *\n * @vt: #Y OSC 4 \"Set ANSI color\" \"OSC 4 ; c ; spec BEL\" \"Change color number `c` to the color specified by `spec`.\"\n * `c` is the color index between 0 and 255. The color format of `spec` is derived from `XParseColor` (see OSC 10 for supported formats).\n * There may be multipe `c ; spec` pairs present in the same instruction.\n * If `spec` contains `?` the terminal returns a sequence with the currently set color.\n */\n public setOrReportIndexedColor(data: string): boolean {\n const event: IColorEvent = [];\n const slots = data.split(';');\n while (slots.length > 1) {\n const idx = slots.shift() as string;\n const spec = slots.shift() as string;\n if (/^\\d+$/.exec(idx)) {\n const index = parseInt(idx);\n if (0 <= index && index < 256) {\n if (spec === '?') {\n event.push({ type: ColorRequestType.REPORT, index });\n } else {\n const color = parseColor(spec);\n if (color) {\n event.push({ type: ColorRequestType.SET, index, color });\n }\n }\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 8 ; ; ST - create hyperlink\n * OSC 8 ; ; ST - finish hyperlink\n *\n * Test case:\n *\n * ```sh\n * printf '\\e]8;;http://example.com\\e\\\\This is a link\\e]8;;\\e\\\\\\n'\n * ```\n *\n * @vt: #Y OSC 8 \"Create hyperlink\" \"OSC 8 ; params ; uri BEL\" \"Create a hyperlink to `uri` using `params`.\"\n * `uri` is a hyperlink starting with `http://`, `https://`, `ftp://`, `file://` or `mailto://`. `params` is an\n * optional list of key=value assignments, separated by the : character. Example: `id=xyz123:foo=bar:baz=quux`.\n * Currently only the id key is defined. Cells that share the same ID and URI share hover feedback.\n * Use `OSC 8 ; ; BEL` to finish the current hyperlink.\n */\n public setHyperlink(data: string): boolean {\n const args = data.split(';');\n if (args.length < 2) {\n return false;\n }\n if (args[1]) {\n return this._createHyperlink(args[0], args[1]);\n }\n if (args[0]) {\n return false;\n }\n return this._finishHyperlink();\n }\n\n private _createHyperlink(params: string, uri: string): boolean {\n // It's legal to open a new hyperlink without explicitly finishing the previous one\n if (this._getCurrentLinkId()) {\n this._finishHyperlink();\n }\n const parsedParams = params.split(':');\n let id: string | undefined;\n const idParamIndex = parsedParams.findIndex(e => e.startsWith('id='));\n if (idParamIndex !== -1) {\n id = parsedParams[idParamIndex].slice(3) || undefined;\n }\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = this._oscLinkService.registerLink({ id, uri });\n this._curAttrData.updateExtended();\n return true;\n }\n\n private _finishHyperlink(): boolean {\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = 0;\n this._curAttrData.updateExtended();\n return true;\n }\n\n // special colors - OSC 10 | 11 | 12\n private _specialColors = [ColorIndex.FOREGROUND, ColorIndex.BACKGROUND, ColorIndex.CURSOR];\n\n /**\n * Apply colors requests for special colors in OSC 10 | 11 | 12.\n * Since these commands are stacking from multiple parameters,\n * we handle them in a loop with an entry offset to `_specialColors`.\n */\n private _setOrReportSpecialColor(data: string, offset: number): boolean {\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i, ++offset) {\n if (offset >= this._specialColors.length) break;\n if (slots[i] === '?') {\n this._onColor.fire([{ type: ColorRequestType.REPORT, index: this._specialColors[offset] }]);\n } else {\n const color = parseColor(slots[i]);\n if (color) {\n this._onColor.fire([{ type: ColorRequestType.SET, index: this._specialColors[offset], color }]);\n }\n }\n }\n return true;\n }\n\n /**\n * OSC 10 ; | ST - set or query default foreground color\n *\n * @vt: #Y OSC 10 \"Set or query default foreground color\" \"OSC 10 ; Pt BEL\" \"Set or query default foreground color.\"\n * To set the color, the following color specification formats are supported:\n * - `rgb://` for `, , ` in `h | hh | hhh | hhhh`, where\n * `h` is a single hexadecimal digit (case insignificant). The different widths scale\n * from 4 bit (`h`) to 16 bit (`hhhh`) and get converted to 8 bit (`hh`).\n * - `#RGB` - 4 bits per channel, expanded to `#R0G0B0`\n * - `#RRGGBB` - 8 bits per channel\n * - `#RRRGGGBBB` - 12 bits per channel, truncated to `#RRGGBB`\n * - `#RRRRGGGGBBBB` - 16 bits per channel, truncated to `#RRGGBB`\n *\n * **Note:** X11 named colors are currently unsupported.\n *\n * If `Pt` contains `?` instead of a color specification, the terminal\n * returns a sequence with the current default foreground color\n * (use that sequence to restore the color after changes).\n *\n * **Note:** Other than xterm, xterm.js does not support OSC 12 - 19.\n * Therefore stacking multiple `Pt` separated by `;` only works for the first two entries.\n */\n public setOrReportFgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 0);\n }\n\n /**\n * OSC 11 ; | ST - set or query default background color\n *\n * @vt: #Y OSC 11 \"Set or query default background color\" \"OSC 11 ; Pt BEL\" \"Same as OSC 10, but for default background.\"\n */\n public setOrReportBgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 1);\n }\n\n /**\n * OSC 12 ; | ST - set or query default cursor color\n *\n * @vt: #Y OSC 12 \"Set or query default cursor color\" \"OSC 12 ; Pt BEL\" \"Same as OSC 10, but for default cursor color.\"\n */\n public setOrReportCursorColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 2);\n }\n\n /**\n * OSC 104 ; ST - restore ANSI color \n *\n * @vt: #Y OSC 104 \"Reset ANSI color\" \"OSC 104 ; c BEL\" \"Reset color number `c` to themed color.\"\n * `c` is the color index between 0 and 255. This function restores the default color for `c` as\n * specified by the loaded theme. Any number of `c` parameters may be given.\n * If no parameters are given, the entire indexed color table will be reset.\n */\n public restoreIndexedColor(data: string): boolean {\n if (!data) {\n this._onColor.fire([{ type: ColorRequestType.RESTORE }]);\n return true;\n }\n const event: IColorEvent = [];\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i) {\n if (/^\\d+$/.exec(slots[i])) {\n const index = parseInt(slots[i]);\n if (0 <= index && index < 256) {\n event.push({ type: ColorRequestType.RESTORE, index });\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 110 ST - restore default foreground color\n *\n * @vt: #Y OSC 110 \"Restore default foreground color\" \"OSC 110 BEL\" \"Restore default foreground to themed color.\"\n */\n public restoreFgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: ColorIndex.FOREGROUND }]);\n return true;\n }\n\n /**\n * OSC 111 ST - restore default background color\n *\n * @vt: #Y OSC 111 \"Restore default background color\" \"OSC 111 BEL\" \"Restore default background to themed color.\"\n */\n public restoreBgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: ColorIndex.BACKGROUND }]);\n return true;\n }\n\n /**\n * OSC 112 ST - restore default cursor color\n *\n * @vt: #Y OSC 112 \"Restore default cursor color\" \"OSC 112 BEL\" \"Restore default cursor to themed color.\"\n */\n public restoreCursorColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: ColorIndex.CURSOR }]);\n return true;\n }\n\n /**\n * ESC E\n * C1.NEL\n * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL)\n * Moves cursor to first position on next line.\n *\n * @vt: #Y C1 NEL \"Next Line\" \"\\x85\" \"Move the cursor to the beginning of the next row.\"\n * @vt: #Y ESC NEL \"Next Line\" \"ESC E\" \"Move the cursor to the beginning of the next row.\"\n */\n public nextLine(): boolean {\n this._activeBuffer.x = 0;\n this.index();\n return true;\n }\n\n /**\n * ESC =\n * DEC mnemonic: DECKPAM (https://vt100.net/docs/vt510-rm/DECKPAM.html)\n * Enables the numeric keypad to send application sequences to the host.\n */\n public keypadApplicationMode(): boolean {\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC >\n * DEC mnemonic: DECKPNM (https://vt100.net/docs/vt510-rm/DECKPNM.html)\n * Enables the keypad to send numeric characters to the host.\n */\n public keypadNumericMode(): boolean {\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC % @\n * ESC % G\n * Select default character set. UTF-8 is not supported (string are unicode anyways)\n * therefore ESC % G does the same.\n */\n public selectDefaultCharset(): boolean {\n this._charsetService.setgLevel(0);\n this._charsetService.setgCharset(0, DEFAULT_CHARSET); // US (default)\n return true;\n }\n\n /**\n * ESC ( C\n * Designate G0 Character Set, VT100, ISO 2022.\n * ESC ) C\n * Designate G1 Character Set (ISO 2022, VT100).\n * ESC * C\n * Designate G2 Character Set (ISO 2022, VT220).\n * ESC + C\n * Designate G3 Character Set (ISO 2022, VT220).\n * ESC - C\n * Designate G1 Character Set (VT300).\n * ESC . C\n * Designate G2 Character Set (VT300).\n * ESC / C\n * Designate G3 Character Set (VT300). C = A -> ISO Latin-1 Supplemental. - Supported?\n */\n public selectCharset(collectAndFlag: string): boolean {\n if (collectAndFlag.length !== 2) {\n this.selectDefaultCharset();\n return true;\n }\n if (collectAndFlag[0] === '/') {\n return true; // TODO: Is this supported?\n }\n this._charsetService.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] || DEFAULT_CHARSET);\n return true;\n }\n\n /**\n * ESC D\n * C1.IND\n * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html)\n * Moves the cursor down one line in the same column.\n *\n * @vt: #Y C1 IND \"Index\" \"\\x84\" \"Move the cursor one line down scrolling if needed.\"\n * @vt: #Y ESC IND \"Index\" \"ESC D\" \"Move the cursor one line down scrolling if needed.\"\n */\n public index(): boolean {\n this._restrictCursor();\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * ESC H\n * C1.HTS\n * DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html)\n * Sets a horizontal tab stop at the column position indicated by\n * the value of the active column when the terminal receives an HTS.\n *\n * @vt: #Y C1 HTS \"Horizontal Tabulation Set\" \"\\x88\" \"Places a tab stop at the current cursor position.\"\n * @vt: #Y ESC HTS \"Horizontal Tabulation Set\" \"ESC H\" \"Places a tab stop at the current cursor position.\"\n */\n public tabSet(): boolean {\n this._activeBuffer.tabs[this._activeBuffer.x] = true;\n return true;\n }\n\n /**\n * ESC M\n * C1.RI\n * DEC mnemonic: HTS\n * Moves the cursor up one line in the same column. If the cursor is at the top margin,\n * the page scrolls down.\n *\n * @vt: #Y ESC IR \"Reverse Index\" \"ESC M\" \"Move the cursor one line up scrolling if needed.\"\n */\n public reverseIndex(): boolean {\n this._restrictCursor();\n if (this._activeBuffer.y === this._activeBuffer.scrollTop) {\n // possibly move the code below to term.reverseScroll();\n // test: echo -ne '\\e[1;1H\\e[44m\\eM\\e[0m'\n // blankLine(true) is xterm/linux behavior\n const scrollRegionHeight = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;\n this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase + this._activeBuffer.y, scrollRegionHeight, 1);\n this._activeBuffer.lines.set(this._activeBuffer.ybase + this._activeBuffer.y, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n } else {\n this._activeBuffer.y--;\n this._restrictCursor(); // quickfix to not run out of bounds\n }\n return true;\n }\n\n /**\n * ESC c\n * DEC mnemonic: RIS (https://vt100.net/docs/vt510-rm/RIS.html)\n * Reset to initial state.\n */\n public fullReset(): boolean {\n this._parser.reset();\n this._onRequestReset.fire();\n return true;\n }\n\n public reset(): void {\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._eraseAttrDataInternal = DEFAULT_ATTR_DATA.clone();\n }\n\n /**\n * back_color_erase feature for xterm.\n */\n private _eraseAttrData(): IAttributeData {\n this._eraseAttrDataInternal.bg &= ~(Attributes.CM_MASK | 0xFFFFFF);\n this._eraseAttrDataInternal.bg |= this._curAttrData.bg & ~0xFC000000;\n return this._eraseAttrDataInternal;\n }\n\n /**\n * ESC n\n * ESC o\n * ESC |\n * ESC }\n * ESC ~\n * DEC mnemonic: LS (https://vt100.net/docs/vt510-rm/LS.html)\n * When you use a locking shift, the character set remains in GL or GR until\n * you use another locking shift. (partly supported)\n */\n public setgLevel(level: number): boolean {\n this._charsetService.setgLevel(level);\n return true;\n }\n\n /**\n * ESC # 8\n * DEC mnemonic: DECALN (https://vt100.net/docs/vt510-rm/DECALN.html)\n * This control function fills the complete screen area with\n * a test pattern (E) used for adjusting screen alignment.\n *\n * @vt: #Y ESC DECALN \"Screen Alignment Pattern\" \"ESC # 8\" \"Fill viewport with a test pattern (E).\"\n */\n public screenAlignmentPattern(): boolean {\n // prepare cell data\n const cell = new CellData();\n cell.content = 1 << Content.WIDTH_SHIFT | 'E'.charCodeAt(0);\n cell.fg = this._curAttrData.fg;\n cell.bg = this._curAttrData.bg;\n\n\n this._setCursor(0, 0);\n for (let yOffset = 0; yOffset < this._bufferService.rows; ++yOffset) {\n const row = this._activeBuffer.ybase + this._activeBuffer.y + yOffset;\n const line = this._activeBuffer.lines.get(row);\n if (line) {\n line.fill(cell);\n line.isWrapped = false;\n }\n }\n this._dirtyRowTracker.markAllDirty();\n this._setCursor(0, 0);\n return true;\n }\n\n\n /**\n * DCS $ q Pt ST\n * DECRQSS (https://vt100.net/docs/vt510-rm/DECRQSS.html)\n * Request Status String (DECRQSS), VT420 and up.\n * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html)\n *\n * @vt: #P[Limited support, see below.] DCS DECRQSS \"Request Selection or Setting\" \"DCS $ q Pt ST\" \"Request several terminal settings.\"\n * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the corresponding CSI string,\n * `ESC P 0 ST` for invalid requests.\n *\n * Supported requests and responses:\n *\n * | Type | Request | Response (`Pt`) |\n * | -------------------------------- | ----------------- | ----------------------------------------------------- |\n * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) |\n * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ps ; Ps r` |\n * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Ps SP q` |\n * | Protection Attribute (DECSCA) | `DCS $ q \" q ST` | `Ps \" q` (DECSCA 2 is reported as Ps = 0) |\n * | Conformance Level (DECSCL) | `DCS $ q \" p ST` | always reporting `61 ; 1 \" p` (DECSCL is unsupported) |\n *\n *\n * TODO:\n * - fix SGR report\n * - either check which conformance is better suited or remove the report completely\n * --> we are currently a mixture of all up to VT400 but dont follow anyone strictly\n */\n public requestStatusString(data: string, params: IParams): boolean {\n const f = (s: string): boolean => {\n this._coreService.triggerDataEvent(`${C0.ESC}${s}${C0.ESC}\\\\`);\n return true;\n };\n\n // access helpers\n const b = this._bufferService.buffer;\n const opts = this._optionsService.rawOptions;\n const STYLES: { [key: string]: number } = { 'block': 2, 'underline': 4, 'bar': 6 };\n\n if (data === '\"q') return f(`P1$r${this._curAttrData.isProtected() ? 1 : 0}\"q`);\n if (data === '\"p') return f(`P1$r61;1\"p`);\n if (data === 'r') return f(`P1$r${b.scrollTop + 1};${b.scrollBottom + 1}r`);\n // FIXME: report real SGR settings instead of 0m\n if (data === 'm') return f(`P1$r0m`);\n if (data === ' q') return f(`P1$r${STYLES[opts.cursorStyle] - (opts.cursorBlink ? 1 : 0)} q`);\n return f(`P0$r`);\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n this._dirtyRowTracker.markRangeDirty(y1, y2);\n }\n}\n\nexport interface IDirtyRowTracker {\n readonly start: number;\n readonly end: number;\n\n clearRange(): void;\n markDirty(y: number): void;\n markRangeDirty(y1: number, y2: number): void;\n markAllDirty(): void;\n}\n\nclass DirtyRowTracker implements IDirtyRowTracker {\n public start!: number;\n public end!: number;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n this.clearRange();\n }\n\n public clearRange(): void {\n this.start = this._bufferService.buffer.y;\n this.end = this._bufferService.buffer.y;\n }\n\n public markDirty(y: number): void {\n if (y < this.start) {\n this.start = y;\n } else if (y > this.end) {\n this.end = y;\n }\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n if (y1 > y2) {\n $temp = y1;\n y1 = y2;\n y2 = $temp;\n }\n if (y1 < this.start) {\n this.start = y1;\n }\n if (y2 > this.end) {\n this.end = y2;\n }\n }\n\n public markAllDirty(): void {\n this.markRangeDirty(0, this._bufferService.rows - 1);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\n\n/**\n * A base class that can be extended to provide convenience methods for managing the lifecycle of an\n * object and its components.\n */\nexport abstract class Disposable implements IDisposable {\n protected _disposables: IDisposable[] = [];\n protected _isDisposed: boolean = false;\n\n constructor() {\n }\n\n /**\n * Disposes the object, triggering the `dispose` method on all registered IDisposables.\n */\n public dispose(): void {\n this._isDisposed = true;\n for (const d of this._disposables) {\n d.dispose();\n }\n this._disposables.length = 0;\n }\n\n /**\n * Registers a disposable object.\n * @param d The disposable to register.\n * @returns The disposable.\n */\n public register(d: T): T {\n this._disposables.push(d);\n return d;\n }\n\n /**\n * Unregisters a disposable object if it has been registered, if not do\n * nothing.\n * @param d The disposable to unregister.\n */\n public unregister(d: T): void {\n const index = this._disposables.indexOf(d);\n if (index !== -1) {\n this._disposables.splice(index, 1);\n }\n }\n}\n\n/**\n * Wrap a function in a disposable.\n */\nexport function toDisposable(f: () => void): IDisposable {\n return { dispose: f };\n}\n\n/**\n * Dispose of all disposables in an array and set its length to 0.\n */\nexport function disposeArray(disposables: IDisposable[]): void {\n for (const d of disposables) {\n d.dispose();\n }\n disposables.length = 0;\n}\n\n/**\n * Creates a disposable that will dispose of an array of disposables when disposed.\n */\nexport function getDisposeArrayDisposable(array: IDisposable[]): IDisposable {\n return { dispose: () => disposeArray(array) };\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport class TwoKeyMap {\n private _data: { [bg: string | number]: { [fg: string | number]: TValue | undefined } | undefined } = {};\n\n public set(first: TFirst, second: TSecond, value: TValue): void {\n if (!this._data[first]) {\n this._data[first] = {};\n }\n this._data[first as string | number]![second] = value;\n }\n\n public get(first: TFirst, second: TSecond): TValue | undefined {\n return this._data[first as string | number] ? this._data[first as string | number]![second] : undefined;\n }\n\n public clear(): void {\n this._data = {};\n }\n}\n\nexport class FourKeyMap {\n private _data: TwoKeyMap> = new TwoKeyMap();\n\n public set(first: TFirst, second: TSecond, third: TThird, fourth: TFourth, value: TValue): void {\n if (!this._data.get(first, second)) {\n this._data.set(first, second, new TwoKeyMap());\n }\n this._data.get(first, second)!.set(third, fourth, value);\n }\n\n public get(first: TFirst, second: TSecond, third: TThird, fourth: TFourth): TValue | undefined {\n return this._data.get(first, second)?.get(third, fourth);\n }\n\n public clear(): void {\n this._data.clear();\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\ninterface INavigator {\n userAgent: string;\n language: string;\n platform: string;\n}\n\n// We're declaring a navigator global here as we expect it in all runtimes (node and browser), but\n// we want this module to live in common.\ndeclare const navigator: INavigator;\n\nexport const isNode = (typeof navigator === 'undefined') ? true : false;\nconst userAgent = (isNode) ? 'node' : navigator.userAgent;\nconst platform = (isNode) ? 'node' : navigator.platform;\n\nexport const isFirefox = userAgent.includes('Firefox');\nexport const isLegacyEdge = userAgent.includes('Edge');\nexport const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);\nexport function getSafariVersion(): number {\n if (!isSafari) {\n return 0;\n }\n const majorVersion = userAgent.match(/Version\\/(\\d+)/);\n if (majorVersion === null || majorVersion.length < 2) {\n return 0;\n }\n return parseInt(majorVersion[1]);\n}\n\n// Find the users platform. We use this to interpret the meta key\n// and ISO third level shifts.\n// http://stackoverflow.com/q/19877924/577598\nexport const isMac = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].includes(platform);\nexport const isIpad = platform === 'iPad';\nexport const isIphone = platform === 'iPhone';\nexport const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform);\nexport const isLinux = platform.indexOf('Linux') >= 0;\n// Note that when this is true, isLinux will also be true.\nexport const isChromeOS = /\\bCrOS\\b/.test(userAgent);\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n// Work variables to avoid garbage collection.\nlet i = 0;\n\n/**\n * A generic list that is maintained in sorted order and allows values with duplicate keys. This\n * list is based on binary search and as such locating a key will take O(log n) amortized, this\n * includes the by key iterator.\n */\nexport class SortedList {\n private readonly _array: T[] = [];\n\n constructor(\n private readonly _getKey: (value: T) => number\n ) {\n }\n\n public clear(): void {\n this._array.length = 0;\n }\n\n public insert(value: T): void {\n if (this._array.length === 0) {\n this._array.push(value);\n return;\n }\n i = this._search(this._getKey(value), 0, this._array.length - 1);\n this._array.splice(i, 0, value);\n }\n\n public delete(value: T): boolean {\n if (this._array.length === 0) {\n return false;\n }\n const key = this._getKey(value);\n if (key === undefined) {\n return false;\n }\n i = this._search(key, 0, this._array.length - 1);\n if (i === -1) {\n return false;\n }\n if (this._getKey(this._array[i]) !== key) {\n return false;\n }\n do {\n if (this._array[i] === value) {\n this._array.splice(i, 1);\n return true;\n }\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n return false;\n }\n\n public *getKeyIterator(key: number): IterableIterator {\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key, 0, this._array.length - 1);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n yield this._array[i];\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public forEachByKey(key: number, callback: (value: T) => void): void {\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key, 0, this._array.length - 1);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n callback(this._array[i]);\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public values(): IterableIterator {\n return this._array.values();\n }\n\n private _search(key: number, min: number, max: number): number {\n if (max < min) {\n return min;\n }\n let mid = Math.floor((min + max) / 2);\n const midKey = this._getKey(this._array[mid]);\n if (midKey > key) {\n return this._search(key, min, mid - 1);\n }\n if (midKey < key) {\n return this._search(key, mid + 1, max);\n }\n // Value found! Since keys can be duplicates, move the result index back to the lowest index\n // that matches the key.\n while (mid > 0 && this._getKey(this._array[mid - 1]) === key) {\n mid--;\n }\n return mid;\n }\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isNode } from 'common/Platform';\n\ninterface ITaskQueue {\n /**\n * Adds a task to the queue which will run in a future idle callback.\n * To avoid perceivable stalls on the mainthread, tasks with heavy workload\n * should split their work into smaller pieces and return `true` to get\n * called again until the work is done (on falsy return value).\n */\n enqueue(task: () => boolean | void): void;\n\n /**\n * Flushes the queue, running all remaining tasks synchronously.\n */\n flush(): void;\n\n /**\n * Clears any remaining tasks from the queue, these will not be run.\n */\n clear(): void;\n}\n\ninterface ITaskDeadline {\n timeRemaining(): number;\n}\ntype CallbackWithDeadline = (deadline: ITaskDeadline) => void;\n\nabstract class TaskQueue implements ITaskQueue {\n private _tasks: (() => boolean | void)[] = [];\n private _idleCallback?: number;\n private _i = 0;\n\n protected abstract _requestCallback(callback: CallbackWithDeadline): number;\n protected abstract _cancelCallback(identifier: number): void;\n\n public enqueue(task: () => boolean | void): void {\n this._tasks.push(task);\n this._start();\n }\n\n public flush(): void {\n while (this._i < this._tasks.length) {\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n }\n this.clear();\n }\n\n public clear(): void {\n if (this._idleCallback) {\n this._cancelCallback(this._idleCallback);\n this._idleCallback = undefined;\n }\n this._i = 0;\n this._tasks.length = 0;\n }\n\n private _start(): void {\n if (!this._idleCallback) {\n this._idleCallback = this._requestCallback(this._process.bind(this));\n }\n }\n\n private _process(deadline: ITaskDeadline): void {\n this._idleCallback = undefined;\n let taskDuration = 0;\n let longestTask = 0;\n let lastDeadlineRemaining = deadline.timeRemaining();\n let deadlineRemaining = 0;\n while (this._i < this._tasks.length) {\n taskDuration = Date.now();\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n // other than performance.now, Date.now might not be stable (changes on wall clock changes),\n // this is not an issue here as a clock change during a short running task is very unlikely\n // in case it still happened and leads to negative duration, simply assume 1 msec\n taskDuration = Math.max(1, Date.now() - taskDuration);\n longestTask = Math.max(taskDuration, longestTask);\n // Guess the following task will take a similar time to the longest task in this batch, allow\n // additional room to try avoid exceeding the deadline\n deadlineRemaining = deadline.timeRemaining();\n if (longestTask * 1.5 > deadlineRemaining) {\n // Warn when the time exceeding the deadline is over 20ms, if this happens in practice the\n // task should be split into sub-tasks to ensure the UI remains responsive.\n if (lastDeadlineRemaining - taskDuration < -20) {\n console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(lastDeadlineRemaining - taskDuration))}ms`);\n }\n this._start();\n return;\n }\n lastDeadlineRemaining = deadlineRemaining;\n }\n this.clear();\n }\n}\n\n/**\n * A queue of that runs tasks over several tasks via setTimeout, trying to maintain above 60 frames\n * per second. The tasks will run in the order they are enqueued, but they will run some time later,\n * and care should be taken to ensure they're non-urgent and will not introduce race conditions.\n */\nexport class PriorityTaskQueue extends TaskQueue {\n protected _requestCallback(callback: CallbackWithDeadline): number {\n return setTimeout(() => callback(this._createDeadline(16)));\n }\n\n protected _cancelCallback(identifier: number): void {\n clearTimeout(identifier);\n }\n\n private _createDeadline(duration: number): ITaskDeadline {\n const end = Date.now() + duration;\n return {\n timeRemaining: () => Math.max(0, end - Date.now())\n };\n }\n}\n\nclass IdleTaskQueueInternal extends TaskQueue {\n protected _requestCallback(callback: IdleRequestCallback): number {\n return requestIdleCallback(callback);\n }\n\n protected _cancelCallback(identifier: number): void {\n cancelIdleCallback(identifier);\n }\n}\n\n/**\n * A queue of that runs tasks over several idle callbacks, trying to respect the idle callback's\n * deadline given by the environment. The tasks will run in the order they are enqueued, but they\n * will run some time later, and care should be taken to ensure they're non-urgent and will not\n * introduce race conditions.\n *\n * This reverts to a {@link PriorityTaskQueue} if the environment does not support idle callbacks.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdleTaskQueue = (!isNode && 'requestIdleCallback' in window) ? IdleTaskQueueInternal : PriorityTaskQueue;\n\n/**\n * An object that tracks a single debounced task that will run on the next idle frame. When called\n * multiple times, only the last set task will run.\n */\nexport class DebouncedIdleTask {\n private _queue: ITaskQueue;\n\n constructor() {\n this._queue = new IdleTaskQueue();\n }\n\n public set(task: () => boolean | void): void {\n this._queue.clear();\n this._queue.enqueue(task);\n }\n\n public flush(): void {\n this._queue.flush();\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';\nimport { IBufferService } from 'common/services/Services';\n\nexport function updateWindowsModeWrappedState(bufferService: IBufferService): void {\n // Winpty does not support wraparound mode which means that lines will never\n // be marked as wrapped. This causes issues for things like copying a line\n // retaining the wrapped new line characters or if consumers are listening\n // in on the data stream.\n //\n // The workaround for this is to listen to every incoming line feed and mark\n // the line as wrapped if the last character in the previous line is not a\n // space. This is certainly not without its problems, but generally on\n // Windows when text reaches the end of the terminal it's likely going to be\n // wrapped.\n const line = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y - 1);\n const lastChar = line?.get(bufferService.cols - 1);\n\n const nextLine = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y);\n if (nextLine && lastChar) {\n nextLine.isWrapped = (lastChar[CHAR_DATA_CODE_INDEX] !== NULL_CELL_CODE && lastChar[CHAR_DATA_CODE_INDEX] !== WHITESPACE_CELL_CODE);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/Types';\nimport { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from 'common/buffer/Constants';\n\nexport class AttributeData implements IAttributeData {\n public static toColorRGB(value: number): IColorRGB {\n return [\n value >>> Attributes.RED_SHIFT & 255,\n value >>> Attributes.GREEN_SHIFT & 255,\n value & 255\n ];\n }\n\n public static fromColorRGB(value: IColorRGB): number {\n return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;\n }\n\n public clone(): IAttributeData {\n const newObj = new AttributeData();\n newObj.fg = this.fg;\n newObj.bg = this.bg;\n newObj.extended = this.extended.clone();\n return newObj;\n }\n\n // data\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n\n // flags\n public isInverse(): number { return this.fg & FgFlags.INVERSE; }\n public isBold(): number { return this.fg & FgFlags.BOLD; }\n public isUnderline(): number {\n if (this.hasExtendedAttrs() && this.extended.underlineStyle !== UnderlineStyle.NONE) {\n return 1;\n }\n return this.fg & FgFlags.UNDERLINE;\n }\n public isBlink(): number { return this.fg & FgFlags.BLINK; }\n public isInvisible(): number { return this.fg & FgFlags.INVISIBLE; }\n public isItalic(): number { return this.bg & BgFlags.ITALIC; }\n public isDim(): number { return this.bg & BgFlags.DIM; }\n public isStrikethrough(): number { return this.fg & FgFlags.STRIKETHROUGH; }\n public isProtected(): number { return this.bg & BgFlags.PROTECTED; }\n\n // color modes\n public getFgColorMode(): number { return this.fg & Attributes.CM_MASK; }\n public getBgColorMode(): number { return this.bg & Attributes.CM_MASK; }\n public isFgRGB(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isBgRGB(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isFgPalette(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.fg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isBgPalette(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.bg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isFgDefault(): boolean { return (this.fg & Attributes.CM_MASK) === 0; }\n public isBgDefault(): boolean { return (this.bg & Attributes.CM_MASK) === 0; }\n public isAttributeDefault(): boolean { return this.fg === 0 && this.bg === 0; }\n\n // colors\n public getFgColor(): number {\n switch (this.fg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.fg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.fg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n public getBgColor(): number {\n switch (this.bg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.bg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.bg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n\n // extended attrs\n public hasExtendedAttrs(): number {\n return this.bg & BgFlags.HAS_EXTENDED;\n }\n public updateExtended(): void {\n if (this.extended.isEmpty()) {\n this.bg &= ~BgFlags.HAS_EXTENDED;\n } else {\n this.bg |= BgFlags.HAS_EXTENDED;\n }\n }\n public getUnderlineColor(): number {\n if ((this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor) {\n switch (this.extended.underlineColor & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.extended.underlineColor & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.extended.underlineColor & Attributes.RGB_MASK;\n default: return this.getFgColor();\n }\n }\n return this.getFgColor();\n }\n public getUnderlineColorMode(): number {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? this.extended.underlineColor & Attributes.CM_MASK\n : this.getFgColorMode();\n }\n public isUnderlineColorRGB(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_RGB\n : this.isFgRGB();\n }\n public isUnderlineColorPalette(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P16\n || (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P256\n : this.isFgPalette();\n }\n public isUnderlineColorDefault(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === 0\n : this.isFgDefault();\n }\n public getUnderlineStyle(): UnderlineStyle {\n return this.fg & FgFlags.UNDERLINE\n ? (this.bg & BgFlags.HAS_EXTENDED ? this.extended.underlineStyle : UnderlineStyle.SINGLE)\n : UnderlineStyle.NONE;\n }\n}\n\n\n/**\n * Extended attributes for a cell.\n * Holds information about different underline styles and color.\n */\nexport class ExtendedAttrs implements IExtendedAttrs {\n private _ext: number = 0;\n public get ext(): number {\n if (this._urlId) {\n return (\n (this._ext & ~ExtFlags.UNDERLINE_STYLE) |\n (this.underlineStyle << 26)\n );\n }\n return this._ext;\n }\n public set ext(value: number) { this._ext = value; }\n\n public get underlineStyle(): UnderlineStyle {\n // Always return the URL style if it has one\n if (this._urlId) {\n return UnderlineStyle.DASHED;\n }\n return (this._ext & ExtFlags.UNDERLINE_STYLE) >> 26;\n }\n public set underlineStyle(value: UnderlineStyle) {\n this._ext &= ~ExtFlags.UNDERLINE_STYLE;\n this._ext |= (value << 26) & ExtFlags.UNDERLINE_STYLE;\n }\n\n public get underlineColor(): number {\n return this._ext & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n public set underlineColor(value: number) {\n this._ext &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n this._ext |= value & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n\n private _urlId: number = 0;\n public get urlId(): number {\n return this._urlId;\n }\n public set urlId(value: number) {\n this._urlId = value;\n }\n\n constructor(\n ext: number = 0,\n urlId: number = 0\n ) {\n this._ext = ext;\n this._urlId = urlId;\n }\n\n public clone(): IExtendedAttrs {\n return new ExtendedAttrs(this._ext, this._urlId);\n }\n\n /**\n * Convenient method to indicate whether the object holds no additional information,\n * that needs to be persistant in the buffer.\n */\n public isEmpty(): boolean {\n return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0;\n }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CircularList, IInsertEvent } from 'common/CircularList';\nimport { IBuffer, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult } from 'common/buffer/Types';\nimport { IBufferLine, ICellData, IAttributeData, ICharset } from 'common/Types';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { CellData } from 'common/buffer/CellData';\nimport { NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from 'common/buffer/Constants';\nimport { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from 'common/buffer/BufferReflow';\nimport { Marker } from 'common/buffer/Marker';\nimport { IOptionsService, IBufferService } from 'common/services/Services';\nimport { DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { ExtendedAttrs } from 'common/buffer/AttributeData';\nimport { DebouncedIdleTask, IdleTaskQueue } from 'common/TaskQueue';\n\nexport const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1\n\n/**\n * This class represents a terminal buffer (an internal state of the terminal), where the\n * following information is stored (in high-level):\n * - text content of this particular buffer\n * - cursor position\n * - scroll position\n */\nexport class Buffer implements IBuffer {\n public lines: CircularList;\n public ydisp: number = 0;\n public ybase: number = 0;\n public y: number = 0;\n public x: number = 0;\n public scrollBottom: number;\n public scrollTop: number;\n public tabs: { [column: number]: boolean | undefined } = {};\n public savedY: number = 0;\n public savedX: number = 0;\n public savedCurAttrData = DEFAULT_ATTR_DATA.clone();\n public savedCharset: ICharset | undefined = DEFAULT_CHARSET;\n public markers: Marker[] = [];\n private _nullCell: ICellData = CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]);\n private _cols: number;\n private _rows: number;\n private _isClearing: boolean = false;\n\n constructor(\n private _hasScrollback: boolean,\n private _optionsService: IOptionsService,\n private _bufferService: IBufferService\n ) {\n this._cols = this._bufferService.cols;\n this._rows = this._bufferService.rows;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n public getNullCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._nullCell.fg = attr.fg;\n this._nullCell.bg = attr.bg;\n this._nullCell.extended = attr.extended;\n } else {\n this._nullCell.fg = 0;\n this._nullCell.bg = 0;\n this._nullCell.extended = new ExtendedAttrs();\n }\n return this._nullCell;\n }\n\n public getWhitespaceCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._whitespaceCell.fg = attr.fg;\n this._whitespaceCell.bg = attr.bg;\n this._whitespaceCell.extended = attr.extended;\n } else {\n this._whitespaceCell.fg = 0;\n this._whitespaceCell.bg = 0;\n this._whitespaceCell.extended = new ExtendedAttrs();\n }\n return this._whitespaceCell;\n }\n\n public getBlankLine(attr: IAttributeData, isWrapped?: boolean): IBufferLine {\n return new BufferLine(this._bufferService.cols, this.getNullCell(attr), isWrapped);\n }\n\n public get hasScrollback(): boolean {\n return this._hasScrollback && this.lines.maxLength > this._rows;\n }\n\n public get isCursorInViewport(): boolean {\n const absoluteY = this.ybase + this.y;\n const relativeY = absoluteY - this.ydisp;\n return (relativeY >= 0 && relativeY < this._rows);\n }\n\n /**\n * Gets the correct buffer length based on the rows provided, the terminal's\n * scrollback and whether this buffer is flagged to have scrollback or not.\n * @param rows The terminal rows to use in the calculation.\n */\n private _getCorrectBufferLength(rows: number): number {\n if (!this._hasScrollback) {\n return rows;\n }\n\n const correctBufferLength = rows + this._optionsService.rawOptions.scrollback;\n\n return correctBufferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBufferLength;\n }\n\n /**\n * Fills the buffer's viewport with blank lines.\n */\n public fillViewportRows(fillAttr?: IAttributeData): void {\n if (this.lines.length === 0) {\n if (fillAttr === undefined) {\n fillAttr = DEFAULT_ATTR_DATA;\n }\n let i = this._rows;\n while (i--) {\n this.lines.push(this.getBlankLine(fillAttr));\n }\n }\n }\n\n /**\n * Clears the buffer to it's initial state, discarding all previous data.\n */\n public clear(): void {\n this.ydisp = 0;\n this.ybase = 0;\n this.y = 0;\n this.x = 0;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n /**\n * Resizes the buffer, adjusting its data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n // store reference to null cell with default attrs\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n\n // count bufferlines with overly big memory to be cleaned afterwards\n let dirtyMemoryLines = 0;\n\n // Increase max length if needed before adjustments to allow space to fill\n // as required.\n const newMaxLength = this._getCorrectBufferLength(newRows);\n if (newMaxLength > this.lines.maxLength) {\n this.lines.maxLength = newMaxLength;\n }\n\n // The following adjustments should only happen if the buffer has been\n // initialized/filled.\n if (this.lines.length > 0) {\n // Deal with columns increasing (reducing needs to happen after reflow)\n if (this._cols < newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n\n // Resize rows in both directions as needed\n let addToY = 0;\n if (this._rows < newRows) {\n for (let y = this._rows; y < newRows; y++) {\n if (this.lines.length < newRows + this.ybase) {\n if (this._optionsService.rawOptions.windowsMode) {\n // Just add the new missing rows on Windows as conpty reprints the screen with it's\n // view of the world. Once a line enters scrollback for conpty it remains there\n this.lines.push(new BufferLine(newCols, nullCell));\n } else {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n // There is room above the buffer and there are no empty elements below the line,\n // scroll up\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n // Viewport is at the top of the buffer, must increase downwards\n this.ydisp--;\n }\n } else {\n // Add a blank line if there is no buffer left at the top to scroll to, or if there\n // are blank lines after the cursor\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n }\n }\n }\n } else { // (this._rows >= newRows)\n for (let y = this._rows; y > newRows; y--) {\n if (this.lines.length > newRows + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n // The line is a blank line below the cursor, remove it\n this.lines.pop();\n } else {\n // The line is the cursor, scroll down\n this.ybase++;\n this.ydisp++;\n }\n }\n }\n }\n\n // Reduce max length if needed after adjustments, this is done after as it\n // would otherwise cut data from the bottom of the buffer.\n if (newMaxLength < this.lines.maxLength) {\n // Trim from the top of the buffer and adjust ybase and ydisp.\n const amountToTrim = this.lines.length - newMaxLength;\n if (amountToTrim > 0) {\n this.lines.trimStart(amountToTrim);\n this.ybase = Math.max(this.ybase - amountToTrim, 0);\n this.ydisp = Math.max(this.ydisp - amountToTrim, 0);\n this.savedY = Math.max(this.savedY - amountToTrim, 0);\n }\n this.lines.maxLength = newMaxLength;\n }\n\n // Make sure that the cursor stays on screen\n this.x = Math.min(this.x, newCols - 1);\n this.y = Math.min(this.y, newRows - 1);\n if (addToY) {\n this.y += addToY;\n }\n this.savedX = Math.min(this.savedX, newCols - 1);\n\n this.scrollTop = 0;\n }\n\n this.scrollBottom = newRows - 1;\n\n if (this._isReflowEnabled) {\n this._reflow(newCols, newRows);\n\n // Trim the end of the line off if cols shrunk\n if (this._cols > newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n }\n\n this._cols = newCols;\n this._rows = newRows;\n\n this._memoryCleanupQueue.clear();\n // schedule memory cleanup only, if more than 10% of the lines are affected\n if (dirtyMemoryLines > 0.1 * this.lines.length) {\n this._memoryCleanupPosition = 0;\n this._memoryCleanupQueue.enqueue(() => this._batchedMemoryCleanup());\n }\n }\n\n private _memoryCleanupQueue = new IdleTaskQueue();\n private _memoryCleanupPosition = 0;\n\n private _batchedMemoryCleanup(): boolean {\n let normalRun = true;\n if (this._memoryCleanupPosition >= this.lines.length) {\n // cleanup made it once through all lines, thus rescan in loop below to also catch shifted lines,\n // which should finish rather quick if there are no more cleanups pending\n this._memoryCleanupPosition = 0;\n normalRun = false;\n }\n let counted = 0;\n while (this._memoryCleanupPosition < this.lines.length) {\n counted += this.lines.get(this._memoryCleanupPosition++)!.cleanupMemory();\n // cleanup max 100 lines per batch\n if (counted > 100) {\n return true;\n }\n }\n // normal runs always need another rescan afterwards\n // if we made it here with normalRun=false, we are in a final run\n // and can end the cleanup task for sure\n return normalRun;\n }\n\n private get _isReflowEnabled(): boolean {\n return this._hasScrollback && !this._optionsService.rawOptions.windowsMode;\n }\n\n private _reflow(newCols: number, newRows: number): void {\n if (this._cols === newCols) {\n return;\n }\n\n // Iterate through rows, ignore the last one as it cannot be wrapped\n if (newCols > this._cols) {\n this._reflowLarger(newCols, newRows);\n } else {\n this._reflowSmaller(newCols, newRows);\n }\n }\n\n private _reflowLarger(newCols: number, newRows: number): void {\n const toRemove: number[] = reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(DEFAULT_ATTR_DATA));\n if (toRemove.length > 0) {\n const newLayoutResult = reflowLargerCreateNewLayout(this.lines, toRemove);\n reflowLargerApplyNewLayout(this.lines, newLayoutResult.layout);\n this._reflowLargerAdjustViewport(newCols, newRows, newLayoutResult.countRemoved);\n }\n }\n\n private _reflowLargerAdjustViewport(newCols: number, newRows: number, countRemoved: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Adjust viewport based on number of items removed\n let viewportAdjustments = countRemoved;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y > 0) {\n this.y--;\n }\n if (this.lines.length < newRows) {\n // Add an extra row at the bottom of the viewport\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n } else {\n if (this.ydisp === this.ybase) {\n this.ydisp--;\n }\n this.ybase--;\n }\n }\n this.savedY = Math.max(this.savedY - countRemoved, 0);\n }\n\n private _reflowSmaller(newCols: number, newRows: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Gather all BufferLines that need to be inserted into the Buffer here so that they can be\n // batched up and only committed once\n const toInsert = [];\n let countToInsert = 0;\n // Go backwards as many lines may be trimmed and this will avoid considering them\n for (let y = this.lines.length - 1; y >= 0; y--) {\n // Check whether this line is a problem\n let nextLine = this.lines.get(y) as BufferLine;\n if (!nextLine || !nextLine.isWrapped && nextLine.getTrimmedLength() <= newCols) {\n continue;\n }\n\n // Gather wrapped lines and adjust y to be the starting line\n const wrappedLines: BufferLine[] = [nextLine];\n while (nextLine.isWrapped && y > 0) {\n nextLine = this.lines.get(--y) as BufferLine;\n wrappedLines.unshift(nextLine);\n }\n\n // If these lines contain the cursor don't touch them, the program will handle fixing up\n // wrapped lines with the cursor\n const absoluteY = this.ybase + this.y;\n if (absoluteY >= y && absoluteY < y + wrappedLines.length) {\n continue;\n }\n\n const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength();\n const destLineLengths = reflowSmallerGetNewLineLengths(wrappedLines, this._cols, newCols);\n const linesToAdd = destLineLengths.length - wrappedLines.length;\n let trimmedLines: number;\n if (this.ybase === 0 && this.y !== this.lines.length - 1) {\n // If the top section of the buffer is not yet filled\n trimmedLines = Math.max(0, this.y - this.lines.maxLength + linesToAdd);\n } else {\n trimmedLines = Math.max(0, this.lines.length - this.lines.maxLength + linesToAdd);\n }\n\n // Add the new lines\n const newLines: BufferLine[] = [];\n for (let i = 0; i < linesToAdd; i++) {\n const newLine = this.getBlankLine(DEFAULT_ATTR_DATA, true) as BufferLine;\n newLines.push(newLine);\n }\n if (newLines.length > 0) {\n toInsert.push({\n // countToInsert here gets the actual index, taking into account other inserted items.\n // using this we can iterate through the list forwards\n start: y + wrappedLines.length + countToInsert,\n newLines\n });\n countToInsert += newLines.length;\n }\n wrappedLines.push(...newLines);\n\n // Copy buffer data to new locations, this needs to happen backwards to do in-place\n let destLineIndex = destLineLengths.length - 1; // Math.floor(cellsNeeded / newCols);\n let destCol = destLineLengths[destLineIndex]; // cellsNeeded % newCols;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n let srcLineIndex = wrappedLines.length - linesToAdd - 1;\n let srcCol = lastLineLength;\n while (srcLineIndex >= 0) {\n const cellsToCopy = Math.min(srcCol, destCol);\n if (wrappedLines[destLineIndex] === undefined) {\n // Sanity check that the line exists, this has been known to fail for an unknown reason\n // which would stop the reflow from happening if an exception would throw.\n break;\n }\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol - cellsToCopy, destCol - cellsToCopy, cellsToCopy, true);\n destCol -= cellsToCopy;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n srcCol -= cellsToCopy;\n if (srcCol === 0) {\n srcLineIndex--;\n const wrappedLinesIndex = Math.max(srcLineIndex, 0);\n srcCol = getWrappedLineTrimmedLength(wrappedLines, wrappedLinesIndex, this._cols);\n }\n }\n\n // Null out the end of the line ends if a wide character wrapped to the following line\n for (let i = 0; i < wrappedLines.length; i++) {\n if (destLineLengths[i] < newCols) {\n wrappedLines[i].setCell(destLineLengths[i], nullCell);\n }\n }\n\n // Adjust viewport as needed\n let viewportAdjustments = linesToAdd - trimmedLines;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y < newRows - 1) {\n this.y++;\n this.lines.pop();\n } else {\n this.ybase++;\n this.ydisp++;\n }\n } else {\n // Ensure ybase does not exceed its maximum value\n if (this.ybase < Math.min(this.lines.maxLength, this.lines.length + countToInsert) - newRows) {\n if (this.ybase === this.ydisp) {\n this.ydisp++;\n }\n this.ybase++;\n }\n }\n }\n this.savedY = Math.min(this.savedY + linesToAdd, this.ybase + newRows - 1);\n }\n\n // Rearrange lines in the buffer if there are any insertions, this is done at the end rather\n // than earlier so that it's a single O(n) pass through the buffer, instead of O(n^2) from many\n // costly calls to CircularList.splice.\n if (toInsert.length > 0) {\n // Record buffer insert events and then play them back backwards so that the indexes are\n // correct\n const insertEvents: IInsertEvent[] = [];\n\n // Record original lines so they don't get overridden when we rearrange the list\n const originalLines: BufferLine[] = [];\n for (let i = 0; i < this.lines.length; i++) {\n originalLines.push(this.lines.get(i) as BufferLine);\n }\n const originalLinesLength = this.lines.length;\n\n let originalLineIndex = originalLinesLength - 1;\n let nextToInsertIndex = 0;\n let nextToInsert = toInsert[nextToInsertIndex];\n this.lines.length = Math.min(this.lines.maxLength, this.lines.length + countToInsert);\n let countInsertedSoFar = 0;\n for (let i = Math.min(this.lines.maxLength - 1, originalLinesLength + countToInsert - 1); i >= 0; i--) {\n if (nextToInsert && nextToInsert.start > originalLineIndex + countInsertedSoFar) {\n // Insert extra lines here, adjusting i as needed\n for (let nextI = nextToInsert.newLines.length - 1; nextI >= 0; nextI--) {\n this.lines.set(i--, nextToInsert.newLines[nextI]);\n }\n i++;\n\n // Create insert events for later\n insertEvents.push({\n index: originalLineIndex + 1,\n amount: nextToInsert.newLines.length\n });\n\n countInsertedSoFar += nextToInsert.newLines.length;\n nextToInsert = toInsert[++nextToInsertIndex];\n } else {\n this.lines.set(i, originalLines[originalLineIndex--]);\n }\n }\n\n // Update markers\n let insertCountEmitted = 0;\n for (let i = insertEvents.length - 1; i >= 0; i--) {\n insertEvents[i].index += insertCountEmitted;\n this.lines.onInsertEmitter.fire(insertEvents[i]);\n insertCountEmitted += insertEvents[i].amount;\n }\n const amountToTrim = Math.max(0, originalLinesLength + countToInsert - this.lines.maxLength);\n if (amountToTrim > 0) {\n this.lines.onTrimEmitter.fire(amountToTrim);\n }\n }\n }\n\n // private _reflowSmallerGetLinesNeeded()\n\n /**\n * Translates a string index back to a BufferIndex.\n * To get the correct buffer position the string must start at `startCol` 0\n * (default in translateBufferLineToString).\n * The method also works on wrapped line strings given rows were not trimmed.\n * The method operates on the CharData string length, there are no\n * additional content or boundary checks. Therefore the string and the buffer\n * should not be altered in between.\n * TODO: respect trim flag after fixing #1685\n * @param lineIndex line index the string was retrieved from\n * @param stringIndex index within the string\n * @param trimRight Whether to trim whitespace to the right.\n */\n public stringIndexToBufferIndex(lineIndex: number, stringIndex: number, trimRight: boolean = false): BufferIndex {\n while (stringIndex) {\n const line = this.lines.get(lineIndex);\n if (!line) {\n return [-1, -1];\n }\n const length = (trimRight) ? line.getTrimmedLength() : line.length;\n for (let i = 0; i < length; ++i) {\n if (line.get(i)[CHAR_DATA_WIDTH_INDEX]) {\n // empty cells report a string length of 0, but get replaced\n // with a whitespace in translateToString, thus replace with 1\n stringIndex -= line.get(i)[CHAR_DATA_CHAR_INDEX].length || 1;\n }\n if (stringIndex < 0) {\n return [lineIndex, i];\n }\n }\n lineIndex++;\n }\n return [lineIndex, 0];\n }\n\n /**\n * Translates a buffer line to a string, with optional start and end columns.\n * Wide characters will count as two columns in the resulting string. This\n * function is useful for getting the actual text underneath the raw selection\n * position.\n * @param lineIndex The absolute index of the line being translated.\n * @param trimRight Whether to trim whitespace to the right.\n * @param startCol The column to start at.\n * @param endCol The column to end at.\n */\n public translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol: number = 0, endCol?: number): string {\n const line = this.lines.get(lineIndex);\n if (!line) {\n return '';\n }\n return line.translateToString(trimRight, startCol, endCol);\n }\n\n public getWrappedRangeForLine(y: number): { first: number, last: number } {\n let first = y;\n let last = y;\n // Scan upwards for wrapped lines\n while (first > 0 && this.lines.get(first)!.isWrapped) {\n first--;\n }\n // Scan downwards for wrapped lines\n while (last + 1 < this.lines.length && this.lines.get(last + 1)!.isWrapped) {\n last++;\n }\n return { first, last };\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n if (i !== null && i !== undefined) {\n if (!this.tabs[i]) {\n i = this.prevStop(i);\n }\n } else {\n this.tabs = {};\n i = 0;\n }\n\n for (; i < this._cols; i += this._optionsService.rawOptions.tabStopWidth) {\n this.tabs[i] = true;\n }\n }\n\n /**\n * Move the cursor to the previous tab stop from the given position (default is current).\n * @param x The position to move the cursor to the previous tab stop.\n */\n public prevStop(x?: number): number {\n if (x === null || x === undefined) {\n x = this.x;\n }\n while (!this.tabs[--x] && x > 0);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Move the cursor one tab stop forward from the given position (default is current).\n * @param x The position to move the cursor one tab stop forward.\n */\n public nextStop(x?: number): number {\n if (x === null || x === undefined) {\n x = this.x;\n }\n while (!this.tabs[++x] && x < this._cols);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Clears markers on single line.\n * @param y The line to clear.\n */\n public clearMarkers(y: number): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n if (this.markers[i].line === y) {\n this.markers[i].dispose();\n this.markers.splice(i--, 1);\n }\n }\n this._isClearing = false;\n }\n\n /**\n * Clears markers on all lines\n */\n public clearAllMarkers(): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n this.markers[i].dispose();\n this.markers.splice(i--, 1);\n }\n this._isClearing = false;\n }\n\n public addMarker(y: number): Marker {\n const marker = new Marker(y);\n this.markers.push(marker);\n marker.register(this.lines.onTrim(amount => {\n marker.line -= amount;\n // The marker should be disposed when the line is trimmed from the buffer\n if (marker.line < 0) {\n marker.dispose();\n }\n }));\n marker.register(this.lines.onInsert(event => {\n if (marker.line >= event.index) {\n marker.line += event.amount;\n }\n }));\n marker.register(this.lines.onDelete(event => {\n // Delete the marker if it's within the range\n if (marker.line >= event.index && marker.line < event.index + event.amount) {\n marker.dispose();\n }\n\n // Shift the marker if it's after the deleted range\n if (marker.line > event.index) {\n marker.line -= event.amount;\n }\n }));\n marker.register(marker.onDispose(() => this._removeMarker(marker)));\n return marker;\n }\n\n private _removeMarker(marker: Marker): void {\n if (!this._isClearing) {\n this.markers.splice(this.markers.indexOf(marker), 1);\n }\n }\n\n public iterator(trimRight: boolean, startIndex?: number, endIndex?: number, startOverscan?: number, endOverscan?: number): IBufferStringIterator {\n return new BufferStringIterator(this, trimRight, startIndex, endIndex, startOverscan, endOverscan);\n }\n}\n\n/**\n * Iterator to get unwrapped content strings from the buffer.\n * The iterator returns at least the string data between the borders\n * `startIndex` and `endIndex` (exclusive) and will expand the lines\n * by `startOverscan` to the top and by `endOverscan` to the bottom,\n * if no new line was found in between.\n * It will never read/return string data beyond `startIndex - startOverscan`\n * or `endIndex + endOverscan`. Therefore the first and last line might be truncated.\n * It is possible to always get the full string for the first and last line as well\n * by setting the overscan values to the actual buffer length. This not recommended\n * since it might return the whole buffer within a single string in a worst case scenario.\n */\nexport class BufferStringIterator implements IBufferStringIterator {\n private _current: number;\n\n constructor(\n private _buffer: IBuffer,\n private _trimRight: boolean,\n private _startIndex: number = 0,\n private _endIndex: number = _buffer.lines.length,\n private _startOverscan: number = 0,\n private _endOverscan: number = 0\n ) {\n if (this._startIndex < 0) {\n this._startIndex = 0;\n }\n if (this._endIndex > this._buffer.lines.length) {\n this._endIndex = this._buffer.lines.length;\n }\n this._current = this._startIndex;\n }\n\n public hasNext(): boolean {\n return this._current < this._endIndex;\n }\n\n public next(): IBufferStringIteratorResult {\n const range = this._buffer.getWrappedRangeForLine(this._current);\n // limit search window to overscan value at both borders\n if (range.first < this._startIndex - this._startOverscan) {\n range.first = this._startIndex - this._startOverscan;\n }\n if (range.last > this._endIndex + this._endOverscan) {\n range.last = this._endIndex + this._endOverscan;\n }\n // limit to current buffer length\n range.first = Math.max(range.first, 0);\n range.last = Math.min(range.last, this._buffer.lines.length);\n let content = '';\n for (let i = range.first; i <= range.last; ++i) {\n content += this._buffer.translateBufferLineToString(i, this._trimRight);\n }\n this._current = range.last + 1;\n return { range, content };\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IBufferLine, ICellData, IAttributeData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, WHITESPACE_CELL_CHAR, Content, BgFlags, FgFlags } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\n\n/**\n * buffer memory layout:\n *\n * | uint32_t | uint32_t | uint32_t |\n * | `content` | `FG` | `BG` |\n * | wcwidth(2) comb(1) codepoint(21) | flags(8) R(8) G(8) B(8) | flags(8) R(8) G(8) B(8) |\n */\n\n\n/** typed array slots taken by one cell */\nconst CELL_SIZE = 3;\n\n/**\n * Cell member indices.\n *\n * Direct access:\n * `content = data[column * CELL_SIZE + Cell.CONTENT];`\n * `fg = data[column * CELL_SIZE + Cell.FG];`\n * `bg = data[column * CELL_SIZE + Cell.BG];`\n */\nconst enum Cell {\n CONTENT = 0,\n FG = 1, // currently simply holds all known attrs\n BG = 2 // currently unused\n}\n\nexport const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());\n\n// Work variables to avoid garbage collection\nlet $startIndex = 0;\n\n/** Factor when to cleanup underlying array buffer after shrinking. */\nconst CLEANUP_THRESHOLD = 2;\n\n/**\n * Typed array based bufferline implementation.\n *\n * There are 2 ways to insert data into the cell buffer:\n * - `setCellFromCodepoint` + `addCodepointToCell`\n * Use these for data that is already UTF32.\n * Used during normal input in `InputHandler` for faster buffer access.\n * - `setCell`\n * This method takes a CellData object and stores the data in the buffer.\n * Use `CellData.fromCharData` to create the CellData object (e.g. from JS string).\n *\n * To retrieve data from the buffer use either one of the primitive methods\n * (if only one particular value is needed) or `loadCell`. For `loadCell` in a loop\n * memory allocs / GC pressure can be greatly reduced by reusing the CellData object.\n */\nexport class BufferLine implements IBufferLine {\n protected _data: Uint32Array;\n protected _combined: {[index: number]: string} = {};\n protected _extendedAttrs: {[index: number]: IExtendedAttrs | undefined} = {};\n public length: number;\n\n constructor(cols: number, fillCellData?: ICellData, public isWrapped: boolean = false) {\n this._data = new Uint32Array(cols * CELL_SIZE);\n const cell = fillCellData || CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n for (let i = 0; i < cols; ++i) {\n this.setCell(i, cell);\n }\n this.length = cols;\n }\n\n /**\n * Get cell data CharData.\n * @deprecated\n */\n public get(index: number): CharData {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n return [\n this._data[index * CELL_SIZE + Cell.FG],\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index]\n : (cp) ? stringFromCodePoint(cp) : '',\n content >> Content.WIDTH_SHIFT,\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index].charCodeAt(this._combined[index].length - 1)\n : cp\n ];\n }\n\n /**\n * Set cell data from CharData.\n * @deprecated\n */\n public set(index: number, value: CharData): void {\n this._data[index * CELL_SIZE + Cell.FG] = value[CHAR_DATA_ATTR_INDEX];\n if (value[CHAR_DATA_CHAR_INDEX].length > 1) {\n this._combined[index] = value[1];\n this._data[index * CELL_SIZE + Cell.CONTENT] = index | Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n } else {\n this._data[index * CELL_SIZE + Cell.CONTENT] = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n\n /**\n * primitive getters\n * use these when only one value is needed, otherwise use `loadCell`\n */\n public getWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT;\n }\n\n /** Test whether content has width. */\n public hasWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.WIDTH_MASK;\n }\n\n /** Get FG cell component. */\n public getFg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.FG];\n }\n\n /** Get BG cell component. */\n public getBg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG];\n }\n\n /**\n * Test whether contains any chars.\n * Basically an empty has no content, but other cells might differ in FG/BG\n * from real empty cells.\n */\n public hasContent(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK;\n }\n\n /**\n * Get codepoint of the cell.\n * To be in line with `code` in CharData this either returns\n * a single UTF32 codepoint or the last codepoint of a combined string.\n */\n public getCodePoint(index: number): number {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index].charCodeAt(this._combined[index].length - 1);\n }\n return content & Content.CODEPOINT_MASK;\n }\n\n /** Test whether the cell contains a combined string. */\n public isCombined(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.IS_COMBINED_MASK;\n }\n\n /** Returns the string content of the cell. */\n public getString(index: number): string {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index];\n }\n if (content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(content & Content.CODEPOINT_MASK);\n }\n // return empty string for empty cells\n return '';\n }\n\n /** Get state of protected flag. */\n public isProtected(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG] & BgFlags.PROTECTED;\n }\n\n /**\n * Load data at `index` into `cell`. This is used to access cells in a way that's more friendly\n * to GC as it significantly reduced the amount of new objects/references needed.\n */\n public loadCell(index: number, cell: ICellData): ICellData {\n $startIndex = index * CELL_SIZE;\n cell.content = this._data[$startIndex + Cell.CONTENT];\n cell.fg = this._data[$startIndex + Cell.FG];\n cell.bg = this._data[$startIndex + Cell.BG];\n if (cell.content & Content.IS_COMBINED_MASK) {\n cell.combinedData = this._combined[index];\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n cell.extended = this._extendedAttrs[index]!;\n }\n return cell;\n }\n\n /**\n * Set data at `index` to `cell`.\n */\n public setCell(index: number, cell: ICellData): void {\n if (cell.content & Content.IS_COMBINED_MASK) {\n this._combined[index] = cell.combinedData;\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = cell.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = cell.content;\n this._data[index * CELL_SIZE + Cell.FG] = cell.fg;\n this._data[index * CELL_SIZE + Cell.BG] = cell.bg;\n }\n\n /**\n * Set cell data from input handler.\n * Since the input handler see the incoming chars as UTF32 codepoints,\n * it gets an optimized access method.\n */\n public setCellFromCodePoint(index: number, codePoint: number, width: number, fg: number, bg: number, eAttrs: IExtendedAttrs): void {\n if (bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = eAttrs;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = codePoint | (width << Content.WIDTH_SHIFT);\n this._data[index * CELL_SIZE + Cell.FG] = fg;\n this._data[index * CELL_SIZE + Cell.BG] = bg;\n }\n\n /**\n * Add a codepoint to a cell from input handler.\n * During input stage combining chars with a width of 0 follow and stack\n * onto a leading char. Since we already set the attrs\n * by the previous `setDataFromCodePoint` call, we can omit it here.\n */\n public addCodepointToCell(index: number, codePoint: number): void {\n let content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n // we already have a combined string, simply add\n this._combined[index] += stringFromCodePoint(codePoint);\n } else {\n if (content & Content.CODEPOINT_MASK) {\n // normal case for combining chars:\n // - move current leading char + new one into combined string\n // - set combined flag\n this._combined[index] = stringFromCodePoint(content & Content.CODEPOINT_MASK) + stringFromCodePoint(codePoint);\n content &= ~Content.CODEPOINT_MASK; // set codepoint in buffer to 0\n content |= Content.IS_COMBINED_MASK;\n } else {\n // should not happen - we actually have no data in the cell yet\n // simply set the data in the cell buffer with a width of 1\n content = codePoint | (1 << Content.WIDTH_SHIFT);\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = content;\n }\n }\n\n public insertCells(pos: number, n: number, fillCellData: ICellData, eraseAttr?: IAttributeData): void {\n pos %= this.length;\n\n // handle fullwidth at pos: reset cell one to the left if pos is second cell of a wide char\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodePoint(pos - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n\n if (n < this.length - pos) {\n const cell = new CellData();\n for (let i = this.length - pos - n - 1; i >= 0; --i) {\n this.setCell(pos + n + i, this.loadCell(pos + i, cell));\n }\n for (let i = 0; i < n; ++i) {\n this.setCell(pos + i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at line end: reset last cell if it is first cell of a wide char\n if (this.getWidth(this.length - 1) === 2) {\n this.setCellFromCodePoint(this.length - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n }\n\n public deleteCells(pos: number, n: number, fillCellData: ICellData, eraseAttr?: IAttributeData): void {\n pos %= this.length;\n if (n < this.length - pos) {\n const cell = new CellData();\n for (let i = 0; i < this.length - pos - n; ++i) {\n this.setCell(pos + i, this.loadCell(pos + n + i, cell));\n }\n for (let i = this.length - n; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at pos:\n // - reset pos-1 if wide char\n // - reset pos if width==0 (previous second cell of a wide char)\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodePoint(pos - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n if (this.getWidth(pos) === 0 && !this.hasContent(pos)) {\n this.setCellFromCodePoint(pos, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n }\n\n public replaceCells(start: number, end: number, fillCellData: ICellData, eraseAttr?: IAttributeData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n if (start && this.getWidth(start - 1) === 2 && !this.isProtected(start - 1)) {\n this.setCellFromCodePoint(start - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n if (end < this.length && this.getWidth(end - 1) === 2 && !this.isProtected(end)) {\n this.setCellFromCodePoint(end, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n while (start < end && start < this.length) {\n if (!this.isProtected(start)) {\n this.setCell(start, fillCellData);\n }\n start++;\n }\n return;\n }\n\n // handle fullwidth at start: reset cell one to the left if start is second cell of a wide char\n if (start && this.getWidth(start - 1) === 2) {\n this.setCellFromCodePoint(start - 1, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n // handle fullwidth at last cell + 1: reset to empty cell if it is second part of a wide char\n if (end < this.length && this.getWidth(end - 1) === 2) {\n this.setCellFromCodePoint(end, 0, 1, eraseAttr?.fg || 0, eraseAttr?.bg || 0, eraseAttr?.extended || new ExtendedAttrs());\n }\n\n while (start < end && start < this.length) {\n this.setCell(start++, fillCellData);\n }\n }\n\n /**\n * Resize BufferLine to `cols` filling excess cells with `fillCellData`.\n * The underlying array buffer will not change if there is still enough space\n * to hold the new buffer line data.\n * Returns a boolean indicating, whether a `cleanupMemory` call would free\n * excess memory (true after shrinking > CLEANUP_THRESHOLD).\n */\n public resize(cols: number, fillCellData: ICellData): boolean {\n if (cols === this.length) {\n return this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n const uint32Cells = cols * CELL_SIZE;\n if (cols > this.length) {\n if (this._data.buffer.byteLength >= uint32Cells * 4) {\n // optimization: avoid alloc and data copy if buffer has enough room\n this._data = new Uint32Array(this._data.buffer, 0, uint32Cells);\n } else {\n // slow path: new alloc and full data copy\n const data = new Uint32Array(uint32Cells);\n data.set(this._data);\n this._data = data;\n }\n for (let i = this.length; i < cols; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n // optimization: just shrink the view on existing buffer\n this._data = this._data.subarray(0, uint32Cells);\n // Remove any cut off combined data\n const keys = Object.keys(this._combined);\n for (let i = 0; i < keys.length; i++) {\n const key = parseInt(keys[i], 10);\n if (key >= cols) {\n delete this._combined[key];\n }\n }\n // remove any cut off extended attributes\n const extKeys = Object.keys(this._extendedAttrs);\n for (let i = 0; i < extKeys.length; i++) {\n const key = parseInt(extKeys[i], 10);\n if (key >= cols) {\n delete this._extendedAttrs[key];\n }\n }\n }\n this.length = cols;\n return uint32Cells * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n\n /**\n * Cleanup underlying array buffer.\n * A cleanup will be triggered if the array buffer exceeds the actual used\n * memory by a factor of CLEANUP_THRESHOLD.\n * Returns 0 or 1 indicating whether a cleanup happened.\n */\n public cleanupMemory(): number {\n if (this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength) {\n const data = new Uint32Array(this._data.length);\n data.set(this._data);\n this._data = data;\n return 1;\n }\n return 0;\n }\n\n /** fill a line with fillCharData */\n public fill(fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n for (let i = 0; i < this.length; ++i) {\n if (!this.isProtected(i)) {\n this.setCell(i, fillCellData);\n }\n }\n return;\n }\n this._combined = {};\n this._extendedAttrs = {};\n for (let i = 0; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n /** alter to a full copy of line */\n public copyFrom(line: BufferLine): void {\n if (this.length !== line.length) {\n this._data = new Uint32Array(line._data);\n } else {\n // use high speed copy if lengths are equal\n this._data.set(line._data);\n }\n this.length = line.length;\n this._combined = {};\n for (const el in line._combined) {\n this._combined[el] = line._combined[el];\n }\n this._extendedAttrs = {};\n for (const el in line._extendedAttrs) {\n this._extendedAttrs[el] = line._extendedAttrs[el];\n }\n this.isWrapped = line.isWrapped;\n }\n\n /** create a new clone */\n public clone(): IBufferLine {\n const newLine = new BufferLine(0);\n newLine._data = new Uint32Array(this._data);\n newLine.length = this.length;\n for (const el in this._combined) {\n newLine._combined[el] = this._combined[el];\n }\n for (const el in this._extendedAttrs) {\n newLine._extendedAttrs[el] = this._extendedAttrs[el];\n }\n newLine.isWrapped = this.isWrapped;\n return newLine;\n }\n\n public getTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public copyCellsFrom(src: BufferLine, srcCol: number, destCol: number, length: number, applyInReverse: boolean): void {\n const srcData = src._data;\n if (applyInReverse) {\n for (let cell = length - 1; cell >= 0; cell--) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n } else {\n for (let cell = 0; cell < length; cell++) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n }\n\n // Move any combined data over as needed, FIXME: repeat for extended attrs\n const srcCombinedKeys = Object.keys(src._combined);\n for (let i = 0; i < srcCombinedKeys.length; i++) {\n const key = parseInt(srcCombinedKeys[i], 10);\n if (key >= srcCol) {\n this._combined[key - srcCol + destCol] = src._combined[key];\n }\n }\n }\n\n public translateToString(trimRight: boolean = false, startCol: number = 0, endCol: number = this.length): string {\n if (trimRight) {\n endCol = Math.min(endCol, this.getTrimmedLength());\n }\n let result = '';\n while (startCol < endCol) {\n const content = this._data[startCol * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n result += (content & Content.IS_COMBINED_MASK) ? this._combined[startCol] : (cp) ? stringFromCodePoint(cp) : WHITESPACE_CELL_CHAR;\n startCol += (content >> Content.WIDTH_SHIFT) || 1; // always advance by 1\n }\n return result;\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange } from 'xterm';\n\nexport function getRangeLength(range: IBufferRange, bufferCols: number): number {\n if (range.start.y > range.end.y) {\n throw new Error(`Buffer range end (${range.end.x}, ${range.end.y}) cannot be before start (${range.start.x}, ${range.start.y})`);\n }\n return bufferCols * (range.end.y - range.start.y) + (range.end.x - range.start.x + 1);\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { BufferLine } from 'common/buffer/BufferLine';\nimport { CircularList } from 'common/CircularList';\nimport { IBufferLine, ICellData } from 'common/Types';\n\nexport interface INewLayoutResult {\n layout: number[];\n countRemoved: number;\n}\n\n/**\n * Evaluates and returns indexes to be removed after a reflow larger occurs. Lines will be removed\n * when a wrapped line unwraps.\n * @param lines The buffer lines.\n * @param oldCols The columns before resize\n * @param newCols The columns after resize.\n * @param bufferAbsoluteY The absolute y position of the cursor (baseY + cursorY).\n * @param nullCell The cell data to use when filling in empty cells.\n */\nexport function reflowLargerGetLinesToRemove(lines: CircularList, oldCols: number, newCols: number, bufferAbsoluteY: number, nullCell: ICellData): number[] {\n // Gather all BufferLines that need to be removed from the Buffer here so that they can be\n // batched up and only committed once\n const toRemove: number[] = [];\n\n for (let y = 0; y < lines.length - 1; y++) {\n // Check if this row is wrapped\n let i = y;\n let nextLine = lines.get(++i) as BufferLine;\n if (!nextLine.isWrapped) {\n continue;\n }\n\n // Check how many lines it's wrapped for\n const wrappedLines: BufferLine[] = [lines.get(y) as BufferLine];\n while (i < lines.length && nextLine.isWrapped) {\n wrappedLines.push(nextLine);\n nextLine = lines.get(++i) as BufferLine;\n }\n\n // If these lines contain the cursor don't touch them, the program will handle fixing up wrapped\n // lines with the cursor\n if (bufferAbsoluteY >= y && bufferAbsoluteY < i) {\n y += wrappedLines.length - 1;\n continue;\n }\n\n // Copy buffer data to new locations\n let destLineIndex = 0;\n let destCol = getWrappedLineTrimmedLength(wrappedLines, destLineIndex, oldCols);\n let srcLineIndex = 1;\n let srcCol = 0;\n while (srcLineIndex < wrappedLines.length) {\n const srcTrimmedTineLength = getWrappedLineTrimmedLength(wrappedLines, srcLineIndex, oldCols);\n const srcRemainingCells = srcTrimmedTineLength - srcCol;\n const destRemainingCells = newCols - destCol;\n const cellsToCopy = Math.min(srcRemainingCells, destRemainingCells);\n\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol, destCol, cellsToCopy, false);\n\n destCol += cellsToCopy;\n if (destCol === newCols) {\n destLineIndex++;\n destCol = 0;\n }\n srcCol += cellsToCopy;\n if (srcCol === srcTrimmedTineLength) {\n srcLineIndex++;\n srcCol = 0;\n }\n\n // Make sure the last cell isn't wide, if it is copy it to the current dest\n if (destCol === 0 && destLineIndex !== 0) {\n if (wrappedLines[destLineIndex - 1].getWidth(newCols - 1) === 2) {\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[destLineIndex - 1], newCols - 1, destCol++, 1, false);\n // Null out the end of the last row\n wrappedLines[destLineIndex - 1].setCell(newCols - 1, nullCell);\n }\n }\n }\n\n // Clear out remaining cells or fragments could remain;\n wrappedLines[destLineIndex].replaceCells(destCol, newCols, nullCell);\n\n // Work backwards and remove any rows at the end that only contain null cells\n let countToRemove = 0;\n for (let i = wrappedLines.length - 1; i > 0; i--) {\n if (i > destLineIndex || wrappedLines[i].getTrimmedLength() === 0) {\n countToRemove++;\n } else {\n break;\n }\n }\n\n if (countToRemove > 0) {\n toRemove.push(y + wrappedLines.length - countToRemove); // index\n toRemove.push(countToRemove);\n }\n\n y += wrappedLines.length - 1;\n }\n return toRemove;\n}\n\n/**\n * Creates and return the new layout for lines given an array of indexes to be removed.\n * @param lines The buffer lines.\n * @param toRemove The indexes to remove.\n */\nexport function reflowLargerCreateNewLayout(lines: CircularList, toRemove: number[]): INewLayoutResult {\n const layout: number[] = [];\n // First iterate through the list and get the actual indexes to use for rows\n let nextToRemoveIndex = 0;\n let nextToRemoveStart = toRemove[nextToRemoveIndex];\n let countRemovedSoFar = 0;\n for (let i = 0; i < lines.length; i++) {\n if (nextToRemoveStart === i) {\n const countToRemove = toRemove[++nextToRemoveIndex];\n\n // Tell markers that there was a deletion\n lines.onDeleteEmitter.fire({\n index: i - countRemovedSoFar,\n amount: countToRemove\n });\n\n i += countToRemove - 1;\n countRemovedSoFar += countToRemove;\n nextToRemoveStart = toRemove[++nextToRemoveIndex];\n } else {\n layout.push(i);\n }\n }\n return {\n layout,\n countRemoved: countRemovedSoFar\n };\n}\n\n/**\n * Applies a new layout to the buffer. This essentially does the same as many splice calls but it's\n * done all at once in a single iteration through the list since splice is very expensive.\n * @param lines The buffer lines.\n * @param newLayout The new layout to apply.\n */\nexport function reflowLargerApplyNewLayout(lines: CircularList, newLayout: number[]): void {\n // Record original lines so they don't get overridden when we rearrange the list\n const newLayoutLines: BufferLine[] = [];\n for (let i = 0; i < newLayout.length; i++) {\n newLayoutLines.push(lines.get(newLayout[i]) as BufferLine);\n }\n\n // Rearrange the list\n for (let i = 0; i < newLayoutLines.length; i++) {\n lines.set(i, newLayoutLines[i]);\n }\n lines.length = newLayout.length;\n}\n\n/**\n * Gets the new line lengths for a given wrapped line. The purpose of this function it to pre-\n * compute the wrapping points since wide characters may need to be wrapped onto the following line.\n * This function will return an array of numbers of where each line wraps to, the resulting array\n * will only contain the values `newCols` (when the line does not end with a wide character) and\n * `newCols - 1` (when the line does end with a wide character), except for the last value which\n * will contain the remaining items to fill the line.\n *\n * Calling this with a `newCols` value of `1` will lock up.\n *\n * @param wrappedLines The wrapped lines to evaluate.\n * @param oldCols The columns before resize.\n * @param newCols The columns after resize.\n */\nexport function reflowSmallerGetNewLineLengths(wrappedLines: BufferLine[], oldCols: number, newCols: number): number[] {\n const newLineLengths: number[] = [];\n const cellsNeeded = wrappedLines.map((l, i) => getWrappedLineTrimmedLength(wrappedLines, i, oldCols)).reduce((p, c) => p + c);\n\n // Use srcCol and srcLine to find the new wrapping point, use that to get the cellsAvailable and\n // linesNeeded\n let srcCol = 0;\n let srcLine = 0;\n let cellsAvailable = 0;\n while (cellsAvailable < cellsNeeded) {\n if (cellsNeeded - cellsAvailable < newCols) {\n // Add the final line and exit the loop\n newLineLengths.push(cellsNeeded - cellsAvailable);\n break;\n }\n srcCol += newCols;\n const oldTrimmedLength = getWrappedLineTrimmedLength(wrappedLines, srcLine, oldCols);\n if (srcCol > oldTrimmedLength) {\n srcCol -= oldTrimmedLength;\n srcLine++;\n }\n const endsWithWide = wrappedLines[srcLine].getWidth(srcCol - 1) === 2;\n if (endsWithWide) {\n srcCol--;\n }\n const lineLength = endsWithWide ? newCols - 1 : newCols;\n newLineLengths.push(lineLength);\n cellsAvailable += lineLength;\n }\n\n return newLineLengths;\n}\n\nexport function getWrappedLineTrimmedLength(lines: BufferLine[], i: number, cols: number): number {\n // If this is the last row in the wrapped line, get the actual trimmed length\n if (i === lines.length - 1) {\n return lines[i].getTrimmedLength();\n }\n // Detect whether the following line starts with a wide character and the end of the current line\n // is null, if so then we can be pretty sure the null character should be excluded from the line\n // length]\n const endsInNull = !(lines[i].hasContent(cols - 1)) && lines[i].getWidth(cols - 1) === 1;\n const followingLineStartsWithWide = lines[i + 1].getWidth(0) === 2;\n if (endsInNull && followingLineStartsWithWide) {\n return cols - 1;\n }\n return cols;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IAttributeData } from 'common/Types';\nimport { Buffer } from 'common/buffer/Buffer';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { IOptionsService, IBufferService } from 'common/services/Services';\nimport { Disposable } from 'common/Lifecycle';\n\n/**\n * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and\n * provides also utilities for working with them.\n */\nexport class BufferSet extends Disposable implements IBufferSet {\n private _normal!: Buffer;\n private _alt!: Buffer;\n private _activeBuffer!: Buffer;\n\n private readonly _onBufferActivate = this.register(new EventEmitter<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}>());\n public readonly onBufferActivate = this._onBufferActivate.event;\n\n /**\n * Create a new BufferSet for the given terminal.\n */\n constructor(\n private readonly _optionsService: IOptionsService,\n private readonly _bufferService: IBufferService\n ) {\n super();\n this.reset();\n this.register(this._optionsService.onSpecificOptionChange('scrollback', () => this.resize(this._bufferService.cols, this._bufferService.rows)));\n this.register(this._optionsService.onSpecificOptionChange('tabStopWidth', () => this.setupTabStops()));\n }\n\n public reset(): void {\n this._normal = new Buffer(true, this._optionsService, this._bufferService);\n this._normal.fillViewportRows();\n\n // The alt buffer should never have scrollback.\n // See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer\n this._alt = new Buffer(false, this._optionsService, this._bufferService);\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n\n this.setupTabStops();\n }\n\n /**\n * Returns the alt Buffer of the BufferSet\n */\n public get alt(): Buffer {\n return this._alt;\n }\n\n /**\n * Returns the currently active Buffer of the BufferSet\n */\n public get active(): Buffer {\n return this._activeBuffer;\n }\n\n /**\n * Returns the normal Buffer of the BufferSet\n */\n public get normal(): Buffer {\n return this._normal;\n }\n\n /**\n * Sets the normal Buffer of the BufferSet as its currently active Buffer\n */\n public activateNormalBuffer(): void {\n if (this._activeBuffer === this._normal) {\n return;\n }\n this._normal.x = this._alt.x;\n this._normal.y = this._alt.y;\n // The alt buffer should always be cleared when we switch to the normal\n // buffer. This frees up memory since the alt buffer should always be new\n // when activated.\n this._alt.clearAllMarkers();\n this._alt.clear();\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n }\n\n /**\n * Sets the alt Buffer of the BufferSet as its currently active Buffer\n */\n public activateAltBuffer(fillAttr?: IAttributeData): void {\n if (this._activeBuffer === this._alt) {\n return;\n }\n // Since the alt buffer is always cleared when the normal buffer is\n // activated, we want to fill it when switching to it.\n this._alt.fillViewportRows(fillAttr);\n this._alt.x = this._normal.x;\n this._alt.y = this._normal.y;\n this._activeBuffer = this._alt;\n this._onBufferActivate.fire({\n activeBuffer: this._alt,\n inactiveBuffer: this._normal\n });\n }\n\n /**\n * Resizes both normal and alt buffers, adjusting their data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n this._normal.resize(newCols, newRows);\n this._alt.resize(newCols, newRows);\n this.setupTabStops(newCols);\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n this._normal.setupTabStops(i);\n this._alt.setupTabStops(i);\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, ICellData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\n\n/**\n * CellData - represents a single Cell in the terminal buffer.\n */\nexport class CellData extends AttributeData implements ICellData {\n /** Helper to create CellData from CharData. */\n public static fromCharData(value: CharData): CellData {\n const obj = new CellData();\n obj.setFromCharData(value);\n return obj;\n }\n /** Primitives from terminal buffer. */\n public content = 0;\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n public combinedData = '';\n /** Whether cell contains a combined string. */\n public isCombined(): number {\n return this.content & Content.IS_COMBINED_MASK;\n }\n /** Width of the cell. */\n public getWidth(): number {\n return this.content >> Content.WIDTH_SHIFT;\n }\n /** JS string of the content. */\n public getChars(): string {\n if (this.content & Content.IS_COMBINED_MASK) {\n return this.combinedData;\n }\n if (this.content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(this.content & Content.CODEPOINT_MASK);\n }\n return '';\n }\n /**\n * Codepoint of cell\n * Note this returns the UTF32 codepoint of single chars,\n * if content is a combined string it returns the codepoint\n * of the last char in string to be in line with code in CharData.\n */\n public getCode(): number {\n return (this.isCombined())\n ? this.combinedData.charCodeAt(this.combinedData.length - 1)\n : this.content & Content.CODEPOINT_MASK;\n }\n /** Set data from CharData */\n public setFromCharData(value: CharData): void {\n this.fg = value[CHAR_DATA_ATTR_INDEX];\n this.bg = 0;\n let combined = false;\n // surrogates and combined strings need special treatment\n if (value[CHAR_DATA_CHAR_INDEX].length > 2) {\n combined = true;\n }\n else if (value[CHAR_DATA_CHAR_INDEX].length === 2) {\n const code = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0);\n // if the 2-char string is a surrogate create single codepoint\n // everything else is combined\n if (0xD800 <= code && code <= 0xDBFF) {\n const second = value[CHAR_DATA_CHAR_INDEX].charCodeAt(1);\n if (0xDC00 <= second && second <= 0xDFFF) {\n this.content = ((code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n else {\n combined = true;\n }\n }\n else {\n combined = true;\n }\n }\n else {\n this.content = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n if (combined) {\n this.combinedData = value[CHAR_DATA_CHAR_INDEX];\n this.content = Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n /** Get data as CharData. */\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport const DEFAULT_COLOR = 0;\nexport const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);\nexport const DEFAULT_EXT = 0;\n\nexport const CHAR_DATA_ATTR_INDEX = 0;\nexport const CHAR_DATA_CHAR_INDEX = 1;\nexport const CHAR_DATA_WIDTH_INDEX = 2;\nexport const CHAR_DATA_CODE_INDEX = 3;\n\n/**\n * Null cell - a real empty cell (containing nothing).\n * Note that code should always be 0 for a null cell as\n * several test condition of the buffer line rely on this.\n */\nexport const NULL_CELL_CHAR = '';\nexport const NULL_CELL_WIDTH = 1;\nexport const NULL_CELL_CODE = 0;\n\n/**\n * Whitespace cell.\n * This is meant as a replacement for empty cells when needed\n * during rendering lines to preserve correct aligment.\n */\nexport const WHITESPACE_CELL_CHAR = ' ';\nexport const WHITESPACE_CELL_WIDTH = 1;\nexport const WHITESPACE_CELL_CODE = 32;\n\n/**\n * Bitmasks for accessing data in `content`.\n */\nexport const enum Content {\n /**\n * bit 1..21 codepoint, max allowed in UTF32 is 0x10FFFF (21 bits taken)\n * read: `codepoint = content & Content.codepointMask;`\n * write: `content |= codepoint & Content.codepointMask;`\n * shortcut if precondition `codepoint <= 0x10FFFF` is met:\n * `content |= codepoint;`\n */\n CODEPOINT_MASK = 0x1FFFFF,\n\n /**\n * bit 22 flag indication whether a cell contains combined content\n * read: `isCombined = content & Content.isCombined;`\n * set: `content |= Content.isCombined;`\n * clear: `content &= ~Content.isCombined;`\n */\n IS_COMBINED_MASK = 0x200000, // 1 << 21\n\n /**\n * bit 1..22 mask to check whether a cell contains any string data\n * we need to check for codepoint and isCombined bits to see\n * whether a cell contains anything\n * read: `isEmpty = !(content & Content.hasContent)`\n */\n HAS_CONTENT_MASK = 0x3FFFFF,\n\n /**\n * bit 23..24 wcwidth value of cell, takes 2 bits (ranges from 0..2)\n * read: `width = (content & Content.widthMask) >> Content.widthShift;`\n * `hasWidth = content & Content.widthMask;`\n * as long as wcwidth is highest value in `content`:\n * `width = content >> Content.widthShift;`\n * write: `content |= (width << Content.widthShift) & Content.widthMask;`\n * shortcut if precondition `0 <= width <= 3` is met:\n * `content |= width << Content.widthShift;`\n */\n WIDTH_MASK = 0xC00000, // 3 << 22\n WIDTH_SHIFT = 22\n}\n\nexport const enum Attributes {\n /**\n * bit 1..8 blue in RGB, color in P256 and P16\n */\n BLUE_MASK = 0xFF,\n BLUE_SHIFT = 0,\n PCOLOR_MASK = 0xFF,\n PCOLOR_SHIFT = 0,\n\n /**\n * bit 9..16 green in RGB\n */\n GREEN_MASK = 0xFF00,\n GREEN_SHIFT = 8,\n\n /**\n * bit 17..24 red in RGB\n */\n RED_MASK = 0xFF0000,\n RED_SHIFT = 16,\n\n /**\n * bit 25..26 color mode: DEFAULT (0) | P16 (1) | P256 (2) | RGB (3)\n */\n CM_MASK = 0x3000000,\n CM_DEFAULT = 0,\n CM_P16 = 0x1000000,\n CM_P256 = 0x2000000,\n CM_RGB = 0x3000000,\n\n /**\n * bit 1..24 RGB room\n */\n RGB_MASK = 0xFFFFFF\n}\n\nexport const enum FgFlags {\n /**\n * bit 27..32\n */\n INVERSE = 0x4000000,\n BOLD = 0x8000000,\n UNDERLINE = 0x10000000,\n BLINK = 0x20000000,\n INVISIBLE = 0x40000000,\n STRIKETHROUGH = 0x80000000,\n}\n\nexport const enum BgFlags {\n /**\n * bit 27..32 (upper 2 unused)\n */\n ITALIC = 0x4000000,\n DIM = 0x8000000,\n HAS_EXTENDED = 0x10000000,\n PROTECTED = 0x20000000\n}\n\nexport const enum ExtFlags {\n /**\n * bit 27..32 (upper 3 unused)\n */\n UNDERLINE_STYLE = 0x1C000000\n}\n\nexport const enum UnderlineStyle {\n NONE = 0,\n SINGLE = 1,\n DOUBLE = 2,\n CURLY = 3,\n DOTTED = 4,\n DASHED = 5\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { EventEmitter } from 'common/EventEmitter';\nimport { disposeArray } from 'common/Lifecycle';\nimport { IDisposable, IMarker } from 'common/Types';\n\nexport class Marker implements IMarker {\n private static _nextId = 1;\n\n public isDisposed: boolean = false;\n private _disposables: IDisposable[] = [];\n\n private _id: number = Marker._nextId++;\n public get id(): number { return this._id; }\n\n private readonly _onDispose = this.register(new EventEmitter());\n public readonly onDispose = this._onDispose.event;\n\n constructor(\n public line: number\n ) {\n }\n\n public dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n this.line = -1;\n // Emit before super.dispose such that dispose listeners get a change to react\n this._onDispose.fire();\n disposeArray(this._disposables);\n this._disposables.length = 0;\n }\n\n public register(disposable: T): T {\n this._disposables.push(disposable);\n return disposable;\n }\n}\n","/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharset } from 'common/Types';\n\n/**\n * The character sets supported by the terminal. These enable several languages\n * to be represented within the terminal with only 8-bit encoding. See ISO 2022\n * for a discussion on character sets. Only VT100 character sets are supported.\n */\nexport const CHARSETS: { [key: string]: ICharset | undefined } = {};\n\n/**\n * The default character set, US.\n */\nexport const DEFAULT_CHARSET: ICharset | undefined = CHARSETS['B'];\n\n/**\n * DEC Special Character and Line Drawing Set.\n * Reference: http://vt100.net/docs/vt102-ug/table5-13.html\n * A lot of curses apps use this if they see TERM=xterm.\n * testing: echo -e '\\e(0a\\e(B'\n * The xterm output sometimes seems to conflict with the\n * reference above. xterm seems in line with the reference\n * when running vttest however.\n * The table below now uses xterm's output from vttest.\n */\nCHARSETS['0'] = {\n '`': '\\u25c6', // '◆'\n 'a': '\\u2592', // '▒'\n 'b': '\\u2409', // '␉' (HT)\n 'c': '\\u240c', // '␌' (FF)\n 'd': '\\u240d', // '␍' (CR)\n 'e': '\\u240a', // '␊' (LF)\n 'f': '\\u00b0', // '°'\n 'g': '\\u00b1', // '±'\n 'h': '\\u2424', // '␤' (NL)\n 'i': '\\u240b', // '␋' (VT)\n 'j': '\\u2518', // '┘'\n 'k': '\\u2510', // '┐'\n 'l': '\\u250c', // '┌'\n 'm': '\\u2514', // '└'\n 'n': '\\u253c', // '┼'\n 'o': '\\u23ba', // '⎺'\n 'p': '\\u23bb', // '⎻'\n 'q': '\\u2500', // '─'\n 'r': '\\u23bc', // '⎼'\n 's': '\\u23bd', // '⎽'\n 't': '\\u251c', // '├'\n 'u': '\\u2524', // '┤'\n 'v': '\\u2534', // '┴'\n 'w': '\\u252c', // '┬'\n 'x': '\\u2502', // '│'\n 'y': '\\u2264', // '≤'\n 'z': '\\u2265', // '≥'\n '{': '\\u03c0', // 'π'\n '|': '\\u2260', // '≠'\n '}': '\\u00a3', // '£'\n '~': '\\u00b7' // '·'\n};\n\n/**\n * British character set\n * ESC (A\n * Reference: http://vt100.net/docs/vt220-rm/table2-5.html\n */\nCHARSETS['A'] = {\n '#': '£'\n};\n\n/**\n * United States character set\n * ESC (B\n */\nCHARSETS['B'] = undefined;\n\n/**\n * Dutch character set\n * ESC (4\n * Reference: http://vt100.net/docs/vt220-rm/table2-6.html\n */\nCHARSETS['4'] = {\n '#': '£',\n '@': '¾',\n '[': 'ij',\n '\\\\': '½',\n ']': '|',\n '{': '¨',\n '|': 'f',\n '}': '¼',\n '~': '´'\n};\n\n/**\n * Finnish character set\n * ESC (C or ESC (5\n * Reference: http://vt100.net/docs/vt220-rm/table2-7.html\n */\nCHARSETS['C'] =\nCHARSETS['5'] = {\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Å',\n '^': 'Ü',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * French character set\n * ESC (R\n * Reference: http://vt100.net/docs/vt220-rm/table2-8.html\n */\nCHARSETS['R'] = {\n '#': '£',\n '@': 'à',\n '[': '°',\n '\\\\': 'ç',\n ']': '§',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': '¨'\n};\n\n/**\n * French Canadian character set\n * ESC (Q\n * Reference: http://vt100.net/docs/vt220-rm/table2-9.html\n */\nCHARSETS['Q'] = {\n '@': 'à',\n '[': 'â',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n '`': 'ô',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': 'û'\n};\n\n/**\n * German character set\n * ESC (K\n * Reference: http://vt100.net/docs/vt220-rm/table2-10.html\n */\nCHARSETS['K'] = {\n '@': '§',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Ü',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'ß'\n};\n\n/**\n * Italian character set\n * ESC (Y\n * Reference: http://vt100.net/docs/vt220-rm/table2-11.html\n */\nCHARSETS['Y'] = {\n '#': '£',\n '@': '§',\n '[': '°',\n '\\\\': 'ç',\n ']': 'é',\n '`': 'ù',\n '{': 'à',\n '|': 'ò',\n '}': 'è',\n '~': 'ì'\n};\n\n/**\n * Norwegian/Danish character set\n * ESC (E or ESC (6\n * Reference: http://vt100.net/docs/vt220-rm/table2-12.html\n */\nCHARSETS['E'] =\nCHARSETS['6'] = {\n '@': 'Ä',\n '[': 'Æ',\n '\\\\': 'Ø',\n ']': 'Å',\n '^': 'Ü',\n '`': 'ä',\n '{': 'æ',\n '|': 'ø',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * Spanish character set\n * ESC (Z\n * Reference: http://vt100.net/docs/vt220-rm/table2-13.html\n */\nCHARSETS['Z'] = {\n '#': '£',\n '@': '§',\n '[': '¡',\n '\\\\': 'Ñ',\n ']': '¿',\n '{': '°',\n '|': 'ñ',\n '}': 'ç'\n};\n\n/**\n * Swedish character set\n * ESC (H or ESC (7\n * Reference: http://vt100.net/docs/vt220-rm/table2-14.html\n */\nCHARSETS['H'] =\nCHARSETS['7'] = {\n '@': 'É',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Å',\n '^': 'Ü',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'å',\n '~': 'ü'\n};\n\n/**\n * Swiss character set\n * ESC (=\n * Reference: http://vt100.net/docs/vt220-rm/table2-15.html\n */\nCHARSETS['='] = {\n '#': 'ù',\n '@': 'à',\n '[': 'é',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n '_': 'è',\n '`': 'ô',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'û'\n};\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * C0 control codes\n * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n */\nexport namespace C0 {\n /** Null (Caret = ^@, C = \\0) */\n export const NUL = '\\x00';\n /** Start of Heading (Caret = ^A) */\n export const SOH = '\\x01';\n /** Start of Text (Caret = ^B) */\n export const STX = '\\x02';\n /** End of Text (Caret = ^C) */\n export const ETX = '\\x03';\n /** End of Transmission (Caret = ^D) */\n export const EOT = '\\x04';\n /** Enquiry (Caret = ^E) */\n export const ENQ = '\\x05';\n /** Acknowledge (Caret = ^F) */\n export const ACK = '\\x06';\n /** Bell (Caret = ^G, C = \\a) */\n export const BEL = '\\x07';\n /** Backspace (Caret = ^H, C = \\b) */\n export const BS = '\\x08';\n /** Character Tabulation, Horizontal Tabulation (Caret = ^I, C = \\t) */\n export const HT = '\\x09';\n /** Line Feed (Caret = ^J, C = \\n) */\n export const LF = '\\x0a';\n /** Line Tabulation, Vertical Tabulation (Caret = ^K, C = \\v) */\n export const VT = '\\x0b';\n /** Form Feed (Caret = ^L, C = \\f) */\n export const FF = '\\x0c';\n /** Carriage Return (Caret = ^M, C = \\r) */\n export const CR = '\\x0d';\n /** Shift Out (Caret = ^N) */\n export const SO = '\\x0e';\n /** Shift In (Caret = ^O) */\n export const SI = '\\x0f';\n /** Data Link Escape (Caret = ^P) */\n export const DLE = '\\x10';\n /** Device Control One (XON) (Caret = ^Q) */\n export const DC1 = '\\x11';\n /** Device Control Two (Caret = ^R) */\n export const DC2 = '\\x12';\n /** Device Control Three (XOFF) (Caret = ^S) */\n export const DC3 = '\\x13';\n /** Device Control Four (Caret = ^T) */\n export const DC4 = '\\x14';\n /** Negative Acknowledge (Caret = ^U) */\n export const NAK = '\\x15';\n /** Synchronous Idle (Caret = ^V) */\n export const SYN = '\\x16';\n /** End of Transmission Block (Caret = ^W) */\n export const ETB = '\\x17';\n /** Cancel (Caret = ^X) */\n export const CAN = '\\x18';\n /** End of Medium (Caret = ^Y) */\n export const EM = '\\x19';\n /** Substitute (Caret = ^Z) */\n export const SUB = '\\x1a';\n /** Escape (Caret = ^[, C = \\e) */\n export const ESC = '\\x1b';\n /** File Separator (Caret = ^\\) */\n export const FS = '\\x1c';\n /** Group Separator (Caret = ^]) */\n export const GS = '\\x1d';\n /** Record Separator (Caret = ^^) */\n export const RS = '\\x1e';\n /** Unit Separator (Caret = ^_) */\n export const US = '\\x1f';\n /** Space */\n export const SP = '\\x20';\n /** Delete (Caret = ^?) */\n export const DEL = '\\x7f';\n}\n\n/**\n * C1 control codes\n * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n */\nexport namespace C1 {\n /** padding character */\n export const PAD = '\\x80';\n /** High Octet Preset */\n export const HOP = '\\x81';\n /** Break Permitted Here */\n export const BPH = '\\x82';\n /** No Break Here */\n export const NBH = '\\x83';\n /** Index */\n export const IND = '\\x84';\n /** Next Line */\n export const NEL = '\\x85';\n /** Start of Selected Area */\n export const SSA = '\\x86';\n /** End of Selected Area */\n export const ESA = '\\x87';\n /** Horizontal Tabulation Set */\n export const HTS = '\\x88';\n /** Horizontal Tabulation With Justification */\n export const HTJ = '\\x89';\n /** Vertical Tabulation Set */\n export const VTS = '\\x8a';\n /** Partial Line Down */\n export const PLD = '\\x8b';\n /** Partial Line Up */\n export const PLU = '\\x8c';\n /** Reverse Index */\n export const RI = '\\x8d';\n /** Single-Shift 2 */\n export const SS2 = '\\x8e';\n /** Single-Shift 3 */\n export const SS3 = '\\x8f';\n /** Device Control String */\n export const DCS = '\\x90';\n /** Private Use 1 */\n export const PU1 = '\\x91';\n /** Private Use 2 */\n export const PU2 = '\\x92';\n /** Set Transmit State */\n export const STS = '\\x93';\n /** Destructive backspace, intended to eliminate ambiguity about meaning of BS. */\n export const CCH = '\\x94';\n /** Message Waiting */\n export const MW = '\\x95';\n /** Start of Protected Area */\n export const SPA = '\\x96';\n /** End of Protected Area */\n export const EPA = '\\x97';\n /** Start of String */\n export const SOS = '\\x98';\n /** Single Graphic Character Introducer */\n export const SGCI = '\\x99';\n /** Single Character Introducer */\n export const SCI = '\\x9a';\n /** Control Sequence Introducer */\n export const CSI = '\\x9b';\n /** String Terminator */\n export const ST = '\\x9c';\n /** Operating System Command */\n export const OSC = '\\x9d';\n /** Privacy Message */\n export const PM = '\\x9e';\n /** Application Program Command */\n export const APC = '\\x9f';\n}\nexport namespace C1_ESCAPED {\n export const ST = `${C0.ESC}\\\\`;\n}\n","/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n// reg + shift key mappings for digits and special chars\nconst KEYCODE_KEY_MAPPINGS: { [key: number]: [string, string]} = {\n // digits 0-9\n 48: ['0', ')'],\n 49: ['1', '!'],\n 50: ['2', '@'],\n 51: ['3', '#'],\n 52: ['4', '$'],\n 53: ['5', '%'],\n 54: ['6', '^'],\n 55: ['7', '&'],\n 56: ['8', '*'],\n 57: ['9', '('],\n\n // special chars\n 186: [';', ':'],\n 187: ['=', '+'],\n 188: [',', '<'],\n 189: ['-', '_'],\n 190: ['.', '>'],\n 191: ['/', '?'],\n 192: ['`', '~'],\n 219: ['[', '{'],\n 220: ['\\\\', '|'],\n 221: [']', '}'],\n 222: ['\\'', '\"']\n};\n\nexport function evaluateKeyboardEvent(\n ev: IKeyboardEvent,\n applicationCursorMode: boolean,\n isMac: boolean,\n macOptionIsMeta: boolean\n): IKeyboardResult {\n const result: IKeyboardResult = {\n type: KeyboardResultType.SEND_KEY,\n // Whether to cancel event propagation (NOTE: this may not be needed since the event is\n // canceled at the end of keyDown\n cancel: false,\n // The new key even to emit\n key: undefined\n };\n const modifiers = (ev.shiftKey ? 1 : 0) | (ev.altKey ? 2 : 0) | (ev.ctrlKey ? 4 : 0) | (ev.metaKey ? 8 : 0);\n switch (ev.keyCode) {\n case 0:\n if (ev.key === 'UIKeyInputUpArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n }\n else if (ev.key === 'UIKeyInputLeftArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n }\n else if (ev.key === 'UIKeyInputRightArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n }\n else if (ev.key === 'UIKeyInputDownArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n }\n break;\n case 8:\n // backspace\n if (ev.altKey) {\n result.key = C0.ESC + C0.DEL; // \\e ^?\n break;\n }\n result.key = C0.DEL; // ^?\n break;\n case 9:\n // tab\n if (ev.shiftKey) {\n result.key = C0.ESC + '[Z';\n break;\n }\n result.key = C0.HT;\n result.cancel = true;\n break;\n case 13:\n // return/enter\n result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;\n result.cancel = true;\n break;\n case 27:\n // escape\n result.key = C0.ESC;\n if (ev.altKey) {\n result.key = C0.ESC + C0.ESC;\n }\n result.cancel = true;\n break;\n case 37:\n // left-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'D';\n // HACK: Make Alt + left-arrow behave like Ctrl + left-arrow: move one word backwards\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (result.key === C0.ESC + '[1;3D') {\n result.key = C0.ESC + (isMac ? 'b' : '[1;5D');\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n break;\n case 39:\n // right-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'C';\n // HACK: Make Alt + right-arrow behave like Ctrl + right-arrow: move one word forward\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (result.key === C0.ESC + '[1;3C') {\n result.key = C0.ESC + (isMac ? 'f' : '[1;5C');\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n break;\n case 38:\n // up-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A';\n // HACK: Make Alt + up-arrow behave like Ctrl + up-arrow\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (!isMac && result.key === C0.ESC + '[1;3A') {\n result.key = C0.ESC + '[1;5A';\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n break;\n case 40:\n // down-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B';\n // HACK: Make Alt + down-arrow behave like Ctrl + down-arrow\n // http://unix.stackexchange.com/a/108106\n // macOS uses different escape sequences than linux\n if (!isMac && result.key === C0.ESC + '[1;3B') {\n result.key = C0.ESC + '[1;5B';\n }\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n break;\n case 45:\n // insert\n if (!ev.shiftKey && !ev.ctrlKey) {\n // or + are used to\n // copy-paste on some systems.\n result.key = C0.ESC + '[2~';\n }\n break;\n case 46:\n // delete\n if (modifiers) {\n result.key = C0.ESC + '[3;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[3~';\n }\n break;\n case 36:\n // home\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'H';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OH';\n } else {\n result.key = C0.ESC + '[H';\n }\n break;\n case 35:\n // end\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'F';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OF';\n } else {\n result.key = C0.ESC + '[F';\n }\n break;\n case 33:\n // page up\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_UP;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[5;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[5~';\n }\n break;\n case 34:\n // page down\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_DOWN;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[6;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[6~';\n }\n break;\n case 112:\n // F1-F12\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'P';\n } else {\n result.key = C0.ESC + 'OP';\n }\n break;\n case 113:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'Q';\n } else {\n result.key = C0.ESC + 'OQ';\n }\n break;\n case 114:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'R';\n } else {\n result.key = C0.ESC + 'OR';\n }\n break;\n case 115:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'S';\n } else {\n result.key = C0.ESC + 'OS';\n }\n break;\n case 116:\n if (modifiers) {\n result.key = C0.ESC + '[15;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[15~';\n }\n break;\n case 117:\n if (modifiers) {\n result.key = C0.ESC + '[17;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[17~';\n }\n break;\n case 118:\n if (modifiers) {\n result.key = C0.ESC + '[18;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[18~';\n }\n break;\n case 119:\n if (modifiers) {\n result.key = C0.ESC + '[19;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[19~';\n }\n break;\n case 120:\n if (modifiers) {\n result.key = C0.ESC + '[20;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[20~';\n }\n break;\n case 121:\n if (modifiers) {\n result.key = C0.ESC + '[21;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[21~';\n }\n break;\n case 122:\n if (modifiers) {\n result.key = C0.ESC + '[23;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[23~';\n }\n break;\n case 123:\n if (modifiers) {\n result.key = C0.ESC + '[24;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[24~';\n }\n break;\n default:\n // a-z and space\n if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {\n if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n result.key = String.fromCharCode(ev.keyCode - 64);\n } else if (ev.keyCode === 32) {\n result.key = C0.NUL;\n } else if (ev.keyCode >= 51 && ev.keyCode <= 55) {\n // escape, file sep, group sep, record sep, unit sep\n result.key = String.fromCharCode(ev.keyCode - 51 + 27);\n } else if (ev.keyCode === 56) {\n result.key = C0.DEL;\n } else if (ev.keyCode === 219) {\n result.key = C0.ESC;\n } else if (ev.keyCode === 220) {\n result.key = C0.FS;\n } else if (ev.keyCode === 221) {\n result.key = C0.GS;\n }\n } else if ((!isMac || macOptionIsMeta) && ev.altKey && !ev.metaKey) {\n // On macOS this is a third level shift when !macOptionIsMeta. Use instead.\n const keyMapping = KEYCODE_KEY_MAPPINGS[ev.keyCode];\n const key = keyMapping?.[!ev.shiftKey ? 0 : 1];\n if (key) {\n result.key = C0.ESC + key;\n } else if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n const keyCode = ev.ctrlKey ? ev.keyCode - 64 : ev.keyCode + 32;\n let keyString = String.fromCharCode(keyCode);\n if (ev.shiftKey) {\n keyString = keyString.toUpperCase();\n }\n result.key = C0.ESC + keyString;\n } else if (ev.keyCode === 32) {\n result.key = C0.ESC + (ev.ctrlKey ? C0.NUL : ' ');\n } else if (ev.key === 'Dead' && ev.code.startsWith('Key')) {\n // Reference: https://github.com/xtermjs/xterm.js/issues/3725\n // Alt will produce a \"dead key\" (initate composition) with some\n // of the letters in US layout (e.g. N/E/U).\n // It's safe to match against Key* since no other `code` values begin with \"Key\".\n // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values#code_values_on_mac\n let keyString = ev.code.slice(3, 4);\n if (!ev.shiftKey) {\n keyString = keyString.toLowerCase();\n }\n result.key = C0.ESC + keyString;\n result.cancel = true;\n }\n } else if (isMac && !ev.altKey && !ev.ctrlKey && !ev.shiftKey && ev.metaKey) {\n if (ev.keyCode === 65) { // cmd + a\n result.type = KeyboardResultType.SELECT_ALL;\n }\n } else if (ev.key && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.keyCode >= 48 && ev.key.length === 1) {\n // Include only keys that that result in a _single_ character; don't include num lock, volume up, etc.\n result.key = ev.key;\n } else if (ev.key && ev.ctrlKey) {\n if (ev.key === '_') { // ^_\n result.key = C0.US;\n }\n if (ev.key === '@') { // ^ + shift + 2 = ^ + @\n result.key = C0.NUL;\n }\n }\n break;\n }\n\n return result;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Polyfill - Convert UTF32 codepoint into JS string.\n * Note: The built-in String.fromCodePoint happens to be much slower\n * due to additional sanity checks. We can avoid them since\n * we always operate on legal UTF32 (granted by the input decoders)\n * and use this faster version instead.\n */\nexport function stringFromCodePoint(codePoint: number): string {\n if (codePoint > 0xFFFF) {\n codePoint -= 0x10000;\n return String.fromCharCode((codePoint >> 10) + 0xD800) + String.fromCharCode((codePoint % 0x400) + 0xDC00);\n }\n return String.fromCharCode(codePoint);\n}\n\n/**\n * Convert UTF32 char codes into JS string.\n * Basically the same as `stringFromCodePoint` but for multiple codepoints\n * in a loop (which is a lot faster).\n */\nexport function utf32ToString(data: Uint32Array, start: number = 0, end: number = data.length): string {\n let result = '';\n for (let i = start; i < end; ++i) {\n let codepoint = data[i];\n if (codepoint > 0xFFFF) {\n // JS strings are encoded as UTF16, thus a non BMP codepoint gets converted into a surrogate pair\n // conversion rules:\n // - subtract 0x10000 from code point, leaving a 20 bit number\n // - add high 10 bits to 0xD800 --> first surrogate\n // - add low 10 bits to 0xDC00 --> second surrogate\n codepoint -= 0x10000;\n result += String.fromCharCode((codepoint >> 10) + 0xD800) + String.fromCharCode((codepoint % 0x400) + 0xDC00);\n } else {\n result += String.fromCharCode(codepoint);\n }\n }\n return result;\n}\n\n/**\n * StringToUtf32 - decodes UTF16 sequences into UTF32 codepoints.\n * To keep the decoder in line with JS strings it handles single surrogates as UCS2.\n */\nexport class StringToUtf32 {\n private _interim: number = 0;\n\n /**\n * Clears interim and resets decoder to clean state.\n */\n public clear(): void {\n this._interim = 0;\n }\n\n /**\n * Decode JS string to UTF32 codepoints.\n * The methods assumes stream input and will store partly transmitted\n * surrogate pairs and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided input data does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: string, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let startPos = 0;\n\n // handle leftover surrogate high\n if (this._interim) {\n const second = input.charCodeAt(startPos++);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (this._interim - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = this._interim;\n target[size++] = second;\n }\n this._interim = 0;\n }\n\n for (let i = startPos; i < length; ++i) {\n const code = input.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n this._interim = code;\n return size;\n }\n const second = input.charCodeAt(i);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = code;\n target[size++] = second;\n }\n continue;\n }\n if (code === 0xFEFF) {\n // BOM\n continue;\n }\n target[size++] = code;\n }\n return size;\n }\n}\n\n/**\n * Utf8Decoder - decodes UTF8 byte sequences into UTF32 codepoints.\n */\nexport class Utf8ToUtf32 {\n public interim: Uint8Array = new Uint8Array(3);\n\n /**\n * Clears interim bytes and resets decoder to clean state.\n */\n public clear(): void {\n this.interim.fill(0);\n }\n\n /**\n * Decodes UTF8 byte sequences in `input` to UTF32 codepoints in `target`.\n * The methods assumes stream input and will store partly transmitted bytes\n * and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided data chunk does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: Uint8Array, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let byte1: number;\n let byte2: number;\n let byte3: number;\n let byte4: number;\n let codepoint = 0;\n let startPos = 0;\n\n // handle leftover bytes\n if (this.interim[0]) {\n let discardInterim = false;\n let cp = this.interim[0];\n cp &= ((((cp & 0xE0) === 0xC0)) ? 0x1F : (((cp & 0xF0) === 0xE0)) ? 0x0F : 0x07);\n let pos = 0;\n let tmp: number;\n while ((tmp = this.interim[++pos] & 0x3F) && pos < 4) {\n cp <<= 6;\n cp |= tmp;\n }\n // missing bytes - read ahead from input\n const type = (((this.interim[0] & 0xE0) === 0xC0)) ? 2 : (((this.interim[0] & 0xF0) === 0xE0)) ? 3 : 4;\n const missing = type - pos;\n while (startPos < missing) {\n if (startPos >= length) {\n return 0;\n }\n tmp = input[startPos++];\n if ((tmp & 0xC0) !== 0x80) {\n // wrong continuation, discard interim bytes completely\n startPos--;\n discardInterim = true;\n break;\n } else {\n // need to save so we can continue short inputs in next call\n this.interim[pos++] = tmp;\n cp <<= 6;\n cp |= tmp & 0x3F;\n }\n }\n if (!discardInterim) {\n // final test is type dependent\n if (type === 2) {\n if (cp < 0x80) {\n // wrong starter byte\n startPos--;\n } else {\n target[size++] = cp;\n }\n } else if (type === 3) {\n if (cp < 0x0800 || (cp >= 0xD800 && cp <= 0xDFFF) || cp === 0xFEFF) {\n // illegal codepoint or BOM\n } else {\n target[size++] = cp;\n }\n } else {\n if (cp < 0x010000 || cp > 0x10FFFF) {\n // illegal codepoint\n } else {\n target[size++] = cp;\n }\n }\n }\n this.interim.fill(0);\n }\n\n // loop through input\n const fourStop = length - 4;\n let i = startPos;\n while (i < length) {\n /**\n * ASCII shortcut with loop unrolled to 4 consecutive ASCII chars.\n * This is a compromise between speed gain for ASCII\n * and penalty for non ASCII:\n * For best ASCII performance the char should be stored directly into target,\n * but even a single attempt to write to target and compare afterwards\n * penalizes non ASCII really bad (-50%), thus we load the char into byteX first,\n * which reduces ASCII performance by ~15%.\n * This trial for ASCII reduces non ASCII performance by ~10% which seems acceptible\n * compared to the gains.\n * Note that this optimization only takes place for 4 consecutive ASCII chars,\n * for any shorter it bails out. Worst case - all 4 bytes being read but\n * thrown away due to the last being a non ASCII char (-10% performance).\n */\n while (i < fourStop\n && !((byte1 = input[i]) & 0x80)\n && !((byte2 = input[i + 1]) & 0x80)\n && !((byte3 = input[i + 2]) & 0x80)\n && !((byte4 = input[i + 3]) & 0x80))\n {\n target[size++] = byte1;\n target[size++] = byte2;\n target[size++] = byte3;\n target[size++] = byte4;\n i += 4;\n }\n\n // reread byte1\n byte1 = input[i++];\n\n // 1 byte\n if (byte1 < 0x80) {\n target[size++] = byte1;\n\n // 2 bytes\n } else if ((byte1 & 0xE0) === 0xC0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x1F) << 6 | (byte2 & 0x3F);\n if (codepoint < 0x80) {\n // wrong starter byte\n i--;\n continue;\n }\n target[size++] = codepoint;\n\n // 3 bytes\n } else if ((byte1 & 0xF0) === 0xE0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F);\n if (codepoint < 0x0800 || (codepoint >= 0xD800 && codepoint <= 0xDFFF) || codepoint === 0xFEFF) {\n // illegal codepoint or BOM, no i-- here\n continue;\n }\n target[size++] = codepoint;\n\n // 4 bytes\n } else if ((byte1 & 0xF8) === 0xF0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n this.interim[2] = byte3;\n return size;\n }\n byte4 = input[i++];\n if ((byte4 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x07) << 18 | (byte2 & 0x3F) << 12 | (byte3 & 0x3F) << 6 | (byte4 & 0x3F);\n if (codepoint < 0x010000 || codepoint > 0x10FFFF) {\n // illegal codepoint, no i-- here\n continue;\n }\n target[size++] = codepoint;\n } else {\n // illegal byte, just skip\n }\n }\n return size;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IUnicodeVersionProvider } from 'common/services/Services';\n\ntype CharWidth = 0 | 1 | 2;\n\nconst BMP_COMBINING = [\n [0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489],\n [0x0591, 0x05BD], [0x05BF, 0x05BF], [0x05C1, 0x05C2],\n [0x05C4, 0x05C5], [0x05C7, 0x05C7], [0x0600, 0x0603],\n [0x0610, 0x0615], [0x064B, 0x065E], [0x0670, 0x0670],\n [0x06D6, 0x06E4], [0x06E7, 0x06E8], [0x06EA, 0x06ED],\n [0x070F, 0x070F], [0x0711, 0x0711], [0x0730, 0x074A],\n [0x07A6, 0x07B0], [0x07EB, 0x07F3], [0x0901, 0x0902],\n [0x093C, 0x093C], [0x0941, 0x0948], [0x094D, 0x094D],\n [0x0951, 0x0954], [0x0962, 0x0963], [0x0981, 0x0981],\n [0x09BC, 0x09BC], [0x09C1, 0x09C4], [0x09CD, 0x09CD],\n [0x09E2, 0x09E3], [0x0A01, 0x0A02], [0x0A3C, 0x0A3C],\n [0x0A41, 0x0A42], [0x0A47, 0x0A48], [0x0A4B, 0x0A4D],\n [0x0A70, 0x0A71], [0x0A81, 0x0A82], [0x0ABC, 0x0ABC],\n [0x0AC1, 0x0AC5], [0x0AC7, 0x0AC8], [0x0ACD, 0x0ACD],\n [0x0AE2, 0x0AE3], [0x0B01, 0x0B01], [0x0B3C, 0x0B3C],\n [0x0B3F, 0x0B3F], [0x0B41, 0x0B43], [0x0B4D, 0x0B4D],\n [0x0B56, 0x0B56], [0x0B82, 0x0B82], [0x0BC0, 0x0BC0],\n [0x0BCD, 0x0BCD], [0x0C3E, 0x0C40], [0x0C46, 0x0C48],\n [0x0C4A, 0x0C4D], [0x0C55, 0x0C56], [0x0CBC, 0x0CBC],\n [0x0CBF, 0x0CBF], [0x0CC6, 0x0CC6], [0x0CCC, 0x0CCD],\n [0x0CE2, 0x0CE3], [0x0D41, 0x0D43], [0x0D4D, 0x0D4D],\n [0x0DCA, 0x0DCA], [0x0DD2, 0x0DD4], [0x0DD6, 0x0DD6],\n [0x0E31, 0x0E31], [0x0E34, 0x0E3A], [0x0E47, 0x0E4E],\n [0x0EB1, 0x0EB1], [0x0EB4, 0x0EB9], [0x0EBB, 0x0EBC],\n [0x0EC8, 0x0ECD], [0x0F18, 0x0F19], [0x0F35, 0x0F35],\n [0x0F37, 0x0F37], [0x0F39, 0x0F39], [0x0F71, 0x0F7E],\n [0x0F80, 0x0F84], [0x0F86, 0x0F87], [0x0F90, 0x0F97],\n [0x0F99, 0x0FBC], [0x0FC6, 0x0FC6], [0x102D, 0x1030],\n [0x1032, 0x1032], [0x1036, 0x1037], [0x1039, 0x1039],\n [0x1058, 0x1059], [0x1160, 0x11FF], [0x135F, 0x135F],\n [0x1712, 0x1714], [0x1732, 0x1734], [0x1752, 0x1753],\n [0x1772, 0x1773], [0x17B4, 0x17B5], [0x17B7, 0x17BD],\n [0x17C6, 0x17C6], [0x17C9, 0x17D3], [0x17DD, 0x17DD],\n [0x180B, 0x180D], [0x18A9, 0x18A9], [0x1920, 0x1922],\n [0x1927, 0x1928], [0x1932, 0x1932], [0x1939, 0x193B],\n [0x1A17, 0x1A18], [0x1B00, 0x1B03], [0x1B34, 0x1B34],\n [0x1B36, 0x1B3A], [0x1B3C, 0x1B3C], [0x1B42, 0x1B42],\n [0x1B6B, 0x1B73], [0x1DC0, 0x1DCA], [0x1DFE, 0x1DFF],\n [0x200B, 0x200F], [0x202A, 0x202E], [0x2060, 0x2063],\n [0x206A, 0x206F], [0x20D0, 0x20EF], [0x302A, 0x302F],\n [0x3099, 0x309A], [0xA806, 0xA806], [0xA80B, 0xA80B],\n [0xA825, 0xA826], [0xFB1E, 0xFB1E], [0xFE00, 0xFE0F],\n [0xFE20, 0xFE23], [0xFEFF, 0xFEFF], [0xFFF9, 0xFFFB]\n];\nconst HIGH_COMBINING = [\n [0x10A01, 0x10A03], [0x10A05, 0x10A06], [0x10A0C, 0x10A0F],\n [0x10A38, 0x10A3A], [0x10A3F, 0x10A3F], [0x1D167, 0x1D169],\n [0x1D173, 0x1D182], [0x1D185, 0x1D18B], [0x1D1AA, 0x1D1AD],\n [0x1D242, 0x1D244], [0xE0001, 0xE0001], [0xE0020, 0xE007F],\n [0xE0100, 0xE01EF]\n];\n\n// BMP lookup table, lazy initialized during first addon loading\nlet table: Uint8Array;\n\nfunction bisearch(ucs: number, data: number[][]): boolean {\n let min = 0;\n let max = data.length - 1;\n let mid;\n if (ucs < data[0][0] || ucs > data[max][1]) {\n return false;\n }\n while (max >= min) {\n mid = (min + max) >> 1;\n if (ucs > data[mid][1]) {\n min = mid + 1;\n } else if (ucs < data[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n}\n\nexport class UnicodeV6 implements IUnicodeVersionProvider {\n public readonly version = '6';\n\n constructor() {\n // init lookup table once\n if (!table) {\n table = new Uint8Array(65536);\n table.fill(1);\n table[0] = 0;\n // control chars\n table.fill(0, 1, 32);\n table.fill(0, 0x7f, 0xa0);\n\n // apply wide char rules first\n // wide chars\n table.fill(2, 0x1100, 0x1160);\n table[0x2329] = 2;\n table[0x232a] = 2;\n table.fill(2, 0x2e80, 0xa4d0);\n table[0x303f] = 1; // wrongly in last line\n\n table.fill(2, 0xac00, 0xd7a4);\n table.fill(2, 0xf900, 0xfb00);\n table.fill(2, 0xfe10, 0xfe1a);\n table.fill(2, 0xfe30, 0xfe70);\n table.fill(2, 0xff00, 0xff61);\n table.fill(2, 0xffe0, 0xffe7);\n\n // apply combining last to ensure we overwrite\n // wrongly wide set chars:\n // the original algo evals combining first and falls\n // through to wide check so we simply do here the opposite\n // combining 0\n for (let r = 0; r < BMP_COMBINING.length; ++r) {\n table.fill(0, BMP_COMBINING[r][0], BMP_COMBINING[r][1] + 1);\n }\n }\n }\n\n public wcwidth(num: number): CharWidth {\n if (num < 32) return 0;\n if (num < 127) return 1;\n if (num < 65536) return table[num] as CharWidth;\n if (bisearch(num, HIGH_COMBINING)) return 0;\n if ((num >= 0x20000 && num <= 0x2fffd) || (num >= 0x30000 && num <= 0x3fffd)) return 2;\n return 1;\n }\n}\n","\n/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\n\ndeclare const setTimeout: (handler: () => void, timeout?: number) => void;\n\n/**\n * Safety watermark to avoid memory exhaustion and browser engine crash on fast data input.\n * Enable flow control to avoid this limit and make sure that your backend correctly\n * propagates this to the underlying pty. (see docs for further instructions)\n * Since this limit is meant as a safety parachute to prevent browser crashs,\n * it is set to a very high number. Typically xterm.js gets unresponsive with\n * a 100 times lower number (>500 kB).\n */\nconst DISCARD_WATERMARK = 50000000; // ~50 MB\n\n/**\n * The max number of ms to spend on writes before allowing the renderer to\n * catch up with a 0ms setTimeout. A value of < 33 to keep us close to\n * 30fps, and a value of < 16 to try to run at 60fps. Of course, the real FPS\n * depends on the time it takes for the renderer to draw the frame.\n */\nconst WRITE_TIMEOUT_MS = 12;\n\n/**\n * Threshold of max held chunks in the write buffer, that were already processed.\n * This is a tradeoff between extensive write buffer shifts (bad runtime) and high\n * memory consumption by data thats not used anymore.\n */\nconst WRITE_BUFFER_LENGTH_THRESHOLD = 50;\n\nexport class WriteBuffer extends Disposable {\n private _writeBuffer: (string | Uint8Array)[] = [];\n private _callbacks: ((() => void) | undefined)[] = [];\n private _pendingData = 0;\n private _bufferOffset = 0;\n private _isSyncWriting = false;\n private _syncCalls = 0;\n private _didUserInput = false;\n\n private readonly _onWriteParsed = this.register(new EventEmitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise) {\n super();\n }\n\n public handleUserInput(): void {\n this._didUserInput = true;\n }\n\n /**\n * @deprecated Unreliable, to be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n // stop writeSync recursions with maxSubsequentCalls argument\n // This is dangerous to use as it will lose the current data chunk\n // and return immediately.\n if (maxSubsequentCalls !== undefined && this._syncCalls > maxSubsequentCalls) {\n // comment next line if a whole loop block should only contain x `writeSync` calls\n // (total flat vs. deep nested limit)\n this._syncCalls = 0;\n return;\n }\n // append chunk to buffer\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(undefined);\n\n // increase recursion counter\n this._syncCalls++;\n // exit early if another writeSync loop is active\n if (this._isSyncWriting) {\n return;\n }\n this._isSyncWriting = true;\n\n // force sync processing on pending data chunks to avoid in-band data scrambling\n // does the same as innerWrite but without event loop\n // we have to do it here as single loop steps to not corrupt loop subject\n // by another writeSync call triggered from _action\n let chunk: string | Uint8Array | undefined;\n while (chunk = this._writeBuffer.shift()) {\n this._action(chunk);\n const cb = this._callbacks.shift();\n if (cb) cb();\n }\n // reset to avoid reprocessing of chunks with scheduled innerWrite call\n // stopping scheduled innerWrite by offset > length condition\n this._pendingData = 0;\n this._bufferOffset = 0x7FFFFFFF;\n\n // allow another writeSync to loop\n this._isSyncWriting = false;\n this._syncCalls = 0;\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n if (this._pendingData > DISCARD_WATERMARK) {\n throw new Error('write data discarded, use flow control to avoid losing data');\n }\n\n // schedule chunk processing for next event loop run\n if (!this._writeBuffer.length) {\n this._bufferOffset = 0;\n\n // If this is the first write call after the user has done some input,\n // parse it immediately to minimize input latency,\n // otherwise schedule for the next event\n if (this._didUserInput) {\n this._didUserInput = false;\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n this._innerWrite();\n return;\n }\n\n setTimeout(() => this._innerWrite());\n }\n\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n }\n\n /**\n * Inner write call, that enters the sliced chunk processing by timing.\n *\n * `lastTime` indicates, when the last _innerWrite call had started.\n * It is used to aggregate async handler execution under a timeout constraint\n * effectively lowering the redrawing needs, schematically:\n *\n * macroTask _innerWrite:\n * if (Date.now() - (lastTime | 0) < WRITE_TIMEOUT_MS):\n * schedule microTask _innerWrite(lastTime)\n * else:\n * schedule macroTask _innerWrite(0)\n *\n * overall execution order on task queues:\n *\n * macrotasks: [...] --> _innerWrite(0) --> [...] --> screenUpdate --> [...]\n * m t: |\n * i a: [...]\n * c s: |\n * r k: while < timeout:\n * o s: _innerWrite(timeout)\n *\n * `promiseResult` depicts the promise resolve value of an async handler.\n * This value gets carried forward through all saved stack states of the\n * paused parser for proper continuation.\n *\n * Note, for pure sync code `lastTime` and `promiseResult` have no meaning.\n */\n protected _innerWrite(lastTime: number = 0, promiseResult: boolean = true): void {\n const startTime = lastTime || Date.now();\n while (this._writeBuffer.length > this._bufferOffset) {\n const data = this._writeBuffer[this._bufferOffset];\n const result = this._action(data, promiseResult);\n if (result) {\n /**\n * If we get a promise as return value, we re-schedule the continuation\n * as thenable on the promise and exit right away.\n *\n * The exit here means, that we block input processing at the current active chunk,\n * the exact execution position within the chunk is preserved by the saved\n * stack content in InputHandler and EscapeSequenceParser.\n *\n * Resuming happens automatically from that saved stack state.\n * Also the resolved promise value is passed along the callstack to\n * `EscapeSequenceParser.parse` to correctly resume the stopped handler loop.\n *\n * Exceptions on async handlers will be logged to console async, but do not interrupt\n * the input processing (continues with next handler at the current input position).\n */\n\n /**\n * If a promise takes long to resolve, we should schedule continuation behind setTimeout.\n * This might already be too late, if our .then enters really late (executor + prev thens took very long).\n * This cannot be solved here for the handler itself (it is the handlers responsibility to slice hard work),\n * but we can at least schedule a screen update as we gain control.\n */\n const continuation: (r: boolean) => void = (r: boolean) => Date.now() - startTime >= WRITE_TIMEOUT_MS\n ? setTimeout(() => this._innerWrite(0, r))\n : this._innerWrite(startTime, r);\n\n /**\n * Optimization considerations:\n * The continuation above favors FPS over throughput by eval'ing `startTime` on resolve.\n * This might schedule too many screen updates with bad throughput drops (in case a slow\n * resolving handler sliced its work properly behind setTimeout calls). We cannot spot\n * this condition here, also the renderer has no way to spot nonsense updates either.\n * FIXME: A proper fix for this would track the FPS at the renderer entry level separately.\n *\n * If favoring of FPS shows bad throughtput impact, use the following instead. It favors\n * throughput by eval'ing `startTime` upfront pulling at least one more chunk into the\n * current microtask queue (executed before setTimeout).\n */\n // const continuation: (r: boolean) => void = Date.now() - startTime >= WRITE_TIMEOUT_MS\n // ? r => setTimeout(() => this._innerWrite(0, r))\n // : r => this._innerWrite(startTime, r);\n\n // Handle exceptions synchronously to current band position, idea:\n // 1. spawn a single microtask which we allow to throw hard\n // 2. spawn a promise immediately resolving to `true`\n // (executed on the same queue, thus properly aligned before continuation happens)\n result.catch(err => {\n queueMicrotask(() => {throw err;});\n return Promise.resolve(false);\n }).then(continuation);\n return;\n }\n\n const cb = this._callbacks[this._bufferOffset];\n if (cb) cb();\n this._bufferOffset++;\n this._pendingData -= data.length;\n\n if (Date.now() - startTime >= WRITE_TIMEOUT_MS) {\n break;\n }\n }\n if (this._writeBuffer.length > this._bufferOffset) {\n // Allow renderer to catch up before processing the next batch\n // trim already processed chunks if we are above threshold\n if (this._bufferOffset > WRITE_BUFFER_LENGTH_THRESHOLD) {\n this._writeBuffer = this._writeBuffer.slice(this._bufferOffset);\n this._callbacks = this._callbacks.slice(this._bufferOffset);\n this._bufferOffset = 0;\n }\n setTimeout(() => this._innerWrite());\n } else {\n this._writeBuffer.length = 0;\n this._callbacks.length = 0;\n this._pendingData = 0;\n this._bufferOffset = 0;\n }\n this._onWriteParsed.fire();\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n\n// 'rgb:' rule - matching: r/g/b | rr/gg/bb | rrr/ggg/bbb | rrrr/gggg/bbbb (hex digits)\nconst RGB_REX = /^([\\da-f])\\/([\\da-f])\\/([\\da-f])$|^([\\da-f]{2})\\/([\\da-f]{2})\\/([\\da-f]{2})$|^([\\da-f]{3})\\/([\\da-f]{3})\\/([\\da-f]{3})$|^([\\da-f]{4})\\/([\\da-f]{4})\\/([\\da-f]{4})$/;\n// '#...' rule - matching any hex digits\nconst HASH_REX = /^[\\da-f]+$/;\n\n/**\n * Parse color spec to RGB values (8 bit per channel).\n * See `man xparsecolor` for details about certain format specifications.\n *\n * Supported formats:\n * - rgb:// with , , in h | hh | hhh | hhhh\n * - #RGB, #RRGGBB, #RRRGGGBBB, #RRRRGGGGBBBB\n *\n * All other formats like rgbi: or device-independent string specifications\n * with float numbering are not supported.\n */\nexport function parseColor(data: string): [number, number, number] | undefined {\n if (!data) return;\n // also handle uppercases\n let low = data.toLowerCase();\n if (low.indexOf('rgb:') === 0) {\n // 'rgb:' specifier\n low = low.slice(4);\n const m = RGB_REX.exec(low);\n if (m) {\n const base = m[1] ? 15 : m[4] ? 255 : m[7] ? 4095 : 65535;\n return [\n Math.round(parseInt(m[1] || m[4] || m[7] || m[10], 16) / base * 255),\n Math.round(parseInt(m[2] || m[5] || m[8] || m[11], 16) / base * 255),\n Math.round(parseInt(m[3] || m[6] || m[9] || m[12], 16) / base * 255)\n ];\n }\n } else if (low.indexOf('#') === 0) {\n // '#' specifier\n low = low.slice(1);\n if (HASH_REX.exec(low) && [3, 6, 9, 12].includes(low.length)) {\n const adv = low.length / 3;\n const result: [number, number, number] = [0, 0, 0];\n for (let i = 0; i < 3; ++i) {\n const c = parseInt(low.slice(adv * i, adv * i + adv), 16);\n result[i] = adv === 1 ? c << 4 : adv === 2 ? c : adv === 3 ? c >> 4 : c >> 8;\n }\n return result;\n }\n }\n\n // Named colors are currently not supported due to the large addition to the xterm.js bundle size\n // they would add. In order to support named colors, we would need some way of optionally loading\n // additional payloads so startup/download time is not bloated (see #3530).\n}\n\n// pad hex output to requested bit width\nfunction pad(n: number, bits: number): string {\n const s = n.toString(16);\n const s2 = s.length < 2 ? '0' + s : s;\n switch (bits) {\n case 4:\n return s[0];\n case 8:\n return s2;\n case 12:\n return (s2 + s2).slice(0, 3);\n default:\n return s2 + s2;\n }\n}\n\n/**\n * Convert a given color to rgb:../../.. string of `bits` depth.\n */\nexport function toRgbString(color: [number, number, number], bits: number = 16): string {\n const [r, g, b] = color;\n return `rgb:${pad(r, bits)}/${pad(g, bits)}/${pad(b, bits)}`;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Internal states of EscapeSequenceParser.\n */\nexport const enum ParserState {\n GROUND = 0,\n ESCAPE = 1,\n ESCAPE_INTERMEDIATE = 2,\n CSI_ENTRY = 3,\n CSI_PARAM = 4,\n CSI_INTERMEDIATE = 5,\n CSI_IGNORE = 6,\n SOS_PM_APC_STRING = 7,\n OSC_STRING = 8,\n DCS_ENTRY = 9,\n DCS_PARAM = 10,\n DCS_IGNORE = 11,\n DCS_INTERMEDIATE = 12,\n DCS_PASSTHROUGH = 13\n}\n\n/**\n * Internal actions of EscapeSequenceParser.\n */\nexport const enum ParserAction {\n IGNORE = 0,\n ERROR = 1,\n PRINT = 2,\n EXECUTE = 3,\n OSC_START = 4,\n OSC_PUT = 5,\n OSC_END = 6,\n CSI_DISPATCH = 7,\n PARAM = 8,\n COLLECT = 9,\n ESC_DISPATCH = 10,\n CLEAR = 11,\n DCS_HOOK = 12,\n DCS_PUT = 13,\n DCS_UNHOOK = 14\n}\n\n/**\n * Internal states of OscParser.\n */\nexport const enum OscState {\n START = 0,\n ID = 1,\n PAYLOAD = 2,\n ABORT = 3\n}\n\n// payload limit for OSC and DCS\nexport const PAYLOAD_LIMIT = 10000000;\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from 'common/parser/Types';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { Params } from 'common/parser/Params';\nimport { PAYLOAD_LIMIT } from 'common/parser/Constants';\n\nconst EMPTY_HANDLERS: IDcsHandler[] = [];\n\nexport class DcsParser implements IDcsParser {\n private _handlers: IHandlerCollection = Object.create(null);\n private _active: IDcsHandler[] = EMPTY_HANDLERS;\n private _ident: number = 0;\n private _handlerFb: DcsFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public registerHandler(ident: number, handler: IDcsHandler): IDisposable {\n if (this._handlers[ident] === undefined) {\n this._handlers[ident] = [];\n }\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n\n public setHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public reset(): void {\n // force cleanup leftover handlers\n if (this._active.length) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].unhook(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n\n public hook(ident: number, params: IParams): void {\n // always reset leftover handlers\n this.reset();\n this._ident = ident;\n this._active = this._handlers[ident] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._ident, 'HOOK', params);\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].hook(params);\n }\n }\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public unhook(success: boolean, promiseResult: boolean = true): void | Promise {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'UNHOOK', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers (fallThrough for async)\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n}\n\n// predefine empty params as [0] (ZDM)\nconst EMPTY_PARAMS = new Params();\nEMPTY_PARAMS.addParam(0);\n\n/**\n * Convenient class to create a DCS handler from a single callback function.\n * Note: The payload is currently limited to 50 MB (hardcoded).\n */\nexport class DcsHandler implements IDcsHandler {\n private _data = '';\n private _params: IParams = EMPTY_PARAMS;\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string, params: IParams) => boolean | Promise) { }\n\n public hook(params: IParams): void {\n // since we need to preserve params until `unhook`, we have to clone it\n // (only borrowed from parser and spans multiple parser states)\n // perf optimization:\n // clone only, if we have non empty params, otherwise stick with default\n this._params = (params.length > 1 || params.params[0]) ? params.clone() : EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > PAYLOAD_LIMIT) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public unhook(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data, this._params);\n if (ret instanceof Promise) {\n // need to hold data and params until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType } from 'common/parser/Types';\nimport { ParserState, ParserAction } from 'common/parser/Constants';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { Params } from 'common/parser/Params';\nimport { OscParser } from 'common/parser/OscParser';\nimport { DcsParser } from 'common/parser/DcsParser';\n\n/**\n * Table values are generated like this:\n * index: currentState << TableValue.INDEX_STATE_SHIFT | charCode\n * value: action << TableValue.TRANSITION_ACTION_SHIFT | nextState\n */\nconst enum TableAccess {\n TRANSITION_ACTION_SHIFT = 4,\n TRANSITION_STATE_MASK = 15,\n INDEX_STATE_SHIFT = 8\n}\n\n/**\n * Transition table for EscapeSequenceParser.\n */\nexport class TransitionTable {\n public table: Uint8Array;\n\n constructor(length: number) {\n this.table = new Uint8Array(length);\n }\n\n /**\n * Set default transition.\n * @param action default action\n * @param next default next state\n */\n public setDefault(action: ParserAction, next: ParserState): void {\n this.table.fill(action << TableAccess.TRANSITION_ACTION_SHIFT | next);\n }\n\n /**\n * Add a transition to the transition table.\n * @param code input character code\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public add(code: number, state: ParserState, action: ParserAction, next: ParserState): void {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | code] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n\n /**\n * Add transitions for multiple input character codes.\n * @param codes input character code array\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public addMany(codes: number[], state: ParserState, action: ParserAction, next: ParserState): void {\n for (let i = 0; i < codes.length; i++) {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | codes[i]] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n }\n}\n\n\n// Pseudo-character placeholder for printable non-ascii characters (unicode).\nconst NON_ASCII_PRINTABLE = 0xA0;\n\n\n/**\n * VT500 compatible transition table.\n * Taken from https://vt100.net/emu/dec_ansi_parser.\n */\nexport const VT500_TRANSITION_TABLE = (function (): TransitionTable {\n const table: TransitionTable = new TransitionTable(4095);\n\n // range macro for byte\n const BYTE_VALUES = 256;\n const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused: any, i: number) => i);\n const r = (start: number, end: number): number[] => blueprint.slice(start, end);\n\n // Default definitions.\n const PRINTABLES = r(0x20, 0x7f); // 0x20 (SP) included, 0x7F (DEL) excluded\n const EXECUTABLES = r(0x00, 0x18);\n EXECUTABLES.push(0x19);\n EXECUTABLES.push.apply(EXECUTABLES, r(0x1c, 0x20));\n\n const states: number[] = r(ParserState.GROUND, ParserState.DCS_PASSTHROUGH + 1);\n let state: any;\n\n // set default transition\n table.setDefault(ParserAction.ERROR, ParserState.GROUND);\n // printables\n table.addMany(PRINTABLES, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n // global anywhere rules\n for (state in states) {\n table.addMany([0x18, 0x1a, 0x99, 0x9a], state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x80, 0x90), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x90, 0x98), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.add(0x9c, state, ParserAction.IGNORE, ParserState.GROUND); // ST as terminator\n table.add(0x1b, state, ParserAction.CLEAR, ParserState.ESCAPE); // ESC\n table.add(0x9d, state, ParserAction.OSC_START, ParserState.OSC_STRING); // OSC\n table.addMany([0x98, 0x9e, 0x9f], state, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.add(0x9b, state, ParserAction.CLEAR, ParserState.CSI_ENTRY); // CSI\n table.add(0x90, state, ParserAction.CLEAR, ParserState.DCS_ENTRY); // DCS\n }\n // rules for executables and 7f\n table.addMany(EXECUTABLES, ParserState.GROUND, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(EXECUTABLES, ParserState.ESCAPE, ParserAction.EXECUTE, ParserState.ESCAPE);\n table.add(0x7f, ParserState.ESCAPE, ParserAction.IGNORE, ParserState.ESCAPE);\n table.addMany(EXECUTABLES, ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n table.addMany(EXECUTABLES, ParserState.CSI_ENTRY, ParserAction.EXECUTE, ParserState.CSI_ENTRY);\n table.add(0x7f, ParserState.CSI_ENTRY, ParserAction.IGNORE, ParserState.CSI_ENTRY);\n table.addMany(EXECUTABLES, ParserState.CSI_PARAM, ParserAction.EXECUTE, ParserState.CSI_PARAM);\n table.add(0x7f, ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_PARAM);\n table.addMany(EXECUTABLES, ParserState.CSI_IGNORE, ParserAction.EXECUTE, ParserState.CSI_IGNORE);\n table.addMany(EXECUTABLES, ParserState.CSI_INTERMEDIATE, ParserAction.EXECUTE, ParserState.CSI_INTERMEDIATE);\n table.add(0x7f, ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.ESCAPE_INTERMEDIATE, ParserAction.EXECUTE, ParserState.ESCAPE_INTERMEDIATE);\n table.add(0x7f, ParserState.ESCAPE_INTERMEDIATE, ParserAction.IGNORE, ParserState.ESCAPE_INTERMEDIATE);\n // osc\n table.add(0x5d, ParserState.ESCAPE, ParserAction.OSC_START, ParserState.OSC_STRING);\n table.addMany(PRINTABLES, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(0x7f, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.addMany([0x9c, 0x1b, 0x18, 0x1a, 0x07], ParserState.OSC_STRING, ParserAction.OSC_END, ParserState.GROUND);\n table.addMany(r(0x1c, 0x20), ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n // sos/pm/apc does nothing\n table.addMany([0x58, 0x5e, 0x5f], ParserState.ESCAPE, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.addMany(PRINTABLES, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.addMany(EXECUTABLES, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n table.add(0x9c, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.GROUND);\n table.add(0x7f, ParserState.SOS_PM_APC_STRING, ParserAction.IGNORE, ParserState.SOS_PM_APC_STRING);\n // csi entries\n table.add(0x5b, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.CSI_ENTRY);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_ENTRY, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_ENTRY, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_PARAM, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_PARAM, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x20, 0x40), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(0x7f, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.CSI_INTERMEDIATE, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_INTERMEDIATE, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_PARAM, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n // esc_intermediate\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE_INTERMEDIATE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x30, 0x7f), ParserState.ESCAPE_INTERMEDIATE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x50), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x51, 0x58), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany([0x59, 0x5a, 0x5c], ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x60, 0x7f), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n // dcs entry\n table.add(0x50, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.DCS_ENTRY);\n table.addMany(EXECUTABLES, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.add(0x7f, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x20, 0x30), ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_ENTRY, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_PARAM);\n table.addMany(EXECUTABLES, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x80), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(EXECUTABLES, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.add(0x7f, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_PARAM, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_PARAM, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.add(0x7f, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_INTERMEDIATE, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_INTERMEDIATE, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_PARAM, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_ENTRY, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(EXECUTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.addMany(PRINTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.add(0x7f, ParserState.DCS_PASSTHROUGH, ParserAction.IGNORE, ParserState.DCS_PASSTHROUGH);\n table.addMany([0x1b, 0x9c, 0x18, 0x1a], ParserState.DCS_PASSTHROUGH, ParserAction.DCS_UNHOOK, ParserState.GROUND);\n // special handling of unicode chars\n table.add(NON_ASCII_PRINTABLE, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n table.add(NON_ASCII_PRINTABLE, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(NON_ASCII_PRINTABLE, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n return table;\n})();\n\n\n/**\n * EscapeSequenceParser.\n * This class implements the ANSI/DEC compatible parser described by\n * Paul Williams (https://vt100.net/emu/dec_ansi_parser).\n *\n * To implement custom ANSI compliant escape sequences it is not needed to\n * alter this parser, instead consider registering a custom handler.\n * For non ANSI compliant sequences change the transition table with\n * the optional `transitions` constructor argument and\n * reimplement the `parse` method.\n *\n * This parser is currently hardcoded to operate in ZDM (Zero Default Mode)\n * as suggested by the original parser, thus empty parameters are set to 0.\n * This this is not in line with the latest ECMA-48 specification\n * (ZDM was part of the early specs and got completely removed later on).\n *\n * Other than the original parser from vt100.net this parser supports\n * sub parameters in digital parameters separated by colons. Empty sub parameters\n * are set to -1 (no ZDM for sub parameters).\n *\n * About prefix and intermediate bytes:\n * This parser follows the assumptions of the vt100.net parser with these restrictions:\n * - only one prefix byte is allowed as first parameter byte, byte range 0x3c .. 0x3f\n * - max. two intermediates are respected, byte range 0x20 .. 0x2f\n * Note that this is not in line with ECMA-48 which does not limit either of those.\n * Furthermore ECMA-48 allows the prefix byte range at any param byte position. Currently\n * there are no known sequences that follow the broader definition of the specification.\n *\n * TODO: implement error recovery hook via error handler return values\n */\nexport class EscapeSequenceParser extends Disposable implements IEscapeSequenceParser {\n public initialState: number;\n public currentState: number;\n public precedingCodepoint: number;\n\n // buffers over several parse calls\n protected _params: Params;\n protected _collect: number;\n\n // handler lookup containers\n protected _printHandler: PrintHandlerType;\n protected _executeHandlers: { [flag: number]: ExecuteHandlerType };\n protected _csiHandlers: IHandlerCollection;\n protected _escHandlers: IHandlerCollection;\n protected readonly _oscParser: IOscParser;\n protected readonly _dcsParser: IDcsParser;\n protected _errorHandler: (state: IParsingState) => IParsingState;\n\n // fallback handlers\n protected _printHandlerFb: PrintFallbackHandlerType;\n protected _executeHandlerFb: ExecuteFallbackHandlerType;\n protected _csiHandlerFb: CsiFallbackHandlerType;\n protected _escHandlerFb: EscFallbackHandlerType;\n protected _errorHandlerFb: (state: IParsingState) => IParsingState;\n\n // parser stack save for async handler support\n protected _parseStack: IParserStackState = {\n state: ParserStackType.NONE,\n handlers: [],\n handlerPos: 0,\n transition: 0,\n chunkPos: 0\n };\n\n constructor(\n protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE\n ) {\n super();\n\n this.initialState = ParserState.GROUND;\n this.currentState = this.initialState;\n this._params = new Params(); // defaults to 32 storable params/subparams\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingCodepoint = 0;\n\n // set default fallback handlers and handler lookup containers\n this._printHandlerFb = (data, start, end): void => { };\n this._executeHandlerFb = (code: number): void => { };\n this._csiHandlerFb = (ident: number, params: IParams): void => { };\n this._escHandlerFb = (ident: number): void => { };\n this._errorHandlerFb = (state: IParsingState): IParsingState => state;\n this._printHandler = this._printHandlerFb;\n this._executeHandlers = Object.create(null);\n this._csiHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n this.register(toDisposable(() => {\n this._csiHandlers = Object.create(null);\n this._executeHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n }));\n this._oscParser = this.register(new OscParser());\n this._dcsParser = this.register(new DcsParser());\n this._errorHandler = this._errorHandlerFb;\n\n // swallow 7bit ST (ESC+\\)\n this.registerEscHandler({ final: '\\\\' }, () => true);\n }\n\n protected _identifier(id: IFunctionIdentifier, finalRange: number[] = [0x40, 0x7e]): number {\n let res = 0;\n if (id.prefix) {\n if (id.prefix.length > 1) {\n throw new Error('only one byte as prefix supported');\n }\n res = id.prefix.charCodeAt(0);\n if (res && 0x3c > res || res > 0x3f) {\n throw new Error('prefix must be in range 0x3c .. 0x3f');\n }\n }\n if (id.intermediates) {\n if (id.intermediates.length > 2) {\n throw new Error('only two bytes as intermediates are supported');\n }\n for (let i = 0; i < id.intermediates.length; ++i) {\n const intermediate = id.intermediates.charCodeAt(i);\n if (0x20 > intermediate || intermediate > 0x2f) {\n throw new Error('intermediate must be in range 0x20 .. 0x2f');\n }\n res <<= 8;\n res |= intermediate;\n }\n }\n if (id.final.length !== 1) {\n throw new Error('final must be a single byte');\n }\n const finalCode = id.final.charCodeAt(0);\n if (finalRange[0] > finalCode || finalCode > finalRange[1]) {\n throw new Error(`final must be in range ${finalRange[0]} .. ${finalRange[1]}`);\n }\n res <<= 8;\n res |= finalCode;\n\n return res;\n }\n\n public identToString(ident: number): string {\n const res: string[] = [];\n while (ident) {\n res.push(String.fromCharCode(ident & 0xFF));\n ident >>= 8;\n }\n return res.reverse().join('');\n }\n\n public setPrintHandler(handler: PrintHandlerType): void {\n this._printHandler = handler;\n }\n public clearPrintHandler(): void {\n this._printHandler = this._printHandlerFb;\n }\n\n public registerEscHandler(id: IFunctionIdentifier, handler: EscHandlerType): IDisposable {\n const ident = this._identifier(id, [0x30, 0x7e]);\n if (this._escHandlers[ident] === undefined) {\n this._escHandlers[ident] = [];\n }\n const handlerList = this._escHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearEscHandler(id: IFunctionIdentifier): void {\n if (this._escHandlers[this._identifier(id, [0x30, 0x7e])]) delete this._escHandlers[this._identifier(id, [0x30, 0x7e])];\n }\n public setEscHandlerFallback(handler: EscFallbackHandlerType): void {\n this._escHandlerFb = handler;\n }\n\n public setExecuteHandler(flag: string, handler: ExecuteHandlerType): void {\n this._executeHandlers[flag.charCodeAt(0)] = handler;\n }\n public clearExecuteHandler(flag: string): void {\n if (this._executeHandlers[flag.charCodeAt(0)]) delete this._executeHandlers[flag.charCodeAt(0)];\n }\n public setExecuteHandlerFallback(handler: ExecuteFallbackHandlerType): void {\n this._executeHandlerFb = handler;\n }\n\n public registerCsiHandler(id: IFunctionIdentifier, handler: CsiHandlerType): IDisposable {\n const ident = this._identifier(id);\n if (this._csiHandlers[ident] === undefined) {\n this._csiHandlers[ident] = [];\n }\n const handlerList = this._csiHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearCsiHandler(id: IFunctionIdentifier): void {\n if (this._csiHandlers[this._identifier(id)]) delete this._csiHandlers[this._identifier(id)];\n }\n public setCsiHandlerFallback(callback: (ident: number, params: IParams) => void): void {\n this._csiHandlerFb = callback;\n }\n\n public registerDcsHandler(id: IFunctionIdentifier, handler: IDcsHandler): IDisposable {\n return this._dcsParser.registerHandler(this._identifier(id), handler);\n }\n public clearDcsHandler(id: IFunctionIdentifier): void {\n this._dcsParser.clearHandler(this._identifier(id));\n }\n public setDcsHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._dcsParser.setHandlerFallback(handler);\n }\n\n public registerOscHandler(ident: number, handler: IOscHandler): IDisposable {\n return this._oscParser.registerHandler(ident, handler);\n }\n public clearOscHandler(ident: number): void {\n this._oscParser.clearHandler(ident);\n }\n public setOscHandlerFallback(handler: OscFallbackHandlerType): void {\n this._oscParser.setHandlerFallback(handler);\n }\n\n public setErrorHandler(callback: (state: IParsingState) => IParsingState): void {\n this._errorHandler = callback;\n }\n public clearErrorHandler(): void {\n this._errorHandler = this._errorHandlerFb;\n }\n\n /**\n * Reset parser to initial values.\n *\n * This can also be used to lift the improper continuation error condition\n * when dealing with async handlers. Use this only as a last resort to silence\n * that error when the terminal has no pending data to be processed. Note that\n * the interrupted async handler might continue its work in the future messing\n * up the terminal state even further.\n */\n public reset(): void {\n this.currentState = this.initialState;\n this._oscParser.reset();\n this._dcsParser.reset();\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingCodepoint = 0;\n // abort pending continuation from async handler\n // Here the RESET type indicates, that the next parse call will\n // ignore any saved stack, instead continues sync with next codepoint from GROUND\n if (this._parseStack.state !== ParserStackType.NONE) {\n this._parseStack.state = ParserStackType.RESET;\n this._parseStack.handlers = []; // also release handlers ref\n }\n }\n\n /**\n * Async parse support.\n */\n protected _preserveStack(\n state: ParserStackType,\n handlers: ResumableHandlersType,\n handlerPos: number,\n transition: number,\n chunkPos: number\n ): void {\n this._parseStack.state = state;\n this._parseStack.handlers = handlers;\n this._parseStack.handlerPos = handlerPos;\n this._parseStack.transition = transition;\n this._parseStack.chunkPos = chunkPos;\n }\n\n /**\n * Parse UTF32 codepoints in `data` up to `length`.\n *\n * Note: For several actions with high data load the parsing is optimized\n * by using local read ahead loops with hardcoded conditions to\n * avoid costly table lookups. Make sure that any change of table values\n * will be reflected in the loop conditions as well and vice versa.\n * Affected states/actions:\n * - GROUND:PRINT\n * - CSI_PARAM:PARAM\n * - DCS_PARAM:PARAM\n * - OSC_STRING:OSC_PUT\n * - DCS_PASSTHROUGH:DCS_PUT\n *\n * Note on asynchronous handler support:\n * Any handler returning a promise will be treated as asynchronous.\n * To keep the in-band blocking working for async handlers, `parse` pauses execution,\n * creates a stack save and returns the promise to the caller.\n * For proper continuation of the paused state it is important\n * to await the promise resolving. On resolve the parse must be repeated\n * with the same chunk of data and the resolved value in `promiseResult`\n * until no promise is returned.\n *\n * Important: With only sync handlers defined, parsing is completely synchronous as well.\n * As soon as an async handler is involved, synchronous parsing is not possible anymore.\n *\n * Boilerplate for proper parsing of multiple chunks with async handlers:\n *\n * ```typescript\n * async function parseMultipleChunks(chunks: Uint32Array[]): Promise {\n * for (const chunk of chunks) {\n * let result: void | Promise;\n * let prev: boolean | undefined;\n * while (result = parser.parse(chunk, chunk.length, prev)) {\n * prev = await result;\n * }\n * }\n * // finished parsing all chunks...\n * }\n * ```\n */\n public parse(data: Uint32Array, length: number, promiseResult?: boolean): void | Promise {\n let code = 0;\n let transition = 0;\n let start = 0;\n let handlerResult: void | boolean | Promise;\n\n // resume from async handler\n if (this._parseStack.state) {\n // allow sync parser reset even in continuation mode\n // Note: can be used to recover parser from improper continuation error below\n if (this._parseStack.state === ParserStackType.RESET) {\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1; // continue with next codepoint in GROUND\n } else {\n if (promiseResult === undefined || this._parseStack.state === ParserStackType.FAIL) {\n /**\n * Reject further parsing on improper continuation after pausing.\n * This is a really bad condition with screwed up execution order and prolly messed up\n * terminal state, therefore we exit hard with an exception and reject any further parsing.\n *\n * Note: With `Terminal.write` usage this exception should never occur, as the top level\n * calls are guaranteed to handle async conditions properly. If you ever encounter this\n * exception in your terminal integration it indicates, that you injected data chunks to\n * `InputHandler.parse` or `EscapeSequenceParser.parse` synchronously without waiting for\n * continuation of a running async handler.\n *\n * It is possible to get rid of this error by calling `reset`. But dont rely on that,\n * as the pending async handler still might mess up the terminal later. Instead fix the faulty\n * async handling, so this error will not be thrown anymore.\n */\n this._parseStack.state = ParserStackType.FAIL;\n throw new Error('improper continuation due to previous async handler, giving up parsing');\n }\n\n // we have to resume the old handler loop if:\n // - return value of the promise was `false`\n // - handlers are not exhausted yet\n const handlers = this._parseStack.handlers;\n let handlerPos = this._parseStack.handlerPos - 1;\n switch (this._parseStack.state) {\n case ParserStackType.CSI:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as CsiHandlerType[])[handlerPos](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.ESC:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as EscHandlerType[])[handlerPos]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.DCS:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserStackType.OSC:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n }\n // cleanup before continuing with the main sync loop\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1;\n this.precedingCodepoint = 0;\n this.currentState = this._parseStack.transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n\n // continue with main sync loop\n\n // process input string\n for (let i = start; i < length; ++i) {\n code = data[i];\n\n // normal transition & action lookup\n transition = this._transitions.table[this.currentState << TableAccess.INDEX_STATE_SHIFT | (code < 0xa0 ? code : NON_ASCII_PRINTABLE)];\n switch (transition >> TableAccess.TRANSITION_ACTION_SHIFT) {\n case ParserAction.PRINT:\n // read ahead with loop unrolling\n // Note: 0x20 (SP) is included, 0x7F (DEL) is excluded\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.EXECUTE:\n if (this._executeHandlers[code]) this._executeHandlers[code]();\n else this._executeHandlerFb(code);\n this.precedingCodepoint = 0;\n break;\n case ParserAction.IGNORE:\n break;\n case ParserAction.ERROR:\n const inject: IParsingState = this._errorHandler(\n {\n position: i,\n code,\n currentState: this.currentState,\n collect: this._collect,\n params: this._params,\n abort: false\n });\n if (inject.abort) return;\n // inject values: currently not implemented\n break;\n case ParserAction.CSI_DISPATCH:\n // Trigger CSI Handler\n const handlers = this._csiHandlers[this._collect << 8 | code];\n let j = handlers ? handlers.length - 1 : -1;\n for (; j >= 0; j--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlers[j](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.CSI, handlers, j, transition, i);\n return handlerResult;\n }\n }\n if (j < 0) {\n this._csiHandlerFb(this._collect << 8 | code, this._params);\n }\n this.precedingCodepoint = 0;\n break;\n case ParserAction.PARAM:\n // inner loop: digits (0x30 - 0x39) and ; (0x3b) and : (0x3a)\n do {\n switch (code) {\n case 0x3b:\n this._params.addParam(0); // ZDM\n break;\n case 0x3a:\n this._params.addSubParam(-1);\n break;\n default: // 0x30 - 0x39\n this._params.addDigit(code - 48);\n }\n } while (++i < length && (code = data[i]) > 0x2f && code < 0x3c);\n i--;\n break;\n case ParserAction.COLLECT:\n this._collect <<= 8;\n this._collect |= code;\n break;\n case ParserAction.ESC_DISPATCH:\n const handlersEsc = this._escHandlers[this._collect << 8 | code];\n let jj = handlersEsc ? handlersEsc.length - 1 : -1;\n for (; jj >= 0; jj--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlersEsc[jj]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.ESC, handlersEsc, jj, transition, i);\n return handlerResult;\n }\n }\n if (jj < 0) {\n this._escHandlerFb(this._collect << 8 | code);\n }\n this.precedingCodepoint = 0;\n break;\n case ParserAction.CLEAR:\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserAction.DCS_HOOK:\n this._dcsParser.hook(this._collect << 8 | code, this._params);\n break;\n case ParserAction.DCS_PUT:\n // inner loop - exit DCS_PUT: 0x18, 0x1a, 0x1b, 0x7f, 0x80 - 0x9f\n // unhook triggered by: 0x1b, 0x9c (success) and 0x18, 0x1a (abort)\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._dcsParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.DCS_UNHOOK:\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.DCS, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingCodepoint = 0;\n break;\n case ParserAction.OSC_START:\n this._oscParser.start();\n break;\n case ParserAction.OSC_PUT:\n // inner loop: 0x20 (SP) included, 0x7F (DEL) included\n for (let j = i + 1; ; j++) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._oscParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.OSC_END:\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.OSC, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingCodepoint = 0;\n break;\n }\n this.currentState = transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from 'common/parser/Types';\nimport { OscState, PAYLOAD_LIMIT } from 'common/parser/Constants';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { IDisposable } from 'common/Types';\n\nconst EMPTY_HANDLERS: IOscHandler[] = [];\n\nexport class OscParser implements IOscParser {\n private _state = OscState.START;\n private _active = EMPTY_HANDLERS;\n private _id = -1;\n private _handlers: IHandlerCollection = Object.create(null);\n private _handlerFb: OscFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public registerHandler(ident: number, handler: IOscHandler): IDisposable {\n if (this._handlers[ident] === undefined) {\n this._handlers[ident] = [];\n }\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n public setHandlerFallback(handler: OscFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public reset(): void {\n // force cleanup handlers if payload was already sent\n if (this._state === OscState.PAYLOAD) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].end(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n\n private _start(): void {\n this._active = this._handlers[this._id] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._id, 'START');\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].start();\n }\n }\n }\n\n private _put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._id, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public start(): void {\n // always reset leftover handlers\n this.reset();\n this._state = OscState.ID;\n }\n\n /**\n * Put data to current OSC command.\n * Expects the identifier of the OSC command in the form\n * OSC id ; payload ST/BEL\n * Payload chunks are not further processed and get\n * directly passed to the handlers.\n */\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._state === OscState.ABORT) {\n return;\n }\n if (this._state === OscState.ID) {\n while (start < end) {\n const code = data[start++];\n if (code === 0x3b) {\n this._state = OscState.PAYLOAD;\n this._start();\n break;\n }\n if (code < 0x30 || 0x39 < code) {\n this._state = OscState.ABORT;\n return;\n }\n if (this._id === -1) {\n this._id = 0;\n }\n this._id = this._id * 10 + code - 48;\n }\n }\n if (this._state === OscState.PAYLOAD && end - start > 0) {\n this._put(data, start, end);\n }\n }\n\n /**\n * Indicates end of an OSC command.\n * Whether the OSC got aborted or finished normally\n * is indicated by `success`.\n */\n public end(success: boolean, promiseResult: boolean = true): void | Promise {\n if (this._state === OscState.START) {\n return;\n }\n // do nothing if command was faulty\n if (this._state !== OscState.ABORT) {\n // if we are still in ID state and get an early end\n // means that the command has no payload thus we still have\n // to announce START and send END right after\n if (this._state === OscState.ID) {\n this._start();\n }\n\n if (!this._active.length) {\n this._handlerFb(this._id, 'END', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers\n // we always have to call .end for proper cleanup,\n // here we use `success` to indicate whether a handler should execute\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n}\n\n/**\n * Convenient class to allow attaching string based handler functions\n * as OSC handlers.\n */\nexport class OscHandler implements IOscHandler {\n private _data = '';\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string) => boolean | Promise) { }\n\n public start(): void {\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > PAYLOAD_LIMIT) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public end(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data);\n if (ret instanceof Promise) {\n // need to hold data until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IParams, ParamsArray } from 'common/parser/Types';\n\n// max value supported for a single param/subparam (clamped to positive int32 range)\nconst MAX_VALUE = 0x7FFFFFFF;\n// max allowed subparams for a single sequence (hardcoded limitation)\nconst MAX_SUBPARAMS = 256;\n\n/**\n * Params storage class.\n * This type is used by the parser to accumulate sequence parameters and sub parameters\n * and transmit them to the input handler actions.\n *\n * NOTES:\n * - params object for action handlers is borrowed, use `.toArray` or `.clone` to get a copy\n * - never read beyond `params.length - 1` (likely to contain arbitrary data)\n * - `.getSubParams` returns a borrowed typed array, use `.getSubParamsAll` for cloned sub params\n * - hardcoded limitations:\n * - max. value for a single (sub) param is 2^31 - 1 (greater values are clamped to that)\n * - max. 256 sub params possible\n * - negative values are not allowed beside -1 (placeholder for default value)\n *\n * About ZDM (Zero Default Mode):\n * ZDM is not orchestrated by this class. If the parser is in ZDM,\n * it should add 0 for empty params, otherwise -1. This does not apply\n * to subparams, empty subparams should always be added with -1.\n */\nexport class Params implements IParams {\n // params store and length\n public params: Int32Array;\n public length: number;\n\n // sub params store and length\n protected _subParams: Int32Array;\n protected _subParamsLength: number;\n\n // sub params offsets from param: param idx --> [start, end] offset\n private _subParamsIdx: Uint16Array;\n private _rejectDigits: boolean;\n private _rejectSubDigits: boolean;\n private _digitIsSub: boolean;\n\n /**\n * Create a `Params` type from JS array representation.\n */\n public static fromArray(values: ParamsArray): Params {\n const params = new Params();\n if (!values.length) {\n return params;\n }\n // skip leading sub params\n for (let i = (Array.isArray(values[0])) ? 1 : 0; i < values.length; ++i) {\n const value = values[i];\n if (Array.isArray(value)) {\n for (let k = 0; k < value.length; ++k) {\n params.addSubParam(value[k]);\n }\n } else {\n params.addParam(value);\n }\n }\n return params;\n }\n\n /**\n * @param maxLength max length of storable parameters\n * @param maxSubParamsLength max length of storable sub parameters\n */\n constructor(public maxLength: number = 32, public maxSubParamsLength: number = 32) {\n if (maxSubParamsLength > MAX_SUBPARAMS) {\n throw new Error('maxSubParamsLength must not be greater than 256');\n }\n this.params = new Int32Array(maxLength);\n this.length = 0;\n this._subParams = new Int32Array(maxSubParamsLength);\n this._subParamsLength = 0;\n this._subParamsIdx = new Uint16Array(maxLength);\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Clone object.\n */\n public clone(): Params {\n const newParams = new Params(this.maxLength, this.maxSubParamsLength);\n newParams.params.set(this.params);\n newParams.length = this.length;\n newParams._subParams.set(this._subParams);\n newParams._subParamsLength = this._subParamsLength;\n newParams._subParamsIdx.set(this._subParamsIdx);\n newParams._rejectDigits = this._rejectDigits;\n newParams._rejectSubDigits = this._rejectSubDigits;\n newParams._digitIsSub = this._digitIsSub;\n return newParams;\n }\n\n /**\n * Get a JS array representation of the current parameters and sub parameters.\n * The array is structured as follows:\n * sequence: \"1;2:3:4;5::6\"\n * array : [1, 2, [3, 4], 5, [-1, 6]]\n */\n public toArray(): ParamsArray {\n const res: ParamsArray = [];\n for (let i = 0; i < this.length; ++i) {\n res.push(this.params[i]);\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n res.push(Array.prototype.slice.call(this._subParams, start, end));\n }\n }\n return res;\n }\n\n /**\n * Reset to initial empty state.\n */\n public reset(): void {\n this.length = 0;\n this._subParamsLength = 0;\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Add a parameter value.\n * `Params` only stores up to `maxLength` parameters, any later\n * parameter will be ignored.\n * Note: VT devices only stored up to 16 values, xterm seems to\n * store up to 30.\n */\n public addParam(value: number): void {\n this._digitIsSub = false;\n if (this.length >= this.maxLength) {\n this._rejectDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength;\n this.params[this.length++] = value > MAX_VALUE ? MAX_VALUE : value;\n }\n\n /**\n * Add a sub parameter value.\n * The sub parameter is automatically associated with the last parameter value.\n * Thus it is not possible to add a subparameter without any parameter added yet.\n * `Params` only stores up to `subParamsLength` sub parameters, any later\n * sub parameter will be ignored.\n */\n public addSubParam(value: number): void {\n this._digitIsSub = true;\n if (!this.length) {\n return;\n }\n if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength) {\n this._rejectSubDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParams[this._subParamsLength++] = value > MAX_VALUE ? MAX_VALUE : value;\n this._subParamsIdx[this.length - 1]++;\n }\n\n /**\n * Whether parameter at index `idx` has sub parameters.\n */\n public hasSubParams(idx: number): boolean {\n return ((this._subParamsIdx[idx] & 0xFF) - (this._subParamsIdx[idx] >> 8) > 0);\n }\n\n /**\n * Return sub parameters for parameter at index `idx`.\n * Note: The values are borrowed, thus you need to copy\n * the values if you need to hold them in nonlocal scope.\n */\n public getSubParams(idx: number): Int32Array | null {\n const start = this._subParamsIdx[idx] >> 8;\n const end = this._subParamsIdx[idx] & 0xFF;\n if (end - start > 0) {\n return this._subParams.subarray(start, end);\n }\n return null;\n }\n\n /**\n * Return all sub parameters as {idx: subparams} mapping.\n * Note: The values are not borrowed.\n */\n public getSubParamsAll(): {[idx: number]: Int32Array} {\n const result: {[idx: number]: Int32Array} = {};\n for (let i = 0; i < this.length; ++i) {\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n result[i] = this._subParams.slice(start, end);\n }\n }\n return result;\n }\n\n /**\n * Add a single digit value to current parameter.\n * This is used by the parser to account digits on a char by char basis.\n */\n public addDigit(value: number): void {\n let length;\n if (this._rejectDigits\n || !(length = this._digitIsSub ? this._subParamsLength : this.length)\n || (this._digitIsSub && this._rejectSubDigits)\n ) {\n return;\n }\n\n const store = this._digitIsSub ? this._subParams : this.params;\n const cur = store[length - 1];\n store[length - 1] = ~cur ? Math.min(cur * 10 + value, MAX_VALUE) : value;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminalAddon, IDisposable, Terminal } from 'xterm';\n\nexport interface ILoadedAddon {\n instance: ITerminalAddon;\n dispose: () => void;\n isDisposed: boolean;\n}\n\nexport class AddonManager implements IDisposable {\n protected _addons: ILoadedAddon[] = [];\n\n constructor() {\n }\n\n public dispose(): void {\n for (let i = this._addons.length - 1; i >= 0; i--) {\n this._addons[i].instance.dispose();\n }\n }\n\n public loadAddon(terminal: Terminal, instance: ITerminalAddon): void {\n const loadedAddon: ILoadedAddon = {\n instance,\n dispose: instance.dispose,\n isDisposed: false\n };\n this._addons.push(loadedAddon);\n instance.dispose = () => this._wrappedAddonDispose(loadedAddon);\n instance.activate(terminal as any);\n }\n\n private _wrappedAddonDispose(loadedAddon: ILoadedAddon): void {\n if (loadedAddon.isDisposed) {\n // Do nothing if already disposed\n return;\n }\n let index = -1;\n for (let i = 0; i < this._addons.length; i++) {\n if (this._addons[i] === loadedAddon) {\n index = i;\n break;\n }\n }\n if (index === -1) {\n throw new Error('Could not dispose an addon that has not been loaded');\n }\n loadedAddon.isDisposed = true;\n loadedAddon.dispose.apply(loadedAddon.instance);\n this._addons.splice(index, 1);\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from 'xterm';\nimport { IBuffer } from 'common/buffer/Types';\nimport { BufferLineApiView } from 'common/public/BufferLineApiView';\nimport { CellData } from 'common/buffer/CellData';\n\nexport class BufferApiView implements IBufferApi {\n constructor(\n private _buffer: IBuffer,\n public readonly type: 'normal' | 'alternate'\n ) { }\n\n public init(buffer: IBuffer): BufferApiView {\n this._buffer = buffer;\n return this;\n }\n\n public get cursorY(): number { return this._buffer.y; }\n public get cursorX(): number { return this._buffer.x; }\n public get viewportY(): number { return this._buffer.ydisp; }\n public get baseY(): number { return this._buffer.ybase; }\n public get length(): number { return this._buffer.lines.length; }\n public getLine(y: number): IBufferLineApi | undefined {\n const line = this._buffer.lines.get(y);\n if (!line) {\n return undefined;\n }\n return new BufferLineApiView(line);\n }\n public getNullCell(): IBufferCellApi { return new CellData(); }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferLine, ICellData } from 'common/Types';\nimport { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from 'xterm';\n\nexport class BufferLineApiView implements IBufferLineApi {\n constructor(private _line: IBufferLine) { }\n\n public get isWrapped(): boolean { return this._line.isWrapped; }\n public get length(): number { return this._line.length; }\n public getCell(x: number, cell?: IBufferCellApi): IBufferCellApi | undefined {\n if (x < 0 || x >= this._line.length) {\n return undefined;\n }\n\n if (cell) {\n this._line.loadCell(x, cell as ICellData);\n return cell;\n }\n return this._line.loadCell(x, new CellData());\n }\n public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {\n return this._line.translateToString(trimRight, startColumn, endColumn);\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from 'xterm';\nimport { BufferApiView } from 'common/public/BufferApiView';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { ICoreTerminal } from 'common/Types';\n\nexport class BufferNamespaceApi implements IBufferNamespaceApi {\n private _normal: BufferApiView;\n private _alternate: BufferApiView;\n\n private readonly _onBufferChange = new EventEmitter();\n public readonly onBufferChange = this._onBufferChange.event;\n\n constructor(private _core: ICoreTerminal) {\n this._normal = new BufferApiView(this._core.buffers.normal, 'normal');\n this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');\n this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));\n }\n public get active(): IBufferApi {\n if (this._core.buffers.active === this._core.buffers.normal) { return this.normal; }\n if (this._core.buffers.active === this._core.buffers.alt) { return this.alternate; }\n throw new Error('Active buffer is neither normal nor alternate');\n }\n public get normal(): IBufferApi {\n return this._normal.init(this._core.buffers.normal);\n }\n public get alternate(): IBufferApi {\n return this._alternate.init(this._core.buffers.alt);\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParams } from 'common/parser/Types';\nimport { IDisposable, IFunctionIdentifier, IParser } from 'xterm';\nimport { ICoreTerminal } from 'common/Types';\n\nexport class ParserApi implements IParser {\n constructor(private _core: ICoreTerminal) { }\n\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));\n }\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerCsiHandler(id, callback);\n }\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerDcsHandler(id, (data: string, params: IParams) => callback(data, params.toArray()));\n }\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerDcsHandler(id, callback);\n }\n public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this._core.registerEscHandler(id, handler);\n }\n public addEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this.registerEscHandler(id, handler);\n }\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerOscHandler(ident, callback);\n }\n public addOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this.registerOscHandler(ident, callback);\n }\n}\n","/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreTerminal } from 'common/Types';\nimport { IUnicodeHandling, IUnicodeVersionProvider } from 'xterm';\n\nexport class UnicodeApi implements IUnicodeHandling {\n constructor(private _core: ICoreTerminal) { }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._core.unicodeService.register(provider);\n }\n\n public get versions(): string[] {\n return this._core.unicodeService.versions;\n }\n\n public get activeVersion(): string {\n return this._core.unicodeService.activeVersion;\n }\n\n public set activeVersion(version: string) {\n this._core.unicodeService.activeVersion = version;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { BufferSet } from 'common/buffer/BufferSet';\nimport { IBufferSet, IBuffer } from 'common/buffer/Types';\nimport { EventEmitter, IEventEmitter, IEvent } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { IAttributeData, IBufferLine, ScrollSource } from 'common/Types';\n\nexport const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars\nexport const MINIMUM_ROWS = 1;\n\nexport class BufferService extends Disposable implements IBufferService {\n public serviceBrand: any;\n\n public cols: number;\n public rows: number;\n public buffers: IBufferSet;\n /** Whether the user is scrolling (locks the scroll position) */\n public isUserScrolling: boolean = false;\n\n private readonly _onResize = this.register(new EventEmitter<{ cols: number, rows: number }>());\n public readonly onResize = this._onResize.event;\n private readonly _onScroll = this.register(new EventEmitter());\n public readonly onScroll = this._onScroll.event;\n\n public get buffer(): IBuffer { return this.buffers.active; }\n\n /** An IBufferline to clone/copy from for new blank lines */\n private _cachedBlankLine: IBufferLine | undefined;\n\n constructor(@IOptionsService optionsService: IOptionsService) {\n super();\n this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);\n this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);\n this.buffers = this.register(new BufferSet(optionsService, this));\n }\n\n public resize(cols: number, rows: number): void {\n this.cols = cols;\n this.rows = rows;\n this.buffers.resize(cols, rows);\n // TODO: This doesn't fire when scrollback changes - add a resize event to BufferSet and forward event\n this._onResize.fire({ cols, rows });\n }\n\n public reset(): void {\n this.buffers.reset();\n this.isUserScrolling = false;\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n const buffer = this.buffer;\n\n let newLine: IBufferLine | undefined;\n newLine = this._cachedBlankLine;\n if (!newLine || newLine.length !== this.cols || newLine.getFg(0) !== eraseAttr.fg || newLine.getBg(0) !== eraseAttr.bg) {\n newLine = buffer.getBlankLine(eraseAttr, isWrapped);\n this._cachedBlankLine = newLine;\n }\n newLine.isWrapped = isWrapped;\n\n const topRow = buffer.ybase + buffer.scrollTop;\n const bottomRow = buffer.ybase + buffer.scrollBottom;\n\n if (buffer.scrollTop === 0) {\n // Determine whether the buffer is going to be trimmed after insertion.\n const willBufferBeTrimmed = buffer.lines.isFull;\n\n // Insert the line using the fastest method\n if (bottomRow === buffer.lines.length - 1) {\n if (willBufferBeTrimmed) {\n buffer.lines.recycle().copyFrom(newLine);\n } else {\n buffer.lines.push(newLine.clone());\n }\n } else {\n buffer.lines.splice(bottomRow + 1, 0, newLine.clone());\n }\n\n // Only adjust ybase and ydisp when the buffer is not trimmed\n if (!willBufferBeTrimmed) {\n buffer.ybase++;\n // Only scroll the ydisp with ybase if the user has not scrolled up\n if (!this.isUserScrolling) {\n buffer.ydisp++;\n }\n } else {\n // When the buffer is full and the user has scrolled up, keep the text\n // stable unless ydisp is right at the top\n if (this.isUserScrolling) {\n buffer.ydisp = Math.max(buffer.ydisp - 1, 0);\n }\n }\n } else {\n // scrollTop is non-zero which means no line will be going to the\n // scrollback, instead we can just shift them in-place.\n const scrollRegionHeight = bottomRow - topRow + 1 /* as it's zero-based */;\n buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);\n buffer.lines.set(bottomRow, newLine.clone());\n }\n\n // Move the viewport to the bottom of the buffer unless the user is\n // scrolling.\n if (!this.isUserScrolling) {\n buffer.ydisp = buffer.ybase;\n }\n\n this._onScroll.fire(buffer.ydisp);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used\n * to avoid unwanted events being handled by the viewport when the event was triggered from the\n * viewport originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean, source?: ScrollSource): void {\n const buffer = this.buffer;\n if (disp < 0) {\n if (buffer.ydisp === 0) {\n return;\n }\n this.isUserScrolling = true;\n } else if (disp + buffer.ydisp >= buffer.ybase) {\n this.isUserScrolling = false;\n }\n\n const oldYdisp = buffer.ydisp;\n buffer.ydisp = Math.max(Math.min(buffer.ydisp + disp, buffer.ybase), 0);\n\n // No change occurred, don't trigger scroll/refresh\n if (oldYdisp === buffer.ydisp) {\n return;\n }\n\n if (!suppressScrollEvent) {\n this._onScroll.fire(buffer.ydisp);\n }\n }\n\n /**\n * Scroll the display of the terminal by a number of pages.\n * @param pageCount The number of pages to scroll (negative scrolls up).\n */\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n /**\n * Scrolls the display of the terminal to the top.\n */\n public scrollToTop(): void {\n this.scrollLines(-this.buffer.ydisp);\n }\n\n /**\n * Scrolls the display of the terminal to the bottom.\n */\n public scrollToBottom(): void {\n this.scrollLines(this.buffer.ybase - this.buffer.ydisp);\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharsetService } from 'common/services/Services';\nimport { ICharset } from 'common/Types';\n\nexport class CharsetService implements ICharsetService {\n public serviceBrand: any;\n\n public charset: ICharset | undefined;\n public glevel: number = 0;\n\n private _charsets: (ICharset | undefined)[] = [];\n\n public reset(): void {\n this.charset = undefined;\n this._charsets = [];\n this.glevel = 0;\n }\n\n public setgLevel(g: number): void {\n this.glevel = g;\n this.charset = this._charsets[g];\n }\n\n public setgCharset(g: number, charset: ICharset | undefined): void {\n this._charsets[g] = charset;\n if (this.glevel === g) {\n this.charset = charset;\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, ICoreService, ICoreMouseService } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\n\n/**\n * Supported default protocols.\n */\nconst DEFAULT_PROTOCOLS: { [key: string]: ICoreMouseProtocol } = {\n /**\n * NONE\n * Events: none\n * Modifiers: none\n */\n NONE: {\n events: CoreMouseEventType.NONE,\n restrict: () => false\n },\n /**\n * X10\n * Events: mousedown\n * Modifiers: none\n */\n X10: {\n events: CoreMouseEventType.DOWN,\n restrict: (e: ICoreMouseEvent) => {\n // no wheel, no move, no up\n if (e.button === CoreMouseButton.WHEEL || e.action !== CoreMouseAction.DOWN) {\n return false;\n }\n // no modifiers\n e.ctrl = false;\n e.alt = false;\n e.shift = false;\n return true;\n }\n },\n /**\n * VT200\n * Events: mousedown / mouseup / wheel\n * Modifiers: all\n */\n VT200: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL,\n restrict: (e: ICoreMouseEvent) => {\n // no move\n if (e.action === CoreMouseAction.MOVE) {\n return false;\n }\n return true;\n }\n },\n /**\n * DRAG\n * Events: mousedown / mouseup / wheel / mousedrag\n * Modifiers: all\n */\n DRAG: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL | CoreMouseEventType.DRAG,\n restrict: (e: ICoreMouseEvent) => {\n // no move without button\n if (e.action === CoreMouseAction.MOVE && e.button === CoreMouseButton.NONE) {\n return false;\n }\n return true;\n }\n },\n /**\n * ANY\n * Events: all mouse related events\n * Modifiers: all\n */\n ANY: {\n events:\n CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL\n | CoreMouseEventType.DRAG | CoreMouseEventType.MOVE,\n restrict: (e: ICoreMouseEvent) => true\n }\n};\n\nconst enum Modifiers {\n SHIFT = 4,\n ALT = 8,\n CTRL = 16\n}\n\n// helper for default encoders to generate the event code.\nfunction eventCode(e: ICoreMouseEvent, isSGR: boolean): number {\n let code = (e.ctrl ? Modifiers.CTRL : 0) | (e.shift ? Modifiers.SHIFT : 0) | (e.alt ? Modifiers.ALT : 0);\n if (e.button === CoreMouseButton.WHEEL) {\n code |= 64;\n code |= e.action;\n } else {\n code |= e.button & 3;\n if (e.button & 4) {\n code |= 64;\n }\n if (e.button & 8) {\n code |= 128;\n }\n if (e.action === CoreMouseAction.MOVE) {\n code |= CoreMouseAction.MOVE;\n } else if (e.action === CoreMouseAction.UP && !isSGR) {\n // special case - only SGR can report button on release\n // all others have to go with NONE\n code |= CoreMouseButton.NONE;\n }\n }\n return code;\n}\n\nconst S = String.fromCharCode;\n\n/**\n * Supported default encodings.\n */\nconst DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {\n /**\n * DEFAULT - CSI M Pb Px Py\n * Single byte encoding for coords and event code.\n * Can encode values up to 223 (1-based).\n */\n DEFAULT: (e: ICoreMouseEvent) => {\n const params = [eventCode(e, false) + 32, e.col + 32, e.row + 32];\n // supress mouse report if we exceed addressible range\n // Note this is handled differently by emulators\n // - xterm: sends 0;0 coords instead\n // - vte, konsole: no report\n if (params[0] > 255 || params[1] > 255 || params[2] > 255) {\n return '';\n }\n return `\\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`;\n },\n /**\n * SGR - CSI < Pb ; Px ; Py M|m\n * No encoding limitation.\n * Can report button on release and works with a well formed sequence.\n */\n SGR: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.col};${e.row}${final}`;\n },\n SGR_PIXELS: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.x};${e.y}${final}`;\n }\n};\n\n/**\n * CoreMouseService\n *\n * Provides mouse tracking reports with different protocols and encodings.\n * - protocols: NONE (default), X10, VT200, DRAG, ANY\n * - encodings: DEFAULT, SGR (UTF8, URXVT removed in #2507)\n *\n * Custom protocols/encodings can be added by `addProtocol` / `addEncoding`.\n * To activate a protocol/encoding, set `activeProtocol` / `activeEncoding`.\n * Switching a protocol will send a notification event `onProtocolChange`\n * with a list of needed events to track.\n *\n * The service handles the mouse tracking state and decides whether to send\n * a tracking report to the backend based on protocol and encoding limitations.\n * To send a mouse event call `triggerMouseEvent`.\n */\nexport class CoreMouseService extends Disposable implements ICoreMouseService {\n private _protocols: { [name: string]: ICoreMouseProtocol } = {};\n private _encodings: { [name: string]: CoreMouseEncoding } = {};\n private _activeProtocol: string = '';\n private _activeEncoding: string = '';\n private _lastEvent: ICoreMouseEvent | null = null;\n\n private readonly _onProtocolChange = this.register(new EventEmitter());\n public readonly onProtocolChange = this._onProtocolChange.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService\n ) {\n super();\n // register default protocols and encodings\n for (const name of Object.keys(DEFAULT_PROTOCOLS)) this.addProtocol(name, DEFAULT_PROTOCOLS[name]);\n for (const name of Object.keys(DEFAULT_ENCODINGS)) this.addEncoding(name, DEFAULT_ENCODINGS[name]);\n // call reset to set defaults\n this.reset();\n }\n\n public addProtocol(name: string, protocol: ICoreMouseProtocol): void {\n this._protocols[name] = protocol;\n }\n\n public addEncoding(name: string, encoding: CoreMouseEncoding): void {\n this._encodings[name] = encoding;\n }\n\n public get activeProtocol(): string {\n return this._activeProtocol;\n }\n\n public get areMouseEventsActive(): boolean {\n return this._protocols[this._activeProtocol].events !== 0;\n }\n\n public set activeProtocol(name: string) {\n if (!this._protocols[name]) {\n throw new Error(`unknown protocol \"${name}\"`);\n }\n this._activeProtocol = name;\n this._onProtocolChange.fire(this._protocols[name].events);\n }\n\n public get activeEncoding(): string {\n return this._activeEncoding;\n }\n\n public set activeEncoding(name: string) {\n if (!this._encodings[name]) {\n throw new Error(`unknown encoding \"${name}\"`);\n }\n this._activeEncoding = name;\n }\n\n public reset(): void {\n this.activeProtocol = 'NONE';\n this.activeEncoding = 'DEFAULT';\n this._lastEvent = null;\n }\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n public triggerMouseEvent(e: ICoreMouseEvent): boolean {\n // range check for col/row\n if (e.col < 0 || e.col >= this._bufferService.cols\n || e.row < 0 || e.row >= this._bufferService.rows) {\n return false;\n }\n\n // filter nonsense combinations of button + action\n if (e.button === CoreMouseButton.WHEEL && e.action === CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button === CoreMouseButton.NONE && e.action !== CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button !== CoreMouseButton.WHEEL && (e.action === CoreMouseAction.LEFT || e.action === CoreMouseAction.RIGHT)) {\n return false;\n }\n\n // report 1-based coords\n e.col++;\n e.row++;\n\n // debounce move events at grid or pixel level\n if (e.action === CoreMouseAction.MOVE\n && this._lastEvent\n && this._equalEvents(this._lastEvent, e, this._activeEncoding === 'SGR_PIXELS')\n ) {\n return false;\n }\n\n // apply protocol restrictions\n if (!this._protocols[this._activeProtocol].restrict(e)) {\n return false;\n }\n\n // encode report and send\n const report = this._encodings[this._activeEncoding](e);\n if (report) {\n // always send DEFAULT as binary data\n if (this._activeEncoding === 'DEFAULT') {\n this._coreService.triggerBinaryEvent(report);\n } else {\n this._coreService.triggerDataEvent(report, true);\n }\n }\n\n this._lastEvent = e;\n\n return true;\n }\n\n public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {\n return {\n down: !!(events & CoreMouseEventType.DOWN),\n up: !!(events & CoreMouseEventType.UP),\n drag: !!(events & CoreMouseEventType.DRAG),\n move: !!(events & CoreMouseEventType.MOVE),\n wheel: !!(events & CoreMouseEventType.WHEEL)\n };\n }\n\n private _equalEvents(e1: ICoreMouseEvent, e2: ICoreMouseEvent, pixels: boolean): boolean {\n if (pixels) {\n if (e1.x !== e2.x) return false;\n if (e1.y !== e2.y) return false;\n } else {\n if (e1.col !== e2.col) return false;\n if (e1.row !== e2.row) return false;\n }\n if (e1.button !== e2.button) return false;\n if (e1.action !== e2.action) return false;\n if (e1.ctrl !== e2.ctrl) return false;\n if (e1.alt !== e2.alt) return false;\n if (e1.shift !== e2.shift) return false;\n return true;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreService, ILogService, IOptionsService, IBufferService } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { IDecPrivateModes, IModes } from 'common/Types';\nimport { clone } from 'common/Clone';\nimport { Disposable } from 'common/Lifecycle';\n\nconst DEFAULT_MODES: IModes = Object.freeze({\n insertMode: false\n});\n\nconst DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({\n applicationCursorKeys: false,\n applicationKeypad: false,\n bracketedPasteMode: false,\n origin: false,\n reverseWraparound: false,\n sendFocus: false,\n wraparound: true // defaults: xterm - true, vt100 - false\n});\n\nexport class CoreService extends Disposable implements ICoreService {\n public serviceBrand: any;\n\n public isCursorInitialized: boolean = false;\n public isCursorHidden: boolean = false;\n public modes: IModes;\n public decPrivateModes: IDecPrivateModes;\n\n private readonly _onData = this.register(new EventEmitter());\n public readonly onData = this._onData.event;\n private readonly _onUserInput = this.register(new EventEmitter());\n public readonly onUserInput = this._onUserInput.event;\n private readonly _onBinary = this.register(new EventEmitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onRequestScrollToBottom = this.register(new EventEmitter());\n public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ILogService private readonly _logService: ILogService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n }\n\n public reset(): void {\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n }\n\n public triggerDataEvent(data: string, wasUserInput: boolean = false): void {\n // Prevents all events to pty process if stdin is disabled\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n\n // Input is being sent to the terminal, the terminal should focus the prompt.\n const buffer = this._bufferService.buffer;\n if (wasUserInput && this._optionsService.rawOptions.scrollOnUserInput && buffer.ybase !== buffer.ydisp) {\n this._onRequestScrollToBottom.fire();\n }\n\n // Fire onUserInput so listeners can react as well (eg. clear selection)\n if (wasUserInput) {\n this._onUserInput.fire();\n }\n\n // Fire onData API\n this._logService.debug(`sending data \"${data}\"`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onData.fire(data);\n }\n\n public triggerBinaryEvent(data: string): void {\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n this._logService.debug(`sending binary \"${data}\"`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onBinary.fire(data);\n }\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { css } from 'common/Color';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IDecorationService, IInternalDecoration } from 'common/services/Services';\nimport { SortedList } from 'common/SortedList';\nimport { IColor } from 'common/Types';\nimport { IDecorationOptions, IDecoration, IMarker, IEvent } from 'xterm';\n\n// Work variables to avoid garbage collection\nlet $xmin = 0;\nlet $xmax = 0;\n\nexport class DecorationService extends Disposable implements IDecorationService {\n public serviceBrand: any;\n\n /**\n * A list of all decorations, sorted by the marker's line value. This relies on the fact that\n * while marker line values do change, they should all change by the same amount so this should\n * never become out of order.\n */\n private readonly _decorations: SortedList = new SortedList(e => e?.marker.line);\n\n private readonly _onDecorationRegistered = this.register(new EventEmitter());\n public readonly onDecorationRegistered = this._onDecorationRegistered.event;\n private readonly _onDecorationRemoved = this.register(new EventEmitter());\n public readonly onDecorationRemoved = this._onDecorationRemoved.event;\n\n public get decorations(): IterableIterator { return this._decorations.values(); }\n\n constructor() {\n super();\n\n this.register(toDisposable(() => {\n for (const d of this._decorations.values()) {\n this._onDecorationRemoved.fire(d);\n }\n this.reset();\n }));\n }\n\n public registerDecoration(options: IDecorationOptions): IDecoration | undefined {\n if (options.marker.isDisposed) {\n return undefined;\n }\n const decoration = new Decoration(options);\n if (decoration) {\n const markerDispose = decoration.marker.onDispose(() => decoration.dispose());\n decoration.onDispose(() => {\n if (decoration) {\n if (this._decorations.delete(decoration)) {\n this._onDecorationRemoved.fire(decoration);\n }\n markerDispose.dispose();\n }\n });\n this._decorations.insert(decoration);\n this._onDecorationRegistered.fire(decoration);\n }\n return decoration;\n }\n\n public reset(): void {\n for (const d of this._decorations.values()) {\n d.dispose();\n }\n this._decorations.clear();\n }\n\n public *getDecorationsAtCell(x: number, line: number, layer?: 'bottom' | 'top'): IterableIterator {\n let xmin = 0;\n let xmax = 0;\n for (const d of this._decorations.getKeyIterator(line)) {\n xmin = d.options.x ?? 0;\n xmax = xmin + (d.options.width ?? 1);\n if (x >= xmin && x < xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n yield d;\n }\n }\n }\n\n public forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void {\n this._decorations.forEachByKey(line, d => {\n $xmin = d.options.x ?? 0;\n $xmax = $xmin + (d.options.width ?? 1);\n if (x >= $xmin && x < $xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n callback(d);\n }\n });\n }\n\n public dispose(): void {\n for (const d of this._decorations.values()) {\n this._onDecorationRemoved.fire(d);\n }\n this.reset();\n }\n}\n\nclass Decoration extends Disposable implements IInternalDecoration {\n public readonly marker: IMarker;\n public element: HTMLElement | undefined;\n public isDisposed: boolean = false;\n\n public readonly onRenderEmitter = this.register(new EventEmitter());\n public readonly onRender = this.onRenderEmitter.event;\n private readonly _onDispose = this.register(new EventEmitter());\n public readonly onDispose = this._onDispose.event;\n\n private _cachedBg: IColor | undefined | null = null;\n public get backgroundColorRGB(): IColor | undefined {\n if (this._cachedBg === null) {\n if (this.options.backgroundColor) {\n this._cachedBg = css.toColor(this.options.backgroundColor);\n } else {\n this._cachedBg = undefined;\n }\n }\n return this._cachedBg;\n }\n\n private _cachedFg: IColor | undefined | null = null;\n public get foregroundColorRGB(): IColor | undefined {\n if (this._cachedFg === null) {\n if (this.options.foregroundColor) {\n this._cachedFg = css.toColor(this.options.foregroundColor);\n } else {\n this._cachedFg = undefined;\n }\n }\n return this._cachedFg;\n }\n\n constructor(\n public readonly options: IDecorationOptions\n ) {\n super();\n this.marker = options.marker;\n if (this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position) {\n this.options.overviewRulerOptions.position = 'full';\n }\n }\n\n public override dispose(): void {\n this._onDispose.fire();\n super.dispose();\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInstantiationService, IServiceIdentifier } from 'common/services/Services';\nimport { getServiceDependencies } from 'common/services/ServiceRegistry';\n\nexport class ServiceCollection {\n\n private _entries = new Map, any>();\n\n constructor(...entries: [IServiceIdentifier, any][]) {\n for (const [id, service] of entries) {\n this.set(id, service);\n }\n }\n\n public set(id: IServiceIdentifier, instance: T): T {\n const result = this._entries.get(id);\n this._entries.set(id, instance);\n return result;\n }\n\n public forEach(callback: (id: IServiceIdentifier, instance: any) => any): void {\n for (const [key, value] of this._entries.entries()) {\n callback(key, value);\n }\n }\n\n public has(id: IServiceIdentifier): boolean {\n return this._entries.has(id);\n }\n\n public get(id: IServiceIdentifier): T | undefined {\n return this._entries.get(id);\n }\n}\n\nexport class InstantiationService implements IInstantiationService {\n public serviceBrand: undefined;\n\n private readonly _services: ServiceCollection = new ServiceCollection();\n\n constructor() {\n this._services.set(IInstantiationService, this);\n }\n\n public setService(id: IServiceIdentifier, instance: T): void {\n this._services.set(id, instance);\n }\n\n public getService(id: IServiceIdentifier): T | undefined {\n return this._services.get(id);\n }\n\n public createInstance(ctor: any, ...args: any[]): T {\n const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);\n\n const serviceArgs: any[] = [];\n for (const dependency of serviceDependencies) {\n const service = this._services.get(dependency.id);\n if (!service) {\n throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`);\n }\n serviceArgs.push(service);\n }\n\n const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;\n\n // check for argument mismatches, adjust static args if needed\n if (args.length !== firstServiceArgPos) {\n throw new Error(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);\n }\n\n // now create the instance\n return new ctor(...[...args, ...serviceArgs]);\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { ILogService, IOptionsService, LogLevelEnum } from 'common/services/Services';\n\ntype LogType = (message?: any, ...optionalParams: any[]) => void;\n\ninterface IConsole {\n log: LogType;\n error: LogType;\n info: LogType;\n trace: LogType;\n warn: LogType;\n}\n\n// console is available on both node.js and browser contexts but the common\n// module doesn't depend on them so we need to explicitly declare it.\ndeclare const console: IConsole;\n\nconst optionsKeyToLogLevel: { [key: string]: LogLevelEnum } = {\n debug: LogLevelEnum.DEBUG,\n info: LogLevelEnum.INFO,\n warn: LogLevelEnum.WARN,\n error: LogLevelEnum.ERROR,\n off: LogLevelEnum.OFF\n};\n\nconst LOG_PREFIX = 'xterm.js: ';\n\nexport class LogService extends Disposable implements ILogService {\n public serviceBrand: any;\n\n public logLevel: LogLevelEnum = LogLevelEnum.OFF;\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this._updateLogLevel();\n this.register(this._optionsService.onSpecificOptionChange('logLevel', () => this._updateLogLevel()));\n }\n\n private _updateLogLevel(): void {\n this.logLevel = optionsKeyToLogLevel[this._optionsService.rawOptions.logLevel];\n }\n\n private _evalLazyOptionalParams(optionalParams: any[]): void {\n for (let i = 0; i < optionalParams.length; i++) {\n if (typeof optionalParams[i] === 'function') {\n optionalParams[i] = optionalParams[i]();\n }\n }\n }\n\n private _log(type: LogType, message: string, optionalParams: any[]): void {\n this._evalLazyOptionalParams(optionalParams);\n type.call(console, LOG_PREFIX + message, ...optionalParams);\n }\n\n public debug(message: string, ...optionalParams: any[]): void {\n if (this.logLevel <= LogLevelEnum.DEBUG) {\n this._log(console.log, message, optionalParams);\n }\n }\n\n public info(message: string, ...optionalParams: any[]): void {\n if (this.logLevel <= LogLevelEnum.INFO) {\n this._log(console.info, message, optionalParams);\n }\n }\n\n public warn(message: string, ...optionalParams: any[]): void {\n if (this.logLevel <= LogLevelEnum.WARN) {\n this._log(console.warn, message, optionalParams);\n }\n }\n\n public error(message: string, ...optionalParams: any[]): void {\n if (this.logLevel <= LogLevelEnum.ERROR) {\n this._log(console.error, message, optionalParams);\n }\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService, ITerminalOptions, FontWeight } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { isMac } from 'common/Platform';\nimport { CursorStyle, IDisposable } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\n\nexport const DEFAULT_OPTIONS: Readonly> = {\n cols: 80,\n rows: 24,\n cursorBlink: false,\n cursorStyle: 'block',\n cursorWidth: 1,\n customGlyphs: true,\n drawBoldTextInBrightColors: true,\n fastScrollModifier: 'alt',\n fastScrollSensitivity: 5,\n fontFamily: 'courier-new, courier, monospace',\n fontSize: 15,\n fontWeight: 'normal',\n fontWeightBold: 'bold',\n lineHeight: 1.0,\n letterSpacing: 0,\n linkHandler: null,\n logLevel: 'info',\n scrollback: 1000,\n scrollOnUserInput: true,\n scrollSensitivity: 1,\n screenReaderMode: false,\n smoothScrollDuration: 0,\n macOptionIsMeta: false,\n macOptionClickForcesSelection: false,\n minimumContrastRatio: 1,\n disableStdin: false,\n allowProposedApi: false,\n allowTransparency: false,\n tabStopWidth: 8,\n theme: {},\n rightClickSelectsWord: isMac,\n windowOptions: {},\n windowsMode: false,\n wordSeparator: ' ()[]{}\\',\"`',\n altClickMovesCursor: true,\n convertEol: false,\n termName: 'xterm',\n cancelEvents: false,\n overviewRulerWidth: 0\n};\n\nconst FONT_WEIGHT_OPTIONS: Extract[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\n\nexport class OptionsService extends Disposable implements IOptionsService {\n public serviceBrand: any;\n\n public readonly rawOptions: Required;\n public options: Required;\n\n private readonly _onOptionChange = this.register(new EventEmitter());\n public readonly onOptionChange = this._onOptionChange.event;\n\n constructor(options: Partial) {\n super();\n // set the default value of each option\n const defaultOptions = { ...DEFAULT_OPTIONS };\n for (const key in options) {\n if (key in defaultOptions) {\n try {\n const newValue = options[key];\n defaultOptions[key] = this._sanitizeAndValidateOption(key, newValue);\n } catch (e) {\n console.error(e);\n }\n }\n }\n\n // set up getters and setters for each option\n this.rawOptions = defaultOptions;\n this.options = { ... defaultOptions };\n this._setupOptions();\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onSpecificOptionChange(key: T, listener: (value: ITerminalOptions[T]) => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (eventKey === key) {\n listener(this.rawOptions[key]);\n }\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (keys.indexOf(eventKey) !== -1) {\n listener();\n }\n });\n }\n\n private _setupOptions(): void {\n const getter = (propName: string): any => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n return this.rawOptions[propName];\n };\n\n const setter = (propName: string, value: any): void => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n\n value = this._sanitizeAndValidateOption(propName, value);\n // Don't fire an option change event if they didn't change\n if (this.rawOptions[propName] !== value) {\n this.rawOptions[propName] = value;\n this._onOptionChange.fire(propName);\n }\n };\n\n for (const propName in this.rawOptions) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this.options, propName, desc);\n }\n }\n\n private _sanitizeAndValidateOption(key: string, value: any): any {\n switch (key) {\n case 'cursorStyle':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n if (!isCursorStyle(value)) {\n throw new Error(`\"${value}\" is not a valid value for ${key}`);\n }\n break;\n case 'wordSeparator':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n break;\n case 'fontWeight':\n case 'fontWeightBold':\n if (typeof value === 'number' && 1 <= value && value <= 1000) {\n // already valid numeric value\n break;\n }\n value = FONT_WEIGHT_OPTIONS.includes(value) ? value : DEFAULT_OPTIONS[key];\n break;\n case 'cursorWidth':\n value = Math.floor(value);\n // Fall through for bounds check\n case 'lineHeight':\n case 'tabStopWidth':\n if (value < 1) {\n throw new Error(`${key} cannot be less than 1, value: ${value}`);\n }\n break;\n case 'minimumContrastRatio':\n value = Math.max(1, Math.min(21, Math.round(value * 10) / 10));\n break;\n case 'scrollback':\n value = Math.min(value, 4294967295);\n if (value < 0) {\n throw new Error(`${key} cannot be less than 0, value: ${value}`);\n }\n break;\n case 'fastScrollSensitivity':\n case 'scrollSensitivity':\n if (value <= 0) {\n throw new Error(`${key} cannot be less than or equal to 0, value: ${value}`);\n }\n case 'rows':\n case 'cols':\n if (!value && value !== 0) {\n throw new Error(`${key} must be numeric, value: ${value}`);\n }\n break;\n }\n return value;\n }\n}\n\nfunction isCursorStyle(value: unknown): value is CursorStyle {\n return value === 'block' || value === 'underline' || value === 'bar';\n}\n","/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, IOscLinkService } from 'common/services/Services';\nimport { IMarker, IOscLinkData } from 'common/Types';\n\nexport class OscLinkService implements IOscLinkService {\n public serviceBrand: any;\n\n private _nextId = 1;\n\n /**\n * A map of the link key to link entry. This is used to add additional lines to links with ids.\n */\n private _entriesWithId: Map = new Map();\n\n /**\n * A map of the link id to the link entry. The \"link id\" (number) which is the numberic\n * representation of a unique link should not be confused with \"id\" (string) which comes in with\n * `id=` in the OSC link's properties.\n */\n private _dataByLinkId: Map = new Map();\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n }\n\n public registerLink(data: IOscLinkData): number {\n const buffer = this._bufferService.buffer;\n\n // Links with no id will only ever be registered a single time\n if (data.id === undefined) {\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryNoId = {\n data,\n id: this._nextId++,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n // Add the line to the link if it already exists\n const castData = data as Required;\n const key = this._getEntryIdKey(castData);\n const match = this._entriesWithId.get(key);\n if (match) {\n this.addLineToLink(match.id, buffer.ybase + buffer.y);\n return match.id;\n }\n\n // Create the link\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryWithId = {\n id: this._nextId++,\n key: this._getEntryIdKey(castData),\n data: castData,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._entriesWithId.set(entry.key, entry);\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n public addLineToLink(linkId: number, y: number): void {\n const entry = this._dataByLinkId.get(linkId);\n if (!entry) {\n return;\n }\n if (entry.lines.every(e => e.line !== y)) {\n const marker = this._bufferService.buffer.addMarker(y);\n entry.lines.push(marker);\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n }\n }\n\n public getLinkData(linkId: number): IOscLinkData | undefined {\n return this._dataByLinkId.get(linkId)?.data;\n }\n\n private _getEntryIdKey(linkData: Required): string {\n return `${linkData.id};;${linkData.uri}`;\n }\n\n private _removeMarkerFromLink(entry: IOscLinkEntryNoId | IOscLinkEntryWithId, marker: IMarker): void {\n const index = entry.lines.indexOf(marker);\n if (index === -1) {\n return;\n }\n entry.lines.splice(index, 1);\n if (entry.lines.length === 0) {\n if (entry.data.id !== undefined) {\n this._entriesWithId.delete((entry as IOscLinkEntryWithId).key);\n }\n this._dataByLinkId.delete(entry.id);\n }\n }\n}\n\ninterface IOscLinkEntry {\n data: T;\n id: number;\n lines: IMarker[];\n}\n\ninterface IOscLinkEntryNoId extends IOscLinkEntry {\n}\n\ninterface IOscLinkEntryWithId extends IOscLinkEntry> {\n key: string;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IServiceIdentifier } from 'common/services/Services';\n\nconst DI_TARGET = 'di$target';\nconst DI_DEPENDENCIES = 'di$dependencies';\n\nexport const serviceRegistry: Map> = new Map();\n\nexport function getServiceDependencies(ctor: any): { id: IServiceIdentifier, index: number, optional: boolean }[] {\n return ctor[DI_DEPENDENCIES] || [];\n}\n\nexport function createDecorator(id: string): IServiceIdentifier {\n if (serviceRegistry.has(id)) {\n return serviceRegistry.get(id)!;\n }\n\n const decorator: any = function (target: Function, key: string, index: number): any {\n if (arguments.length !== 3) {\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\n }\n\n storeServiceDependency(decorator, target, index);\n };\n\n decorator.toString = () => id;\n\n serviceRegistry.set(id, decorator);\n return decorator;\n}\n\nfunction storeServiceDependency(id: Function, target: Function, index: number): void {\n if ((target as any)[DI_TARGET] === target) {\n (target as any)[DI_DEPENDENCIES].push({ id, index });\n } else {\n (target as any)[DI_DEPENDENCIES] = [{ id, index }];\n (target as any)[DI_TARGET] = target;\n }\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IEvent, IEventEmitter } from 'common/EventEmitter';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes, IAttributeData, ScrollSource, IDisposable, IColor, CursorStyle, IOscLinkData } from 'common/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport { IDecorationOptions, IDecoration, ILinkHandler } from 'xterm';\n\nexport const IBufferService = createDecorator('BufferService');\nexport interface IBufferService {\n serviceBrand: undefined;\n\n readonly cols: number;\n readonly rows: number;\n readonly buffer: IBuffer;\n readonly buffers: IBufferSet;\n isUserScrolling: boolean;\n onResize: IEvent<{ cols: number, rows: number }>;\n onScroll: IEvent;\n scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;\n scrollToBottom(): void;\n scrollToTop(): void;\n scrollToLine(line: number): void;\n scrollLines(disp: number, suppressScrollEvent?: boolean, source?: ScrollSource): void;\n scrollPages(pageCount: number): void;\n resize(cols: number, rows: number): void;\n reset(): void;\n}\n\nexport const ICoreMouseService = createDecorator('CoreMouseService');\nexport interface ICoreMouseService {\n activeProtocol: string;\n activeEncoding: string;\n areMouseEventsActive: boolean;\n addProtocol(name: string, protocol: ICoreMouseProtocol): void;\n addEncoding(name: string, encoding: CoreMouseEncoding): void;\n reset(): void;\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n triggerMouseEvent(event: ICoreMouseEvent): boolean;\n\n /**\n * Event to announce changes in mouse tracking.\n */\n onProtocolChange: IEvent;\n\n /**\n * Human readable version of mouse events.\n */\n explainEvents(events: CoreMouseEventType): { [event: string]: boolean };\n}\n\nexport const ICoreService = createDecorator('CoreService');\nexport interface ICoreService {\n serviceBrand: undefined;\n\n /**\n * Initially the cursor will not be visible until the first time the terminal\n * is focused.\n */\n isCursorInitialized: boolean;\n isCursorHidden: boolean;\n\n readonly modes: IModes;\n readonly decPrivateModes: IDecPrivateModes;\n\n readonly onData: IEvent;\n readonly onUserInput: IEvent;\n readonly onBinary: IEvent;\n readonly onRequestScrollToBottom: IEvent;\n\n reset(): void;\n\n /**\n * Triggers the onData event in the public API.\n * @param data The data that is being emitted.\n * @param wasUserInput Whether the data originated from the user (as opposed to\n * resulting from parsing incoming data). When true this will also:\n * - Scroll to the bottom of the buffer if option scrollOnUserInput is true.\n * - Fire the `onUserInput` event (so selection can be cleared).\n */\n triggerDataEvent(data: string, wasUserInput?: boolean): void;\n\n /**\n * Triggers the onBinary event in the public API.\n * @param data The data that is being emitted.\n */\n triggerBinaryEvent(data: string): void;\n}\n\nexport const ICharsetService = createDecorator('CharsetService');\nexport interface ICharsetService {\n serviceBrand: undefined;\n\n charset: ICharset | undefined;\n readonly glevel: number;\n\n reset(): void;\n\n /**\n * Set the G level of the terminal.\n * @param g\n */\n setgLevel(g: number): void;\n\n /**\n * Set the charset for the given G level of the terminal.\n * @param g\n * @param charset\n */\n setgCharset(g: number, charset: ICharset | undefined): void;\n}\n\nexport interface IServiceIdentifier {\n (...args: any[]): void;\n type: T;\n}\n\nexport interface IBrandedService {\n serviceBrand: undefined;\n}\n\ntype GetLeadingNonServiceArgs =\n Args extends [...IBrandedService[]] ? []\n : Args extends [infer A1, ...IBrandedService[]] ? [A1]\n : Args extends [infer A1, infer A2, ...IBrandedService[]] ? [A1, A2]\n : Args extends [infer A1, infer A2, infer A3, ...IBrandedService[]] ? [A1, A2, A3]\n : Args extends [infer A1, infer A2, infer A3, infer A4, ...IBrandedService[]] ? [A1, A2, A3, A4]\n : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, ...IBrandedService[]] ? [A1, A2, A3, A4, A5]\n : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6]\n : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6, A7]\n : Args extends [infer A1, infer A2, infer A3, infer A4, infer A5, infer A6, infer A7, infer A8, ...IBrandedService[]] ? [A1, A2, A3, A4, A5, A6, A7, A8]\n : never;\n\nexport const IInstantiationService = createDecorator('InstantiationService');\nexport interface IInstantiationService {\n serviceBrand: undefined;\n\n setService(id: IServiceIdentifier, instance: T): void;\n getService(id: IServiceIdentifier): T | undefined;\n createInstance any, R extends InstanceType>(t: Ctor, ...args: GetLeadingNonServiceArgs>): R;\n}\n\nexport enum LogLevelEnum {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n OFF = 4\n}\n\nexport const ILogService = createDecorator('LogService');\nexport interface ILogService {\n serviceBrand: undefined;\n\n logLevel: LogLevelEnum;\n\n debug(message: any, ...optionalParams: any[]): void;\n info(message: any, ...optionalParams: any[]): void;\n warn(message: any, ...optionalParams: any[]): void;\n error(message: any, ...optionalParams: any[]): void;\n}\n\nexport const IOptionsService = createDecorator('OptionsService');\nexport interface IOptionsService {\n serviceBrand: undefined;\n\n /**\n * Read only access to the raw options object, this is an internal-only fast path for accessing\n * single options without any validation as we trust TypeScript to enforce correct usage\n * internally.\n */\n readonly rawOptions: Required;\n\n /**\n * Options as exposed through the public API, this property uses getters and setters with\n * validation which makes it safer but slower. {@link rawOptions} should be used for pretty much\n * all internal usage for performance reasons.\n */\n readonly options: Required;\n\n /**\n * Adds an event listener for when any option changes.\n */\n readonly onOptionChange: IEvent;\n\n /**\n * Adds an event listener for when a specific option changes, this is a convenience method that is\n * preferred over {@link onOptionChange} when only a single option is being listened to.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onSpecificOptionChange(key: T, listener: (arg1: Required[T]) => any): IDisposable;\n\n /**\n * Adds an event listener for when a set of specific options change, this is a convenience method\n * that is preferred over {@link onOptionChange} when multiple options are being listened to and\n * handled the same way.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable;\n}\n\nexport type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';\n\nexport interface ITerminalOptions {\n allowProposedApi?: boolean;\n allowTransparency?: boolean;\n altClickMovesCursor?: boolean;\n cols?: number;\n convertEol?: boolean;\n cursorBlink?: boolean;\n cursorStyle?: CursorStyle;\n cursorWidth?: number;\n customGlyphs?: boolean;\n disableStdin?: boolean;\n drawBoldTextInBrightColors?: boolean;\n fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';\n fastScrollSensitivity?: number;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: FontWeight;\n fontWeightBold?: FontWeight;\n letterSpacing?: number;\n lineHeight?: number;\n linkHandler?: ILinkHandler | null;\n logLevel?: LogLevel;\n macOptionIsMeta?: boolean;\n macOptionClickForcesSelection?: boolean;\n minimumContrastRatio?: number;\n rightClickSelectsWord?: boolean;\n rows?: number;\n screenReaderMode?: boolean;\n scrollback?: number;\n scrollOnUserInput?: boolean;\n scrollSensitivity?: number;\n smoothScrollDuration?: number;\n tabStopWidth?: number;\n theme?: ITheme;\n windowsMode?: boolean;\n windowOptions?: IWindowOptions;\n wordSeparator?: string;\n overviewRulerWidth?: number;\n\n [key: string]: any;\n cancelEvents: boolean;\n termName: string;\n}\n\nexport interface ITheme {\n foreground?: string;\n background?: string;\n cursor?: string;\n cursorAccent?: string;\n selectionForeground?: string;\n selectionBackground?: string;\n selectionInactiveBackground?: string;\n black?: string;\n red?: string;\n green?: string;\n yellow?: string;\n blue?: string;\n magenta?: string;\n cyan?: string;\n white?: string;\n brightBlack?: string;\n brightRed?: string;\n brightGreen?: string;\n brightYellow?: string;\n brightBlue?: string;\n brightMagenta?: string;\n brightCyan?: string;\n brightWhite?: string;\n extendedAnsi?: string[];\n}\n\nexport const IOscLinkService = createDecorator('OscLinkService');\nexport interface IOscLinkService {\n serviceBrand: undefined;\n /**\n * Registers a link to the service, returning the link ID. The link data is managed by this\n * service and will be freed when this current cursor position is trimmed off the buffer.\n */\n registerLink(linkData: IOscLinkData): number;\n /**\n * Adds a line to a link if needed.\n */\n addLineToLink(linkId: number, y: number): void;\n /** Get the link data associated with a link ID. */\n getLinkData(linkId: number): IOscLinkData | undefined;\n}\n\nexport const IUnicodeService = createDecorator('UnicodeService');\nexport interface IUnicodeService {\n serviceBrand: undefined;\n /** Register an Unicode version provider. */\n register(provider: IUnicodeVersionProvider): void;\n /** Registered Unicode versions. */\n readonly versions: string[];\n /** Currently active version. */\n activeVersion: string;\n /** Event triggered, when activate version changed. */\n readonly onChange: IEvent;\n\n /**\n * Unicode version dependent\n */\n wcwidth(codepoint: number): number;\n getStringCellWidth(s: string): number;\n}\n\nexport interface IUnicodeVersionProvider {\n readonly version: string;\n wcwidth(ucs: number): 0 | 1 | 2;\n}\n\nexport const IDecorationService = createDecorator('DecorationService');\nexport interface IDecorationService extends IDisposable {\n serviceBrand: undefined;\n readonly decorations: IterableIterator;\n readonly onDecorationRegistered: IEvent;\n readonly onDecorationRemoved: IEvent;\n registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;\n reset(): void;\n /**\n * Trigger a callback over the decoration at a cell (in no particular order). This uses a callback\n * instead of an iterator as it's typically used in hot code paths.\n */\n forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void;\n}\nexport interface IInternalDecoration extends IDecoration {\n readonly options: IDecorationOptions;\n readonly backgroundColorRGB: IColor | undefined;\n readonly foregroundColorRGB: IColor | undefined;\n readonly onRenderEmitter: IEventEmitter;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IUnicodeService, IUnicodeVersionProvider } from 'common/services/Services';\nimport { EventEmitter, IEvent } from 'common/EventEmitter';\nimport { UnicodeV6 } from 'common/input/UnicodeV6';\n\nexport class UnicodeService implements IUnicodeService {\n public serviceBrand: any;\n\n private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);\n private _active: string = '';\n private _activeProvider: IUnicodeVersionProvider;\n\n private readonly _onChange = new EventEmitter();\n public readonly onChange = this._onChange.event;\n\n constructor() {\n const defaultProvider = new UnicodeV6();\n this.register(defaultProvider);\n this._active = defaultProvider.version;\n this._activeProvider = defaultProvider;\n }\n\n public dispose(): void {\n this._onChange.dispose();\n }\n\n public get versions(): string[] {\n return Object.keys(this._providers);\n }\n\n public get activeVersion(): string {\n return this._active;\n }\n\n public set activeVersion(version: string) {\n if (!this._providers[version]) {\n throw new Error(`unknown Unicode version \"${version}\"`);\n }\n this._active = version;\n this._activeProvider = this._providers[version];\n this._onChange.fire(version);\n }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._providers[provider.version] = provider;\n }\n\n /**\n * Unicode version dependent interface.\n */\n public wcwidth(num: number): number {\n return this._activeProvider.wcwidth(num);\n }\n\n public getStringCellWidth(s: string): number {\n let result = 0;\n const length = s.length;\n for (let i = 0; i < length; ++i) {\n let code = s.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n // this should not happen with strings retrieved from\n // Buffer.translateToString as it converts from UTF-32\n // and therefore always should contain the second part\n // for any other string we still have to handle it somehow:\n // simply treat the lonely surrogate first as a single char (UCS-2 behavior)\n return result + this.wcwidth(code);\n }\n const second = s.charCodeAt(i);\n // convert surrogate pair to high codepoint only for valid second part (UTF-16)\n // otherwise treat them independently (UCS-2 behavior)\n if (0xDC00 <= second && second <= 0xDFFF) {\n code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n result += this.wcwidth(second);\n }\n }\n result += this.wcwidth(code);\n }\n return result;\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Terminal as ITerminalApi, IMarker, IDisposable, ILocalizableStrings, ITerminalAddon, IBufferNamespace as IBufferNamespaceApi, IParser, ILinkProvider, IUnicodeHandling, IModes, IDecorationOptions, IDecoration } from 'xterm';\nimport { IBufferRange, ITerminal } from 'browser/Types';\nimport { Terminal as TerminalCore } from 'browser/Terminal';\nimport * as Strings from 'browser/LocalizableStrings';\nimport { IEvent } from 'common/EventEmitter';\nimport { ParserApi } from 'common/public/ParserApi';\nimport { UnicodeApi } from 'common/public/UnicodeApi';\nimport { AddonManager } from 'common/public/AddonManager';\nimport { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';\nimport { ITerminalOptions } from 'common/Types';\n\n/**\n * The set of options that only have an effect when set in the Terminal constructor.\n */\nconst CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows'];\n\nexport class Terminal implements ITerminalApi {\n private _core: ITerminal;\n private _addonManager: AddonManager;\n private _parser: IParser | undefined;\n private _buffer: BufferNamespaceApi | undefined;\n private _publicOptions: Required;\n\n constructor(options?: ITerminalOptions) {\n this._core = new TerminalCore(options);\n this._addonManager = new AddonManager();\n\n this._publicOptions = { ... this._core.options };\n const getter = (propName: string): any => {\n return this._core.options[propName];\n };\n const setter = (propName: string, value: any): void => {\n this._checkReadonlyOptions(propName);\n this._core.options[propName] = value;\n };\n\n for (const propName in this._core.options) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this._publicOptions, propName, desc);\n }\n }\n\n private _checkReadonlyOptions(propName: string): void {\n // Throw an error if any constructor only option is modified\n // from terminal.options\n // Modifications from anywhere else are allowed\n if (CONSTRUCTOR_ONLY_OPTIONS.includes(propName)) {\n throw new Error(`Option \"${propName}\" can only be set in the constructor`);\n }\n }\n\n private _checkProposedApi(): void {\n if (!this._core.optionsService.rawOptions.allowProposedApi) {\n throw new Error('You must set the allowProposedApi option to true to use proposed API');\n }\n }\n\n public get onBell(): IEvent { return this._core.onBell; }\n public get onBinary(): IEvent { return this._core.onBinary; }\n public get onCursorMove(): IEvent { return this._core.onCursorMove; }\n public get onData(): IEvent { return this._core.onData; }\n public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }\n public get onLineFeed(): IEvent { return this._core.onLineFeed; }\n public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }\n public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }\n public get onScroll(): IEvent { return this._core.onScroll; }\n public get onSelectionChange(): IEvent { return this._core.onSelectionChange; }\n public get onTitleChange(): IEvent { return this._core.onTitleChange; }\n public get onWriteParsed(): IEvent { return this._core.onWriteParsed; }\n\n public get element(): HTMLElement | undefined { return this._core.element; }\n public get parser(): IParser {\n if (!this._parser) {\n this._parser = new ParserApi(this._core);\n }\n return this._parser;\n }\n public get unicode(): IUnicodeHandling {\n this._checkProposedApi();\n return new UnicodeApi(this._core);\n }\n public get textarea(): HTMLTextAreaElement | undefined { return this._core.textarea; }\n public get rows(): number { return this._core.rows; }\n public get cols(): number { return this._core.cols; }\n public get buffer(): IBufferNamespaceApi {\n if (!this._buffer) {\n this._buffer = new BufferNamespaceApi(this._core);\n }\n return this._buffer;\n }\n public get markers(): ReadonlyArray {\n this._checkProposedApi();\n return this._core.markers;\n }\n public get modes(): IModes {\n const m = this._core.coreService.decPrivateModes;\n let mouseTrackingMode: 'none' | 'x10' | 'vt200' | 'drag' | 'any' = 'none';\n switch (this._core.coreMouseService.activeProtocol) {\n case 'X10': mouseTrackingMode = 'x10'; break;\n case 'VT200': mouseTrackingMode = 'vt200'; break;\n case 'DRAG': mouseTrackingMode = 'drag'; break;\n case 'ANY': mouseTrackingMode = 'any'; break;\n }\n return {\n applicationCursorKeysMode: m.applicationCursorKeys,\n applicationKeypadMode: m.applicationKeypad,\n bracketedPasteMode: m.bracketedPasteMode,\n insertMode: this._core.coreService.modes.insertMode,\n mouseTrackingMode: mouseTrackingMode,\n originMode: m.origin,\n reverseWraparoundMode: m.reverseWraparound,\n sendFocusMode: m.sendFocus,\n wraparoundMode: m.wraparound\n };\n }\n public get options(): Required {\n return this._publicOptions;\n }\n public set options(options: ITerminalOptions) {\n for (const propName in options) {\n this._publicOptions[propName] = options[propName];\n }\n }\n public blur(): void {\n this._core.blur();\n }\n public focus(): void {\n this._core.focus();\n }\n public resize(columns: number, rows: number): void {\n this._verifyIntegers(columns, rows);\n this._core.resize(columns, rows);\n }\n public open(parent: HTMLElement): void {\n this._core.open(parent);\n }\n public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {\n this._core.attachCustomKeyEventHandler(customKeyEventHandler);\n }\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._core.registerLinkProvider(linkProvider);\n }\n public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {\n this._checkProposedApi();\n return this._core.registerCharacterJoiner(handler);\n }\n public deregisterCharacterJoiner(joinerId: number): void {\n this._checkProposedApi();\n this._core.deregisterCharacterJoiner(joinerId);\n }\n public registerMarker(cursorYOffset: number = 0): IMarker | undefined {\n this._verifyIntegers(cursorYOffset);\n return this._core.addMarker(cursorYOffset);\n }\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n this._checkProposedApi();\n this._verifyPositiveIntegers(decorationOptions.x ?? 0, decorationOptions.width ?? 0, decorationOptions.height ?? 0);\n return this._core.registerDecoration(decorationOptions);\n }\n public hasSelection(): boolean {\n return this._core.hasSelection();\n }\n public select(column: number, row: number, length: number): void {\n this._verifyIntegers(column, row, length);\n this._core.select(column, row, length);\n }\n public getSelection(): string {\n return this._core.getSelection();\n }\n public getSelectionPosition(): IBufferRange | undefined {\n return this._core.getSelectionPosition();\n }\n public clearSelection(): void {\n this._core.clearSelection();\n }\n public selectAll(): void {\n this._core.selectAll();\n }\n public selectLines(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.selectLines(start, end);\n }\n public dispose(): void {\n this._addonManager.dispose();\n this._core.dispose();\n }\n public scrollLines(amount: number): void {\n this._verifyIntegers(amount);\n this._core.scrollLines(amount);\n }\n public scrollPages(pageCount: number): void {\n this._verifyIntegers(pageCount);\n this._core.scrollPages(pageCount);\n }\n public scrollToTop(): void {\n this._core.scrollToTop();\n }\n public scrollToBottom(): void {\n this._core.scrollToBottom();\n }\n public scrollToLine(line: number): void {\n this._verifyIntegers(line);\n this._core.scrollToLine(line);\n }\n public clear(): void {\n this._core.clear();\n }\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data, callback);\n }\n public writeln(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data);\n this._core.write('\\r\\n', callback);\n }\n public paste(data: string): void {\n this._core.paste(data);\n }\n public refresh(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.refresh(start, end);\n }\n public reset(): void {\n this._core.reset();\n }\n public clearTextureAtlas(): void {\n this._core.clearTextureAtlas();\n }\n public loadAddon(addon: ITerminalAddon): void {\n return this._addonManager.loadAddon(this, addon);\n }\n public static get strings(): ILocalizableStrings {\n return Strings;\n }\n\n private _verifyIntegers(...values: number[]): void {\n for (const value of values) {\n if (value === Infinity || isNaN(value) || value % 1 !== 0) {\n throw new Error('This API only accepts integers');\n }\n }\n }\n\n private _verifyPositiveIntegers(...values: number[]): void {\n for (const value of values) {\n if (value && (value === Infinity || isNaN(value) || value % 1 !== 0 || value < 0)) {\n throw new Error('This API only accepts positive integers');\n }\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","a","i","self","AccessibilityManager","Disposable","constructor","_terminal","_renderService","super","_liveRegionLineCount","_charsToConsume","_charsToAnnounce","this","_accessibilityTreeRoot","document","createElement","classList","add","tabIndex","_rowContainer","setAttribute","_rowElements","rows","_createAccessibilityTreeNode","appendChild","_topBoundaryFocusListener","e","_handleBoundaryFocus","_bottomBoundaryFocusListener","addEventListener","length","_refreshRowsDimensions","_renderRowsDebouncer","TimeBasedDebouncer","_renderRows","bind","_refreshRows","_liveRegion","element","Error","insertAdjacentElement","register","onResize","_handleResize","onRender","start","end","onScroll","onA11yChar","char","_handleChar","onLineFeed","onA11yTab","spaceCount","_handleTab","onKey","_handleKey","key","onBlur","_clearLiveRegion","onDimensionsChange","_screenDprMonitor","ScreenDprMonitor","window","setListener","addDisposableDomListener","toDisposable","removeElementFromParent","position","boundaryElement","target","beforeBoundaryElement","getAttribute","buffer","lines","relatedTarget","topBoundaryElement","bottomBoundaryElement","pop","removeChild","shift","removeEventListener","newElement","unshift","push","scrollLines","focus","preventDefault","stopImmediatePropagation","children","_refreshRowDimensions","MAX_ROWS_TO_READ","textContent","Strings","tooMuchOutput","isMac","parentNode","setTimeout","keyChar","test","refresh","setSize","toString","lineData","translateBufferLineToString","ydisp","posInSet","innerText","_announceCharacters","dimensions","css","cell","height","style","width","canvas","prepareTextForTerminal","text","replace","bracketTextForPaste","bracketedPasteMode","paste","textarea","coreService","decPrivateModes","triggerDataEvent","value","moveTextAreaUnderMouseCursor","ev","screenElement","pos","getBoundingClientRect","left","clientX","top","clientY","zIndex","selectionService","clipboardData","setData","selectionText","stopPropagation","getData","shouldSelectWord","rightClickSelect","select","_color","TwoKeyMap","_css","setCss","bg","fg","set","getCss","get","setColor","getColor","clear","elements","parentElement","node","type","handler","options","disposed","dispose","Linkifier2","_bufferService","_linkProviders","_linkCacheDisposables","_isMouseOut","_activeLine","_onShowLinkUnderline","EventEmitter","onShowLinkUnderline","event","_onHideLinkUnderline","onHideLinkUnderline","getDisposeArrayDisposable","_lastMouseEvent","undefined","currentLink","_currentLink","registerLinkProvider","linkProvider","providerIndex","indexOf","splice","attachToDom","mouseService","renderService","_element","_mouseService","_clearCurrentLink","_handleMouseMove","_handleMouseDown","_handleMouseUp","_positionFromMouseEvent","composedPath","contains","_lastBufferCell","x","y","_handleHover","_askForLink","_linkAtPosition","link","useLineCache","_activeProviderReplies","forEach","reply","linkWithState","Map","linkProvided","entries","_checkLinkProviderResult","provideLinks","links","linksWithState","map","size","_removeIntersectingLinks","replies","occupiedCells","Set","providerReply","startX","range","endX","cols","has","index","hasLinkBefore","j","linkAtPosition","find","_handleNewLink","_mouseDownLink","activate","startRow","endRow","_linkLeave","disposeArray","state","decorations","underline","pointerCursor","isHovered","_linkHover","Object","defineProperties","v","toggle","_fireUnderlineEvent","onRenderedViewportChange","oldEvent","hover","showEvent","scrollOffset","_createLinkUnderlineEvent","fire","remove","leave","lower","upper","current","coords","getCoords","x1","y1","x2","y2","IBufferService","promptLabel","OscLinkProvider","_optionsService","_oscLinkService","callback","line","result","linkHandler","rawOptions","CellData","lineLength","getTrimmedLength","currentLinkId","currentStart","finishLink","hasContent","loadCell","hasExtendedAttrs","extended","urlId","getLinkData","uri","ignoreLink","allowNonHttpProtocols","parsed","URL","includes","protocol","defaultActivate","confirm","newWindow","open","opener","location","href","console","warn","IOptionsService","IOscLinkService","_parentWindow","_renderCallback","_refreshCallbacks","_animationFrame","cancelAnimationFrame","addRefreshCallback","requestAnimationFrame","_innerRefresh","rowStart","rowEnd","rowCount","_rowCount","_rowStart","Math","min","_rowEnd","max","_runRefreshCallbacks","_currentDevicePixelRatio","devicePixelRatio","clearListener","listener","_listener","_outerListener","_updateDpr","_resolutionMediaMatchList","removeListener","matchMedia","addListener","Terminal","CoreTerminal","browser","Browser","_keyDownHandled","_keyDownSeen","_keyPressHandled","_unprocessedDeadKey","_onCursorMove","onCursorMove","_onKey","_onRender","_onSelectionChange","onSelectionChange","_onTitleChange","onTitleChange","_onBell","onBell","_onFocus","_onBlur","_onA11yCharEmitter","_onA11yTabEmitter","_onWillOpen","_setup","linkifier2","_instantiationService","createInstance","_decorationService","DecorationService","setService","IDecorationService","_inputHandler","onRequestBell","onRequestRefreshRows","onRequestSendFocus","_reportFocus","onRequestReset","reset","onRequestWindowsOptionsReport","_reportWindowsOptions","onColor","_handleColorEvent","forwardEvent","_afterResize","_customKeyEventHandler","onFocus","onWillOpen","_themeService","req","acc","ident","channels","color","toColorRGB","colors","ansi","C0","ESC","toRgbString","C1_ESCAPED","ST","modifyColors","rgba","toColor","narrowedAcc","restoreColor","buffers","active","preventScroll","_handleScreenReaderModeOptionChange","_accessibilityManager","_handleTextAreaFocus","sendFocus","updateCursorStyle","_showCursor","blur","_handleTextAreaBlur","_syncTextArea","isCursorInViewport","_compositionHelper","isComposing","cursorY","ybase","bufferLine","cursorX","cellHeight","getWidth","cellWidth","cursorTop","cursorLeft","lineHeight","_initGlobal","_bindKeys","hasSelection","copyHandler","_selectionService","pasteHandlerWrapper","handlePasteEvent","isFirefox","button","rightClickHandler","rightClickSelectsWord","isLinux","_keyUp","_keyDown","_keyPress","compositionstart","compositionupdate","compositionend","_inputEvent","updateCompositionElements","parent","isConnected","_logService","debug","_document","ownerDocument","dir","fragment","createDocumentFragment","_viewportElement","_viewportScrollArea","_helperContainer","isChromeOS","_coreBrowserService","CoreBrowserService","defaultView","ICoreBrowserService","_charSizeService","CharSizeService","ICharSizeService","ThemeService","IThemeService","_characterJoinerService","CharacterJoinerService","ICharacterJoinerService","RenderService","IRenderService","resize","_compositionView","CompositionHelper","hasRenderer","setRenderer","_createRenderer","MouseService","IMouseService","viewport","Viewport","amount","onRequestSyncScrollBar","syncScrollArea","handleCursorMove","handleResize","handleBlur","handleFocus","SelectionService","ISelectionService","onRequestScrollLines","suppressScrollEvent","onRequestRedraw","handleSelectionChanged","columnSelectMode","onLinuxMouseSelection","_onScroll","BufferDecorationRenderer","handleMouseDown","coreMouseService","areMouseEventsActive","disable","enable","screenReaderMode","optionsService","onSpecificOptionChange","overviewRulerWidth","_overviewRulerRenderer","OverviewRulerRenderer","measure","bindMouse","DomRenderer","el","sendEvent","getMouseReportCoords","but","action","overrideType","buttons","getLinesScrolled","deltaY","triggerMouseEvent","col","row","ctrl","ctrlKey","alt","altKey","shiftKey","requestedEvents","mouseup","wheel","mousedrag","mousemove","eventListeners","cancel","onProtocolChange","events","logLevel","explainEvents","passive","activeProtocol","shouldForceSelection","hasScrollback","sequence","applicationCursorKeys","data","abs","handleWheel","handleTouchStart","handleTouchMove","refreshRows","shouldColumnSelect","isCursorInitialized","disp","source","attachCustomKeyEventHandler","customKeyEventHandler","registerCharacterJoiner","joinerId","deregisterCharacterJoiner","deregister","markers","addMarker","cursorYOffset","registerDecoration","decorationOptions","column","setSelection","getSelection","getSelectionPosition","selectionStart","selectionEnd","clearSelection","selectAll","selectLines","shouldIgnoreComposition","macOptionIsMeta","keydown","scrollOnUserInput","scrollToBottom","evaluateKeyboardEvent","scrollCount","_isThirdLevelShift","metaKey","charCodeAt","ETX","CR","domEvent","thirdLevelKey","isWindows","getModifierState","keyCode","wasModifierKeyOnlyEvent","charCode","which","String","fromCharCode","inputType","composed","hasValidSize","clearAllMarkers","getBlankLine","DEFAULT_ATTR_DATA","clearTextureAtlas","WindowsOptionsReportType","GET_WIN_SIZE_PIXELS","canvasWidth","toFixed","canvasHeight","GET_CELL_SIZE_PIXELS","force","cancelEvents","_debounceThresholdMS","_lastRefreshMs","_additionalRefreshRequested","_refreshTimeoutID","clearTimeout","refreshRequestTime","Date","now","elapsed","waitPeriodBeforeTrailingRefresh","_scrollLines","_scrollArea","themeService","scrollBarWidth","_currentRowHeight","_currentDeviceCellHeight","_lastRecordedBufferLength","_lastRecordedViewportHeight","_lastRecordedBufferHeight","_lastTouchY","_lastScrollTop","_wheelPartialScroll","_refreshAnimationFrame","_ignoreNextScrollEvent","_smoothScrollState","startTime","origin","offsetWidth","_handleScroll","_activeBuffer","onBufferActivate","activeBuffer","_renderDimensions","_handleThemeChange","onChangeColors","backgroundColor","background","_refresh","immediate","device","dpr","offsetHeight","newBufferHeight","round","scrollTop","offsetParent","diff","_smoothScroll","_isDisposed","percent","_smoothScrollPercent","_clearSmoothScrollState","smoothScrollDuration","_bubbleScroll","scrollPosFromTop","cancelable","_getPixelsScrolled","scrollHeight","_applyScrollModifier","deltaMode","WheelEvent","DOM_DELTA_LINE","DOM_DELTA_PAGE","DOM_DELTA_PIXEL","floor","modifier","fastScrollModifier","fastScrollSensitivity","scrollSensitivity","touches","pageY","_screenElement","_decorationElements","_altBufferIsActive","_dimensionsChanged","_container","_doRefreshDecorations","_queueRefresh","onDecorationRegistered","onDecorationRemoved","decoration","_removeDecoration","_renderDecoration","_refreshStyle","_refreshXPosition","_createElement","marker","display","onRenderEmitter","anchor","right","delete","_zones","_zonePool","_zonePoolIndex","_linePadding","full","center","zones","addDecoration","overviewRulerOptions","z","_lineIntersectsZone","_lineAdjacentToZone","_addLineToZone","startBufferLine","endBufferLine","setPadding","padding","zone","drawHeight","drawWidth","drawX","_coreBrowseService","_colorZoneStore","ColorZoneStore","_shouldUpdateDimensions","_shouldUpdateAnchor","_lastKnownBufferLength","_canvas","_refreshCanvasDimensions","insertBefore","ctx","getContext","_ctx","_registerDecorationListeners","_registerBufferChangeListeners","_registerDimensionChangeListeners","_width","normal","_refreshDrawHeightConstants","_refreshColorZonePadding","_containerHeight","clientHeight","_refreshDrawConstants","outerWidth","innerWidth","ceil","pixelsPerLine","nonFullHeight","_refreshDecorations","clearRect","lineWidth","_renderColorZone","fillStyle","fillRect","updateCanvasDimensions","updateAnchor","_textarea","_coreService","_isComposing","_isSendingComposition","_compositionPosition","_dataAlreadySent","_finalizeComposition","_handleAnyTextareaChanges","waitForPropagation","currentCompositionPosition","input","substring","oldValue","newValue","DEL","dontRecurse","fontFamily","fontSize","compositionViewBounds","ICoreService","getCoordsRelativeToElement","rect","elementStyle","getComputedStyle","leftPadding","parseInt","getPropertyValue","topPadding","colCount","hasValidCharSize","cssCellWidth","cssCellHeight","isSelection","moveToRequestedRow","startY","targetY","bufferService","applicationCursor","wrappedRowsForRow","rowsToMove","wrappedRows","direction","verticalDirection","isWrapped","wrappedRowsCount","repeat","currentRow","lineWraps","startCol","endCol","forward","currentCol","bufferStr","mod","count","str","rpt","targetX","resetStartingRow","horizontalDirection","moveToRequestedCol","rowDifference","currX","colsFromRowEnd","TERMINAL_CLASS_PREFIX","FOCUS_CLASS","nextTerminalId","_linkifier2","instantiationService","_terminalClass","_cellToRowElements","_refreshRowElements","_selectionContainer","createRenderDimensions","_updateDimensions","onOptionChange","_handleOptionsChanged","_injectCss","_rowFactory","DomRendererRowFactory","_handleLinkHover","_handleLinkLeave","_themeStyleElement","_dimensionsStyleElement","letterSpacing","overflow","styles","_terminalSelector","foreground","BOLD_CLASS","fontWeight","fontWeightBold","ITALIC_CLASS","cursor","cursorAccent","CURSOR_CLASS","CURSOR_STYLE_BLOCK_CLASS","CURSOR_BLINK_CLASS","CURSOR_STYLE_BAR_CLASS","cursorWidth","CURSOR_STYLE_UNDERLINE_CLASS","selectionBackgroundOpaque","selectionInactiveBackgroundOpaque","c","INVERTED_DEFAULT_COLOR","opaque","handleDevicePixelRatioChange","handleCharSizeChanged","renderRows","viewportStartRow","viewportEndRow","viewportCappedStartRow","viewportCappedEndRow","documentFragment","isXFlipped","_createSelectionElement","middleRowsCount","colStart","colEnd","replaceChildren","cursorAbsoluteY","cursorBlink","rowElement","cursorStyle","Int16Array","createRow","_setCellUnderline","enabled","span","textDecoration","IInstantiationService","DIM_CLASS","UNDERLINE_CLASS","STRIKETHROUGH_CLASS","_workCell","_columnSelectMode","_selectionStart","_selectionEnd","isCursorRow","cellMap","joinedRanges","getJoinedCharacters","getCode","NULL_CELL_CODE","elemIndex","isJoined","lastCharX","JoinedCellData","translateToString","charElement","isCursorHidden","isBold","isItalic","isDim","isInvisible","WHITESPACE_CELL_CHAR","getChars","isUnderline","underlineStyle","isUnderlineColorDefault","isUnderlineColorRGB","textDecorationColor","AttributeData","getUnderlineColor","join","drawBoldTextInBrightColors","isStrikethrough","getFgColor","fgColorMode","getFgColorMode","getBgColor","bgColorMode","getBgColorMode","isInverse","temp","temp2","bgOverride","fgOverride","isTop","forEachDecorationAtCell","d","layer","backgroundColorRGB","foregroundColorRGB","isInSelection","_isCellInSelection","resolvedBg","selectionForeground","isFocused","_addStyle","padStart","multiplyOpacity","_applyMinimumContrast","subarray","fill","minimumContrastRatio","excludeFromContrastRatioDemands","adjustedColor","contrastCache","ensureContrastRatio","padChar","DIM_OPACITY","TEXT_BASELINE","isLegacyEdge","isPowerlineGlyph","codepoint","isBoxOrBlockGlyph","isSelectAllActive","selectionStartLength","finalSelectionStart","areSelectionValuesReversed","finalSelectionEnd","startPlusLength","handleTrim","_onCharSizeChange","onCharSizeChange","_measureStrategy","DomMeasureStrategy","onMultipleOptionChange","_parentElement","_result","_measureElement","geometry","firstCell","chars","content","combinedData","isCombined","setFromCharData","getAsCharData","_characterJoiners","_nextCharacterJoinerId","joiner","id","ranges","lineStr","rangeStartColumn","currentStringIndex","rangeStartStringIndex","rangeAttrFG","getFg","rangeAttrBG","getBg","_getJoinedRanges","startIndex","endIndex","allJoinedRanges","error","joinerRanges","_mergeRanges","_stringRangesToCellRanges","currentRangeIndex","currentRangeStarted","currentRange","getString","static","newRange","inRange","_isFocused","_cachedIsFocused","hasFocus","queueMicrotask","decorationService","coreBrowserService","_pausedResizeTask","DebouncedIdleTask","_isPaused","_needsFullRefresh","_isNextRenderRedrawOnly","_needsSelectionRefresh","_canvasWidth","_canvasHeight","_selectionState","_onDimensionsChange","_onRenderedViewportChange","_onRefreshRequest","onRefreshRequest","_renderer","_renderDebouncer","RenderDebouncer","_fullRefresh","observer","IntersectionObserver","_handleIntersectionChange","threshold","observe","disconnect","entry","isIntersecting","intersectionRatio","flush","isRedrawOnly","_fireOnCanvasResize","renderer","NON_BREAKING_SPACE_CHAR","ALL_NON_BREAKING_SPACE_REGEX","RegExp","_linkifier","_dragScrollAmount","_enabled","_mouseDownTimeStamp","_oldHasSelection","_oldSelectionStart","_oldSelectionEnd","_onLinuxMouseSelection","_onRedrawRequest","_onRequestScrollLines","_mouseMoveListener","_mouseUpListener","onUserInput","_trimListener","onTrim","_handleTrim","_handleBufferActivate","_model","SelectionModel","_activeSelectionMode","_removeMouseDownListeners","lineText","startRowEndCol","isLinuxMouseSelection","_isClickInSelection","_getMouseBufferCoords","_areCoordsInSelection","isCellInSelection","_selectWordAtCursor","allowWhitespaceOnlySelection","getRangeLength","_selectWordAt","_getMouseEventScrollAmount","offset","terminalHeight","macOptionClickForcesSelection","timeStamp","_handleIncrementalClick","detail","_handleSingleClick","_handleDoubleClick","_handleTripleClick","_addMouseDownListeners","_dragScrollIntervalTimer","setInterval","_dragScroll","clearInterval","hasWidth","_selectLineAt","previousSelectionEnd","_selectToWordAt","timeElapsed","altClickMovesCursor","coordinates","moveToCellSequence","_fireEventIfSelectionChanged","_fireOnSelectionChange","_convertViewportColToCharacterIndex","charIndex","_getWordAt","followWrappedLinesAbove","followWrappedLinesBelow","charOffset","leftWideCharCount","rightWideCharCount","leftLongCharOffset","rightLongCharOffset","charAt","_isCharWordSeparator","slice","trim","getCodePoint","previousBufferLine","previousLineWordPosition","nextBufferLine","nextLineWordPosition","wordPosition","wordSeparator","wrappedRange","getWrappedRangeForLine","first","last","createDecorator","DEFAULT_FOREGROUND","DEFAULT_BACKGROUND","DEFAULT_CURSOR","DEFAULT_CURSOR_ACCENT","DEFAULT_SELECTION","DEFAULT_ANSI_COLORS","freeze","r","g","b","toCss","toRgba","_onChangeColors","_contrastCache","ColorContrastCache","_colors","selectionBackgroundTransparent","blend","selectionInactiveBackgroundTransparent","_updateRestoreColors","_setTheme","theme","parseColor","selectionBackground","selectionInactiveBackground","NULL_COLOR","isOpaque","opacity","black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite","extendedAnsi","colorCount","slot","_restoreColor","_restoreColors","cssString","fallback","CircularList","_maxLength","onDeleteEmitter","onDelete","onInsertEmitter","onInsert","onTrimEmitter","_array","Array","_startIndex","_length","maxLength","newMaxLength","newArray","_getCyclicIndex","newLength","recycle","isFull","deleteCount","items","countToTrim","trimStart","shiftElements","expandListBy","clone","val","depth","clonedObject","isArray","$r","$g","$b","$a","rgb","toPaddedHex","s","contrastRatio","l1","l2","toChannels","fgR","fgG","fgB","bgR","bgG","bgB","ratio","rgbaColor","factor","$ctx","$litmusColor","isNode","willReadFrequently","globalCompositeOperation","createLinearGradient","match","rgbaMatch","parseFloat","getImageData","relativeLuminance2","rs","gs","bs","pow","relativeLuminance","reduceLuminance","bgRgba","fgRgba","cr","increaseLuminance","bgL","fgL","resultA","resultARatio","resultB","hasWriteSyncWarnHappened","_onBinary","onBinary","_onData","onData","_onLineFeed","_onResize","_onWriteParsed","onWriteParsed","InstantiationService","OptionsService","BufferService","LogService","ILogService","CoreService","CoreMouseService","ICoreMouseService","unicodeService","UnicodeService","IUnicodeService","_charsetService","CharsetService","ICharsetService","OscLinkService","InputHandler","onRequestScrollToBottom","_writeBuffer","handleUserInput","_handleWindowsModeOptionChange","markRangeDirty","scrollBottom","WriteBuffer","promiseResult","parse","_windowsMode","_onScrollApi","write","writeSync","maxSubsequentCalls","LogLevelEnum","WARN","isNaN","MINIMUM_COLS","MINIMUM_ROWS","scroll","eraseAttr","scrollPages","pageCount","scrollToTop","scrollToLine","registerEscHandler","registerDcsHandler","registerCsiHandler","registerOscHandler","windowsMode","_enableWindowsMode","disposables","updateWindowsModeWrappedState","final","_listeners","_disposed","_event","arg1","arg2","queue","call","from","to","GLEVEL","MAX_PARSEBUFFER_LENGTH","paramToWindowOption","n","opts","setWinLines","restoreWin","minimizeWin","setWinPosition","setWinSizePixels","raiseWin","lowerWin","refreshWin","setWinSizeChars","maximizeWin","fullscreenWin","getWinState","getWinPosition","getWinSizePixels","getScreenSizePixels","getCellSizePixels","getWinSizeChars","getScreenSizeChars","getIconTitle","getWinTitle","pushTitle","popTitle","$temp","_coreMouseService","_unicodeService","_parser","EscapeSequenceParser","_parseBuffer","Uint32Array","_stringDecoder","StringToUtf32","_utf8Decoder","Utf8ToUtf32","_windowTitle","_iconName","_windowTitleStack","_iconNameStack","_curAttrData","_eraseAttrDataInternal","_onRequestBell","_onRequestRefreshRows","_onRequestReset","_onRequestSendFocus","_onRequestSyncScrollBar","_onRequestWindowsOptionsReport","_onA11yChar","_onA11yTab","_onColor","_parseStack","paused","cursorStartX","cursorStartY","decodedLength","_specialColors","_dirtyRowTracker","DirtyRowTracker","setCsiHandlerFallback","params","identifier","identToString","toArray","setEscHandlerFallback","setExecuteHandlerFallback","code","setOscHandlerFallback","setDcsHandlerFallback","payload","setPrintHandler","print","insertChars","intermediates","scrollLeft","cursorUp","scrollRight","cursorDown","cursorForward","cursorBackward","cursorNextLine","cursorPrecedingLine","cursorCharAbsolute","cursorPosition","cursorForwardTab","eraseInDisplay","prefix","eraseInLine","insertLines","deleteLines","deleteChars","scrollUp","scrollDown","eraseChars","cursorBackwardTab","charPosAbsolute","hPositionRelative","repeatPrecedingCharacter","sendDeviceAttributesPrimary","sendDeviceAttributesSecondary","linePosAbsolute","vPositionRelative","hVPosition","tabClear","setMode","setModePrivate","resetMode","resetModePrivate","charAttributes","deviceStatus","deviceStatusPrivate","softReset","setCursorStyle","setScrollRegion","saveCursor","windowOptions","restoreCursor","insertColumns","deleteColumns","selectProtected","requestMode","setExecuteHandler","BEL","bell","LF","lineFeed","VT","FF","carriageReturn","BS","backspace","HT","tab","SO","shiftOut","SI","shiftIn","C1","IND","NEL","nextLine","HTS","tabSet","OscHandler","setTitle","setIconName","setOrReportIndexedColor","setHyperlink","setOrReportFgColor","setOrReportBgColor","setOrReportCursorColor","restoreIndexedColor","restoreFgColor","restoreBgColor","restoreCursorColor","reverseIndex","keypadApplicationMode","keypadNumericMode","fullReset","setgLevel","selectDefaultCharset","flag","CHARSETS","selectCharset","screenAlignmentPattern","setErrorHandler","DcsHandler","requestStatusString","getAttrData","_preserveStack","_logSlowResolvingAsync","p","Promise","race","res","rej","catch","err","_getCurrentLinkId","wasPaused","DEBUG","prototype","split","clearRange","len","decode","chWidth","charset","wraparoundMode","wraparound","insertMode","modes","curAttr","bufferRow","markDirty","setCellFromCodePoint","wcwidth","ch","stringFromCodePoint","addLineToLink","_eraseAttrData","insertCells","getNullCell","NULL_CELL_WIDTH","addCodepointToCell","precedingCodepoint","convertEol","reverseWraparound","_restrictCursor","originalX","nextStop","maxCol","_setCursor","_moveCursor","diffToTop","diffToBottom","param","tabs","prevStop","_eraseInBufferLine","clearWrap","respectProtect","replaceCells","_resetBufferLine","clearMarkers","scrollBackSize","scrollBottomRowsOffset","scrollBottomAbsolute","deleteCells","_is","term","termName","setgCharset","DEFAULT_CHARSET","applicationKeypad","activeEncoding","activateAltBuffer","activateNormalBuffer","dm","mouseProtocol","mouseEncoding","cs","b2v","m","_updateAttrColor","mode","c1","c2","c3","fromColorRGB","_extractColor","attr","accu","cSpace","advance","hasSubParams","subparams","getSubParams","underlineColor","_processUnderline","updateExtended","_processSGR0","l","savedX","savedY","savedCurAttrData","savedCharset","isBlinking","bottom","second","_savedCharset","slots","idx","spec","exec","args","_createHyperlink","_finishHyperlink","parsedParams","idParamIndex","findIndex","startsWith","registerLink","_setOrReportSpecialColor","collectAndFlag","scrollRegionHeight","level","yOffset","markAllDirty","f","isProtected","_disposables","unregister","array","_data","third","fourth","navigator","userAgent","platform","isSafari","majorVersion","isIpad","isIphone","_getKey","insert","_search","forEachByKey","values","mid","midKey","TaskQueue","_tasks","_i","enqueue","task","_start","_idleCallback","_cancelCallback","_requestCallback","_process","deadline","taskDuration","longestTask","lastDeadlineRemaining","timeRemaining","deadlineRemaining","PriorityTaskQueue","_createDeadline","duration","IdleTaskQueue","requestIdleCallback","cancelIdleCallback","_queue","lastChar","CHAR_DATA_CODE_INDEX","WHITESPACE_CELL_CODE","ExtendedAttrs","newObj","isBlink","isFgRGB","isBgRGB","isFgPalette","isBgPalette","isFgDefault","isBgDefault","isAttributeDefault","isEmpty","getUnderlineColorMode","isUnderlineColorPalette","getUnderlineStyle","ext","_ext","_urlId","MAX_BUFFER_SIZE","_hasScrollback","_nullCell","fromCharData","NULL_CELL_CHAR","_whitespaceCell","WHITESPACE_CELL_WIDTH","_isClearing","_memoryCleanupQueue","_memoryCleanupPosition","_cols","_rows","_getCorrectBufferLength","setupTabStops","getWhitespaceCell","BufferLine","relativeY","correctBufferLength","scrollback","fillViewportRows","fillAttr","newCols","newRows","nullCell","dirtyMemoryLines","addToY","amountToTrim","_isReflowEnabled","_reflow","_batchedMemoryCleanup","normalRun","counted","cleanupMemory","_reflowLarger","_reflowSmaller","toRemove","reflowLargerGetLinesToRemove","newLayoutResult","reflowLargerCreateNewLayout","reflowLargerApplyNewLayout","layout","_reflowLargerAdjustViewport","countRemoved","viewportAdjustments","toInsert","countToInsert","wrappedLines","absoluteY","lastLineLength","destLineLengths","reflowSmallerGetNewLineLengths","linesToAdd","trimmedLines","newLines","newLine","destLineIndex","destCol","srcLineIndex","srcCol","cellsToCopy","copyCellsFrom","wrappedLinesIndex","getWrappedLineTrimmedLength","setCell","insertEvents","originalLines","originalLinesLength","originalLineIndex","nextToInsertIndex","nextToInsert","countInsertedSoFar","nextI","insertCountEmitted","stringIndexToBufferIndex","lineIndex","stringIndex","trimRight","CHAR_DATA_WIDTH_INDEX","CHAR_DATA_CHAR_INDEX","tabStopWidth","Marker","onDispose","_removeMarker","iterator","startOverscan","endOverscan","BufferStringIterator","_buffer","_trimRight","_endIndex","_startOverscan","_endOverscan","_current","hasNext","next","$startIndex","fillCellData","_combined","_extendedAttrs","cp","CHAR_DATA_ATTR_INDEX","codePoint","eAttrs","byteLength","uint32Cells","keys","extKeys","copyFrom","src","applyInReverse","srcData","srcCombinedKeys","bufferCols","endsInNull","followingLineStartsWithWide","oldCols","bufferAbsoluteY","srcTrimmedTineLength","srcRemainingCells","destRemainingCells","countToRemove","nextToRemoveIndex","nextToRemoveStart","countRemovedSoFar","newLayout","newLayoutLines","newLineLengths","cellsNeeded","reduce","srcLine","cellsAvailable","oldTrimmedLength","endsWithWide","BufferSet","_onBufferActivate","_normal","Buffer","_alt","inactiveBuffer","obj","combined","DEFAULT_COLOR","DEFAULT_ATTR","DEFAULT_EXT","isDisposed","_id","_nextId","_onDispose","disposable","C","NUL","SOH","STX","EOT","ENQ","ACK","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","FS","GS","RS","US","SP","PAD","HOP","BPH","NBH","SSA","ESA","HTJ","VTS","PLD","PLU","RI","SS2","SS3","DCS","PU1","PU2","STS","CCH","MW","SPA","EPA","SOS","SGCI","SCI","CSI","OSC","PM","APC","KEYCODE_KEY_MAPPINGS","applicationCursorMode","modifiers","keyMapping","keyString","toUpperCase","toLowerCase","_interim","startPos","interim","Uint8Array","byte1","byte2","byte3","byte4","discardInterim","tmp","missing","fourStop","BMP_COMBINING","HIGH_COMBINING","table","version","num","ucs","bisearch","_action","_callbacks","_pendingData","_bufferOffset","_isSyncWriting","_syncCalls","_didUserInput","chunk","cb","_innerWrite","lastTime","continuation","resolve","then","RGB_REX","HASH_REX","pad","bits","s2","low","base","adv","PAYLOAD_LIMIT","EMPTY_HANDLERS","_handlers","create","_active","_ident","_handlerFb","_stack","loopPosition","fallThrough","registerHandler","handlerList","handlerIndex","clearHandler","setHandlerFallback","unhook","hook","put","utf32ToString","success","handlerResult","EMPTY_PARAMS","Params","addParam","_handler","_params","_hitLimit","ret","TransitionTable","setDefault","addMany","codes","NON_ASCII_PRINTABLE","VT500_TRANSITION_TABLE","blueprint","apply","unused","PRINTABLES","EXECUTABLES","states","_transitions","handlers","handlerPos","transition","chunkPos","initialState","currentState","_collect","_printHandlerFb","_executeHandlerFb","_csiHandlerFb","_escHandlerFb","_errorHandlerFb","_printHandler","_executeHandlers","_csiHandlers","_escHandlers","_oscParser","OscParser","_dcsParser","DcsParser","_errorHandler","_identifier","finalRange","intermediate","finalCode","reverse","clearPrintHandler","clearEscHandler","clearExecuteHandler","clearCsiHandler","clearDcsHandler","clearOscHandler","clearErrorHandler","collect","abort","addSubParam","addDigit","handlersEsc","jj","_state","_put","MAX_VALUE","maxSubParamsLength","Int32Array","_subParams","_subParamsLength","_subParamsIdx","Uint16Array","_rejectDigits","_rejectSubDigits","_digitIsSub","k","newParams","getSubParamsAll","store","cur","_addons","instance","loadAddon","terminal","loadedAddon","_wrappedAddonDispose","init","viewportY","baseY","getLine","BufferLineApiView","_line","getCell","startColumn","endColumn","_core","_onBufferChange","onBufferChange","BufferApiView","_alternate","alternate","addCsiHandler","addDcsHandler","addEscHandler","addOscHandler","provider","versions","activeVersion","isUserScrolling","_cachedBlankLine","topRow","bottomRow","willBufferBeTrimmed","oldYdisp","scrollAmount","glevel","_charsets","DEFAULT_PROTOCOLS","NONE","restrict","X10","VT200","DRAG","ANY","eventCode","isSGR","S","DEFAULT_ENCODINGS","DEFAULT","SGR","SGR_PIXELS","_protocols","_encodings","_activeProtocol","_activeEncoding","_lastEvent","_onProtocolChange","name","addProtocol","addEncoding","encoding","_equalEvents","report","triggerBinaryEvent","down","up","drag","move","e1","e2","pixels","DEFAULT_MODES","DEFAULT_DEC_PRIVATE_MODES","_onUserInput","_onRequestScrollToBottom","wasUserInput","disableStdin","$xmin","$xmax","_decorations","SortedList","_onDecorationRegistered","_onDecorationRemoved","Decoration","markerDispose","xmin","xmax","getKeyIterator","_cachedBg","_cachedFg","foregroundColor","ServiceCollection","_entries","service","_services","getService","ctor","serviceDependencies","getServiceDependencies","sort","serviceArgs","dependency","firstServiceArgPos","optionsKeyToLogLevel","info","INFO","ERROR","off","OFF","_updateLogLevel","_evalLazyOptionalParams","optionalParams","_log","message","log","DEFAULT_OPTIONS","customGlyphs","allowProposedApi","allowTransparency","FONT_WEIGHT_OPTIONS","_onOptionChange","defaultOptions","_sanitizeAndValidateOption","_setupOptions","eventKey","getter","propName","setter","desc","defineProperty","isCursorStyle","_entriesWithId","_dataByLinkId","_removeMarkerFromLink","castData","_getEntryIdKey","linkId","every","linkData","storeServiceDependency","serviceRegistry","decorator","arguments","_providers","_onChange","onChange","defaultProvider","UnicodeV6","_activeProvider","getStringCellWidth","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","CONSTRUCTOR_ONLY_OPTIONS","_addonManager","AddonManager","_publicOptions","_checkReadonlyOptions","_checkProposedApi","parser","ParserApi","unicode","UnicodeApi","BufferNamespaceApi","mouseTrackingMode","applicationCursorKeysMode","applicationKeypadMode","originMode","reverseWraparoundMode","sendFocusMode","columns","_verifyIntegers","registerMarker","_verifyPositiveIntegers","writeln","addon","strings","Infinity"],"sourceRoot":""} \ No newline at end of file diff --git a/lxconsole/templates/container.html b/lxconsole/templates/container.html index 1ee7a66..67a6ae4 100644 --- a/lxconsole/templates/container.html +++ b/lxconsole/templates/container.html @@ -612,10 +612,9 @@ {% endblock modal %} {% block script %} - - + - + +