]> git.proxmox.com Git - pve-xtermjs.git/commitdiff
upgrade to xterm.js 5.3.0
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 26 Sep 2023 06:33:26 +0000 (08:33 +0200)
committerDominik Csapak <d.csapak@proxmox.com>
Tue, 26 Sep 2023 06:33:26 +0000 (08:33 +0200)
and update xterm-addon-fit to a compatible version (0.8.0)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Makefile
src/www/xterm-addon-fit.js
src/www/xterm-addon-fit.js.map
src/www/xterm.css
src/www/xterm.js
src/www/xterm.js.map

index 01488d1ee32c6db6125d0da324c31508e08b7649..2c730a913680f143b7ab79da120f3205eade2cbe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,10 +9,10 @@ ORIG_SRC_TAR=$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
 
 export VERSION=$(DEB_VERSION_UPSTREAM_REVISION)
 
-XTERMJSVER=4.16.0
+XTERMJSVER=5.3.0
 XTERMJSTGZ=xterm-$(XTERMJSVER).tgz
 
-FITADDONVER=0.5.0
+FITADDONVER=0.8.0
 FITADDONTGZ=xterm-addon-fit-$(FITADDONVER).tgz
 
 DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
index a6b3cdc60e2a576577fe5a8be1cb4580bcbee1fb..7cfd9de082a639baf6dbd444117f215467683634 100644 (file)
@@ -1,2 +1,2 @@
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(function(){return(()=>{"use strict";var e={775:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0;var r=function(){function e(){}return e.prototype.activate=function(e){this._terminal=e},e.prototype.dispose=function(){},e.prototype.fit=function(){var e=this.proposeDimensions();if(e&&this._terminal){var t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}},e.prototype.proposeDimensions=function(){if(this._terminal&&this._terminal.element&&this._terminal.element.parentElement){var e=this._terminal._core;if(0!==e._renderService.dimensions.actualCellWidth&&0!==e._renderService.dimensions.actualCellHeight){var t=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(t.getPropertyValue("height")),i=Math.max(0,parseInt(t.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o=r-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),a=i-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-e.viewport.scrollBarWidth;return{cols:Math.max(2,Math.floor(a/e._renderService.dimensions.actualCellWidth)),rows:Math.max(1,Math.floor(o/e._renderService.dimensions.actualCellHeight))}}}},e}();t.FitAddon=r}},t={};return function r(i){if(t[i])return t[i].exports;var n=t[i]={exports:{}};return e[i](n,n.exports,r),n.exports}(775)})()}));
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),l=o-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),a=s-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(a/t.css.cell.width)),rows:Math.max(1,Math.floor(l/t.css.cell.height))}}}})(),e})()));
 //# sourceMappingURL=xterm-addon-fit.js.map
\ No newline at end of file
index f61662886ab292d6bd2eae074a6db6e4b9030ecf..33a9297169a98c32c5373e5a6dc9f0f9955f3b04 100644 (file)
@@ -1 +1 @@
-{"version":3,"sources":["webpack://FitAddon/webpack/universalModuleDefinition","webpack://FitAddon/./src/FitAddon.ts","webpack://FitAddon/webpack/bootstrap","webpack://FitAddon/webpack/startup"],"names":["root","factory","exports","module","define","amd","self","activate","terminal","this","_terminal","dispose","fit","dims","proposeDimensions","core","_core","rows","cols","_renderService","clear","resize","element","parentElement","dimensions","actualCellWidth","actualCellHeight","parentElementStyle","window","getComputedStyle","parentElementHeight","parseInt","getPropertyValue","parentElementWidth","Math","max","elementStyle","availableHeight","availableWidth","viewport","scrollBarWidth","floor","FitAddon","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAkB,SAAID,IAEtBD,EAAe,SAAIC,IARrB,CASGK,MAAM,WACT,M,yGCSA,IAGA,aAGE,cA4DF,OA1DS,YAAAC,SAAP,SAAgBC,GACdC,KAAKC,UAAYF,GAGZ,YAAAG,QAAP,aAEO,YAAAC,IAAP,WACE,IAAMC,EAAOJ,KAAKK,oBAClB,GAAKD,GAASJ,KAAKC,UAAnB,CAKA,IAAMK,EAAQN,KAAKC,UAAkBM,MAGjCP,KAAKC,UAAUO,OAASJ,EAAKI,MAAQR,KAAKC,UAAUQ,OAASL,EAAKK,OACpEH,EAAKI,eAAeC,QACpBX,KAAKC,UAAUW,OAAOR,EAAKK,KAAML,EAAKI,SAInC,YAAAH,kBAAP,WACE,GAAKL,KAAKC,WAILD,KAAKC,UAAUY,SAAYb,KAAKC,UAAUY,QAAQC,cAAvD,CAKA,IAAMR,EAAQN,KAAKC,UAAkBM,MAErC,GAAuD,IAAnDD,EAAKI,eAAeK,WAAWC,iBAA6E,IAApDV,EAAKI,eAAeK,WAAWE,iBAA3F,CAIA,IAAMC,EAAqBC,OAAOC,iBAAiBpB,KAAKC,UAAUY,QAAQC,eACpEO,EAAsBC,SAASJ,EAAmBK,iBAAiB,WACnEC,EAAqBC,KAAKC,IAAI,EAAGJ,SAASJ,EAAmBK,iBAAiB,WAC9EI,EAAeR,OAAOC,iBAAiBpB,KAAKC,UAAUY,SAStDe,EAAkBP,GAPjBC,SAASK,EAAaJ,iBAAiB,gBACpCD,SAASK,EAAaJ,iBAAiB,oBAO3CM,EAAiBL,GANdF,SAASK,EAAaJ,iBAAiB,kBACxCD,SAASK,EAAaJ,iBAAiB,kBAKiBjB,EAAKwB,SAASC,eAK9E,MAJiB,CACftB,KAAMgB,KAAKC,IA7DI,EA6DcD,KAAKO,MAAMH,EAAiBvB,EAAKI,eAAeK,WAAWC,kBACxFR,KAAMiB,KAAKC,IA7DI,EA6DcD,KAAKO,MAAMJ,EAAkBtB,EAAKI,eAAeK,WAAWE,uBAI/F,EA/DA,GAAa,EAAAgB,aCrBTC,EAA2B,GCE/B,ODCA,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAU3C,QAG3C,IAAIC,EAASwC,EAAyBE,GAAY,CAGjD3C,QAAS,IAOV,OAHA4C,EAAoBD,GAAU1C,EAAQA,EAAOD,QAAS0C,GAG/CzC,EAAOD,QCjBR0C,CAAoB,M","file":"xterm-addon-fit.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 if(typeof exports === 'object')\n\t\texports[\"FitAddon\"] = factory();\n\telse\n\t\troot[\"FitAddon\"] = factory();\n})(self, function() {\nreturn ","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Terminal, ITerminalAddon } from 'xterm';\n\ninterface ITerminalDimensions {\n  /**\n   * The number of rows in the terminal.\n   */\n  rows: number;\n\n  /**\n   * The number of columns in the terminal.\n   */\n  cols: number;\n}\n\nconst MINIMUM_COLS = 2;\nconst MINIMUM_ROWS = 1;\n\nexport class FitAddon implements ITerminalAddon {\n  private _terminal: Terminal | undefined;\n\n  constructor() {}\n\n  public activate(terminal: Terminal): void {\n    this._terminal = terminal;\n  }\n\n  public dispose(): void {}\n\n  public fit(): void {\n    const dims = this.proposeDimensions();\n    if (!dims || !this._terminal) {\n      return;\n    }\n\n    // TODO: Remove reliance on private API\n    const core = (this._terminal as any)._core;\n\n    // Force a full render\n    if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {\n      core._renderService.clear();\n      this._terminal.resize(dims.cols, dims.rows);\n    }\n  }\n\n  public proposeDimensions(): ITerminalDimensions | undefined {\n    if (!this._terminal) {\n      return undefined;\n    }\n\n    if (!this._terminal.element || !this._terminal.element.parentElement) {\n      return undefined;\n    }\n\n    // TODO: Remove reliance on private API\n    const core = (this._terminal as any)._core;\n\n    if (core._renderService.dimensions.actualCellWidth === 0 || core._renderService.dimensions.actualCellHeight === 0) {\n      return undefined;\n    }\n\n    const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);\n    const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));\n    const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));\n    const elementStyle = window.getComputedStyle(this._terminal.element);\n    const elementPadding = {\n      top: parseInt(elementStyle.getPropertyValue('padding-top')),\n      bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')),\n      right: parseInt(elementStyle.getPropertyValue('padding-right')),\n      left: parseInt(elementStyle.getPropertyValue('padding-left'))\n    };\n    const elementPaddingVer = elementPadding.top + elementPadding.bottom;\n    const elementPaddingHor = elementPadding.right + elementPadding.left;\n    const availableHeight = parentElementHeight - elementPaddingVer;\n    const availableWidth = parentElementWidth - elementPaddingHor - core.viewport.scrollBarWidth;\n    const geometry = {\n      cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / core._renderService.dimensions.actualCellWidth)),\n      rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / core._renderService.dimensions.actualCellHeight))\n    };\n    return geometry;\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](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__(775);\n"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"xterm-addon-fit.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAkB,SAAID,IAEtBD,EAAe,SAAIC,GACpB,CATD,CASGK,MAAM,I,mHCcT,iBAGS,QAAAC,CAASC,GACdC,KAAKC,UAAYF,CACnB,CAEO,OAAAG,GAAiB,CAEjB,GAAAC,GACL,MAAMC,EAAOJ,KAAKK,oBAClB,IAAKD,I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niversalModuleDefinition(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 if(typeof exports === 'object')\n\t\texports[\"FitAddon\"] = factory();\n\telse\n\t\troot[\"FitAddon\"] = factory();\n})(self, () => {\nreturn ","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Terminal, ITerminalAddon } from 'xterm';\nimport { IRenderDimensions } from 'browser/renderer/shared/Types';\n\ninterface ITerminalDimensions {\n  /**\n   * The number of rows in the terminal.\n   */\n  rows: number;\n\n  /**\n   * The number of columns in the terminal.\n   */\n  cols: number;\n}\n\nconst MINIMUM_COLS = 2;\nconst MINIMUM_ROWS = 1;\n\nexport class FitAddon implements ITerminalAddon {\n  private _terminal: Terminal | undefined;\n\n  public activate(terminal: Terminal): void {\n    this._terminal = terminal;\n  }\n\n  public dispose(): void {}\n\n  public fit(): void {\n    const dims = this.proposeDimensions();\n    if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) {\n      return;\n    }\n\n    // TODO: Remove reliance on private API\n    const core = (this._terminal as any)._core;\n\n    // Force a full render\n    if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {\n      core._renderService.clear();\n      this._terminal.resize(dims.cols, dims.rows);\n    }\n  }\n\n  public proposeDimensions(): ITerminalDimensions | undefined {\n    if (!this._terminal) {\n      return undefined;\n    }\n\n    if (!this._terminal.element || !this._terminal.element.parentElement) {\n      return undefined;\n    }\n\n    // TODO: Remove reliance on private API\n    const core = (this._terminal as any)._core;\n    const dims: IRenderDimensions = core._renderService.dimensions;\n\n    if (dims.css.cell.width === 0 || dims.css.cell.height === 0) {\n      return undefined;\n    }\n\n    const scrollbarWidth = this._terminal.options.scrollback === 0 ?\n      0 : core.viewport.scrollBarWidth;\n\n    const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);\n    const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));\n    const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));\n    const elementStyle = window.getComputedStyle(this._terminal.element);\n    const elementPadding = {\n      top: parseInt(elementStyle.getPropertyValue('padding-top')),\n      bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')),\n      right: parseInt(elementStyle.getPropertyValue('padding-right')),\n      left: parseInt(elementStyle.getPropertyValue('padding-left'))\n    };\n    const elementPaddingVer = elementPadding.top + elementPadding.bottom;\n    const elementPaddingHor = elementPadding.right + elementPadding.left;\n    const availableHeight = parentElementHeight - elementPaddingVer;\n    const availableWidth = parentElementWidth - elementPaddingHor - scrollbarWidth;\n    const geometry = {\n      cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / dims.css.cell.width)),\n      rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / dims.css.cell.height))\n    };\n    return geometry;\n  }\n}\n"],"names":["root","factory","exports","module","define","amd","self","activate","terminal","this","_terminal","dispose","fit","dims","proposeDimensions","isNaN","cols","rows","core","_core","_renderService","clear","resize","element","parentElement","dimensions","css","cell","width","height","scrollbarWidth","options","scrollback","viewport","scrollBarWidth","parentElementStyle","window","getComputedStyle","parentElementHeight","parseInt","getPropertyValue","parentElementWidth","Math","max","elementStyle","availableHeight","availableWidth","floor"],"sourceRoot":""}
\ No newline at end of file
index 38e27a006c299ed1653fb702c777992c68c82464..74acc26708829de31d158bf08ce690d811590b8e 100644 (file)
@@ -36,6 +36,7 @@
  */
 
 .xterm {
+    cursor: text;
     position: relative;
     user-select: none;
     -ms-user-select: none;
     line-height: normal;
 }
 
-.xterm {
-    cursor: text;
-}
-
 .xterm.enable-mouse-events {
     /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
     cursor: default;
     right: 0;
     z-index: 10;
     color: transparent;
+    pointer-events: none;
 }
 
 .xterm .live-region {
 }
 
 .xterm-dim {
-    opacity: 0.5;
+    /* Dim should not apply to background, so the opacity of the foreground color is applied
+     * explicitly in the generated class and reset to 1 here */
+    opacity: 1 !important;
 }
 
-.xterm-underline {
-    text-decoration: underline;
+.xterm-underline-1 { text-decoration: underline; }
+.xterm-underline-2 { text-decoration: double underline; }
+.xterm-underline-3 { text-decoration: wavy underline; }
+.xterm-underline-4 { text-decoration: dotted underline; }
+.xterm-underline-5 { text-decoration: dashed underline; }
+
+.xterm-overline {
+    text-decoration: overline;
 }
 
+.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
+.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
+.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
+.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
+.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
+
 .xterm-strikethrough {
     text-decoration: line-through;
 }
+
+.xterm-screen .xterm-decoration-container .xterm-decoration {
+       z-index: 6;
+       position: absolute;
+}
+
+.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
+       z-index: 7;
+}
+
+.xterm-decoration-overview-ruler {
+    z-index: 8;
+    position: absolute;
+    top: 0;
+    right: 0;
+    pointer-events: none;
+}
+
+.xterm-decoration-top {
+    z-index: 2;
+    position: relative;
+}
index 754f6a9b6327f3b986d1bae48323eb78218d9d5c..a68eae6ce1ca32f17fc7150b2dffa628d7b71099 100644 (file)
@@ -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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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(9924),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.setAttribute("role","document"),i._accessibilityTreeRoot.classList.add("xterm-accessibility"),i._accessibilityTreeRoot.tabIndex=0,i._rowContainer=document.createElement("div"),i._rowContainer.setAttribute("role","list"),i._rowContainer.classList.add("xterm-accessibility-tree"),i._rowElements=[];for(var n=0;n<i._terminal.rows;n++)i._rowElements[n]=i._createAccessibilityTreeNode(),i._rowContainer.appendChild(i._rowElements[n]);if(i._topBoundaryFocusListener=function(e){return i._onBoundaryFocus(e,0)},i._bottomBoundaryFocusListener=function(e){return i._onBoundaryFocus(e,1)},i._rowElements[0].addEventListener("focus",i._topBoundaryFocusListener),i._rowElements[i._rowElements.length-1].addEventListener("focus",i._bottomBoundaryFocusListener),i._refreshRowsDimensions(),i._accessibilityTreeRoot.appendChild(i._rowContainer),i._renderRowsDebouncer=new a.TimeBasedDebouncer(i._renderRows.bind(i)),i._refreshRows(),i._liveRegion=document.createElement("div"),i._liveRegion.classList.add("live-region"),i._liveRegion.setAttribute("aria-live","assertive"),i._accessibilityTreeRoot.appendChild(i._liveRegion),!i._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");return i._terminal.element.insertAdjacentElement("afterbegin",i._accessibilityTreeRoot),i.register(i._renderRowsDebouncer),i.register(i._terminal.onResize((function(e){return i._onResize(e.rows)}))),i.register(i._terminal.onRender((function(e){return i._refreshRows(e.start,e.end)}))),i.register(i._terminal.onScroll((function(){return i._refreshRows()}))),i.register(i._terminal.onA11yChar((function(e){return i._onChar(e)}))),i.register(i._terminal.onLineFeed((function(){return i._onChar("\n")}))),i.register(i._terminal.onA11yTab((function(e){return i._onTab(e)}))),i.register(i._terminal.onKey((function(e){return i._onKey(e.key)}))),i.register(i._terminal.onBlur((function(){return i._clearLiveRegion()}))),i.register(i._renderService.onDimensionsChange((function(){return i._refreshRowsDimensions()}))),i._screenDprMonitor=new h.ScreenDprMonitor,i.register(i._screenDprMonitor),i._screenDprMonitor.setListener((function(){return i._refreshRowsDimensions()})),i.register((0,c.addDisposableDomListener)(window,"resize",(function(){return i._refreshRowsDimensions()}))),i}return n(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),(0,u.removeElementFromParent)(this._accessibilityTreeRoot),this._rowElements.length=0},t.prototype._onBoundaryFocus=function(e,t){var r=e.target,i=this._rowElements[0===t?1:this._rowElements.length-2];if(r.getAttribute("aria-posinset")!==(0===t?"1":""+this._terminal.buffer.lines.length)&&e.relatedTarget===i){var n,o;if(0===t?(n=r,o=this._rowElements.pop(),this._rowContainer.removeChild(o)):(n=this._rowElements.shift(),o=r,this._rowContainer.removeChild(n)),n.removeEventListener("focus",this._topBoundaryFocusListener),o.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){var s=this._createAccessibilityTreeNode();this._rowElements.unshift(s),this._rowContainer.insertAdjacentElement("afterbegin",s)}else s=this._createAccessibilityTreeNode(),this._rowElements.push(s),this._rowContainer.appendChild(s);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()}},t.prototype._onResize=function(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)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;t<e;t++)this._onChar(" ")},t.prototype._onChar=function(e){var t=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?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&&(0,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<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}},t.prototype._refreshRowDimensions=function(e){e.style.height=this._renderService.dimensions.actualCellHeight+"px"},t.prototype._announceCharacters=function(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},t}(l.Disposable);t.AccessibilityManager=f},3614:(e,t)=>{function r(e){return e.replace(/\r?\n/g,"\r")}function i(e,t){return t?"\e[200~"+e+"\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<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=void 0,function(e){e.toCss=function(e,t,r,i){return void 0!==i?"#"+s(e)+s(t)+s(r)+s(i):"#"+s(e)+s(t)+s(r)},e.toRgba=function(e,t,r,i){return void 0===i&&(i=255),(e<<24|t<<16|r<<8|i)>>>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)}},i.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]},(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));u<r&&(c>0||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<r&&(c<255||l<255||h<255);)c=Math.min(255,c+Math.ceil(.1*(255-c))),l=Math.min(255,l+Math.ceil(.1*(255-l))),h=Math.min(255,h+Math.ceil(.1*(255-h))),u=a(n.relativeLuminance2(c,h,l),n.relativeLuminance2(i,o,s));return(c<<24|l<<16|h<<8|255)>>>0}e.ensureContrastRatio=function(e,r,o){var s=n.relativeLuminance(e>>8),c=n.relativeLuminance(r>>8);if(a(s,c)<o)return c<s?t(e,r,o):i(e,r,o)},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){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:function(e,t,r){var i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.ColorManager=t.DEFAULT_ANSI_COLORS=void 0;var n=r(4774),o=r(7239),s=n.css.toColor("#ffffff"),a=n.css.toColor("#000000"),c=n.css.toColor("#ffffff"),l=n.css.toColor("#000000"),h={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze(function(){for(var e=[n.css.toColor("#2e3436"),n.css.toColor("#cc0000"),n.css.toColor("#4e9a06"),n.css.toColor("#c4a000"),n.css.toColor("#3465a4"),n.css.toColor("#75507b"),n.css.toColor("#06989a"),n.css.toColor("#d3d7cf"),n.css.toColor("#555753"),n.css.toColor("#ef2929"),n.css.toColor("#8ae234"),n.css.toColor("#fce94f"),n.css.toColor("#729fcf"),n.css.toColor("#ad7fa8"),n.css.toColor("#34e2e2"),n.css.toColor("#eeeeec")],t=[0,95,135,175,215,255],r=0;r<216;r++){var i=t[r/36%6|0],o=t[r/6%6|0],s=t[r%6];e.push({css:n.channels.toCss(i,o,s),rgba:n.channels.toRgba(i,o,s)})}for(r=0;r<24;r++){var a=8+10*r;e.push({css:n.channels.toCss(a,a,a),rgba:n.channels.toRgba(a,a,a)})}return e}());var u=function(){function e(e,r){this.allowTransparency=r;var i=e.createElement("canvas");i.width=1,i.height=1;var u=i.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 o.ColorContrastCache,this.colors={foreground:s,background:a,cursor:c,cursorAccent:l,selectionTransparent:h,selectionOpaque:n.color.blend(a,h),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache},this._updateRestoreColors()}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,s),this.colors.background=this._parseColor(e.background,a),this.colors.cursor=this._parseColor(e.cursor,c,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,l,!0),this.colors.selectionTransparent=this._parseColor(e.selection,h,!0),this.colors.selectionOpaque=n.color.blend(this.colors.background,this.colors.selectionTransparent),n.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=n.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(),this._updateRestoreColors()},e.prototype.restoreColor=function(e){if(void 0!==e)switch(e){case 256:this.colors.foreground=this._restoreColors.foreground;break;case 257:this.colors.background=this._restoreColors.background;break;case 258:this.colors.cursor=this._restoreColors.cursor;break;default:this.colors.ansi[e]=this._restoreColors.ansi[e]}else for(var t=0;t<this._restoreColors.ansi.length;++t)this.colors.ansi[t]=this._restoreColors.ansi[t]},e.prototype._updateRestoreColors=function(){this._restoreColors={foreground:this.colors.foreground,background:this.colors.background,cursor:this.colors.cursor,ansi:i([],this.colors.ansi,!0)}},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 i=this._ctx.getImageData(0,0,1,1).data;if(255!==i[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:n.channels.toRgba(s,a,c,h),css:e}}return{css:this._ctx.fillStyle,rgba:n.channels.toRgba(i[0],i[1],i[2],i[3])}},e}();t.ColorManager=u},9631:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var i=0,n=t;i<n.length;i++){var o=n[i];null===(e=null==o?void 0:o.parentElement)||void 0===e||e.removeChild(o)}}},3656:(e,t)=>{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<this._linkMatchers.length;s++)this._doLinkifyRow(o.range.first,o.content,this._linkMatchers[s]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},e.prototype.registerLinkMatcher=function(e,t,r){if(void 0===r&&(r={}),!t)throw new Error("handler must be defined");var i={id:this._nextLinkMatcherId++,regex:e,handler:t,matchIndex:r.matchIndex,validationCallback:r.validationCallback,hoverTooltipCallback:r.tooltipCallback,hoverLeaveCallback:r.leaveCallback,willLinkActivate:r.willLinkActivate,priority:r.priority||0};return this._addLinkMatcherToList(i),i.id},e.prototype._addLinkMatcherToList=function(e){if(0!==this._linkMatchers.length){for(var t=this._linkMatchers.length-1;t>=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<this._linkMatchers.length;t++)if(this._linkMatchers[t].id===e)return this._linkMatchers.splice(t,1),!0;return!1},e.prototype._doLinkifyRow=function(e,t,r){for(var i,n=this,o=new RegExp(r.regex.source,(r.regex.flags||"")+"g"),s=-1,a=function(){var a=i["number"!=typeof r.matchIndex?0:r.matchIndex];if(!a)return c._logService.debug("match found without corresponding matchIndex",i,r),"break";if(s=t.indexOf(a,s+1),o.lastIndex=s+a.length,s<0)return"break";var l=c._bufferService.buffer.stringIndexToBufferIndex(e,s);if(l[0]<0)return"break";var h=c._bufferService.buffer.lines.get(l[0]);if(!h)return"break";var u=h.getFg(l[1]),f=u?u>>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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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((0,l.getDisposeArrayDisposable)(r._linkCacheDisposables)),r}return n(t,e),Object.defineProperty(t.prototype,"currentLink",{get:function(){return this._currentLink},enumerable:!1,configurable:!0}),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((0,h.addDisposableDomListener)(this._element,"mouseleave",(function(){i._isMouseOut=!0,i._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._onMouseMove.bind(this))),this.register((0,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;i<r.length;i++){var n=r[i];if(n.classList.contains("xterm"))break;if(n.classList.contains("xterm-hover"))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._onHover(t),this._lastBufferCell=t)}}},t.prototype._onHover=function(e){if(this._activeLine!==e.y)return this._clearCurrentLink(),void this._askForLink(e,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))},t.prototype._askForLink=function(e,t){var r,i=this;this._activeProviderReplies&&t||(null===(r=this._activeProviderReplies)||void 0===r||r.forEach((function(e){null==e||e.forEach((function(e){e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);var n=!1;this._linkProviders.forEach((function(r,o){var s;t?(null===(s=i._activeProviderReplies)||void 0===s?void 0:s.get(o))&&(n=i._checkLinkProviderResult(o,e,n)):r.provideLinks(e.y,(function(t){var r,s;if(!i._isMouseOut){var a=null==t?void 0:t.map((function(e){return{link:e}}));null===(r=i._activeProviderReplies)||void 0===r||r.set(o,a),n=i._checkLinkProviderResult(o,e,n),(null===(s=i._activeProviderReplies)||void 0===s?void 0:s.size)===i._linkProviders.length&&i._removeIntersectingLinks(e.y,i._activeProviderReplies)}}))}))},t.prototype._removeIntersectingLinks=function(e,t){for(var r=new Set,i=0;i<t.size;i++){var n=t.get(i);if(n)for(var o=0;o<n.length;o++)for(var s=n[o],a=s.link.range.start.y<e?0:s.link.range.start.x,c=s.link.range.end.y>e?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;a++)this._activeProviderReplies.has(a)&&!this._activeProviderReplies.get(a)||(s=!0);if(!s&&o){var c=o.find((function(e){return n._linkAtPosition(e.link,t)}));c&&(r=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviders.length&&!r)for(a=0;a<this._activeProviderReplies.size;a++){var l=null===(i=this._activeProviderReplies.get(a))||void 0===i?void 0:i.find((function(e){return n._linkAtPosition(e.link,t)}));if(l){r=!0,this._handleNewLink(l);break}}return r},t.prototype._onClick=function(e){if(this._element&&this._mouseService&&this._currentLink){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}},t.prototype._clearCurrentLink=function(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,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.y<t.y,n=e.range.end.y>t.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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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((0,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;r<this._zones.length;r++){var i=this._zones[r];(i.y1>e&&i.y1<=t+1||i.y2>e&&i.y2<=t+1||i.y1<e&&i.y2>t+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);null==t||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<this._zones.length;n++){var o=this._zones[n];if(o.y1===o.y2){if(i===o.y1&&r>=o.x1&&r<o.x2)return o}else if(i===o.y1&&r>=o.x1||i===o.y2&&r<o.x2||i>o.y1&&i<o.y2)return o}},o([s(2,h.IBufferService),s(3,l.IMouseService),s(4,l.ISelectionService),s(5,h.IOptionsService)],t)}(a.Disposable);t.MouseZoneManager=u},6193:(e,t)=>{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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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),m=r(1296),S=r(7399),C=r(8460),b=r(8437),w=r(5680),L=r(3230),E=r(4725),x=r(428),M=r(8934),k=r(6465),A=r(5114),R=r(8969),T=r(4774),B=r(4269),O=r(5941),D="undefined"!=typeof window?window.document:null,P=function(e){function t(t){void 0===t&&(t={});var r=e.call(this,t)||this;return r.browser=_,r._keyDownHandled=!1,r._keyPressHandled=!1,r._unprocessedDeadKey=!1,r._onCursorMove=new C.EventEmitter,r._onKey=new C.EventEmitter,r._onRender=new C.EventEmitter,r._onSelectionChange=new C.EventEmitter,r._onTitleChange=new C.EventEmitter,r._onBell=new C.EventEmitter,r._onFocus=new C.EventEmitter,r._onBlur=new C.EventEmitter,r._onA11yCharEmitter=new C.EventEmitter,r._onA11yTabEmitter=new C.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.onRequestSendFocus((function(){return r._reportFocus()}))),r.register(r._inputHandler.onRequestReset((function(){return r.reset()}))),r.register(r._inputHandler.onRequestWindowsOptionsReport((function(e){return r._reportWindowsOptions(e)}))),r.register(r._inputHandler.onColor((function(e){return r._handleColorEvent(e)}))),r.register((0,C.forwardEvent)(r._inputHandler.onCursorMove,r._onCursorMove)),r.register((0,C.forwardEvent)(r._inputHandler.onTitleChange,r._onTitleChange)),r.register((0,C.forwardEvent)(r._inputHandler.onA11yChar,r._onA11yCharEmitter)),r.register((0,C.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,"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,"onBell",{get:function(){return this._onBell.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._handleColorEvent=function(e){var t,r;if(this._colorManager){for(var i=0,n=e;i<n.length;i++){var o=n[i],s=void 0,a="";switch(o.index){case 256:s="foreground",a="10";break;case 257:s="background",a="11";break;case 258:s="cursor",a="12";break;default:s="ansi",a="4;"+o.index}if(s)switch(o.type){case 0:var l=T.color.toColorRGB("ansi"===s?this._colorManager.colors.ansi[o.index]:this._colorManager.colors[s]);this.coreService.triggerDataEvent(c.C0.ESC+"]"+a+";"+(0,O.toRgbString)(l)+c.C0.BEL);break;case 1:"ansi"===s?this._colorManager.colors.ansi[o.index]=T.rgba.toColor.apply(T.rgba,o.color):this._colorManager.colors[s]=T.rgba.toColor.apply(T.rgba,o.color);break;case 2:this._colorManager.restoreColor(o.index)}}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"customGlyphs":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&&this._renderService){var e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(t){var r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.actualCellHeight,n=t.getWidth(r),o=this._renderService.dimensions.actualCellWidth*n,s=this.buffer.y*this._renderService.dimensions.actualCellHeight,a=r*this._renderService.dimensions.actualCellWidth;this.textarea.style.left=a+"px",this.textarea.style.top=s+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}}},t.prototype._initGlobal=function(){var e=this;this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",(function(t){e.hasSelection()&&(0,a.copyHandler)(t,e._selectionService)})));var t=function(t){return(0,a.handlePasteEvent)(t,e.textarea,e.coreService)};this.register((0,d.addDisposableDomListener)(this.textarea,"paste",t)),this.register((0,d.addDisposableDomListener)(this.element,"paste",t)),_.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(function(t){2===t.button&&(0,a.rightClickHandler)(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(function(t){(0,a.rightClickHandler)(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))),_.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(function(t){1===t.button&&(0,a.moveTextAreaUnderMouseCursor)(t,e.textarea,e.screenElement)})))},t.prototype._bindKeys=function(){var e=this;this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",(function(t){return e._keyUp(t)}),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",(function(t){return e._keyDown(t)}),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",(function(t){return e._keyPress(t)}),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(function(){return e._compositionHelper.compositionstart()}))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",(function(t){return e._compositionHelper.compositionupdate(t)}))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(function(){return e._compositionHelper.compositionend()}))),this.register((0,d.addDisposableDomListener)(this.textarea,"input",(function(t){return e._inputEvent(t)}),!0)),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"),e.appendChild(this.element);var r=D.createDocumentFragment();this._viewportElement=D.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this._viewportScrollArea=D.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=D.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=D.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement),this.textarea=D.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((0,d.addDisposableDomListener)(this.textarea,"focus",(function(e){return t._onTextAreaFocus(e)}))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",(function(){return t._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea);var i=this._instantiationService.createInstance(A.CoreBrowserService,this.textarea);this._instantiationService.setService(E.ICoreBrowserService,i),this._charSizeService=this._instantiationService.createInstance(x.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._theme=this.options.theme||this._theme,this._colorManager=new w.ColorManager(D,this.options.allowTransparency),this.register(this.optionsService.onOptionChange((function(e){return t._colorManager.onOptionsChange(e)}))),this._colorManager.setTheme(this._theme),this._characterJoinerService=this._instantiationService.createInstance(B.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService);var n=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(L.RenderService,n,this.rows,this.screenElement)),this._instantiationService.setService(E.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._compositionView=D.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._soundService=this._instantiationService.createInstance(v.SoundService),this._instantiationService.setService(E.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(M.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(s.Viewport,(function(e){return t.scrollLines(e,!0,1)}),this._viewportElement,this._viewportScrollArea,this.element),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.linkifier2)),this._instantiationService.setService(E.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.event((function(e){t.viewport.syncScrollArea(),t._selectionService.refresh()}))),this.register((0,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.screenElement,this._mouseService,this._renderService),this.register((0,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(m.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),e.cancel(t,!0)},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((0,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((0,d.addDisposableDomListener)(r,"wheel",(function(t){if(!n.wheel){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;s<Math.abs(r);s++)o+=i;return e.coreService.triggerDataEvent(o,!0),e.cancel(t,!0)}return e.viewport.onWheel(t)?e.cancel(t):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(r,"touchstart",(function(t){if(!e.coreMouseService.areMouseEventsActive)return e.viewport.onTouchStart(t),e.cancel(t)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(r,"touchmove",(function(t){if(!e.coreMouseService.areMouseEventsActive)return e.viewport.onTouchMove(t)?void 0:e.cancel(t)}),{passive:!1}))},t.prototype.refresh=function(e,t){var r;null===(r=this._renderService)||void 0===r||r.refreshRows(e,t)},t.prototype._queueLinkification=function(e,t){var r;null===(r=this.linkifier)||void 0===r||r.linkifyRows(e,t)},t.prototype.updateCursorStyle=function(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")},t.prototype._showCursor=function(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},t.prototype.scrollLines=function(t,r,i){void 0===i&&(i=0),e.prototype.scrollLines.call(this,t,r,i),this.refresh(0,this.rows-1)},t.prototype.paste=function(e){(0,a.paste)(e,this.textarea,this.coreService)},t.prototype.attachCustomKeyEventHandler=function(e){this._customKeyEventHandler=e},t.prototype.registerLinkMatcher=function(e,t,r){var i=this.linkifier.registerLinkMatcher(e,t,r);return this.refresh(0,this.rows-1),i},t.prototype.deregisterLinkMatcher=function(e){this.linkifier.deregisterLinkMatcher(e)&&this.refresh(0,this.rows-1)},t.prototype.registerLinkProvider=function(e){return this.linkifier2.registerLinkProvider(e)},t.prototype.registerCharacterJoiner=function(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");var t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t},t.prototype.deregisterCharacterJoiner=function(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)},Object.defineProperty(t.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),t.prototype.addMarker=function(e){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)},t.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},t.prototype.select=function(e,t,r){this._selectionService.setSelection(e,t,r)},t.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},t.prototype.getSelectionPosition=function(){if(this._selectionService&&this._selectionService.hasSelection)return{startColumn:this._selectionService.selectionStart[0],startRow:this._selectionService.selectionStart[1],endColumn:this._selectionService.selectionEnd[0],endRow:this._selectionService.selectionEnd[1]}},t.prototype.clearSelection=function(){var e;null===(e=this._selectionService)||void 0===e||e.clearSelection()},t.prototype.selectAll=function(){var e;null===(e=this._selectionService)||void 0===e||e.selectAll()},t.prototype.selectLines=function(e,t){var r;null===(r=this._selectionService)||void 0===r||r.selectLines(e,t)},t.prototype._keyDown=function(e){if(this._keyDownHandled=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(!this._compositionHelper.keydown(e))return this.buffer.ybase!==this.buffer.ydisp&&this._bufferService.scrollToBottom(),!1;"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);var t=(0,S.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===t.type||2===t.type){var r=this.rows-1;return this.scrollLines(2===t.type?-r:r),this.cancel(e,!0)}return 1===t.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(t.cancel&&this.cancel(e,!0),!t.key||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(t.key!==c.C0.ETX&&t.key!==c.C0.CR||(this.textarea.value=""),this._onKey.fire({key:t.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(e,!0))))},t.prototype._isThirdLevelShift=function(e,t){var r=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?r:r&&(!t.keyCode||t.keyCode>47)},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),this._keyPressHandled=!1)},t.prototype._keyPress=function(e){var 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))},t.prototype._inputEvent=function(e){if(e.data&&"insertText"===e.inputType&&!e.composed&&!this.optionsService.options.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;var t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1},t.prototype.bell=function(){var e;this._soundBell()&&(null===(e=this._soundService)||void 0===e||e.playBellSound()),this._onBell.fire()},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<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(b.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire({position:this.buffer.ydisp,source:0})}},t.prototype.reset=function(){var t,r;this.options.rows=this.rows,this.options.cols=this.cols;var i=this._customKeyEventHandler;this._setup(),e.prototype.reset.call(this),null===(t=this._selectionService)||void 0===t||t.reset(),this._customKeyEventHandler=i,this.refresh(0,this.rows-1),null===(r=this.viewport)||void 0===r||r.syncScrollArea()},t.prototype.clearTextureAtlas=function(){var e;null===(e=this._renderService)||void 0===e||e.clearTextureAtlas()},t.prototype._reportFocus=function(){var e;(null===(e=this.element)||void 0===e?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent(c.C0.ESC+"[I"):this.coreService.triggerDataEvent(c.C0.ESC+"[O")},t.prototype._reportWindowsOptions=function(e){if(this._renderService)switch(e){case l.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var t=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),r=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this.coreService.triggerDataEvent(c.C0.ESC+"[4;"+r+";"+t+"t");break;case l.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var i=this._renderService.dimensions.scaledCellWidth.toFixed(0),n=this._renderService.dimensions.scaledCellHeight.toFixed(0);this.coreService.triggerDataEvent(c.C0.ESC+"[6;"+n+";"+i+"t")}},t.prototype.cancel=function(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1},t.prototype._visualBell=function(){return!1},t.prototype._soundBell=function(){return"sound"===this.options.bellStyle},t}(R.CoreTerminal);t.Terminal=P},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0;var r=function(){function e(e,t){void 0===t&&(t=1e3),this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}return e.prototype.dispose=function(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)},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;var n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){var o=n-this._lastRefreshMs,s=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((function(){i._lastRefreshMs=Date.now(),i._innerRefresh(),i._additionalRefreshRequested=!1,i._refreshTimeoutID=void 0}),s)}},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._renderCallback(e,t)}},e}();t.TimeBasedDebouncer=r},1680: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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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.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,l){var h=e.call(this)||this;return h._scrollLines=t,h._viewportElement=r,h._scrollArea=i,h._element=n,h._bufferService=o,h._optionsService=s,h._charSizeService=a,h._renderService=l,h.scrollBarWidth=0,h._currentRowHeight=0,h._currentScaledCellHeight=0,h._lastRecordedBufferLength=0,h._lastRecordedViewportHeight=0,h._lastRecordedBufferHeight=0,h._lastTouchY=0,h._lastScrollTop=0,h._lastHadScrollBar=!1,h._wheelPartialScroll=0,h._refreshAnimationFrame=null,h._ignoreNextScrollEvent=!1,h.scrollBarWidth=h._viewportElement.offsetWidth-h._scrollArea.offsetWidth||15,h._lastHadScrollBar=!0,h.register((0,c.addDisposableDomListener)(h._viewportElement,"scroll",h._onScroll.bind(h))),h._activeBuffer=h._bufferService.buffer,h.register(h._bufferService.buffers.onBufferActivate((function(e){return h._activeBuffer=e.activeBuffer}))),h._renderDimensions=h._renderService.dimensions,h.register(h._renderService.onDimensionsChange((function(e){return h._renderDimensions=e}))),setTimeout((function(){return h.syncScrollArea()}),0),h}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._currentScaledCellHeight=this._renderService.dimensions.scaledCellHeight,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),0===this._optionsService.options.scrollback?this.scrollBarWidth=0:this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this._lastHadScrollBar=this.scrollBarWidth>0;var r=window.getComputedStyle(this._element),i=parseInt(r.paddingLeft)+parseInt(r.paddingRight);this._viewportElement.style.width=(this._renderService.dimensions.actualCellWidth*this._bufferService.cols+this.scrollBarWidth+(this._lastHadScrollBar?i:0)).toString()+"px",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);this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.scaledCellHeight===this._currentScaledCellHeight?this._lastHadScrollBar!==this._optionsService.options.scrollback>0&&this._refresh(e):this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent){if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._scrollLines(0);var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t)}},t.prototype._bubbleScroll=function(e,t){var r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&r<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)},t.prototype.onWheel=function(e){var t=this._getPixelsScrolled(e);return 0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},t.prototype._getPixelsScrolled=function(e){if(0===e.deltaY||e.shiftKey)return 0;var t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t},t.prototype.getLinesScrolled=function(e){if(0===e.deltaY||e.shiftKey)return 0;var t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?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(4,h.IBufferService),s(5,h.IOptionsService),s(6,l.ICharSizeService),s(7,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._coreService=n,this._renderService=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.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.actualCellHeight,n=this._bufferService.buffer.y*this._renderService.dimensions.actualCellHeight,o=r*this._renderService.dimensions.actualCellWidth;this._compositionView.style.left=o+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var s=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout((function(){return t.updateCompositionElements(!0)}),0)}},i([n(2,s.IBufferService),n(3,s.IOptionsService),n(4,s.ICoreService),n(5,o.IRenderService)],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),h=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<Math.abs(n-a);c++){var l="A"===s(e,t)?-1:1,h=r.buffer.lines.get(n+l*c);(null==h?void 0:h.isWrapped)&&i++}return i}(e,t,r);return l(h,c(s(e,t),i))}function o(e,t){for(var r=0,i=e.buffer.lines.get(t),n=null==i?void 0:i.isWrapped;n&&t>=0&&t<e.rows;)r++,n=null==(i=e.buffer.lines.get(--t))?void 0:i.isWrapped;return r}function s(e,t){return e>t?"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;i<e;i++)r+=t;return r}t.moveToCellSequence=function(e,t,r,i){var s,h=r.buffer.x,u=r.buffer.y;if(!r.buffer.hasScrollback)return function(e,t,r,i,s,h){return 0===n(t,i,s,h).length?"":l(a(e,t,e,t-o(s,t),!1,s).length,c("D",h))}(h,u,0,t,r,i)+n(u,t,r,i)+function(e,t,r,i,s,h){var u;u=n(t,i,s,h).length>0?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&&c<=i||e>=r&&c<i?"C":"D"}(e,t,r,i,s,h);return l(a(e,u,r,f,"C"===_,s).length,c(_,h))}(h,u,e,t,r,i);if(u===t)return s=h>e?"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))}},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=r(8978),u=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;(0,l.removeElementFromParent)(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=(0,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=(0,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.clearTextureAtlas=function(){var e;null===(e=this._charAtlas)||void 0===e||e.clear()},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._fillMiddleLineAtCells=function(e,t,r){void 0===r&&(r=1);var i=Math.ceil(.5*this._scaledCellHeight);this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-i-window.devicePixelRatio,r*this._scaledCellWidth,window.devicePixelRatio)},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=n.TEXT_BASELINE,this._clipRow(r);var i=!1;!1!==this._optionsService.options.customGlyphs&&(i=(0,h.tryDrawCustomChar)(this._ctx,e.getChars(),t*this._scaledCellWidth,r*this._scaledCellHeight,this._scaledCellWidth,this._scaledCellHeight)),i||this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight)},e.prototype._drawChars=function(e,t,r){var o,s,a,c=this._getContrastColor(e);c||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,r,c):(e.isInverse()?(s=e.isBgDefault()?n.INVERTED_DEFAULT_COLOR:e.getBgColor(),a=e.isFgDefault()?n.INVERTED_DEFAULT_COLOR:e.getFgColor()):(a=e.isBgDefault()?i.DEFAULT_COLOR:e.getBgColor(),s=e.isFgDefault()?i.DEFAULT_COLOR:e.getFgColor()),s+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||i.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||i.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=a,this._currentGlyphIdentifier.fg=s,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),(null===(o=this._charAtlas)||void 0===o?void 0:o.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=n.TEXT_BASELINE,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);var l=!1;!1!==this._optionsService.options.customGlyphs&&(l=(0,h.tryDrawCustomChar)(this._ctx,e.getChars(),t*this._scaledCellWidth,r*this._scaledCellHeight,this._scaledCellWidth,this._scaledCellHeight)),l||this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight),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;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;default:return r?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=u},2512: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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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.CursorRenderLayer=void 0;var a=r(1546),c=r(511),l=r(2585),h=r(4725),u=600,f=function(e){function t(t,r,i,n,o,s,a,l,h){var u=e.call(this,t,"cursor",r,!0,i,n,s,a)||this;return u._onRequestRedraw=o,u._coreService=l,u._coreBrowserService=h,u._cell=new c.CellData,u._state={x:0,y:0,isFocused:!1,style:"",width:0},u._cursorRenderers={bar:u._renderBarCursor.bind(u),block:u._renderBlockCursor.bind(u),underline:u._renderUnderlineCursor.bind(u)},u}return n(t,e),t.prototype.dispose=function(){this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0),e.prototype.dispose.call(this)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},t.prototype.reset=function(){var e;this._clearCursor(),null===(e=this._cursorBlinkStateManager)||void 0===e||e.restartBlinkAnimation(),this.onOptionsChanged()},t.prototype.onBlur=function(){var e;null===(e=this._cursorBlinkStateManager)||void 0===e||e.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onFocus=function(){var e;null===(e=this._cursorBlinkStateManager)||void 0===e||e.resume(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onOptionsChanged=function(){var e,t=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new _(this._coreBrowserService.isFocused,(function(){t._render(!0)}))):(null===(e=this._cursorBlinkStateManager)||void 0===e||e.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onCursorMove=function(){var e;null===(e=this._cursorBlinkStateManager)||void 0===e||e.restartBlinkAnimation()},t.prototype.onGridChanged=function(e,t){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},t.prototype._render=function(e){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var t=this._bufferService.buffer.ybase+this._bufferService.buffer.y,r=t-this._bufferService.buffer.ydisp;if(r<0||r>=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&&(window.devicePixelRatio<1?this._clearAll():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()},o([s(5,l.IBufferService),s(6,l.IOptionsService),s(7,l.ICoreService),s(8,h.ICoreBrowserService)],t)}(a.BaseRenderLayer);t.CursorRenderLayer=f;var _=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=u),this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=window.setTimeout((function(){if(t._animationTimeRestarted){var e=u-(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=u-(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}))}),u)}),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}()},8978:(e,t,r)=>{var i,n,o,s,a,c,l,h,u,f,_,d,p,v,g,y,m,S,C,b,w,L,E,x,M,k,A,R,T,B,O,D,P,I,H,F,j,W,U,q,N,z,K,G,V,X,Y,Z,J,$,Q,ee,te,re,ie,ne,oe,se,ae,ce,le,he,ue,fe,_e,de,pe,ve,ge,ye,me,Se,Ce,be,we,Le,Ee,xe,Me,ke,Ae,Re,Te,Be,Oe,De,Pe,Ie,He,Fe,je,We,Ue,qe,Ne,ze,Ke,Ge,Ve,Xe,Ye,Ze,Je,$e,Qe,et,tt,rt,it,nt,ot,st,at,ct,lt,ht,ut,ft,_t,dt,pt,vt,gt,yt,mt,St,Ct,bt;Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;var wt=r(1752);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:9,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:0,y:0,w:4,h:8}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};var Lt={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":(i={},i[1]="M0,.5 L1,.5",i),"━":(n={},n[3]="M0,.5 L1,.5",n),"│":(o={},o[1]="M.5,0 L.5,1",o),"┃":(s={},s[3]="M.5,0 L.5,1",s),"┌":(a={},a[1]="M0.5,1 L.5,.5 L1,.5",a),"┏":(c={},c[3]="M0.5,1 L.5,.5 L1,.5",c),"┐":(l={},l[1]="M0,.5 L.5,.5 L.5,1",l),"┓":(h={},h[3]="M0,.5 L.5,.5 L.5,1",h),"└":(u={},u[1]="M.5,0 L.5,.5 L1,.5",u),"┗":(f={},f[3]="M.5,0 L.5,.5 L1,.5",f),"┘":(_={},_[1]="M.5,0 L.5,.5 L0,.5",_),"┛":(d={},d[3]="M.5,0 L.5,.5 L0,.5",d),"├":(p={},p[1]="M.5,0 L.5,1 M.5,.5 L1,.5",p),"┣":(v={},v[3]="M.5,0 L.5,1 M.5,.5 L1,.5",v),"┤":(g={},g[1]="M.5,0 L.5,1 M.5,.5 L0,.5",g),"┫":(y={},y[3]="M.5,0 L.5,1 M.5,.5 L0,.5",y),"┬":(m={},m[1]="M0,.5 L1,.5 M.5,.5 L.5,1",m),"┳":(S={},S[3]="M0,.5 L1,.5 M.5,.5 L.5,1",S),"┴":(C={},C[1]="M0,.5 L1,.5 M.5,.5 L.5,0",C),"┻":(b={},b[3]="M0,.5 L1,.5 M.5,.5 L.5,0",b),"┼":(w={},w[1]="M0,.5 L1,.5 M.5,0 L.5,1",w),"╋":(L={},L[3]="M0,.5 L1,.5 M.5,0 L.5,1",L),"╴":(E={},E[1]="M.5,.5 L0,.5",E),"╸":(x={},x[3]="M.5,.5 L0,.5",x),"╵":(M={},M[1]="M.5,.5 L.5,0",M),"╹":(k={},k[3]="M.5,.5 L.5,0",k),"╶":(A={},A[1]="M.5,.5 L1,.5",A),"╺":(R={},R[3]="M.5,.5 L1,.5",R),"╷":(T={},T[1]="M.5,.5 L.5,1",T),"╻":(B={},B[3]="M.5,.5 L.5,1",B),"═":(O={},O[1]=function(e,t){return"M0,"+(.5-t)+" L1,"+(.5-t)+" M0,"+(.5+t)+" L1,"+(.5+t)},O),"║":(D={},D[1]=function(e,t){return"M"+(.5-e)+",0 L"+(.5-e)+",1 M"+(.5+e)+",0 L"+(.5+e)+",1"},D),"╒":(P={},P[1]=function(e,t){return"M.5,1 L.5,"+(.5-t)+" L1,"+(.5-t)+" M.5,"+(.5+t)+" L1,"+(.5+t)},P),"╓":(I={},I[1]=function(e,t){return"M"+(.5-e)+",1 L"+(.5-e)+",.5 L1,.5 M"+(.5+e)+",.5 L"+(.5+e)+",1"},I),"╔":(H={},H[1]=function(e,t){return"M1,"+(.5-t)+" L"+(.5-e)+","+(.5-t)+" L"+(.5-e)+",1 M1,"+(.5+t)+" L"+(.5+e)+","+(.5+t)+" L"+(.5+e)+",1"},H),"╕":(F={},F[1]=function(e,t){return"M0,"+(.5-t)+" L.5,"+(.5-t)+" L.5,1 M0,"+(.5+t)+" L.5,"+(.5+t)},F),"╖":(j={},j[1]=function(e,t){return"M"+(.5+e)+",1 L"+(.5+e)+",.5 L0,.5 M"+(.5-e)+",.5 L"+(.5-e)+",1"},j),"╗":(W={},W[1]=function(e,t){return"M0,"+(.5+t)+" L"+(.5-e)+","+(.5+t)+" L"+(.5-e)+",1 M0,"+(.5-t)+" L"+(.5+e)+","+(.5-t)+" L"+(.5+e)+",1"},W),"╘":(U={},U[1]=function(e,t){return"M.5,0 L.5,"+(.5+t)+" L1,"+(.5+t)+" M.5,"+(.5-t)+" L1,"+(.5-t)},U),"╙":(q={},q[1]=function(e,t){return"M1,.5 L"+(.5-e)+",.5 L"+(.5-e)+",0 M"+(.5+e)+",.5 L"+(.5+e)+",0"},q),"╚":(N={},N[1]=function(e,t){return"M1,"+(.5-t)+" L"+(.5+e)+","+(.5-t)+" L"+(.5+e)+",0 M1,"+(.5+t)+" L"+(.5-e)+","+(.5+t)+" L"+(.5-e)+",0"},N),"╛":(z={},z[1]=function(e,t){return"M0,"+(.5+t)+" L.5,"+(.5+t)+" L.5,0 M0,"+(.5-t)+" L.5,"+(.5-t)},z),"╜":(K={},K[1]=function(e,t){return"M0,.5 L"+(.5+e)+",.5 L"+(.5+e)+",0 M"+(.5-e)+",.5 L"+(.5-e)+",0"},K),"╝":(G={},G[1]=function(e,t){return"M0,"+(.5-t)+" L"+(.5-e)+","+(.5-t)+" L"+(.5-e)+",0 M0,"+(.5+t)+" L"+(.5+e)+","+(.5+t)+" L"+(.5+e)+",0"},G),"╞":(V={},V[1]=function(e,t){return"M.5,0 L.5,1 M.5,"+(.5-t)+" L1,"+(.5-t)+" M.5,"+(.5+t)+" L1,"+(.5+t)},V),"╟":(X={},X[1]=function(e,t){return"M"+(.5-e)+",0 L"+(.5-e)+",1 M"+(.5+e)+",0 L"+(.5+e)+",1 M"+(.5+e)+",.5 L1,.5"},X),"╠":(Y={},Y[1]=function(e,t){return"M"+(.5-e)+",0 L"+(.5-e)+",1 M1,"+(.5+t)+" L"+(.5+e)+","+(.5+t)+" L"+(.5+e)+",1 M1,"+(.5-t)+" L"+(.5+e)+","+(.5-t)+" L"+(.5+e)+",0"},Y),"╡":(Z={},Z[1]=function(e,t){return"M.5,0 L.5,1 M0,"+(.5-t)+" L.5,"+(.5-t)+" M0,"+(.5+t)+" L.5,"+(.5+t)},Z),"╢":(J={},J[1]=function(e,t){return"M0,.5 L"+(.5-e)+",.5 M"+(.5-e)+",0 L"+(.5-e)+",1 M"+(.5+e)+",0 L"+(.5+e)+",1"},J),"╣":($={},$[1]=function(e,t){return"M"+(.5+e)+",0 L"+(.5+e)+",1 M0,"+(.5+t)+" L"+(.5-e)+","+(.5+t)+" L"+(.5-e)+",1 M0,"+(.5-t)+" L"+(.5-e)+","+(.5-t)+" L"+(.5-e)+",0"},$),"╤":(Q={},Q[1]=function(e,t){return"M0,"+(.5-t)+" L1,"+(.5-t)+" M0,"+(.5+t)+" L1,"+(.5+t)+" M.5,"+(.5+t)+" L.5,1"},Q),"╥":(ee={},ee[1]=function(e,t){return"M0,.5 L1,.5 M"+(.5-e)+",.5 L"+(.5-e)+",1 M"+(.5+e)+",.5 L"+(.5+e)+",1"},ee),"╦":(te={},te[1]=function(e,t){return"M0,"+(.5-t)+" L1,"+(.5-t)+" M0,"+(.5+t)+" L"+(.5-e)+","+(.5+t)+" L"+(.5-e)+",1 M1,"+(.5+t)+" L"+(.5+e)+","+(.5+t)+" L"+(.5+e)+",1"},te),"╧":(re={},re[1]=function(e,t){return"M.5,0 L.5,"+(.5-t)+" M0,"+(.5-t)+" L1,"+(.5-t)+" M0,"+(.5+t)+" L1,"+(.5+t)},re),"╨":(ie={},ie[1]=function(e,t){return"M0,.5 L1,.5 M"+(.5-e)+",.5 L"+(.5-e)+",0 M"+(.5+e)+",.5 L"+(.5+e)+",0"},ie),"╩":(ne={},ne[1]=function(e,t){return"M0,"+(.5+t)+" L1,"+(.5+t)+" M0,"+(.5-t)+" L"+(.5-e)+","+(.5-t)+" L"+(.5-e)+",0 M1,"+(.5-t)+" L"+(.5+e)+","+(.5-t)+" L"+(.5+e)+",0"},ne),"╪":(oe={},oe[1]=function(e,t){return"M.5,0 L.5,1 M0,"+(.5-t)+" L1,"+(.5-t)+" M0,"+(.5+t)+" L1,"+(.5+t)},oe),"╫":(se={},se[1]=function(e,t){return"M0,.5 L1,.5 M"+(.5-e)+",0 L"+(.5-e)+",1 M"+(.5+e)+",0 L"+(.5+e)+",1"},se),"╬":(ae={},ae[1]=function(e,t){return"M0,"+(.5+t)+" L"+(.5-e)+","+(.5+t)+" L"+(.5-e)+",1 M1,"+(.5+t)+" L"+(.5+e)+","+(.5+t)+" L"+(.5+e)+",1 M0,"+(.5-t)+" L"+(.5-e)+","+(.5-t)+" L"+(.5-e)+",0 M1,"+(.5-t)+" L"+(.5+e)+","+(.5-t)+" L"+(.5+e)+",0"},ae),"╱":(ce={},ce[1]="M1,0 L0,1",ce),"╲":(le={},le[1]="M0,0 L1,1",le),"╳":(he={},he[1]="M1,0 L0,1 M0,0 L1,1",he),"╼":(ue={},ue[1]="M.5,.5 L0,.5",ue[3]="M.5,.5 L1,.5",ue),"╽":(fe={},fe[1]="M.5,.5 L.5,0",fe[3]="M.5,.5 L.5,1",fe),"╾":(_e={},_e[1]="M.5,.5 L1,.5",_e[3]="M.5,.5 L0,.5",_e),"╿":(de={},de[1]="M.5,.5 L.5,1",de[3]="M.5,.5 L.5,0",de),"┍":(pe={},pe[1]="M.5,.5 L.5,1",pe[3]="M.5,.5 L1,.5",pe),"┎":(ve={},ve[1]="M.5,.5 L1,.5",ve[3]="M.5,.5 L.5,1",ve),"┑":(ge={},ge[1]="M.5,.5 L.5,1",ge[3]="M.5,.5 L0,.5",ge),"┒":(ye={},ye[1]="M.5,.5 L0,.5",ye[3]="M.5,.5 L.5,1",ye),"┕":(me={},me[1]="M.5,.5 L.5,0",me[3]="M.5,.5 L1,.5",me),"┖":(Se={},Se[1]="M.5,.5 L1,.5",Se[3]="M.5,.5 L.5,0",Se),"┙":(Ce={},Ce[1]="M.5,.5 L.5,0",Ce[3]="M.5,.5 L0,.5",Ce),"┚":(be={},be[1]="M.5,.5 L0,.5",be[3]="M.5,.5 L.5,0",be),"┝":(we={},we[1]="M.5,0 L.5,1",we[3]="M.5,.5 L1,.5",we),"┞":(Le={},Le[1]="M0.5,1 L.5,.5 L1,.5",Le[3]="M.5,.5 L.5,0",Le),"┟":(Ee={},Ee[1]="M.5,0 L.5,.5 L1,.5",Ee[3]="M.5,.5 L.5,1",Ee),"┠":(xe={},xe[1]="M.5,.5 L1,.5",xe[3]="M.5,0 L.5,1",xe),"┡":(Me={},Me[1]="M.5,.5 L.5,1",Me[3]="M.5,0 L.5,.5 L1,.5",Me),"┢":(ke={},ke[1]="M.5,.5 L.5,0",ke[3]="M0.5,1 L.5,.5 L1,.5",ke),"┥":(Ae={},Ae[1]="M.5,0 L.5,1",Ae[3]="M.5,.5 L0,.5",Ae),"┦":(Re={},Re[1]="M0,.5 L.5,.5 L.5,1",Re[3]="M.5,.5 L.5,0",Re),"┧":(Te={},Te[1]="M.5,0 L.5,.5 L0,.5",Te[3]="M.5,.5 L.5,1",Te),"┨":(Be={},Be[1]="M.5,.5 L0,.5",Be[3]="M.5,0 L.5,1",Be),"┩":(Oe={},Oe[1]="M.5,.5 L.5,1",Oe[3]="M.5,0 L.5,.5 L0,.5",Oe),"┪":(De={},De[1]="M.5,.5 L.5,0",De[3]="M0,.5 L.5,.5 L.5,1",De),"┭":(Pe={},Pe[1]="M0.5,1 L.5,.5 L1,.5",Pe[3]="M.5,.5 L0,.5",Pe),"┮":(Ie={},Ie[1]="M0,.5 L.5,.5 L.5,1",Ie[3]="M.5,.5 L1,.5",Ie),"┯":(He={},He[1]="M.5,.5 L.5,1",He[3]="M0,.5 L1,.5",He),"┰":(Fe={},Fe[1]="M0,.5 L1,.5",Fe[3]="M.5,.5 L.5,1",Fe),"┱":(je={},je[1]="M.5,.5 L1,.5",je[3]="M0,.5 L.5,.5 L.5,1",je),"┲":(We={},We[1]="M.5,.5 L0,.5",We[3]="M0.5,1 L.5,.5 L1,.5",We),"┵":(Ue={},Ue[1]="M.5,0 L.5,.5 L1,.5",Ue[3]="M.5,.5 L0,.5",Ue),"┶":(qe={},qe[1]="M.5,0 L.5,.5 L0,.5",qe[3]="M.5,.5 L1,.5",qe),"┷":(Ne={},Ne[1]="M.5,.5 L.5,0",Ne[3]="M0,.5 L1,.5",Ne),"┸":(ze={},ze[1]="M0,.5 L1,.5",ze[3]="M.5,.5 L.5,0",ze),"┹":(Ke={},Ke[1]="M.5,.5 L1,.5",Ke[3]="M.5,0 L.5,.5 L0,.5",Ke),"┺":(Ge={},Ge[1]="M.5,.5 L0,.5",Ge[3]="M.5,0 L.5,.5 L1,.5",Ge),"┽":(Ve={},Ve[1]="M.5,0 L.5,1 M.5,.5 L1,.5",Ve[3]="M.5,.5 L0,.5",Ve),"┾":(Xe={},Xe[1]="M.5,0 L.5,1 M.5,.5 L0,.5",Xe[3]="M.5,.5 L1,.5",Xe),"┿":(Ye={},Ye[1]="M.5,0 L.5,1",Ye[3]="M0,.5 L1,.5",Ye),"╀":(Ze={},Ze[1]="M0,.5 L1,.5 M.5,.5 L.5,1",Ze[3]="M.5,.5 L.5,0",Ze),"╁":(Je={},Je[1]="M.5,.5 L.5,0 M0,.5 L1,.5",Je[3]="M.5,.5 L.5,1",Je),"╂":($e={},$e[1]="M0,.5 L1,.5",$e[3]="M.5,0 L.5,1",$e),"╃":(Qe={},Qe[1]="M0.5,1 L.5,.5 L1,.5",Qe[3]="M.5,0 L.5,.5 L0,.5",Qe),"╄":(et={},et[1]="M0,.5 L.5,.5 L.5,1",et[3]="M.5,0 L.5,.5 L1,.5",et),"╅":(tt={},tt[1]="M.5,0 L.5,.5 L1,.5",tt[3]="M0,.5 L.5,.5 L.5,1",tt),"╆":(rt={},rt[1]="M.5,0 L.5,.5 L0,.5",rt[3]="M0.5,1 L.5,.5 L1,.5",rt),"╇":(it={},it[1]="M.5,.5 L.5,1",it[3]="M.5,.5 L.5,0 M0,.5 L1,.5",it),"╈":(nt={},nt[1]="M.5,.5 L.5,0",nt[3]="M0,.5 L1,.5 M.5,.5 L.5,1",nt),"╉":(ot={},ot[1]="M.5,.5 L1,.5",ot[3]="M.5,0 L.5,1 M.5,.5 L0,.5",ot),"╊":(st={},st[1]="M.5,.5 L0,.5",st[3]="M.5,0 L.5,1 M.5,.5 L1,.5",st),"╌":(at={},at[1]="M.1,.5 L.4,.5 M.6,.5 L.9,.5",at),"╍":(ct={},ct[3]="M.1,.5 L.4,.5 M.6,.5 L.9,.5",ct),"┄":(lt={},lt[1]="M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",lt),"┅":(ht={},ht[3]="M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",ht),"┈":(ut={},ut[1]="M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",ut),"┉":(ft={},ft[3]="M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",ft),"╎":(_t={},_t[1]="M.5,.1 L.5,.4 M.5,.6 L.5,.9",_t),"╏":(dt={},dt[3]="M.5,.1 L.5,.4 M.5,.6 L.5,.9",dt),"┆":(pt={},pt[1]="M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",pt),"┇":(vt={},vt[3]="M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",vt),"┊":(gt={},gt[1]="M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",gt),"┋":(yt={},yt[3]="M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",yt),"╭":(mt={},mt[1]="C.5,1,.5,.5,1,.5",mt),"╮":(St={},St[1]="C.5,1,.5,.5,0,.5",St),"╯":(Ct={},Ct[1]="C.5,0,.5,.5,0,.5",Ct),"╰":(bt={},bt[1]="C.5,0,.5,.5,1,.5",bt)},t.tryDrawCustomChar=function(e,r,i,n,o,s){var a=t.blockElementDefinitions[r];if(a)return function(e,t,r,i,n,o){for(var s=0;s<t.length;s++){var a=t[s],c=n/8,l=o/8;e.fillRect(r+a.x*c,i+a.y*l,a.w*c,a.h*l)}}(e,a,i,n,o,s),!0;var c=Lt[r];if(c)return function(e,t,r,i,n,o){var s,a=Et.get(t);a||(a=new Map,Et.set(t,a));var c=e.fillStyle;if("string"!=typeof c)throw new Error('Unexpected fillStyle type "'+c+'"');var l=a.get(c);if(!l){var h=t[0].length,u=t.length,f=document.createElement("canvas");f.width=h,f.height=u;var _=(0,wt.throwIfFalsy)(f.getContext("2d")),d=new ImageData(h,u),p=void 0,v=void 0,g=void 0,y=void 0;if(c.startsWith("#"))p=parseInt(c.substr(1,2),16),v=parseInt(c.substr(3,2),16),g=parseInt(c.substr(5,2),16),y=c.length>7&&parseInt(c.substr(7,2),16)||1;else{if(!c.startsWith("rgba"))throw new Error('Unexpected fillStyle color format "'+c+'" when drawing pattern glyph');p=(s=c.substring(5,c.length-1).split(",").map((function(e){return parseFloat(e)})))[0],v=s[1],g=s[2],y=s[3]}for(var m=0;m<u;m++)for(var S=0;S<h;S++)d.data[4*(m*h+S)]=p,d.data[4*(m*h+S)+1]=v,d.data[4*(m*h+S)+2]=g,d.data[4*(m*h+S)+3]=t[m][S]*(255*y);_.putImageData(d,0,0),l=(0,wt.throwIfFalsy)(e.createPattern(f,null)),a.set(c,l)}e.fillStyle=l,e.fillRect(r,i,n,o)}(e,c,i,n,o,s),!0;var l=t.boxDrawingDefinitions[r];return!!l&&(function(e,t,r,i,n,o){e.strokeStyle=e.fillStyle;for(var s=0,a=Object.entries(t);s<a.length;s++){var c=a[s],l=c[0],h=c[1];e.beginPath(),e.lineWidth=window.devicePixelRatio*Number.parseInt(l);for(var u=0,f=("function"==typeof h?h(.15,.15/o*n):h).split(" ");u<f.length;u++){var _=f[u],d=_[0],p=Mt[d];if(p){var v=_.substring(1).split(",");v[0]&&v[1]&&p(e,kt(v,n,o,r,i))}else console.error('Could not find drawing instructions for "'+d+'"')}e.stroke(),e.closePath()}}(e,l,i,n,o,s),!0)};var Et=new Map;function xt(e,t,r){return void 0===r&&(r=0),Math.max(Math.min(e,t),r)}var Mt={C:function(e,t){return e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])},L:function(e,t){return e.lineTo(t[0],t[1])},M:function(e,t){return e.moveTo(t[0],t[1])}};function kt(e,t,r,i,n){var o=e.map((function(e){return parseFloat(e)||parseInt(e)}));if(o.length<2)throw new Error("Too few arguments for instruction");for(var s=0;s<o.length;s+=2)o[s]*=t,0!==o[s]&&(o[s]=xt(Math.round(o[s]+.5)-.5,t,0)),o[s]+=i;for(var a=1;a<o.length;a+=2)o[a]*=r,0!==o[a]&&(o[a]=xt(Math.round(o[a]+.5)-.5,r,0)),o[a]+=n;return o}},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;r<e;r++){this.cache.length<=r&&this.cache.push([]);for(var i=this.cache[r].length;i<t;i++)this.cache[r].push(void 0);this.cache[r].length=t}this.cache.length=e},e.prototype.clear=function(){for(var e=0;e<this.cache.length;e++)for(var t=0;t<this.cache[e].length;t++)this.cache[e][t]=void 0},e}();t.GridCache=r},5098: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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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.LinkRenderLayer=void 0;var a=r(1546),c=r(8803),l=r(2040),h=r(2585),u=function(e){function t(t,r,i,n,o,s,a,c){var l=e.call(this,t,"link",r,!0,i,n,a,c)||this;return o.onShowLinkUnderline((function(e){return l._onShowLinkUnderline(e)})),o.onHideLinkUnderline((function(e){return l._onHideLinkUnderline(e)})),s.onShowLinkUnderline((function(e){return l._onShowLinkUnderline(e)})),s.onHideLinkUnderline((function(e){return l._onHideLinkUnderline(e)})),l}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._state=void 0},t.prototype.reset=function(){this._clearCurrentLink()},t.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},t.prototype._onShowLinkUnderline=function(e){if(e.fg===c.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:e.fg&&(0,l.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<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e},t.prototype._onHideLinkUnderline=function(e){this._clearCurrentLink()},o([s(6,h.IBufferService),s(7,h.IOptionsService)],t)}(a.BaseRenderLayer);t.LinkRenderLayer=u},3525: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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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.Renderer=void 0;var a=r(9596),c=r(4149),l=r(2512),h=r(5098),u=r(844),f=r(4725),_=r(2585),d=r(1420),p=r(8460),v=1,g=function(e){function t(t,r,i,n,o,s,u,f){var _=e.call(this)||this;_._colors=t,_._screenElement=r,_._bufferService=s,_._charSizeService=u,_._optionsService=f,_._id=v++,_._onRequestRedraw=new p.EventEmitter;var d=_._optionsService.options.allowTransparency;return _._renderLayers=[o.createInstance(a.TextRenderLayer,_._screenElement,0,_._colors,d,_._id),o.createInstance(c.SelectionRenderLayer,_._screenElement,1,_._colors,_._id),o.createInstance(h.LinkRenderLayer,_._screenElement,2,_._colors,_._id,i,n),o.createInstance(l.CursorRenderLayer,_._screenElement,3,_._colors,_._id,_._onRequestRedraw)],_.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},_._devicePixelRatio=window.devicePixelRatio,_._updateDimensions(),_.onOptionsChanged(),_}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<r.length;t++)r[t].dispose();e.prototype.dispose.call(this),(0,d.removeTerminalFromCache)(this._id)},t.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},t.prototype.setColors=function(e){this._colors=e;for(var t=0,r=this._renderLayers;t<r.length;t++){var i=r[t];i.setColors(this._colors),i.reset()}},t.prototype.onResize=function(e,t){this._updateDimensions();for(var r=0,i=this._renderLayers;r<i.length;r++)i[r].resize(this.dimensions);this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},t.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},t.prototype.onBlur=function(){this._runOperation((function(e){return e.onBlur()}))},t.prototype.onFocus=function(){this._runOperation((function(e){return e.onFocus()}))},t.prototype.onSelectionChanged=function(e,t,r){void 0===r&&(r=!1),this._runOperation((function(i){return i.onSelectionChanged(e,t,r)}))},t.prototype.onCursorMove=function(){this._runOperation((function(e){return e.onCursorMove()}))},t.prototype.onOptionsChanged=function(){this._runOperation((function(e){return e.onOptionsChanged()}))},t.prototype.clear=function(){this._runOperation((function(e){return e.reset()}))},t.prototype._runOperation=function(e){for(var t=0,r=this._renderLayers;t<r.length;t++)e(r[t])},t.prototype.renderRows=function(e,t){for(var r=0,i=this._renderLayers;r<i.length;r++)i[r].onGridChanged(e,t)},t.prototype.clearTextureAtlas=function(){for(var e=0,t=this._renderLayers;e<t.length;e++)t[e].clearTextureAtlas()},t.prototype._updateDimensions=function(){this._charSizeService.hasValidSize&&(this.dimensions.scaledCharWidth=Math.floor(this._charSizeService.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharTop=1===this._optionsService.options.lineHeight?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._optionsService.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._bufferService.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._bufferService.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols)},o([s(4,_.IInstantiationService),s(5,_.IBufferService),s(6,f.ICharSizeService),s(7,_.IOptionsService)],t)}(u.Disposable);t.Renderer=g},1752:(e,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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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.SelectionRenderLayer=void 0;var a=r(1546),c=r(2585),l=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]},o([s(4,c.IBufferService),s(5,c.IOptionsService)],t)}(a.BaseRenderLayer);t.SelectionRenderLayer=l},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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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.TextRenderLayer=void 0;var a=r(3700),c=r(1546),l=r(3734),h=r(643),u=r(511),f=r(2585),_=r(4725),d=r(4269),p=function(e){function t(t,r,i,n,o,s,c,l){var h=e.call(this,t,"text",r,n,i,o,s,c)||this;return h._characterJoinerService=l,h._characterWidth=0,h._characterFont="",h._characterOverlapCache={},h._workCell=new u.CellData,h._state=new a.GridCache,h}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){for(var i=e;i<=t;i++)for(var n=i+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.lines.get(n),s=this._characterJoinerService.getJoinedCharacters(n),a=0;a<this._bufferService.cols;a++){o.loadCell(a,this._workCell);var c=this._workCell,l=!1,u=a;if(0!==c.getWidth()){if(s.length>0&&a===s[0][0]){l=!0;var f=s.shift();c=new d.JoinedCellData(this._workCell,o.translateToString(!0,f[0],f[1]),f[1]-f[0]),u=f[1]-1}!l&&this._isOverlapping(c)&&u<o.length-1&&o.getCodePoint(u+1)===h.NULL_CELL_CODE&&(c.content&=-12582913,c.content|=2<<22),r(c,a,i),a=u}}},t.prototype._drawBackground=function(e,t){var r=this,i=this._ctx,n=this._bufferService.cols,o=0,s=0,a=null;i.save(),this._forEachCell(e,t,(function(e,t,c){var h=null;e.isInverse()?h=e.isFgDefault()?r._colors.foreground.css:e.isFgRGB()?"rgb("+l.AttributeData.toColorRGB(e.getFgColor()).join(",")+")":r._colors.ansi[e.getFgColor()].css:e.isBgRGB()?h="rgb("+l.AttributeData.toColorRGB(e.getBgColor()).join(",")+")":e.isBgPalette()&&(h=r._colors.ansi[e.getBgColor()].css),null===a&&(o=t,s=c),c!==s?(i.fillStyle=a||"",r._fillCells(o,s,n-o,1),o=t,s=c):a!==h&&(i.fillStyle=a||"",r._fillCells(o,s,t-o,1),o=t,s=c),a=h})),null!==a&&(i.fillStyle=a,this._fillCells(o,s,n-o,1)),i.restore()},t.prototype._drawForeground=function(e,t){var r=this;this._forEachCell(e,t,(function(e,t,i){if(!e.isInvisible()&&(r._drawChars(e,t,i),e.isUnderline()||e.isStrikethrough())){if(r._ctx.save(),e.isInverse())if(e.isBgDefault())r._ctx.fillStyle=r._colors.background.css;else if(e.isBgRGB())r._ctx.fillStyle="rgb("+l.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var n=e.getBgColor();r._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&n<8&&(n+=8),r._ctx.fillStyle=r._colors.ansi[n].css}else if(e.isFgDefault())r._ctx.fillStyle=r._colors.foreground.css;else if(e.isFgRGB())r._ctx.fillStyle="rgb("+l.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var o=e.getFgColor();r._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8&&(o+=8),r._ctx.fillStyle=r._colors.ansi[o].css}e.isStrikethrough()&&r._fillMiddleLineAtCells(t,i,e.getWidth()),e.isUnderline()&&r._fillBottomLineAtCells(t,i,e.getWidth()),r._ctx.restore()}}))},t.prototype.onGridChanged=function(e,t){0!==this._state.cache.length&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,e,this._bufferService.cols,t-e+1),this._drawBackground(e,t),this._drawForeground(e,t))},t.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},t.prototype._isOverlapping=function(e){if(1!==e.getWidth())return!1;if(e.getCode()<256)return!1;var t=e.getChars();if(this._characterOverlapCache.hasOwnProperty(t))return this._characterOverlapCache[t];this._ctx.save(),this._ctx.font=this._characterFont;var r=Math.floor(this._ctx.measureText(t).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=r,r},o([s(5,f.IBufferService),s(6,f.IOptionsService),s(7,_.ICharacterJoinerService)],t)}(c.BaseRenderLayer);t.TextRenderLayer=p},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.clear=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=(0,i.generateConfig)(s,a,e,r),l=0;l<o.length;l++){var h=(u=o[l]).ownedBy.indexOf(t);if(h>=0){if((0,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<o.length;l++){var u=o[l];if((0,i.configEquals)(u.config,c))return u.ownedBy.push(t),u.atlas}var f={atlas:new n.DynamicCharAtlas(document,c),config:c,ownedBy:[t]};return o.push(f),f.atlas},t.removeTerminalFromCache=function(e){for(var t=0;t<o.length;t++){var r=o[t].ownedBy.indexOf(e);if(-1!==r){1===o[t].ownedBy.length?(o[t].atlas.dispose(),o.splice(t,1)):o[t].ownedBy.splice(r,1);break}}}},2040:function(e,t,r){var i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;var n=r(643);t.generateConfig=function(e,t,r,n){var o={foreground:n.foreground,background:n.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:i([],n.ansi,!0)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:e,scaledCharHeight:t,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,colors:o}},t.configEquals=function(e,t){for(var r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.scaledCharWidth===t.scaledCharWidth&&e.scaledCharHeight===t.scaledCharHeight&&e.colors.foreground===t.colors.foreground&&e.colors.background===t.colors.background},t.is256Color=function(e){return e<n.DEFAULT_COLOR}},8803:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR_ATLAS_CELL_SPACING=t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;var i=r(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=i.isFirefox?"bottom":"ideographic",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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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=1024,_=1024,d={css:"rgba(0, 0, 0, 0)",rgba:0};function p(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=p;var v=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=f,i._cacheCanvas.height=_,i._cacheCtx=(0,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=(0,h.throwIfFalsy)(n.getContext("2d",{alpha:i._config.allowTransparency})),i._width=Math.floor(f/i._config.scaledCharWidth),i._height=Math.floor(_/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.clear=function(){if(this._cacheMap.size>0){var e=this._width*this._height;this._cacheMap=new c.LRUMap(e),this._cacheMap.prealloc(e)}this._cacheCtx.clearRect(0,0,f,_),this._tmpCtx.clearRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight)},t.prototype.draw=function(e,t,r,i){if(32===t.code)return!0;if(!this._canCache(t))return!1;var n=p(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<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index;var a=this._drawToCache(t,s);return this._cacheMap.set(n,a),this._drawFromCache(e,a,r,i),!0}return!1},t.prototype._canCache=function(e){return e.code<256},t.prototype._toCoordinateX=function(e){return e%this._width*this._config.scaledCharWidth},t.prototype._toCoordinateY=function(e){return Math.floor(e/this._width)*this._config.scaledCharHeight},t.prototype._drawFromCache=function(e,t,r,i){if(!t.isEmpty){var n=this._toCoordinateX(t.index),o=this._toCoordinateY(t.index);e.drawImage(t.inBitmap?this._bitmap:this._cacheCanvas,n,o,this._config.scaledCharWidth,this._config.scaledCharHeight,r,i,this._config.scaledCharWidth,this._config.scaledCharHeight)}},t.prototype._getColorFromAnsiIndex=function(e){return e<this._config.colors.ansi.length?this._config.colors.ansi[e]:a.DEFAULT_ANSI_COLORS[e]},t.prototype._getBackgroundColor=function(e){return this._config.allowTransparency?d:e.bg===o.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:e.bg<256?this._getColorFromAnsiIndex(e.bg):this._config.colors.background},t.prototype._getForegroundColor=function(e){return e.fg===o.INVERTED_DEFAULT_COLOR?u.color.opaque(this._config.colors.background):e.fg<256?this._getColorFromAnsiIndex(e.fg):this._config.colors.foreground},t.prototype._drawToCache=function(e,t){this._drawToCacheCount++,this._tmpCtx.save();var r=this._getBackgroundColor(e);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=r.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var i=e.bold?this._config.fontWeightBold:this._config.fontWeight,n=e.italic?"italic":"";this._tmpCtx.font=n+" "+i+" "+this._config.fontSize*this._config.devicePixelRatio+"px "+this._config.fontFamily,this._tmpCtx.textBaseline=o.TEXT_BASELINE,this._tmpCtx.fillStyle=this._getForegroundColor(e).css,e.dim&&(this._tmpCtx.globalAlpha=o.DIM_OPACITY),this._tmpCtx.fillText(e.chars,0,this._config.scaledCharHeight);var s=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),a=!1;if(this._config.allowTransparency||(a=y(s,r)),a&&"_"===e.chars&&!this._config.allowTransparency)for(var c=1;c<=5&&(this._tmpCtx.fillText(e.chars,0,this._config.scaledCharHeight-c),a=y(s=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),r));c++);this._tmpCtx.restore();var l=this._toCoordinateX(t),h=this._toCoordinateY(t);this._cacheCtx.putImageData(s,l,h);var u={index:t,isEmpty:a,inBitmap:!1};return this._addGlyphToBitmap(u),u},t.prototype._addGlyphToBitmap=function(e){var t=this;!("createImageBitmap"in window)||l.isFirefox||l.isSafari||(this._glyphsWaitingOnBitmap.push(e),null===this._bitmapCommitTimeout&&(this._bitmapCommitTimeout=window.setTimeout((function(){return t._generateBitmap()}),100)))},t.prototype._generateBitmap=function(){var e=this,t=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then((function(r){e._bitmap=r;for(var i=0;i<t.length;i++)t[i].inBitmap=!0})),this._bitmapCommitTimeout=null},t}(s.BaseCharAtlas);t.DynamicCharAtlas=v;var g=function(e){function t(t,r){return e.call(this)||this}return n(t,e),t.prototype.draw=function(e,t,r,i){return!1},t}(s.BaseCharAtlas);function y(e,t){for(var r=!0,i=t.rgba>>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,s=0;s<e.data.length;s+=4)e.data[s]===i&&e.data[s+1]===n&&e.data[s+2]===o?e.data[s+3]=0:r=!1;return r}t.NoneCharAtlas=g},7001:(e,t)=>{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<e;r++)t.push({prev:null,next:null,key:null,value:null})},e.prototype.get=function(e){var t=this._map[e];return void 0!==t?(this._unlinkNode(t),this._appendNode(t),t.value):null},e.prototype.peekValue=function(e){var t=this._map[e];return void 0!==t?t.value:null},e.prototype.peek=function(){var e=this._head;return null===e?null:e.value},e.prototype.set=function(e,t){var r=this._map[e];if(void 0!==r)r=this._map[e],this._unlinkNode(r),r.value=t;else if(this.size>=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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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",m=1,S=function(e){function t(t,r,i,n,o,s,c,l,h,u){var f=e.call(this)||this;return f._colors=t,f._element=r,f._screenElement=i,f._viewportElement=n,f._linkifier=o,f._linkifier2=s,f._charSizeService=l,f._optionsService=h,f._bufferService=u,f._terminalClass=m++,f._rowElements=[],f._rowContainer=document.createElement("div"),f._rowContainer.classList.add("xterm-rows"),f._rowContainer.style.lineHeight="normal",f._rowContainer.setAttribute("aria-hidden","true"),f._refreshRowElements(f._bufferService.cols,f._bufferService.rows),f._selectionContainer=document.createElement("div"),f._selectionContainer.classList.add("xterm-selection"),f._selectionContainer.setAttribute("aria-hidden","true"),f.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},f._updateDimensions(),f._injectCss(),f._rowFactory=c.createInstance(a.DomRendererRowFactory,document,f._colors),f._element.classList.add(p+f._terminalClass),f._screenElement.appendChild(f._rowContainer),f._screenElement.appendChild(f._selectionContainer),f._linkifier.onShowLinkUnderline((function(e){return f._onLinkHover(e)})),f._linkifier.onHideLinkUnderline((function(e){return f._onLinkLeave(e)})),f._linkifier2.onShowLinkUnderline((function(e){return f._onLinkHover(e)})),f._linkifier2.onHideLinkUnderline((function(e){return f._onLinkLeave(e)})),f}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),(0,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;e<t.length;e++){var r=t[e];r.style.width=this.dimensions.canvasWidth+"px",r.style.height=this.dimensions.actualCellHeight+"px",r.style.lineHeight=this.dimensions.actualCellHeight+"px",r.style.overflow="hidden"}this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));var i=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},t.prototype.setColors=function(e){this._colors=e,this._injectCss()},t.prototype._injectCss=function(){var e=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var t=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";t+=this._terminalSelector+" span:not(."+a.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+a.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+a.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: "+this._colors.cursor.css+";  color: "+this._colors.cursorAccent.css+"; } 50% {  background-color: "+this._colors.cursorAccent.css+";  color: "+this._colors.cursor.css+"; }}",t+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+a.CURSOR_CLASS+"."+a.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+a.CURSOR_CLASS+"."+a.CURSOR_BLINK_CLASS+":not(."+a.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+a.CURSOR_CLASS+"."+a.CURSOR_BLINK_CLASS+"."+a.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+a.CURSOR_CLASS+"."+a.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+a.CURSOR_CLASS+"."+a.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+a.CURSOR_CLASS+"."+a.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",t+=this._terminalSelector+" .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" .xterm-selection div { position: absolute; background-color: "+this._colors.selectionTransparent.css+";}",this._colors.ansi.forEach((function(r,i){t+=e._terminalSelector+" ."+v+i+" { color: "+r.css+"; }"+e._terminalSelector+" ."+g+i+" { background-color: "+r.css+"; }"})),t+=this._terminalSelector+" ."+v+c.INVERTED_DEFAULT_COLOR+" { color: "+_.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" ."+g+c.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.textContent=t},t.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},t.prototype._refreshRowElements=function(e,t){for(var r=this._rowElements.length;r<=t;r++){var i=document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)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<t.length;e++)t[e].innerText=""},t.prototype.renderRows=function(e,t){for(var r=this._bufferService.buffer.ybase+this._bufferService.buffer.y,i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._optionsService.options.cursorBlink,o=e;o<=t;o++){var s=this._rowElements[o];s.innerText="";var a=o+this._bufferService.buffer.ydisp,c=this._bufferService.buffer.lines.get(a),l=this._optionsService.options.cursorStyle;s.appendChild(this._rowFactory.createRow(c,a,a===r,l,i,n,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(t.prototype,"_terminalSelector",{get:function(){return"."+p+this._terminalClass},enumerable:!1,configurable:!0}),t.prototype._onLinkHover=function(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)},t.prototype._onLinkLeave=function(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)},t.prototype._setCellUnderline=function(e,t,r,i,n,o){for(;e!==t||r!==i;){var s=this._rowElements[r];if(!s)return;var a=s.children[e];a&&(a.style.textDecoration=o?"underline":"none"),++e>=n&&(e=0,r++)}},o([s(6,u.IInstantiationService),s(7,h.ICharSizeService),s(8,u.IOptionsService),s(9,u.IBufferService)],t)}(l.Disposable);t.DomRenderer=S},3787: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.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;var o=r(8803),s=r(643),a=r(511),c=r(2585),l=r(4774),h=r(4725),u=r(4269);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";var f=function(){function e(e,t,r,i,n){this._document=e,this._colors=t,this._characterJoinerService=r,this._optionsService=i,this._coreService=n,this._workCell=new a.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,r,i,n,a,c,h,f){for(var d=this._document.createDocumentFragment(),p=this._characterJoinerService.getJoinedCharacters(r),v=0,g=Math.min(e.length,f)-1;g>=0;g--)if(e.loadCell(g,this._workCell).getCode()!==s.NULL_CELL_CODE||i&&g===a){v=g+1;break}for(g=0;g<v;g++){e.loadCell(g,this._workCell);var y=this._workCell.getWidth();if(0!==y){var m=!1,S=g,C=this._workCell;if(p.length>0&&g===p[0][0]){m=!0;var b=p.shift();C=new u.JoinedCellData(this._workCell,e.translateToString(!0,b[0],b[1]),b[1]-b[0]),S=b[1]-1,y=C.getWidth()}var w=this._document.createElement("span");if(y>1&&(w.style.width=h*y+"px"),m&&(w.style.display="inline",a>=g&&a<=S&&(a=g)),!this._coreService.isCursorHidden&&i&&g===a)switch(w.classList.add(t.CURSOR_CLASS),c&&w.classList.add(t.CURSOR_BLINK_CLASS),n){case"bar":w.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":w.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:w.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}C.isBold()&&w.classList.add(t.BOLD_CLASS),C.isItalic()&&w.classList.add(t.ITALIC_CLASS),C.isDim()&&w.classList.add(t.DIM_CLASS),C.isUnderline()&&w.classList.add(t.UNDERLINE_CLASS),C.isInvisible()?w.textContent=s.WHITESPACE_CELL_CHAR:w.textContent=C.getChars()||s.WHITESPACE_CELL_CHAR,C.isStrikethrough()&&w.classList.add(t.STRIKETHROUGH_CLASS);var L=C.getFgColor(),E=C.getFgColorMode(),x=C.getBgColor(),M=C.getBgColorMode(),k=!!C.isInverse();if(k){var A=L;L=x,x=A;var R=E;E=M,M=R}switch(E){case 16777216:case 33554432:C.isBold()&&L<8&&this._optionsService.options.drawBoldTextInBrightColors&&(L+=8),this._applyMinimumContrast(w,this._colors.background,this._colors.ansi[L])||w.classList.add("xterm-fg-"+L);break;case 50331648:var T=l.rgba.toColor(L>>16&255,L>>8&255,255&L);this._applyMinimumContrast(w,this._colors.background,T)||this._addStyle(w,"color:#"+_(L.toString(16),"0",6));break;default:this._applyMinimumContrast(w,this._colors.background,this._colors.foreground)||k&&w.classList.add("xterm-fg-"+o.INVERTED_DEFAULT_COLOR)}switch(M){case 16777216:case 33554432:w.classList.add("xterm-bg-"+x);break;case 50331648:this._addStyle(w,"background-color:#"+_(x.toString(16),"0",6));break;default:k&&w.classList.add("xterm-bg-"+o.INVERTED_DEFAULT_COLOR)}d.appendChild(w),g=S}}return d},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=l.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+";")},i([n(2,h.ICharacterJoinerService),n(3,c.IOptionsService),n(4,c.ICoreService)],e)}();function _(e,t,r){for(;e.length<r;)e=t+e;return e}t.DomRendererRowFactory=f},456:(e,t)=>{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==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]]}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}()},4269: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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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.CharacterJoinerService=t.JoinedCellData=void 0;var a=r(3734),c=r(643),l=r(511),h=r(2585),u=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}(a.AttributeData);t.JoinedCellData=u;var f=function(){function e(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new l.CellData}return e.prototype.register=function(e){var t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id},e.prototype.deregister=function(e){for(var t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1},e.prototype.getJoinedCharacters=function(e){if(0===this._characterJoiners.length)return[];var t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];for(var r=[],i=t.translateToString(!0),n=0,o=0,s=0,a=t.getFg(0),l=t.getBg(0),h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==a||this._workCell.bg!==l){if(h-n>1)for(var u=this._getJoinedRanges(i,s,o,t,n),f=0;f<u.length;f++)r.push(u[f]);n=h,s=o,a=this._workCell.fg,l=this._workCell.bg}o+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-n>1)for(u=this._getJoinedRanges(i,s,o,t,n),f=0;f<u.length;f++)r.push(u[f]);return r},e.prototype._getJoinedRanges=function(t,r,i,n,o){var s=t.substring(r,i),a=[];try{a=this._characterJoiners[0].handler(s)}catch(e){console.error(e)}for(var c=1;c<this._characterJoiners.length;c++)try{for(var l=this._characterJoiners[c].handler(s),h=0;h<l.length;h++)e._mergeRanges(a,l[h])}catch(e){console.error(e)}return this._stringRangesToCellRanges(a,n,o),a},e.prototype._stringRangesToCellRanges=function(e,t,r){var i=0,n=!1,o=0,s=e[i];if(s){for(var a=r;a<this._bufferService.cols;a++){var l=t.getWidth(a),h=t.getString(a).length||c.WHITESPACE_CELL_CHAR.length;if(0!==l){if(!n&&s[0]<=o&&(s[0]=a,n=!0),s[1]<=o){if(s[1]=a,!(s=e[++i]))break;s[0]<=o?(s[0]=a,n=!0):n=!1}o+=h}}s&&(s[1]=this._bufferService.cols)}},e._mergeRanges=function(e,t){for(var r=!1,i=0;i<e.length;i++){var n=e[i];if(r){if(t[1]<=n[0])return e[i-1][1]=t[1],e;if(t[1]<=n[1])return e[i-1][1]=Math.max(t[1],n[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=n[0])return e.splice(i,0,t),e;if(t[1]<=n[1])return n[0]=Math.min(t[0],n[0]),e;t[0]<n[1]&&(n[0]=Math.min(t[0],n[0]),r=!0)}}return r?e[e.length-1][1]=t[1]:e.push(t),e},e=o([s(0,h.IBufferService)],e)}();t.CharacterJoinerService=f},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(0,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(0,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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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((0,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.clearTextureAtlas=function(){var e,t;null===(t=null===(e=this._renderer)||void 0===e?void 0:e.clearTextureAtlas)||void 0===t||t.call(e),this._fullRefresh()},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()},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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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=r(4841),g=String.fromCharCode(160),y=new RegExp(g,"g"),m=function(e){function t(t,r,i,n,o,s,a,u){var f=e.call(this)||this;return f._element=t,f._screenElement=r,f._linkifier=i,f._bufferService=n,f._coreService=o,f._mouseService=s,f._optionsService=a,f._renderService=u,f._dragScrollAmount=0,f._enabled=!0,f._workCell=new l.CellData,f._mouseDownTimeStamp=0,f._oldHasSelection=!1,f._oldSelectionStart=void 0,f._oldSelectionEnd=void 0,f._onLinuxMouseSelection=f.register(new h.EventEmitter),f._onRedrawRequest=f.register(new h.EventEmitter),f._onSelectionChange=f.register(new h.EventEmitter),f._onRequestScrollLines=f.register(new h.EventEmitter),f._mouseMoveListener=function(e){return f._onMouseMove(e)},f._mouseUpListener=function(e){return f._onMouseUp(e)},f._coreService.onUserInput((function(){f.hasSelection&&f.clearSelection()})),f._trimListener=f._bufferService.buffer.lines.onTrim((function(e){return f._onTrim(e)})),f.register(f._bufferService.buffers.onBufferActivate((function(e){return f._onBufferActivate(e)}))),f.enable(),f._model=new c.SelectionModel(f._bufferService),f._activeSelectionMode=0,f}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),(null==c?void 0: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(y," ")})).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]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]},t.prototype._selectWordAtCursor=function(e,t){var r,i,n=null===(i=null===(r=this._linkifier.currentLink)||void 0===r?void 0:r.link)||void 0===i?void 0:i.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;var o=this._getMouseBufferCoords(e);return!!o&&(this._selectWordAt(o,t),this._model.selectionEnd=void 0,!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=(0,_.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){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)},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]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>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]<r.lines.length){var i=r.lines.get(this._model.selectionEnd[1]);i&&0===i.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},t.prototype._dragScroll=function(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});var e=this._bufferService.buffer;this._dragScrollAmount>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=(0,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,!1)&&this.refresh(!0),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(;c<s.length&&" "===s.charAt(c+1);)c++}else{var d=e[0],p=e[0];0===o.getWidth(d)&&(h++,d--),2===o.getWidth(p)&&(u++,p++);var v=o.getString(p).length;for(v>1&&(_+=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(;p<o.length&&c+1<s.length&&!this._isCharWordSeparator(o.loadCell(p+1,this._workCell));){o.loadCell(p+1,this._workCell);var y=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,p++):y>1&&(_+=y-1,c+=y-1),c++,p++}}c++;var m=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===m&&32!==o.getCodePoint(0)){var C=n.lines.get(e[1]-1);if(C&&o.isWrapped&&32!==C.getCodePoint(this._bufferService.cols-1)){var b=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(b){var w=this._bufferService.cols-b.start;m-=w,S+=w}}}if(i&&m+S===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){var L=n.lines.get(e[1]+1);if((null==L?void 0:L.isWrapped)&&32!==L.getCodePoint(0)){var E=this._getWordAt([0,e[1]+1],!1,!1,!0);E&&(S+=E.length)}}return{start:m,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(3,f.IBufferService),s(4,f.ICoreService),s(5,u.IMouseService),s(6,f.IOptionsService),s(7,u.IRenderService)],t)}(p.Disposable);t.SelectionService=m},4725:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ICharacterJoinerService=t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var i=r(8343);t.ICharSizeService=(0,i.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,i.createDecorator)("CoreBrowserService"),t.IMouseService=(0,i.createDecorator)("MouseService"),t.IRenderService=(0,i.createDecorator)("RenderService"),t.ISelectionService=(0,i.createDecorator)("SelectionService"),t.ISoundService=(0,i.createDecorator)("SoundService"),t.ICharacterJoinerService=(0,i.createDecorator)("CharacterJoinerService")},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<r;n++)i[n]=t.charCodeAt(n);return i.buffer},e.prototype._removeMimeType=function(e){return e.split(",")[1]},e=i([n(0,o.IOptionsService)],e)}();t.SoundService=s},6349:(e,t,r)=>{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;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},set:function(e){if(e>this._length)for(var t=this._length;t<e;t++)this._array[t]=void 0;this._length=e},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this._array[this._getCyclicIndex(e)]},e.prototype.set=function(e,t){this._array[this._getCyclicIndex(e)]=t},e.prototype.push=function(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},e.prototype.recycle=function(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(e.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),e.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},e.prototype.splice=function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t){for(var n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._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<t;i++)this.set(e+i+r,this.get(e+i))}},e.prototype._getCyclicIndex=function(e){return(this._startIndex+e)%this._maxLength},e}();t.CircularList=n},1439:(e,t)=>{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);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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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),m=r(5981),S=!1,C=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((0,f.forwardEvent)(r._inputHandler.onLineFeed,r._onLineFeed)),r.register(r._inputHandler),r.register((0,f.forwardEvent)(r._bufferService.onResize,r._onResize)),r.register((0,f.forwardEvent)(r.coreService.onData,r._onData)),r.register((0,f.forwardEvent)(r.coreService.onBinary,r._onBinary)),r.register(r.optionsService.onOptionChange((function(e){return r._updateOptions(e)}))),r.register(r._bufferService.onScroll((function(e){r._onScroll.fire({position:r._bufferService.buffer.ydisp,source:0}),r._dirtyRowService.markRangeDirty(r._bufferService.buffer.scrollTop,r._bufferService.buffer.scrollBottom)}))),r.register(r._inputHandler.onScroll((function(e){r._onScroll.fire({position:r._bufferService.buffer.ydisp,source:0}),r._dirtyRowService.markRangeDirty(r._bufferService.buffer.scrollTop,r._bufferService.buffer.scrollBottom)}))),r._writeBuffer=new m.WriteBuffer((function(e,t){return r._inputHandler.parse(e,t)})),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(){var e=this;return this._onScrollApi||(this._onScrollApi=new f.EventEmitter,this.register(this._onScroll.event((function(t){var r;null===(r=e._onScrollApi)||void 0===r||r.fire(t.position)})))),this._onScrollApi.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}),Object.defineProperty(t.prototype,"options",{get:function(){return this.optionsService.options},set:function(e){for(var t in e)this.optionsService.options[t]=e[t]},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,t){this._logService.logLevel<=s.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(e,t)},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),this._bufferService.scroll(e,t)},t.prototype.scrollLines=function(e,t,r){this._bufferService.scrollLines(e,t,r)},t.prototype.scrollPages=function(e){this._bufferService.scrollPages(e)},t.prototype.scrollToTop=function(){this._bufferService.scrollToTop()},t.prototype.scrollToBottom=function(){this._bufferService.scrollToBottom()},t.prototype.scrollToLine=function(e){this._bufferService.scrollToLine(e)},t.prototype.registerEscHandler=function(e,t){return this._inputHandler.registerEscHandler(e,t)},t.prototype.registerDcsHandler=function(e,t){return this._inputHandler.registerDcsHandler(e,t)},t.prototype.registerCsiHandler=function(e,t){return this._inputHandler.registerCsiHandler(e,t)},t.prototype.registerOscHandler=function(e,t){return this._inputHandler.registerOscHandler(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.registerCsiHandler({final:"H"},(function(){return(0,g.updateWindowsModeWrappedState)(e._bufferService),!1}))),this._windowsMode={dispose:function(){for(var e=0,r=t;e<r.length;e++)r[e].dispose()}}}},t}(o.Disposable);t.CoreTerminal=C},8460:(e,t)=>{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;r<e._listeners.length;r++)if(e._listeners[r]===t)return void e._listeners.splice(r,1)}}}),this._event},enumerable:!1,configurable:!0}),e.prototype.fire=function(e,t){for(var r=[],i=0;i<this._listeners.length;i++)r.push(this._listeners[i]);for(i=0;i<r.length;i++)r[i].call(void 0,e,t)},e.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},e}();t.EventEmitter=r,t.forwardEvent=function(e,t){return e((function(e){return t.fire(e)}))}},5435: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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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.InputHandler=t.WindowsOptionsReportType=void 0;var o,s=r(2584),a=r(7116),c=r(2015),l=r(844),h=r(8273),u=r(482),f=r(8437),_=r(8460),d=r(643),p=r(511),v=r(3734),g=r(2585),y=r(6242),m=r(6351),S=r(5941),C={"(":0,")":1,"*":2,"+":3,"-":1,".":2},b=131072;function w(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}!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 L=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=(0,h.concat)(this._data,e.subarray(t,r))},e.prototype.unhook=function(e){if(!e)return this._data=new Uint32Array(0),!0;var t=(0,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}(),E=function(e){function t(t,r,i,n,o,l,h,d,v){void 0===v&&(v=new c.EscapeSequenceParser);var g=e.call(this)||this;g._bufferService=t,g._charsetService=r,g._coreService=i,g._dirtyRowService=n,g._logService=o,g._optionsService=l,g._coreMouseService=h,g._unicodeService=d,g._parser=v,g._parseBuffer=new Uint32Array(4096),g._stringDecoder=new u.StringToUtf32,g._utf8Decoder=new u.Utf8ToUtf32,g._workCell=new p.CellData,g._windowTitle="",g._iconName="",g._windowTitleStack=[],g._iconNameStack=[],g._curAttrData=f.DEFAULT_ATTR_DATA.clone(),g._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),g._onRequestBell=new _.EventEmitter,g._onRequestRefreshRows=new _.EventEmitter,g._onRequestReset=new _.EventEmitter,g._onRequestSendFocus=new _.EventEmitter,g._onRequestSyncScrollBar=new _.EventEmitter,g._onRequestWindowsOptionsReport=new _.EventEmitter,g._onA11yChar=new _.EventEmitter,g._onA11yTab=new _.EventEmitter,g._onCursorMove=new _.EventEmitter,g._onLineFeed=new _.EventEmitter,g._onScroll=new _.EventEmitter,g._onTitleChange=new _.EventEmitter,g._onColor=new _.EventEmitter,g._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},g._specialColors=[256,257,258],g.register(g._parser),g._activeBuffer=g._bufferService.buffer,g.register(g._bufferService.buffers.onBufferActivate((function(e){return g._activeBuffer=e.activeBuffer}))),g._parser.setCsiHandlerFallback((function(e,t){g._logService.debug("Unknown CSI code: ",{identifier:g._parser.identToString(e),params:t.toArray()})})),g._parser.setEscHandlerFallback((function(e){g._logService.debug("Unknown ESC code: ",{identifier:g._parser.identToString(e)})})),g._parser.setExecuteHandlerFallback((function(e){g._logService.debug("Unknown EXECUTE code: ",{code:e})})),g._parser.setOscHandlerFallback((function(e,t,r){g._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:r})})),g._parser.setDcsHandlerFallback((function(e,t,r){"HOOK"===t&&(r=r.toArray()),g._logService.debug("Unknown DCS code: ",{identifier:g._parser.identToString(e),action:t,payload:r})})),g._parser.setPrintHandler((function(e,t,r){return g.print(e,t,r)})),g._parser.registerCsiHandler({final:"@"},(function(e){return g.insertChars(e)})),g._parser.registerCsiHandler({intermediates:" ",final:"@"},(function(e){return g.scrollLeft(e)})),g._parser.registerCsiHandler({final:"A"},(function(e){return g.cursorUp(e)})),g._parser.registerCsiHandler({intermediates:" ",final:"A"},(function(e){return g.scrollRight(e)})),g._parser.registerCsiHandler({final:"B"},(function(e){return g.cursorDown(e)})),g._parser.registerCsiHandler({final:"C"},(function(e){return g.cursorForward(e)})),g._parser.registerCsiHandler({final:"D"},(function(e){return g.cursorBackward(e)})),g._parser.registerCsiHandler({final:"E"},(function(e){return g.cursorNextLine(e)})),g._parser.registerCsiHandler({final:"F"},(function(e){return g.cursorPrecedingLine(e)})),g._parser.registerCsiHandler({final:"G"},(function(e){return g.cursorCharAbsolute(e)})),g._parser.registerCsiHandler({final:"H"},(function(e){return g.cursorPosition(e)})),g._parser.registerCsiHandler({final:"I"},(function(e){return g.cursorForwardTab(e)})),g._parser.registerCsiHandler({final:"J"},(function(e){return g.eraseInDisplay(e)})),g._parser.registerCsiHandler({prefix:"?",final:"J"},(function(e){return g.eraseInDisplay(e)})),g._parser.registerCsiHandler({final:"K"},(function(e){return g.eraseInLine(e)})),g._parser.registerCsiHandler({prefix:"?",final:"K"},(function(e){return g.eraseInLine(e)})),g._parser.registerCsiHandler({final:"L"},(function(e){return g.insertLines(e)})),g._parser.registerCsiHandler({final:"M"},(function(e){return g.deleteLines(e)})),g._parser.registerCsiHandler({final:"P"},(function(e){return g.deleteChars(e)})),g._parser.registerCsiHandler({final:"S"},(function(e){return g.scrollUp(e)})),g._parser.registerCsiHandler({final:"T"},(function(e){return g.scrollDown(e)})),g._parser.registerCsiHandler({final:"X"},(function(e){return g.eraseChars(e)})),g._parser.registerCsiHandler({final:"Z"},(function(e){return g.cursorBackwardTab(e)})),g._parser.registerCsiHandler({final:"`"},(function(e){return g.charPosAbsolute(e)})),g._parser.registerCsiHandler({final:"a"},(function(e){return g.hPositionRelative(e)})),g._parser.registerCsiHandler({final:"b"},(function(e){return g.repeatPrecedingCharacter(e)})),g._parser.registerCsiHandler({final:"c"},(function(e){return g.sendDeviceAttributesPrimary(e)})),g._parser.registerCsiHandler({prefix:">",final:"c"},(function(e){return g.sendDeviceAttributesSecondary(e)})),g._parser.registerCsiHandler({final:"d"},(function(e){return g.linePosAbsolute(e)})),g._parser.registerCsiHandler({final:"e"},(function(e){return g.vPositionRelative(e)})),g._parser.registerCsiHandler({final:"f"},(function(e){return g.hVPosition(e)})),g._parser.registerCsiHandler({final:"g"},(function(e){return g.tabClear(e)})),g._parser.registerCsiHandler({final:"h"},(function(e){return g.setMode(e)})),g._parser.registerCsiHandler({prefix:"?",final:"h"},(function(e){return g.setModePrivate(e)})),g._parser.registerCsiHandler({final:"l"},(function(e){return g.resetMode(e)})),g._parser.registerCsiHandler({prefix:"?",final:"l"},(function(e){return g.resetModePrivate(e)})),g._parser.registerCsiHandler({final:"m"},(function(e){return g.charAttributes(e)})),g._parser.registerCsiHandler({final:"n"},(function(e){return g.deviceStatus(e)})),g._parser.registerCsiHandler({prefix:"?",final:"n"},(function(e){return g.deviceStatusPrivate(e)})),g._parser.registerCsiHandler({intermediates:"!",final:"p"},(function(e){return g.softReset(e)})),g._parser.registerCsiHandler({intermediates:" ",final:"q"},(function(e){return g.setCursorStyle(e)})),g._parser.registerCsiHandler({final:"r"},(function(e){return g.setScrollRegion(e)})),g._parser.registerCsiHandler({final:"s"},(function(e){return g.saveCursor(e)})),g._parser.registerCsiHandler({final:"t"},(function(e){return g.windowOptions(e)})),g._parser.registerCsiHandler({final:"u"},(function(e){return g.restoreCursor(e)})),g._parser.registerCsiHandler({intermediates:"'",final:"}"},(function(e){return g.insertColumns(e)})),g._parser.registerCsiHandler({intermediates:"'",final:"~"},(function(e){return g.deleteColumns(e)})),g._parser.setExecuteHandler(s.C0.BEL,(function(){return g.bell()})),g._parser.setExecuteHandler(s.C0.LF,(function(){return g.lineFeed()})),g._parser.setExecuteHandler(s.C0.VT,(function(){return g.lineFeed()})),g._parser.setExecuteHandler(s.C0.FF,(function(){return g.lineFeed()})),g._parser.setExecuteHandler(s.C0.CR,(function(){return g.carriageReturn()})),g._parser.setExecuteHandler(s.C0.BS,(function(){return g.backspace()})),g._parser.setExecuteHandler(s.C0.HT,(function(){return g.tab()})),g._parser.setExecuteHandler(s.C0.SO,(function(){return g.shiftOut()})),g._parser.setExecuteHandler(s.C0.SI,(function(){return g.shiftIn()})),g._parser.setExecuteHandler(s.C1.IND,(function(){return g.index()})),g._parser.setExecuteHandler(s.C1.NEL,(function(){return g.nextLine()})),g._parser.setExecuteHandler(s.C1.HTS,(function(){return g.tabSet()})),g._parser.registerOscHandler(0,new y.OscHandler((function(e){return g.setTitle(e),g.setIconName(e),!0}))),g._parser.registerOscHandler(1,new y.OscHandler((function(e){return g.setIconName(e)}))),g._parser.registerOscHandler(2,new y.OscHandler((function(e){return g.setTitle(e)}))),g._parser.registerOscHandler(4,new y.OscHandler((function(e){return g.setOrReportIndexedColor(e)}))),g._parser.registerOscHandler(10,new y.OscHandler((function(e){return g.setOrReportFgColor(e)}))),g._parser.registerOscHandler(11,new y.OscHandler((function(e){return g.setOrReportBgColor(e)}))),g._parser.registerOscHandler(12,new y.OscHandler((function(e){return g.setOrReportCursorColor(e)}))),g._parser.registerOscHandler(104,new y.OscHandler((function(e){return g.restoreIndexedColor(e)}))),g._parser.registerOscHandler(110,new y.OscHandler((function(e){return g.restoreFgColor(e)}))),g._parser.registerOscHandler(111,new y.OscHandler((function(e){return g.restoreBgColor(e)}))),g._parser.registerOscHandler(112,new y.OscHandler((function(e){return g.restoreCursorColor(e)}))),g._parser.registerEscHandler({final:"7"},(function(){return g.saveCursor()})),g._parser.registerEscHandler({final:"8"},(function(){return g.restoreCursor()})),g._parser.registerEscHandler({final:"D"},(function(){return g.index()})),g._parser.registerEscHandler({final:"E"},(function(){return g.nextLine()})),g._parser.registerEscHandler({final:"H"},(function(){return g.tabSet()})),g._parser.registerEscHandler({final:"M"},(function(){return g.reverseIndex()})),g._parser.registerEscHandler({final:"="},(function(){return g.keypadApplicationMode()})),g._parser.registerEscHandler({final:">"},(function(){return g.keypadNumericMode()})),g._parser.registerEscHandler({final:"c"},(function(){return g.fullReset()})),g._parser.registerEscHandler({final:"n"},(function(){return g.setgLevel(2)})),g._parser.registerEscHandler({final:"o"},(function(){return g.setgLevel(3)})),g._parser.registerEscHandler({final:"|"},(function(){return g.setgLevel(3)})),g._parser.registerEscHandler({final:"}"},(function(){return g.setgLevel(2)})),g._parser.registerEscHandler({final:"~"},(function(){return g.setgLevel(1)})),g._parser.registerEscHandler({intermediates:"%",final:"@"},(function(){return g.selectDefaultCharset()})),g._parser.registerEscHandler({intermediates:"%",final:"G"},(function(){return g.selectDefaultCharset()}));var m=function(e){S._parser.registerEscHandler({intermediates:"(",final:e},(function(){return g.selectCharset("("+e)})),S._parser.registerEscHandler({intermediates:")",final:e},(function(){return g.selectCharset(")"+e)})),S._parser.registerEscHandler({intermediates:"*",final:e},(function(){return g.selectCharset("*"+e)})),S._parser.registerEscHandler({intermediates:"+",final:e},(function(){return g.selectCharset("+"+e)})),S._parser.registerEscHandler({intermediates:"-",final:e},(function(){return g.selectCharset("-"+e)})),S._parser.registerEscHandler({intermediates:".",final:e},(function(){return g.selectCharset("."+e)})),S._parser.registerEscHandler({intermediates:"/",final:e},(function(){return g.selectCharset("/"+e)}))},S=this;for(var C in a.CHARSETS)m(C);return g._parser.registerEscHandler({intermediates:"#",final:"8"},(function(){return g.screenAlignmentPattern()})),g._parser.setErrorHandler((function(e){return g._logService.error("Parsing error: ",e),e})),g._parser.registerDcsHandler({intermediates:"$",final:"q"},new L(g._bufferService,g._coreService,g._logService,g._optionsService)),g}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,"onRequestSendFocus",{get:function(){return this._onRequestSendFocus.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,"onColor",{get:function(){return this._onColor.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype._preserveStack=function(e,t,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=i},t.prototype._logSlowResolvingAsync=function(e){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([e,new Promise((function(e,t){return setTimeout((function(){return t("#SLOW_TIMEOUT")}),5e3)}))]).catch((function(e){if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")}))},t.prototype.parse=function(e,t){var r,i=this._activeBuffer.x,n=this._activeBuffer.y,o=0,s=this._parseStack.paused;if(s){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>b&&(o=this._parseStack.position+b)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+("string"==typeof e?' "'+e+'"':""),"string"==typeof e?e.split("").map((function(e){return e.charCodeAt(0)})):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<b&&(this._parseBuffer=new Uint32Array(Math.min(e.length,b))),s||this._dirtyRowService.clearRange(),e.length>b)for(var a=o;a<e.length;a+=b){var c=a+b<e.length?a+b:e.length,l="string"==typeof e?this._stringDecoder.decode(e.substring(a,c),this._parseBuffer):this._utf8Decoder.decode(e.subarray(a,c),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,l))return this._preserveStack(i,n,l,a),this._logSlowResolvingAsync(r),r}else if(!s&&(l="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer),r=this._parser.parse(this._parseBuffer,l)))return this._preserveStack(i,n,l,0),this._logSlowResolvingAsync(r),r;this._activeBuffer.x===i&&this._activeBuffer.y===n||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},t.prototype.print=function(e,t,r){var i,n,o=this._charsetService.charset,s=this._optionsService.options.screenReaderMode,a=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,h=this._curAttrData,f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowService.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&2===f.getWidth(this._activeBuffer.x-1)&&f.setCellFromCodePoint(this._activeBuffer.x-1,0,1,h.fg,h.bg,h.extended);for(var _=t;_<r;++_){if(i=e[_],n=this._unicodeService.wcwidth(i),i<127&&o){var p=o[String.fromCharCode(i)];p&&(i=p.charCodeAt(0))}if(s&&this._onA11yChar.fire((0,u.stringFromCodePoint)(i)),n||!this._activeBuffer.x){if(this._activeBuffer.x+n-1>=a)if(c){for(;this._activeBuffer.x<a;)f.setCellFromCodePoint(this._activeBuffer.x++,0,1,h.fg,h.bg,h.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=a-1,2===n)continue;if(l&&(f.insertCells(this._activeBuffer.x,n,this._activeBuffer.getNullCell(h),h),2===f.getWidth(a-1)&&f.setCellFromCodePoint(a-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,h.fg,h.bg,h.extended)),f.setCellFromCodePoint(this._activeBuffer.x++,i,n,h.fg,h.bg,h.extended),n>0)for(;--n;)f.setCellFromCodePoint(this._activeBuffer.x++,0,0,h.fg,h.bg,h.extended)}else f.getWidth(this._activeBuffer.x-1)?f.addCodepointToCell(this._activeBuffer.x-1,i):f.addCodepointToCell(this._activeBuffer.x-2,i)}r-t>0&&(f.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.x<a&&r-t>0&&0===f.getWidth(this._activeBuffer.x)&&!f.hasContent(this._activeBuffer.x)&&f.setCellFromCodePoint(this._activeBuffer.x,0,1,h.fg,h.bg,h.extended),this._dirtyRowService.markDirty(this._activeBuffer.y)},t.prototype.registerCsiHandler=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!w(e.params[0],r._optionsService.options.windowOptions)||t(e)}))},t.prototype.registerDcsHandler=function(e,t){return this._parser.registerDcsHandler(e,new m.DcsHandler(t))},t.prototype.registerEscHandler=function(e,t){return this._parser.registerEscHandler(e,t)},t.prototype.registerOscHandler=function(e,t){return this._parser.registerOscHandler(e,new y.OscHandler(t))},t.prototype.bell=function(){return this._onRequestBell.fire(),!0},t.prototype.lineFeed=function(){return this._dirtyRowService.markDirty(this._activeBuffer.y),this._optionsService.options.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._dirtyRowService.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0},t.prototype.carriageReturn=function(){return this._activeBuffer.x=0,!0},t.prototype.backspace=function(){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;var t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0},t.prototype.tab=function(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;var e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.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._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._dirtyRowService.markDirty(this._activeBuffer.y)},t.prototype._setCursor=function(e,t){this._dirtyRowService.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._dirtyRowService.markDirty(this._activeBuffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)},t.prototype.cursorUp=function(e){var 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},t.prototype.cursorDown=function(e){var 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},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._activeBuffer.x=0,!0},t.prototype.cursorPrecedingLine=function(e){return this.cursorUp(e),this._activeBuffer.x=0,!0},t.prototype.cursorCharAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.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._activeBuffer.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._activeBuffer.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._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0},t.prototype.cursorForwardTab=function(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0},t.prototype.cursorBackwardTab=function(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0},t.prototype._eraseInBufferLine=function(e,t,r,i){void 0===i&&(i=!1);var n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i&&(n.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);t.fill(this._activeBuffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(t=this._activeBuffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x);t<this._bufferService.rows;t++)this._resetBufferLine(t);this._dirtyRowService.markDirty(t);break;case 1:for(t=this._activeBuffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t,0,this._activeBuffer.x+1,!0),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.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._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0))}return!0},t.prototype.eraseInLine=function(e){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);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0)}return this._dirtyRowService.markDirty(this._activeBuffer.y),!0},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;t--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0},t.prototype.deleteLines=function(e){this._restrictCursor();var t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;var r,i=this._activeBuffer.ybase+this._activeBuffer.y;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0},t.prototype.insertChars=function(e){this._restrictCursor();var t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},t.prototype.deleteChars=function(e){this._restrictCursor();var t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},t.prototype.scrollUp=function(e){for(var t=e.params[0]||1;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},t.prototype.scrollDown=function(e){for(var t=e.params[0]||1;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(f.DEFAULT_ATTR_DATA));return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},t.prototype.scrollLeft=function(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var t=e.params[0]||1,r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){var i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},t.prototype.scrollRight=function(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var t=e.params[0]||1,r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){var i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},t.prototype.insertColumns=function(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var t=e.params[0]||1,r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){var i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},t.prototype.deleteColumns=function(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var t=e.params[0]||1,r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){var i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},t.prototype.eraseChars=function(e){this._restrictCursor();var t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},t.prototype.repeatPrecedingCharacter=function(e){if(!this._parser.precedingCodepoint)return!0;for(var t=e.params[0]||1,r=new Uint32Array(t),i=0;i<t;++i)r[i]=this._parser.precedingCodepoint;return this.print(r,0,r.length),!0},t.prototype.sendDeviceAttributesPrimary=function(e){return e.params[0]>0||(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<e.length;t++)4===e.params[t]&&(this._coreService.modes.insertMode=!0);return!0},t.prototype.setModePrivate=function(e){for(var t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),this._charsetService.setgCharset(1,a.DEFAULT_CHARSET),this._charsetService.setgCharset(2,a.DEFAULT_CHARSET),this._charsetService.setgCharset(3,a.DEFAULT_CHARSET);break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0},t.prototype.resetMode=function(e){for(var t=0;t<e.length;t++)4===e.params[t]&&(this._coreService.modes.insertMode=!1);return!0},t.prototype.resetModePrivate=function(e){for(var t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[t]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0},t.prototype._updateAttrColor=function(e,t,r,i,n){return 2===t?(e|=50331648,e&=-16777216,e|=v.AttributeData.fromColorRGB([r,i,n])):5===t&&(e&=-50331904,e|=33554432|255&r),e},t.prototype._extractColor=function(e,t,r){var i=[0,0,-1,0,0,0],n=0,o=0;do{if(i[o+n]=e.params[t+o],e.hasSubParams(t+o)){var s=e.getSubParams(t+o),a=0;do{5===i[1]&&(n=1),i[o+a+1+n]=s[a]}while(++a<s.length&&a+o+1+n<i.length);break}if(5===i[1]&&o+n>=2||2===i[1]&&o+n>=5)break;i[1]&&(n=1)}while(++o+t<e.length&&o+n<i.length);for(a=2;a<i.length;++a)-1===i[a]&&(i[a]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return o},t.prototype._processUnderline=function(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(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<r;n++)(t=e.params[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:9===t?i.fg|=2147483648: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:29===t?i.fg&=2147483647: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._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(s.C0.ESC+"["+t+";"+r+"R")}return!0},t.prototype.deviceStatusPrivate=function(e){if(6===e.params[0]){var t=this._activeBuffer.y+1,r=this._activeBuffer.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._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.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},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._activeBuffer.scrollTop=r-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0},t.prototype.windowOptions=function(e){if(!w(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._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},t.prototype.restoreCursor=function(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},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.setOrReportIndexedColor=function(e){for(var t=[],r=e.split(";");r.length>1;){var i=r.shift(),n=r.shift();if(/^\d+$/.exec(i)){var o=parseInt(i);if(0<=o&&o<256)if("?"===n)t.push({type:0,index:o});else{var s=(0,S.parseColor)(n);s&&t.push({type:1,index:o,color:s})}}}return t.length&&this._onColor.fire(t),!0},t.prototype._setOrReportSpecialColor=function(e,t){for(var r=e.split(";"),i=0;i<r.length&&!(t>=this._specialColors.length);++i,++t)if("?"===r[i])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{var n=(0,S.parseColor)(r[i]);n&&this._onColor.fire([{type:1,index:this._specialColors[t],color:n}])}return!0},t.prototype.setOrReportFgColor=function(e){return this._setOrReportSpecialColor(e,0)},t.prototype.setOrReportBgColor=function(e){return this._setOrReportSpecialColor(e,1)},t.prototype.setOrReportCursorColor=function(e){return this._setOrReportSpecialColor(e,2)},t.prototype.restoreIndexedColor=function(e){if(!e)return this._onColor.fire([{type:2}]),!0;for(var t=[],r=e.split(";"),i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){var n=parseInt(r[i]);0<=n&&n<256&&t.push({type:2,index:n})}return t.length&&this._onColor.fire(t),!0},t.prototype.restoreFgColor=function(e){return this._onColor.fire([{type:2,index:256}]),!0},t.prototype.restoreBgColor=function(e){return this._onColor.fire([{type:2,index:257}]),!0},t.prototype.restoreCursorColor=function(e){return this._onColor.fire([{type:2,index:258}]),!0},t.prototype.nextLine=function(){return this._activeBuffer.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(C[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET),!0)},t.prototype.index=function(){return this._restrictCursor(),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._restrictCursor(),!0},t.prototype.tabSet=function(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0},t.prototype.reverseIndex=function(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){var 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._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.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,this._setCursor(0,0);for(var t=0;t<this._bufferService.rows;++t){var r=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowService.markAllDirty(),this._setCursor(0,0),!0},t}(l.Disposable);t.InputHandler=E},844:(e,t)=>{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<t.length;e++)t[e].dispose();this._disposables.length=0},e.prototype.register=function(e){return this._disposables.push(e),e},e.prototype.unregister=function(e){var t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)},e}();function i(e){for(var t=0,r=e;t<r.length;t++)r[t].dispose();e.length=0}t.Disposable=r,t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return{dispose:function(){return i(e)}}}},6114:(e,t)=>{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<i;++n)e[n]=t;return e}Object.defineProperty(t,"__esModule",{value:!0}),t.concat=t.fillFallback=t.fill=void 0,t.fill=function(e,t,i,n){return e.fill?e.fill(t,i,n):r(e,t,i,n)},t.fillFallback=r,t.concat=function(e,t){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}},9282:(e,t,r)=>{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.isStrikethrough=function(){return 2147483648&this.fg},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&&e<this._rows},enumerable:!1,configurable:!0}),e.prototype._getCorrectBufferLength=function(e){if(!this._hasScrollback)return e;var r=e+this._optionsService.options.scrollback;return r>t.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._cols<e)for(var o=0;o<this.lines.length;o++)this.lines.get(o).resize(e,r);var s=0;if(this._rows<t)for(var a=this._rows;a<t;a++)this.lines.length<t+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new n.BufferLine(e,r)):this.ybase>0&&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(i<this.lines.maxLength){var c=this.lines.length-i;c>0&&(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;o<this.lines.length;o++)this.lines.get(o).resize(e,r);this._cols=e,this._rows=t},Object.defineProperty(e.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),e.prototype._reflow=function(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var r=(0,a.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(r.length>0){var i=(0,a.reflowLargerCreateNewLayout)(this.lines,r);(0,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<t&&this.lines.push(new n.BufferLine(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)},e.prototype._reflowSmaller=function(e,t){for(var r=this.getNullCell(n.DEFAULT_ATTR_DATA),i=[],o=0,s=this.lines.length-1;s>=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&&h<s+l.length)){var u,f=l[l.length-1].getTrimmedLength(),_=(0,a.reflowSmallerGetNewLineLengths)(l,this._cols,e),d=_.length-l.length;u=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);for(var p=[],v=0;v<d;v++){var g=this.getBlankLine(n.DEFAULT_ATTR_DATA,!0);p.push(g)}p.length>0&&(i.push({start:s+l.length+o,newLines:p}),o+=p.length),l.push.apply(l,p);var y=_.length-1,m=_[y];0===m&&(m=_[--y]);for(var S=l.length-d-1,C=f;S>=0;){var b=Math.min(C,m);if(l[y].copyCellsFrom(l[S],C-b,m-b,b,!0),0==(m-=b)&&(m=_[--y]),0==(C-=b)){S--;var w=Math.max(S,0);C=(0,a.getWrappedLineTrimmedLength)(l,w,this._cols)}}for(v=0;v<l.length;v++)_[v]<e&&l[v].setCell(_[v],r);for(var L=d-u;L-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}}}if(i.length>0){var E=[],x=[];for(v=0;v<this.lines.length;v++)x.push(this.lines.get(v));var M=this.lines.length,k=M-1,A=0,R=i[A];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);var T=0;for(v=Math.min(this.lines.maxLength-1,M+o-1);v>=0;v--)if(R&&R.start>k+T){for(var B=R.newLines.length-1;B>=0;B--)this.lines.set(v--,R.newLines[B]);v++,E.push({index:k+1,amount:R.newLines.length}),T+=R.newLines.length,R=i[++A]}else this.lines.set(v,x[k--]);var O=0;for(v=E.length-1;v>=0;v--)E[v].index+=O,this.lines.onInsertEmitter.fire(E[v]),O+=E[v].amount;var D=Math.max(0,M+o-this.lines.maxLength);D>0&&this.lines.onTrimEmitter.fire(D)}},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;o<n;++o)if(i.get(o)[s.CHAR_DATA_WIDTH_INDEX]&&(t-=i.get(o)[s.CHAR_DATA_CHAR_INDEX].length||1),t<0)return[e,o];e++}return[e,0]},e.prototype.translateBufferLineToString=function(e,t,r,i){void 0===r&&(r=0);var n=this.lines.get(e);return n?n.translateToString(t,r,i):""},e.prototype.getWrappedRangeForLine=function(e){for(var t=e,r=e;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}},e.prototype.setupTabStops=function(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.options.tabStopWidth)this.tabs[e]=!0},e.prototype.prevStop=function(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);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;);return 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.line<e.index+e.amount&&r.dispose(),r.line>e.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._current<this._endIndex},e.prototype.next=function(){var e=this._buffer.getWrappedRangeForLine(this._current);e.first<this._startIndex-this._startOverscan&&(e.first=this._startIndex-this._startOverscan),e.last>this._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<e;++s)this.setCell(s,i);this.length=e}return e.prototype.get=function(e){var t=this._data[3*e+0],r=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:r?(0,i.stringFromCodePoint)(r):"",t>>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?(0,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]+=(0,i.stringFromCodePoint)(t):(2097151&r?(this._combined[e]=(0,i.stringFromCodePoint)(2097151&r)+(0,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<this.length-e){for(var n=new o.CellData,a=this.length-e-t-1;a>=0;--a)this.setCell(e+t+a,this.loadCell(e+a,n));for(a=0;a<t;++a)this.setCell(e+a,r)}else for(a=e;a<this.length;++a)this.setCell(a,r);2===this.getWidth(this.length-1)&&this.setCellFromCodePoint(this.length-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)},e.prototype.deleteCells=function(e,t,r,i){if(e%=this.length,t<this.length-e){for(var n=new o.CellData,a=0;a<this.length-e-t;++a)this.setCell(e+a,this.loadCell(e+t+a,n));for(a=this.length-t;a<this.length;++a)this.setCell(a,r)}else for(a=e;a<this.length;++a)this.setCell(a,r);e&&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),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodePoint(e,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)},e.prototype.replaceCells=function(e,t,r,i){for(e&&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<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodePoint(t,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);e<t&&e<this.length;)this.setCell(e++,r)},e.prototype.resize=function(e,t){if(e!==this.length){if(e>this.length){var r=new Uint32Array(3*e);this.length&&(3*e<this._data.length?r.set(this._data.subarray(0,3*e)):r.set(this._data)),this._data=r;for(var i=this.length;i<e;++i)this.setCell(i,t)}else if(e){(r=new Uint32Array(3*e)).set(this._data.subarray(0,3*e)),this._data=r;var n=Object.keys(this._combined);for(i=0;i<n.length;i++){var o=parseInt(n[i],10);o>=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<this.length;++t)this.setCell(t,e)},e.prototype.copyFrom=function(e){for(var t in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[t]=e._combined[t];for(var t in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped},e.prototype.clone=function(){var t=new e(0);for(var r in t._data=new Uint32Array(this._data),t.length=this.length,this._combined)t._combined[r]=this._combined[r];for(var r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t},e.prototype.getTrimmedLength=function(){for(var e=this.length-1;e>=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<i;s++)for(a=0;a<3;a++)this._data[3*(r+s)+a]=o[3*(t+s)+a];var c=Object.keys(e._combined);for(a=0;a<c.length;a++){var l=parseInt(c[a],10);l>=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<r;){var s=this._data[3*t+0],a=2097151&s;o+=2097152&s?this._combined[t]:a?(0,i.stringFromCodePoint)(a):n.WHITESPACE_CELL_CHAR,t+=s>>22||1}return o},e}();t.BufferLine=a},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 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<e.length-1;a++){var c=a,l=e.get(++c);if(l.isWrapped){for(var h=[e.get(a)];c<e.length&&l.isWrapped;)h.push(l),l=e.get(++c);if(n>=a&&n<c)a+=h.length-1;else{for(var u=0,f=r(h,u,t),_=1,d=0;_<h.length;){var p=r(h,_,t),v=p-d,g=i-f,y=Math.min(v,g);h[u].copyCellsFrom(h[_],d,f,y,!1),(f+=y)===i&&(u++,f=0),(d+=y)===p&&(_++,d=0),0===f&&0!==u&&2===h[u-1].getWidth(i-1)&&(h[u].copyCellsFrom(h[u-1],i-1,f++,1,!1),h[u-1].setCell(i-1,o))}h[u].replaceCells(f,i,o);for(var m=0,S=h.length-1;S>0&&(S>u||0===h[S].getTrimmedLength());S--)m++;m>0&&(s.push(a+h.length-m),s.push(m)),a+=h.length-1}}}return s},t.reflowLargerCreateNewLayout=function(e,t){for(var r=[],i=0,n=t[i],o=0,s=0;s<e.length;s++)if(n===s){var a=t[++i];e.onDeleteEmitter.fire({index:s-o,amount:a}),s+=a-1,o+=a,n=t[++i]}else r.push(s);return{layout:r,countRemoved:o}},t.reflowLargerApplyNewLayout=function(e,t){for(var r=[],i=0;i<t.length;i++)r.push(e.get(t[i]));for(i=0;i<r.length;i++)e.set(i,r[i]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,i){for(var n=[],o=e.map((function(i,n){return r(e,n,t)})).reduce((function(e,t){return e+t})),s=0,a=0,c=0;c<o;){if(o-c<i){n.push(o-c);break}s+=i;var l=r(e,a,t);s>l&&(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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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?(0,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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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="\ 1",i.STX="\ 2",i.ETX="\ 3",i.EOT="\ 4",i.ENQ="\ 5",i.ACK="\ 6",i.BEL="\a",i.BS="\b",i.HT="\t",i.LF="\n",i.VT="\v",i.FF="\f",i.CR="\r",i.SO="\ e",i.SI="\ f",i.DLE="\10",i.DC1="\11",i.DC2="\12",i.DC3="\13",i.DC4="\14",i.NAK="\15",i.SYN="\16",i.ETB="\17",i.CAN="\18",i.EM="\19",i.SUB="\1a",i.ESC="\e",i.FS="\1c",i.GS="\1d",i.RS="\1e",i.US="\1f",i.SP=" ",i.DEL="\7f",(r=t.C1||(t.C1={})).PAD="\80",r.HOP="\81",r.BPH="\82",r.NBH="\83",r.IND="\84",r.NEL="\85",r.SSA="\86",r.ESA="\87",r.HTS="\88",r.HTJ="\89",r.VTS="\8a",r.PLD="\8b",r.PLU="\8c",r.RI="\8d",r.SS2="\8e",r.SS3="\8f",r.DCS="\90",r.PU1="\91",r.PU2="\92",r.STS="\93",r.CCH="\94",r.MW="\95",r.SPA="\96",r.EPA="\97",r.SOS="\98",r.SGCI="\99",r.SCI="\9a",r.CSI="\9b",r.ST="\9c",r.OSC="\9d",r.PM="\9e",r.APC="\9f"},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=null==c?void 0: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;n<r;++n){var o=e[n];o>65535?(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;++o){var s=e.charCodeAt(o);if(55296<=s&&s<=56319){if(++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<p;){if(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;){for(;!(!(g<v)||128&(i=e[g])||128&(n=e[g+1])||128&(o=e[g+2])||128&(s=e[g+3]));)t[a++]=i,t[a++]=n,t[a++]=o,t[a++]=s,g+=4;if((i=e[g++])<128)t[a++]=i;else if(192==(224&i)){if(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),(0,n.fill)(i,1),i[0]=0,(0,n.fill)(i,0,1,32),(0,n.fill)(i,0,127,160),(0,n.fill)(i,2,4352,4448),i[9001]=2,i[9002]=2,(0,n.fill)(i,2,11904,42192),i[12351]=1,(0,n.fill)(i,2,44032,55204),(0,n.fill)(i,2,63744,64256),(0,n.fill)(i,2,65040,65050),(0,n.fill)(i,2,65072,65136),(0,n.fill)(i,2,65280,65377),(0,n.fill)(i,2,65504,65511);for(var e=0;e<o.length;++e)(0,n.fill)(i,0,o[e][0],o[e][1]+1)}}return e.prototype.wcwidth=function(e){return e<32?0:e<127?1:e<65536?i[e]:function(e,t){var r,i=0,n=t.length-1;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=i;)if(e>t[r=i+n>>1][1])i=r+1;else{if(!(e<t[r][0]))return!0;n=r-1}return!1}(e,s)?0: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="undefined"==typeof queueMicrotask?function(e){Promise.resolve().then(e)}:queueMicrotask,i=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0}return e.prototype.writeSync=function(e,t){if(void 0!==t&&this._syncCalls>t)this._syncCalls=0;else if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){var r;for(this._isSyncWriting=!0;r=this._writeBuffer.shift();){this._action(r);var i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}},e.prototype.write=function(e,t){var r=this;if(this._pendingData>5e7)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(e,t){var i=this;void 0===e&&(e=0),void 0===t&&(t=!0);for(var n=e||Date.now();this._writeBuffer.length>this._bufferOffset;){var o=this._writeBuffer[this._bufferOffset],s=this._action(o,t);if(s)return void s.catch((function(e){return r((function(){throw e})),Promise.resolve(!1)})).then((function(e){return Date.now()-n>=12?setTimeout((function(){return i._innerWrite(0,e)})):i._innerWrite(n,e)}));var a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=o.length,Date.now()-n>=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 i._innerWrite()}))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=i},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;var r=/^([\da-f]{1})\/([\da-f]{1})\/([\da-f]{1})$|^([\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})$/,i=/^[\da-f]+$/;function n(e,t){var r=e.toString(16),i=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}t.parseColor=function(e){if(e){var t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);var n=r.exec(t);if(n){var o=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/o*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/o*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/o*255)]}}else if(0===t.indexOf("#")&&(t=t.slice(1),i.exec(t)&&[3,6,9,12].includes(t.length))){for(var s=t.length/3,a=[0,0,0],c=0;c<3;++c){var l=parseInt(t.slice(s*c,s*c+s),16);a[c]=1===s?l<<4:2===s?l:3===s?l>>4:l>>8}return a}}},t.toRgbString=function(e,t){void 0===t&&(t=16);var r=e[0],i=e[1],o=e[2];return"rgb:"+n(r,t)+"/"+n(i,t)+"/"+n(o,t)}},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(){},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}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(){if(this._active.length)for(var 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=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",(0,i.utf32ToString)(e,t,r))},e.prototype.unhook=function(e,t){if(void 0===t&&(t=!0),this._active.length){var r=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===r){for(;i>=0&&!0!==(r=this._active[i].unhook(e));i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if((r=this._active[i].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}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+=(0,i.utf32ToString)(e,t,r),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t=this,r=!1;if(this._hitLimit)r=!1;else if(e&&(r=this._handler(this._data,this._params))instanceof Promise)return r.then((function(e){return t._params=c,t._data="",t._hitLimit=!1,e}));return this._params=c,this._data="",this._hitLimit=!1,r},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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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){(0,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;n<e.length;n++)this.table[t<<8|e[n]]=r<<4|i},e}();t.TransitionTable=h;var u=160;t.VT500_TRANSITION_TABLE=function(){var e=new h(4095),t=Array.apply(null,Array(256)).map((function(e,t){return t})),r=function(e,r){return t.slice(e,r)},i=r(32,127),n=r(0,24);n.push(25),n.push.apply(n,r(28,32));var o,s=r(0,14);for(o in e.setDefault(1,0),e.addMany(i,0,2,0),s)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(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(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(u,0,2,0),e.add(u,8,5,8),e.add(u,6,0,6),e.add(u,11,0,11),e.add(u,13,13,13),e}();var f=function(e){function r(r){void 0===r&&(r=t.VT500_TRANSITION_TABLE);var i=e.call(this)||this;return i._transitions=r,i._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},i.initialState=0,i.currentState=i.initialState,i._params=new a.Params,i._params.addParam(0),i._collect=0,i.precedingCodepoint=0,i._printHandlerFb=function(e,t,r){},i._executeHandlerFb=function(e){},i._csiHandlerFb=function(e,t){},i._escHandlerFb=function(e){},i._errorHandlerFb=function(e){return e},i._printHandler=i._printHandlerFb,i._executeHandlers=Object.create(null),i._csiHandlers=Object.create(null),i._escHandlers=Object.create(null),i._oscParser=new c.OscParser,i._dcsParser=new l.DcsParser,i._errorHandler=i._errorHandlerFb,i.registerEscHandler({final:"\\"},(function(){return!0})),i}return n(r,e),r.prototype._identifier=function(e,t){void 0===t&&(t=[64,126]);var r=0;if(e.prefix){if(e.prefix.length>1)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;i<e.intermediates.length;++i){var n=e.intermediates.charCodeAt(i);if(32>n||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,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])},r.prototype._preserveStack=function(e,t,r,i,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=n},r.prototype.parse=function(e,t,r){var i,n=0,o=0,s=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(void 0===r||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");var a=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===r&&c>-1)for(;c>=0&&!0!==(i=a[c](this._params));c--)if(i instanceof Promise)return this._parseStack.handlerPos=c,i;this._parseStack.handlers=[];break;case 4:if(!1===r&&c>-1)for(;c>=0&&!0!==(i=a[c]());c--)if(i instanceof Promise)return this._parseStack.handlerPos=c,i;this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],i=this._dcsParser.unhook(24!==n&&26!==n,r))return i;27===n&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],i=this._oscParser.end(24!==n&&26!==n,r))return i;27===n&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(var l=s;l<t;++l){switch(n=e[l],(o=this._transitions.table[this.currentState<<8|(n<160?n:u)])>>4){case 2:for(var h=l+1;;++h){if(h>=t||(n=e[h])<32||n>126&&n<u){this._printHandler(e,l,h),l=h-1;break}if(++h>=t||(n=e[h])<32||n>126&&n<u){this._printHandler(e,l,h),l=h-1;break}if(++h>=t||(n=e[h])<32||n>126&&n<u){this._printHandler(e,l,h),l=h-1;break}if(++h>=t||(n=e[h])<32||n>126&&n<u){this._printHandler(e,l,h),l=h-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:for(var f=(a=this._csiHandlers[this._collect<<8|n])?a.length-1:-1;f>=0&&!0!==(i=a[f](this._params));f--)if(i instanceof Promise)return this._preserveStack(3,a,f,o,l),i;f<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingCodepoint=0;break;case 8:do{switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}}while(++l<t&&(n=e[l])>47&&n<60);l--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:for(var _=this._escHandlers[this._collect<<8|n],d=_?_.length-1:-1;d>=0&&!0!==(i=_[d]());d--)if(i instanceof Promise)return this._preserveStack(4,_,d,o,l),i;d<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(var p=l+1;;++p)if(p>=t||24===(n=e[p])||26===n||27===n||n>127&&n<u){this._dcsParser.put(e,l,p),l=p-1;break}break;case 14:if(i=this._dcsParser.unhook(24!==n&&26!==n))return this._preserveStack(6,[],0,o,l),i;27===n&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(var v=l+1;;v++)if(v>=t||(n=e[v])<32||n>127&&n<u){this._oscParser.put(e,l,v),l=v-1;break}break;case 6:if(i=this._oscParser.end(24!==n&&26!==n))return this._preserveStack(5,[],0,o,l),i;27===n&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&o}},r}(o.Disposable);t.EscapeSequenceParser=f},6242:(e,t,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(){},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}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(){if(2===this._state)for(var 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=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",(0,n.utf32ToString)(e,t,r))},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(;t<r;){var i=e[t++];if(59===i){this._state=2,this._start();break}if(i<48||57<i)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+i-48}2===this._state&&r-t>0&&this._put(e,t,r)}},e.prototype.end=function(e,t){if(void 0===t&&(t=!0),0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){var r=!1,i=this._active.length-1,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===r){for(;i>=0&&!0!==(r=this._active[i].end(e));i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if((r=this._active[i].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}else this._handlerFb(this._id,"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+=(0,n.utf32ToString)(e,t,r),this._data.length>i.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t=this,r=!1;if(this._hitLimit)r=!1;else if(e&&(r=this._handler(this._data))instanceof Promise)return r.then((function(e){return t._data="",t._hitLimit=!1,e}));return this._data="",this._hitLimit=!1,r},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=Array.isArray(t[0])?1:0;i<t.length;++i){var n=t[i];if(Array.isArray(n))for(var o=0;o<n.length;++o)r.addSubParam(n[o]);else r.addParam(n)}return r},e.prototype.clone=function(){var t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t},e.prototype.toArray=function(){for(var e=[],t=0;t<this.length;++t){e.push(this.params[t]);var r=this._subParamsIdx[t]>>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<this.length;++t){var r=this._subParamsIdx[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},5741:(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<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(-1===t)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},e}();t.AddonManager=r},8771:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;var i=r(3785),n=r(511),o=function(){function e(e,t){this._buffer=e,this.type=t}return e.prototype.init=function(e){return this._buffer=e,this},Object.defineProperty(e.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!1,configurable:!0}),e.prototype.getLine=function(e){var t=this._buffer.lines.get(e);if(t)return new i.BufferLineApiView(t)},e.prototype.getNullCell=function(){return new n.CellData},e}();t.BufferApiView=o},3785:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;var i=r(511),n=function(){function e(e){this._line=e}return Object.defineProperty(e.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._line.length},enumerable:!1,configurable:!0}),e.prototype.getCell=function(e,t){if(!(e<0||e>=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}();t.BufferLineApiView=n},8285:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;var i=r(8771),n=r(8460),o=function(){function e(e){var t=this;this._core=e,this._onBufferChange=new n.EventEmitter,this._normal=new i.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new i.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((function(){return t._onBufferChange.fire(t.active)}))}return Object.defineProperty(e.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"active",{get:function(){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")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"normal",{get:function(){return this._normal.init(this._core.buffers.normal)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alternate",{get:function(){return this._alternate.init(this._core.buffers.alt)},enumerable:!1,configurable:!0}),e}();t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0;var r=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.registerCsiHandler(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.registerDcsHandler(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.registerEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.registerOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}();t.ParserApi=r},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0;var r=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}();t.UnicodeApi=r},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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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._onScroll=new l.EventEmitter,i.cols=Math.max(r.options.cols||0,t.MINIMUM_COLS),i.rows=Math.max(r.options.rows||0,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,"onScroll",{get:function(){return this._onScroll.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},r.prototype.scroll=function(e,t){void 0===t&&(t=!1);var r,i=this.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.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{var a=o-n+1;i.lines.shiftElements(n+1,a-1,-1),i.lines.set(o,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)},r.prototype.scrollLines=function(e,t,r){var i=this.buffer;if(e<0){if(0===i.ydisp)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);var n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),n!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))},r.prototype.scrollPages=function(e){this.scrollLines(e*(this.rows-1))},r.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)},r.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)},r.prototype.scrollToLine=function(e){var t=e-this.buffer.ydisp;0!==t&&this.scrollLines(t)},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?"":"\e[M"+l(t[0])+l(t[1])+l(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"\e[<"+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<i.length;r++){var n=i[r];this.addProtocol(n,a[n])}for(var o=0,c=Object.keys(h);o<c.length;o++){var l=c[o];this.addEncoding(l,h[l])}this.reset()}return e.prototype.addProtocol=function(e,t){this._protocols[e]=t},e.prototype.addEncoding=function(e,t){this._encodings[e]=t},Object.defineProperty(e.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(e){if(!this._protocols[e])throw new Error('unknown protocol "'+e+'"');this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"areMouseEventsActive",{get:function(){return 0!==this._protocols[this._activeProtocol].events},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(e){if(!this._encodings[e])throw new Error('unknown encoding "'+e+'"');this._activeEncoding=e},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null},Object.defineProperty(e.prototype,"onProtocolChange",{get:function(){return this._onProtocolChange.event},enumerable:!1,configurable:!0}),e.prototype.triggerMouseEvent=function(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._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])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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=(0,l.clone)(u),o.decPrivateModes=(0,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=(0,l.clone)(u),this.decPrivateModes=(0,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){e<this._start?this._start=e:e>this._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var r=e;e=t,t=r}e<this._start&&(this._start=e),t>this._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.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;var n=r(2585),o=r(8343),s=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._entries=new Map;for(var r=0,i=e;r<i.length;r++){var n=i[r],o=n[0],s=n[1];this.set(o,s)}}return e.prototype.set=function(e,t){var r=this._entries.get(e);return this._entries.set(e,t),r},e.prototype.forEach=function(e){this._entries.forEach((function(t,r){return e(r,t)}))},e.prototype.has=function(e){return this._entries.has(e)},e.prototype.get=function(e){return this._entries.get(e)},e}();t.ServiceCollection=s;var a=function(){function e(){this._services=new s,this._services.set(n.IInstantiationService,this)}return e.prototype.setService=function(e,t){this._services.set(e,t)},e.prototype.getService=function(e){return this._services.get(e)},e.prototype.createInstance=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=(0,o.getServiceDependencies)(e).sort((function(e,t){return e.index-t.index})),s=[],a=0,c=n;a<c.length;a++){var l=c[a],h=this._services.get(l.id);if(!h)throw new Error("[createInstance] "+e.name+" depends on UNKNOWN service "+l.id+".");s.push(h)}var u=n.length>0?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(i([],t,!0),s,!0),!1)))},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.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.LogService=void 0;var s=r(2585),a={debug:s.LogLevelEnum.DEBUG,info:s.LogLevelEnum.INFO,warn:s.LogLevelEnum.WARN,error:s.LogLevelEnum.ERROR,off:s.LogLevelEnum.OFF},c=function(){function e(e){var t=this;this._optionsService=e,this.logLevel=s.LogLevelEnum.OFF,this._updateLogLevel(),this._optionsService.onOptionChange((function(e){"logLevel"===e&&t._updateLogLevel()}))}return e.prototype._updateLogLevel=function(){this.logLevel=a[this._optionsService.options.logLevel]},e.prototype._evalLazyOptionalParams=function(e){for(var t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())},e.prototype._log=function(e,t,r){this._evalLazyOptionalParams(r),e.call.apply(e,o([console,"xterm.js: "+t],r,!1))},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.logLevel<=s.LogLevelEnum.DEBUG&&this._log(console.log,e,t)},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.logLevel<=s.LogLevelEnum.INFO&&this._log(console.info,e,t)},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.logLevel<=s.LogLevelEnum.WARN&&this._log(console.warn,e,t)},e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.logLevel<=s.LogLevelEnum.ERROR&&this._log(console.error,e,t)},i([n(0,s.IOptionsService)],e)}();t.LogService=c},7302:function(e,t,r){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=t.DEFAULT_BELL_SOUND=void 0;var n=r(8460),o=r(6114);t.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,customGlyphs:!0,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:o.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=function(){function e(e){for(var r in this._onOptionChange=new n.EventEmitter,this._options=i({},t.DEFAULT_OPTIONS),e)if(r in this._options)try{var o=e[r];this._options[r]=this._sanitizeAndValidateOption(r,o)}catch(e){console.error(e)}this.options=this._setupOptions(this._options)}return Object.defineProperty(e.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!1,configurable:!0}),e.prototype._setupOptions=function(e){var r=this,n=i({},e),o=function(e){Object.defineProperty(n,e,{get:function(){if(!(e in t.DEFAULT_OPTIONS))throw new Error('No option with key "'+e+'"');return r._options[e]},set:function(i){if(!(e in t.DEFAULT_OPTIONS))throw new Error('No option with key "'+e+'"');i=r._sanitizeAndValidateOption(e,i),r._options[e]!==i&&(r._options[e]=i,r._onOptionChange.fire(e))}})};for(var s in n)o(s);return n},e.prototype.setOption=function(e,t){this.options[e]=t},e.prototype._sanitizeAndValidateOption=function(e,r){switch(e){case"bellStyle":case"cursorStyle":case"rendererType":case"wordSeparator":r||(r=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof r&&1<=r&&r<=1e3)break;r=s.includes(r)?r:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":r=Math.floor(r);case"lineHeight":case"tabStopWidth":if(r<1)throw new Error(e+" cannot be less than 1, value: "+r);break;case"minimumContrastRatio":r=Math.max(1,Math.min(21,Math.round(10*r)/10));break;case"scrollback":if((r=Math.min(r,4294967295))<0)throw new Error(e+" cannot be less than 0, value: "+r);break;case"fastScrollSensitivity":case"scrollSensitivity":if(r<=0)throw new Error(e+" cannot be less than or equal to 0, value: "+r);case"rows":case"cols":if(!r&&0!==r)throw new Error(e+" must be numeric, value: "+r)}return r},e.prototype.getOption=function(e){return this.options[e]},e}();t.OptionsService=a},8343:(e,t)=>{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.LogLevelEnum=t.IInstantiationService=t.IDirtyRowService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;var i,n=r(8343);t.IBufferService=(0,n.createDecorator)("BufferService"),t.ICoreMouseService=(0,n.createDecorator)("CoreMouseService"),t.ICoreService=(0,n.createDecorator)("CoreService"),t.ICharsetService=(0,n.createDecorator)("CharsetService"),t.IDirtyRowService=(0,n.createDecorator)("DirtyRowService"),t.IInstantiationService=(0,n.createDecorator)("InstantiationService"),(i=t.LogLevelEnum||(t.LogLevelEnum={}))[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.OFF=4]="OFF",t.ILogService=(0,n.createDecorator)("LogService"),t.IOptionsService=(0,n.createDecorator)("OptionsService"),t.IUnicodeService=(0,n.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;++i){var n=e.charCodeAt(i);if(55296<=n&&n<=56319){if(++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={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,r),o.exports}var i={};return(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;var t=r(3236),n=r(9042),o=r(7975),s=r(7090),a=r(5741),c=r(8285),l=["cols","rows"],h=function(){function e(e){var r=this;this._core=new t.Terminal(e),this._addonManager=new a.AddonManager,this._publicOptions={};var i=function(e){Object.defineProperty(n._publicOptions,e,{get:function(){return r._core.options[e]},set:function(t){r._checkReadonlyOptions(e),r._core.options[e]=t}})},n=this;for(var o in this._core.options)i(o)}return e.prototype._checkReadonlyOptions=function(e){if(l.includes(e))throw new Error('Option "'+e+'" can only be set in the constructor')},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,"onBell",{get:function(){return this._core.onBell},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},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,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},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 o.ParserApi(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unicode",{get:function(){return this._checkProposedApi(),new s.UnicodeApi(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 c.BufferNamespaceApi(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}),Object.defineProperty(e.prototype,"modes",{get:function(){var e=this._core.coreService.decPrivateModes,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}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._publicOptions},set:function(e){for(var t in e)this._publicOptions[t]=e[t]},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._checkReadonlyOptions(e),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.clearTextureAtlas=function(){this._core.clearTextureAtlas()},e.prototype.loadAddon=function(e){return this._addonManager.loadAddon(this,e)},Object.defineProperty(e,"strings",{get:function(){return n},enumerable:!1,configurable:!0}),e.prototype._verifyIntegers=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=0,i=e;r<i.length;r++){var n=i[r];if(n===1/0||isNaN(n)||n%1!=0)throw new Error("This API only accepts integers")}},e}();e.Terminal=h})(),i})()}));
+!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,(()=>(()=>{"use strict";var e={4567: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.AccessibilityManager=void 0;const n=i(9042),o=i(6114),a=i(9924),h=i(844),c=i(5596),l=i(4725),d=i(3656);let _=t.AccessibilityManager=class extends h.Disposable{constructor(e,t){super(),this._terminal=e,this._renderService=t,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._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._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new a.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),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 c.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,d.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,h.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=n.tooMuchOutput)),o.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,o.isMac&&this._liveRegion.remove()}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.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()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_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;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)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}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.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<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=_=s([r(1,l.IRenderService)],_)},3614:(e,t)=>{function i(e){return e.replace(/\r?\n/g,"\r")}function s(e,t){return t?"\e[200~"+e+"\e[201~":e}function r(e,t,r,n){e=s(e=i(e),r.decPrivateModes.bracketedPasteMode&&!0!==n.rawOptions.ignoreBracketedPasteMode),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,s){e.stopPropagation(),e.clipboardData&&r(e.clipboardData.getData("text/plain"),t,i,s)},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()}}},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(3656),o=i(8460),a=i(844),h=i(2585);let c=t.Linkifier2=class extends a.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,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}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}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,n.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.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<i.length;e++){const t=i[e];if(t.classList.contains("xterm"))break;if(t.classList.contains("xterm-hover"))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,s;this._activeProviderReplies&&t||(null===(i=this._activeProviderReplies)||void 0===i||i.forEach((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;s<t.size;s++){const r=t.get(s);if(r)for(let t=0;t<r.length;t++){const s=r[t],n=s.link.range.start.y<e?0:s.link.range.start.x,o=s.link.range.end.y>e?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;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(n=!0);if(!n&&r){const e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviders.length&&!i)for(let e=0;e<this._activeProviderReplies.size;e++){const r=null===(s=this._activeProviderReplies.get(e))||void 0===s?void 0:s.find((e=>this._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=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent&&this._element)){const e=this._positionFromMouseEvent(this._lastMouseEvent,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}}};t.Linkifier2=c=s([r(0,h.IBufferService)],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=t.OscLinkProvider=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;t<c;t++)if(-1!==d||s.hasContent(t)){if(s.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(-1===d){d=t,l=a.extended.urlId;continue}_=a.extended.urlId!==l}else-1!==d&&(_=!0);if(_||-1!==d&&t===c-1){const s=null===(i=this._oscLinkService.getLinkData(l))||void 0===i?void 0:i.uri;if(s){const i={start:{x:d+1,y:e},end:{x:t+(_||t!==c-1?0:1),y:e}};let n=!1;if(!(null==o?void 0:o.allowNonHttpProtocols))try{const e=new URL(s);["http:","https:"].includes(e.protocol)||(n=!0)}catch(e){n=!0}n||r.push({text:s,range:i,activate:(e,t)=>o?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")}}t.OscLinkProvider=a=s([r(0,o.IBufferService),r(1,o.IOptionsService),r(2,o.IOscLinkService)],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(3614),r=i(3656),n=i(6465),o=i(9042),a=i(3730),h=i(1680),c=i(3107),l=i(5744),d=i(2950),_=i(1296),u=i(428),f=i(4269),v=i(5114),p=i(8934),g=i(3230),m=i(9312),S=i(4725),C=i(6731),b=i(8055),y=i(8969),w=i(8460),E=i(844),k=i(6114),L=i(8437),D=i(2584),R=i(7399),x=i(5941),A=i(9074),B=i(2585),T=i(5435),M=i(4567),O="undefined"!=typeof window?window.document:null;class P extends y.CoreTerminal{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}constructor(e={}){super(e),this.browser=k,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new E.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(n.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(a.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(B.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,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,E.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)})))}_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=b.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${i};${(0,x.toRgbString)(s)}${D.C1_ESCAPED.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors((e=>e.ansi[t.index]=b.rgba.toColor(...t.color)));else{const i=e;this._themeService.modifyColors((e=>e[i]=b.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){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(M.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.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(D.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,r.addDisposableDomListener)(this.element,"copy",(e=>{this.hasSelection()&&(0,s.copyHandler)(e,this._selectionService)})));const e=e=>(0,s.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,r.addDisposableDomListener)(this.textarea,"paste",e)),this.register((0,r.addDisposableDomListener)(this.element,"paste",e)),k.isFirefox?this.register((0,r.addDisposableDomListener)(this.element,"mousedown",(e=>{2===e.button&&(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,r.addDisposableDomListener)(this.element,"contextmenu",(e=>{(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),k.isLinux&&this.register((0,r.addDisposableDomListener)(this.element,"auxclick",(e=>{1===e.button&&(0,s.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,r.addDisposableDomListener)(this.textarea,"keyup",(e=>this._keyUp(e)),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"keydown",(e=>this._keyDown(e)),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"keypress",(e=>this._keyPress(e)),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionupdate",(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,r.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,r.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"),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",o.promptLabel),k.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(v.CoreBrowserService,this.textarea,null!==(t=this._document.defaultView)&&void 0!==t?t:window),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,r.addDisposableDomListener)(this.textarea,"focus",(e=>this._handleTextAreaFocus(e)))),this.register((0,r.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(C.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(f.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.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(d.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(p.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(h.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),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(m.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,r.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,r.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.value=this._instantiationService.createInstance(M.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(_.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},n={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",n.mousemove),s.mousemove=n.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup||(t.addEventListener("mouseup",n.mouseup),s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),t.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,r.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,r.addDisposableDomListener)(t,"wheel",(e=>{if(!s.wheel){if(!this.buffer.hasScrollback){const t=this.viewport.getLinesScrolled(e);if(0===t)return;const i=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(e.deltaY<0?"A":"B");let s="";for(let e=0;e<Math.abs(t);e++)s+=i;return this.coreService.triggerDataEvent(s,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,r.addDisposableDomListener)(t,"touchstart",(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,r.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){var s;1===i?(super.scrollLines(e,t,i),this.refresh(0,this.rows-1)):null===(s=this.viewport)||void 0===s||s.scrollLines(e)}paste(e){(0,s.paste)(e,this.textarea,this.coreService,this.optionsService)}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}registerMarker(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.scrollToBottom(),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const i=(0,R.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!==D.C0.ETX&&i.key!==D.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(){var e;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<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(L.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),null===(e=this.viewport)||void 0===e||e.reset(),this.refresh(0,this.rows-1)}}reset(){var e,t;this.options.rows=this.rows,this.options.cols=this.cols;const i=this._customKeyEventHandler;this._setup(),super.reset(),null===(e=this._selectionService)||void 0===e||e.reset(),this._decorationService.reset(),null===(t=this.viewport)||void 0===t||t.reset(),this._customKeyEventHandler=i,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;null===(e=this._renderService)||void 0===e||e.clearTextureAtlas()}_reportFocus(){var e;(null===(e=this.element)||void 0===e?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent(D.C0.ESC+"[I"):this.coreService.triggerDataEvent(D.C0.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case T.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case T.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${s};${i}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=P},9924:(e,t)=>{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(3656),o=i(4725),a=i(8460),h=i(844),c=i(2585);let l=t.Viewport=class extends h.Disposable{constructor(e,t,i,s,r,o,h,c){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=i,this._optionsService=s,this._charSizeService=r,this._renderService=o,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._onRequestScrollLines=this.register(new a.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.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()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_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._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_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&&i<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){const t=this._getPixelsScrolled(e);return 0!==t&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,-1===this._smoothScrollState.target?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(0!==e)if(this._optionsService.rawOptions.smoothScrollDuration){const t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){var i;let s,r="";const n=[],o=null!=t?t:this._bufferService.buffer.lines.length,a=this._bufferService.buffer.lines;for(let t=e;t<o;t++){const e=a.get(t);if(!e)continue;const o=null===(i=a.get(t+1))||void 0===i?void 0:i.isWrapped;if(r+=e.translateToString(!o),!o||t===a.length-1){const e=document.createElement("div");e.textContent=r,n.push(e),r.length>0&&(s=e),r=""}}return{bufferElements:n,cursorElement:s}}getLinesScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?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))}};t.Viewport=l=s([r(2,c.IBufferService),r(3,c.IOptionsService),r(4,o.ICharSizeService),r(5,o.IRenderService),r(6,o.ICoreBrowserService),r(7,o.IThemeService)],l)},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=t.BufferDecorationRenderer=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,i;const s=document.createElement("div");s.classList.add("xterm-decoration"),s.classList.toggle("xterm-decoration-top-layer","top"===(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.layer)),s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",s.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const r=null!==(i=e.options.x)&&void 0!==i?i:0;return r&&r>this._bufferService.cols&&(s.style.display="none"),this._refreshXPosition(e,s),s}_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),e.onDispose((()=>{this._decorationElements.delete(e),i.remove()}))),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()}};t.BufferDecorationRenderer=c=s([r(1,h.IBufferService),r(2,h.IDecorationService),r(3,o.IRenderService)],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<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=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=t.OverviewRulerRenderer=class extends h.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}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()})))}_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})))}};t.OverviewRulerRenderer=u=s([r(2,c.IBufferService),r(3,c.IDecorationService),r(4,a.IRenderService),r(5,c.IOptionsService),r(6,a.ICoreBrowserService)],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=t.CompositionHelper=class{get isComposing(){return this._isComposing}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=""}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.length<e.length?this._coreService.triggerDataEvent(`${a.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const r=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(r.width,1)+"px",this._textarea.style.height=Math.max(r.height,1)+"px",this._textarea.style.lineHeight=r.height+"px"}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=h=s([r(2,o.IBufferService),r(3,o.IOptionsService),r(4,o.ICoreService),r(5,n.IRenderService)],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<Math.abs(r-a);n++){const a="A"===o(e,t)?-1:1,h=i.buffer.lines.get(r+a*n);(null==h?void 0:h.isWrapped)&&s++}return s}(e,t,i);return c(l,h(o(e,t),s))}function n(e,t){let i=0,s=t.buffer.lines.get(e),r=null==s?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=null==s?void 0:s.isWrapped;return i}function o(e,t){return e>t?"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;s<e;s++)i+=t;return i}t.moveToCellSequence=function(e,t,i,s){const o=i.buffer.x,l=i.buffer.y;if(!i.buffer.hasScrollback)return function(e,t,i,s,o,l){return 0===r(t,s,o,l).length?"":c(a(e,t,e,t-n(t,o),!1,o).length,h("D",l))}(o,l,0,t,i,s)+r(l,t,i,s)+function(e,t,i,s,o,l){let d;d=r(t,s,o,l).length>0?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&&h<=s||e>=i&&h<s?"C":"D"}(e,t,i,s,o,l);return c(a(e,d,i,_,"C"===u,o).length,h(u,l))}(o,l,e,t,i,s);let d;if(l===t)return d=o>e?"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(3787),o=i(2550),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-rows",p="xterm-fg-",g="xterm-bg-",m="xterm-focus",S="xterm-selection";let C=1,b=t.DomRenderer=class extends _.Disposable{constructor(e,t,i,s,r,a,c,l,u,p){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._themeService=p,this._terminalClass=C++,this._rowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(v),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(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,h.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=r.createInstance(n.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),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_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} .${v} span { display: inline-block; height: 100%; vertical-align: top;}`;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} .${v} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${v} .xterm-dim { color: ${l.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`,t+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% {  border-bottom-style: hidden; }}",t+="@keyframes blink_block_"+this._terminalClass+" { 0% {"+`  background-color: ${e.cursor.css};`+`  color: ${e.cursorAccent.css}; } 50% {  background-color: inherit;`+`  color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+" 1s step-end infinite;}"+`${this._terminalSelector} .${v}.${m} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+" 1s step-end infinite;}"+`${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block {`+` background-color: ${e.cursor.css};`+` color: ${e.cursorAccent.css};}`+`${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-outline {`+` outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}`+`${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-bar {`+` box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}`+`${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-underline {`+` border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[i,s]of e.ansi.entries())t+=`${this._terminalSelector} .${p}${i} { color: ${s.css}; }${this._terminalSelector} .${p}${i}.xterm-dim { color: ${l.color.multiplyOpacity(s,.5).css}; }${this._terminalSelector} .${g}${i} { background-color: ${s.css}; }`;t+=`${this._terminalSelector} .${p}${a.INVERTED_DEFAULT_COLOR} { color: ${l.color.opaque(e.background).css}; }${this._terminalSelector} .${p}${a.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${l.color.multiplyOpacity(l.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${g}${a.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){const e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_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(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(m)}handleFocus(){this._rowContainer.classList.add(m),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),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(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const e of this._rowElements)e.replaceChildren()}renderRows(e,t){const i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){const e=h+i.ydisp,t=this._rowElements[h],c=i.lines.get(e);if(!t||!c)break;t.replaceChildren(...this._rowFactory.createRow(c,e,e===s,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}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){i<0&&(e=0),s<0&&(t=0);const o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);const a=this._bufferService.buffer,h=a.ybase+a.y,c=Math.min(a.x,r-1),l=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=i;o<=s;++o){const u=o+a.ydisp,f=this._rowElements[o],v=a.lines.get(u);if(!f||!v)break;f.replaceChildren(...this._rowFactory.createRow(v,u,u===h,d,_,c,l,this.dimensions.css.cell.width,this._widthCache,n?o===i?e:0:-1,n?(o===s?t:r)-1:-1))}}};t.DomRenderer=b=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)],b)},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=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);let f=t.DomRendererRowFactory=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,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,a,h,l,_,f,p){const g=[],m=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors;let C,b=e.getNoBgTrimmedLength();i&&b<a+1&&(b=a+1);let y=0,w="",E=0,k=0,L=0,D=!1,R=0,x=!1,A=0;const B=[],T=-1!==f&&-1!==p;for(let M=0;M<b;M++){e.loadCell(M,this._workCell);let b=this._workCell.getWidth();if(0===b)continue;let O=!1,P=M,I=this._workCell;if(m.length>0&&M===m[0][0]){O=!0;const t=m.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),P=t[1]-1,b=I.getWidth()}const H=this._isCellInSelection(M,t),F=i&&M===a,W=T&&M>=f&&M<=p;let U=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,(e=>{U=!0}));let N=I.getChars()||o.WHITESPACE_CELL_CHAR;if(" "===N&&(I.isUnderline()||I.isOverline())&&(N=" "),A=b*l-_.get(N,I.isBold(),I.isItalic()),C){if(y&&(H&&x||!H&&!x&&I.bg===E)&&(H&&x&&S.selectionForeground||I.fg===k)&&I.extended.ext===L&&W===D&&A===R&&!F&&!O&&!U){w+=N,y++;continue}y&&(C.textContent=w),C=this._document.createElement("span"),y=0,w=""}else C=this._document.createElement("span");if(E=I.bg,k=I.fg,L=I.extended.ext,D=W,R=A,x=H,O&&a>=M&&a<=P&&(a=M),!this._coreService.isCursorHidden&&F)if(B.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&B.push("xterm-cursor-blink"),B.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":B.push("xterm-cursor-outline");break;case"block":B.push("xterm-cursor-block");break;case"bar":B.push("xterm-cursor-bar");break;case"underline":B.push("xterm-cursor-underline")}if(I.isBold()&&B.push("xterm-bold"),I.isItalic()&&B.push("xterm-italic"),I.isDim()&&B.push("xterm-dim"),w=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(B.push(`xterm-underline-${I.extended.underlineStyle}`)," "===w&&(w=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),C.style.textDecorationColor=S.ansi[e].css}I.isOverline()&&(B.push("xterm-overline")," "===w&&(w=" ")),I.isStrikethrough()&&B.push("xterm-strikethrough"),W&&(C.style.textDecoration="underline");let $=I.getFgColor(),j=I.getFgColorMode(),z=I.getBgColor(),K=I.getBgColorMode();const q=!!I.isInverse();if(q){const e=$;$=z,z=e;const t=j;j=K,K=t}let V,G,X,J=!1;switch(this._decorationService.forEachDecorationAtCell(M,t,void 0,(e=>{"top"!==e.options.layer&&J||(e.backgroundColorRGB&&(K=50331648,z=e.backgroundColorRGB.rgba>>8&16777215,V=e.backgroundColorRGB),e.foregroundColorRGB&&(j=50331648,$=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),J="top"===e.options.layer)})),!J&&H&&(V=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,z=V.rgba>>8&16777215,K=50331648,J=!0,S.selectionForeground&&(j=50331648,$=S.selectionForeground.rgba>>8&16777215,G=S.selectionForeground)),J&&B.push("xterm-decoration-top"),K){case 16777216:case 33554432:X=S.ansi[z],B.push(`xterm-bg-${z}`);break;case 50331648:X=c.rgba.toColor(z>>16,z>>8&255,255&z),this._addStyle(C,`background-color:#${v((z>>>0).toString(16),"0",6)}`);break;default:q?(X=S.foreground,B.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):X=S.background}switch(V||I.isDim()&&(V=c.color.multiplyOpacity(X,.5)),j){case 16777216:case 33554432:I.isBold()&&$<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&($+=8),this._applyMinimumContrast(C,X,S.ansi[$],I,V,void 0)||B.push(`xterm-fg-${$}`);break;case 50331648:const e=c.rgba.toColor($>>16&255,$>>8&255,255&$);this._applyMinimumContrast(C,X,e,I,V,G)||this._addStyle(C,`color:#${v($.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(C,X,S.foreground,I,V,void 0)||q&&B.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}B.length&&(C.className=B.join(" "),B.length=0),F||O||U?C.textContent=w:y++,A!==this.defaultSpacing&&(C.style.letterSpacing=`${A}px`),g.push(C),M=P}return C&&y&&(C.textContent=w),g}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,_.excludeFromContrastRatioDemands)(s.getCode()))return!1;const o=this._getContrastCache(s);let a;if(r||n||(a=o.getColor(t.rgba,i.rgba)),void 0===a){const e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=c.color.ensureContrastRatio(r||t,n||i,e),o.setColor((r||t).rgba,(n||i).rgba,null!=a?a:null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_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<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0])}};function v(e,t,i){for(;e.length<i;)e=t+e;return e}t.DomRendererRowFactory=f=s([r(1,l.ICharacterJoinerService),r(2,h.IOptionsService),r(3,l.ICoreBrowserService),r(4,h.ICoreService),r(5,h.IDecorationService),r(6,l.IThemeService)],f)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const t=e.createElement("span"),i=e.createElement("span");i.style.fontWeight="bold";const s=e.createElement("span");s.style.fontStyle="italic";const r=e.createElement("span");r.style.fontWeight="bold",r.style.fontStyle="italic",this._measureElements=[t,i,s,r],this._container.appendChild(t),this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),e.body.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&1===e.length&&(s=e.charCodeAt(0))<256)return-9999!==this._flat[s]?this._flat[s]:this._flat[s]=this._measure(e,0);let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(void 0===n){let s=0;t&&(s|=1),i&&(s|=2),n=this._measure(e,s),this._holey.set(r,n)}return n}_measure(e,t){const i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}}},2223:(e,t,i)=>{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=t.CharSizeService=class extends a.Disposable{get hasValidSize(){return this.width>0&&this.height>0}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())))}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())}};t.CharSizeService=h=s([r(2,n.IOptionsService)],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".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",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={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return 0!==e.width&&0!==e.height&&(this._result.width=e.width/32,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=t.CharacterJoinerService=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;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];const t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];const i=[],s=t.translateToString(!0);let r=0,n=0,a=0,h=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==h||this._workCell.bg!==c){if(e-r>1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t<e.length;t++)i.push(e[t])}r=e,a=n,h=this._workCell.fg,c=this._workCell.bg}n+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-r>1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t<e.length;t++)i.push(e[t])}return i}_getJoinedRanges(t,i,s,r,n){const o=t.substring(i,s);let a=[];try{a=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{const i=this._characterJoiners[t].handler(o);for(let t=0;t<i.length;t++)e._mergeRanges(a,i[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(a,r,n),a}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,a=e[s];if(a){for(let h=i;h<this._bufferService.cols;h++){const i=t.getWidth(h),c=t.getString(h).length||o.WHITESPACE_CELL_CHAR.length;if(0!==i){if(!r&&a[0]<=n&&(a[0]=h,r=!0),a[1]<=n){if(a[1]=h,a=e[++s],!a)break;a[0]<=n?(a[0]=h,r=!0):r=!1}n+=c}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){const r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0)}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=l=s([r(0,h.IBufferService)],l)},5114:(e,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=t.MouseService=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)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{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])}}};t.MouseService=a=s([r(0,n.IRenderService),r(1,n.ICharSizeService)],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(3656),o=i(6193),a=i(5596),h=i(4725),c=i(8460),l=i(844),d=i(7226),_=i(2585);let u=t.RenderService=class extends l.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,i,s,r,h,_,u){if(super(),this._rowCount=e,this._charSizeService=s,this._renderer=this.register(new l.MutableDisposable),this._pausedResizeTask=new d.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 c.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new c.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new c.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new c.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer(_.window,((e,t)=>this._renderRows(e,t))),this.register(this._renderDebouncer),this._screenDprMonitor=new a.ScreenDprMonitor(_.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(h.onResize((()=>this._fullRefresh()))),this.register(h.buffers.onBufferActivate((()=>{var e;return null===(e=this._renderer.value)||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(h.cols,h.rows),this._fullRefresh()}))),this.register(i.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(h.buffer.y,h.buffer.y,!0)))),this.register((0,n.addDisposableDomListener)(_.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(u.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in _.window){const e=new _.window.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});e.observe(t),this.register({dispose:()=>e.disconnect()})}}_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.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.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.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value.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.value&&(null===(t=(e=this._renderer.value).clearTextureAtlas)||void 0===t||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null===(e=this._renderer.value)||void 0===e||e.handleCharSizeChanged()}handleBlur(){var e;null===(e=this._renderer.value)||void 0===e||e.handleBlur()}handleFocus(){var e;null===(e=this._renderer.value)||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.value)||void 0===s||s.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;null===(e=this._renderer.value)||void 0===e||e.handleCursorMove()}clear(){var e;null===(e=this._renderer.value)||void 0===e||e.clear()}};t.RenderService=u=s([r(2,_.IOptionsService),r(3,h.ICharSizeService),r(4,_.IDecorationService),r(5,_.IBufferService),r(6,h.ICoreBrowserService),r(7,h.IThemeService)],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(9806),o=i(9504),a=i(456),h=i(4725),c=i(8460),l=i(844),d=i(6114),_=i(4841),u=i(511),f=i(2585),v=String.fromCharCode(160),p=new RegExp(v,"g");let g=t.SelectionService=class extends l.Disposable{constructor(e,t,i,s,r,n,o,h,d){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=h,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.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 a.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,l.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]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){const e=i.translateBufferLineToString(o,!0,r,n);s.push(e)}}else{const r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let r=e[1]+1;r<=t[1]-1;r++){const e=i.lines.get(r),t=i.translateBufferLineToString(r,!0);(null==e?void 0:e.isWrapped)?s[s.length-1]+=t:s.push(t)}if(e[1]!==t[1]){const e=i.lines.get(t[1]),r=i.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?s[s.length-1]+=r:s.push(r)}}return s.map((e=>e.replace(p," "))).join(d.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()))),d.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]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&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,_.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,n.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 d.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&&!(d.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]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>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]<i.lines.length){const e=i.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const e=this._bufferService.buffer;this._dragScrollAmount>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,o.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(;h<o.length&&" "===o.charAt(h+1);)h++}else{let t=e[0],i=e[0];0===n.getWidth(t)&&(l++,t--),2===n.getWidth(i)&&(d++,i++);const s=n.getString(i).length;for(s>1&&(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(;i<n.length&&h+1<o.length&&!this._isCharWordSeparator(n.loadCell(i+1,this._workCell));){n.loadCell(i+1,this._workCell);const e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,i++):e>1&&(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,_.getRangeLength)(i,this._bufferService.cols)}};t.SelectionService=g=s([r(3,f.IBufferService),r(4,f.ICoreService),r(5,h.IMouseService),r(6,f.IOptionsService),r(7,h.IRenderService),r(8,h.ICoreBrowserService)],g)},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=t.ThemeService=class extends h.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new a.EventEmitter),this.onChangeColors=this._onChangeColors.event,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,halfContrastCache:this._halfContrastCache},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))))}_setTheme(e={}){const i=this._colors;if(i.foreground=p(e.foreground,l),i.background=p(e.background,d),i.cursor=p(e.cursor,_),i.cursorAccent=p(e.cursorAccent,u),i.selectionBackgroundTransparent=p(e.selectionBackground,f),i.selectionBackgroundOpaque=o.color.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=p(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=o.color.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?p(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]=p(e.black,t.DEFAULT_ANSI_COLORS[0]),i.ansi[1]=p(e.red,t.DEFAULT_ANSI_COLORS[1]),i.ansi[2]=p(e.green,t.DEFAULT_ANSI_COLORS[2]),i.ansi[3]=p(e.yellow,t.DEFAULT_ANSI_COLORS[3]),i.ansi[4]=p(e.blue,t.DEFAULT_ANSI_COLORS[4]),i.ansi[5]=p(e.magenta,t.DEFAULT_ANSI_COLORS[5]),i.ansi[6]=p(e.cyan,t.DEFAULT_ANSI_COLORS[6]),i.ansi[7]=p(e.white,t.DEFAULT_ANSI_COLORS[7]),i.ansi[8]=p(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),i.ansi[9]=p(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),i.ansi[10]=p(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),i.ansi[11]=p(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),i.ansi[12]=p(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),i.ansi[13]=p(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),i.ansi[14]=p(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),i.ansi[15]=p(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<s;r++)i.ansi[r+16]=p(e.extendedAnsi[r],t.DEFAULT_ANSI_COLORS[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0!==e)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function p(e,t){if(void 0!==e)try{return o.css.toColor(e)}catch(e){}return t}t.ThemeService=v=s([r(0,c.IOptionsService)],v)},6349:(e,t,i)=>{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;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+i.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<i.length;t++)this._array[this._getCyclicIndex(e+t)]=i[t];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._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<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=n},1439:(e,t)=>{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,d,_;function u(e){const t=e.toString(16);return t.length<2?"0"+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(e){e.toCss=function(e,t,i,s){return void 0!==s?`#${u(e)}${u(t)}${u(i)}${u(s)}`:`#${u(e)}${u(t)}${u(i)}`},e.toRgba=function(e,t,i,s=255){return(e<<24|t<<16|i<<8|s)>>>0}}(h||(t.channels=h={})),function(e){function t(e,t){return a=Math.round(255*t),[r,n,o]=_.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=_.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return _.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[r,n,o]=_.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]}}(c||(t.color=c={})),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),_.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),_.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]))),_.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}}}(l||(t.css=l={})),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}(d||(t.rgb=d={})),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,c=f(d.relativeLuminance2(o,a,h),d.relativeLuminance2(s,r,n));for(;c<i&&(o>0||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)),c=f(d.relativeLuminance2(o,a,h),d.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,c=f(d.relativeLuminance2(o,a,h),d.relativeLuminance2(s,r,n));for(;c<i&&(o<255||a<255||h<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),h=Math.min(255,h+Math.ceil(.1*(255-h))),c=f(d.relativeLuminance2(o,a,h),d.relativeLuminance2(s,r,n));return(o<<24|a<<16|h<<8|255)>>>0}e.ensureContrastRatio=function(e,s,r){const n=d.relativeLuminance(e>>8),o=d.relativeLuminance(s>>8);if(f(n,o)<r){if(o<n){const o=t(e,s,r),a=f(n,d.relativeLuminance(o>>8));if(a<r){const t=i(e,s,r);return a>f(n,d.relativeLuminance(t>>8))?o:t}return o}const a=i(e,s,r),h=f(n,d.relativeLuminance(a>>8));if(h<r){const i=t(e,s,r);return h>f(n,d.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i,s){return{css:h.toCss(e,t,i,s),rgba:h.toRgba(e,t,i,s)}}}(_||(t.rgba=_={})),t.toPaddedHex=u,t.contrastRatio=f},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),p=i(5981),g=i(2660);let m=!1;class S extends s.Disposable{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]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new s.MutableDisposable),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(g.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.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),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 p.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,l.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=r.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!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.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}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._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e=!!("conpty"===t.backend&&t.buildNumber<21376):this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){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._windowsWrappingHeuristics.value=(0,s.toDisposable)((()=>{for(const t of e)t.dispose()}))}}}t.CoreTerminal=S},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;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const i=[];for(let e=0;e<this._listeners.length;e++)i.push(this._listeners[e]);for(let s=0;s<i.length;s++)i[s].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))}},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),p=i(6242),g=i(6351),m=i(5941),S={"(":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=y={}));let w=0;class E extends h.Disposable{getAttrData(){return this._curAttrData}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 k(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 p.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new p.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new p.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new p.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new p.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new p.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new p.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new p.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new p.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new p.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new p.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new p.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 g.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_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.length<e.length&&this._parseBuffer.length<C&&(this._parseBuffer=new Uint32Array(Math.min(e.length,C))),o||this._dirtyRowTracker.clearRange(),e.length>C)for(let t=n;t<e.length;t+=C){const n=t+C<e.length?t+C:e.length,o="string"==typeof e?this._stringDecoder.decode(e.substring(t,n),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,n),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,o))return this._preserveStack(s,r,o,t),this._logSlowResolvingAsync(i),i}else if(!o){const t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,t))return this._preserveStack(s,r,t,0),this._logSlowResolvingAsync(i),i}this._activeBuffer.x===s&&this._activeBuffer.y===r||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(e,t,i){let s,r;const n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,d=this._curAttrData;let u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&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<i;++f){if(s=e[f],r=this._unicodeService.wcwidth(s),s<127&&n){const e=n[String.fromCharCode(s)];e&&(s=e.charCodeAt(0))}if(o&&this._onA11yChar.fire((0,c.stringFromCodePoint)(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),r||!this._activeBuffer.x){if(this._activeBuffer.x+r-1>=a)if(h){for(;this._activeBuffer.x<a;)u.setCellFromCodePoint(this._activeBuffer.x++,0,1,d.fg,d.bg,d.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=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.x<a&&i-t>0&&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 g.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new p.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.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!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&&(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.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=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.y<this._activeBuffer.scrollTop)return!0;const i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const i=this._activeBuffer.ybase+this._activeBuffer.y;let s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(l.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();const t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){if(!this._parser.precedingCodepoint)return!0;const t=e.params[0]||1,i=new Uint32Array(t);for(let e=0;e<t;++e)i[e]=this._parser.precedingCodepoint;return this.print(i,0,i.length),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(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;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[t]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){const i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:r}=this._coreMouseService,o=this._coreService,{buffers:a,cols:h}=this._bufferService,{active:c,alt:l}=a,d=this._optionsService.rawOptions,_=e=>e?1:2,u=e.params[0];return f=u,v=t?2===u?4:4===u?_(o.modes.insertMode):12===u?3: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):67===u?4: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<i.length&&o+n+1+r<s.length);break}if(5===s[1]&&n+r>=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let e=2;e<s.length;++e)-1===s[e]&&(s[e]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(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<t;r++)i=e.params[r],i>=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):53===i?s.bg|=1073741824:55===i?s.bg&=-1073741825: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(L(i))if("?"===s)t.push({type:0,index:i});else{const e=(0,m.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<i.length&&!(t>=this._specialColors.length);++e,++t)if("?"===i[e])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const s=(0,m.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<i.length;++e)if(/^\d+$/.exec(i[e])){const s=parseInt(i[e]);L(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(S[e[0]],o.CHARSETS[e[1]]||o.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),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._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._bufferService.rows;++t){const i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){const i=this._bufferService.buffer,s=this._optionsService.rawOptions;return(e=>(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 k=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(w=e,e=t,t=w),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function L(e){return 0<=e&&e<256}k=s([r(0,v.IBufferService)],k)},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.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null===(t=this._value)||void 0===t||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null===(e=this._value)||void 0===e||e.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return{dispose:()=>i(e)}}},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)),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),-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])===t);return!1}*getKeyIterator(e){if(0!==this._array.length&&(i=this._search(e),!(i<0||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)}forEachByKey(e,t){if(0!==this._array.length&&(i=this._search(e),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===e))do{t(this._array[i])}while(++i<this._array.length&&this._getKey(this._array[i])===e)}values(){return[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1;const r=this._getKey(this._array[s]);if(r>e)i=s-1;else{if(!(r<e)){for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}}},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._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),i=Math.max(t,i),r=e.timeRemaining(),1.5*i>r)return s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),void this._start();s=r}this.clear()}}class 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}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return 50331648==(50331648&this.fg)}isBgRGB(){return 50331648==(50331648&this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return 0==(50331648&this.fg)}isBgDefault(){return 0==(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}t.AttributeData=i;class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=s},9092:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const s=i(6349),r=i(7226),n=i(3734),o=i(8437),a=i(4634),h=i(511),c=i(643),l=i(4863),d=i(7116);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=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=h.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=h.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new r.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 n.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 n.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.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&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;const i=e+this._optionsService.rawOptions.scrollback;return i>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=o.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(o.DEFAULT_ATTR_DATA);let s=0;const r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)s+=+this.lines.get(t).resize(e,i);let n=0;if(this._rows<t)for(let s=this._rows;s<t;s++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new o.BufferLine(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.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(r<this.lines.maxLength){const e=this.lines.length-r;e>0&&(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=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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<this.lines.length;t++)s+=+this.lines.get(t).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.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._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376: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(o.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(o.DEFAULT_ATTR_DATA);let r=i;for(;r-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){const i=this.getNullCell(o.DEFAULT_ATTR_DATA),s=[];let r=0;for(let n=this.lines.length-1;n>=0;n--){let h=this.lines.get(n);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;const c=[h];for(;h.isWrapped&&n>0;)h=this.lines.get(--n),c.unshift(h);const l=this.ybase+this.y;if(l>=n&&l<n+c.length)continue;const d=c[c.length-1].getTrimmedLength(),_=(0,a.reflowSmallerGetNewLineLengths)(c,this._cols,e),u=_.length-c.length;let f;f=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+u):Math.max(0,this.lines.length-this.lines.maxLength+u);const v=[];for(let e=0;e<u;e++){const e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);v.push(e)}v.length>0&&(s.push({start:n+c.length+r,newLines:v}),r+=v.length),c.push(...v);let p=_.length-1,g=_[p];0===g&&(p--,g=_[p]);let m=c.length-u-1,S=d;for(;m>=0;){const e=Math.min(S,g);if(void 0===c[p])break;if(c[p].copyCellsFrom(c[m],S-e,g-e,e,!0),g-=e,0===g&&(p--,g=_[p]),S-=e,0===S){m--;const e=Math.max(m,0);S=(0,a.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t<c.length;t++)_[t]<e&&c[t].setCell(_[t],i);let C=u-f;for(;C-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+r)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+t-1)}if(s.length>0){const e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));const i=this.lines.length;let n=i-1,o=0,a=s[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+r);let h=0;for(let c=Math.min(this.lines.maxLength-1,i+r-1);c>=0;c--)if(a&&a.start>n+h){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(c--,a.newLines[e]);c++,e.push({index:n+1,amount:a.newLines.length}),h+=a.newLines.length,a=s[++o]}else this.lines.set(c,t[n--]);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+r-this.lines.maxLength);l>0&&this.lines.onTrimEmitter.fire(l)}}translateBufferLineToString(e,t,i=0,s){const r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);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;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){const t=new l.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim((e=>{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.line<e.index+e.amount&&t.dispose(),t.line>e.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)}}},8437:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const s=i(3734),r=i(511),n=i(643),o=i(482);t.DEFAULT_ATTR_DATA=Object.freeze(new s.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||r.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let t=0;t<e;++t)this.setCell(t,s);this.length=e}get(e){const t=this._data[3*e+0],i=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:i?(0,o.stringFromCodePoint)(i):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(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}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,o.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,o.stringFromCodePoint)(t):(2097151&i?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&i)+(0,o.stringFromCodePoint)(t),i&=-2097152,i|=2097152):i=t|1<<22,this._data[3*e+0]=i)}insertCells(e,t,i,n){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new s.ExtendedAttrs),t<this.length-e){const s=new r.CellData;for(let i=this.length-e-t-1;i>=0;--i)this.setCell(e+t+i,this.loadCell(e+i,s));for(let s=0;s<t;++s)this.setCell(e+s,i)}else for(let t=e;t<this.length;++t)this.setCell(t,i);2===this.getWidth(this.length-1)&&this.setCellFromCodePoint(this.length-1,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new s.ExtendedAttrs)}deleteCells(e,t,i,n){if(e%=this.length,t<this.length-e){const s=new r.CellData;for(let i=0;i<this.length-e-t;++i)this.setCell(e+i,this.loadCell(e+t+i,s));for(let e=this.length-t;e<this.length;++e)this.setCell(e,i)}else for(let t=e;t<this.length;++t)this.setCell(t,i);e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new s.ExtendedAttrs),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(null==n?void 0:n.fg)||0,(null==n?void 0:n.bg)||0,(null==n?void 0:n.extended)||new s.ExtendedAttrs)}replaceCells(e,t,i,r,n=!1){if(n)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==r?void 0:r.fg)||0,(null==r?void 0:r.bg)||0,(null==r?void 0:r.extended)||new s.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodePoint(t,0,1,(null==r?void 0:r.fg)||0,(null==r?void 0:r.bg)||0,(null==r?void 0:r.extended)||new s.ExtendedAttrs);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==r?void 0:r.fg)||0,(null==r?void 0:r.bg)||0,(null==r?void 0:r.extended)||new s.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodePoint(t,0,1,(null==r?void 0:r.fg)||0,(null==r?void 0:r.bg)||0,(null==r?void 0:r.extended)||new s.ExtendedAttrs);e<t&&e<this.length;)this.setCell(e++,i)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.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;++i)this.setCell(i,t)}else{this._data=this._data.subarray(0,i);const t=Object.keys(this._combined);for(let i=0;i<t.length;i++){const s=parseInt(t[i],10);s>=e&&delete this._combined[s]}const s=Object.keys(this._extendedAttrs);for(let t=0;t<s.length;t++){const i=parseInt(s[t],10);i>=e&&delete this._extendedAttrs[i]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(const t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){const e=new h(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const t in this._combined)e._combined[t]=this._combined[t];for(const t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])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<s;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])}const o=Object.keys(e._combined);for(let s=0;s<o.length;s++){const r=parseInt(o[s],10);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 s="";for(;t<i;){const e=this._data[3*t+0],i=2097151&e;s+=2097152&e?this._combined[t]:i?(0,o.stringFromCodePoint)(i):n.WHITESPACE_CELL_CHAR,t+=e>>22||1}return s}}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<e.length-1;a++){let h=a,c=e.get(++h);if(!c.isWrapped)continue;const l=[e.get(a)];for(;h<e.length&&c.isWrapped;)l.push(c),c=e.get(++h);if(r>=a&&r<h){a+=l.length-1;continue}let d=0,_=i(l,d,t),u=1,f=0;for(;u<l.length;){const e=i(l,u,t),r=e-f,o=s-_,a=Math.min(r,o);l[d].copyCellsFrom(l[u],f,_,a,!1),_+=a,_===s&&(d++,_=0),f+=a,f===e&&(u++,f=0),0===_&&0!==d&&2===l[d-1].getWidth(s-1)&&(l[d].copyCellsFrom(l[d-1],s-1,_++,1,!1),l[d-1].setCell(s-1,n))}l[d].replaceCells(_,s,n);let v=0;for(let e=l.length-1;e>0&&(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;o<e.length;o++)if(r===o){const i=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:i}),o+=i-1,n+=i,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}},t.reflowLargerApplyNewLayout=function(e,t){const i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let t=0;t<i.length;t++)e.set(t,i[t]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,s){const r=[],n=e.map(((s,r)=>i(e,r,t))).reduce(((e,t)=>e+t));let o=0,a=0,h=0;for(;h<n;){if(n-h<s){r.push(n-h);break}o+=s;const c=i(e,a,t);o>c&&(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(8460),r=i(844),n=i(9092);class o extends r.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new s.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 n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.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{get id(){return this._id}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}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,r;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL="\0",e.SOH="\ 1",e.STX="\ 2",e.ETX="\ 3",e.EOT="\ 4",e.ENQ="\ 5",e.ACK="\ 6",e.BEL="\a",e.BS="\b",e.HT="\t",e.LF="\n",e.VT="\v",e.FF="\f",e.CR="\r",e.SO="\ e",e.SI="\ f",e.DLE="\10",e.DC1="\11",e.DC2="\12",e.DC3="\13",e.DC4="\14",e.NAK="\15",e.SYN="\16",e.ETB="\17",e.CAN="\18",e.EM="\19",e.SUB="\1a",e.ESC="\e",e.FS="\1c",e.GS="\1d",e.RS="\1e",e.US="\1f",e.SP=" ",e.DEL="\7f"}(i||(t.C0=i={})),function(e){e.PAD="\80",e.HOP="\81",e.BPH="\82",e.NBH="\83",e.IND="\84",e.NEL="\85",e.SSA="\86",e.ESA="\87",e.HTS="\88",e.HTJ="\89",e.VTS="\8a",e.PLD="\8b",e.PLU="\8c",e.RI="\8d",e.SS2="\8e",e.SS3="\8f",e.DCS="\90",e.PU1="\91",e.PU2="\92",e.STS="\93",e.CCH="\94",e.MW="\95",e.SPA="\96",e.EPA="\97",e.SOS="\98",e.SGCI="\99",e.SCI="\9a",e.CSI="\9b",e.ST="\9c",e.OSC="\9d",e.PM="\9e",e.APC="\9f"}(s||(t.C1=s={})),function(e){e.ST=`${i.ESC}\\`}(r||(t.C1_ESCAPED=r={}))},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;r<i;++r){let t=e[r];t>65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){const i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let n=r;n<i;++n){const r=e.charCodeAt(n);if(55296<=r&&r<=56319){if(++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<l;){if(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;){for(;!(!(d<l)||128&(s=e[d])||128&(r=e[d+1])||128&(n=e[d+2])||128&(o=e[d+3]));)t[a++]=s,t[a++]=r,t[a++]=n,t[a++]=o,d+=4;if(s=e[d++],s<128)t[a++]=s;else if(192==(224&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(h=(31&s)<<6|63&r,h<128){d--;continue}t[a++]=h}else if(224==(240&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(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;e<i.length;++e)r.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?r[e]:function(e,t){let i,s=0,r=t.length-1;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e<t[i][0]))return!0;r=i-1}return!1}(e,s)?0: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;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}}t.TransitionTable=a;const h=160;t.VT500_TRANSITION_TABLE=function(){const e=new a(4095),t=Array.apply(null,Array(256)).map(((e,t)=>t)),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;t<e.intermediates.length;++t){const s=e.intermediates.charCodeAt(t);if(32>s||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<t;++i){switch(r=e[i],n=this._transitions.table[this.currentState<<8|(r<160?r:h)],n>>4){case 2:for(let s=i+1;;++s){if(s>=t||(r=e[s])<32||r>126&&r<h){this._printHandler(e,i,s),i=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<h){this._printHandler(e,i,s),i=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<h){this._printHandler(e,i,s),i=s-1;break}if(++s>=t||(r=e[s])<32||r>126&&r<h){this._printHandler(e,i,s),i=s-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:i,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const o=this._csiHandlers[this._collect<<8|r];let a=o?o.length-1:-1;for(;a>=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(++i<t&&(r=e[i])>47&&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<h){this._dcsParser.put(e,i,s),i=s-1;break}break;case 14:if(s=this._dcsParser.unhook(24!==r&&26!==r),s)return this._preserveStack(6,[],0,n,i),s;27===r&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let s=i+1;;s++)if(s>=t||(r=e[s])<32||r>127&&r<h){this._oscParser.put(e,i,s),i=s-1;break}break;case 6:if(s=this._oscParser.end(24!==r&&26!==r),s)return this._preserveStack(5,[],0,n,i),s;27===r&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&n}}}t.EscapeSequenceParser=c},6242:(e,t,i)=>{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(;t<i;){const i=e[t++];if(59===i){this._state=2,this._start();break}if(i<48||57<i)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+i-48}2===this._state&&i-t>0&&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{static fromArray(e){const t=new s;if(!e.length)return t;for(let i=Array.isArray(e[0])?1:0;i<e.length;++i){const s=e[i];if(Array.isArray(s))for(let e=0;e<s.length;++e)t.addSubParam(s[e]);else t.addParam(s)}return t}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}clone(){const e=new s(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);const i=this._subParamsIdx[t]>>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<this.length;++t){const i=this._subParamsIdx[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<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(-1===t)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,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),n=i(844);class o extends n.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(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)}}t.BufferNamespaceApi=o},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(8460),o=i(844),a=i(5295),h=i(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let c=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.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 a.BufferSet(e,this))}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))}};t.BufferService=c=s([r(0,h.IOptionsService)],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?"":`\e[M${l(t[0])}${l(t[1])}${l(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`\e[<${c(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`\e[<${c(e,!0)};${e.x};${e.y}${t}`}};let _=t.CoreMouseService=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}};t.CoreMouseService=_=s([r(0,n.IBufferService),r(1,n.ICoreService)],_)},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(1439),o=i(8460),a=i(844),h=i(2585),c=Object.freeze({insertMode:!1}),l=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=t.CoreService=class extends a.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,n.clone)(c),this.decPrivateModes=(0,n.clone)(l)}reset(){this.modes=(0,n.clone)(c),this.decPrivateModes=(0,n.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))}};t.CoreService=d=s([r(0,h.IBufferService),r(1,h.ILogService),r(2,h.IOptionsService)],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{get decorations(){return this._decorations.values()}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)((()=>this.reset())))}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<a&&(!i||(null!==(n=h.options.layer)&&void 0!==n?n:"bottom")===i)&&(yield h)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,(t=>{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<h&&(!i||(null!==(o=t.options.layer)&&void 0!==o?o:"bottom")===i)&&s(t)}))}}t.DecorationService=c;class l extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=s.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=s.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new r.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,i)=>{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.traceCall=t.setTraceLogger=t.LogService=void 0;const n=i(844),o=i(2585),a={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF};let h,c=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),h=this}_updateLogLevel(){this._logLevel=a[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){var i,s;this._logLevel<=o.LogLevelEnum.TRACE&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.trace.bind(this._optionsService.options.logger))&&void 0!==s?s:console.log,e,t)}debug(e,...t){var i,s;this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.debug.bind(this._optionsService.options.logger))&&void 0!==s?s:console.log,e,t)}info(e,...t){var i,s;this._logLevel<=o.LogLevelEnum.INFO&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.info.bind(this._optionsService.options.logger))&&void 0!==s?s:console.info,e,t)}warn(e,...t){var i,s;this._logLevel<=o.LogLevelEnum.WARN&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.warn.bind(this._optionsService.options.logger))&&void 0!==s?s:console.warn,e,t)}error(e,...t){var i,s;this._logLevel<=o.LogLevelEnum.ERROR&&this._log(null!==(s=null===(i=this._optionsService.options.logger)||void 0===i?void 0:i.error.bind(this._optionsService.options.logger))&&void 0!==s?s:console.error,e,t)}};t.LogService=c=s([r(0,o.IOptionsService)],c),t.setTraceLogger=function(e){h=e},t.traceCall=function(e,t,i){if("function"!=typeof i.value)throw new Error("not supported");const s=i.value;i.value=function(...e){if(h.logLevel!==o.LogLevelEnum.TRACE)return s.apply(this,e);h.trace(`GlyphRenderer#${s.name}(${e.map((e=>JSON.stringify(e))).join(", ")})`);const t=s.apply(this,e);return h.trace(`GlyphRenderer#${s.name} return`,t),t}}},7302:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const s=i(8460),r=i(844),n=i(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,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:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},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 r.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}`);break;case"rows":case"cols":if(!i&&0!==i)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=null!=i?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=t.OscLinkService=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)))}};t.OscLinkService=o=s([r(0,n.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const i="di$target",s="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[s]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const r=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,r){t[i]===t?t[s].push({id:e,index:r}):(t[s]=[{id:e,index:r}],t[i]=t)}(r,e,n)};return r.toString=()=>e,t.serviceRegistry.set(e,r),r}},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"),function(e){e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.OFF=5]="OFF"}(r||(t.LogLevelEnum=r={})),t.ILogService=(0,s.createDecorator)("LogService"),t.IOptionsService=(0,s.createDecorator)("OptionsService"),t.IOscLinkService=(0,s.createDecorator)("OscLinkService"),t.IUnicodeService=(0,s.createDecorator)("UnicodeService"),t.IDecorationService=(0,s.createDecorator)("DecorationService")},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;++s){let r=e.charCodeAt(s);if(55296<=r&&r<=56319){if(++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(9042),r=i(3236),n=i(844),o=i(5741),a=i(8285),h=i(7975),c=i(7090),l=["cols","rows"];class d extends n.Disposable{constructor(e){super(),this._core=this.register(new r.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions=Object.assign({},this._core.options);const t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const e in this._core.options){const s={get:t.bind(this,e),set:i.bind(this,e)};Object.defineProperty(this._publicOptions,e,s)}}_checkReadonlyOptions(e){if(l.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 h.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.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=this.register(new a.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.registerMarker(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(){super.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){this._addonManager.loadAddon(this,e)}static get strings(){return t}_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")}}e.Terminal=d})(),s})()));
 //# sourceMappingURL=xterm.js.map
\ No newline at end of file
index c8e69a75a793de44064b014440187bfe3ab08408..d3bb063de6474c07fccefae38b78212fb628ea89 100644 (file)
@@ -1 +1 @@
-{"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,EAA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AMpjD,MAAM7R,GACjBvM,KAAKwhE,MAAMpjD,MAAM,OAAQ2iB,IAEpB,YAAA39B,MAAP,SAAamJ,GACXvM,KAAKwhE,MAAMp+D,MAAMmJ,IAOZ,YAAA+kC,UAAP,SAAiBjyC,GACf,OAAOW,KAAKwhE,MAAM1iD,eAAewyB,UAAUjyC,IAYtC,YAAAwoE,UAAP,SAAiBxoE,EAAUoE,GACzBzD,KAAK8oE,sBAAsBzpE,GAC3BW,KAAKwhE,MAAM1iD,eAAe+oD,UAAUxoE,EAAKoE,IAEpC,YAAAzB,QAAP,SAAevD,EAAeC,GAC5BsB,KAAKwpE,gBAAgB/qE,EAAOC,GAC5BsB,KAAKwhE,MAAMx/D,QAAQvD,EAAOC,IAErB,YAAAoe,MAAP,WACE9c,KAAKwhE,MAAM1kD,SAEN,YAAA4N,kBAAP,WACE1qB,KAAKwhE,MAAM92C,qBAEN,YAAAm2C,UAAP,SAAiB+I,GACf,OAAO5pE,KAAK4oE,cAAc/H,UAAU7gE,KAAM4pE,IAE5C,sBAAkB,YAAO,C,IAAzB,WACE,OAAOloE,G,gCAGD,YAAA8nE,gBAAR,W,IAAwB,sDACtB,IAAoB,UAAApJ,EAAA,eAAQ,CAAvB,IAAM38D,EAAK,KACd,GAAIA,IAAUomE,EAAAA,GAAY3xB,MAAMz0C,IAAUA,EAAQ,GAAM,EACtD,MAAM,IAAItF,MAAM,oCAIxB,EAlQA,GAAa,EAAAutB,SAAAA,G","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/TimeBasedDebouncer.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/renderer/BaseRenderLayer.ts","webpack://xterm/./src/browser/renderer/CursorRenderLayer.ts","webpack://xterm/./src/browser/renderer/CustomGlyphs.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/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/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/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/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/./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 } 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.setAttribute('role', 'document');\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._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 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._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 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 _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';\nimport { IColorRGB } from 'common/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    // 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    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  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  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  // 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): 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';\nimport { ColorIndex } from 'common/Types';\n\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\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  private _restoreColors!: IRestoreColorSet;\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    this._updateRestoreColors();\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    this._updateRestoreColors();\n  }\n\n  public restoreColor(slot?: ColorIndex): 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  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]\n    };\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<ILinkifierEvent>();\n  public get onShowLinkUnderline(): IEvent<ILinkifierEvent> { return this._onShowLinkUnderline.event; }\n  private _onHideLinkUnderline = new EventEmitter<ILinkifierEvent>();\n  public get onHideLinkUnderline(): IEvent<ILinkifierEvent> { return this._onHideLinkUnderline.event; }\n  private _onLinkTooltip = new EventEmitter<ILinkifierEvent>();\n  public get onLinkTooltip(): IEvent<ILinkifierEvent> { 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\n    // Cannot use window.setTimeout since tests need to run in node\n    this._rowsTimeoutId = setTimeout(() => this._linkifyRows(), Linkifier._timeBeforeLatency) as any as number;\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, 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 } 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 _lastMouseEvent: MouseEvent | undefined;\n  private _linkCacheDisposables: IDisposable[] = [];\n  private _lastBufferCell: IBufferCellPosition | undefined;\n  private _isMouseOut: boolean = true;\n  private _activeProviderReplies: Map<Number, ILinkWithState[] | undefined> | undefined;\n  private _activeLine: number = -1;\n\n  private _onShowLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());\n  public get onShowLinkUnderline(): IEvent<ILinkifierEvent> { return this._onShowLinkUnderline.event; }\n  private _onHideLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());\n  public get onHideLinkUnderline(): IEvent<ILinkifierEvent> { 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<Number, ILinkWithState[] | undefined>): void {\n    const occupiedCells = new Set<number>();\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    zone?.tooltipCallback(e);\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 { IRenderDebouncer } from 'browser/Types';\n\n/**\n * Debounces calls to render terminal rows using animation frames.\n */\nexport class RenderDebouncer implements IRenderDebouncer {\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, CharacterJoinerHandler } from 'browser/Types';\nimport { IRenderer } 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 { 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 { ColorManager } from 'browser/ColorManager';\nimport { RenderService } from 'browser/services/RenderService';\nimport { ICharSizeService, IRenderService, IMouseService, ISelectionService, ISoundService, ICoreBrowserService, ICharacterJoinerService } 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 'browser/Color';\nimport { CharacterJoinerService } from 'browser/services/CharacterJoinerService';\nimport { toRgbString } from 'common/input/XParseColor';\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 as any;\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 _characterJoinerService: ICharacterJoinerService | 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  /**\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 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<void>();\n  public get onCursorMove(): IEvent<void> { 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<void>();\n  public get onSelectionChange(): IEvent<void> { return this._onSelectionChange.event; }\n  private _onTitleChange = new EventEmitter<string>();\n  public get onTitleChange(): IEvent<string> { return this._onTitleChange.event; }\n  private _onBell = new EventEmitter<void>();\n  public get onBell(): IEvent<void> { return this._onBell.event; }\n\n  private _onFocus = new EventEmitter<void>();\n  public get onFocus(): IEvent<void> { return this._onFocus.event; }\n  private _onBlur = new EventEmitter<void>();\n  public get onBlur(): IEvent<void> { return this._onBlur.event; }\n  private _onA11yCharEmitter = new EventEmitter<string>();\n  public get onA11yChar(): IEvent<string> { return this._onA11yCharEmitter.event; }\n  private _onA11yTabEmitter = new EventEmitter<number>();\n  public get onA11yTab(): IEvent<number> { 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: Partial<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.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\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._colorManager) return;\n    for (const req of event) {\n      let acc: 'foreground' | 'background' | 'cursor' | 'ansi' | undefined = undefined;\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      if (acc) {\n        switch (req.type) {\n          case ColorRequestType.REPORT:\n            const channels = color.toColorRGB(acc === 'ansi'\n              ? this._colorManager.colors.ansi[req.index]\n              : this._colorManager.colors[acc]);\n            this.coreService.triggerDataEvent(`${C0.ESC}]${ident};${toRgbString(channels)}${C0.BEL}`);\n            break;\n          case ColorRequestType.SET:\n            if (acc === 'ansi') this._colorManager.colors.ansi[req.index] = rgba.toColor(...req.color);\n            else this._colorManager.colors[acc] = rgba.toColor(...req.color);\n            break;\n          case ColorRequestType.RESTORE:\n            this._colorManager.restoreColor(req.index);\n            break;\n        }\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 'customGlyphs':\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 || !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.actualCellHeight;\n    const width = bufferLine.getWidth(cursorX);\n    const cellWidth = this._renderService.dimensions.actualCellWidth * width;\n    const cursorTop = this.buffer.y * this._renderService.dimensions.actualCellHeight;\n    const cursorLeft = cursorX * this._renderService.dimensions.actualCellWidth;\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    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    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._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    this._characterJoinerService = this._instantiationService.createInstance(CharacterJoinerService);\n    this._instantiationService.setService(ICharacterJoinerService, this._characterJoinerService);\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._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._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) => this.scrollLines(amount, true, ScrollSource.VIEWPORT),\n      this._viewportElement,\n      this._viewportScrollArea,\n      this.element\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.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!.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.event(ev => {\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.screenElement, 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 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          // 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        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.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      // 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!.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?.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  /**\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    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    // 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._bufferService.scrollToBottom();\n      }\n      return false;\n    }\n\n    if (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    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, 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: 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    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    if (ev.data && ev.inputType === 'insertText' && !ev.composed && !this.optionsService.options.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   * 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    this._onBell.fire();\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({ 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\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.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) 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 } from 'browser/Types';\nimport { ICharSizeService, IRenderService } from 'browser/services/Services';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IRenderDimensions } from 'browser/renderer/Types';\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 _currentScaledCellHeight: 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 _lastHadScrollBar: boolean = false;\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\n  constructor(\n    private readonly _scrollLines: (amount: number) => void,\n    private readonly _viewportElement: HTMLElement,\n    private readonly _scrollArea: HTMLElement,\n    private readonly _element: 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._lastHadScrollBar = true;\n    this.register(addDisposableDomListener(this._viewportElement, 'scroll', this._onScroll.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    // 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._currentScaledCellHeight = this._renderService.dimensions.scaledCellHeight;\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    // Update scroll bar width\n    if (this._optionsService.options.scrollback === 0) {\n      this.scrollBarWidth = 0;\n    } else {\n      this.scrollBarWidth = (this._viewportElement.offsetWidth - this._scrollArea.offsetWidth) || FALLBACK_SCROLL_BAR_WIDTH;\n    }\n    this._lastHadScrollBar = this.scrollBarWidth > 0;\n\n    const elementStyle = window.getComputedStyle(this._element);\n    const elementPadding = parseInt(elementStyle.paddingLeft) + parseInt(elementStyle.paddingRight);\n    this._viewportElement.style.width = (this._renderService.dimensions.actualCellWidth * (this._bufferService.cols) + this.scrollBarWidth + (this._lastHadScrollBar ? elementPadding : 0)).toString() + 'px';\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.canvasHeight) {\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.scaledCellHeight !== this._currentScaledCellHeight) {\n      this._refresh(immediate);\n      return;\n    }\n\n    // If the scroll bar visibility changed\n    if (this._lastHadScrollBar !== (this._optionsService.options.scrollback > 0)) {\n      this._refresh(immediate);\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      // 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  /**\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 || 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.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 { IRenderService } 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    @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<CompositionEvent, 'data'>): 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 cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n\n      const cellHeight = this._renderService.dimensions.actualCellHeight;\n      const cursorTop = this._bufferService.buffer.y * this._renderService.dimensions.actualCellHeight;\n      const cursorLeft = cursorX * this._renderService.dimensions.actualCellWidth;\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      // 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(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?.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?.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(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) 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, TEXT_BASELINE } 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';\nimport { tryDrawCustomChar } from 'browser/renderer/CustomGlyphs';\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  public clearTextureAtlas(): void {\n    this._charAtlas?.clear();\n  }\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 middle 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 _fillMiddleLineAtCells(x: number, y: number, width: number = 1): void {\n    const cellOffset = Math.ceil(this._scaledCellHeight * 0.5);\n    this._ctx.fillRect(\n      x * this._scaledCellWidth,\n      (y + 1) * this._scaledCellHeight - cellOffset - window.devicePixelRatio,\n      width * this._scaledCellWidth,\n      window.devicePixelRatio);\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 = TEXT_BASELINE;\n    this._clipRow(y);\n\n    // Draw custom characters if applicable\n    let drawSuccess = false;\n    if (this._optionsService.options.customGlyphs !== false) {\n      drawSuccess = tryDrawCustomChar(this._ctx, cell.getChars(), x * this._scaledCellWidth, y * this._scaledCellHeight, this._scaledCellWidth, this._scaledCellHeight);\n    }\n\n    // Draw the character\n    if (!drawSuccess) {\n      this._ctx.fillText(\n        cell.getChars(),\n        x * this._scaledCellWidth + this._scaledCharLeft,\n        y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight);\n    }\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?.draw(this._ctx, this._currentGlyphIdentifier, x * this._scaledCellWidth + this._scaledCharLeft, y * this._scaledCellHeight + this._scaledCharTop);\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 = TEXT_BASELINE;\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\n    // Draw custom characters if applicable\n    let drawSuccess = false;\n    if (this._optionsService.options.customGlyphs !== false) {\n      drawSuccess = tryDrawCustomChar(this._ctx, cell.getChars(), x * this._scaledCellWidth, y * this._scaledCellHeight, this._scaledCellWidth, this._scaledCellHeight);\n    }\n\n    // Draw the character\n    if (!drawSuccess) {\n      this._ctx.fillText(\n        cell.getChars(),\n        x * this._scaledCellWidth + this._scaledCharLeft,\n        y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight);\n    }\n\n    this._ctx.restore();\n  }\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) 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<IRequestRedrawEvent>,\n    @IBufferService bufferService: IBufferService,\n    @IOptionsService optionsService: IOptionsService,\n    @ICoreService private readonly _coreService: ICoreService,\n    @ICoreBrowserService 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  }\n\n  public dispose(): void {\n    if (this._cursorBlinkStateManager) {\n      this._cursorBlinkStateManager.dispose();\n      this._cursorBlinkStateManager = undefined;\n    }\n    super.dispose();\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    this._cursorBlinkStateManager?.restartBlinkAnimation();\n    this.onOptionsChanged();\n  }\n\n  public onBlur(): void {\n    this._cursorBlinkStateManager?.pause();\n    this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });\n  }\n\n  public onFocus(): void {\n    this._cursorBlinkStateManager?.resume();\n    this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });\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    this._cursorBlinkStateManager?.restartBlinkAnimation();\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      // Avoid potential rounding errors when device pixel ratio is less than 1\n      if (window.devicePixelRatio < 1) {\n        this._clearAll();\n      } else {\n        this._clearCells(this._state.x, this._state.y, this._state.width, 1);\n      }\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      this._blinkInterval = undefined;\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) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { throwIfFalsy } from 'browser/renderer/RendererUtils';\n\ninterface IBlockVector {\n  x: number;\n  y: number;\n  w: number;\n  h: number;\n}\n\nexport const blockElementDefinitions: { [index: string]: IBlockVector[] | undefined } = {\n  // Block elements (0x2580-0x2590)\n  '▀': [{ x: 0, y: 0, w: 8, h: 4 }], // UPPER HALF BLOCK\n  '▁': [{ x: 0, y: 7, w: 8, h: 1 }], // LOWER ONE EIGHTH BLOCK\n  '▂': [{ x: 0, y: 6, w: 8, h: 2 }], // LOWER ONE QUARTER BLOCK\n  '▃': [{ x: 0, y: 5, w: 8, h: 3 }], // LOWER THREE EIGHTHS BLOCK\n  '▄': [{ x: 0, y: 4, w: 8, h: 4 }], // LOWER HALF BLOCK\n  '▅': [{ x: 0, y: 3, w: 8, h: 5 }], // LOWER FIVE EIGHTHS BLOCK\n  '▆': [{ x: 0, y: 2, w: 8, h: 6 }], // LOWER THREE QUARTERS BLOCK\n  '▇': [{ x: 0, y: 1, w: 8, h: 7 }], // LOWER SEVEN EIGHTHS BLOCK\n  '█': [{ x: 0, y: 0, w: 8, h: 8 }], // FULL BLOCK\n  '▉': [{ x: 0, y: 0, w: 7, h: 8 }], // LEFT SEVEN EIGHTHS BLOCK\n  '▊': [{ x: 0, y: 0, w: 6, h: 8 }], // LEFT THREE QUARTERS BLOCK\n  '▋': [{ x: 0, y: 0, w: 5, h: 8 }], // LEFT FIVE EIGHTHS BLOCK\n  '▌': [{ x: 0, y: 0, w: 4, h: 8 }], // LEFT HALF BLOCK\n  '▍': [{ x: 0, y: 0, w: 3, h: 8 }], // LEFT THREE EIGHTHS BLOCK\n  '▎': [{ x: 0, y: 0, w: 2, h: 8 }], // LEFT ONE QUARTER BLOCK\n  '▏': [{ x: 0, y: 0, w: 1, h: 8 }], // LEFT ONE EIGHTH BLOCK\n  '▐': [{ x: 4, y: 0, w: 4, h: 8 }], // RIGHT HALF BLOCK\n\n  // Block elements (0x2594-0x2595)\n  '▔': [{ x: 0, y: 0, w: 9, h: 1 }], // UPPER ONE EIGHTH BLOCK\n  '▕': [{ x: 7, y: 0, w: 1, h: 8 }], // RIGHT ONE EIGHTH BLOCK\n\n  // Terminal graphic characters (0x2596-0x259F)\n  '▖': [{ x: 0, y: 4, w: 4, h: 4 }],                             // QUADRANT LOWER LEFT\n  '▗': [{ x: 4, y: 4, w: 4, h: 4 }],                             // QUADRANT LOWER RIGHT\n  '▘': [{ x: 0, y: 0, w: 4, h: 4 }],                             // QUADRANT UPPER LEFT\n  '▙': [{ x: 0, y: 0, w: 4, h: 8 }, { x: 0, y: 4, w: 8, h: 4 }], // QUADRANT UPPER LEFT AND LOWER LEFT AND LOWER RIGHT\n  '▚': [{ x: 0, y: 0, w: 4, h: 4 }, { x: 4, y: 4, w: 4, h: 4 }], // QUADRANT UPPER LEFT AND LOWER RIGHT\n  '▛': [{ x: 0, y: 0, w: 4, h: 8 }, { x: 0, y: 0, w: 4, h: 8 }], // QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER LEFT\n  '▜': [{ x: 0, y: 0, w: 8, h: 4 }, { x: 4, y: 0, w: 4, h: 8 }], // QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER RIGHT\n  '▝': [{ x: 4, y: 0, w: 4, h: 4 }],                             // QUADRANT UPPER RIGHT\n  '▞': [{ x: 4, y: 0, w: 4, h: 4 }, { x: 0, y: 4, w: 4, h: 4 }], // QUADRANT UPPER RIGHT AND LOWER LEFT\n  '▟': [{ x: 4, y: 0, w: 4, h: 8 }, { x: 0, y: 4, w: 8, h: 4 }], // QUADRANT UPPER RIGHT AND LOWER LEFT AND LOWER RIGHT\n\n  // VERTICAL ONE EIGHTH BLOCK-2 through VERTICAL ONE EIGHTH BLOCK-7\n  '\\u{1FB70}': [{ x: 1, y: 0, w: 1, h: 8 }],\n  '\\u{1FB71}': [{ x: 2, y: 0, w: 1, h: 8 }],\n  '\\u{1FB72}': [{ x: 3, y: 0, w: 1, h: 8 }],\n  '\\u{1FB73}': [{ x: 4, y: 0, w: 1, h: 8 }],\n  '\\u{1FB74}': [{ x: 5, y: 0, w: 1, h: 8 }],\n  '\\u{1FB75}': [{ x: 6, y: 0, w: 1, h: 8 }],\n\n  // HORIZONTAL ONE EIGHTH BLOCK-2 through HORIZONTAL ONE EIGHTH BLOCK-7\n  '\\u{1FB76}': [{ x: 0, y: 1, w: 8, h: 1 }],\n  '\\u{1FB77}': [{ x: 0, y: 2, w: 8, h: 1 }],\n  '\\u{1FB78}': [{ x: 0, y: 3, w: 8, h: 1 }],\n  '\\u{1FB79}': [{ x: 0, y: 4, w: 8, h: 1 }],\n  '\\u{1FB7A}': [{ x: 0, y: 5, w: 8, h: 1 }],\n  '\\u{1FB7B}': [{ x: 0, y: 6, w: 8, h: 1 }],\n\n  // LEFT AND LOWER ONE EIGHTH BLOCK\n  '\\u{1FB7C}': [{ x: 0, y: 0, w: 1, h: 8 }, { x: 0, y: 7, w: 8, h: 1 }],\n  // LEFT AND UPPER ONE EIGHTH BLOCK\n  '\\u{1FB7D}': [{ x: 0, y: 0, w: 1, h: 8 }, { x: 0, y: 0, w: 8, h: 1 }],\n  // RIGHT AND UPPER ONE EIGHTH BLOCK\n  '\\u{1FB7E}': [{ x: 7, y: 0, w: 1, h: 8 }, { x: 0, y: 0, w: 8, h: 1 }],\n  // RIGHT AND LOWER ONE EIGHTH BLOCK\n  '\\u{1FB7F}': [{ x: 7, y: 0, w: 1, h: 8 }, { x: 0, y: 7, w: 8, h: 1 }],\n  // UPPER AND LOWER ONE EIGHTH BLOCK\n  '\\u{1FB80}': [{ x: 0, y: 0, w: 8, h: 1 }, { x: 0, y: 7, w: 8, h: 1 }],\n  // HORIZONTAL ONE EIGHTH BLOCK-1358\n  '\\u{1FB81}': [{ x: 0, y: 0, w: 8, h: 1 }, { x: 0, y: 2, w: 8, h: 1 }, { x: 0, y: 4, w: 8, h: 1 }, { x: 0, y: 7, w: 8, h: 1 }],\n\n  // UPPER ONE QUARTER BLOCK\n  '\\u{1FB82}': [{ x: 0, y: 0, w: 8, h: 2 }],\n  // UPPER THREE EIGHTHS BLOCK\n  '\\u{1FB83}': [{ x: 0, y: 0, w: 8, h: 3 }],\n  // UPPER FIVE EIGHTHS BLOCK\n  '\\u{1FB84}': [{ x: 0, y: 0, w: 8, h: 5 }],\n  // UPPER THREE QUARTERS BLOCK\n  '\\u{1FB85}': [{ x: 0, y: 0, w: 8, h: 6 }],\n  // UPPER SEVEN EIGHTHS BLOCK\n  '\\u{1FB86}': [{ x: 0, y: 0, w: 8, h: 7 }],\n\n  // RIGHT ONE QUARTER BLOCK\n  '\\u{1FB87}': [{ x: 6, y: 0, w: 2, h: 8 }],\n  // RIGHT THREE EIGHTHS B0OCK\n  '\\u{1FB88}': [{ x: 5, y: 0, w: 3, h: 8 }],\n  // RIGHT FIVE EIGHTHS BL0CK\n  '\\u{1FB89}': [{ x: 3, y: 0, w: 5, h: 8 }],\n  // RIGHT THREE QUARTERS 0LOCK\n  '\\u{1FB8A}': [{ x: 2, y: 0, w: 6, h: 8 }],\n  // RIGHT SEVEN EIGHTHS B0OCK\n  '\\u{1FB8B}': [{ x: 1, y: 0, w: 7, h: 8 }],\n\n  // CHECKER BOARD FILL\n  '\\u{1FB95}': [\n    { x: 0, y: 0, w: 2, h: 2 }, { x: 4, y: 0, w: 2, h: 2 },\n    { x: 2, y: 2, w: 2, h: 2 }, { x: 6, y: 2, w: 2, h: 2 },\n    { x: 0, y: 4, w: 2, h: 2 }, { x: 4, y: 4, w: 2, h: 2 },\n    { x: 2, y: 6, w: 2, h: 2 }, { x: 6, y: 6, w: 2, h: 2 }\n  ],\n  // INVERSE CHECKER BOARD FILL\n  '\\u{1FB96}': [\n    { x: 2, y: 0, w: 2, h: 2 }, { x: 6, y: 0, w: 2, h: 2 },\n    { x: 0, y: 2, w: 2, h: 2 }, { x: 4, y: 2, w: 2, h: 2 },\n    { x: 2, y: 4, w: 2, h: 2 }, { x: 6, y: 4, w: 2, h: 2 },\n    { x: 0, y: 6, w: 2, h: 2 }, { x: 4, y: 6, w: 2, h: 2 }\n  ],\n  // HEAVY HORIZONTAL FILL (upper middle and lower one quarter block)\n  '\\u{1FB97}': [{ x: 0, y: 2, w: 8, h: 2 }, { x: 0, y: 6, w: 8, h: 2 }]\n};\n\ntype PatternDefinition = number[][];\n\n/**\n * Defines the repeating pattern used by special characters, the pattern is made up of a 2d array of\n * pixel values to be filled (1) or not filled (0).\n */\nconst patternCharacterDefinitions: { [key: string]: PatternDefinition | undefined } = {\n  // Shade characters (0x2591-0x2593)\n  '░': [ // LIGHT SHADE (25%)\n    [1, 0, 0, 0],\n    [0, 0, 0, 0],\n    [0, 0, 1, 0],\n    [0, 0, 0, 0]\n  ],\n  '▒': [ // MEDIUM SHADE (50%)\n    [1, 0],\n    [0, 0],\n    [0, 1],\n    [0, 0]\n  ],\n  '▓': [ // DARK SHADE (75%)\n    [0, 1],\n    [1, 1],\n    [1, 0],\n    [1, 1]\n  ]\n};\n\nconst enum Shapes {\n  /** │ */ TOP_TO_BOTTOM = 'M.5,0 L.5,1',\n  /** ─ */ LEFT_TO_RIGHT = 'M0,.5 L1,.5',\n\n  /** └ */ TOP_TO_RIGHT = 'M.5,0 L.5,.5 L1,.5',\n  /** ┘ */ TOP_TO_LEFT = 'M.5,0 L.5,.5 L0,.5',\n  /** ┐ */ LEFT_TO_BOTTOM = 'M0,.5 L.5,.5 L.5,1',\n  /** ┌ */ RIGHT_TO_BOTTOM = 'M0.5,1 L.5,.5 L1,.5',\n\n  /** ╵ */ MIDDLE_TO_TOP = 'M.5,.5 L.5,0',\n  /** ╴ */ MIDDLE_TO_LEFT = 'M.5,.5 L0,.5',\n  /** ╶ */ MIDDLE_TO_RIGHT = 'M.5,.5 L1,.5',\n  /** ╷ */ MIDDLE_TO_BOTTOM = 'M.5,.5 L.5,1',\n\n  /** ┴ */ T_TOP = 'M0,.5 L1,.5 M.5,.5 L.5,0',\n  /** ┤ */ T_LEFT = 'M.5,0 L.5,1 M.5,.5 L0,.5',\n  /** ├ */ T_RIGHT = 'M.5,0 L.5,1 M.5,.5 L1,.5',\n  /** ┬ */ T_BOTTOM = 'M0,.5 L1,.5 M.5,.5 L.5,1',\n\n  /** ┼ */ CROSS = 'M0,.5 L1,.5 M.5,0 L.5,1',\n\n  /** ╌ */ TWO_DASHES_HORIZONTAL = 'M.1,.5 L.4,.5 M.6,.5 L.9,.5', // .2 empty, .3 filled\n  /** ┄ */ THREE_DASHES_HORIZONTAL = 'M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5', // .1333 empty, .2 filled\n  /** ┉ */ FOUR_DASHES_HORIZONTAL = 'M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5', // .1 empty, .15 filled\n  /** ╎ */ TWO_DASHES_VERTICAL = 'M.5,.1 L.5,.4 M.5,.6 L.5,.9',\n  /** ┆ */ THREE_DASHES_VERTICAL = 'M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333',\n  /** ┊ */ FOUR_DASHES_VERTICAL = 'M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95',\n}\n\nconst enum Style {\n  NORMAL = 1,\n  BOLD = 3\n}\n\n/**\n * This contains the definitions of all box drawing characters in the format of SVG paths (ie. the\n * svg d attribute).\n */\nexport const boxDrawingDefinitions: { [character: string]: { [fontWeight: number]: string | ((xp: number, yp: number) => string) } | undefined } = {\n  // Uniform normal and bold\n  '─': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT },\n  '━': { [Style.BOLD]:   Shapes.LEFT_TO_RIGHT },\n  '│': { [Style.NORMAL]: Shapes.TOP_TO_BOTTOM },\n  '┃': { [Style.BOLD]:   Shapes.TOP_TO_BOTTOM },\n  '┌': { [Style.NORMAL]: Shapes.RIGHT_TO_BOTTOM },\n  '┏': { [Style.BOLD]:   Shapes.RIGHT_TO_BOTTOM },\n  '┐': { [Style.NORMAL]: Shapes.LEFT_TO_BOTTOM },\n  '┓': { [Style.BOLD]:   Shapes.LEFT_TO_BOTTOM },\n  '└': { [Style.NORMAL]: Shapes.TOP_TO_RIGHT },\n  '┗': { [Style.BOLD]:   Shapes.TOP_TO_RIGHT },\n  '┘': { [Style.NORMAL]: Shapes.TOP_TO_LEFT },\n  '┛': { [Style.BOLD]:   Shapes.TOP_TO_LEFT },\n  '├': { [Style.NORMAL]: Shapes.T_RIGHT },\n  '┣': { [Style.BOLD]:   Shapes.T_RIGHT },\n  '┤': { [Style.NORMAL]: Shapes.T_LEFT },\n  '┫': { [Style.BOLD]:   Shapes.T_LEFT },\n  '┬': { [Style.NORMAL]: Shapes.T_BOTTOM },\n  '┳': { [Style.BOLD]:   Shapes.T_BOTTOM },\n  '┴': { [Style.NORMAL]: Shapes.T_TOP },\n  '┻': { [Style.BOLD]:   Shapes.T_TOP },\n  '┼': { [Style.NORMAL]: Shapes.CROSS },\n  '╋': { [Style.BOLD]:   Shapes.CROSS },\n  '╴': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT },\n  '╸': { [Style.BOLD]:   Shapes.MIDDLE_TO_LEFT },\n  '╵': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP },\n  '╹': { [Style.BOLD]:   Shapes.MIDDLE_TO_TOP },\n  '╶': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT },\n  '╺': { [Style.BOLD]:   Shapes.MIDDLE_TO_RIGHT },\n  '╷': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM },\n  '╻': { [Style.BOLD]:   Shapes.MIDDLE_TO_BOTTOM },\n\n  // Double border\n  '═': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L1,${.5 + yp}` },\n  '║': { [Style.NORMAL]: (xp, yp) => `M${.5 - xp},0 L${.5 - xp},1 M${.5 + xp},0 L${.5 + xp},1` },\n  '╒': { [Style.NORMAL]: (xp, yp) => `M.5,1 L.5,${.5 - yp} L1,${.5 - yp} M.5,${.5 + yp} L1,${.5 + yp}` },\n  '╓': { [Style.NORMAL]: (xp, yp) => `M${.5 - xp},1 L${.5 - xp},.5 L1,.5 M${.5 + xp},.5 L${.5 + xp},1` },\n  '╔': { [Style.NORMAL]: (xp, yp) => `M1,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},1 M1,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},1` },\n  '╕': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L.5,${.5 - yp} L.5,1 M0,${.5 + yp} L.5,${.5 + yp}` },\n  '╖': { [Style.NORMAL]: (xp, yp) => `M${.5 + xp},1 L${.5 + xp},.5 L0,.5 M${.5 - xp},.5 L${.5 - xp},1` },\n  '╗': { [Style.NORMAL]: (xp, yp) => `M0,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},1 M0,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},1` },\n  '╘': { [Style.NORMAL]: (xp, yp) => `M.5,0 L.5,${.5 + yp} L1,${.5 + yp} M.5,${.5 - yp} L1,${.5 - yp}` },\n  '╙': { [Style.NORMAL]: (xp, yp) => `M1,.5 L${.5 - xp},.5 L${.5 - xp},0 M${.5 + xp},.5 L${.5 + xp},0` },\n  '╚': { [Style.NORMAL]: (xp, yp) => `M1,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},0 M1,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},0` },\n  '╛': { [Style.NORMAL]: (xp, yp) => `M0,${.5 + yp} L.5,${.5 + yp} L.5,0 M0,${.5 - yp} L.5,${.5 - yp}` },\n  '╜': { [Style.NORMAL]: (xp, yp) => `M0,.5 L${.5 + xp},.5 L${.5 + xp},0 M${.5 - xp},.5 L${.5 - xp},0` },\n  '╝': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},0 M0,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},0` },\n  '╞': { [Style.NORMAL]: (xp, yp) => `${Shapes.TOP_TO_BOTTOM} M.5,${.5 - yp} L1,${.5 - yp} M.5,${.5 + yp} L1,${.5 + yp}` },\n  '╟': { [Style.NORMAL]: (xp, yp) => `M${.5 - xp},0 L${.5 - xp},1 M${.5 + xp},0 L${.5 + xp},1 M${.5 + xp},.5 L1,.5` },\n  '╠': { [Style.NORMAL]: (xp, yp) => `M${.5 - xp},0 L${.5 - xp},1 M1,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},1 M1,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},0` },\n  '╡': { [Style.NORMAL]: (xp, yp) => `${Shapes.TOP_TO_BOTTOM} M0,${.5 - yp} L.5,${.5 - yp} M0,${.5 + yp} L.5,${.5 + yp}` },\n  '╢': { [Style.NORMAL]: (xp, yp) => `M0,.5 L${.5 - xp},.5 M${.5 - xp},0 L${.5 - xp},1 M${.5 + xp},0 L${.5 + xp},1` },\n  '╣': { [Style.NORMAL]: (xp, yp) => `M${.5 + xp},0 L${.5 + xp},1 M0,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},1 M0,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},0` },\n  '╤': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L1,${.5 + yp} M.5,${.5 + yp} L.5,1` },\n  '╥': { [Style.NORMAL]: (xp, yp) => `${Shapes.LEFT_TO_RIGHT} M${.5 - xp},.5 L${.5 - xp},1 M${.5 + xp},.5 L${.5 + xp},1` },\n  '╦': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},1 M1,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},1` },\n  '╧': { [Style.NORMAL]: (xp, yp) => `M.5,0 L.5,${.5 - yp} M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L1,${.5 + yp}` },\n  '╨': { [Style.NORMAL]: (xp, yp) => `${Shapes.LEFT_TO_RIGHT} M${.5 - xp},.5 L${.5 - xp},0 M${.5 + xp},.5 L${.5 + xp},0` },\n  '╩': { [Style.NORMAL]: (xp, yp) => `M0,${.5 + yp} L1,${.5 + yp} M0,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},0 M1,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},0` },\n  '╪': { [Style.NORMAL]: (xp, yp) => `${Shapes.TOP_TO_BOTTOM} M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L1,${.5 + yp}` },\n  '╫': { [Style.NORMAL]: (xp, yp) => `${Shapes.LEFT_TO_RIGHT} M${.5 - xp},0 L${.5 - xp},1 M${.5 + xp},0 L${.5 + xp},1` },\n  '╬': { [Style.NORMAL]: (xp, yp) => `M0,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},1 M1,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},1 M0,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},0 M1,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},0` },\n\n  // Diagonal\n  '╱': { [Style.NORMAL]: 'M1,0 L0,1' },\n  '╲': { [Style.NORMAL]: 'M0,0 L1,1' },\n  '╳': { [Style.NORMAL]: 'M1,0 L0,1 M0,0 L1,1' },\n\n  // Mixed weight\n  '╼': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT,                                [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },\n  '╽': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP,                                 [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },\n  '╾': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT,                               [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },\n  '╿': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM,                              [Style.BOLD]: Shapes.MIDDLE_TO_TOP },\n  '┍': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM,                              [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },\n  '┎': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT,                               [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },\n  '┑': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM,                              [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },\n  '┒': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT,                                [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },\n  '┕': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP,                                 [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },\n  '┖': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT,                               [Style.BOLD]: Shapes.MIDDLE_TO_TOP },\n  '┙': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP,                                 [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },\n  '┚': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT,                                [Style.BOLD]: Shapes.MIDDLE_TO_TOP },\n  '┝': { [Style.NORMAL]: Shapes.TOP_TO_BOTTOM,                                 [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },\n  '┞': { [Style.NORMAL]: Shapes.RIGHT_TO_BOTTOM,                               [Style.BOLD]: Shapes.MIDDLE_TO_TOP },\n  '┟': { [Style.NORMAL]: Shapes.TOP_TO_RIGHT,                                  [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },\n  '┠': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT,                               [Style.BOLD]: Shapes.TOP_TO_BOTTOM },\n  '┡': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM,                              [Style.BOLD]: Shapes.TOP_TO_RIGHT },\n  '┢': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP,                                 [Style.BOLD]: Shapes.RIGHT_TO_BOTTOM },\n  '┥': { [Style.NORMAL]: Shapes.TOP_TO_BOTTOM,                                 [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },\n  '┦': { [Style.NORMAL]: Shapes.LEFT_TO_BOTTOM,                                [Style.BOLD]: Shapes.MIDDLE_TO_TOP },\n  '┧': { [Style.NORMAL]: Shapes.TOP_TO_LEFT,                                   [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },\n  '┨': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT,                                [Style.BOLD]: Shapes.TOP_TO_BOTTOM },\n  '┩': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM,                              [Style.BOLD]: Shapes.TOP_TO_LEFT },\n  '┪': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP,                                 [Style.BOLD]: Shapes.LEFT_TO_BOTTOM },\n  '┭': { [Style.NORMAL]: Shapes.RIGHT_TO_BOTTOM,                               [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },\n  '┮': { [Style.NORMAL]: Shapes.LEFT_TO_BOTTOM,                                [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },\n  '┯': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM,                              [Style.BOLD]: Shapes.LEFT_TO_RIGHT },\n  '┰': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT,                                 [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },\n  '┱': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT,                               [Style.BOLD]: Shapes.LEFT_TO_BOTTOM },\n  '┲': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT,                                [Style.BOLD]: Shapes.RIGHT_TO_BOTTOM },\n  '┵': { [Style.NORMAL]: Shapes.TOP_TO_RIGHT,                                  [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },\n  '┶': { [Style.NORMAL]: Shapes.TOP_TO_LEFT,                                   [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },\n  '┷': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP,                                 [Style.BOLD]: Shapes.LEFT_TO_RIGHT },\n  '┸': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT,                                 [Style.BOLD]: Shapes.MIDDLE_TO_TOP },\n  '┹': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT,                               [Style.BOLD]: Shapes.TOP_TO_LEFT },\n  '┺': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT,                                [Style.BOLD]: Shapes.TOP_TO_RIGHT },\n  '┽': { [Style.NORMAL]: `${Shapes.TOP_TO_BOTTOM} ${Shapes.MIDDLE_TO_RIGHT}`,  [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },\n  '┾': { [Style.NORMAL]: `${Shapes.TOP_TO_BOTTOM} ${Shapes.MIDDLE_TO_LEFT}`,   [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },\n  '┿': { [Style.NORMAL]: Shapes.TOP_TO_BOTTOM,                                 [Style.BOLD]: Shapes.LEFT_TO_RIGHT },\n  '╀': { [Style.NORMAL]: `${Shapes.LEFT_TO_RIGHT} ${Shapes.MIDDLE_TO_BOTTOM}`, [Style.BOLD]: Shapes.MIDDLE_TO_TOP },\n  '╁': { [Style.NORMAL]: `${Shapes.MIDDLE_TO_TOP} ${Shapes.LEFT_TO_RIGHT}`,    [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },\n  '╂': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT,                                 [Style.BOLD]: Shapes.TOP_TO_BOTTOM },\n  '╃': { [Style.NORMAL]: Shapes.RIGHT_TO_BOTTOM,                               [Style.BOLD]: Shapes.TOP_TO_LEFT },\n  '╄': { [Style.NORMAL]: Shapes.LEFT_TO_BOTTOM,                                [Style.BOLD]: Shapes.TOP_TO_RIGHT },\n  '╅': { [Style.NORMAL]: Shapes.TOP_TO_RIGHT,                                  [Style.BOLD]: Shapes.LEFT_TO_BOTTOM },\n  '╆': { [Style.NORMAL]: Shapes.TOP_TO_LEFT,                                   [Style.BOLD]: Shapes.RIGHT_TO_BOTTOM },\n  '╇': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM,                              [Style.BOLD]: `${Shapes.MIDDLE_TO_TOP} ${Shapes.LEFT_TO_RIGHT}` },\n  '╈': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP,                                 [Style.BOLD]: `${Shapes.LEFT_TO_RIGHT} ${Shapes.MIDDLE_TO_BOTTOM}` },\n  '╉': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT,                               [Style.BOLD]: `${Shapes.TOP_TO_BOTTOM} ${Shapes.MIDDLE_TO_LEFT}` },\n  '╊': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT,                                [Style.BOLD]: `${Shapes.TOP_TO_BOTTOM} ${Shapes.MIDDLE_TO_RIGHT}` },\n\n  // Dashed\n  '╌': { [Style.NORMAL]: Shapes.TWO_DASHES_HORIZONTAL },\n  '╍': { [Style.BOLD]:   Shapes.TWO_DASHES_HORIZONTAL },\n  '┄': { [Style.NORMAL]: Shapes.THREE_DASHES_HORIZONTAL },\n  '┅': { [Style.BOLD]:   Shapes.THREE_DASHES_HORIZONTAL },\n  '┈': { [Style.NORMAL]: Shapes.FOUR_DASHES_HORIZONTAL },\n  '┉': { [Style.BOLD]:   Shapes.FOUR_DASHES_HORIZONTAL },\n  '╎': { [Style.NORMAL]: Shapes.TWO_DASHES_VERTICAL },\n  '╏': { [Style.BOLD]:   Shapes.TWO_DASHES_VERTICAL },\n  '┆': { [Style.NORMAL]: Shapes.THREE_DASHES_VERTICAL  },\n  '┇': { [Style.BOLD]:   Shapes.THREE_DASHES_VERTICAL },\n  '┊': { [Style.NORMAL]: Shapes.FOUR_DASHES_VERTICAL },\n  '┋': { [Style.BOLD]:   Shapes.FOUR_DASHES_VERTICAL },\n\n  // Curved\n  '╭': { [Style.NORMAL]: 'C.5,1,.5,.5,1,.5' },\n  '╮': { [Style.NORMAL]: 'C.5,1,.5,.5,0,.5' },\n  '╯': { [Style.NORMAL]: 'C.5,0,.5,.5,0,.5' },\n  '╰': { [Style.NORMAL]: 'C.5,0,.5,.5,1,.5' }\n};\n\n/**\n * Try drawing a custom block element or box drawing character, returning whether it was\n * successfully drawn.\n */\nexport function tryDrawCustomChar(\n  ctx: CanvasRenderingContext2D,\n  c: string,\n  xOffset: number,\n  yOffset: number,\n  scaledCellWidth: number,\n  scaledCellHeight: number\n): boolean {\n  const blockElementDefinition = blockElementDefinitions[c];\n  if (blockElementDefinition) {\n    drawBlockElementChar(ctx, blockElementDefinition, xOffset, yOffset, scaledCellWidth, scaledCellHeight);\n    return true;\n  }\n\n  const patternDefinition = patternCharacterDefinitions[c];\n  if (patternDefinition) {\n    drawPatternChar(ctx, patternDefinition, xOffset, yOffset, scaledCellWidth, scaledCellHeight);\n    return true;\n  }\n\n  const boxDrawingDefinition = boxDrawingDefinitions[c];\n  if (boxDrawingDefinition) {\n    drawBoxDrawingChar(ctx, boxDrawingDefinition, xOffset, yOffset, scaledCellWidth, scaledCellHeight);\n    return true;\n  }\n\n  return false;\n}\n\nfunction drawBlockElementChar(\n  ctx: CanvasRenderingContext2D,\n  charDefinition: IBlockVector[],\n  xOffset: number,\n  yOffset: number,\n  scaledCellWidth: number,\n  scaledCellHeight: number\n): void {\n  for (let i = 0; i < charDefinition.length; i++) {\n    const box = charDefinition[i];\n    const xEighth = scaledCellWidth / 8;\n    const yEighth = scaledCellHeight / 8;\n    ctx.fillRect(\n      xOffset + box.x * xEighth,\n      yOffset + box.y * yEighth,\n      box.w * xEighth,\n      box.h * yEighth\n    );\n  }\n}\n\nconst cachedPatterns: Map<PatternDefinition, Map</* fillStyle */string, CanvasPattern>> = new Map();\n\nfunction drawPatternChar(\n  ctx: CanvasRenderingContext2D,\n  charDefinition: number[][],\n  xOffset: number,\n  yOffset: number,\n  scaledCellWidth: number,\n  scaledCellHeight: number\n): void {\n  let patternSet = cachedPatterns.get(charDefinition);\n  if (!patternSet) {\n    patternSet = new Map();\n    cachedPatterns.set(charDefinition, patternSet);\n  }\n  const fillStyle = ctx.fillStyle;\n  if (typeof fillStyle !== 'string') {\n    throw new Error(`Unexpected fillStyle type \"${fillStyle}\"`);\n  }\n  let pattern = patternSet.get(fillStyle);\n  if (!pattern) {\n    const width = charDefinition[0].length;\n    const height = charDefinition.length;\n    const tmpCanvas = document.createElement('canvas');\n    tmpCanvas.width = width;\n    tmpCanvas.height = height;\n    const tmpCtx = throwIfFalsy(tmpCanvas.getContext('2d'));\n    const imageData = new ImageData(width, height);\n\n    // Extract rgba from fillStyle\n    let r: number;\n    let g: number;\n    let b: number;\n    let a: number;\n    if (fillStyle.startsWith('#')) {\n      r = parseInt(fillStyle.substr(1, 2), 16);\n      g = parseInt(fillStyle.substr(3, 2), 16);\n      b = parseInt(fillStyle.substr(5, 2), 16);\n      a = fillStyle.length > 7 && parseInt(fillStyle.substr(7, 2), 16) || 1;\n    } else if (fillStyle.startsWith('rgba')) {\n      ([r, g, b, a] = fillStyle.substring(5, fillStyle.length - 1).split(',').map(e => parseFloat(e)));\n    } else {\n      throw new Error(`Unexpected fillStyle color format \"${fillStyle}\" when drawing pattern glyph`);\n    }\n\n    for (let y = 0; y < height; y++) {\n      for (let x = 0; x < width; x++) {\n        imageData.data[(y * width + x) * 4    ] = r;\n        imageData.data[(y * width + x) * 4 + 1] = g;\n        imageData.data[(y * width + x) * 4 + 2] = b;\n        imageData.data[(y * width + x) * 4 + 3] = charDefinition[y][x] * (a * 255);\n      }\n    }\n    tmpCtx.putImageData(imageData, 0, 0);\n    pattern = throwIfFalsy(ctx.createPattern(tmpCanvas, null));\n    patternSet.set(fillStyle, pattern);\n  }\n  ctx.fillStyle = pattern;\n  ctx.fillRect(xOffset, yOffset, scaledCellWidth, scaledCellHeight);\n}\n\n/**\n * Draws the following box drawing characters by mapping a subset of SVG d attribute instructions to\n * canvas draw calls.\n *\n * Box styles:       ┎┰┒┍┯┑╓╥╖╒╤╕ ┏┳┓┌┲┓┌┬┐┏┱┐\n * ┌─┬─┐ ┏━┳━┓ ╔═╦═╗ ┠╂┨┝┿┥╟╫╢╞╪╡ ┡╇┩├╊┫┢╈┪┣╉┤\n * │ │ │ ┃ ┃ ┃ ║ ║ ║ ┖┸┚┕┷┙╙╨╜╘╧╛ └┴┘└┺┛┗┻┛┗┹┘\n * ├─┼─┤ ┣━╋━┫ ╠═╬═╣ ┏┱┐┌┲┓┌┬┐┌┬┐ ┏┳┓┌┮┓┌┬┐┏┭┐\n * │ │ │ ┃ ┃ ┃ ║ ║ ║ ┡╃┤├╄┩├╆┪┢╅┤ ┞╀┦├┾┫┟╁┧┣┽┤\n * └─┴─┘ ┗━┻━┛ ╚═╩═╝ └┴┘└┴┘└┺┛┗┹┘ └┴┘└┶┛┗┻┛┗┵┘\n *\n * Other:\n * ╭─╮ ╲ ╱ ╷╻╎╏┆┇┊┋ ╺╾╴ ╌╌╌ ┄┄┄ ┈┈┈\n * │ │  ╳  ╽╿╎╏┆┇┊┋ ╶╼╸ ╍╍╍ ┅┅┅ ┉┉┉\n * ╰─╯ ╱ ╲ ╹╵╎╏┆┇┊┋\n *\n * All box drawing characters:\n * ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏\n * ┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟\n * ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯\n * ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿\n * ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏\n * ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟\n * ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯\n * ╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿\n *\n * ---\n *\n * Box drawing alignment tests:                                          █\n *                                                                       ▉\n *   ╔══╦══╗  ┌──┬──┐  ╭──┬──╮  ╭──┬──╮  ┏━━┳━━┓  ┎┒┏┑   ╷  ╻ ┏┯┓ ┌┰┐    ▊ ╱╲╱╲╳╳╳\n *   ║┌─╨─┐║  │╔═╧═╗│  │╒═╪═╕│  │╓─╁─╖│  ┃┌─╂─┐┃  ┗╃╄┙  ╶┼╴╺╋╸┠┼┨ ┝╋┥    ▋ ╲╱╲╱╳╳╳\n *   ║│╲ ╱│║  │║   ║│  ││ │ ││  │║ ┃ ║│  ┃│ ╿ │┃  ┍╅╆┓   ╵  ╹ ┗┷┛ └┸┘    ▌ ╱╲╱╲╳╳╳\n *   ╠╡ ╳ ╞╣  ├╢   ╟┤  ├┼─┼─┼┤  ├╫─╂─╫┤  ┣┿╾┼╼┿┫  ┕┛┖┚     ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳\n *   ║│╱ ╲│║  │║   ║│  ││ │ ││  │║ ┃ ║│  ┃│ ╽ │┃  ░░▒▒▓▓██ ┊  ┆ ╎ ╏  ┇ ┋ ▎\n *   ║└─╥─┘║  │╚═╤═╝│  │╘═╪═╛│  │╙─╀─╜│  ┃└─╂─┘┃  ░░▒▒▓▓██ ┊  ┆ ╎ ╏  ┇ ┋ ▏\n *   ╚══╩══╝  └──┴──┘  ╰──┴──╯  ╰──┴──╯  ┗━━┻━━┛           └╌╌┘ ╎ ┗╍╍┛ ┋  ▁▂▃▄▅▆▇█\n *\n * Source: https://www.w3.org/2001/06/utf-8-test/UTF-8-demo.html\n */\nfunction drawBoxDrawingChar(\n  ctx: CanvasRenderingContext2D,\n  charDefinition: { [fontWeight: number]: string | ((xp: number, yp: number) => string) },\n  xOffset: number,\n  yOffset: number,\n  scaledCellWidth: number,\n  scaledCellHeight: number\n): void {\n  ctx.strokeStyle = ctx.fillStyle;\n  for (const [fontWeight, instructions] of Object.entries(charDefinition)) {\n    ctx.beginPath();\n    ctx.lineWidth = window.devicePixelRatio * Number.parseInt(fontWeight);\n    let actualInstructions: string;\n    if (typeof instructions === 'function') {\n      const xp = .15;\n      const yp = .15 / scaledCellHeight * scaledCellWidth;\n      actualInstructions = instructions(xp, yp);\n    } else {\n      actualInstructions = instructions;\n    }\n    for (const instruction of actualInstructions.split(' ')) {\n      const type = instruction[0];\n      const f = svgToCanvasInstructionMap[type];\n      if (!f) {\n        console.error(`Could not find drawing instructions for \"${type}\"`);\n        continue;\n      }\n      const args: string[] = instruction.substring(1).split(',');\n      if (!args[0] || !args[1]) {\n        continue;\n      }\n      f(ctx, translateArgs(args, scaledCellWidth, scaledCellHeight, xOffset, yOffset));\n    }\n    ctx.stroke();\n    ctx.closePath();\n  }\n}\n\nfunction clamp(value: number, max: number, min: number = 0): number {\n  return Math.max(Math.min(value, max), min);\n}\n\nconst svgToCanvasInstructionMap: { [index: string]: any } = {\n  'C': (ctx: CanvasRenderingContext2D, args: number[]) => ctx.bezierCurveTo(args[0], args[1], args[2], args[3], args[4], args[5]),\n  'L': (ctx: CanvasRenderingContext2D, args: number[]) => ctx.lineTo(args[0], args[1]),\n  'M': (ctx: CanvasRenderingContext2D, args: number[]) => ctx.moveTo(args[0], args[1])\n};\n\nfunction translateArgs(args: string[], cellWidth: number, cellHeight: number, xOffset: number, yOffset: number): number[] {\n  const result = args.map(e => parseFloat(e) || parseInt(e));\n\n  if (result.length < 2) {\n    throw new Error('Too few arguments for instruction');\n  }\n\n  for (let x = 0; x < result.length; x += 2) {\n    // Translate from 0-1 to 0-cellWidth\n    result[x] *= cellWidth;\n    // Ensure coordinate doesn't escape cell bounds and round to the nearest 0.5 to ensure a crisp\n    // line at 100% devicePixelRatio\n    if (result[x] !== 0) {\n      result[x] = clamp(Math.round(result[x] + 0.5) - 0.5, cellWidth, 0);\n    }\n    // Apply the cell's offset (ie. x*cellWidth)\n    result[x] += xOffset;\n  }\n\n  for (let y = 1; y < result.length; y += 2) {\n    // Translate from 0-1 to 0-cellHeight\n    result[y] *= cellHeight;\n    // Ensure coordinate doesn't escape cell bounds and round to the nearest 0.5 to ensure a crisp\n    // line at 100% devicePixelRatio\n    if (result[y] !== 0) {\n      result[y] = clamp(Math.round(result[y] + 0.5) - 0.5, cellHeight, 0);\n    }\n    // Apply the cell's offset (ie. x*cellHeight)\n    result[y] += yOffset;\n  }\n\n  return result;\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport class GridCache<T> {\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    @IBufferService bufferService: IBufferService,\n    @IOptionsService 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, IRequestRedrawEvent } from 'browser/renderer/Types';\nimport { LinkRenderLayer } from 'browser/renderer/LinkRenderLayer';\nimport { Disposable } from 'common/Lifecycle';\nimport { IColorSet, ILinkifier, ILinkifier2 } from 'browser/Types';\nimport { ICharSizeService, ICoreBrowserService } from 'browser/services/Services';\nimport { IBufferService, IOptionsService, ICoreService, IInstantiationService } 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\n  public dimensions: IRenderDimensions;\n\n  private _onRequestRedraw = new EventEmitter<IRequestRedrawEvent>();\n  public get onRequestRedraw(): IEvent<IRequestRedrawEvent> { return this._onRequestRedraw.event; }\n\n  constructor(\n    private _colors: IColorSet,\n    private readonly _screenElement: HTMLElement,\n    linkifier: ILinkifier,\n    linkifier2: ILinkifier2,\n    @IInstantiationService instantiationService: IInstantiationService,\n    @IBufferService private readonly _bufferService: IBufferService,\n    @ICharSizeService private readonly _charSizeService: ICharSizeService,\n    @IOptionsService private readonly _optionsService: IOptionsService\n  ) {\n    super();\n    const allowTransparency = this._optionsService.options.allowTransparency;\n    this._renderLayers = [\n      instantiationService.createInstance(TextRenderLayer, this._screenElement, 0, this._colors, allowTransparency, this._id),\n      instantiationService.createInstance(SelectionRenderLayer, this._screenElement, 1, this._colors, this._id),\n      instantiationService.createInstance(LinkRenderLayer, this._screenElement, 2, this._colors, this._id, linkifier, linkifier2),\n      instantiationService.createInstance(CursorRenderLayer, this._screenElement, 3, this._colors, this._id, this._onRequestRedraw)\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  public clearTextureAtlas(): void {\n    for (const layer of this._renderLayers) {\n      layer.clearTextureAtlas();\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","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function throwIfFalsy<T>(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    @IBufferService bufferService: IBufferService,\n    @IOptionsService 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 { 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 { IColorSet } from 'browser/Types';\nimport { CellData } from 'common/buffer/CellData';\nimport { IOptionsService, IBufferService } from 'common/services/Services';\nimport { ICharacterJoinerService } from 'browser/services/Services';\nimport { JoinedCellData } from 'browser/services/CharacterJoinerService';\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<CharData>;\n  private _characterWidth: number = 0;\n  private _characterFont: string = '';\n  private _characterOverlapCache: { [key: string]: boolean } = {};\n  private _workCell = new CellData();\n\n  constructor(\n    container: HTMLElement,\n    zIndex: number,\n    colors: IColorSet,\n    alpha: boolean,\n    rendererId: number,\n    @IBufferService bufferService: IBufferService,\n    @IOptionsService optionsService: IOptionsService,\n    @ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService\n  ) {\n    super(container, 'text', zIndex, alpha, colors, rendererId, bufferService, optionsService);\n    this._state = new GridCache<CharData>();\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    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 = this._characterJoinerService.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          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, (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, (cell, x, y) => {\n      if (cell.isInvisible()) {\n        return;\n      }\n      this._drawChars(cell, x, y);\n      if (cell.isUnderline() || cell.isStrikethrough()) {\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        if (cell.isStrikethrough()) {\n          this._fillMiddleLineAtCells(x, y, cell.getWidth());\n        }\n        if (cell.isUnderline()) {\n          this._fillBottomLineAtCells(x, y, cell.getWidth());\n        }\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  public clear(): 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: IPartialColorSet = {\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\nimport { isFirefox } from 'common/Platform';\n\nexport const INVERTED_DEFAULT_COLOR = 257;\nexport const DIM_OPACITY = 0.5;\n// The text baseline is set conditionally by browser. Using 'ideographic' for Firefox 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 ? 'bottom' : 'ideographic';\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, TEXT_BASELINE } 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<IGlyphCacheValue>;\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 clear(): void {\n    if (this._cacheMap.size > 0) {\n      const capacity = this._width * this._height;\n      this._cacheMap = new LRUMap(capacity);\n      this._cacheMap.prealloc(capacity);\n    }\n    this._cacheCtx.clearRect(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT);\n    this._tmpCtx.clearRect(0, 0, this._config.scaledCharWidth, this._config.scaledCharHeight);\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 = TEXT_BASELINE;\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);\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    let 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    // If this charcater is underscore and empty, shift it up until it is visible, try for a maximum\n    // of 5 pixels.\n    if (isEmpty && glyph.chars === '_' && !this._config.allowTransparency) {\n      for (let offset = 1; offset <= 5; offset++) {\n        // Draw the character\n        this._tmpCtx.fillText(glyph.chars, 0, this._config.scaledCharHeight - offset);\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        imageData = this._tmpCtx.getImageData(\n          0, 0, this._config.scaledCharWidth, this._config.scaledCharHeight\n        );\n        isEmpty = clearColor(imageData, backgroundColor);\n        if (!isEmpty) {\n          break;\n        }\n      }\n    }\n\n    this._tmpCtx.restore();\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<T> {\n  prev: ILinkedListNode<T> | null;\n  next: ILinkedListNode<T> | null;\n  key: number | null;\n  value: T | null;\n}\n\nexport class LRUMap<T> {\n  private _map: { [key: number]: ILinkedListNode<T> } = {};\n  private _head: ILinkedListNode<T> | null = null;\n  private _tail: ILinkedListNode<T> | null = null;\n  private _nodePool: ILinkedListNode<T>[] = [];\n  public size: number = 0;\n\n  constructor(public capacity: number) { }\n\n  private _unlinkNode(node: ILinkedListNode<T>): 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<T>): 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, 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, IInstantiationService } 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<IRequestRedrawEvent> { return new EventEmitter<IRequestRedrawEvent>().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    @IInstantiationService instantiationService: IInstantiationService,\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 = instantiationService.createInstance(DomRendererRowFactory, document, 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, 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  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] 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 } 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 { ICoreService, IOptionsService } from 'common/services/Services';\nimport { color, rgba } from 'browser/Color';\nimport { IColorSet, IColor } from 'browser/Types';\nimport { ICharacterJoinerService } from 'browser/services/Services';\nimport { JoinedCellData } from 'browser/services/CharacterJoinerService';\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  constructor(\n    private readonly _document: Document,\n    private _colors: IColorSet,\n    @ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService,\n    @IOptionsService private readonly _optionsService: IOptionsService,\n    @ICoreService private readonly _coreService: ICoreService\n  ) {\n  }\n\n  public setColors(colors: IColorSet): void {\n    this._colors = colors;\n  }\n\n  public createRow(lineData: IBufferLine, row: number, isCursorRow: boolean, cursorStyle: string | undefined, cursorX: number, cursorBlink: boolean, cellWidth: number, cols: number): DocumentFragment {\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    for (let x = 0; 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      if (width === 0) {\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.isUnderline()) {\n        charElement.classList.add(UNDERLINE_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.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      // Foreground\n      switch (fgColorMode) {\n        case Attributes.CM_P16:\n        case Attributes.CM_P256:\n          if (cell.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      x = lastCharX;\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        // 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        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<void>();\n  public get onCharSizeChange(): IEvent<void> { 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) 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  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 } 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, IRenderDebouncer } 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: IRenderDebouncer;\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<IRenderDimensions>();\n  public get onDimensionsChange(): IEvent<IRenderDimensions> { 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 clearTextureAtlas(): void {\n    this._renderer?.clearTextureAtlas?.();\n    this._fullRefresh();\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","/**\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 } from 'browser/services/Services';\nimport { 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 } 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 _onLinuxMouseSelection = this.register(new EventEmitter<string>());\n  public get onLinuxMouseSelection(): IEvent<string> { return this._onLinuxMouseSelection.event; }\n  private _onRedrawRequest = this.register(new EventEmitter<ISelectionRedrawRequestEvent>());\n  public get onRequestRedraw(): IEvent<ISelectionRedrawRequestEvent> { return this._onRedrawRequest.event; }\n  private _onSelectionChange = this.register(new EventEmitter<void>());\n  public get onSelectionChange(): IEvent<void> { return this._onSelectionChange.event; }\n  private _onRequestScrollLines = this.register(new EventEmitter<ISelectionRequestScrollLinesEvent>());\n  public get onRequestScrollLines(): IEvent<ISelectionRequestScrollLinesEvent> { return 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  ) {\n    super();\n\n    // Init listeners\n    this._mouseMoveListener = event => this._onMouseMove(event as MouseEvent);\n    this._mouseUpListener = event => this._onMouseUp(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._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?.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, 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 _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 word.\n   * @param event The mouse event.\n   */\n  private _onDoubleClick(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 _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      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);\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 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 } 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<ICharSizeService>('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<void>;\n\n  measure(): void;\n}\n\nexport const ICoreBrowserService = createDecorator<ICoreBrowserService>('CoreBrowserService');\nexport interface ICoreBrowserService {\n  serviceBrand: undefined;\n\n  readonly isFocused: boolean;\n}\n\nexport const IMouseService = createDecorator<IMouseService>('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<IRenderService>('RenderService');\nexport interface IRenderService extends IDisposable {\n  serviceBrand: undefined;\n\n  onDimensionsChange: IEvent<IRenderDimensions>;\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  clearTextureAtlas(): 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}\n\nexport const ISelectionService = createDecorator<ISelectionService>('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<string>;\n  readonly onRequestRedraw: IEvent<ISelectionRequestRedrawEvent>;\n  readonly onRequestScrollLines: IEvent<ISelectionRequestScrollLinesEvent>;\n  readonly onSelectionChange: IEvent<void>;\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<ISoundService>('SoundService');\nexport interface ISoundService {\n  serviceBrand: undefined;\n\n  playBellSound(): void;\n}\n\n\nexport const ICharacterJoinerService = createDecorator<ICharacterJoinerService>('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","/**\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 as any).AudioContext || (window as any).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<T> implements ICircularList<T> {\n  protected _array: (T | undefined)[];\n  private _startIndex: number;\n  private _length: number;\n\n  public onDeleteEmitter = new EventEmitter<IDeleteEvent>();\n  public get onDelete(): IEvent<IDeleteEvent> { return this.onDeleteEmitter.event; }\n  public onInsertEmitter = new EventEmitter<IInsertEvent>();\n  public get onInsert(): IEvent<IInsertEvent> { return this.onInsertEmitter.event; }\n  public onTrimEmitter = new EventEmitter<number>();\n  public get onTrim(): IEvent<number> { return this.onTrimEmitter.event; }\n\n  constructor(\n    private _maxLength: number\n  ) {\n    this._array = new Array<T>(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<T | undefined>(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<T>(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) 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, LogLevelEnum, ITerminalOptions } 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, IBufferLine, IAttributeData, ICoreTerminal, IKeyboardEvent, IScrollEvent, ScrollSource, ITerminalOptions as IPublicTerminalOptions } 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\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 _dirtyRowService: IDirtyRowService;\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 _onBinary = new EventEmitter<string>();\n  public get onBinary(): IEvent<string> { return this._onBinary.event; }\n  private _onData = new EventEmitter<string>();\n  public get onData(): IEvent<string> { return this._onData.event; }\n  protected _onLineFeed = new EventEmitter<void>();\n  public get onLineFeed(): IEvent<void> { 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<IScrollEvent, void>();\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<number, void>;\n  public get onScroll(): IEvent<number, void> {\n    if (!this._onScrollApi) {\n      this._onScrollApi = new EventEmitter<number, void>();\n      this.register(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(): ITerminalOptions { 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<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    this.register(this._bufferService.onScroll(event => {\n      this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: ScrollSource.TERMINAL });\n      this._dirtyRowService.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._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);\n    }));\n\n    // Setup WriteBuffer\n    this._writeBuffer = new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult));\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  /**\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 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<boolean>): 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<boolean>): 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<boolean>): 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<boolean>): IDisposable {\n    return this._inputHandler.registerOscHandler(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.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<T, U = void> {\n  (arg1: T, arg2: U): void;\n}\n\nexport interface IEvent<T, U = void> {\n  (listener: (arg1: T, arg2: U) => any): IDisposable;\n}\n\nexport interface IEventEmitter<T, U = void> {\n  event: IEvent<T, U>;\n  fire(arg1: T, arg2: U): void;\n  dispose(): void;\n}\n\nexport class EventEmitter<T, U = void> implements IEventEmitter<T, U> {\n  private _listeners: IListener<T, U>[] = [];\n  private _event?: IEvent<T, U>;\n  private _disposed: boolean = false;\n\n  public get event(): IEvent<T, U> {\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<T, U>[] = [];\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<T>(from: IEvent<T>, to: IEventEmitter<T>): 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 { 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, LogLevelEnum } 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 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// create a warning log if an async handler takes longer than the limit (in ms)\nconst SLOW_ASYNC_LIMIT = 5000;\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 _activeBuffer: IBuffer;\n\n  private _onRequestBell = new EventEmitter<void>();\n  public get onRequestBell(): IEvent<void> { return this._onRequestBell.event; }\n  private _onRequestRefreshRows = new EventEmitter<number, number>();\n  public get onRequestRefreshRows(): IEvent<number, number> { return this._onRequestRefreshRows.event; }\n  private _onRequestReset = new EventEmitter<void>();\n  public get onRequestReset(): IEvent<void> { return this._onRequestReset.event; }\n  private _onRequestSendFocus = new EventEmitter<void>();\n  public get onRequestSendFocus(): IEvent<void> { return this._onRequestSendFocus.event; }\n  private _onRequestSyncScrollBar = new EventEmitter<void>();\n  public get onRequestSyncScrollBar(): IEvent<void> { return this._onRequestSyncScrollBar.event; }\n  private _onRequestWindowsOptionsReport = new EventEmitter<WindowsOptionsReportType>();\n  public get onRequestWindowsOptionsReport(): IEvent<WindowsOptionsReportType> { return this._onRequestWindowsOptionsReport.event; }\n\n  private _onA11yChar = new EventEmitter<string>();\n  public get onA11yChar(): IEvent<string> { return this._onA11yChar.event; }\n  private _onA11yTab = new EventEmitter<number>();\n  public get onA11yTab(): IEvent<number> { return this._onA11yTab.event; }\n  private _onCursorMove = new EventEmitter<void>();\n  public get onCursorMove(): IEvent<void> { return this._onCursorMove.event; }\n  private _onLineFeed = new EventEmitter<void>();\n  public get onLineFeed(): IEvent<void> { return this._onLineFeed.event; }\n  private _onScroll = new EventEmitter<number>();\n  public get onScroll(): IEvent<number> { return this._onScroll.event; }\n  private _onTitleChange = new EventEmitter<string>();\n  public get onTitleChange(): IEvent<string> { return this._onTitleChange.event; }\n  private _onColor = new EventEmitter<IColorEvent>();\n  public get onColor(): IEvent<IColorEvent> { return 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 _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    // 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));\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.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    //  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 DECRQSS(this._bufferService, this._coreService, this._logService, this._optionsService));\n  }\n\n  public dispose(): void {\n    super.dispose();\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<boolean>): 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  /**\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\\<boolean\\>:\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<boolean> {\n    let result: void | Promise<boolean>;\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}\"` : ''}`, 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._dirtyRowService.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._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 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 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n\n    this._dirtyRowService.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\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._dirtyRowService.markDirty(this._activeBuffer.y);\n  }\n\n  /**\n   * Forward registerCsiHandler from parser.\n   */\n  public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<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 registerDcsHandler from parser.\n   */\n  public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): 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<boolean>): 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<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    this._dirtyRowService.markDirty(this._activeBuffer.y);\n    if (this._optionsService.options.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._dirtyRowService.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.options.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._dirtyRowService.markDirty(this._activeBuffer.y);\n  }\n\n  /**\n   * Set absolute cursor position.\n   */\n  private _setCursor(x: number, y: number): void {\n    this._dirtyRowService.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._dirtyRowService.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  /**\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   * @param cleanWrap clear the isWrapped flag\n   */\n  private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: 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    );\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._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n    line.fill(this._activeBuffer.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(this._bufferService.cols);\n    let j;\n    switch (params.params[0]) {\n      case 0:\n        j = this._activeBuffer.y;\n        this._dirtyRowService.markDirty(j);\n        this._eraseInBufferLine(j++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.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._activeBuffer.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._activeBuffer.x + 1, true);\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);\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._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: #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(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);\n        break;\n      case 1:\n        this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false);\n        break;\n      case 2:\n        this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true);\n        break;\n    }\n    this._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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._dirtyRowService.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.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          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 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 (strikethrough).                  | #Y      |\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 (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   * | 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 === 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      } 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.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._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; <data> 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; <data> 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; <num> ; <text> ST (set ANSI color <num> to <text>)\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  // 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 ; <xcolor name>|<?> 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:<red>/<green>/<blue>` for  `<red>, <green>, <blue>` 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 ; <xcolor name>|<?> 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 ; <xcolor name>|<?> 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 ; <num> ST - restore ANSI color <num>\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._dirtyRowService.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._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<T extends IDisposable>(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<T extends IDisposable>(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<T extends TypedArray>(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<T extends TypedArray>(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<T extends TypedArray>(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  public isStrikethrough(): number { return this.fg & FgFlags.STRIKETHROUGH; }\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<IBufferLine>;\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<IBufferLine>(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<IBufferLine>(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) 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 newCols The columns after resize.\n */\nexport function reflowLargerGetLinesToRemove(lines: CircularList<IBufferLine>, 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<IBufferLine>, 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<IBufferLine>, 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    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 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..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 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<void>();\n  public get onDispose(): IEvent<void> { 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        // <Ctrl> or <Shift> + <Insert> 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 <Esc> 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          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\n// queueMicrotask polyfill for nodejs < v11\nconst qmt: (cb: () => void) => void = (typeof queueMicrotask === 'undefined')\n  ? (cb: () => void) => { Promise.resolve().then(cb); }\n  : queueMicrotask;\n\n\nexport class WriteBuffer {\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\n  constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise<boolean>) { }\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      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          qmt(() => {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  }\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]{1})\\/([\\da-f]{1})\\/([\\da-f]{1})$|^([\\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:<red>/<green>/<blue> with <red>, <green>, <blue> 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<IDcsHandler> = 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<boolean> {\n    if (!this._active.length) {\n      this._handlerFb(this._ident, 'UNHOOK', success);\n    } else {\n      let handlerResult: boolean | Promise<boolean> = 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<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 | Promise<boolean> {\n    let ret: boolean | Promise<boolean> = 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 } 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<CsiHandlerType>;\n  protected _escHandlers: IHandlerCollection<EscHandlerType>;\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  // 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._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  /**\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<void> {\n   *   for (const chunk of chunks) {\n   *     let result: void | Promise<boolean>;\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<boolean> {\n    let code = 0;\n    let transition = 0;\n    let start = 0;\n    let handlerResult: void | boolean | Promise<boolean>;\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<IOscHandler> = 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<boolean> {\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<boolean> = 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<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 | Promise<boolean> {\n    let ret: boolean | Promise<boolean> = 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 { IEvent, EventEmitter } from 'common/EventEmitter';\nimport { ICoreTerminal } from 'common/Types';\n\nexport class BufferNamespaceApi implements IBufferNamespaceApi {\n  private _normal: BufferApiView;\n  private _alternate: BufferApiView;\n  private _onBufferChange = new EventEmitter<IBufferApi>();\n  public get onBufferChange(): IEvent<IBufferApi> { return 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<boolean>): IDisposable {\n    return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));\n  }\n  public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise<boolean>): IDisposable {\n    return this.registerCsiHandler(id, callback);\n  }\n  public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise<boolean>): 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<boolean>): IDisposable {\n    return this.registerDcsHandler(id, callback);\n  }\n  public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise<boolean>): IDisposable {\n    return this._core.registerEscHandler(id, handler);\n  }\n  public addEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise<boolean>): IDisposable {\n    return this.registerEscHandler(id, handler);\n  }\n  public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable {\n    return this._core.registerOscHandler(ident, callback);\n  }\n  public addOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): 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, 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 _onResize = new EventEmitter<{ cols: number, rows: number }>();\n  public get onResize(): IEvent<{ cols: number, rows: number }> { return this._onResize.event; }\n  private _onScroll = new EventEmitter<number>();\n  public get onScroll(): IEvent<number> { return 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(\n    @IOptionsService private _optionsService: IOptionsService\n  ) {\n    super();\n    this.cols = Math.max(_optionsService.options.cols || 0, MINIMUM_COLS);\n    this.rows = Math.max(_optionsService.options.rows || 0, 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   * 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.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';\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<CoreMouseEventType>();\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<CoreMouseEventType> {\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<string>());\n  public get onData(): IEvent<string> { return this._onData.event; }\n  private _onUserInput = this.register(new EventEmitter<void>());\n  public get onUserInput(): IEvent<void> { return this._onUserInput.event; }\n  private _onBinary = this.register(new EventEmitter<string>());\n  public get onBinary(): IEvent<string> { 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<IServiceIdentifier<any>, any>();\n\n  constructor(...entries: [IServiceIdentifier<any>, any][]) {\n    for (const [id, service] of entries) {\n      this.set(id, service);\n    }\n  }\n\n  public set<T>(id: IServiceIdentifier<T>, 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<any>, instance: any) => any): void {\n    this._entries.forEach((value, key) => callback(key, value));\n  }\n\n  public has(id: IServiceIdentifier<any>): boolean {\n    return this._entries.has(id);\n  }\n\n  public get<T>(id: IServiceIdentifier<T>): 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<T>(id: IServiceIdentifier<T>, instance: T): void {\n    this._services.set(id, instance);\n  }\n\n  public getService<T>(id: IServiceIdentifier<T>): T | undefined {\n    return this._services.get(id);\n  }\n\n  public createInstance<T>(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, 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 implements ILogService {\n  public serviceBrand: any;\n\n  public logLevel: LogLevelEnum = LogLevelEnum.OFF;\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 <= 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';\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\nexport const DEFAULT_OPTIONS: Readonly<ITerminalOptions> = {\n  cols: 80,\n  rows: 24,\n  cursorBlink: false,\n  cursorStyle: 'block',\n  cursorWidth: 1,\n  customGlyphs: true,\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<FontWeight, string>[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\n\nexport class OptionsService implements IOptionsService {\n  public serviceBrand: any;\n\n  private _options: ITerminalOptions;\n  public options: ITerminalOptions;\n\n  private _onOptionChange = new EventEmitter<string>();\n  public get onOptionChange(): IEvent<string> { return this._onOptionChange.event; }\n\n  constructor(options: Partial<ITerminalOptions>) {\n    // set the default value of each option\n    this._options = { ...DEFAULT_OPTIONS };\n    for (const key in options) {\n      if (key in this._options) {\n        try {\n          const newValue = options[key];\n          this._options[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.options = this._setupOptions(this._options);\n  }\n\n  private _setupOptions(options: ITerminalOptions): ITerminalOptions {\n    const copiedOptions = { ... options };\n    for (const propName in copiedOptions) {\n      Object.defineProperty(copiedOptions, propName, {\n        get: () => {\n          if (!(propName in DEFAULT_OPTIONS)) {\n            throw new Error(`No option with key \"${propName}\"`);\n          }\n          return this._options[propName];\n        },\n        set: (value: any) => {\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._options[propName] !== value) {\n            this._options[propName] = value;\n            this._onOptionChange.fire(propName);\n          }\n        }\n      });\n    }\n    return copiedOptions;\n  }\n\n  public setOption(key: string, value: any): void {\n    this.options[key] = value;\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      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  public getOption(key: string): any {\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<string, IServiceIdentifier<any>> = new Map();\n\nexport function getServiceDependencies(ctor: any): { id: IServiceIdentifier<any>, index: number, optional: boolean }[] {\n  return ctor[DI_DEPENDENCIES] || [];\n}\n\nexport function createDecorator<T>(id: string): IServiceIdentifier<T> {\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, IAttributeData, ScrollSource } from 'common/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\n\nexport const IBufferService = createDecorator<IBufferService>('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<number>;\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<ICoreMouseService>('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<CoreMouseEventType>;\n\n  /**\n   * Human readable version of mouse events.\n   */\n  explainEvents(events: CoreMouseEventType): { [event: string]: boolean };\n}\n\nexport const ICoreService = createDecorator<ICoreService>('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<string>;\n  readonly onUserInput: IEvent<void>;\n  readonly onBinary: IEvent<string>;\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<ICharsetService>('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<IDirtyRowService>('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<T> {\n  (...args: any[]): void;\n  type: T;\n}\n\nexport interface IBrandedService {\n  serviceBrand: undefined;\n}\n\ntype GetLeadingNonServiceArgs<Args> =\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<IInstantiationService>('InstantiationService');\nexport interface IInstantiationService {\n  serviceBrand: undefined;\n\n  setService<T>(id: IServiceIdentifier<T>, instance: T): void;\n  getService<T>(id: IServiceIdentifier<T>): T | undefined;\n  createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(t: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): 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<ILogService>('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<IOptionsService>('OptionsService');\nexport interface IOptionsService {\n  serviceBrand: undefined;\n\n  readonly options: ITerminalOptions;\n\n  readonly onOptionChange: IEvent<string>;\n\n  setOption<T>(key: string, value: T): void;\n  getOption<T>(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';\n\nexport type RendererType = 'dom' | 'canvas';\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  convertEol: boolean;\n  cursorBlink: boolean;\n  cursorStyle: 'block' | 'underline' | 'bar';\n  cursorWidth: number;\n  customGlyphs: boolean;\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  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<IUnicodeService>('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<string>;\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<string>();\n  public get onChange(): IEvent<string> { 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\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, ILinkMatcherOptions, ITheme, ILocalizableStrings, ITerminalAddon, ISelectionPosition, IBufferNamespace as IBufferNamespaceApi, IParser, ILinkProvider, IUnicodeHandling, FontWeight, IModes } from 'xterm';\nimport { 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: ITerminalOptions;\n\n  constructor(options?: ITerminalOptions) {\n    this._core = new TerminalCore(options);\n    this._addonManager = new AddonManager();\n\n    this._publicOptions = {};\n    for (const propName in this._core.options) {\n      Object.defineProperty(this._publicOptions, propName, {\n        get: () => {\n          return this._core.options[propName];\n        },\n        set: (value: any) => {\n          this._checkReadonlyOptions(propName);\n          this._core.options[propName] = value;\n        }\n      });\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.options.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<void> { return this._core.onBell; }\n  public get onBinary(): IEvent<string> { return this._core.onBinary; }\n  public get onCursorMove(): IEvent<void> { return this._core.onCursorMove; }\n  public get onData(): IEvent<string> { return this._core.onData; }\n  public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }\n  public get onLineFeed(): IEvent<void> { 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<number> { return this._core.onScroll; }\n  public get onSelectionChange(): IEvent<void> { return this._core.onSelectionChange; }\n  public get onTitleChange(): IEvent<string> { return this._core.onTitleChange; }\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<IMarker> {\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(): ITerminalOptions {\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 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._checkReadonlyOptions(key);\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 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"],"names":["root","factory","exports","module","define","amd","a","i","self","_terminal","_renderService","_liveRegionLineCount","_charsToConsume","_charsToAnnounce","_accessibilityTreeRoot","document","createElement","setAttribute","classList","add","tabIndex","_rowContainer","_rowElements","rows","_createAccessibilityTreeNode","appendChild","_topBoundaryFocusListener","e","_onBoundaryFocus","_bottomBoundaryFocusListener","addEventListener","length","_refreshRowsDimensions","_renderRowsDebouncer","TimeBasedDebouncer","_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","_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","toColorRGB","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","_updateRestoreColors","onOptionsChange","setTheme","theme","_parseColor","selection","black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite","restoreColor","slot","_restoreColors","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","_currentLink","registerLinkProvider","linkProvider","providerIndex","mouseService","renderService","_mouseService","_clearCurrentLink","_onMouseMove","_onClick","_lastMouseEvent","_positionFromMouseEvent","composedPath","contains","_lastBufferCell","_onHover","_askForLink","_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","RenderDebouncer","_currentDevicePixelRatio","devicePixelRatio","listener","_listener","clearListener","_outerListener","_updateDpr","_resolutionMediaMatchList","removeListener","matchMedia","addListener","browser","Browser","_keyDownHandled","_keyPressHandled","_unprocessedDeadKey","_onCursorMove","_onRender","_onSelectionChange","_onTitleChange","_onBell","_onFocus","_onBlur","_onA11yCharEmitter","_onA11yTabEmitter","_setup","linkifier","_instantiationService","createInstance","linkifier2","_inputHandler","onRequestBell","bell","onRequestRefreshRows","onRequestSendFocus","_reportFocus","onRequestReset","reset","onRequestWindowsOptionsReport","_reportWindowsOptions","onColor","_handleColorEvent","forwardEvent","onCursorMove","onTitleChange","_afterResize","_colorManager","req","acc","ident","C0","ESC","toRgbString","BEL","setColors","viewport","onThemeChange","_isDisposed","_customKeyEventHandler","write","buffers","active","preventScroll","_updateOptions","_charSizeService","measure","setRenderer","_createRenderer","syncScrollArea","optionsService","screenReaderMode","_accessibilityManager","setupTabStops","_setTheme","_onTextAreaFocus","sendFocus","updateCursorStyle","_showCursor","blur","_onTextAreaBlur","_syncTextArea","isCursorInViewport","_compositionHelper","isComposing","cursorY","ybase","bufferLine","cursorX","cellHeight","getWidth","cellWidth","actualCellWidth","cursorTop","cursorLeft","lineHeight","_initGlobal","_bindKeys","hasSelection","copyHandler","pasteHandlerWrapper","handlePasteEvent","isFirefox","button","rightClickHandler","rightClickSelectsWord","isLinux","_keyUp","_keyDown","_keyPress","compositionstart","compositionupdate","compositionend","_inputEvent","updateCompositionElements","_queueLinkification","parent","isConnected","_document","ownerDocument","dir","fragment","createDocumentFragment","_viewportElement","_viewportScrollArea","_helperContainer","coreBrowserService","CoreBrowserService","setService","ICoreBrowserService","CharSizeService","ICharSizeService","_theme","onOptionChange","_characterJoinerService","CharacterJoinerService","ICharacterJoinerService","renderer","RenderService","IRenderService","resize","_compositionView","CompositionHelper","_soundService","SoundService","ISoundService","MouseService","Viewport","amount","onRequestSyncScrollBar","onFocus","SelectionService","onRequestScrollLines","suppressScrollEvent","onSelectionChange","onRequestRedraw","onSelectionChanged","columnSelectMode","onLinuxMouseSelection","_onScroll","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","deregister","markers","addMarker","cursorYOffset","normal","column","setSelection","getSelection","getSelectionPosition","startColumn","selectionStart","endColumn","selectionEnd","clearSelection","selectAll","selectLines","keydown","scrollToBottom","evaluateKeyboardEvent","macOptionIsMeta","scrollCount","_isThirdLevelShift","ETX","CR","domEvent","thirdLevelKey","metaKey","isWindows","getModifierState","keyCode","wasModifierKeyOnlyEvent","charCode","which","String","fromCharCode","inputType","composed","_soundBell","playBellSound","hasValidSize","getBlankLine","DEFAULT_ATTR_DATA","clearTextureAtlas","WindowsOptionsReportType","GET_WIN_SIZE_PIXELS","canvasWidth","scaledCanvasWidth","toFixed","canvasHeight","scaledCanvasHeight","GET_CELL_SIZE_PIXELS","scaledCellWidth","scaledCellHeight","force","cancelEvents","_visualBell","bellStyle","CoreTerminal","Terminal","_debounceThresholdMS","_lastRefreshMs","_additionalRefreshRequested","_refreshTimeoutID","refreshRequestTime","Date","now","elapsed","waitPeriodBeforeTrailingRefresh","_scrollLines","_scrollArea","scrollBarWidth","_currentRowHeight","_currentScaledCellHeight","_lastRecordedBufferLength","_lastRecordedViewportHeight","_lastRecordedBufferHeight","_lastTouchY","_lastScrollTop","_lastHadScrollBar","_wheelPartialScroll","_refreshAnimationFrame","_ignoreNextScrollEvent","offsetWidth","_activeBuffer","onBufferActivate","activeBuffer","_renderDimensions","backgroundColor","_refresh","immediate","offsetHeight","newBufferHeight","scrollTop","scrollback","elementStyle","getComputedStyle","elementPadding","paddingLeft","paddingRight","offsetParent","diff","_bubbleScroll","scrollPosFromTop","cancelable","_getPixelsScrolled","_applyScrollModifier","deltaMode","WheelEvent","DOM_DELTA_LINE","DOM_DELTA_PAGE","DOM_DELTA_PIXEL","modifier","fastScrollModifier","fastScrollSensitivity","scrollSensitivity","touches","_textarea","_coreService","_isComposing","_isSendingComposition","_compositionPosition","_dataAlreadySent","_finalizeComposition","_handleAnyTextareaChanges","waitForPropagation","input","oldValue","dontRecurse","fontFamily","fontSize","compositionViewBounds","ICoreService","getCoordsRelativeToElement","rect","colCount","hasValidCharSize","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","_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","_fillMiddleLineAtCells","cellOffset","_fillBottomLineAtCells","_fillLeftLineAtCell","_strokeRectAtCell","lineWidth","strokeRect","clearRect","_clearCells","_fillCharTrueColor","cell","font","_getFont","textBaseline","TEXT_BASELINE","_clipRow","drawSuccess","customGlyphs","tryDrawCustomChar","getChars","fillText","_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","join","globalAlpha","DIM_OPACITY","restore","beginPath","clip","fontWeightBold","fontWeight","minimumContrastRatio","adjustedColor","fgColor","fgColorMode","getFgColorMode","bgColor","bgColorMode","getBgColorMode","temp","temp2","_resolveBackgroundRgba","_resolveForegroundRgba","inverse","BaseRenderLayer","BLINK_INTERVAL","container","rendererId","_onRequestRedraw","_coreBrowserService","_cell","CellData","_state","isFocused","_cursorRenderers","_renderBarCursor","_renderBlockCursor","_renderUnderlineCursor","_cursorBlinkStateManager","_clearCursor","restartBlinkAnimation","pause","resume","cursorBlink","CursorBlinkStateManager","_render","isPaused","triggeredByAnimationFrame","isCursorHidden","viewportRelativeCursorY","loadCell","cursorStyle","_renderBlurCursor","isCursorVisible","cursorWidth","strokeStyle","CursorRenderLayer","_restartInterval","_blinkStartTimeout","_blinkInterval","clearInterval","_animationTimeRestarted","timeToStart","time","setInterval","blockElementDefinitions","w","h","patternCharacterDefinitions","boxDrawingDefinitions","xp","yp","xOffset","yOffset","blockElementDefinition","charDefinition","box","xEighth","yEighth","drawBlockElementChar","patternDefinition","patternSet","cachedPatterns","pattern","tmpCanvas","tmpCtx","imageData","ImageData","startsWith","substr","parseFloat","putImageData","createPattern","drawPatternChar","boxDrawingDefinition","entries","instructions","instruction","f","svgToCanvasInstructionMap","args","translateArgs","error","stroke","closePath","drawBoxDrawingChar","clamp","bezierCurveTo","lineTo","moveTo","cache","GridCache","onShowLinkUnderline","onHideLinkUnderline","middleRowCount","is256Color","LinkRenderLayer","nextRendererId","instantiationService","_id","_renderLayers","TextRenderLayer","SelectionRenderLayer","_devicePixelRatio","_updateDimensions","removeTerminalFromCache","onDevicePixelRatioChange","l","onCharSizeChanged","_runOperation","operation","renderRows","letterSpacing","IInstantiationService","_clearState","_didStateChange","viewportStartRow","viewportEndRow","viewportCappedStartRow","viewportCappedEndRow","startRowEndCol","middleRowsCount","_areCoordinatesEqual","coord1","coord2","_characterWidth","_characterFont","_characterOverlapCache","_workCell","terminalFont","_forEachCell","firstRow","lastRow","callback","joinedRanges","getJoinedCharacters","isJoined","lastCharX","JoinedCellData","translateToString","_isOverlapping","getCodePoint","NULL_CELL_CODE","_drawBackground","prevFillStyle","nextFillStyle","isBgPalette","_drawForeground","isInvisible","isUnderline","isStrikethrough","beginFrame","hasOwnProperty","overlaps","measureText","_didWarmUp","_doWarmUp","BaseCharAtlas","charAtlasCache","newConfig","generateConfig","ownedByIndex","entry","ownedBy","configEquals","config","atlas","newEntry","DynamicCharAtlas","clonedColors","colorCode","CHAR_ATLAS_CELL_SPACING","TEXTURE_WIDTH","TEXTURE_HEIGHT","TRANSPARENT_COLOR","getGlyphCacheKey","glyph","_config","_drawToCacheCount","_glyphsWaitingOnBitmap","_bitmapCommitTimeout","_bitmap","_cacheCanvas","_cacheCtx","_tmpCtx","_width","_height","capacity","_cacheMap","LRUMap","prealloc","_canCache","glyphKey","cacheValue","_drawFromCache","peek","_drawToCache","_toCoordinateX","_toCoordinateY","isEmpty","cacheX","cacheY","drawImage","inBitmap","_getColorFromAnsiIndex","idx","_getBackgroundColor","_getForegroundColor","fontStyle","clearColor","offset","_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","STRIKETHROUGH_CLASS","isCursorRow","lineLength","charElement","display","_applyMinimumContrast","_addStyle","padStart","padChar","isSelectAllActive","selectionStartLength","areSelectionValuesReversed","startPlusLength","onTrim","SelectionModel","_onCharSizeChange","_measureStrategy","DomMeasureStrategy","_parentElement","_result","_measureElement","geometry","firstCell","combinedData","isCombined","setFromCharData","getAsCharData","_characterJoiners","_nextCharacterJoinerId","joiner","ranges","lineStr","rangeStartColumn","currentStringIndex","rangeStartStringIndex","rangeAttrFG","rangeAttrBG","getBg","getTrimmedLength","_getJoinedRanges","startIndex","endIndex","allJoinedRanges","joinerRanges","_mergeRanges","_stringRangesToCellRanges","currentRangeIndex","currentRangeStarted","currentRange","getString","newRange","inRange","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","allowWhitespaceOnlySelection","getRangeLength","_selectWordAt","_getMouseEventScrollAmount","terminalHeight","macOptionClickForcesSelection","timeStamp","_onIncrementalClick","detail","_onSingleClick","_onDoubleClick","_onTripleClick","_addMouseDownListeners","_dragScrollIntervalTimer","_dragScroll","hasWidth","_selectLineAt","previousSelectionEnd","_selectToWordAt","timeElapsed","getOption","coordinates","moveToCellSequence","_fireEventIfSelectionChanged","_fireOnSelectionChange","_convertViewportColToCharacterIndex","charIndex","_getWordAt","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","hasWriteSyncWarnHappened","_onBinary","_onData","_onLineFeed","InstantiationService","OptionsService","BufferService","LogService","CoreService","CoreMouseService","ICoreMouseService","_dirtyRowService","DirtyRowService","IDirtyRowService","unicodeService","UnicodeService","_charsetService","CharsetService","ICharsetService","InputHandler","onData","onBinary","markRangeDirty","scrollBottom","_writeBuffer","WriteBuffer","promiseResult","parse","_onScrollApi","_windowsMode","writeSync","maxSubsequentCalls","LogLevelEnum","WARN","isNaN","MINIMUM_COLS","MINIMUM_ROWS","scroll","eraseAttr","scrollPages","pageCount","scrollToTop","scrollToLine","registerEscHandler","registerDcsHandler","registerCsiHandler","registerOscHandler","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","params","put","concat","subarray","unhook","success","utf32ToString","pt","_coreMouseService","_parser","EscapeSequenceParser","_parseBuffer","_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","setCsiHandlerFallback","identifier","identToString","toArray","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","LF","lineFeed","VT","FF","carriageReturn","BS","backspace","HT","tab","SO","shiftOut","SI","shiftIn","C1","IND","NEL","nextLine","HTS","tabSet","OscHandler","setTitle","setIconName","setOrReportIndexedColor","setOrReportFgColor","setOrReportBgColor","setOrReportCursorColor","restoreIndexedColor","restoreFgColor","restoreBgColor","restoreCursorColor","reverseIndex","keypadApplicationMode","keypadNumericMode","fullReset","setgLevel","selectDefaultCharset","flag","selectCharset","CHARSETS","screenAlignmentPattern","setErrorHandler","DECRQSS","_preserveStack","_logSlowResolvingAsync","p","Promise","race","res","rej","catch","err","wasPaused","DEBUG","clearRange","decode","chWidth","charset","wraparoundMode","wraparound","insertMode","modes","curAttr","bufferRow","markDirty","setCellFromCodePoint","extended","wcwidth","ch","stringFromCodePoint","_eraseAttrData","insertCells","getNullCell","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","savedX","savedY","savedCurAttrData","savedCharset","isBlinking","bottom","second","_savedCharset","slots","spec","parseColor","_setOrReportSpecialColor","collectAndFlag","scrollRegionHeight","level","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","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","newLine","destLineIndex","destCol","srcLineIndex","srcCol","cellsToCopy","copyCellsFrom","wrappedLinesIndex","getWrappedLineTrimmedLength","setCell","insertEvents","originalLines","originalLinesLength","originalLineIndex","nextToInsertIndex","nextToInsert","countInsertedSoFar","nextI","insertCountEmitted","lineIndex","trimRight","CHAR_DATA_WIDTH_INDEX","CHAR_DATA_CHAR_INDEX","tabStopWidth","marker","Marker","onInsert","onDelete","onDispose","_removeMarker","startOverscan","endOverscan","BufferStringIterator","Buffer","_buffer","_trimRight","_endIndex","_startOverscan","_endOverscan","_current","fillCellData","_combined","_extendedAttrs","cp","CHAR_DATA_ATTR_INDEX","codePoint","eAttrs","keys","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","_normal","_alt","inactiveBuffer","BufferSet","obj","combined","DEFAULT_ATTR","_nextId","isDisposed","_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","applicationCursorMode","modifiers","keyMapping","codepoint","_interim","startPos","interim","byte1","byte2","byte3","byte4","discardInterim","tmp","missing","fourStop","table","BMP_COMBINING","HIGH_COMBINING","version","num","ucs","mid","bisearch","UnicodeV6","qmt","queueMicrotask","cb","resolve","_action","_callbacks","_pendingData","_bufferOffset","_isSyncWriting","_syncCalls","chunk","_innerWrite","lastTime","startTime","RGB_REX","HASH_REX","pad","bits","s2","low","toLowerCase","m","base","adv","PAYLOAD_LIMIT","EMPTY_HANDLERS","_handlers","create","_active","_ident","_handlerFb","_stack","loopPosition","fallThrough","registerHandler","handlerList","handlerIndex","clearHandler","setHandlerFallback","handlerResult","DcsParser","EMPTY_PARAMS","Params","addParam","_handler","_params","_hitLimit","ret","setDefault","addMany","codes","TransitionTable","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","_errorHandler","_identifier","finalRange","intermediate","finalCode","reverse","clearPrintHandler","clearEscHandler","clearExecuteHandler","clearCsiHandler","clearDcsHandler","clearOscHandler","clearErrorHandler","collect","abort","addSubParam","addDigit","handlersEsc","jj","_start","_put","MAX_VALUE","maxSubParamsLength","Int32Array","_subParams","_subParamsLength","_subParamsIdx","Uint16Array","_rejectDigits","_rejectSubDigits","_digitIsSub","fromArray","values","k","newParams","prototype","getSubParamsAll","store","cur","_addons","instance","loadAddon","terminal","loadedAddon","_wrappedAddonDispose","AddonManager","init","getLine","BufferLineApiView","BufferApiView","_line","getCell","_core","_onBufferChange","_alternate","alternate","BufferNamespaceApi","addCsiHandler","addDcsHandler","addEscHandler","addOscHandler","ParserApi","provider","versions","activeVersion","UnicodeApi","isUserScrolling","_cachedBlankLine","topRow","bottomRow","willBufferBeTrimmed","isFull","oldYdisp","scrollAmount","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","_end","_entries","service","ServiceCollection","_services","getService","ctor","serviceDependencies","getServiceDependencies","sort","serviceArgs","dependency","firstServiceArgPos","optionsKeyToLogLevel","info","INFO","ERROR","off","OFF","_updateLogLevel","_evalLazyOptionalParams","optionalParams","_log","message","log","DEFAULT_BELL_SOUND","DEFAULT_OPTIONS","allowProposedApi","altClickMovesCursor","FONT_WEIGHT_OPTIONS","_onOptionChange","_options","newValue","_sanitizeAndValidateOption","_setupOptions","copiedOptions","propName","defineProperty","setOption","storeServiceDependency","serviceRegistry","decorator","arguments","_providers","_onChange","defaultProvider","_activeProvider","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","CONSTRUCTOR_ONLY_OPTIONS","_addonManager","_publicOptions","_checkReadonlyOptions","_checkProposedApi","onBell","mouseTrackingMode","applicationCursorKeysMode","applicationKeypadMode","originMode","reverseWraparoundMode","sendFocusMode","columns","_verifyIntegers","registerMarker","writeUtf8","writeln","addon","Infinity"],"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,I,miBCJT,gBAEA,UACA,UACA,SACA,UACA,UACA,UAUO,IAAMC,EAAoB,uBAA1B,cAAmC,EAAAC,WA4BxC,WAAAC,CACmBC,EACD,GAEhBC,QAHiB,KAAAD,UAAAA,EACgB,KAAAE,eAAAA,EAvB3B,KAAAC,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8iE,MAAM5tB,aAAavkC,EAC1B,CACO,KAAAtH,GACLrJ,KAAK8iE,MAAMz5D,OACb,CACO,KAAAgrC,CAAMxyB,EAA2BnR,GACtC1Q,KAAK8iE,MAAMzuB,MAAMxyB,EAAMnR,EACzB,CACO,OAAA88D,CAAQ3rD,EAA2BnR,GACxC1Q,KAAK8iE,MAAMzuB,MAAMxyB,GACjB7hB,KAAK8iE,MAAMzuB,MAAM,OAAQ3jC,EAC3B,CACO,KAAA5J,CAAM+a,GACX7hB,KAAK8iE,MAAMh8D,MAAM+a,EACnB,CACO,OAAA3d,CAAQlC,EAAeC,GAC5BjC,KAAKstE,gBAAgBtrE,EAAOC,GAC5BjC,KAAK8iE,MAAM5+D,QAAQlC,EAAOC,EAC5B,CACO,KAAAiV,GACLlX,KAAK8iE,MAAM5rD,OACb,CACO,iBAAAsO,GACLxlB,KAAK8iE,MAAMt9C,mBACb,CACO,SAAAu8C,CAAU0L,GACfztE,KAAKssE,cAAcvK,UAAU/hE,KAAMytE,EACrC,CACO,kBAAWC,GAChB,OAAOhqE,CACT,CAEQ,eAAA4pE,IAAmBjjB,GACzB,IAAK,MAAM/iD,KAAS+iD,EAClB,GAAI/iD,IAAUqmE,KAAYj5B,MAAMptC,IAAUA,EAAQ,GAAM,EACtD,MAAM,IAAI5F,MAAM,iCAGtB,CAEQ,uBAAA6rE,IAA2BljB,GACjC,IAAK,MAAM/iD,KAAS+iD,EAClB,GAAI/iD,IAAUA,IAAUqmE,KAAYj5B,MAAMptC,IAAUA,EAAQ,GAAM,GAAKA,EAAQ,GAC7E,MAAM,IAAI5F,MAAM,0CAGtB,EA5OF,Y","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/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/dom/WidthCache.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, () => {\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 { isMac } from 'common/Platform';\nimport { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { ScreenDprMonitor } from 'browser/ScreenDprMonitor';\nimport { IRenderService } from 'browser/services/Services';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IBuffer } from 'common/buffer/Types';\n\nconst MAX_ROWS_TO_READ = 20;\n\nconst enum BoundaryPosition {\n  TOP,\n  BOTTOM\n}\n\nexport class AccessibilityManager extends Disposable {\n  private _accessibilityContainer: HTMLElement;\n\n  private _rowContainer: HTMLElement;\n  private _rowElements: HTMLElement[];\n\n  private _liveRegion: HTMLElement;\n  private _liveRegionLineCount: number = 0;\n  private _liveRegionDebouncer: IRenderDebouncer;\n\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    @IRenderService private readonly _renderService: IRenderService\n  ) {\n    super();\n    this._accessibilityContainer = document.createElement('div');\n    this._accessibilityContainer.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._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._accessibilityContainer.appendChild(this._rowContainer);\n\n    this._liveRegion = document.createElement('div');\n    this._liveRegion.classList.add('live-region');\n    this._liveRegion.setAttribute('aria-live', 'assertive');\n    this._accessibilityContainer.appendChild(this._liveRegion);\n    this._liveRegionDebouncer = this.register(new TimeBasedDebouncer(this._renderRows.bind(this)));\n\n    if (!this._terminal.element) {\n      throw new Error('Cannot enable accessibility before Terminal.open');\n    }\n    this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityContainer);\n\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\n    this._refreshRows();\n    this.register(toDisposable(() => {\n      this._accessibilityContainer.remove();\n      this._rowElements.length = 0;\n    }));\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._accessibilityContainer.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      this._liveRegion.remove();\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._liveRegionDebouncer.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 _announceCharacters(): void {\n    if (this._charsToAnnounce.length === 0) {\n      return;\n    }\n    this._liveRegion.textContent += this._charsToAnnounce;\n    this._charsToAnnounce = '';\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  private _refreshRowsDimensions(): void {\n    if (!this._renderService.dimensions.css.cell.height) {\n      return;\n    }\n    this._accessibilityContainer.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  private _refreshRowDimensions(element: HTMLElement): void {\n    element.style.height = `${this._renderService.dimensions.css.cell.height}px`;\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, IOptionsService } 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, optionsService: IOptionsService): void {\n  ev.stopPropagation();\n  if (ev.clipboardData) {\n    const text = ev.clipboardData.getData('text/plain');\n    paste(text, textarea, coreService, optionsService);\n  }\n}\n\nexport function paste(text: string, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n  text = prepareTextForTerminal(text);\n  text = bracketTextForPaste(text, coreService.decPrivateModes.bracketedPasteMode && optionsService.rawOptions.ignoreBracketedPasteMode !== true);\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</* bg */number, /* fg */number, IColor | null> = new TwoKeyMap();\n  private _css: TwoKeyMap</* bg */number, /* fg */number, string | null> = 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) 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 { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IBufferCellPosition, ILink, ILinkDecorations, ILinkProvider, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'browser/Types';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable, disposeArray, getDisposeArrayDisposable, toDisposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { IBufferService } from 'common/services/Services';\nimport { IMouseService, IRenderService } from './services/Services';\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 _wasResized: boolean = false;\n  private _activeProviderReplies: Map<Number, ILinkWithState[] | undefined> | undefined;\n  private _activeLine: number = -1;\n\n  private readonly _onShowLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());\n  public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;\n  private readonly _onHideLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());\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    // Listen to resize to catch the case where it's resized and the cursor is out of the viewport.\n    this.register(this._bufferService.onResize(() => {\n      this._clearCurrentLink();\n      this._wasResized = true;\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\n    //       should be something like `activeRange: {startY, endY}`\n    // Check if we need to clear the link\n    if (this._activeLine !== position.y || this._wasResized) {\n      this._clearCurrentLink();\n      this._askForLink(position, false);\n      this._wasResized = 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<Number, ILinkWithState[] | undefined>): void {\n    const occupiedCells = new Set<number>();\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      // Listen to viewport changes to re-render the link under the cursor (only when the line the\n      // link is on changes)\n      if (this._renderService) {\n        this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e => {\n          // Sanity check, this shouldn't happen in practice as this listener would be disposed\n          if (!this._currentLink) {\n            return;\n          }\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 end = this._bufferService.buffer.ydisp + 1 + e.end;\n          // Only clear the link if the viewport change happened on this line\n          if (this._currentLink.link.range.start.y >= start && this._currentLink.link.range.end.y <= end) {\n            this._clearCurrentLink(start, end);\n            if (this._lastMouseEvent && this._element) {\n              // re-eval previously active link after changes\n              const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService!);\n              if (position) {\n                this._askForLink(position, false);\n              }\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\n    //       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 { copyHandler, handlePasteEvent, moveTextAreaUnderMouseCursor, paste, rightClickHandler } from 'browser/Clipboard';\nimport { addDisposableDomListener } from 'browser/Lifecycle';\nimport { Linkifier2 } from 'browser/Linkifier2';\nimport * as Strings from 'browser/LocalizableStrings';\nimport { OscLinkProvider } from 'browser/OscLinkProvider';\nimport { CharacterJoinerHandler, CustomKeyEventHandler, IBrowser, IBufferRange, ICompositionHelper, ILinkifier2, ITerminal, IViewport } from 'browser/Types';\nimport { Viewport } from 'browser/Viewport';\nimport { BufferDecorationRenderer } from 'browser/decorations/BufferDecorationRenderer';\nimport { OverviewRulerRenderer } from 'browser/decorations/OverviewRulerRenderer';\nimport { CompositionHelper } from 'browser/input/CompositionHelper';\nimport { DomRenderer } from 'browser/renderer/dom/DomRenderer';\nimport { IRenderer } from 'browser/renderer/shared/Types';\nimport { CharSizeService } from 'browser/services/CharSizeService';\nimport { CharacterJoinerService } from 'browser/services/CharacterJoinerService';\nimport { CoreBrowserService } from 'browser/services/CoreBrowserService';\nimport { MouseService } from 'browser/services/MouseService';\nimport { RenderService } from 'browser/services/RenderService';\nimport { SelectionService } from 'browser/services/SelectionService';\nimport { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';\nimport { ThemeService } from 'browser/services/ThemeService';\nimport { color, rgba } from 'common/Color';\nimport { CoreTerminal } from 'common/CoreTerminal';\nimport { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';\nimport { MutableDisposable, toDisposable } from 'common/Lifecycle';\nimport * as Browser from 'common/Platform';\nimport { ColorRequestType, CoreMouseAction, CoreMouseButton, CoreMouseEventType, IColorEvent, ITerminalOptions, KeyboardResultType, ScrollSource, SpecialColorIndex } from 'common/Types';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IBuffer } from 'common/buffer/Types';\nimport { C0, C1_ESCAPED } from 'common/data/EscapeSequences';\nimport { evaluateKeyboardEvent } from 'common/input/Keyboard';\nimport { toRgbString } from 'common/input/XParseColor';\nimport { DecorationService } from 'common/services/DecorationService';\nimport { IDecorationService } from 'common/services/Services';\nimport { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker } from 'xterm';\nimport { WindowsOptionsReportType } from '../common/InputHandler';\nimport { AccessibilityManager } from './AccessibilityManager';\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  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: MutableDisposable<AccessibilityManager> = this.register(new MutableDisposable());\n\n  private readonly _onCursorMove = this.register(new EventEmitter<void>());\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<void>());\n  public readonly onSelectionChange = this._onSelectionChange.event;\n  private readonly _onTitleChange = this.register(new EventEmitter<string>());\n  public readonly onTitleChange = this._onTitleChange.event;\n  private readonly _onBell = this.register(new EventEmitter<void>());\n  public readonly onBell = this._onBell.event;\n\n  private _onFocus = this.register(new EventEmitter<void>());\n  public get onFocus(): IEvent<void> { return this._onFocus.event; }\n  private _onBlur = this.register(new EventEmitter<void>());\n  public get onBlur(): IEvent<void> { return this._onBlur.event; }\n  private _onA11yCharEmitter = this.register(new EventEmitter<string>());\n  public get onA11yChar(): IEvent<string> { return this._onA11yCharEmitter.event; }\n  private _onA11yTabEmitter = this.register(new EventEmitter<number>());\n  public get onA11yTab(): IEvent<number> { return this._onA11yTabEmitter.event; }\n  private _onWillOpen = this.register(new EventEmitter<HTMLElement>());\n  public get onWillOpen(): IEvent<HTMLElement> { return this._onWillOpen.event; }\n\n  constructor(\n    options: Partial<ITerminalOptions> = {}\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 SpecialColorIndex.FOREGROUND: // OSC 10 | 110\n          acc = 'foreground';\n          ident = '10';\n          break;\n        case SpecialColorIndex.BACKGROUND: // OSC 11 | 111\n          acc = 'background';\n          ident = '11';\n          break;\n        case SpecialColorIndex.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.value && this._renderService) {\n        this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n      }\n    } else {\n      this._accessibilityManager.clear();\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, this.optionsService);\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    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, this._viewportElement, this._viewportScrollArea);\n    this.viewport.onRequestScrollLines(e => this.scrollLines(e.amount, e.suppressScrollEvent, ScrollSource.VIEWPORT)),\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.value = this._instantiationService.createInstance(AccessibilityManager, this);\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        el.removeEventListener('mouseup', requestedEvents.mouseup!);\n        requestedEvents.mouseup = null;\n      } else if (!requestedEvents.mouseup) {\n        el.addEventListener('mouseup', eventListeners.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    if (source === ScrollSource.VIEWPORT) {\n      super.scrollLines(disp, suppressScrollEvent, source);\n      this.refresh(0, this.rows - 1);\n    } else {\n      this.viewport?.scrollLines(disp);\n    }\n  }\n\n  public paste(data: string): void {\n    paste(data, this.textarea!, this.coreService, this.optionsService);\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 registerMarker(cursorYOffset: number): IMarker {\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.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    // IMPORTANT: Fire scroll event before viewport is reset. This ensures embedders get the clear\n    // scroll event and that the viewport's state will be valid for immediate writes.\n    this._onScroll.fire({ position: this.buffer.ydisp, source: ScrollSource.TERMINAL });\n    this.viewport?.reset();\n    this.refresh(0, this.rows - 1);\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    this.viewport?.reset();\n\n    // reattach\n    this._customKeyEventHandler = customKeyEventHandler;\n\n    // do a full screen refresh\n    this.refresh(0, this.rows - 1);\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 { addDisposableDomListener } from 'browser/Lifecycle';\nimport { IViewport, ReadonlyColorSet } from 'browser/Types';\nimport { IRenderDimensions } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\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  private readonly _onRequestScrollLines = this.register(new EventEmitter<{ amount: number, suppressScrollEvent: boolean }>());\n  public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n  constructor(\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\n    // case, 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());\n  }\n\n  private _handleThemeChange(colors: ReadonlyColorSet): void {\n    this._viewportElement.style.backgroundColor = colors.background.css;\n  }\n\n  public reset(): void {\n    this._currentRowHeight = 0;\n    this._currentDeviceCellHeight = 0;\n    this._lastRecordedBufferLength = 0;\n    this._lastRecordedViewportHeight = 0;\n    this._lastRecordedBufferHeight = 0;\n    this._lastTouchY = 0;\n    this._lastScrollTop = 0;\n    // Sync on next animation frame to ensure the new terminal state is used\n    this._coreBrowserService.window.requestAnimationFrame(() => this.syncScrollArea());\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._onRequestScrollLines.fire({ amount: 0, suppressScrollEvent: true });\n      return;\n    }\n\n    const newRow = Math.round(this._lastScrollTop / this._currentRowHeight);\n    const diff = newRow - this._bufferService.buffer.ydisp;\n    this._onRequestScrollLines.fire({ amount: diff, suppressScrollEvent: true });\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  public scrollLines(disp: number): void {\n    if (disp === 0) {\n      return;\n    }\n    if (!this._optionsService.rawOptions.smoothScrollDuration) {\n      this._onRequestScrollLines.fire({ amount: disp, suppressScrollEvent: false });\n    } else {\n      const amount = disp * this._currentRowHeight;\n      this._smoothScrollState.startTime = Date.now();\n      if (this._smoothScrollPercent() < 1) {\n        this._smoothScrollState.origin = this._viewportElement.scrollTop;\n        this._smoothScrollState.target = this._smoothScrollState.origin + amount;\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  }\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  public getBufferElements(startLine: number, endLine?: number): { bufferElements: HTMLElement[], cursorElement?: HTMLElement } {\n    let currentLine: string = '';\n    let cursorElement: HTMLElement | undefined;\n    const bufferElements: HTMLElement[] = [];\n    const end = endLine ?? this._bufferService.buffer.lines.length;\n    const lines = this._bufferService.buffer.lines;\n    for (let i = startLine; i < end; i++) {\n      const line = lines.get(i);\n      if (!line) {\n        continue;\n      }\n      const isWrapped = lines.get(i + 1)?.isWrapped;\n      currentLine += line.translateToString(!isWrapped);\n      if (!isWrapped || i === lines.length - 1) {\n        const div = document.createElement('div');\n        div.textContent = currentLine;\n        bufferElements.push(div);\n        if (currentLine.length > 0) {\n          cursorElement = div;\n        }\n        currentLine = '';\n      }\n    }\n    return { bufferElements, cursorElement };\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<IInternalDecoration, HTMLElement> = 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.classList.toggle('xterm-decoration-top-layer', decoration?.options?.layer === 'top');\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        decoration.onDispose(() => {\n          this._decorationElements.delete(decoration);\n          element!.remove();\n        });\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<IInternalDecoration['marker'], 'line'>;\n  options: Pick<IInternalDecoration['options'], 'overviewRulerOptions'>;\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<CompositionEvent, 'data'>): 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<Window, 'getComputedStyle'>, 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<Window, 'getComputedStyle'>, event: Pick<MouseEvent, 'clientX' | 'clientY'>, 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 { DomRendererRowFactory, RowCss } from 'browser/renderer/dom/DomRendererRowFactory';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\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\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/**\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 _widthCache: WidthCache;\n\n  public dimensions: IRenderDimensions;\n\n  public readonly onRequestRedraw = this.register(new EventEmitter<IRequestRedrawEvent>()).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 private readonly _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(this._themeService.onChangeColors(e => this._injectCss(e)));\n    this._injectCss(this._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      this._rowContainer.remove();\n      this._selectionContainer.remove();\n      this._widthCache.dispose();\n      this._themeStyleElement.remove();\n      this._dimensionsStyleElement.remove();\n    }));\n\n    this._widthCache = new WidthCache(document);\n    this._widthCache.setFont(\n      this._optionsService.rawOptions.fontFamily,\n      this._optionsService.rawOptions.fontSize,\n      this._optionsService.rawOptions.fontWeight,\n      this._optionsService.rawOptions.fontWeightBold\n    );\n    this._setDefaultSpacing();\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;` +   // TODO: find workaround for inline-block (creates ~20% render penalty)\n      ` height: 100%;` +\n      ` vertical-align: top;` +\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      ` font-kerning: none;` +\n      ` white-space: pre` +\n      `}`;\n    styles +=\n      `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .xterm-dim {` +\n      ` color: ${color.multiplyOpacity(colors.foreground, 0.5).css};` +\n      `}`;\n    // Text styles\n    styles +=\n      `${this._terminalSelector} span:not(.${RowCss.BOLD_CLASS}) {` +\n      ` font-weight: ${this._optionsService.rawOptions.fontWeight};` +\n      `}` +\n      `${this._terminalSelector} span.${RowCss.BOLD_CLASS} {` +\n      ` font-weight: ${this._optionsService.rawOptions.fontWeightBold};` +\n      `}` +\n      `${this._terminalSelector} span.${RowCss.ITALIC_CLASS} {` +\n      ` font-style: italic;` +\n      `}`;\n    // Blink animation\n    styles +=\n      `@keyframes blink_box_shadow` + `_` + this._terminalClass + ` {` +\n      ` 50% {` +\n      `  border-bottom-style: hidden;` +\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: inherit;` +\n      `  color: ${colors.cursor.css};` +\n      ` }` +\n      `}`;\n    // Cursor\n    styles +=\n      `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}:not(.${RowCss.CURSOR_STYLE_BLOCK_CLASS}) {` +\n      ` animation: blink_box_shadow` + `_` + this._terminalClass + ` 1s step-end infinite;` +\n      `}` +\n      `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n      ` animation: blink_block` + `_` + this._terminalClass + ` 1s step-end infinite;` +\n      `}` +\n      `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n      ` background-color: ${colors.cursor.css};` +\n      ` color: ${colors.cursorAccent.css};` +\n      `}` +\n      `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_OUTLINE_CLASS} {` +\n      ` outline: 1px solid ${colors.cursor.css};` +\n      ` outline-offset: -1px;` +\n      `}` +\n      `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.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} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n      ` border-bottom: 1px ${colors.cursor.css};` +\n      ` border-bottom-style: solid;` +\n      ` height: calc(100% - 1px);` +\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} .${FG_CLASS_PREFIX}${i}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(c, 0.5).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} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(color.opaque(colors.background), 0.5).css}; }` +\n      `${this._terminalSelector} .${BG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { background-color: ${colors.foreground.css}; }`;\n\n    this._themeStyleElement.textContent = styles;\n  }\n\n  /**\n   * default letter spacing\n   * Due to rounding issues in dimensions dpr calc glyph might render\n   * slightly too wide or too narrow. The method corrects the stacking offsets\n   * by applying a default letter-spacing for all chars.\n   * The value gets passed to the row factory to avoid setting this value again\n   * (render speedup is roughly 10%).\n   */\n  private _setDefaultSpacing(): void {\n    // measure same char as in CharSizeService to get the base deviation\n    const spacing = this.dimensions.css.cell.width - this._widthCache.get('W', false, false);\n    this._rowContainer.style.letterSpacing = `${spacing}px`;\n    this._rowFactory.defaultSpacing = spacing;\n  }\n\n  public handleDevicePixelRatioChange(): void {\n    this._updateDimensions();\n    this._widthCache.clear();\n    this._setDefaultSpacing();\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    this._widthCache.clear();\n    this._setDefaultSpacing();\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    this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y);\n  }\n\n  public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n    // Remove all selections\n    this._selectionContainer.replaceChildren();\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    // Refresh CSS\n    this._injectCss(this._themeService.colors);\n    // update spacing cache\n    this._widthCache.setFont(\n      this._optionsService.rawOptions.fontFamily,\n      this._optionsService.rawOptions.fontSize,\n      this._optionsService.rawOptions.fontWeight,\n      this._optionsService.rawOptions.fontWeightBold\n    );\n    this._setDefaultSpacing();\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\n       * `@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 buffer = this._bufferService.buffer;\n    const cursorAbsoluteY = buffer.ybase + buffer.y;\n    const cursorX = Math.min(buffer.x, this._bufferService.cols - 1);\n    const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n    const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n    const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n    for (let y = start; y <= end; y++) {\n      const row = y + buffer.ydisp;\n      const rowElement = this._rowElements[y];\n      const lineData = buffer.lines.get(row);\n      if (!rowElement || !lineData) {\n        break;\n      }\n      rowElement.replaceChildren(\n        ...this._rowFactory.createRow(\n          lineData,\n          row,\n          row === cursorAbsoluteY,\n          cursorStyle,\n          cursorInactiveStyle,\n          cursorX,\n          cursorBlink,\n          this.dimensions.css.cell.width,\n          this._widthCache,\n          -1,\n          -1\n        )\n      );\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    /**\n     * NOTE: The linkifier may send out of viewport y-values if:\n     * - negative y-value: the link started at a higher line\n     * - y-value >= maxY: the link ends at a line below viewport\n     *\n     * For negative y-values we can simply adjust x = 0,\n     * as higher up link start means, that everything from\n     * (0,0) is a link under top-down-left-right char progression\n     *\n     * Additionally there might be a small chance of out-of-sync x|y-values\n     * from a race condition of render updates vs. link event handler execution:\n     * - (sync) resize: chances terminal buffer in sync, schedules render update async\n     * - (async) link handler race condition: new buffer metrics, but still on old render state\n     * - (async) render update: brings term metrics and render state back in sync\n     */\n    // clip coords into viewport\n    if (y < 0) x = 0;\n    if (y2 < 0) x2 = 0;\n    const maxY = this._bufferService.rows - 1;\n    y = Math.max(Math.min(y, maxY), 0);\n    y2 = Math.max(Math.min(y2, maxY), 0);\n\n    cols = Math.min(cols, this._bufferService.cols);\n    const buffer = this._bufferService.buffer;\n    const cursorAbsoluteY = buffer.ybase + buffer.y;\n    const cursorX = Math.min(buffer.x, cols - 1);\n    const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n    const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n    const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n    // refresh rows within link range\n    for (let i = y; i <= y2; ++i) {\n      const row = i + buffer.ydisp;\n      const rowElement = this._rowElements[i];\n      const bufferline = buffer.lines.get(row);\n      if (!rowElement || !bufferline) {\n        break;\n      }\n      rowElement.replaceChildren(\n        ...this._rowFactory.createRow(\n          bufferline,\n          row,\n          row === cursorAbsoluteY,\n          cursorStyle,\n          cursorInactiveStyle,\n          cursorX,\n          cursorBlink,\n          this.dimensions.css.cell.width,\n          this._widthCache,\n          enabled ? (i === y ? x : 0) : -1,\n          enabled ? ((i === y2 ? x2 : cols) - 1) : -1\n        )\n      );\n    }\n  }\n}\n","/**\n * Copyright (c) 2018, 2023 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 { 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 { 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';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { IColorContrastCache } from 'browser/Types';\n\n\nexport const enum RowCss {\n  BOLD_CLASS = 'xterm-bold',\n  DIM_CLASS = 'xterm-dim',\n  ITALIC_CLASS = 'xterm-italic',\n  UNDERLINE_CLASS = 'xterm-underline',\n  OVERLINE_CLASS = 'xterm-overline',\n  STRIKETHROUGH_CLASS = 'xterm-strikethrough',\n  CURSOR_CLASS = 'xterm-cursor',\n  CURSOR_BLINK_CLASS = 'xterm-cursor-blink',\n  CURSOR_STYLE_BLOCK_CLASS = 'xterm-cursor-block',\n  CURSOR_STYLE_OUTLINE_CLASS = 'xterm-cursor-outline',\n  CURSOR_STYLE_BAR_CLASS = 'xterm-cursor-bar',\n  CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline'\n}\n\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  public defaultSpacing = 0;\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(\n    lineData: IBufferLine,\n    row: number,\n    isCursorRow: boolean,\n    cursorStyle: string | undefined,\n    cursorInactiveStyle: string | undefined,\n    cursorX: number,\n    cursorBlink: boolean,\n    cellWidth: number,\n    widthCache: WidthCache,\n    linkStart: number,\n    linkEnd: number\n  ): HTMLSpanElement[] {\n\n    const elements: HTMLSpanElement[] = [];\n    const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);\n    const colors = this._themeService.colors;\n\n    let lineLength = lineData.getNoBgTrimmedLength();\n    if (isCursorRow && lineLength < cursorX + 1) {\n      lineLength = cursorX + 1;\n    }\n\n    let charElement: HTMLSpanElement | undefined;\n    let cellAmount = 0;\n    let text = '';\n    let oldBg = 0;\n    let oldFg = 0;\n    let oldExt = 0;\n    let oldLinkHover: number | boolean = false;\n    let oldSpacing = 0;\n    let oldIsInSelection: boolean = false;\n    let spacing = 0;\n    const classes: string[] = [];\n\n    const hasHover = linkStart !== -1 && linkEnd !== -1;\n\n    for (let x = 0; 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      if (width === 0) {\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 isInSelection = this._isCellInSelection(x, row);\n      const isCursorCell = isCursorRow && x === cursorX;\n      const isLinkHover = hasHover && x >= linkStart && x <= linkEnd;\n\n      let isDecorated = false;\n      this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n        isDecorated = true;\n      });\n\n      // get chars to render for this cell\n      let chars = cell.getChars() || WHITESPACE_CELL_CHAR;\n      if (chars === ' ' && (cell.isUnderline() || cell.isOverline())) {\n        chars = '\\xa0';\n      }\n\n      // lookup char render width and calc spacing\n      spacing = width * cellWidth - widthCache.get(chars, cell.isBold(), cell.isItalic());\n\n      if (!charElement) {\n        charElement = this._document.createElement('span');\n      } else {\n        /**\n         * chars can only be merged on existing span if:\n         * - existing span only contains mergeable chars (cellAmount != 0)\n         * - bg did not change (or both are in selection)\n         * - fg did not change (or both are in selection and selection fg is set)\n         * - ext did not change\n         * - underline from hover state did not change\n         * - cell content renders to same letter-spacing\n         * - cell is not cursor\n         */\n        if (\n          cellAmount\n          && (\n            (isInSelection && oldIsInSelection)\n            || (!isInSelection && !oldIsInSelection && cell.bg === oldBg)\n          )\n          && (\n            (isInSelection && oldIsInSelection && colors.selectionForeground)\n            || cell.fg === oldFg\n          )\n          && cell.extended.ext === oldExt\n          && isLinkHover === oldLinkHover\n          && spacing === oldSpacing\n          && !isCursorCell\n          && !isJoined\n          && !isDecorated\n        ) {\n          // no span alterations, thus only account chars skipping all code below\n          text += chars;\n          cellAmount++;\n          continue;\n        } else {\n          /**\n           * cannot merge:\n           * - apply left-over text to old span\n           * - create new span, reset state holders cellAmount & text\n           */\n          if (cellAmount) {\n            charElement.textContent = text;\n          }\n          charElement = this._document.createElement('span');\n          cellAmount = 0;\n          text = '';\n        }\n      }\n      // preserve conditions for next merger eval round\n      oldBg = cell.bg;\n      oldFg = cell.fg;\n      oldExt = cell.extended.ext;\n      oldLinkHover = isLinkHover;\n      oldSpacing = spacing;\n      oldIsInSelection = isInSelection;\n\n      if (isJoined) {\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 && isCursorCell) {\n        classes.push(RowCss.CURSOR_CLASS);\n        if (this._coreBrowserService.isFocused) {\n          if (cursorBlink) {\n            classes.push(RowCss.CURSOR_BLINK_CLASS);\n          }\n          classes.push(\n            cursorStyle === 'bar'\n              ? RowCss.CURSOR_STYLE_BAR_CLASS\n              : cursorStyle === 'underline'\n                ? RowCss.CURSOR_STYLE_UNDERLINE_CLASS\n                : RowCss.CURSOR_STYLE_BLOCK_CLASS\n          );\n        } else {\n          if (cursorInactiveStyle) {\n            switch (cursorInactiveStyle) {\n              case 'outline':\n                classes.push(RowCss.CURSOR_STYLE_OUTLINE_CLASS);\n                break;\n              case 'block':\n                classes.push(RowCss.CURSOR_STYLE_BLOCK_CLASS);\n                break;\n              case 'bar':\n                classes.push(RowCss.CURSOR_STYLE_BAR_CLASS);\n                break;\n              case 'underline':\n                classes.push(RowCss.CURSOR_STYLE_UNDERLINE_CLASS);\n                break;\n              default:\n                break;\n            }\n          }\n        }\n      }\n\n      if (cell.isBold()) {\n        classes.push(RowCss.BOLD_CLASS);\n      }\n\n      if (cell.isItalic()) {\n        classes.push(RowCss.ITALIC_CLASS);\n      }\n\n      if (cell.isDim()) {\n        classes.push(RowCss.DIM_CLASS);\n      }\n\n      if (cell.isInvisible()) {\n        text = WHITESPACE_CELL_CHAR;\n      } else {\n        text = cell.getChars() || WHITESPACE_CELL_CHAR;\n      }\n\n      if (cell.isUnderline()) {\n        classes.push(`${RowCss.UNDERLINE_CLASS}-${cell.extended.underlineStyle}`);\n        if (text === ' ') {\n          text = '\\xa0'; // = &nbsp;\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.isOverline()) {\n        classes.push(RowCss.OVERLINE_CLASS);\n        if (text === ' ') {\n          text = '\\xa0'; // = &nbsp;\n        }\n      }\n\n      if (cell.isStrikethrough()) {\n        classes.push(RowCss.STRIKETHROUGH_CLASS);\n      }\n\n      // apply link hover underline late, effectively overrides any previous text-decoration\n      // settings\n      if (isLinkHover) {\n        charElement.style.textDecoration = 'underline';\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\n      if (!isTop && isInSelection) {\n        // If in the selection, force the element to be above the selection to improve contrast and\n        // support opaque selections. The applies background is not actually needed here as\n        // selection is drawn in a seperate container, the main purpose of this to ensuring minimum\n        // contrast ratio\n        bgOverride = this._coreBrowserService.isFocused ? colors.selectionBackgroundOpaque : colors.selectionInactiveBackgroundOpaque;\n        bg = bgOverride.rgba >> 8 & 0xFFFFFF;\n        bgColorMode = Attributes.CM_RGB;\n        // Since an opaque selection is being rendered, the selection pretends to be a decoration to\n        // ensure text is drawn above the selection.\n        isTop = true;\n        // Apply selection foreground if applicable\n        if (colors.selectionForeground) {\n          fgColorMode = Attributes.CM_RGB;\n          fg = colors.selectionForeground.rgba >> 8 & 0xFFFFFF;\n          fgOverride = colors.selectionForeground;\n        }\n      }\n\n      // If it's a top decoration, render above the selection\n      if (isTop) {\n        classes.push('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          classes.push(`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            classes.push(`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            classes.push(`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              classes.push(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);\n            }\n          }\n      }\n\n      // apply CSS classes\n      // slightly faster than using classList by omitting\n      // checks for doubled entries (code above should not have doublets)\n      if (classes.length) {\n        charElement.className = classes.join(' ');\n        classes.length = 0;\n      }\n\n      // exclude conditions for cell merging - never merge these\n      if (!isCursorCell && !isJoined && !isDecorated) {\n        cellAmount++;\n      } else {\n        charElement.textContent = text;\n      }\n      // apply letter-spacing rule\n      if (spacing !== this.defaultSpacing) {\n        charElement.style.letterSpacing = `${spacing}px`;\n      }\n\n      elements.push(charElement);\n      x = lastCharX;\n    }\n\n    // postfix text of last merged span\n    if (charElement && cellAmount) {\n      charElement.textContent = text;\n    }\n\n    return elements;\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    const cache = this._getContrastCache(cell);\n    let adjustedColor: IColor | undefined | null = undefined;\n    if (!bgOverride && !fgOverride) {\n      adjustedColor = cache.getColor(bg.rgba, fg.rgba);\n    }\n\n    // Calculate and store in cache\n    if (adjustedColor === undefined) {\n      // Dim cells only require half the contrast, otherwise they wouldn't be distinguishable from\n      // non-dim cells\n      const ratio = this._optionsService.rawOptions.minimumContrastRatio / (cell.isDim() ? 2 : 1);\n      adjustedColor = color.ensureContrastRatio(bgOverride || bg, fgOverride || fg, ratio);\n      cache.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 _getContrastCache(cell: ICellData): IColorContrastCache {\n    if (cell.isDim()) {\n      return this._themeService.colors.halfContrastCache;\n    }\n    return this._themeService.colors.contrastCache;\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) 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { FontWeight } from 'common/services/Services';\n\n\nexport const enum WidthCacheSettings {\n  /** sentinel for unset values in flat cache */\n  FLAT_UNSET = -9999,\n  /** size of flat cache, size-1 equals highest codepoint handled by flat */\n  FLAT_SIZE = 256,\n  /** char repeat for measuring */\n  REPEAT = 32\n}\n\n\nconst enum FontVariant {\n  REGULAR = 0,\n  BOLD = 1,\n  ITALIC = 2,\n  BOLD_ITALIC = 3\n}\n\n\nexport class WidthCache implements IDisposable {\n  // flat cache for regular variant up to CacheSettings.FLAT_SIZE\n  // NOTE: ~4x faster access than holey (serving >>80% of terminal content)\n  //       It has a small memory footprint (only 1MB for full BMP caching),\n  //       still the sweet spot is not reached before touching 32k different codepoints,\n  //       thus we store the remaining <<20% of terminal data in a holey structure.\n  protected _flat = new Float32Array(WidthCacheSettings.FLAT_SIZE);\n\n  // holey cache for bold, italic and bold&italic for any string\n  // FIXME: can grow really big over time (~8.5 MB for full BMP caching),\n  //        so a shared API across terminals is needed\n  protected _holey: Map<string, number> | undefined;\n\n  private _font = '';\n  private _fontSize = 0;\n  private _weight: FontWeight = 'normal';\n  private _weightBold: FontWeight = 'bold';\n  private _container: HTMLDivElement;\n  private _measureElements: HTMLSpanElement[] = [];\n\n  constructor(_document: Document) {\n    this._container = _document.createElement('div');\n    this._container.style.position = 'absolute';\n    this._container.style.top = '-50000px';\n    this._container.style.width = '50000px';\n    // SP should stack in spans\n    this._container.style.whiteSpace = 'pre';\n    // avoid undercuts in non-monospace fonts from kerning\n    this._container.style.fontKerning = 'none';\n\n    const regular = _document.createElement('span');\n\n    const bold = _document.createElement('span');\n    bold.style.fontWeight = 'bold';\n\n    const italic = _document.createElement('span');\n    italic.style.fontStyle = 'italic';\n\n    const boldItalic = _document.createElement('span');\n    boldItalic.style.fontWeight = 'bold';\n    boldItalic.style.fontStyle = 'italic';\n\n    // NOTE: must be in order of FontVariant\n    this._measureElements = [regular, bold, italic, boldItalic];\n    this._container.appendChild(regular);\n    this._container.appendChild(bold);\n    this._container.appendChild(italic);\n    this._container.appendChild(boldItalic);\n\n    _document.body.appendChild(this._container);\n\n    this.clear();\n  }\n\n  public dispose(): void {\n    this._container.remove();           // remove elements from DOM\n    this._measureElements.length = 0;   // release element refs\n    this._holey = undefined;            // free cache memory via GC\n  }\n\n  /**\n   * Clear the width cache.\n   */\n  public clear(): void {\n    this._flat.fill(WidthCacheSettings.FLAT_UNSET);\n    // .clear() has some overhead, re-assign instead (>3 times faster)\n    this._holey = new Map<string, number>();\n  }\n\n  /**\n   * Set the font for measuring.\n   * Must be called for any changes on font settings.\n   * Also clears the cache.\n   */\n  public setFont(font: string, fontSize: number, weight: FontWeight, weightBold: FontWeight): void {\n    // skip if nothing changed\n    if (font === this._font\n      && fontSize === this._fontSize\n      && weight === this._weight\n      && weightBold === this._weightBold\n    ) {\n      return;\n    }\n\n    this._font = font;\n    this._fontSize = fontSize;\n    this._weight = weight;\n    this._weightBold = weightBold;\n\n    this._container.style.fontFamily = this._font;\n    this._container.style.fontSize = `${this._fontSize}px`;\n    this._measureElements[FontVariant.REGULAR].style.fontWeight = `${weight}`;\n    this._measureElements[FontVariant.BOLD].style.fontWeight = `${weightBold}`;\n    this._measureElements[FontVariant.ITALIC].style.fontWeight = `${weight}`;\n    this._measureElements[FontVariant.BOLD_ITALIC].style.fontWeight = `${weightBold}`;\n\n    this.clear();\n  }\n\n  /**\n   * Get the render width for cell content `c` with current font settings.\n   * `variant` denotes the font variant to be used.\n   */\n  public get(c: string, bold: boolean | number, italic: boolean | number): number {\n    let cp = 0;\n    if (!bold && !italic && c.length === 1 && (cp = c.charCodeAt(0)) < WidthCacheSettings.FLAT_SIZE) {\n      return this._flat[cp] !== WidthCacheSettings.FLAT_UNSET\n        ? this._flat[cp]\n        : (this._flat[cp] = this._measure(c, 0));\n    }\n    let key = c;\n    if (bold) key += 'B';\n    if (italic) key += 'I';\n    let width = this._holey!.get(key);\n    if (width === undefined) {\n      let variant = 0;\n      if (bold) variant |= FontVariant.BOLD;\n      if (italic) variant |= FontVariant.ITALIC;\n      width = this._measure(c, variant);\n      this._holey!.set(key, width);\n    }\n    return width;\n  }\n\n  protected _measure(c: string, variant: FontVariant): number {\n    const el = this._measureElements[variant];\n    el.textContent = c.repeat(WidthCacheSettings.REPEAT);\n    return el.offsetWidth / WidthCacheSettings.REPEAT;\n  }\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\n// would 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, IRenderDimensions } from 'browser/renderer/shared/Types';\n\nexport function throwIfFalsy<T>(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';\n\n\nconst enum MeasureSettings {\n  REPEAT = 32\n}\n\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<void>());\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\n// 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'.repeat(MeasureSettings.REPEAT);\n    this._measureElement.setAttribute('aria-hidden', 'true');\n    this._measureElement.style.whiteSpace = 'pre';\n    this._measureElement.style.fontKerning = 'none';\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 = {\n      height: Number(this._measureElement.offsetHeight),\n      width: Number(this._measureElement.offsetWidth)\n    };\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 / MeasureSettings.REPEAT;\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    if (!this._charSizeService.hasValidSize) {\n      return undefined;\n    }\n    coords[0] = Math.min(Math.max(coords[0], 0), this._renderService.dimensions.css.canvas.width - 1);\n    coords[1] = Math.min(Math.max(coords[1], 0), this._renderService.dimensions.css.canvas.height - 1);\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 { addDisposableDomListener } from 'browser/Lifecycle';\nimport { RenderDebouncer } from 'browser/RenderDebouncer';\nimport { ScreenDprMonitor } from 'browser/ScreenDprMonitor';\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable, MutableDisposable } from 'common/Lifecycle';\nimport { DebouncedIdleTask } from 'common/TaskQueue';\nimport { IBufferService, IDecorationService, IOptionsService } from 'common/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 _renderer: MutableDisposable<IRenderer> = this.register(new MutableDisposable());\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<IRenderDimensions>());\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.value!.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._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.value?.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.value) {\n      return;\n    }\n\n    // Since this is debounced, a resize event could have happened between the time a refresh was\n    // requested and when this triggers. Clamp the values of start and end to ensure they're valid\n    // given the current viewport state.\n    start = Math.min(start, this._rowCount - 1);\n    end = Math.min(end, this._rowCount - 1);\n\n    // Render\n    this._renderer.value.renderRows(start, end);\n\n    // Update selection if needed\n    if (this._needsSelectionRefresh) {\n      this._renderer.value.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.value) {\n      return;\n    }\n    this.refreshRows(0, this._rowCount - 1);\n    this._fireOnCanvasResize();\n  }\n\n  private _fireOnCanvasResize(): void {\n    if (!this._renderer.value) {\n      return;\n    }\n    // Don't fire the event if the dimensions haven't changed\n    if (this._renderer.value.dimensions.css.canvas.width === this._canvasWidth && this._renderer.value.dimensions.css.canvas.height === this._canvasHeight) {\n      return;\n    }\n    this._onDimensionsChange.fire(this._renderer.value.dimensions);\n  }\n\n  public hasRenderer(): boolean {\n    return !!this._renderer.value;\n  }\n\n  public setRenderer(renderer: IRenderer): void {\n    this._renderer.value = renderer;\n    this._renderer.value.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.value) {\n      return;\n    }\n    this._renderer.value.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.value) {\n      return;\n    }\n    this._renderer.value.handleDevicePixelRatioChange();\n    this.refreshRows(0, this._rowCount - 1);\n  }\n\n  public handleResize(cols: number, rows: number): void {\n    if (!this._renderer.value) {\n      return;\n    }\n    if (this._isPaused) {\n      this._pausedResizeTask.set(() => this._renderer.value!.handleResize(cols, rows));\n    } else {\n      this._renderer.value.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.value?.handleCharSizeChanged();\n  }\n\n  public handleBlur(): void {\n    this._renderer.value?.handleBlur();\n  }\n\n  public handleFocus(): void {\n    this._renderer.value?.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.value?.handleSelectionChanged(start, end, columnSelectMode);\n  }\n\n  public handleCursorMove(): void {\n    this._renderer.value?.handleCursorMove();\n  }\n\n  public clear(): void {\n    this._renderer.value?.clear();\n  }\n}\n","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILinkifier2 } from 'browser/Types';\nimport { getCoordsRelativeToElement } from 'browser/input/Mouse';\nimport { moveToCellSequence } from 'browser/input/MoveToCell';\nimport { SelectionModel } from 'browser/selection/SelectionModel';\nimport { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport * as Browser from 'common/Platform';\nimport { IBufferLine, IDisposable } from 'common/Types';\nimport { getRangeLength } from 'common/buffer/BufferRange';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\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<string>());\n  public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;\n  private readonly _onRedrawRequest = this.register(new EventEmitter<ISelectionRedrawRequestEvent>());\n  public readonly onRequestRedraw = this._onRedrawRequest.event;\n  private readonly _onSelectionChange = this.register(new EventEmitter<void>());\n  public readonly onSelectionChange = this._onSelectionChange.event;\n  private readonly _onRequestScrollLines = this.register(new EventEmitter<ISelectionRequestScrollLinesEvent>());\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 { AllColorIndex, IDisposable } from 'common/Types';\n\nexport const ICharSizeService = createDecorator<ICharSizeService>('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<void>;\n\n  measure(): void;\n}\n\nexport const ICoreBrowserService = createDecorator<ICoreBrowserService>('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<IMouseService>('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<IRenderService>('RenderService');\nexport interface IRenderService extends IDisposable {\n  serviceBrand: undefined;\n\n  onDimensionsChange: IEvent<IRenderDimensions>;\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<ISelectionService>('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<string>;\n  readonly onRequestRedraw: IEvent<ISelectionRequestRedrawEvent>;\n  readonly onRequestScrollLines: IEvent<ISelectionRequestScrollLinesEvent>;\n  readonly onSelectionChange: IEvent<void>;\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<ICharacterJoinerService>('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<IThemeService>('ThemeService');\nexport interface IThemeService {\n  serviceBrand: undefined;\n\n  readonly colors: ReadonlyColorSet;\n\n  readonly onChangeColors: IEvent<ReadonlyColorSet>;\n\n  restoreColor(slot?: AllColorIndex): 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 { AllColorIndex, IColor, SpecialColorIndex } 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 = new ColorContrastCache();\n  private _halfContrastCache: IColorContrastCache = new ColorContrastCache();\n  private _restoreColors!: IRestoreColorSet;\n\n  public get colors(): ReadonlyColorSet { return this._colors; }\n\n  private readonly _onChangeColors = this.register(new EventEmitter<ReadonlyColorSet>());\n  public readonly onChangeColors = this._onChangeColors.event;\n\n  constructor(\n    @IOptionsService private readonly _optionsService: IOptionsService\n  ) {\n    super();\n\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      halfContrastCache: this._halfContrastCache\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._halfContrastCache.clear();\n    this._updateRestoreColors();\n    this._onChangeColors.fire(this.colors);\n  }\n\n  public restoreColor(slot?: AllColorIndex): void {\n    this._restoreColor(slot);\n    this._onChangeColors.fire(this.colors);\n  }\n\n  private _restoreColor(slot: AllColorIndex | 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 SpecialColorIndex.FOREGROUND:\n        this._colors.foreground = this._restoreColors.foreground;\n        break;\n      case SpecialColorIndex.BACKGROUND:\n        this._colors.background = this._restoreColors.background;\n        break;\n      case SpecialColorIndex.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 } 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<T> extends Disposable implements ICircularList<T> {\n  protected _array: (T | undefined)[];\n  private _startIndex: number;\n  private _length: number;\n\n  public readonly onDeleteEmitter = this.register(new EventEmitter<IDeleteEvent>());\n  public readonly onDelete = this.onDeleteEmitter.event;\n  public readonly onInsertEmitter = this.register(new EventEmitter<IInsertEvent>());\n  public readonly onInsert = this.onInsertEmitter.event;\n  public readonly onTrimEmitter = this.register(new EventEmitter<number>());\n  public readonly onTrim = this.onTrimEmitter.event;\n\n  constructor(\n    private _maxLength: number\n  ) {\n    super();\n    this._array = new Array<T>(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<T | undefined>(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<T>(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',\n * '#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, MutableDisposable, 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 _windowsWrappingHeuristics = this.register(new MutableDisposable());\n\n  private readonly _onBinary = this.register(new EventEmitter<string>());\n  public readonly onBinary = this._onBinary.event;\n  private readonly _onData = this.register(new EventEmitter<string>());\n  public readonly onData = this._onData.event;\n  protected _onLineFeed = this.register(new EventEmitter<void>());\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<void>());\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<number, void>;\n  protected _onScroll = this.register(new EventEmitter<IScrollEvent, void>());\n  public get onScroll(): IEvent<number, void> {\n    if (!this._onScrollApi) {\n      this._onScrollApi = this.register(new EventEmitter<number, void>());\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<ITerminalOptions> { 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<ITerminalOptions>\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.onMultipleOptionChange(['windowsMode', 'windowsPty'], () => this._handleWindowsPtyOptionChange()));\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\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 to avoid\n   * unwanted events being handled by the viewport when the event was triggered from the viewport\n   * originally.\n   * @param source Which component the event came from.\n   */\n  public scrollLines(disp: number, suppressScrollEvent?: boolean, source?: ScrollSource): void {\n    this._bufferService.scrollLines(disp, suppressScrollEvent, source);\n  }\n\n  public scrollPages(pageCount: number): void {\n    this.scrollLines(pageCount * (this.rows - 1));\n  }\n\n  public scrollToTop(): void {\n    this.scrollLines(-this._bufferService.buffer.ydisp);\n  }\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 registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): 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<boolean>): 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<boolean>): 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<boolean>): IDisposable {\n    return this._inputHandler.registerOscHandler(ident, callback);\n  }\n\n  protected _setup(): void {\n    this._handleWindowsPtyOptionChange();\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\n  private _handleWindowsPtyOptionChange(): void {\n    let value = false;\n    const windowsPty = this.optionsService.rawOptions.windowsPty;\n    if (windowsPty && windowsPty.buildNumber !== undefined && windowsPty.buildNumber !== undefined) {\n      value = !!(windowsPty.backend === 'conpty' && windowsPty.buildNumber < 21376);\n    } else if (this.optionsService.rawOptions.windowsMode) {\n      value = true;\n    }\n    if (value) {\n      this._enableWindowsWrappingHeuristics();\n    } else {\n      this._windowsWrappingHeuristics.clear();\n    }\n  }\n\n  protected _enableWindowsWrappingHeuristics(): void {\n    if (!this._windowsWrappingHeuristics.value) {\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._windowsWrappingHeuristics.value = toDisposable(() => {\n        for (const d of disposables) {\n          d.dispose();\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<T, U = void> {\n  (arg1: T, arg2: U): void;\n}\n\nexport interface IEvent<T, U = void> {\n  (listener: (arg1: T, arg2: U) => any): IDisposable;\n}\n\nexport interface IEventEmitter<T, U = void> {\n  event: IEvent<T, U>;\n  fire(arg1: T, arg2: U): void;\n  dispose(): void;\n}\n\nexport class EventEmitter<T, U = void> implements IEventEmitter<T, U> {\n  private _listeners: IListener<T, U>[] = [];\n  private _event?: IEvent<T, U>;\n  private _disposed: boolean = false;\n\n  public get event(): IEvent<T, U> {\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<T, U>[] = [];\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    this.clearListeners();\n    this._disposed = true;\n  }\n\n  public clearListeners(): void {\n    if (this._listeners) {\n      this._listeners.length = 0;\n    }\n  }\n}\n\nexport function forwardEvent<T>(from: IEvent<T>, to: IEventEmitter<T>): 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, SpecialColorIndex } 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<void>());\n  public readonly onRequestBell = this._onRequestBell.event;\n  private readonly _onRequestRefreshRows = this.register(new EventEmitter<number, number>());\n  public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;\n  private readonly _onRequestReset = this.register(new EventEmitter<void>());\n  public readonly onRequestReset = this._onRequestReset.event;\n  private readonly _onRequestSendFocus = this.register(new EventEmitter<void>());\n  public readonly onRequestSendFocus = this._onRequestSendFocus.event;\n  private readonly _onRequestSyncScrollBar = this.register(new EventEmitter<void>());\n  public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;\n  private readonly _onRequestWindowsOptionsReport = this.register(new EventEmitter<WindowsOptionsReportType>());\n  public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;\n\n  private readonly _onA11yChar = this.register(new EventEmitter<string>());\n  public readonly onA11yChar = this._onA11yChar.event;\n  private readonly _onA11yTab = this.register(new EventEmitter<number>());\n  public readonly onA11yTab = this._onA11yTab.event;\n  private readonly _onCursorMove = this.register(new EventEmitter<void>());\n  public readonly onCursorMove = this._onCursorMove.event;\n  private readonly _onLineFeed = this.register(new EventEmitter<void>());\n  public readonly onLineFeed = this._onLineFeed.event;\n  private readonly _onScroll = this.register(new EventEmitter<number>());\n  public readonly onScroll = this._onScroll.event;\n  private readonly _onTitleChange = this.register(new EventEmitter<string>());\n  public readonly onTitleChange = this._onTitleChange.event;\n  private readonly _onColor = this.register(new EventEmitter<IColorEvent>());\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<boolean>): 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\\<boolean\\>:\n   *   execution stopped at async handler, stack saved, continue with same chunk and the promise\n   *   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\n   * and proper continuation of async parser handlers.\n   */\n  public parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise<boolean> {\n    let result: void | Promise<boolean>;\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<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.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<boolean>): 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<boolean>): 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<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    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    } else {\n      // There was an explicit line feed (not just a carriage return), so clear the wrapped state of\n      // the line. This is particularly important on conpty/Windows where revisiting lines to\n      // reprint is common, especially on resize. Note that the windowsMode wrapped line heuristics\n      // can mess with this so windowsMode should be disabled, which is recommended on Windows build\n      // 21376 and above.\n      this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\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\n        //   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\n          // before 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. The cell gets replaced with the eraseChar of\n   * 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    if (line) {\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  /**\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\n   * blank characters. Text between the cursor and right margin moves to the right. Characters moved\n   * 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\n   * the left. Character attributes move with the characters. The terminal adds blank characters at\n   * 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\n   * margins, moving content to the right. Content at the right margin is lost. DECIC has no effect\n   * 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, the\n   * 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\n   * set. 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_RESET);\n      if (p === 4) return f(p, b2v(cs.modes.insertMode));\n      if (p === 12) return f(p, V.PERMANENTLY_SET);\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 === 67) return f(p, V.PERMANENTLY_RESET);\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   * | 53        | Overlined.                                               | #Y      |\n   * | 55        | Not Overlined.                                           | #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)\n   * 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 === 53) {\n        // overline\n        attr.bg |= BgFlags.OVERLINE;\n      } else if (p === 55) {\n        // not overline\n        attr.bg &= ~BgFlags.OVERLINE;\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\n   * terminal bootstrap, DECSTR only resets certain attributes. For most needs DECSTR should be\n   * 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; <data> 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\n   * `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; <data> 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; <num> ; <text> ST (set ANSI color <num> to <text>)\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\n   * `XParseColor` (see OSC 10 for supported formats). There may be multipe `c ; spec` pairs present\n   * in the same instruction. If `spec` contains `?` the terminal returns a sequence with the\n   * 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 (isValidColorIndex(index)) {\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 ; <params> ; <uri> 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.\n   * 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\n   * feedback. 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 = [SpecialColorIndex.FOREGROUND, SpecialColorIndex.BACKGROUND, SpecialColorIndex.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 ; <xcolor name>|<?> 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:<red>/<green>/<blue>` for  `<red>, <green>, <blue>` 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 ; <xcolor name>|<?> 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 ; <xcolor name>|<?> 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 ; <num> ST - restore ANSI color <num>\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 (isValidColorIndex(index)) {\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: SpecialColorIndex.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: SpecialColorIndex.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: SpecialColorIndex.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\n   * corresponding CSI string, `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\nfunction isValidColorIndex(value: number): value is ColorIndex {\n  return 0 <= value && value < 256;\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  /**\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<T extends IDisposable>(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<T extends IDisposable>(d: T): void {\n    const index = this._disposables.indexOf(d);\n    if (index !== -1) {\n      this._disposables.splice(index, 1);\n    }\n  }\n}\n\nexport class MutableDisposable<T extends IDisposable> implements IDisposable {\n  private _value?: T;\n  private _isDisposed = false;\n\n  /**\n   * Gets the value if it exists.\n   */\n  public get value(): T | undefined {\n    return this._isDisposed ? undefined : this._value;\n  }\n\n  /**\n   * Sets the value, disposing of the old value if it exists.\n   */\n  public set value(value: T | undefined) {\n    if (this._isDisposed || value === this._value) {\n      return;\n    }\n    this._value?.dispose();\n    this._value = value;\n  }\n\n  /**\n   * Resets the stored value and disposes of the previously stored value.\n   */\n  public clear(): void {\n    this.value = undefined;\n  }\n\n  public dispose(): void {\n    this._isDisposed = true;\n    this._value?.dispose();\n    this._value = undefined;\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<TFirst extends string | number, TSecond extends string | number, TValue> {\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<TFirst extends string | number, TSecond extends string | number, TThird extends string | number, TFourth extends string | number, TValue> {\n  private _data: TwoKeyMap<TFirst, TSecond, TwoKeyMap<TThird, TFourth, TValue>> = 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<T> {\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));\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);\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<T> {\n    if (this._array.length === 0) {\n      return;\n    }\n    i = this._search(key);\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);\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<T> {\n    // Duplicate the array to avoid issues when _array changes while iterating\n    return [...this._array].values();\n  }\n\n  private _search(key: number): number {\n    let min = 0;\n    let max = this._array.length - 1;\n    while (max >= min) {\n      let mid = (min + max) >> 1;\n      const midKey = this._getKey(this._array[mid]);\n      if (midKey > key) {\n        max = mid - 1;\n      } else if (midKey < key) {\n        min = mid + 1;\n      } else {\n        // key in list, walk to lowest duplicate\n        while (mid > 0 && this._getKey(this._array[mid - 1]) === key) {\n          mid--;\n        }\n        return mid;\n      }\n    }\n    // key not in list\n    // still return closest min (also used as insert position)\n    return min;\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  public isOverline(): number      { return this.bg & BgFlags.OVERLINE; }\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 { IdleTaskQueue } from 'common/TaskQueue';\nimport { IAttributeData, IBufferLine, ICellData, ICharset } from 'common/Types';\nimport { ExtendedAttrs } from 'common/buffer/AttributeData';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { getWrappedLineTrimmedLength, reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths } from 'common/buffer/BufferReflow';\nimport { CellData } from 'common/buffer/CellData';\nimport { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from 'common/buffer/Constants';\nimport { Marker } from 'common/buffer/Marker';\nimport { IBuffer } from 'common/buffer/Types';\nimport { DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\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<IBufferLine>;\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<IBufferLine>(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<IBufferLine>(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 || this._optionsService.rawOptions.windowsPty.backend !== undefined || this._optionsService.rawOptions.windowsPty.buildNumber !== undefined) {\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\n      // lines, 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    const windowsPty = this._optionsService.rawOptions.windowsPty;\n    if (windowsPty && windowsPty.buildNumber) {\n      return this._hasScrollback && windowsPty.backend === 'conpty' && windowsPty.buildNumber >= 21376;\n    }\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  /**\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","/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from 'common/Types';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\nimport { CellData } from 'common/buffer/CellData';\nimport { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from 'common/buffer/Constants';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\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 getNoBgTrimmedLength(): number {\n    for (let i = this.length - 1; i >= 0; --i) {\n      if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK) || (this._data[i * CELL_SIZE + Cell.BG] & Attributes.CM_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<IBufferLine>, 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<IBufferLine>, 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<IBufferLine>, 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 { EventEmitter } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { IAttributeData } from 'common/Types';\nimport { Buffer } from 'common/buffer/Buffer';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\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  OVERLINE = 0x40000000\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 readonly _disposables: IDisposable[] = [];\n\n  private readonly _id: number = Marker._nextId++;\n  public get id(): number { return this._id; }\n\n  private readonly _onDispose = this.register(new EventEmitter<void>());\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<T extends IDisposable>(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        // <Ctrl> or <Shift> + <Insert> 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 <Esc> 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,\n        // 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\n      // pair 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 } 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<void>());\n  public readonly onWriteParsed = this._onWriteParsed.event;\n\n  constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise<boolean>) {\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\n         * took very long). This cannot be solved here for the handler itself (it is the handlers\n         * responsibility to slice hard work), but we can at least schedule a screen update as we\n         * 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:<red>/<green>/<blue> with <red>, <green>, <blue> 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<IDcsHandler> = 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<boolean> {\n    if (!this._active.length) {\n      this._handlerFb(this._ident, 'UNHOOK', success);\n    } else {\n      let handlerResult: boolean | Promise<boolean> = 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<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 | Promise<boolean> {\n    let ret: boolean | Promise<boolean> = 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<CsiHandlerType>;\n  protected _escHandlers: IHandlerCollection<EscHandlerType>;\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<void> {\n   *   for (const chunk of chunks) {\n   *     let result: void | Promise<boolean>;\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<boolean> {\n    let code = 0;\n    let transition = 0;\n    let start = 0;\n    let handlerResult: void | boolean | Promise<boolean>;\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. This is a really bad\n           * condition with screwed up execution order and prolly messed up terminal state,\n           * 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, as\n           * the pending async handler still might mess up the terminal later. Instead fix the\n           * faulty 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<IOscHandler> = 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<boolean> {\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<boolean> = 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<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 | Promise<boolean> {\n    let ret: boolean | Promise<boolean> = 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  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';\nimport { Disposable } from 'common/Lifecycle';\n\nexport class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {\n  private _normal: BufferApiView;\n  private _alternate: BufferApiView;\n\n  private readonly _onBufferChange = this.register(new EventEmitter<IBufferApi>());\n  public readonly onBufferChange = this._onBufferChange.event;\n\n  constructor(private _core: ICoreTerminal) {\n    super();\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<boolean>): IDisposable {\n    return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));\n  }\n  public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise<boolean>): IDisposable {\n    return this.registerCsiHandler(id, callback);\n  }\n  public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise<boolean>): 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<boolean>): IDisposable {\n    return this.registerDcsHandler(id, callback);\n  }\n  public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise<boolean>): IDisposable {\n    return this._core.registerEscHandler(id, handler);\n  }\n  public addEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise<boolean>): IDisposable {\n    return this.registerEscHandler(id, handler);\n  }\n  public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable {\n    return this._core.registerOscHandler(ident, callback);\n  }\n  public addOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): 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 { EventEmitter } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { IAttributeData, IBufferLine, ScrollSource } from 'common/Types';\nimport { BufferSet } from 'common/buffer/BufferSet';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\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<number>());\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\n    //       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 * 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 } 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<CoreMouseEventType>());\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 { clone } from 'common/Clone';\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { IDecPrivateModes, IModes } from 'common/Types';\nimport { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';\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<string>());\n  public readonly onData = this._onData.event;\n  private readonly _onUserInput = this.register(new EventEmitter<void>());\n  public readonly onUserInput = this._onUserInput.event;\n  private readonly _onBinary = this.register(new EventEmitter<string>());\n  public readonly onBinary = this._onBinary.event;\n  private readonly _onRequestScrollToBottom = this.register(new EventEmitter<void>());\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 { IDecoration, IDecorationOptions, IMarker } 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<IInternalDecoration> = new SortedList(e => e?.marker.line);\n\n  private readonly _onDecorationRegistered = this.register(new EventEmitter<IInternalDecoration>());\n  public readonly onDecorationRegistered = this._onDecorationRegistered.event;\n  private readonly _onDecorationRemoved = this.register(new EventEmitter<IInternalDecoration>());\n  public readonly onDecorationRemoved = this._onDecorationRemoved.event;\n\n  public get decorations(): IterableIterator<IInternalDecoration> { return this._decorations.values(); }\n\n  constructor() {\n    super();\n\n    this.register(toDisposable(() => this.reset()));\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<IInternalDecoration> {\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\nclass Decoration extends Disposable implements IInternalDecoration {\n  public readonly marker: IMarker;\n  public element: HTMLElement | undefined;\n  public get isDisposed(): boolean { return this._isDisposed; }\n\n  public readonly onRenderEmitter = this.register(new EventEmitter<HTMLElement>());\n  public readonly onRender = this.onRenderEmitter.event;\n  private readonly _onDispose = this.register(new EventEmitter<void>());\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<IServiceIdentifier<any>, any>();\n\n  constructor(...entries: [IServiceIdentifier<any>, any][]) {\n    for (const [id, service] of entries) {\n      this.set(id, service);\n    }\n  }\n\n  public set<T>(id: IServiceIdentifier<T>, 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<any>, 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<any>): boolean {\n    return this._entries.has(id);\n  }\n\n  public get<T>(id: IServiceIdentifier<T>): 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<T>(id: IServiceIdentifier<T>, instance: T): void {\n    this._services.set(id, instance);\n  }\n\n  public getService<T>(id: IServiceIdentifier<T>): T | undefined {\n    return this._services.get(id);\n  }\n\n  public createInstance<T>(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  trace: LogLevelEnum.TRACE,\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  private _logLevel: LogLevelEnum = LogLevelEnum.OFF;\n  public get logLevel(): LogLevelEnum { return this._logLevel; }\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    // For trace logging, assume the latest created log service is valid\n    traceLogger = this;\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, (this._optionsService.options.logger ? '' : LOG_PREFIX) + message, ...optionalParams);\n  }\n\n  public trace(message: string, ...optionalParams: any[]): void {\n    if (this._logLevel <= LogLevelEnum.TRACE) {\n      this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n    }\n  }\n\n  public debug(message: string, ...optionalParams: any[]): void {\n    if (this._logLevel <= LogLevelEnum.DEBUG) {\n      this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n    }\n  }\n\n  public info(message: string, ...optionalParams: any[]): void {\n    if (this._logLevel <= LogLevelEnum.INFO) {\n      this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, message, optionalParams);\n    }\n  }\n\n  public warn(message: string, ...optionalParams: any[]): void {\n    if (this._logLevel <= LogLevelEnum.WARN) {\n      this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, message, optionalParams);\n    }\n  }\n\n  public error(message: string, ...optionalParams: any[]): void {\n    if (this._logLevel <= LogLevelEnum.ERROR) {\n      this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, message, optionalParams);\n    }\n  }\n}\n\nlet traceLogger: ILogService;\nexport function setTraceLogger(logger: ILogService): void {\n  traceLogger = logger;\n}\n\n/**\n * A decorator that can be used to automatically log trace calls to the decorated function.\n */\nexport function traceCall(_target: any, key: string, descriptor: any): any {\n  if (typeof descriptor.value !== 'function') {\n    throw new Error('not supported');\n  }\n  const fnKey = 'value';\n  const fn = descriptor.value;\n  descriptor[fnKey] = function (...args: any[]) {\n    // Early exit\n    if (traceLogger.logLevel !== LogLevelEnum.TRACE) {\n      return fn.apply(this, args);\n    }\n\n    traceLogger.trace(`GlyphRenderer#${fn.name}(${args.map(e => JSON.stringify(e)).join(', ')})`);\n    const result = fn.apply(this, args);\n    traceLogger.trace(`GlyphRenderer#${fn.name} return`, result);\n    return result;\n  };\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { EventEmitter } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { isMac } from 'common/Platform';\nimport { CursorStyle, IDisposable } from 'common/Types';\nimport { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';\n\nexport const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {\n  cols: 80,\n  rows: 24,\n  cursorBlink: false,\n  cursorStyle: 'block',\n  cursorWidth: 1,\n  cursorInactiveStyle: 'outline',\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  ignoreBracketedPasteMode: false,\n  lineHeight: 1.0,\n  letterSpacing: 0,\n  linkHandler: null,\n  logLevel: 'info',\n  logger: null,\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  windowsPty: {},\n  wordSeparator: ' ()[]{}\\',\"`',\n  altClickMovesCursor: true,\n  convertEol: false,\n  termName: 'xterm',\n  cancelEvents: false,\n  overviewRulerWidth: 0\n};\n\nconst FONT_WEIGHT_OPTIONS: Extract<FontWeight, string>[] = ['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<ITerminalOptions>;\n  public options: Required<ITerminalOptions>;\n\n  private readonly _onOptionChange = this.register(new EventEmitter<keyof ITerminalOptions>());\n  public readonly onOptionChange = this._onOptionChange.event;\n\n  constructor(options: Partial<ITerminalOptions>) {\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<T extends keyof ITerminalOptions>(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        break;\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      case 'windowsPty':\n        value = value ?? {};\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<string, IOscLinkEntryWithId> = 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<number, IOscLinkEntryNoId | IOscLinkEntryWithId> = 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<IOscLinkData>;\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<IOscLinkData>): 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<T extends IOscLinkData> {\n  data: T;\n  id: number;\n  lines: IMarker[];\n}\n\ninterface IOscLinkEntryNoId extends IOscLinkEntry<IOscLinkData> {\n}\n\ninterface IOscLinkEntryWithId extends IOscLinkEntry<Required<IOscLinkData>> {\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<string, IServiceIdentifier<any>> = new Map();\n\nexport function getServiceDependencies(ctor: any): { id: IServiceIdentifier<any>, index: number, optional: boolean }[] {\n  return ctor[DI_DEPENDENCIES] || [];\n}\n\nexport function createDecorator<T>(id: string): IServiceIdentifier<T> {\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, CursorInactiveStyle, IOscLinkData } from 'common/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport { IDecorationOptions, IDecoration, ILinkHandler, IWindowsPty, ILogger } from 'xterm';\n\nexport const IBufferService = createDecorator<IBufferService>('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<number>;\n  scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;\n  scrollLines(disp: number, suppressScrollEvent?: boolean, source?: ScrollSource): void;\n  resize(cols: number, rows: number): void;\n  reset(): void;\n}\n\nexport const ICoreMouseService = createDecorator<ICoreMouseService>('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<CoreMouseEventType>;\n\n  /**\n   * Human readable version of mouse events.\n   */\n  explainEvents(events: CoreMouseEventType): { [event: string]: boolean };\n}\n\nexport const ICoreService = createDecorator<ICoreService>('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<string>;\n  readonly onUserInput: IEvent<void>;\n  readonly onBinary: IEvent<string>;\n  readonly onRequestScrollToBottom: IEvent<void>;\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<ICharsetService>('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<T> {\n  (...args: any[]): void;\n  type: T;\n}\n\nexport interface IBrandedService {\n  serviceBrand: undefined;\n}\n\ntype GetLeadingNonServiceArgs<TArgs extends any[]> = TArgs extends [] ? []\n  : TArgs extends [...infer TFirst, infer TLast] ? TLast extends IBrandedService ? GetLeadingNonServiceArgs<TFirst> : TArgs\n    : never;\n\nexport const IInstantiationService = createDecorator<IInstantiationService>('InstantiationService');\nexport interface IInstantiationService {\n  serviceBrand: undefined;\n\n  setService<T>(id: IServiceIdentifier<T>, instance: T): void;\n  getService<T>(id: IServiceIdentifier<T>): T | undefined;\n  createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(t: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;\n}\n\nexport enum LogLevelEnum {\n  TRACE = 0,\n  DEBUG = 1,\n  INFO = 2,\n  WARN = 3,\n  ERROR = 4,\n  OFF = 5\n}\n\nexport const ILogService = createDecorator<ILogService>('LogService');\nexport interface ILogService {\n  serviceBrand: undefined;\n\n  readonly logLevel: LogLevelEnum;\n\n  trace(message: any, ...optionalParams: any[]): void;\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<IOptionsService>('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<ITerminalOptions>;\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<ITerminalOptions>;\n\n  /**\n   * Adds an event listener for when any option changes.\n   */\n  readonly onOptionChange: IEvent<keyof ITerminalOptions>;\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<T extends keyof ITerminalOptions>(key: T, listener: (arg1: Required<ITerminalOptions>[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 = 'trace' | '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  cursorInactiveStyle?: CursorInactiveStyle;\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  ignoreBracketedPasteMode?: boolean;\n  letterSpacing?: number;\n  lineHeight?: number;\n  linkHandler?: ILinkHandler | null;\n  logLevel?: LogLevel;\n  logger?: ILogger | null;\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  windowsPty?: IWindowsPty;\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<IOscLinkService>('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<IUnicodeService>('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<string>;\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<IDecorationService>('DecorationService');\nexport interface IDecorationService extends IDisposable {\n  serviceBrand: undefined;\n  readonly decorations: IterableIterator<IInternalDecoration>;\n  readonly onDecorationRegistered: IEvent<IInternalDecoration>;\n  readonly onDecorationRemoved: IEvent<IInternalDecoration>;\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<HTMLElement>;\n}\n","/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { EventEmitter } from 'common/EventEmitter';\nimport { UnicodeV6 } from 'common/input/UnicodeV6';\nimport { IUnicodeService, IUnicodeVersionProvider } from 'common/services/Services';\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<string>();\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 * as Strings from 'browser/LocalizableStrings';\nimport { Terminal as TerminalCore } from 'browser/Terminal';\nimport { IBufferRange, ITerminal } from 'browser/Types';\nimport { IEvent } from 'common/EventEmitter';\nimport { Disposable } from 'common/Lifecycle';\nimport { ITerminalOptions } from 'common/Types';\nimport { AddonManager } from 'common/public/AddonManager';\nimport { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';\nimport { ParserApi } from 'common/public/ParserApi';\nimport { UnicodeApi } from 'common/public/UnicodeApi';\nimport { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from 'xterm';\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 extends Disposable implements ITerminalApi {\n  private _core: ITerminal;\n  private _addonManager: AddonManager;\n  private _parser: IParser | undefined;\n  private _buffer: BufferNamespaceApi | undefined;\n  private _publicOptions: Required<ITerminalOptions>;\n\n  constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions) {\n    super();\n\n    this._core = this.register(new TerminalCore(options));\n    this._addonManager = this.register(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<void> { return this._core.onBell; }\n  public get onBinary(): IEvent<string> { return this._core.onBinary; }\n  public get onCursorMove(): IEvent<void> { return this._core.onCursorMove; }\n  public get onData(): IEvent<string> { return this._core.onData; }\n  public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }\n  public get onLineFeed(): IEvent<void> { 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<number> { return this._core.onScroll; }\n  public get onSelectionChange(): IEvent<void> { return this._core.onSelectionChange; }\n  public get onTitleChange(): IEvent<string> { return this._core.onTitleChange; }\n  public get onWriteParsed(): IEvent<void> { 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 = this.register(new BufferNamespaceApi(this._core));\n    }\n    return this._buffer;\n  }\n  public get markers(): ReadonlyArray<IMarker> {\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<ITerminalOptions> {\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 {\n    this._verifyIntegers(cursorYOffset);\n    return this._core.registerMarker(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    super.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    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","super","_renderService","_liveRegionLineCount","_charsToConsume","_charsToAnnounce","this","_accessibilityContainer","document","createElement","classList","add","_rowContainer","setAttribute","_rowElements","rows","_createAccessibilityTreeNode","appendChild","_topBoundaryFocusListener","e","_handleBoundaryFocus","_bottomBoundaryFocusListener","addEventListener","length","_refreshRowsDimensions","_liveRegion","_liveRegionDebouncer","register","TimeBasedDebouncer","_renderRows","bind","element","Error","insertAdjacentElement","onResize","_handleResize","onRender","_refreshRows","start","end","onScroll","onA11yChar","char","_handleChar","onLineFeed","onA11yTab","spaceCount","_handleTab","onKey","_handleKey","key","onBlur","_clearLiveRegion","onDimensionsChange","_screenDprMonitor","ScreenDprMonitor","window","setListener","addDisposableDomListener","toDisposable","remove","MAX_ROWS_TO_READ","shift","textContent","Strings","tooMuchOutput","isMac","parentNode","setTimeout","keyChar","test","push","refresh","buffer","setSize","lines","toString","lineData","translateBufferLineToString","ydisp","posInSet","innerText","_announceCharacters","position","boundaryElement","target","beforeBoundaryElement","getAttribute","relatedTarget","topBoundaryElement","bottomBoundaryElement","pop","removeChild","removeEventListener","newElement","unshift","scrollLines","focus","preventDefault","stopImmediatePropagation","children","tabIndex","_refreshRowDimensions","dimensions","css","cell","height","style","width","canvas","IRenderService","prepareTextForTerminal","text","replace","bracketTextForPaste","bracketedPasteMode","paste","textarea","coreService","optionsService","decPrivateModes","rawOptions","ignoreBracketedPasteMode","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","node","type","handler","options","disposed","dispose","Linkifier2","currentLink","_currentLink","_bufferService","_linkProviders","_linkCacheDisposables","_isMouseOut","_wasResized","_activeLine","_onShowLinkUnderline","EventEmitter","onShowLinkUnderline","event","_onHideLinkUnderline","onHideLinkUnderline","getDisposeArrayDisposable","_lastMouseEvent","undefined","_clearCurrentLink","registerLinkProvider","linkProvider","providerIndex","indexOf","splice","attachToDom","mouseService","renderService","_element","_mouseService","_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","hover","showEvent","scrollOffset","_createLinkUnderlineEvent","fire","leave","lower","upper","current","coords","getCoords","x1","y1","x2","y2","IBufferService","promptLabel","OscLinkProvider","_optionsService","_oscLinkService","callback","line","result","linkHandler","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","onFocus","_onFocus","_onBlur","_onA11yCharEmitter","_onA11yTabEmitter","onWillOpen","_onWillOpen","browser","Browser","_keyDownHandled","_keyDownSeen","_keyPressHandled","_unprocessedDeadKey","_accessibilityManager","MutableDisposable","_onCursorMove","onCursorMove","_onKey","_onRender","_onSelectionChange","onSelectionChange","_onTitleChange","onTitleChange","_onBell","onBell","_setup","linkifier2","_instantiationService","createInstance","_decorationService","DecorationService","setService","IDecorationService","_inputHandler","onRequestBell","onRequestRefreshRows","onRequestSendFocus","_reportFocus","onRequestReset","reset","onRequestWindowsOptionsReport","_reportWindowsOptions","onColor","_handleColorEvent","forwardEvent","_afterResize","_customKeyEventHandler","_themeService","req","acc","ident","channels","color","toColorRGB","colors","ansi","C0","ESC","toRgbString","C1_ESCAPED","ST","modifyColors","rgba","toColor","narrowedAcc","restoreColor","buffers","active","preventScroll","_handleScreenReaderModeOptionChange","_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","resize","_compositionView","CompositionHelper","hasRenderer","setRenderer","_createRenderer","MouseService","IMouseService","viewport","Viewport","onRequestScrollLines","amount","suppressScrollEvent","onRequestSyncScrollBar","syncScrollArea","handleCursorMove","handleResize","handleBlur","handleFocus","SelectionService","ISelectionService","onRequestRedraw","handleSelectionChanged","columnSelectMode","onLinuxMouseSelection","_onScroll","BufferDecorationRenderer","handleMouseDown","coreMouseService","areMouseEventsActive","disable","enable","screenReaderMode","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","registerMarker","cursorYOffset","addMarker","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","_scrollArea","themeService","scrollBarWidth","_currentRowHeight","_currentDeviceCellHeight","_lastRecordedBufferLength","_lastRecordedViewportHeight","_lastRecordedBufferHeight","_lastTouchY","_lastScrollTop","_wheelPartialScroll","_refreshAnimationFrame","_ignoreNextScrollEvent","_smoothScrollState","startTime","origin","_onRequestScrollLines","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","getBufferElements","startLine","endLine","cursorElement","currentLine","bufferElements","isWrapped","translateToString","div","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","layer","marker","display","onRenderEmitter","onDispose","delete","anchor","right","_zones","_zonePool","_zonePoolIndex","_linePadding","full","center","zones","addDecoration","overviewRulerOptions","z","_lineIntersectsZone","_lineAdjacentToZone","_addLineToZone","startBufferLine","endBufferLine","setPadding","padding","zone","drawHeight","drawWidth","drawX","_width","_coreBrowseService","_colorZoneStore","ColorZoneStore","_shouldUpdateDimensions","_shouldUpdateAnchor","_lastKnownBufferLength","_canvas","_refreshCanvasDimensions","parentElement","insertBefore","ctx","getContext","_ctx","_registerDecorationListeners","_registerBufferChangeListeners","_registerDimensionChangeListeners","normal","_refreshDrawHeightConstants","_refreshColorZonePadding","_containerHeight","clientHeight","_refreshDrawConstants","outerWidth","innerWidth","ceil","pixelsPerLine","nonFullHeight","_refreshDecorations","clearRect","lineWidth","_renderColorZone","fillStyle","fillRect","updateCanvasDimensions","updateAnchor","_isComposing","_textarea","_coreService","_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","wrappedRowsCount","repeat","currentRow","lineWraps","startCol","endCol","forward","currentCol","bufferStr","mod","count","str","rpt","targetX","resetStartingRow","horizontalDirection","moveToRequestedCol","rowDifference","currX","colsFromRowEnd","TERMINAL_CLASS_PREFIX","ROW_CONTAINER_CLASS","FG_CLASS_PREFIX","BG_CLASS_PREFIX","FOCUS_CLASS","SELECTION_CLASS","nextTerminalId","_linkifier2","instantiationService","_terminalClass","_refreshRowElements","_selectionContainer","createRenderDimensions","_updateDimensions","onOptionChange","_handleOptionsChanged","_injectCss","_rowFactory","DomRendererRowFactory","_handleLinkHover","_handleLinkLeave","_widthCache","_themeStyleElement","_dimensionsStyleElement","WidthCache","setFont","fontWeight","fontWeightBold","_setDefaultSpacing","letterSpacing","overflow","styles","_terminalSelector","foreground","multiplyOpacity","cursor","cursorAccent","cursorWidth","selectionBackgroundOpaque","selectionInactiveBackgroundOpaque","c","INVERTED_DEFAULT_COLOR","opaque","spacing","defaultSpacing","handleDevicePixelRatioChange","handleCharSizeChanged","renderRows","replaceChildren","viewportStartRow","viewportEndRow","viewportCappedStartRow","viewportCappedEndRow","documentFragment","isXFlipped","_createSelectionElement","middleRowsCount","colStart","colEnd","cursorAbsoluteY","cursorBlink","cursorStyle","cursorInactiveStyle","rowElement","createRow","_setCellUnderline","enabled","maxY","bufferline","IInstantiationService","_workCell","_columnSelectMode","_selectionStart","_selectionEnd","isCursorRow","widthCache","linkStart","linkEnd","elements","joinedRanges","getJoinedCharacters","charElement","getNoBgTrimmedLength","cellAmount","oldBg","oldFg","oldExt","oldLinkHover","oldSpacing","oldIsInSelection","classes","hasHover","isJoined","lastCharX","JoinedCellData","isInSelection","_isCellInSelection","isCursorCell","isLinkHover","isDecorated","forEachDecorationAtCell","d","chars","getChars","WHITESPACE_CELL_CHAR","isUnderline","isOverline","isBold","isItalic","selectionForeground","ext","isCursorHidden","isFocused","isDim","isInvisible","underlineStyle","isUnderlineColorDefault","isUnderlineColorRGB","textDecorationColor","AttributeData","getUnderlineColor","join","drawBoldTextInBrightColors","isStrikethrough","textDecoration","getFgColor","fgColorMode","getFgColorMode","getBgColor","bgColorMode","getBgColorMode","isInverse","temp","temp2","bgOverride","fgOverride","resolvedBg","isTop","backgroundColorRGB","foregroundColorRGB","_addStyle","padStart","_applyMinimumContrast","className","minimumContrastRatio","excludeFromContrastRatioDemands","getCode","cache","_getContrastCache","adjustedColor","ratio","ensureContrastRatio","halfContrastCache","contrastCache","padChar","_flat","Float32Array","_font","_fontSize","_weight","_weightBold","_measureElements","whiteSpace","fontKerning","regular","bold","italic","fontStyle","boldItalic","body","_holey","fill","font","weight","weightBold","cp","_measure","variant","DIM_OPACITY","TEXT_BASELINE","isLegacyEdge","isPowerlineGlyph","codepoint","isBoxOrBlockGlyph","isSelectAllActive","selectionStartLength","finalSelectionStart","areSelectionValuesReversed","finalSelectionEnd","startPlusLength","handleTrim","_onCharSizeChange","onCharSizeChange","_measureStrategy","DomMeasureStrategy","onMultipleOptionChange","_parentElement","_result","_measureElement","geometry","Number","firstCell","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","newRange","inRange","_isFocused","_cachedIsFocused","hasFocus","queueMicrotask","_renderer","decorationService","coreBrowserService","_pausedResizeTask","DebouncedIdleTask","_isPaused","_needsFullRefresh","_isNextRenderRedrawOnly","_needsSelectionRefresh","_canvasWidth","_canvasHeight","_selectionState","_onDimensionsChange","_onRenderedViewportChange","_onRefreshRequest","onRefreshRequest","_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","_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","_colors","_contrastCache","ColorContrastCache","_halfContrastCache","_onChangeColors","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","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","_onScrollApi","_windowsWrappingHeuristics","_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","_handleWindowsPtyOptionChange","markRangeDirty","scrollBottom","WriteBuffer","promiseResult","parse","write","writeSync","maxSubsequentCalls","LogLevelEnum","WARN","isNaN","MINIMUM_COLS","MINIMUM_ROWS","scroll","eraseAttr","scrollPages","pageCount","scrollToTop","scrollToLine","scrollAmount","registerEscHandler","registerDcsHandler","registerCsiHandler","registerOscHandler","windowsPty","buildNumber","backend","windowsMode","_enableWindowsWrappingHeuristics","disposables","updateWindowsModeWrappedState","final","_listeners","_disposed","_event","arg1","arg2","queue","call","clearListeners","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","getAttrData","_curAttrData","_coreMouseService","_unicodeService","_parser","EscapeSequenceParser","_parseBuffer","Uint32Array","_stringDecoder","StringToUtf32","_utf8Decoder","Utf8ToUtf32","_windowTitle","_iconName","_windowTitleStack","_iconNameStack","_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","_preserveStack","_logSlowResolvingAsync","p","Promise","race","res","rej","catch","err","_getCurrentLinkId","wasPaused","DEBUG","prototype","split","clearRange","len","decode","subarray","chWidth","charset","wraparoundMode","wraparound","insertMode","modes","curAttr","bufferRow","markDirty","setCellFromCodePoint","wcwidth","ch","stringFromCodePoint","addLineToLink","_eraseAttrData","insertCells","getNullCell","NULL_CELL_CODE","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","isValidColorIndex","args","_createHyperlink","_finishHyperlink","parsedParams","idParamIndex","findIndex","startsWith","registerLink","_setOrReportSpecialColor","collectAndFlag","scrollRegionHeight","level","yOffset","markAllDirty","f","isProtected","_disposables","unregister","_value","array","_data","third","fourth","navigator","userAgent","platform","isSafari","majorVersion","isIpad","isIphone","_getKey","insert","_search","getKeyIterator","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","_urlId","_ext","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","lineIndex","trimRight","tabStopWidth","Marker","_removeMarker","$startIndex","fillCellData","_combined","_extendedAttrs","CHAR_DATA_ATTR_INDEX","CHAR_DATA_CHAR_INDEX","CHAR_DATA_WIDTH_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","_id","isDisposed","_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","next","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","fromArray","k","maxSubParamsLength","Int32Array","_subParams","_subParamsLength","_subParamsIdx","Uint16Array","_rejectDigits","_rejectSubDigits","_digitIsSub","newParams","getSubParamsAll","store","cur","_addons","instance","loadAddon","terminal","loadedAddon","_wrappedAddonDispose","_buffer","init","viewportY","baseY","getLine","BufferLineApiView","_line","getCell","startColumn","endColumn","BufferNamespaceApi","_core","_onBufferChange","onBufferChange","BufferApiView","_alternate","alternate","addCsiHandler","addDcsHandler","addEscHandler","addOscHandler","provider","versions","activeVersion","isUserScrolling","_cachedBlankLine","topRow","bottomRow","willBufferBeTrimmed","oldYdisp","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","getDecorationsAtCell","xmin","xmax","_cachedBg","_cachedFg","foregroundColor","ServiceCollection","_entries","service","_services","getService","ctor","serviceDependencies","getServiceDependencies","sort","serviceArgs","dependency","firstServiceArgPos","optionsKeyToLogLevel","trace","TRACE","info","INFO","ERROR","off","OFF","traceLogger","_logLevel","_updateLogLevel","_evalLazyOptionalParams","optionalParams","_log","message","logger","log","_target","descriptor","fn","JSON","stringify","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","DI_TARGET","DI_DEPENDENCIES","serviceRegistry","decorator","arguments","storeServiceDependency","_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","mouseTrackingMode","applicationCursorKeysMode","applicationKeypadMode","originMode","reverseWraparoundMode","sendFocusMode","columns","_verifyIntegers","_verifyPositiveIntegers","writeln","addon","strings","Infinity"],"sourceRoot":""}
\ No newline at end of file