From 27b6436196ffe1efe504b196e8b32507501f32d1 Mon Sep 17 00:00:00 2001 From: Iwasaki Yudai Date: Tue, 22 Aug 2017 15:59:24 +0900 Subject: [PATCH] Rename TermXterm and TermHterm to Xterm and Hterm --- js/dist/bundle.js | 64 +++++++++++++++++++++---------------------- js/dist/bundle.js.map | 2 +- js/dist/hterm.d.ts | 2 +- js/dist/xterm.d.ts | 2 +- js/src/hterm.ts | 2 +- js/src/main.ts | 8 +++--- js/src/xterm.ts | 2 +- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/js/dist/bundle.js b/js/dist/bundle.js index a08d20a..de2d71a 100644 --- a/js/dist/bundle.js +++ b/js/dist/bundle.js @@ -2479,8 +2479,8 @@ exports.getRawByteCoords = getRawByteCoords; Object.defineProperty(exports, "__esModule", { value: true }); var bare = __webpack_require__(14); -var TermHterm = (function () { - function TermHterm(elem) { +var Hterm = (function () { + function Hterm(elem) { this.elem = elem; bare.hterm.defaultStorage = new bare.lib.Storage.Memory(); this.term = new bare.hterm.Terminal(); @@ -2490,17 +2490,17 @@ var TermHterm = (function () { this.term.installKeyboard(); } ; - TermHterm.prototype.info = function () { + Hterm.prototype.info = function () { return { columns: this.columns, rows: this.rows }; }; ; - TermHterm.prototype.output = function (data) { + Hterm.prototype.output = function (data) { if (this.term.io != null) { this.term.io.writeUTF16(data); } }; ; - TermHterm.prototype.showMessage = function (message, timeout) { + Hterm.prototype.showMessage = function (message, timeout) { this.message = message; if (timeout > 0) { this.term.io.showOverlay(message, timeout); @@ -2510,22 +2510,22 @@ var TermHterm = (function () { } }; ; - TermHterm.prototype.removeMessage = function () { + Hterm.prototype.removeMessage = function () { // there is no hideOverlay(), so show the same message with 0 sec this.term.io.showOverlay(this.message, 0); }; - TermHterm.prototype.setWindowTitle = function (title) { + Hterm.prototype.setWindowTitle = function (title) { this.term.setWindowTitle(title); }; ; - TermHterm.prototype.setPreferences = function (value) { + Hterm.prototype.setPreferences = function (value) { var _this = this; Object.keys(value).forEach(function (key) { _this.term.getPrefs().set(key, value[key]); }); }; ; - TermHterm.prototype.onInput = function (callback) { + Hterm.prototype.onInput = function (callback) { this.io.onVTKeystroke = function (data) { callback(data); }; @@ -2534,7 +2534,7 @@ var TermHterm = (function () { }; }; ; - TermHterm.prototype.onResize = function (callback) { + Hterm.prototype.onResize = function (callback) { var _this = this; this.io.onTerminalResize = function (columns, rows) { _this.columns = columns; @@ -2543,22 +2543,22 @@ var TermHterm = (function () { }; }; ; - TermHterm.prototype.deactivate = function () { + Hterm.prototype.deactivate = function () { this.io.onVTKeystroke = null; this.io.sendString = null; this.io.onTerminalResize = null; this.term.uninstallKeyboard(); }; - TermHterm.prototype.reset = function () { + Hterm.prototype.reset = function () { this.removeMessage(); this.term.installKeyboard(); }; - TermHterm.prototype.close = function () { + Hterm.prototype.close = function () { this.term.uninstallKeyboard(); }; - return TermHterm; + return Hterm; }()); -exports.TermHterm = TermHterm; +exports.Hterm = Hterm; /***/ }), @@ -2741,8 +2741,8 @@ exports.WebTTY = WebTTY; Object.defineProperty(exports, "__esModule", { value: true }); var bare = __webpack_require__(0); bare.loadAddon("fit"); -var TermXterm = (function () { - function TermXterm(elem) { +var Xterm = (function () { + function Xterm(elem) { var _this = this; this.elem = elem; this.term = new bare(); @@ -2761,15 +2761,15 @@ var TermXterm = (function () { this.term.open(elem, true); } ; - TermXterm.prototype.info = function () { + Xterm.prototype.info = function () { return { columns: this.term.cols, rows: this.term.rows }; }; ; - TermXterm.prototype.output = function (data) { + Xterm.prototype.output = function (data) { this.term.write(data); }; ; - TermXterm.prototype.showMessage = function (message, timeout) { + Xterm.prototype.showMessage = function (message, timeout) { var _this = this; this.message.textContent = message; this.elem.appendChild(this.message); @@ -2783,46 +2783,46 @@ var TermXterm = (function () { } }; ; - TermXterm.prototype.removeMessage = function () { + Xterm.prototype.removeMessage = function () { if (this.message.parentNode == this.elem) { this.elem.removeChild(this.message); } }; - TermXterm.prototype.setWindowTitle = function (title) { + Xterm.prototype.setWindowTitle = function (title) { document.title = title; }; ; - TermXterm.prototype.setPreferences = function (value) { + Xterm.prototype.setPreferences = function (value) { }; ; - TermXterm.prototype.onInput = function (callback) { + Xterm.prototype.onInput = function (callback) { this.term.on("data", function (data) { callback(data); }); }; ; - TermXterm.prototype.onResize = function (callback) { + Xterm.prototype.onResize = function (callback) { this.term.on("resize", function (data) { callback(data.cols, data.rows); }); }; ; - TermXterm.prototype.deactivate = function () { + Xterm.prototype.deactivate = function () { this.term.off("data"); this.term.off("resize"); this.term.blur(); }; - TermXterm.prototype.reset = function () { + Xterm.prototype.reset = function () { this.removeMessage(); this.term.clear(); }; - TermXterm.prototype.close = function () { + Xterm.prototype.close = function () { window.removeEventListener("resize", this.resizeListener); this.term.destroy(); }; - return TermXterm; + return Xterm; }()); -exports.TermXterm = TermXterm; +exports.Xterm = Xterm; /***/ }), @@ -20831,10 +20831,10 @@ var elem = document.getElementById("terminal"); if (elem !== null) { var term; if (gotty_term == "hterm") { - term = new hterm_1.TermHterm(elem); + term = new hterm_1.Hterm(elem); } else { - term = new xterm_1.TermXterm(elem); + term = new xterm_1.Xterm(elem); } var httpsEnabled = window.location.protocol == "https:"; var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws'; diff --git a/js/dist/bundle.js.map b/js/dist/bundle.js.map index 3457893..7b54e57 100644 --- a/js/dist/bundle.js.map +++ b/js/dist/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap d143500d12edcad940e0","webpack:///./~/xterm/lib/xterm.js","webpack:///./~/xterm/lib/EventEmitter.js","webpack:///./~/xterm/lib/EscapeSequences.js","webpack:///./~/xterm/lib/Charsets.js","webpack:///./~/xterm/lib/addons/attach/attach.js","webpack:///./~/xterm/lib/addons/fit/fit.js","webpack:///./~/xterm/lib/addons/fullscreen/fullscreen.js","webpack:///./~/xterm/lib/addons/terminado/terminado.js","webpack:///./~/xterm/lib/utils/Browser.js","webpack:///./~/xterm/lib/utils/Mouse.js","webpack:///./src/hterm.ts","webpack:///./src/websocket.ts","webpack:///./src/webtty.ts","webpack:///./src/xterm.ts","webpack:///./~/libapps/hterm/dist/js/hterm_module.js","webpack:///./src/main.ts","webpack:///./~/xterm/lib/CompositionHelper.js","webpack:///./~/xterm/lib/InputHandler.js","webpack:///./~/xterm/lib/Linkifier.js","webpack:///./~/xterm/lib/Parser.js","webpack:///./~/xterm/lib/Renderer.js","webpack:///./~/xterm/lib/SelectionManager.js","webpack:///./~/xterm/lib/SelectionModel.js","webpack:///./~/xterm/lib/Viewport.js","webpack:///./~/xterm/lib/addons ^\\.\\/.*$","webpack:///./~/xterm/lib/addons/attach/package.json","webpack:///./~/xterm/lib/addons/fit/package.json","webpack:///./~/xterm/lib/addons/fullscreen/package.json","webpack:///./~/xterm/lib/addons/terminado/package.json","webpack:///./~/xterm/lib/handlers/Clipboard.js","webpack:///./~/xterm/lib/utils/CharMeasure.js","webpack:///./~/xterm/lib/utils/CircularList.js","webpack:///./~/xterm/lib/utils/DomElementObjectPool.js","webpack:///./~/xterm/lib/utils/Generic.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AChEA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA,UAAU,QAAQ;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,iBAAiB;AAC7C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,gDAAgD,8CAA8C;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,iBAAiB;AAC7C,KAAK;AACL;AACA,2BAA2B,iBAAiB;AAC5C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL,mCAAmC,yCAAyC,EAAE;AAC9E,iEAAiE,yCAAyC,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,4CAA4C;AACtE,iCAAiC,wCAAwC;AACzE,gCAAgC,0CAA0C;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,cAAc;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,iEAAiE;AACjE,wHAAwH;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,iEAAiE;AACjE,wHAAwH;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,iEAAiE;AACjE,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,iEAAiE;AACjE,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,mCAAmC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,6BAA6B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AC5lDA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AC1DA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,qCAAqC;AACtC;;AAEA;;;;;;;;ACzCA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;;AAEA;;;;;;;AChKA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,UAAU;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;AC7HD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B;AAC/B;AACA,kCAAkC;AAClC;AACA;;AAEA;AACA;;AAEA,gBAAgB;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;ACrFD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;ACjDD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,UAAU;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;;ACtID;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACdA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;;;;;;;;;;ACnCA,mCAAgC;AAEhC;IAYI,mBAAY,IAAiB;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAAA,CAAC;IAEF,wBAAI,GAAJ;QACI,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACtD,CAAC;IAAA,CAAC;IAEF,0BAAM,GAAN,UAAO,IAAY;QACf,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,+BAAW,GAAX,UAAY,OAAe,EAAE,OAAe;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,iCAAa,GAAb;QACI,iEAAiE;QACjE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,kCAAc,GAAd,UAAe,KAAa;QACxB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAAA,CAAC;IAEF,kCAAc,GAAd,UAAe,KAAa;QAA5B,iBAIC;QAHG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YAC3B,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IAEF,2BAAO,GAAP,UAAQ,QAAiC;QACrC,IAAI,CAAC,EAAE,CAAC,aAAa,GAAG,UAAC,IAAI;YACzB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC;QACF,IAAI,CAAC,EAAE,CAAC,UAAU,GAAG,UAAC,IAAI;YACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC;IACN,CAAC;IAAA,CAAC;IAEF,4BAAQ,GAAR,UAAS,QAAiD;QAA1D,iBAMC;QALG,IAAI,CAAC,EAAE,CAAC,gBAAgB,GAAG,UAAC,OAAe,EAAE,IAAY;YACrD,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACN,CAAC;IAAA,CAAC;IAEF,8BAAU,GAAV;QACI,IAAI,CAAC,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,UAAU,GAAG,IAAI;QACzB,IAAI,CAAC,EAAE,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IAED,yBAAK,GAAL;QACI,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAED,yBAAK,GAAL;QACI,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IACL,gBAAC;AAAD,CAAC;AAzFY,8BAAS;;;;;;;;;;ACFtB;IAII,2BAAY,GAAW,EAAE,SAAmB;QACxC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF,kCAAM,GAAN;QACI,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAAA,CAAC;IACN,wBAAC;AAAD,CAAC;AAZY,8CAAiB;AAc9B;IAII,oBAAY,GAAW,EAAE,SAAmB;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,yBAAI,GAAJ;QACI,6BAA6B;IACjC,CAAC;IAAA,CAAC;IAEF,0BAAK,GAAL;QACI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAAA,CAAC;IAEF,yBAAI,GAAJ,UAAK,IAAY;QACb,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAAA,CAAC;IAEF,2BAAM,GAAN;QACI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU;YAC5C,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YACzC,MAAM,CAAC,IAAI;QACf,CAAC;QACD,MAAM,CAAC,KAAK;IAChB,CAAC;IAED,2BAAM,GAAN,UAAO,QAAoB;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,UAAC,KAAK;YACrB,QAAQ,EAAE,CAAC;QACf,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,8BAAS,GAAT,UAAU,QAAgC;QACtC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,UAAC,KAAK;YACxB,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,4BAAO,GAAP,UAAQ,QAAoB;QACxB,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,UAAC,KAAK;YACtB,QAAQ,EAAE,CAAC;QACf,CAAC,CAAC;IACN,CAAC;IAAA,CAAC;IACN,iBAAC;AAAD,CAAC;AA7CY,gCAAU;;;;;;;;;;ACdV,iBAAS,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEvB,uBAAe,GAAG,GAAG,CAAC;AACtB,gBAAQ,GAAG,GAAG,CAAC;AACf,eAAO,GAAG,GAAG,CAAC;AACd,yBAAiB,GAAG,GAAG,CAAC;AAExB,wBAAgB,GAAG,GAAG,CAAC;AACvB,iBAAS,GAAG,GAAG,CAAC;AAChB,eAAO,GAAG,GAAG,CAAC;AACd,yBAAiB,GAAG,GAAG,CAAC;AACxB,yBAAiB,GAAG,GAAG,CAAC;AACxB,uBAAe,GAAG,GAAG,CAAC;AAgCnC;IAOI,gBAAY,IAAc,EAAE,iBAAoC,EAAE,IAAY,EAAE,SAAiB;QAC7F,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACxB,CAAC;IAAA,CAAC;IAEF,qBAAI,GAAJ;QAAA,iBA2FC;QA1FG,IAAI,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;QACjD,IAAI,SAAiB,CAAC;QACtB,IAAI,gBAAwB,CAAC;QAE7B,IAAM,KAAK,GAAG;YACV,UAAU,CAAC,MAAM,CAAC;gBACd,IAAM,QAAQ,GAAG,KAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAElC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAC1B;oBACI,SAAS,EAAE,KAAI,CAAC,IAAI;oBACpB,SAAS,EAAE,KAAI,CAAC,SAAS;iBAC5B,CACJ,CAAC,CAAC;gBAGH,IAAM,aAAa,GAAG,UAAC,OAAe,EAAE,IAAY;oBAChD,UAAU,CAAC,IAAI,CACX,yBAAiB,GAAG,IAAI,CAAC,SAAS,CAC9B;wBACI,OAAO,EAAE,OAAO;wBAChB,IAAI,EAAE,IAAI;qBACb,CACJ,CACJ,CAAC;gBACN,CAAC,CAAC;gBAEF,KAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;gBAClC,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAE/C,KAAI,CAAC,IAAI,CAAC,OAAO,CACb,UAAC,KAAa;oBACV,UAAU,CAAC,IAAI,CAAC,gBAAQ,GAAG,KAAK,CAAC,CAAC;gBACtC,CAAC,CACJ,CAAC;gBAEF,SAAS,GAAG,WAAW,CAAC;oBACpB,UAAU,CAAC,IAAI,CAAC,eAAO,CAAC;gBAC5B,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;YAElB,CAAC,CAAC,CAAC;YAEH,UAAU,CAAC,SAAS,CAAC,UAAC,IAAI;gBACtB,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC9B,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACd,KAAK,iBAAS;wBACV,KAAI,CAAC,IAAI,CAAC,MAAM,CACZ,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAS,CAAC;4BACjE,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBACjE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CACf,CAAC;wBACF,KAAK,CAAC;oBACV,KAAK,eAAO;wBACR,KAAK,CAAC;oBACV,KAAK,yBAAiB;wBAClB,KAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;wBAClC,KAAK,CAAC;oBACV,KAAK,yBAAiB;wBAClB,IAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;wBACxC,KAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;wBACtC,KAAK,CAAC;oBACV,KAAK,uBAAe;wBAChB,IAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;wBAC1C,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,aAAa,GAAG,UAAU,CAAC;wBAChE,KAAI,CAAC,SAAS,GAAG,aAAa,CAAC;wBAC/B,KAAK,CAAC;gBACd,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,UAAU,CAAC,OAAO,CAAC;gBACf,aAAa,CAAC,SAAS,CAAC,CAAC;gBACzB,KAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACvB,KAAI,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;gBAC9C,EAAE,CAAC,CAAC,KAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;oBACrB,gBAAgB,GAAG,UAAU,CAAC;wBAC1B,UAAU,GAAG,KAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;wBAC7C,KAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;wBAClB,KAAK,EAAE,CAAC;oBACZ,CAAC,EAAE,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,UAAU,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QAED,KAAK,EAAE,CAAC;QACR,MAAM,CAAC;YACH,YAAY,CAAC,gBAAgB,CAAC,CAAC;YAC/B,UAAU,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;IACL,CAAC;IAAA,CAAC;IACN,aAAC;AAAD,CAAC;AA3GY,wBAAM;AA2GlB,CAAC;;;;;;;;;;ACvJF,kCAA8B;AAE9B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEtB;IAUI,mBAAY,IAAiB;QAA7B,iBAqBC;QApBG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAEvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,eAAe,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAG3B,IAAI,CAAC,cAAc,GAAG;YAClB,KAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAChB,KAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YAC3B,KAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAI,CAAC,cAAc,CAAC,CAAC;QACjG,CAAC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;YACjB,KAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,cAAQ,KAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF,wBAAI,GAAJ;QACI,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC7D,CAAC;IAAA,CAAC;IAEF,0BAAM,GAAN,UAAO,IAAY;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAA,CAAC;IAEF,+BAAW,GAAX,UAAY,OAAe,EAAE,OAAe;QAA5C,iBAYC;QAXG,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEpC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YACpB,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC;QACD,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;gBAC3B,KAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAI,CAAC,OAAO,CAAC,CAAC;YACxC,CAAC,EAAE,OAAO,CAAC,CAAC;QAChB,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,iCAAa,GAAb;QACI,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;IACL,CAAC;IAED,kCAAc,GAAd,UAAe,KAAa;QACxB,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,CAAC;IAAA,CAAC;IAEF,kCAAc,GAAd,UAAe,KAAa;IAC5B,CAAC;IAAA,CAAC;IAEF,2BAAO,GAAP,UAAQ,QAAiC;QACrC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;YACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IAEP,CAAC;IAAA,CAAC;IAEF,4BAAQ,GAAR,UAAS,QAAiD;QACtD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAC,IAAI;YACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IAEF,8BAAU,GAAV;QACI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED,yBAAK,GAAL;QACI,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,yBAAK,GAAL;QACI,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IACL,gBAAC;AAAD,CAAC;AAhGY,8BAAS;;;;;;;;ACJtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,iBAAiB,sBAAsB;AACvC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,mBAAmB;AAC9B,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,EAAE,WAAW,EAAE,WAAW,EAAE;;AAEjD;AACA;AACA,2BAA2B,IAAI,YAAY,IAAI;AAC/C,eAAe,IAAI;AACnB;;AAEA;AACA;AACA;AACA,iBAAiB,IAAI,YAAY,IAAI,YAAY,IAAI;AACrD;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,IAAI,YAAY,IAAI,YAAY,IAAI;AACrD;AACA;;AAEA;AACA,6BAA6B,IAAI,aAAa,IAAI,aAAa,IAAI;;AAEnE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,gBAAgB;AAChB,iBAAiB;AACjB,kBAAkB;AAClB,iBAAiB;AACjB;;AAEA,kDAAkD,gBAAgB;AAClE;AACA;;AAEA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2CAA2C,iCAAiC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,IAAI;AACf;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,4BAA4B,uBAAuB;AACnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA,oBAAoB,+BAA+B;;AAEnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,sBAAsB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,kBAAkB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,8CAA8C;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,8CAA8C;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,0BAA0B;;AAE9C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,wCAAwC;AACnD;AACA;AACA,WAAW,8CAA8C;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA,iBAAiB,qBAAqB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iBAAiB,kCAAkC;AACnD;;AAEA,iBAAiB,6BAA6B;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,SAAS,kBAAkB,aAAa,WAAW,kBAAkB;AAC9E;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,YAAY,OAAO;AACnB;AACA;AACA;AACA,aAAa;AACb,eAAe;AACf,cAAc;AACd;;AAEA,iBAAiB,cAAc;AAC/B;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,iBAAiB,cAAc;AAC/B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,iBAAiB,uBAAuB;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,qBAAqB;AAC1C;AACA,uBAAuB,qDAAqD;AAC5E;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,sBAAsB;AAC3C;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,YAAY,EAAE;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,YAAY,EAAE;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW;AACX;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW;AACX;AACA;AACA;AACA;;AAEA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;;AAEA;;AAEA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW;AACX;AACA;AACA;AACA;;AAEA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;;AAEZ;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,oBAAoB;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,SAAS;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,qBAAqB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,SAAS;AACtC;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA,WAAW,OAAO;AAClB;AACA,WAAW,yCAAyC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,qBAAqB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA,YAAY,IAAI;AAChB;AACA;AACA;AACA;;AAEA,iBAAiB,6CAA6C;AAC9D;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,wBAAwB;AACnC;AACA,WAAW,qBAAqB;AAChC;AACA,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,IAAI;AACf;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,EAAE;AACb,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,2BAA2B;AAC3E;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,IAAI;AACf;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ,kDAAkD;AACtE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,YAAY,OAAO;AACnB;AACA;AACA;;AAEA,iCAAiC,yBAAyB;AAC1D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC,cAAc;AAClD,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL,sCAAsC,eAAe;AACrD;AACA;AACA,CAAC;;AAED;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6DAA6D,eAAe;;AAE5E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,aAAa;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,eAAe;AACnC,eAAe,OAAO;AACtB,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,0BAA0B,wCAAwC,EAAE;AAC3E;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,uBAAuB;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,0BAA0B;AAC1B,qBAAqB;AACrB,8BAA8B;AAC9B,gBAAgB;AAChB,gBAAgB;AAChB,kBAAkB;AAClB,mBAAmB;AACnB,uBAAuB;AACvB,uBAAuB;AACvB,uEAAuE;AACvE,qEAAqE;;AAErE;AACA;AACA;AACA;AACA,uBAAuB;AACvB,mCAAmC;AACnC,sCAAsC;AACtC,uEAAuE;AACvE,4DAA4D;AAC5D,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA,0BAA0B;AAC1B,2BAA2B;AAC3B,yBAAyB;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0BAA0B;AACrC,WAAW,yCAAyC;AACpD;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH,eAAe;;AAEf;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,WAAW,iCAAiC;AAC5C,WAAW,yCAAyC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mDAAmD;AACnD;AACA;AACA,oBAAoB,0BAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;;AAEpB;AACA,iBAAiB,yBAAyB,uBAAuB;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,0CAA0C;AACrE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0BAA0B;AACrC,WAAW,0BAA0B;AACrC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;;AAEA;AACA,YAAY,OAAO;AACnB;AACA;;AAEA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO;AACP;AACA;;AAEA,OAAO;AACP;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,YAAY;;AAEZ;AACA,YAAY;;AAEZ;AACA,YAAY;;;AAGZ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,EAAE;AAChD;AACA,KAAK;AACL;AACA,8CAA8C,EAAE;AAChD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,+CAA+C;AAC/C,GAAG;AACH,yBAAyB;AACzB,GAAG;AACH,qBAAqB;AACrB,GAAG;AACH,qBAAqB;AACrB,GAAG;AACH,sBAAsB;AACtB,GAAG;AACH,mBAAmB;AACnB,GAAG;AACH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAK;AACb,oBAAoB;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,sDAAsD,yBAAyB;AAC/E;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,oBAAoB;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,oBAAoB;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,oBAAoB;AAC/B;AACA;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,YAAY;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,YAAY,MAAM;AAClB;AACA;AACA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;;AAEA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB,oBAAoB;AACpB,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB,oBAAoB;AACpB,oBAAoB;AACpB,mBAAmB;AACnB,wBAAwB;AACxB,+CAA+C;AAC/C,iCAAiC;AACjC,8BAA8B;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd,wBAAwB;AACxB,8CAA8C;AAC9C,mDAAmD;AACnD,QAAQ;AACR;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,sBAAsB;AACtB,8BAA8B;AAC9B,uBAAuB;AACvB,oCAAoC;AACpC,oBAAoB;AACpB,0BAA0B,oBAAoB;AAC9C,wBAAwB;AACxB,mBAAmB;AACnB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,uBAAuB;AACvB,wBAAwB;AACxB,iCAAiC;AACjC,8BAA8B;AAC9B;;AAEA;AACA;AACA;AACA,sBAAsB;AACtB,wBAAwB;AACxB,4CAA4C;AAC5C,wBAAwB;;AAExB;;AAEA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,cAAc;AACd,eAAe;AACf;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,iBAAiB;AACjB,gBAAgB;AAChB,eAAe;AACf,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,gBAAgB;AAChB,iBAAiB;AACjB,4BAA4B;AAC5B,iCAAiC;AACjC,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,yBAAyB,6BAA6B;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,mBAAmB;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,6BAA6B;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,6BAA6B;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,6BAA6B;AAC9C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,gCAAgC;AAC7D;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,8DAA8D;AAC9D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,8BAA8B,wBAAwB,EAAE;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;;AAEvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;;AAEA;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,SAAS,WAAW,EAAE,KAAK;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6CAA6C;AAC7C;AACA,8BAA8B;AAC9B,GAAG;AACH,8BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,aAAa;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH,2CAA2C,QAAQ;AACnD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,2BAA2B;AAChD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,kDAAkD,cAAc;;AAEhE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC,iCAAiC;AACjC,mDAAmD;AACnD,4BAA4B;AAC5B,8BAA8B;AAC9B,SAAS;AACT,kBAAkB;AAClB,gCAAgC;AAChC,6BAA6B;AAC7B,uDAAuD;AACvD,oDAAoD;AACpD,SAAS;AACT,eAAe;AACf,iFAAiF;AACjF,mFAAmF;AACnF,uCAAuC;AACvC,uCAAuC;AACvC,4CAA4C;AAC5C,0CAA0C;AAC1C,gDAAgD;AAChD,qEAAqE;AACrE,SAAS;AACT,0BAA0B;AAC1B,gBAAgB,cAAc,EAAE;AAChC,cAAc,cAAc,EAAE;AAC9B,SAAS;AACT,qBAAqB;AACrB,gCAAgC;AAChC,+DAA+D;AAC/D,8CAA8C;AAC9C,iDAAiD;AACjD,yCAAyC;AACzC,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,iFAAiF;AACjF,iFAAiF;AACjF,uBAAuB;AACvB,2CAA2C;AAC3C,6CAA6C;AAC7C,mEAAmE;AACnE,gEAAgE;;AAEhE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,mBAAmB;AACnB,uBAAuB;AACvB,oBAAoB;AACpB,qBAAqB;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,aAAa;AACxB;AACA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,OAAO;AACjB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,mBAAmB,mBAAmB;AACtC;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iBAAiB,gBAAgB;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,8BAA8B,aAAa;AAC3C;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA,mBAAmB,8BAA8B;AACjD,qBAAqB,6BAA6B;AAClD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,WAAW;AAC5B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,gCAAgC;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS,6BAA6B;AACtC,SAAS,qCAAqC;AAC9C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC;AACnC,0BAA0B;AAC1B,4BAA4B;AAC5B,uBAAuB;AACvB,0CAA0C;AAC1C,oBAAoB;AACpB,sBAAsB;AACtB,4BAA4B;AAC5B,wCAAwC;AACxC,mCAAmC;AACnC,qCAAqC;AACrC,gCAAgC;;AAEhC;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B,uBAAuB;AACvB,0CAA0C;AAC1C,4BAA4B;AAC5B,mCAAmC;AACnC,mDAAmD;AACnD,gCAAgC;AAChC,gDAAgD;;AAEhD;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,8BAA8B;AAC9B,0BAA0B;AAC1B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,4BAA4B,WAAW;AACvC,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,gDAAgD;;AAEhD;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,eAAe;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,qBAAqB;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B,WAAW,gBAAgB;AAC3B,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,IAAI;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,GAAG,kBAAkB;AACrB;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,GAAG;AACH;AACA;;AAEA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,GAAG,uBAAuB;AAC1B;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsC,UAAU,OAAO;AACvD;AACA,wCAAwC;;AAExC;AACA;AACA;;AAEA,0BAA0B,wBAAwB;AAClD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC,yBAAyB;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA,uDAAuD;AACvD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,uBAAuB;AACxC;AACA;AACA;AACA,4CAA4C;;AAE5C;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA,0CAA0C,GAAG,IAAI,KAAK;AACtD;AACA;AACA;AACA;AACA,oBAAoB,gCAAgC;AACpD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,IAAI;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,4BAA4B;AAC7C;;AAEA;AACA,qBAAqB;AACrB;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,sBAAsB;AAC7B;AACA;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,OAAO;AACP;;AAEA,OAAO;AACP;;AAEA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA,KAAK;AACL;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yCAAyC,0BAA0B;AACnE;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,kDAAkD;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C,oBAAoB;AAC9D;AACA;AACA;AACA,6CAA6C,IAAI,IAAI;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH,0CAA0C,EAAE,EAAE;AAC9C,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,sBAAsB;AACjC;AACA;AACA;AACA,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA,4BAA4B;AAC5B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;AACL,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC9jjBA,sCAAoC;AACpC,sCAAoC;AACpC,uCAAuD;AACvD,0CAAgD;AAMhD,IAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC;AAEhD,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAChB,IAAI,IAAc,CAAC;IACnB,EAAE,CAAC,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC;QACxB,IAAI,GAAG,IAAI,iBAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,IAAI,GAAG,IAAI,iBAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IACD,IAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC;IAC1D,IAAM,GAAG,GAAG,CAAC,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzG,IAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpC,IAAM,OAAO,GAAG,IAAI,6BAAiB,CAAC,GAAG,EAAE,kBAAS,CAAC,CAAC;IACtD,IAAM,EAAE,GAAG,IAAI,eAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC7D,IAAM,QAAM,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IAEzB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE;QAC9B,QAAM,EAAE,CAAC;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAAA,CAAC;;;;;;;;AC7BF;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,8CAA8C,EAAE;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AC5HA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,uDAAuD,EAAE;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,yBAAyB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,IAAI;AACxE;AACA;AACA,qEAAqE,GAAG;AACxE;AACA;AACA;AACA;AACA;AACA,qEAAqE,MAAM;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG,qBAAqB;;AAEzB;;;;;;;;ACx6BA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA,2BAA2B,IAAI;AAC/B,sBAAsB,IAAI,KAAK,EAAE,IAAI,IAAI;AACzC;AACA,wBAAwB,IAAI;AAC5B;AACA;AACA,mFAAmF;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,gBAAgB;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,cAAc;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,QAAQ;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,mCAAmC,yBAAyB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,4BAA4B;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;;;;;;;;ACzOA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA,2EAA2E,uBAAuB;AAClG,0EAA0E,2BAA2B;AACrG;AACA;AACA,0EAA0E,iCAAiC;AAC3G,0EAA0E,4BAA4B;AACtG,0EAA0E,sBAAsB;AAChG,0EAA0E,2BAA2B;AACrG,0EAA0E,0BAA0B;AACpG,2EAA2E,6CAA6C;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,4CAA4C;AAC/G;AACA,+CAA+C,8BAA8B;AAC7E,+CAA+C,8BAA8B;AAC7E,+CAA+C,8BAA8B;AAC7E,+CAA+C,gDAAgD;AAC/F,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,+BAA+B;AAC9E,+CAA+C,+BAA+B;AAC9E,+CAA+C,+BAA+B;AAC9E,gDAAgD,gCAAgC;AAChF,uBAAuB,wBAAwB,+BAA+B;AAC9E,oEAAoE,4CAA4C;AAChH;AACA,2DAA2D,oCAAoC;AAC/F,2DAA2D,iCAAiC;AAC5F,2DAA2D,mCAAmC;AAC9F,2DAA2D,sCAAsC;AACjG,2DAA2D,uCAAuC;AAClG,2DAA2D,uCAAuC;AAClG,2DAA2D,4CAA4C;AACvG,2DAA2D,2CAA2C;AACtG,2DAA2D,uCAAuC;AAClG,2DAA2D,yCAAyC;AACpG,2DAA2D,uCAAuC;AAClG,2DAA2D,oCAAoC;AAC/F,2DAA2D,oCAAoC;AAC/F,2DAA2D,oCAAoC;AAC/F,2DAA2D,oCAAoC;AAC/F,2DAA2D,iCAAiC;AAC5F;AACA;AACA;AACA;AACA;AACA,2DAA2D,mCAAmC;AAC9F,2DAA2D,0CAA0C;AACrG,2DAA2D,wCAAwC;AACnG,2DAA2D,0CAA0C;AACrG,2DAA2D,iDAAiD;AAC5G,2DAA2D,6CAA6C;AACxG,2DAA2D,wCAAwC;AACnG,2DAA2D,0CAA0C;AACrG,2DAA2D,mCAAmC;AAC9F,2DAA2D,iCAAiC;AAC5F,2DAA2D,gCAAgC;AAC3F,2DAA2D,kCAAkC;AAC7F,2DAA2D,uCAAuC;AAClG,2DAA2D,qCAAqC;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,wCAAwC;AAC3F,mDAAmD,mCAAmC;AACtF,mDAAmD,sCAAsC;AACzF,iGAAiG,4CAA4C;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,kCAAkC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AC7dA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,sBAAsB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,yBAAyB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mCAAmC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA,8CAA8C;AAC9C;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,0DAA0D;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,cAAc;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACrRA;AACA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,sCAAsC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,8BAA8B;AACpF,oDAAoD,kCAAkC;AACtF,oDAAoD,kCAAkC;AACtF,kDAAkD,gCAAgC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,iBAAiB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,cAAc;AAChD,gCAAgC,eAAe;AAC/C;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oFAAoF,yBAAyB,EAAE;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,6EAA6E;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,4BAA4B,EAAE;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;ACrZA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;ACxEA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,+BAA+B,EAAE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uB;;;;;;AC7BA,kBAAkB,wD;;;;;;ACAlB,kBAAkB,kD;;;;;;;;;;;;ACAlB,kBAAkB,gE;;;;;;ACAlB,kBAAkB,8D;;;;;;;ACAlB;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACpEA;AACA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,2BAA2B,EAAE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AClEA;AACA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,2BAA2B,yCAAyC;AACpE;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,0CAA0C,eAAe;AACzD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,cAAc;AAC/C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA,+BAA+B,gCAAgC;AAC/D;AACA;AACA;AACA;AACA;AACA,0CAA0C,YAAY;AACtD;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AClKA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;;;;;;;;AC5CA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;;AAEA","file":"./dist/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 15);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap d143500d12edcad940e0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar CompositionHelper_1 = require(\"./CompositionHelper\");\nvar EventEmitter_1 = require(\"./EventEmitter\");\nvar Viewport_1 = require(\"./Viewport\");\nvar Clipboard_1 = require(\"./handlers/Clipboard\");\nvar CircularList_1 = require(\"./utils/CircularList\");\nvar EscapeSequences_1 = require(\"./EscapeSequences\");\nvar InputHandler_1 = require(\"./InputHandler\");\nvar Parser_1 = require(\"./Parser\");\nvar Renderer_1 = require(\"./Renderer\");\nvar Linkifier_1 = require(\"./Linkifier\");\nvar SelectionManager_1 = require(\"./SelectionManager\");\nvar CharMeasure_1 = require(\"./utils/CharMeasure\");\nvar Browser = require(\"./utils/Browser\");\nvar Mouse_1 = require(\"./utils/Mouse\");\nvar document = (typeof window != 'undefined') ? window.document : null;\nvar WRITE_BUFFER_PAUSE_THRESHOLD = 5;\nvar WRITE_BATCH_SIZE = 300;\nvar CURSOR_BLINK_INTERVAL = 600;\nfunction Terminal(options) {\n var self = this;\n if (!(this instanceof Terminal)) {\n return new Terminal(arguments[0], arguments[1], arguments[2]);\n }\n self.browser = Browser;\n self.cancel = Terminal.cancel;\n EventEmitter_1.EventEmitter.call(this);\n if (typeof options === 'number') {\n options = {\n cols: arguments[0],\n rows: arguments[1],\n handler: arguments[2]\n };\n }\n options = options || {};\n Object.keys(Terminal.defaults).forEach(function (key) {\n if (options[key] == null) {\n options[key] = Terminal.options[key];\n if (Terminal[key] !== Terminal.defaults[key]) {\n options[key] = Terminal[key];\n }\n }\n self[key] = options[key];\n });\n if (options.colors.length === 8) {\n options.colors = options.colors.concat(Terminal._colors.slice(8));\n }\n else if (options.colors.length === 16) {\n options.colors = options.colors.concat(Terminal._colors.slice(16));\n }\n else if (options.colors.length === 10) {\n options.colors = options.colors.slice(0, -2).concat(Terminal._colors.slice(8, -2), options.colors.slice(-2));\n }\n else if (options.colors.length === 18) {\n options.colors = options.colors.concat(Terminal._colors.slice(16, -2), options.colors.slice(-2));\n }\n this.colors = options.colors;\n this.options = options;\n this.parent = options.body || options.parent || (document ? document.getElementsByTagName('body')[0] : null);\n this.cols = options.cols || options.geometry[0];\n this.rows = options.rows || options.geometry[1];\n this.geometry = [this.cols, this.rows];\n if (options.handler) {\n this.on('data', options.handler);\n }\n this.ybase = 0;\n this.ydisp = 0;\n this.x = 0;\n this.y = 0;\n this.cursorState = 0;\n this.cursorHidden = false;\n this.convertEol;\n this.queue = '';\n this.scrollTop = 0;\n this.scrollBottom = this.rows - 1;\n this.customKeyEventHandler = null;\n this.cursorBlinkInterval = null;\n this.applicationKeypad = false;\n this.applicationCursor = false;\n this.originMode = false;\n this.insertMode = false;\n this.wraparoundMode = true;\n this.normal = null;\n this.charset = null;\n this.gcharset = null;\n this.glevel = 0;\n this.charsets = [null];\n this.decLocator;\n this.x10Mouse;\n this.vt200Mouse;\n this.vt300Mouse;\n this.normalMouse;\n this.mouseEvents;\n this.sendFocus;\n this.utfMouse;\n this.sgrMouse;\n this.urxvtMouse;\n this.element;\n this.children;\n this.refreshStart;\n this.refreshEnd;\n this.savedX;\n this.savedY;\n this.savedCols;\n this.readable = true;\n this.writable = true;\n this.defAttr = (0 << 18) | (257 << 9) | (256 << 0);\n this.curAttr = this.defAttr;\n this.params = [];\n this.currentParam = 0;\n this.prefix = '';\n this.postfix = '';\n this.inputHandler = new InputHandler_1.InputHandler(this);\n this.parser = new Parser_1.Parser(this.inputHandler, this);\n this.renderer = this.renderer || null;\n this.selectionManager = this.selectionManager || null;\n this.linkifier = this.linkifier || new Linkifier_1.Linkifier();\n this.writeBuffer = [];\n this.writeInProgress = false;\n this.xoffSentToCatchUp = false;\n this.writeStopped = false;\n this.surrogate_high = '';\n this.lines = new CircularList_1.CircularList(this.scrollback);\n var i = this.rows;\n while (i--) {\n this.lines.push(this.blankLine());\n }\n if (this.selectionManager) {\n this.selectionManager.setBuffer(this.lines);\n }\n this.tabs;\n this.setupStops();\n this.userScrolling = false;\n}\ninherits(Terminal, EventEmitter_1.EventEmitter);\nTerminal.prototype.eraseAttr = function () {\n return (this.defAttr & ~0x1ff) | (this.curAttr & 0x1ff);\n};\nTerminal.tangoColors = [\n '#2e3436',\n '#cc0000',\n '#4e9a06',\n '#c4a000',\n '#3465a4',\n '#75507b',\n '#06989a',\n '#d3d7cf',\n '#555753',\n '#ef2929',\n '#8ae234',\n '#fce94f',\n '#729fcf',\n '#ad7fa8',\n '#34e2e2',\n '#eeeeec'\n];\nTerminal.colors = (function () {\n var colors = Terminal.tangoColors.slice(), r = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff], i;\n i = 0;\n for (; i < 216; i++) {\n out(r[(i / 36) % 6 | 0], r[(i / 6) % 6 | 0], r[i % 6]);\n }\n i = 0;\n for (; i < 24; i++) {\n r = 8 + i * 10;\n out(r, r, r);\n }\n function out(r, g, b) {\n colors.push('#' + hex(r) + hex(g) + hex(b));\n }\n function hex(c) {\n c = c.toString(16);\n return c.length < 2 ? '0' + c : c;\n }\n return colors;\n})();\nTerminal._colors = Terminal.colors.slice();\nTerminal.vcolors = (function () {\n var out = [], colors = Terminal.colors, i = 0, color;\n for (; i < 256; i++) {\n color = parseInt(colors[i].substring(1), 16);\n out.push([\n (color >> 16) & 0xff,\n (color >> 8) & 0xff,\n color & 0xff\n ]);\n }\n return out;\n})();\nTerminal.defaults = {\n colors: Terminal.colors,\n theme: 'default',\n convertEol: false,\n termName: 'xterm',\n geometry: [80, 24],\n cursorBlink: false,\n cursorStyle: 'block',\n visualBell: false,\n popOnBell: false,\n scrollback: 1000,\n screenKeys: false,\n debug: false,\n cancelEvents: false,\n disableStdin: false,\n useFlowControl: false,\n tabStopWidth: 8\n};\nTerminal.options = {};\nTerminal.focus = null;\neach(keys(Terminal.defaults), function (key) {\n Terminal[key] = Terminal.defaults[key];\n Terminal.options[key] = Terminal.defaults[key];\n});\nTerminal.prototype.focus = function () {\n return this.textarea.focus();\n};\nTerminal.prototype.getOption = function (key, value) {\n if (!(key in Terminal.defaults)) {\n throw new Error('No option with key \"' + key + '\"');\n }\n if (typeof this.options[key] !== 'undefined') {\n return this.options[key];\n }\n return this[key];\n};\nTerminal.prototype.setOption = function (key, value) {\n if (!(key in Terminal.defaults)) {\n throw new Error('No option with key \"' + key + '\"');\n }\n switch (key) {\n case 'scrollback':\n if (value < this.rows) {\n var msg = 'Setting the scrollback value less than the number of rows ';\n msg += \"(\" + this.rows + \") is not allowed.\";\n console.warn(msg);\n return false;\n }\n if (this.options[key] !== value) {\n if (this.lines.length > value) {\n var amountToTrim = this.lines.length - value;\n var needsRefresh = (this.ydisp - 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 if (needsRefresh) {\n this.refresh(0, this.rows - 1);\n }\n }\n this.lines.maxLength = value;\n this.viewport.syncScrollArea();\n }\n break;\n }\n this[key] = value;\n this.options[key] = value;\n switch (key) {\n case 'cursorBlink':\n this.setCursorBlinking(value);\n break;\n case 'cursorStyle':\n this.element.classList.toggle(\"xterm-cursor-style-underline\", value === 'underline');\n this.element.classList.toggle(\"xterm-cursor-style-bar\", value === 'bar');\n break;\n case 'tabStopWidth':\n this.setupStops();\n break;\n }\n};\nTerminal.prototype.restartCursorBlinking = function () {\n this.setCursorBlinking(this.options.cursorBlink);\n};\nTerminal.prototype.setCursorBlinking = function (enabled) {\n this.element.classList.toggle('xterm-cursor-blink', enabled);\n this.clearCursorBlinkingInterval();\n if (enabled) {\n var self = this;\n this.cursorBlinkInterval = setInterval(function () {\n self.element.classList.toggle('xterm-cursor-blink-on');\n }, CURSOR_BLINK_INTERVAL);\n }\n};\nTerminal.prototype.clearCursorBlinkingInterval = function () {\n this.element.classList.remove('xterm-cursor-blink-on');\n if (this.cursorBlinkInterval) {\n clearInterval(this.cursorBlinkInterval);\n this.cursorBlinkInterval = null;\n }\n};\nTerminal.bindFocus = function (term) {\n on(term.textarea, 'focus', function (ev) {\n if (term.sendFocus) {\n term.send(EscapeSequences_1.C0.ESC + '[I');\n }\n term.element.classList.add('focus');\n term.showCursor();\n term.restartCursorBlinking.apply(term);\n Terminal.focus = term;\n term.emit('focus', { terminal: term });\n });\n};\nTerminal.prototype.blur = function () {\n return this.textarea.blur();\n};\nTerminal.bindBlur = function (term) {\n on(term.textarea, 'blur', function (ev) {\n term.refresh(term.y, term.y);\n if (term.sendFocus) {\n term.send(EscapeSequences_1.C0.ESC + '[O');\n }\n term.element.classList.remove('focus');\n term.clearCursorBlinkingInterval.apply(term);\n Terminal.focus = null;\n term.emit('blur', { terminal: term });\n });\n};\nTerminal.prototype.initGlobal = function () {\n var _this = this;\n var term = this;\n Terminal.bindKeys(this);\n Terminal.bindFocus(this);\n Terminal.bindBlur(this);\n on(this.element, 'copy', function (event) {\n if (_this.mouseEvents) {\n return;\n }\n Clipboard_1.copyHandler(event, term, _this.selectionManager);\n });\n var pasteHandlerWrapper = function (event) { return Clipboard_1.pasteHandler(event, term); };\n on(this.textarea, 'paste', pasteHandlerWrapper);\n on(this.element, 'paste', pasteHandlerWrapper);\n if (term.browser.isFirefox) {\n on(this.element, 'mousedown', function (event) {\n if (event.button == 2) {\n Clipboard_1.rightClickHandler(event, _this.textarea, _this.selectionManager);\n }\n });\n }\n else {\n on(this.element, 'contextmenu', function (event) {\n Clipboard_1.rightClickHandler(event, _this.textarea, _this.selectionManager);\n });\n }\n if (term.browser.isLinux) {\n on(this.element, 'auxclick', function (event) {\n if (event.button === 1) {\n Clipboard_1.moveTextAreaUnderMouseCursor(event, _this.textarea, _this.selectionManager);\n }\n });\n }\n};\nTerminal.bindKeys = function (term) {\n on(term.element, 'keydown', function (ev) {\n if (document.activeElement != this) {\n return;\n }\n term.keyDown(ev);\n }, true);\n on(term.element, 'keypress', function (ev) {\n if (document.activeElement != this) {\n return;\n }\n term.keyPress(ev);\n }, true);\n on(term.element, 'keyup', function (ev) {\n if (!wasMondifierKeyOnlyEvent(ev)) {\n term.focus(term);\n }\n }, true);\n on(term.textarea, 'keydown', function (ev) {\n term.keyDown(ev);\n }, true);\n on(term.textarea, 'keypress', function (ev) {\n term.keyPress(ev);\n this.value = '';\n }, true);\n on(term.textarea, 'compositionstart', term.compositionHelper.compositionstart.bind(term.compositionHelper));\n on(term.textarea, 'compositionupdate', term.compositionHelper.compositionupdate.bind(term.compositionHelper));\n on(term.textarea, 'compositionend', term.compositionHelper.compositionend.bind(term.compositionHelper));\n term.on('refresh', term.compositionHelper.updateCompositionElements.bind(term.compositionHelper));\n term.on('refresh', function (data) {\n term.queueLinkification(data.start, data.end);\n });\n};\nTerminal.prototype.insertRow = function (row) {\n if (typeof row != 'object') {\n row = document.createElement('div');\n }\n this.rowContainer.appendChild(row);\n this.children.push(row);\n return row;\n};\nTerminal.prototype.open = function (parent, focus) {\n var _this = this;\n var self = this, i = 0, div;\n this.parent = parent || this.parent;\n if (!this.parent) {\n throw new Error('Terminal requires a parent element.');\n }\n this.context = this.parent.ownerDocument.defaultView;\n this.document = this.parent.ownerDocument;\n this.body = this.document.getElementsByTagName('body')[0];\n this.element = this.document.createElement('div');\n this.element.classList.add('terminal');\n this.element.classList.add('xterm');\n this.element.classList.add('xterm-theme-' + this.theme);\n this.setCursorBlinking(this.options.cursorBlink);\n this.element.setAttribute('tabindex', 0);\n this.viewportElement = document.createElement('div');\n this.viewportElement.classList.add('xterm-viewport');\n this.element.appendChild(this.viewportElement);\n this.viewportScrollArea = document.createElement('div');\n this.viewportScrollArea.classList.add('xterm-scroll-area');\n this.viewportElement.appendChild(this.viewportScrollArea);\n this.selectionContainer = document.createElement('div');\n this.selectionContainer.classList.add('xterm-selection');\n this.element.appendChild(this.selectionContainer);\n this.rowContainer = document.createElement('div');\n this.rowContainer.classList.add('xterm-rows');\n this.element.appendChild(this.rowContainer);\n this.children = [];\n this.linkifier.attachToDom(document, this.children);\n this.helperContainer = document.createElement('div');\n this.helperContainer.classList.add('xterm-helpers');\n this.element.appendChild(this.helperContainer);\n this.textarea = document.createElement('textarea');\n this.textarea.classList.add('xterm-helper-textarea');\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.textarea.addEventListener('focus', function () {\n self.emit('focus', { terminal: self });\n });\n this.textarea.addEventListener('blur', function () {\n self.emit('blur', { terminal: self });\n });\n this.helperContainer.appendChild(this.textarea);\n this.compositionView = document.createElement('div');\n this.compositionView.classList.add('composition-view');\n this.compositionHelper = new CompositionHelper_1.CompositionHelper(this.textarea, this.compositionView, this);\n this.helperContainer.appendChild(this.compositionView);\n this.charSizeStyleElement = document.createElement('style');\n this.helperContainer.appendChild(this.charSizeStyleElement);\n for (; i < this.rows; i++) {\n this.insertRow();\n }\n this.parent.appendChild(this.element);\n this.charMeasure = new CharMeasure_1.CharMeasure(document, this.helperContainer);\n this.charMeasure.on('charsizechanged', function () {\n self.updateCharSizeStyles();\n });\n this.charMeasure.measure();\n this.viewport = new Viewport_1.Viewport(this, this.viewportElement, this.viewportScrollArea, this.charMeasure);\n this.renderer = new Renderer_1.Renderer(this);\n this.selectionManager = new SelectionManager_1.SelectionManager(this, this.lines, this.rowContainer, this.charMeasure);\n this.selectionManager.on('refresh', function (data) {\n _this.renderer.refreshSelection(data.start, data.end);\n });\n this.selectionManager.on('newselection', function (text) {\n _this.textarea.value = text;\n _this.textarea.focus();\n _this.textarea.select();\n });\n this.on('scroll', function () { return _this.selectionManager.refresh(); });\n this.viewportElement.addEventListener('scroll', function () { return _this.selectionManager.refresh(); });\n this.refresh(0, this.rows - 1);\n this.initGlobal();\n if (typeof focus == 'undefined') {\n var message = 'You did not pass the `focus` argument in `Terminal.prototype.open()`.\\n';\n message += 'The `focus` argument now defaults to `true` but starting with xterm.js 3.0 ';\n message += 'it will default to `false`.';\n console.warn(message);\n focus = true;\n }\n if (focus) {\n this.focus();\n }\n on(this.element, 'click', function () {\n var selection = document.getSelection(), collapsed = selection.isCollapsed, isRange = typeof collapsed == 'boolean' ? !collapsed : selection.type == 'Range';\n if (!isRange) {\n self.focus();\n }\n });\n this.bindMouse();\n this.emit('open');\n};\nTerminal.loadAddon = function (addon, callback) {\n if (typeof exports === 'object' && typeof module === 'object') {\n return require('./addons/' + addon + '/' + addon);\n }\n else if (typeof define == 'function') {\n return require(['./addons/' + addon + '/' + addon], callback);\n }\n else {\n console.error('Cannot load a module without a CommonJS or RequireJS environment.');\n return false;\n }\n};\nTerminal.prototype.updateCharSizeStyles = function () {\n this.charSizeStyleElement.textContent =\n \".xterm-wide-char{width:\" + this.charMeasure.width * 2 + \"px;}\" +\n (\".xterm-normal-char{width:\" + this.charMeasure.width + \"px;}\") +\n (\".xterm-rows > div{height:\" + this.charMeasure.height + \"px;}\");\n};\nTerminal.prototype.bindMouse = function () {\n var el = this.element, self = this, pressed = 32;\n function sendButton(ev) {\n var button, pos;\n button = getButton(ev);\n pos = Mouse_1.getRawByteCoords(ev, self.rowContainer, self.charMeasure, self.cols, self.rows);\n if (!pos)\n return;\n sendEvent(button, pos);\n switch (ev.overrideType || ev.type) {\n case 'mousedown':\n pressed = button;\n break;\n case 'mouseup':\n pressed = 32;\n break;\n case 'wheel':\n break;\n }\n }\n function sendMove(ev) {\n var button = pressed, pos;\n pos = Mouse_1.getRawByteCoords(ev, self.rowContainer, self.charMeasure, self.cols, self.rows);\n if (!pos)\n return;\n button += 32;\n sendEvent(button, pos);\n }\n function encode(data, ch) {\n if (!self.utfMouse) {\n if (ch === 255)\n return data.push(0);\n if (ch > 127)\n ch = 127;\n data.push(ch);\n }\n else {\n if (ch === 2047)\n return data.push(0);\n if (ch < 127) {\n data.push(ch);\n }\n else {\n if (ch > 2047)\n ch = 2047;\n data.push(0xC0 | (ch >> 6));\n data.push(0x80 | (ch & 0x3F));\n }\n }\n }\n function sendEvent(button, pos) {\n if (self.vt300Mouse) {\n button &= 3;\n pos.x -= 32;\n pos.y -= 32;\n var data = EscapeSequences_1.C0.ESC + '[24';\n if (button === 0)\n data += '1';\n else if (button === 1)\n data += '3';\n else if (button === 2)\n data += '5';\n else if (button === 3)\n return;\n else\n data += '0';\n data += '~[' + pos.x + ',' + pos.y + ']\\r';\n self.send(data);\n return;\n }\n if (self.decLocator) {\n button &= 3;\n pos.x -= 32;\n pos.y -= 32;\n if (button === 0)\n button = 2;\n else if (button === 1)\n button = 4;\n else if (button === 2)\n button = 6;\n else if (button === 3)\n button = 3;\n self.send(EscapeSequences_1.C0.ESC + '['\n + button\n + ';'\n + (button === 3 ? 4 : 0)\n + ';'\n + pos.y\n + ';'\n + pos.x\n + ';'\n + (pos.page || 0)\n + '&w');\n return;\n }\n if (self.urxvtMouse) {\n pos.x -= 32;\n pos.y -= 32;\n pos.x++;\n pos.y++;\n self.send(EscapeSequences_1.C0.ESC + '[' + button + ';' + pos.x + ';' + pos.y + 'M');\n return;\n }\n if (self.sgrMouse) {\n pos.x -= 32;\n pos.y -= 32;\n self.send(EscapeSequences_1.C0.ESC + '[<'\n + (((button & 3) === 3 ? button & ~3 : button) - 32)\n + ';'\n + pos.x\n + ';'\n + pos.y\n + ((button & 3) === 3 ? 'm' : 'M'));\n return;\n }\n var data = [];\n encode(data, button);\n encode(data, pos.x);\n encode(data, pos.y);\n self.send(EscapeSequences_1.C0.ESC + '[M' + String.fromCharCode.apply(String, data));\n }\n function getButton(ev) {\n var button, shift, meta, ctrl, mod;\n switch (ev.overrideType || ev.type) {\n case 'mousedown':\n button = ev.button != null\n ? +ev.button\n : ev.which != null\n ? ev.which - 1\n : null;\n if (self.browser.isMSIE) {\n button = button === 1 ? 0 : button === 4 ? 1 : button;\n }\n break;\n case 'mouseup':\n button = 3;\n break;\n case 'DOMMouseScroll':\n button = ev.detail < 0\n ? 64\n : 65;\n break;\n case 'wheel':\n button = ev.wheelDeltaY > 0\n ? 64\n : 65;\n break;\n }\n shift = ev.shiftKey ? 4 : 0;\n meta = ev.metaKey ? 8 : 0;\n ctrl = ev.ctrlKey ? 16 : 0;\n mod = shift | meta | ctrl;\n if (self.vt200Mouse) {\n mod &= ctrl;\n }\n else if (!self.normalMouse) {\n mod = 0;\n }\n button = (32 + (mod << 2)) + button;\n return button;\n }\n on(el, 'mousedown', function (ev) {\n if (!self.mouseEvents)\n return;\n sendButton(ev);\n self.focus();\n if (self.vt200Mouse) {\n ev.overrideType = 'mouseup';\n sendButton(ev);\n return self.cancel(ev);\n }\n if (self.normalMouse)\n on(self.document, 'mousemove', sendMove);\n if (!self.x10Mouse) {\n on(self.document, 'mouseup', function up(ev) {\n sendButton(ev);\n if (self.normalMouse)\n off(self.document, 'mousemove', sendMove);\n off(self.document, 'mouseup', up);\n return self.cancel(ev);\n });\n }\n return self.cancel(ev);\n });\n on(el, 'wheel', function (ev) {\n if (!self.mouseEvents)\n return;\n if (self.x10Mouse\n || self.vt300Mouse\n || self.decLocator)\n return;\n sendButton(ev);\n return self.cancel(ev);\n });\n on(el, 'wheel', function (ev) {\n if (self.mouseEvents)\n return;\n self.viewport.onWheel(ev);\n return self.cancel(ev);\n });\n on(el, 'touchstart', function (ev) {\n if (self.mouseEvents)\n return;\n self.viewport.onTouchStart(ev);\n return self.cancel(ev);\n });\n on(el, 'touchmove', function (ev) {\n if (self.mouseEvents)\n return;\n self.viewport.onTouchMove(ev);\n return self.cancel(ev);\n });\n};\nTerminal.prototype.destroy = function () {\n this.readable = false;\n this.writable = false;\n this._events = {};\n this.handler = function () { };\n this.write = function () { };\n if (this.element && this.element.parentNode) {\n this.element.parentNode.removeChild(this.element);\n }\n};\nTerminal.prototype.refresh = function (start, end) {\n if (this.renderer) {\n this.renderer.queueRefresh(start, end);\n }\n};\nTerminal.prototype.queueLinkification = function (start, end) {\n if (this.linkifier) {\n for (var i = start; i <= end; i++) {\n this.linkifier.linkifyRow(i);\n }\n }\n};\nTerminal.prototype.showCursor = function () {\n if (!this.cursorState) {\n this.cursorState = 1;\n this.refresh(this.y, this.y);\n }\n};\nTerminal.prototype.scroll = function (isWrapped) {\n var row;\n if (this.lines.length === this.lines.maxLength) {\n this.lines.trimStart(1);\n this.ybase--;\n if (this.ydisp !== 0) {\n this.ydisp--;\n }\n }\n this.ybase++;\n if (!this.userScrolling) {\n this.ydisp = this.ybase;\n }\n row = this.ybase + this.rows - 1;\n row -= this.rows - 1 - this.scrollBottom;\n if (row === this.lines.length) {\n this.lines.push(this.blankLine(undefined, isWrapped));\n }\n else {\n this.lines.splice(row, 0, this.blankLine(undefined, isWrapped));\n }\n if (this.scrollTop !== 0) {\n if (this.ybase !== 0) {\n this.ybase--;\n if (!this.userScrolling) {\n this.ydisp = this.ybase;\n }\n }\n this.lines.splice(this.ybase + this.scrollTop, 1);\n }\n this.updateRange(this.scrollTop);\n this.updateRange(this.scrollBottom);\n this.emit('scroll', this.ydisp);\n};\nTerminal.prototype.scrollDisp = function (disp, suppressScrollEvent) {\n if (disp < 0) {\n if (this.ydisp === 0) {\n return;\n }\n this.userScrolling = true;\n }\n else if (disp + this.ydisp >= this.ybase) {\n this.userScrolling = false;\n }\n this.ydisp += disp;\n if (this.ydisp > this.ybase) {\n this.ydisp = this.ybase;\n }\n else if (this.ydisp < 0) {\n this.ydisp = 0;\n }\n if (!suppressScrollEvent) {\n this.emit('scroll', this.ydisp);\n }\n this.refresh(0, this.rows - 1);\n};\nTerminal.prototype.scrollPages = function (pageCount) {\n this.scrollDisp(pageCount * (this.rows - 1));\n};\nTerminal.prototype.scrollToTop = function () {\n this.scrollDisp(-this.ydisp);\n};\nTerminal.prototype.scrollToBottom = function () {\n this.scrollDisp(this.ybase - this.ydisp);\n};\nTerminal.prototype.write = function (data) {\n this.writeBuffer.push(data);\n if (this.options.useFlowControl && !this.xoffSentToCatchUp && this.writeBuffer.length >= WRITE_BUFFER_PAUSE_THRESHOLD) {\n this.send(EscapeSequences_1.C0.DC3);\n this.xoffSentToCatchUp = true;\n }\n if (!this.writeInProgress && this.writeBuffer.length > 0) {\n this.writeInProgress = true;\n var self = this;\n setTimeout(function () {\n self.innerWrite();\n });\n }\n};\nTerminal.prototype.innerWrite = function () {\n var writeBatch = this.writeBuffer.splice(0, WRITE_BATCH_SIZE);\n while (writeBatch.length > 0) {\n var data = writeBatch.shift();\n var l = data.length, i = 0, j, cs, ch, code, low, ch_width, row;\n if (this.xoffSentToCatchUp && writeBatch.length === 0 && this.writeBuffer.length === 0) {\n this.send(EscapeSequences_1.C0.DC1);\n this.xoffSentToCatchUp = false;\n }\n this.refreshStart = this.y;\n this.refreshEnd = this.y;\n var state = this.parser.parse(data);\n this.parser.setState(state);\n this.updateRange(this.y);\n this.refresh(this.refreshStart, this.refreshEnd);\n }\n if (this.writeBuffer.length > 0) {\n var self = this;\n setTimeout(function () {\n self.innerWrite();\n }, 0);\n }\n else {\n this.writeInProgress = false;\n }\n};\nTerminal.prototype.writeln = function (data) {\n this.write(data + '\\r\\n');\n};\nTerminal.prototype.attachCustomKeydownHandler = function (customKeydownHandler) {\n var message = 'attachCustomKeydownHandler() is DEPRECATED and will be removed soon. Please use attachCustomKeyEventHandler() instead.';\n console.warn(message);\n this.attachCustomKeyEventHandler(customKeydownHandler);\n};\nTerminal.prototype.attachCustomKeyEventHandler = function (customKeyEventHandler) {\n this.customKeyEventHandler = customKeyEventHandler;\n};\nTerminal.prototype.setHypertextLinkHandler = function (handler) {\n if (!this.linkifier) {\n throw new Error('Cannot attach a hypertext link handler before Terminal.open is called');\n }\n this.linkifier.setHypertextLinkHandler(handler);\n this.refresh(0, this.rows - 1);\n};\nTerminal.prototype.setHypertextValidationCallback = function (callback) {\n if (!this.linkifier) {\n throw new Error('Cannot attach a hypertext validation callback before Terminal.open is called');\n }\n this.linkifier.setHypertextValidationCallback(callback);\n this.refresh(0, this.rows - 1);\n};\nTerminal.prototype.registerLinkMatcher = function (regex, handler, options) {\n if (this.linkifier) {\n var matcherId = this.linkifier.registerLinkMatcher(regex, handler, options);\n this.refresh(0, this.rows - 1);\n return matcherId;\n }\n};\nTerminal.prototype.deregisterLinkMatcher = function (matcherId) {\n if (this.linkifier) {\n if (this.linkifier.deregisterLinkMatcher(matcherId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n};\nTerminal.prototype.hasSelection = function () {\n return this.selectionManager.hasSelection;\n};\nTerminal.prototype.getSelection = function () {\n return this.selectionManager.selectionText;\n};\nTerminal.prototype.clearSelection = function () {\n this.selectionManager.clearSelection();\n};\nTerminal.prototype.selectAll = function () {\n this.selectionManager.selectAll();\n};\nTerminal.prototype.keyDown = function (ev) {\n if (this.customKeyEventHandler && this.customKeyEventHandler(ev) === false) {\n return false;\n }\n this.restartCursorBlinking();\n if (!this.compositionHelper.keydown.bind(this.compositionHelper)(ev)) {\n if (this.ybase !== this.ydisp) {\n this.scrollToBottom();\n }\n return false;\n }\n var self = this;\n var result = this.evaluateKeyEscapeSequence(ev);\n if (result.key === EscapeSequences_1.C0.DC3) {\n this.writeStopped = true;\n }\n else if (result.key === EscapeSequences_1.C0.DC1) {\n this.writeStopped = false;\n }\n if (result.scrollDisp) {\n this.scrollDisp(result.scrollDisp);\n return this.cancel(ev, true);\n }\n if (isThirdLevelShift(this, ev)) {\n return true;\n }\n if (result.cancel) {\n this.cancel(ev, true);\n }\n if (!result.key) {\n return true;\n }\n this.emit('keydown', ev);\n this.emit('key', result.key, ev);\n this.showCursor();\n this.handler(result.key);\n return this.cancel(ev, true);\n};\nTerminal.prototype.evaluateKeyEscapeSequence = function (ev) {\n var result = {\n cancel: false,\n key: undefined,\n scrollDisp: undefined\n };\n var modifiers = ev.shiftKey << 0 | ev.altKey << 1 | ev.ctrlKey << 2 | ev.metaKey << 3;\n switch (ev.keyCode) {\n case 8:\n if (ev.shiftKey) {\n result.key = EscapeSequences_1.C0.BS;\n break;\n }\n result.key = EscapeSequences_1.C0.DEL;\n break;\n case 9:\n if (ev.shiftKey) {\n result.key = EscapeSequences_1.C0.ESC + '[Z';\n break;\n }\n result.key = EscapeSequences_1.C0.HT;\n result.cancel = true;\n break;\n case 13:\n result.key = EscapeSequences_1.C0.CR;\n result.cancel = true;\n break;\n case 27:\n result.key = EscapeSequences_1.C0.ESC;\n result.cancel = true;\n break;\n case 37:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'D';\n if (result.key == EscapeSequences_1.C0.ESC + '[1;3D') {\n result.key = (this.browser.isMac) ? EscapeSequences_1.C0.ESC + 'b' : EscapeSequences_1.C0.ESC + '[1;5D';\n }\n }\n else if (this.applicationCursor) {\n result.key = EscapeSequences_1.C0.ESC + 'OD';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[D';\n }\n break;\n case 39:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'C';\n if (result.key == EscapeSequences_1.C0.ESC + '[1;3C') {\n result.key = (this.browser.isMac) ? EscapeSequences_1.C0.ESC + 'f' : EscapeSequences_1.C0.ESC + '[1;5C';\n }\n }\n else if (this.applicationCursor) {\n result.key = EscapeSequences_1.C0.ESC + 'OC';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[C';\n }\n break;\n case 38:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'A';\n if (result.key == EscapeSequences_1.C0.ESC + '[1;3A') {\n result.key = EscapeSequences_1.C0.ESC + '[1;5A';\n }\n }\n else if (this.applicationCursor) {\n result.key = EscapeSequences_1.C0.ESC + 'OA';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[A';\n }\n break;\n case 40:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'B';\n if (result.key == EscapeSequences_1.C0.ESC + '[1;3B') {\n result.key = EscapeSequences_1.C0.ESC + '[1;5B';\n }\n }\n else if (this.applicationCursor) {\n result.key = EscapeSequences_1.C0.ESC + 'OB';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[B';\n }\n break;\n case 45:\n if (!ev.shiftKey && !ev.ctrlKey) {\n result.key = EscapeSequences_1.C0.ESC + '[2~';\n }\n break;\n case 46:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[3;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[3~';\n }\n break;\n case 36:\n if (modifiers)\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'H';\n else if (this.applicationCursor)\n result.key = EscapeSequences_1.C0.ESC + 'OH';\n else\n result.key = EscapeSequences_1.C0.ESC + '[H';\n break;\n case 35:\n if (modifiers)\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'F';\n else if (this.applicationCursor)\n result.key = EscapeSequences_1.C0.ESC + 'OF';\n else\n result.key = EscapeSequences_1.C0.ESC + '[F';\n break;\n case 33:\n if (ev.shiftKey) {\n result.scrollDisp = -(this.rows - 1);\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[5~';\n }\n break;\n case 34:\n if (ev.shiftKey) {\n result.scrollDisp = this.rows - 1;\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[6~';\n }\n break;\n case 112:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'P';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + 'OP';\n }\n break;\n case 113:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'Q';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + 'OQ';\n }\n break;\n case 114:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'R';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + 'OR';\n }\n break;\n case 115:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'S';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + 'OS';\n }\n break;\n case 116:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[15;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[15~';\n }\n break;\n case 117:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[17;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[17~';\n }\n break;\n case 118:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[18;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[18~';\n }\n break;\n case 119:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[19;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[19~';\n }\n break;\n case 120:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[20;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[20~';\n }\n break;\n case 121:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[21;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[21~';\n }\n break;\n case 122:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[23;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[23~';\n }\n break;\n case 123:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[24;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[24~';\n }\n break;\n default:\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 }\n else if (ev.keyCode === 32) {\n result.key = String.fromCharCode(0);\n }\n else if (ev.keyCode >= 51 && ev.keyCode <= 55) {\n result.key = String.fromCharCode(ev.keyCode - 51 + 27);\n }\n else if (ev.keyCode === 56) {\n result.key = String.fromCharCode(127);\n }\n else if (ev.keyCode === 219) {\n result.key = String.fromCharCode(27);\n }\n else if (ev.keyCode === 220) {\n result.key = String.fromCharCode(28);\n }\n else if (ev.keyCode === 221) {\n result.key = String.fromCharCode(29);\n }\n }\n else if (!this.browser.isMac && ev.altKey && !ev.ctrlKey && !ev.metaKey) {\n if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n result.key = EscapeSequences_1.C0.ESC + String.fromCharCode(ev.keyCode + 32);\n }\n else if (ev.keyCode === 192) {\n result.key = EscapeSequences_1.C0.ESC + '`';\n }\n else if (ev.keyCode >= 48 && ev.keyCode <= 57) {\n result.key = EscapeSequences_1.C0.ESC + (ev.keyCode - 48);\n }\n }\n else if (this.browser.isMac && !ev.altKey && !ev.ctrlKey && ev.metaKey) {\n if (ev.keyCode === 65) {\n this.selectAll();\n }\n }\n break;\n }\n return result;\n};\nTerminal.prototype.setgLevel = function (g) {\n this.glevel = g;\n this.charset = this.charsets[g];\n};\nTerminal.prototype.setgCharset = function (g, charset) {\n this.charsets[g] = charset;\n if (this.glevel === g) {\n this.charset = charset;\n }\n};\nTerminal.prototype.keyPress = function (ev) {\n var key;\n if (this.customKeyEventHandler && this.customKeyEventHandler(ev) === false) {\n return false;\n }\n this.cancel(ev);\n if (ev.charCode) {\n key = ev.charCode;\n }\n else if (ev.which == null) {\n key = ev.keyCode;\n }\n else if (ev.which !== 0 && ev.charCode !== 0) {\n key = ev.which;\n }\n else {\n return false;\n }\n if (!key || ((ev.altKey || ev.ctrlKey || ev.metaKey) && !isThirdLevelShift(this, ev))) {\n return false;\n }\n key = String.fromCharCode(key);\n this.emit('keypress', key, ev);\n this.emit('key', key, ev);\n this.showCursor();\n this.handler(key);\n return true;\n};\nTerminal.prototype.send = function (data) {\n var self = this;\n if (!this.queue) {\n setTimeout(function () {\n self.handler(self.queue);\n self.queue = '';\n }, 1);\n }\n this.queue += data;\n};\nTerminal.prototype.bell = function () {\n if (!this.visualBell)\n return;\n var self = this;\n this.element.style.borderColor = 'white';\n setTimeout(function () {\n self.element.style.borderColor = '';\n }, 10);\n if (this.popOnBell)\n this.focus();\n};\nTerminal.prototype.log = function () {\n if (!this.debug)\n return;\n if (!this.context.console || !this.context.console.log)\n return;\n var args = Array.prototype.slice.call(arguments);\n this.context.console.log.apply(this.context.console, args);\n};\nTerminal.prototype.error = function () {\n if (!this.debug)\n return;\n if (!this.context.console || !this.context.console.error)\n return;\n var args = Array.prototype.slice.call(arguments);\n this.context.console.error.apply(this.context.console, args);\n};\nTerminal.prototype.resize = function (x, y) {\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n if (y > this.getOption('scrollback')) {\n this.setOption('scrollback', y);\n }\n var line, el, i, j, ch, addToY;\n if (x === this.cols && y === this.rows) {\n return;\n }\n if (x < 1)\n x = 1;\n if (y < 1)\n y = 1;\n j = this.cols;\n if (j < x) {\n ch = [this.defAttr, ' ', 1];\n i = this.lines.length;\n while (i--) {\n while (this.lines.get(i).length < x) {\n this.lines.get(i).push(ch);\n }\n }\n }\n this.cols = x;\n this.setupStops(this.cols);\n j = this.rows;\n addToY = 0;\n if (j < y) {\n el = this.element;\n while (j++ < y) {\n if (this.lines.length < y + this.ybase) {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n this.ydisp--;\n }\n }\n else {\n this.lines.push(this.blankLine());\n }\n }\n if (this.children.length < y) {\n this.insertRow();\n }\n }\n }\n else {\n while (j-- > y) {\n if (this.lines.length > y + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n this.lines.pop();\n }\n else {\n this.ybase++;\n this.ydisp++;\n }\n }\n if (this.children.length > y) {\n el = this.children.shift();\n if (!el)\n continue;\n el.parentNode.removeChild(el);\n }\n }\n }\n this.rows = y;\n if (this.y >= y) {\n this.y = y - 1;\n }\n if (addToY) {\n this.y += addToY;\n }\n if (this.x >= x) {\n this.x = x - 1;\n }\n this.scrollTop = 0;\n this.scrollBottom = y - 1;\n this.charMeasure.measure();\n this.refresh(0, this.rows - 1);\n this.normal = null;\n this.geometry = [this.cols, this.rows];\n this.emit('resize', { terminal: this, cols: x, rows: y });\n};\nTerminal.prototype.updateRange = function (y) {\n if (y < this.refreshStart)\n this.refreshStart = y;\n if (y > this.refreshEnd)\n this.refreshEnd = y;\n};\nTerminal.prototype.maxRange = function () {\n this.refreshStart = 0;\n this.refreshEnd = this.rows - 1;\n};\nTerminal.prototype.setupStops = function (i) {\n if (i != null) {\n if (!this.tabs[i]) {\n i = this.prevStop(i);\n }\n }\n else {\n this.tabs = {};\n i = 0;\n }\n for (; i < this.cols; i += this.getOption('tabStopWidth')) {\n this.tabs[i] = true;\n }\n};\nTerminal.prototype.prevStop = function (x) {\n if (x == null)\n x = this.x;\n while (!this.tabs[--x] && x > 0)\n ;\n return x >= this.cols\n ? this.cols - 1\n : x < 0 ? 0 : x;\n};\nTerminal.prototype.nextStop = function (x) {\n if (x == null)\n x = this.x;\n while (!this.tabs[++x] && x < this.cols)\n ;\n return x >= this.cols\n ? this.cols - 1\n : x < 0 ? 0 : x;\n};\nTerminal.prototype.eraseRight = function (x, y) {\n var line = this.lines.get(this.ybase + y);\n if (!line) {\n return;\n }\n var ch = [this.eraseAttr(), ' ', 1];\n for (; x < this.cols; x++) {\n line[x] = ch;\n }\n this.updateRange(y);\n};\nTerminal.prototype.eraseLeft = function (x, y) {\n var line = this.lines.get(this.ybase + y);\n if (!line) {\n return;\n }\n var ch = [this.eraseAttr(), ' ', 1];\n x++;\n while (x--) {\n line[x] = ch;\n }\n this.updateRange(y);\n};\nTerminal.prototype.clear = function () {\n if (this.ybase === 0 && this.y === 0) {\n return;\n }\n this.lines.set(0, this.lines.get(this.ybase + this.y));\n this.lines.length = 1;\n this.ydisp = 0;\n this.ybase = 0;\n this.y = 0;\n for (var i = 1; i < this.rows; i++) {\n this.lines.push(this.blankLine());\n }\n this.refresh(0, this.rows - 1);\n this.emit('scroll', this.ydisp);\n};\nTerminal.prototype.eraseLine = function (y) {\n this.eraseRight(0, y);\n};\nTerminal.prototype.blankLine = function (cur, isWrapped) {\n var attr = cur\n ? this.eraseAttr()\n : this.defAttr;\n var ch = [attr, ' ', 1], line = [], i = 0;\n if (isWrapped) {\n line.isWrapped = isWrapped;\n }\n for (; i < this.cols; i++) {\n line[i] = ch;\n }\n return line;\n};\nTerminal.prototype.ch = function (cur) {\n return cur\n ? [this.eraseAttr(), ' ', 1]\n : [this.defAttr, ' ', 1];\n};\nTerminal.prototype.is = function (term) {\n var name = this.termName;\n return (name + '').indexOf(term) === 0;\n};\nTerminal.prototype.handler = function (data) {\n if (this.options.disableStdin) {\n return;\n }\n if (this.ybase !== this.ydisp) {\n this.scrollToBottom();\n }\n this.emit('data', data);\n};\nTerminal.prototype.handleTitle = function (title) {\n this.emit('title', title);\n};\nTerminal.prototype.index = function () {\n this.y++;\n if (this.y > this.scrollBottom) {\n this.y--;\n this.scroll();\n }\n if (this.x >= this.cols) {\n this.x--;\n }\n};\nTerminal.prototype.reverseIndex = function () {\n var j;\n if (this.y === this.scrollTop) {\n this.lines.shiftElements(this.y + this.ybase, this.rows - 1, 1);\n this.lines.set(this.y + this.ybase, this.blankLine(true));\n this.updateRange(this.scrollTop);\n this.updateRange(this.scrollBottom);\n }\n else {\n this.y--;\n }\n};\nTerminal.prototype.reset = function () {\n this.options.rows = this.rows;\n this.options.cols = this.cols;\n var customKeyEventHandler = this.customKeyEventHandler;\n var cursorBlinkInterval = this.cursorBlinkInterval;\n Terminal.call(this, this.options);\n this.customKeyEventHandler = customKeyEventHandler;\n this.cursorBlinkInterval = cursorBlinkInterval;\n this.refresh(0, this.rows - 1);\n this.viewport.syncScrollArea();\n};\nTerminal.prototype.tabSet = function () {\n this.tabs[this.x] = true;\n};\nfunction on(el, type, handler, capture) {\n if (!Array.isArray(el)) {\n el = [el];\n }\n el.forEach(function (element) {\n element.addEventListener(type, handler, capture || false);\n });\n}\nfunction off(el, type, handler, capture) {\n el.removeEventListener(type, handler, capture || false);\n}\nfunction cancel(ev, force) {\n if (!this.cancelEvents && !force) {\n return;\n }\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n}\nfunction inherits(child, parent) {\n function f() {\n this.constructor = child;\n }\n f.prototype = parent.prototype;\n child.prototype = new f;\n}\nfunction indexOf(obj, el) {\n var i = obj.length;\n while (i--) {\n if (obj[i] === el)\n return i;\n }\n return -1;\n}\nfunction isThirdLevelShift(term, ev) {\n var thirdLevelKey = (term.browser.isMac && ev.altKey && !ev.ctrlKey && !ev.metaKey) ||\n (term.browser.isMSWindows && ev.altKey && ev.ctrlKey && !ev.metaKey);\n if (ev.type == 'keypress') {\n return thirdLevelKey;\n }\n return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);\n}\nTerminal.prototype.matchColor = matchColor;\nfunction matchColor(r1, g1, b1) {\n var hash = (r1 << 16) | (g1 << 8) | b1;\n if (matchColor._cache[hash] != null) {\n return matchColor._cache[hash];\n }\n var ldiff = Infinity, li = -1, i = 0, c, r2, g2, b2, diff;\n for (; i < Terminal.vcolors.length; i++) {\n c = Terminal.vcolors[i];\n r2 = c[0];\n g2 = c[1];\n b2 = c[2];\n diff = matchColor.distance(r1, g1, b1, r2, g2, b2);\n if (diff === 0) {\n li = i;\n break;\n }\n if (diff < ldiff) {\n ldiff = diff;\n li = i;\n }\n }\n return matchColor._cache[hash] = li;\n}\nmatchColor._cache = {};\nmatchColor.distance = function (r1, g1, b1, r2, g2, b2) {\n return Math.pow(30 * (r1 - r2), 2)\n + Math.pow(59 * (g1 - g2), 2)\n + Math.pow(11 * (b1 - b2), 2);\n};\nfunction each(obj, iter, con) {\n if (obj.forEach)\n return obj.forEach(iter, con);\n for (var i = 0; i < obj.length; i++) {\n iter.call(con, obj[i], i, obj);\n }\n}\nfunction wasMondifierKeyOnlyEvent(ev) {\n return ev.keyCode === 16 ||\n ev.keyCode === 17 ||\n ev.keyCode === 18;\n}\nfunction keys(obj) {\n if (Object.keys)\n return Object.keys(obj);\n var key, keys = [];\n for (key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n keys.push(key);\n }\n }\n return keys;\n}\nTerminal.EventEmitter = EventEmitter_1.EventEmitter;\nTerminal.inherits = inherits;\nTerminal.on = on;\nTerminal.off = off;\nTerminal.cancel = cancel;\nmodule.exports = Terminal;\n\n//# sourceMappingURL=xterm.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/xterm.js\n// module id = 0\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n;\nvar EventEmitter = (function () {\n function EventEmitter() {\n this._events = this._events || {};\n }\n EventEmitter.prototype.on = function (type, listener) {\n this._events[type] = this._events[type] || [];\n this._events[type].push(listener);\n };\n EventEmitter.prototype.off = function (type, listener) {\n if (!this._events[type]) {\n return;\n }\n var obj = this._events[type];\n var i = obj.length;\n while (i--) {\n if (obj[i] === listener || obj[i].listener === listener) {\n obj.splice(i, 1);\n return;\n }\n }\n };\n EventEmitter.prototype.removeAllListeners = function (type) {\n if (this._events[type]) {\n delete this._events[type];\n }\n };\n EventEmitter.prototype.once = function (type, listener) {\n function on() {\n var args = Array.prototype.slice.call(arguments);\n this.off(type, on);\n return listener.apply(this, args);\n }\n on.listener = listener;\n return this.on(type, on);\n };\n EventEmitter.prototype.emit = function (type) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (!this._events[type]) {\n return;\n }\n var obj = this._events[type];\n for (var i = 0; i < obj.length; i++) {\n obj[i].apply(this, args);\n }\n };\n EventEmitter.prototype.listeners = function (type) {\n return this._events[type] || [];\n };\n return EventEmitter;\n}());\nexports.EventEmitter = EventEmitter;\n\n//# sourceMappingURL=EventEmitter.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/EventEmitter.js\n// module id = 1\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar C0;\n(function (C0) {\n C0.NUL = '\\x00';\n C0.SOH = '\\x01';\n C0.STX = '\\x02';\n C0.ETX = '\\x03';\n C0.EOT = '\\x04';\n C0.ENQ = '\\x05';\n C0.ACK = '\\x06';\n C0.BEL = '\\x07';\n C0.BS = '\\x08';\n C0.HT = '\\x09';\n C0.LF = '\\x0a';\n C0.VT = '\\x0b';\n C0.FF = '\\x0c';\n C0.CR = '\\x0d';\n C0.SO = '\\x0e';\n C0.SI = '\\x0f';\n C0.DLE = '\\x10';\n C0.DC1 = '\\x11';\n C0.DC2 = '\\x12';\n C0.DC3 = '\\x13';\n C0.DC4 = '\\x14';\n C0.NAK = '\\x15';\n C0.SYN = '\\x16';\n C0.ETB = '\\x17';\n C0.CAN = '\\x18';\n C0.EM = '\\x19';\n C0.SUB = '\\x1a';\n C0.ESC = '\\x1b';\n C0.FS = '\\x1c';\n C0.GS = '\\x1d';\n C0.RS = '\\x1e';\n C0.US = '\\x1f';\n C0.SP = '\\x20';\n C0.DEL = '\\x7f';\n})(C0 = exports.C0 || (exports.C0 = {}));\n;\n\n//# sourceMappingURL=EscapeSequences.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/EscapeSequences.js\n// module id = 2\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CHARSETS = {};\nexports.DEFAULT_CHARSET = exports.CHARSETS['B'];\nexports.CHARSETS['0'] = {\n '`': '\\u25c6',\n 'a': '\\u2592',\n 'b': '\\u0009',\n 'c': '\\u000c',\n 'd': '\\u000d',\n 'e': '\\u000a',\n 'f': '\\u00b0',\n 'g': '\\u00b1',\n 'h': '\\u2424',\n 'i': '\\u000b',\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};\nexports.CHARSETS['A'] = {\n '#': '£'\n};\nexports.CHARSETS['B'] = null;\nexports.CHARSETS['4'] = {\n '#': '£',\n '@': '¾',\n '[': 'ij',\n '\\\\': '½',\n ']': '|',\n '{': '¨',\n '|': 'f',\n '}': '¼',\n '~': '´'\n};\nexports.CHARSETS['C'] =\n exports.CHARSETS['5'] = {\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Å',\n '^': 'Ü',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'å',\n '~': 'ü'\n };\nexports.CHARSETS['R'] = {\n '#': '£',\n '@': 'à',\n '[': '°',\n '\\\\': 'ç',\n ']': '§',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': '¨'\n};\nexports.CHARSETS['Q'] = {\n '@': 'à',\n '[': 'â',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n '`': 'ô',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': 'û'\n};\nexports.CHARSETS['K'] = {\n '@': '§',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Ü',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'ß'\n};\nexports.CHARSETS['Y'] = {\n '#': '£',\n '@': '§',\n '[': '°',\n '\\\\': 'ç',\n ']': 'é',\n '`': 'ù',\n '{': 'à',\n '|': 'ò',\n '}': 'è',\n '~': 'ì'\n};\nexports.CHARSETS['E'] =\n exports.CHARSETS['6'] = {\n '@': 'Ä',\n '[': 'Æ',\n '\\\\': 'Ø',\n ']': 'Å',\n '^': 'Ü',\n '`': 'ä',\n '{': 'æ',\n '|': 'ø',\n '}': 'å',\n '~': 'ü'\n };\nexports.CHARSETS['Z'] = {\n '#': '£',\n '@': '§',\n '[': '¡',\n '\\\\': 'Ñ',\n ']': '¿',\n '{': '°',\n '|': 'ñ',\n '}': 'ç'\n};\nexports.CHARSETS['H'] =\n exports.CHARSETS['7'] = {\n '@': 'É',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Å',\n '^': 'Ü',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'å',\n '~': 'ü'\n };\nexports.CHARSETS['='] = {\n '#': 'ù',\n '@': 'à',\n '[': 'é',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n '_': 'è',\n '`': 'ô',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'û'\n};\n\n//# sourceMappingURL=Charsets.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Charsets.js\n// module id = 3\n// module chunks = 0","/**\n * Implements the attach method, that attaches the terminal to a WebSocket stream.\n * @module xterm/addons/attach/attach\n * @license MIT\n */\n\n(function (attach) {\n if (typeof exports === 'object' && typeof module === 'object') {\n /*\n * CommonJS environment\n */\n module.exports = attach(require('../../xterm'));\n } else if (typeof define == 'function') {\n /*\n * Require.js is available\n */\n define(['../../xterm'], attach);\n } else {\n /*\n * Plain browser environment\n */\n attach(window.Terminal);\n }\n})(function (Xterm) {\n 'use strict';\n\n var exports = {};\n\n /**\n * Attaches the given terminal to the given socket.\n *\n * @param {Xterm} term - The terminal to be attached to the given socket.\n * @param {WebSocket} socket - The socket to attach the current terminal.\n * @param {boolean} bidirectional - Whether the terminal should send data\n * to the socket as well.\n * @param {boolean} buffered - Whether the rendering of incoming data\n * should happen instantly or at a maximum\n * frequency of 1 rendering per 10ms.\n */\n exports.attach = function (term, socket, bidirectional, buffered) {\n bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;\n term.socket = socket;\n\n term._flushBuffer = function () {\n term.write(term._attachSocketBuffer);\n term._attachSocketBuffer = null;\n clearTimeout(term._attachSocketBufferTimer);\n term._attachSocketBufferTimer = null;\n };\n\n term._pushToBuffer = function (data) {\n if (term._attachSocketBuffer) {\n term._attachSocketBuffer += data;\n } else {\n term._attachSocketBuffer = data;\n setTimeout(term._flushBuffer, 10);\n }\n };\n\n term._getMessage = function (ev) {\n if (buffered) {\n term._pushToBuffer(ev.data);\n } else {\n term.write(ev.data);\n }\n };\n\n term._sendData = function (data) {\n socket.send(data);\n };\n\n socket.addEventListener('message', term._getMessage);\n\n if (bidirectional) {\n term.on('data', term._sendData);\n }\n\n socket.addEventListener('close', term.detach.bind(term, socket));\n socket.addEventListener('error', term.detach.bind(term, socket));\n };\n\n /**\n * Detaches the given terminal from the given socket\n *\n * @param {Xterm} term - The terminal to be detached from the given socket.\n * @param {WebSocket} socket - The socket from which to detach the current\n * terminal.\n */\n exports.detach = function (term, socket) {\n term.off('data', term._sendData);\n\n socket = (typeof socket == 'undefined') ? term.socket : socket;\n\n if (socket) {\n socket.removeEventListener('message', term._getMessage);\n }\n\n delete term.socket;\n };\n\n /**\n * Attaches the current terminal to the given socket\n *\n * @param {WebSocket} socket - The socket to attach the current terminal.\n * @param {boolean} bidirectional - Whether the terminal should send data\n * to the socket as well.\n * @param {boolean} buffered - Whether the rendering of incoming data\n * should happen instantly or at a maximum\n * frequency of 1 rendering per 10ms.\n */\n Xterm.prototype.attach = function (socket, bidirectional, buffered) {\n return exports.attach(this, socket, bidirectional, buffered);\n };\n\n /**\n * Detaches the current terminal from the given socket.\n *\n * @param {WebSocket} socket - The socket from which to detach the current\n * terminal.\n */\n Xterm.prototype.detach = function (socket) {\n return exports.detach(this, socket);\n };\n\n return exports;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/attach/attach.js\n// module id = 4\n// module chunks = 0","/**\n * Fit terminal columns and rows to the dimensions of its DOM element.\n *\n * ## Approach\n * - Rows: Truncate the division of the terminal parent element height by the terminal row height.\n *\n * - Columns: Truncate the division of the terminal parent element width by the terminal character\n * width (apply display: inline at the terminal row and truncate its width with the current\n * number of columns).\n * @module xterm/addons/fit/fit\n * @license MIT\n */\n\n(function (fit) {\n if (typeof exports === 'object' && typeof module === 'object') {\n /*\n * CommonJS environment\n */\n module.exports = fit(require('../../xterm'));\n } else if (typeof define == 'function') {\n /*\n * Require.js is available\n */\n define(['../../xterm'], fit);\n } else {\n /*\n * Plain browser environment\n */\n fit(window.Terminal);\n }\n})(function (Xterm) {\n var exports = {};\n\n exports.proposeGeometry = function (term) {\n if (!term.element.parentElement) {\n return null;\n }\n var parentElementStyle = window.getComputedStyle(term.element.parentElement),\n parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),\n parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')) - 17),\n elementStyle = window.getComputedStyle(term.element),\n elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')),\n elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')),\n availableHeight = parentElementHeight - elementPaddingVer,\n availableWidth = parentElementWidth - elementPaddingHor,\n container = term.rowContainer,\n subjectRow = term.rowContainer.firstElementChild,\n contentBuffer = subjectRow.innerHTML,\n characterHeight,\n rows,\n characterWidth,\n cols,\n geometry;\n\n subjectRow.style.display = 'inline';\n subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace\n characterWidth = subjectRow.getBoundingClientRect().width;\n subjectRow.style.display = ''; // Revert style before calculating height, since they differ.\n characterHeight = subjectRow.getBoundingClientRect().height;\n subjectRow.innerHTML = contentBuffer;\n\n rows = parseInt(availableHeight / characterHeight);\n cols = parseInt(availableWidth / characterWidth);\n\n geometry = {cols: cols, rows: rows};\n return geometry;\n };\n\n exports.fit = function (term) {\n var geometry = exports.proposeGeometry(term);\n\n if (geometry) {\n term.resize(geometry.cols, geometry.rows);\n }\n };\n\n Xterm.prototype.proposeGeometry = function () {\n return exports.proposeGeometry(this);\n };\n\n Xterm.prototype.fit = function () {\n return exports.fit(this);\n };\n\n return exports;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/fit/fit.js\n// module id = 5\n// module chunks = 0","/**\n * Fullscreen addon for xterm.js\n * @module xterm/addons/fullscreen/fullscreen\n * @license MIT\n */\n(function (fullscreen) {\n if (typeof exports === 'object' && typeof module === 'object') {\n /*\n * CommonJS environment\n */\n module.exports = fullscreen(require('../../xterm'));\n } else if (typeof define == 'function') {\n /*\n * Require.js is available\n */\n define(['../../xterm'], fullscreen);\n } else {\n /*\n * Plain browser environment\n */\n fullscreen(window.Terminal);\n }\n})(function (Xterm) {\n var exports = {};\n\n /**\n * Toggle the given terminal's fullscreen mode.\n * @param {Xterm} term - The terminal to toggle full screen mode\n * @param {boolean} fullscreen - Toggle fullscreen on (true) or off (false)\n */\n exports.toggleFullScreen = function (term, fullscreen) {\n var fn;\n\n if (typeof fullscreen == 'undefined') {\n fn = (term.element.classList.contains('fullscreen')) ? 'remove' : 'add';\n } else if (!fullscreen) {\n fn = 'remove';\n } else {\n fn = 'add';\n }\n\n term.element.classList[fn]('fullscreen');\n };\n\n Xterm.prototype.toggleFullscreen = function (fullscreen) {\n exports.toggleFullScreen(this, fullscreen);\n };\n\n return exports;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/fullscreen/fullscreen.js\n// module id = 6\n// module chunks = 0","/**\n * This module provides methods for attaching a terminal to a terminado WebSocket stream.\n *\n * @module xterm/addons/terminado/terminado\n * @license MIT\n */\n\n(function (attach) {\n if (typeof exports === 'object' && typeof module === 'object') {\n /*\n * CommonJS environment\n */\n module.exports = attach(require('../../xterm'));\n } else if (typeof define == 'function') {\n /*\n * Require.js is available\n */\n define(['../../xterm'], attach);\n } else {\n /*\n * Plain browser environment\n */\n attach(window.Terminal);\n }\n})(function (Xterm) {\n 'use strict';\n\n var exports = {};\n\n /**\n * Attaches the given terminal to the given socket.\n *\n * @param {Xterm} term - The terminal to be attached to the given socket.\n * @param {WebSocket} socket - The socket to attach the current terminal.\n * @param {boolean} bidirectional - Whether the terminal should send data\n * to the socket as well.\n * @param {boolean} buffered - Whether the rendering of incoming data\n * should happen instantly or at a maximum\n * frequency of 1 rendering per 10ms.\n */\n exports.terminadoAttach = function (term, socket, bidirectional, buffered) {\n bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;\n term.socket = socket;\n\n term._flushBuffer = function () {\n term.write(term._attachSocketBuffer);\n term._attachSocketBuffer = null;\n clearTimeout(term._attachSocketBufferTimer);\n term._attachSocketBufferTimer = null;\n };\n\n term._pushToBuffer = function (data) {\n if (term._attachSocketBuffer) {\n term._attachSocketBuffer += data;\n } else {\n term._attachSocketBuffer = data;\n setTimeout(term._flushBuffer, 10);\n }\n };\n\n term._getMessage = function (ev) {\n var data = JSON.parse(ev.data)\n if( data[0] == \"stdout\" ) {\n if (buffered) {\n term._pushToBuffer(data[1]);\n } else {\n term.write(data[1]);\n }\n }\n };\n\n term._sendData = function (data) {\n socket.send(JSON.stringify(['stdin', data]));\n };\n\n term._setSize = function (size) {\n socket.send(JSON.stringify(['set_size', size.rows, size.cols]));\n };\n\n socket.addEventListener('message', term._getMessage);\n\n if (bidirectional) {\n term.on('data', term._sendData);\n }\n term.on('resize', term._setSize);\n\n socket.addEventListener('close', term.terminadoDetach.bind(term, socket));\n socket.addEventListener('error', term.terminadoDetach.bind(term, socket));\n };\n\n /**\n * Detaches the given terminal from the given socket\n *\n * @param {Xterm} term - The terminal to be detached from the given socket.\n * @param {WebSocket} socket - The socket from which to detach the current\n * terminal.\n */\n exports.terminadoDetach = function (term, socket) {\n term.off('data', term._sendData);\n\n socket = (typeof socket == 'undefined') ? term.socket : socket;\n\n if (socket) {\n socket.removeEventListener('message', term._getMessage);\n }\n\n delete term.socket;\n };\n\n /**\n * Attaches the current terminal to the given socket\n *\n * @param {WebSocket} socket - The socket to attach the current terminal.\n * @param {boolean} bidirectional - Whether the terminal should send data\n * to the socket as well.\n * @param {boolean} buffered - Whether the rendering of incoming data\n * should happen instantly or at a maximum\n * frequency of 1 rendering per 10ms.\n */\n Xterm.prototype.terminadoAttach = function (socket, bidirectional, buffered) {\n return exports.terminadoAttach(this, socket, bidirectional, buffered);\n };\n\n /**\n * Detaches the current terminal from the given socket.\n *\n * @param {WebSocket} socket - The socket from which to detach the current\n * terminal.\n */\n Xterm.prototype.terminadoDetach = function (socket) {\n return exports.terminadoDetach(this, socket);\n };\n\n return exports;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/terminado/terminado.js\n// module id = 7\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Generic_1 = require(\"./Generic\");\nvar isNode = (typeof navigator === 'undefined') ? true : false;\nvar userAgent = (isNode) ? 'node' : navigator.userAgent;\nvar platform = (isNode) ? 'node' : navigator.platform;\nexports.isFirefox = !!~userAgent.indexOf('Firefox');\nexports.isMSIE = !!~userAgent.indexOf('MSIE') || !!~userAgent.indexOf('Trident');\nexports.isMac = Generic_1.contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform);\nexports.isIpad = platform === 'iPad';\nexports.isIphone = platform === 'iPhone';\nexports.isMSWindows = Generic_1.contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform);\nexports.isLinux = platform.indexOf('Linux') >= 0;\n\n//# sourceMappingURL=Browser.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/Browser.js\n// module id = 8\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction getCoordsRelativeToElement(event, element) {\n if (event.pageX == null) {\n return null;\n }\n var x = event.pageX;\n var y = event.pageY;\n while (element && element !== self.document.documentElement) {\n x -= element.offsetLeft;\n y -= element.offsetTop;\n element = 'offsetParent' in element ? element.offsetParent : element.parentElement;\n }\n return [x, y];\n}\nexports.getCoordsRelativeToElement = getCoordsRelativeToElement;\nfunction getCoords(event, rowContainer, charMeasure, colCount, rowCount, isSelection) {\n var coords = getCoordsRelativeToElement(event, rowContainer);\n coords[0] = Math.ceil((coords[0] + (isSelection ? charMeasure.width / 2 : 0)) / charMeasure.width);\n coords[1] = Math.ceil(coords[1] / charMeasure.height);\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + 1);\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount + 1);\n return coords;\n}\nexports.getCoords = getCoords;\nfunction getRawByteCoords(event, rowContainer, charMeasure, colCount, rowCount) {\n var coords = getCoords(event, rowContainer, charMeasure, colCount, rowCount);\n var x = coords[0];\n var y = coords[1];\n x += 32;\n y += 32;\n return { x: x, y: y };\n}\nexports.getRawByteCoords = getRawByteCoords;\n\n//# sourceMappingURL=Mouse.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/Mouse.js\n// module id = 9\n// module chunks = 0","import * as bare from \"libapps\";\n\nexport class TermHterm {\n elem: HTMLElement;\n\n term: bare.Terminal;\n io: bare.IO;\n\n columns: number;\n rows: number;\n\n // to \"show\" the current message when removeMessage() is called\n message: string;\n\n constructor(elem: HTMLElement) {\n this.elem = elem;\n bare.hterm.defaultStorage = new bare.lib.Storage.Memory();\n this.term = new bare.hterm.Terminal();\n this.term.getPrefs().set(\"send-encoding\", \"raw\");\n this.term.decorate(this.elem);\n\n this.io = this.term.io.push();\n this.term.installKeyboard();\n };\n\n info(): { columns: number, rows: number } {\n return { columns: this.columns, rows: this.rows };\n };\n\n output(data: string) {\n if (this.term.io != null) {\n this.term.io.writeUTF16(data);\n }\n };\n\n showMessage(message: string, timeout: number) {\n this.message = message;\n if (timeout > 0) {\n this.term.io.showOverlay(message, timeout);\n } else {\n this.term.io.showOverlay(message, null);\n }\n };\n\n removeMessage(): void {\n // there is no hideOverlay(), so show the same message with 0 sec\n this.term.io.showOverlay(this.message, 0);\n }\n\n setWindowTitle(title: string) {\n this.term.setWindowTitle(title);\n };\n\n setPreferences(value: object) {\n Object.keys(value).forEach((key) => {\n this.term.getPrefs().set(key, value[key]);\n });\n };\n\n onInput(callback: (input: string) => void) {\n this.io.onVTKeystroke = (data) => {\n callback(data);\n };\n this.io.sendString = (data) => {\n callback(data);\n };\n };\n\n onResize(callback: (colmuns: number, rows: number) => void) {\n this.io.onTerminalResize = (columns: number, rows: number) => {\n this.columns = columns;\n this.rows = rows;\n callback(columns, rows);\n };\n };\n\n deactivate(): void {\n this.io.onVTKeystroke = null;\n this.io.sendString = null\n this.io.onTerminalResize = null;\n this.term.uninstallKeyboard();\n }\n\n reset(): void {\n this.removeMessage();\n this.term.installKeyboard();\n }\n\n close(): void {\n this.term.uninstallKeyboard();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/hterm.ts","export class ConnectionFactory {\n url: string;\n protocols: string[];\n\n constructor(url: string, protocols: string[]) {\n this.url = url;\n this.protocols = protocols;\n };\n\n create(): Connection {\n return new Connection(this.url, this.protocols);\n };\n}\n\nexport class Connection {\n bare: WebSocket;\n\n\n constructor(url: string, protocols: string[]) {\n this.bare = new WebSocket(url, protocols);\n }\n\n open() {\n // nothing todo for websocket\n };\n\n close() {\n this.bare.close();\n };\n\n send(data: string) {\n this.bare.send(data);\n };\n\n isOpen(): boolean {\n if (this.bare.readyState == WebSocket.CONNECTING ||\n this.bare.readyState == WebSocket.OPEN) {\n return true\n }\n return false\n }\n\n onOpen(callback: () => void) {\n this.bare.onopen = (event) => {\n callback();\n }\n };\n\n onReceive(callback: (data: string) => void) {\n this.bare.onmessage = (event) => {\n callback(event.data);\n }\n };\n\n onClose(callback: () => void) {\n this.bare.onclose = (event) => {\n callback();\n };\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/websocket.ts","export const protocols = [\"webtty\"];\n\nexport const msgInputUnknown = '0';\nexport const msgInput = '1';\nexport const msgPing = '2';\nexport const msgResizeTerminal = '3';\n\nexport const msgUnknownOutput = '0';\nexport const msgOutput = '1';\nexport const msgPong = '2';\nexport const msgSetWindowTitle = '3';\nexport const msgSetPreferences = '4';\nexport const msgSetReconnect = '5';\n\n\nexport interface Terminal {\n info(): { columns: number, rows: number };\n output(data: string): void;\n showMessage(message: string, timeout: number): void;\n removeMessage(): void;\n setWindowTitle(title: string): void;\n setPreferences(value: object): void;\n onInput(callback: (input: string) => void): void;\n onResize(callback: (colmuns: number, rows: number) => void): void;\n reset(): void;\n deactivate(): void;\n close(): void;\n}\n\nexport interface Connection {\n open(): void;\n close(): void;\n send(data: string): void;\n isOpen(): boolean;\n onOpen(callback: () => void): void;\n onReceive(callback: (data: string) => void): void;\n onClose(callback: () => void): void;\n}\n\nexport interface ConnectionFactory {\n create(): Connection;\n}\n\n\nexport class WebTTY {\n term: Terminal;\n connectionFactory: ConnectionFactory;\n args: string;\n authToken: string;\n reconnect: number;\n\n constructor(term: Terminal, connectionFactory: ConnectionFactory, args: string, authToken: string) {\n this.term = term;\n this.connectionFactory = connectionFactory;\n this.args = args;\n this.authToken = authToken;\n this.reconnect = -1;\n };\n\n open() {\n let connection = this.connectionFactory.create();\n let pingTimer: number;\n let reconnectTimeout: number;\n\n const setup = () => {\n connection.onOpen(() => {\n const termInfo = this.term.info();\n\n connection.send(JSON.stringify(\n {\n Arguments: this.args,\n AuthToken: this.authToken,\n }\n ));\n\n\n const resizeHandler = (colmuns: number, rows: number) => {\n connection.send(\n msgResizeTerminal + JSON.stringify(\n {\n columns: colmuns,\n rows: rows\n }\n )\n );\n };\n\n this.term.onResize(resizeHandler);\n resizeHandler(termInfo.columns, termInfo.rows);\n\n this.term.onInput(\n (input: string) => {\n connection.send(msgInput + input);\n }\n );\n\n pingTimer = setInterval(() => {\n connection.send(msgPing)\n }, 30 * 1000);\n\n });\n\n connection.onReceive((data) => {\n const payload = data.slice(1);\n switch (data[0]) {\n case msgOutput:\n this.term.output(\n decodeURIComponent(Array.prototype.map.call(atob(payload), function(c) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''))\n );\n break;\n case msgPong:\n break;\n case msgSetWindowTitle:\n this.term.setWindowTitle(payload);\n break;\n case msgSetPreferences:\n const preferences = JSON.parse(payload);\n this.term.setPreferences(preferences);\n break;\n case msgSetReconnect:\n const autoReconnect = JSON.parse(payload);\n console.log(\"Enabling reconnect: \" + autoReconnect + \" seconds\")\n this.reconnect = autoReconnect;\n break;\n }\n });\n\n connection.onClose(() => {\n clearInterval(pingTimer);\n this.term.deactivate();\n this.term.showMessage(\"Connection Closed\", 0);\n if (this.reconnect > 0) {\n reconnectTimeout = setTimeout(() => {\n connection = this.connectionFactory.create();\n this.term.reset();\n setup();\n }, this.reconnect * 1000);\n }\n });\n\n connection.open();\n }\n\n setup();\n return () => {\n clearTimeout(reconnectTimeout);\n connection.close();\n }\n };\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/webtty.ts","import * as bare from \"xterm\";\n\nbare.loadAddon(\"fit\");\n\nexport class TermXterm {\n elem: HTMLElement;\n\n message: HTMLElement;\n messageTimeout: number;\n messageTimer: number;\n\n term: bare;\n resizeListener: () => void;\n\n constructor(elem: HTMLElement) {\n this.elem = elem;\n this.term = new bare();\n\n this.message = elem.ownerDocument.createElement(\"div\");\n this.message.className = \"xterm-overlay\";\n this.messageTimeout = 2000;\n\n\n this.resizeListener = () => {\n this.term.fit();\n this.term.scrollToBottom();\n this.showMessage(String(this.term.cols) + \"x\" + String(this.term.rows), this.messageTimeout);\n };\n\n this.term.on(\"open\", () => {\n this.resizeListener();\n window.addEventListener(\"resize\", () => { this.resizeListener(); });\n });\n\n this.term.open(elem, true);\n };\n\n info(): { columns: number, rows: number } {\n return { columns: this.term.cols, rows: this.term.rows };\n };\n\n output(data: string) {\n this.term.write(data);\n };\n\n showMessage(message: string, timeout: number) {\n this.message.textContent = message;\n this.elem.appendChild(this.message);\n\n if (this.messageTimer) {\n clearTimeout(this.messageTimer);\n }\n if (timeout > 0) {\n this.messageTimer = setTimeout(() => {\n this.elem.removeChild(this.message);\n }, timeout);\n }\n };\n\n removeMessage(): void {\n if (this.message.parentNode == this.elem) {\n this.elem.removeChild(this.message);\n }\n }\n\n setWindowTitle(title: string) {\n document.title = title;\n };\n\n setPreferences(value: object) {\n };\n\n onInput(callback: (input: string) => void) {\n this.term.on(\"data\", (data) => {\n callback(data);\n });\n\n };\n\n onResize(callback: (colmuns: number, rows: number) => void) {\n this.term.on(\"resize\", (data) => {\n callback(data.cols, data.rows);\n });\n };\n\n deactivate(): void {\n this.term.off(\"data\");\n this.term.off(\"resize\");\n this.term.blur();\n }\n\n reset(): void {\n this.removeMessage();\n this.term.clear();\n }\n\n close(): void {\n window.removeEventListener(\"resize\", this.resizeListener);\n this.term.destroy();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/xterm.ts","// This file was generated by libdot/bin/concat.sh.\n// It has been marked read-only for your safety. Rather\n// than edit it directly, please modify one of these source\n// files...\n//\n// libdot/js/lib.js\n// libdot/js/lib_polyfill.js\n// libdot/js/lib_colors.js\n// libdot/js/lib_f.js\n// libdot/js/lib_message_manager.js\n// libdot/js/lib_preference_manager.js\n// libdot/js/lib_resource.js\n// libdot/js/lib_storage.js\n// libdot/js/lib_storage_chrome.js\n// libdot/js/lib_storage_local.js\n// libdot/js/lib_storage_memory.js\n// libdot/js/lib_test_manager.js\n// libdot/js/lib_utf8.js\n// libdot/third_party/wcwidth/lib_wc.js\n// hterm/js/hterm.js\n// hterm/js/hterm_frame.js\n// hterm/js/hterm_keyboard.js\n// hterm/js/hterm_keyboard_bindings.js\n// hterm/js/hterm_keyboard_keymap.js\n// hterm/js/hterm_keyboard_keypattern.js\n// hterm/js/hterm_options.js\n// hterm/js/hterm_parser.js\n// hterm/js/hterm_parser_identifiers.js\n// hterm/js/hterm_preference_manager.js\n// hterm/js/hterm_pubsub.js\n// hterm/js/hterm_screen.js\n// hterm/js/hterm_scrollport.js\n// hterm/js/hterm_terminal.js\n// hterm/js/hterm_terminal_io.js\n// hterm/js/hterm_text_attributes.js\n// hterm/js/hterm_vt.js\n// hterm/js/hterm_vt_character_map.js\n// hterm/js/hterm_export.js\n//\n\n// SOURCE FILE: libdot/js/lib.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nif (typeof lib != 'undefined')\n throw new Error('Global \"lib\" object already exists.');\n\nvar lib = {};\n\n/**\n * Map of \"dependency\" to [\"source\", ...].\n *\n * Each dependency is a object name, like \"lib.fs\", \"source\" is the url that\n * depends on the object.\n */\nlib.runtimeDependencies_ = {};\n\n/**\n * List of functions that need to be invoked during library initialization.\n *\n * Each element in the initCallbacks_ array is itself a two-element array.\n * Element 0 is a short string describing the owner of the init routine, useful\n * for debugging. Element 1 is the callback function.\n */\nlib.initCallbacks_ = [];\n\n/**\n * Records a runtime dependency.\n *\n * This can be useful when you want to express a run-time dependency at\n * compile time. It is not intended to be a full-fledged library system or\n * dependency tracker. It's just there to make it possible to debug the\n * deps without running all the code.\n *\n * Object names are specified as strings. For example...\n *\n * lib.rtdep('lib.colors', 'lib.PreferenceManager');\n *\n * Object names need not be rooted by 'lib'. You may use this to declare a\n * dependency on any object.\n *\n * The client program may call lib.ensureRuntimeDependencies() at startup in\n * order to ensure that all runtime dependencies have been met.\n *\n * @param {string} var_args One or more objects specified as strings.\n */\nlib.rtdep = function(var_args) {\n var source;\n\n try {\n throw new Error();\n } catch (ex) {\n var stackArray = ex.stack.split('\\n');\n // In Safari, the resulting stackArray will only have 2 elements and the\n // individual strings are formatted differently.\n if (stackArray.length >= 3) {\n source = stackArray[2].replace(/^\\s*at\\s+/, '');\n } else {\n source = stackArray[1].replace(/^\\s*global code@/, '');\n }\n }\n\n for (var i = 0; i < arguments.length; i++) {\n var path = arguments[i];\n if (path instanceof Array) {\n lib.rtdep.apply(lib, path);\n } else {\n var ary = this.runtimeDependencies_[path];\n if (!ary)\n ary = this.runtimeDependencies_[path] = [];\n ary.push(source);\n }\n }\n};\n\n/**\n * Ensures that all runtime dependencies are met, or an exception is thrown.\n *\n * Every unmet runtime dependency will be logged to the JS console. If at\n * least one dependency is unmet this will raise an exception.\n */\nlib.ensureRuntimeDependencies_ = function() {\n var passed = true;\n\n for (var path in lib.runtimeDependencies_) {\n var sourceList = lib.runtimeDependencies_[path];\n var names = path.split('.');\n\n // In a document context 'window' is the global object. In a worker it's\n // called 'self'.\n var obj = (window || self);\n for (var i = 0; i < names.length; i++) {\n if (!(names[i] in obj)) {\n console.warn('Missing \"' + path + '\" is needed by', sourceList);\n passed = false;\n break;\n }\n\n obj = obj[names[i]];\n }\n }\n\n if (!passed)\n throw new Error('Failed runtime dependency check');\n};\n\n/**\n * Register an initialization function.\n *\n * The initialization functions are invoked in registration order when\n * lib.init() is invoked. Each function will receive a single parameter, which\n * is a function to be invoked when it completes its part of the initialization.\n *\n * @param {string} name A short descriptive name of the init routine useful for\n * debugging.\n * @param {function(function)} callback The initialization function to register.\n * @return {function} The callback parameter.\n */\nlib.registerInit = function(name, callback) {\n lib.initCallbacks_.push([name, callback]);\n return callback;\n};\n\n/**\n * Initialize the library.\n *\n * This will ensure that all registered runtime dependencies are met, and\n * invoke any registered initialization functions.\n *\n * Initialization is asynchronous. The library is not ready for use until\n * the onInit function is invoked.\n *\n * @param {function()} onInit The function to invoke when initialization is\n * complete.\n * @param {function(*)} opt_logFunction An optional function to send\n * initialization related log messages to.\n */\nlib.init = function(onInit, opt_logFunction) {\n var ary = lib.initCallbacks_;\n\n var initNext = function() {\n if (ary.length) {\n var rec = ary.shift();\n if (opt_logFunction)\n opt_logFunction('init: ' + rec[0]);\n rec[1](lib.f.alarm(initNext));\n } else {\n onInit();\n }\n };\n\n if (typeof onInit != 'function')\n throw new Error('Missing or invalid argument: onInit');\n\n lib.ensureRuntimeDependencies_();\n\n setTimeout(initNext, 0);\n};\n// SOURCE FILE: libdot/js/lib_polyfill.js\n// Copyright 2017 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * @fileoverview Polyfills for ES2016+ features we want to use.\n */\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart\nif (!String.prototype.padStart) {\n String.prototype.padStart = function(targetLength, padString) {\n // If the string is already long enough, nothing to do!\n targetLength -= this.length;\n if (targetLength <= 0)\n return String(this);\n\n if (padString === undefined)\n padString = ' ';\n\n // In case the pad is multiple chars long.\n if (targetLength > padString.length)\n padString = padString.repeat((targetLength / padString.length) + 1);\n\n return padString.slice(0, targetLength) + String(this);\n };\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd\nif (!String.prototype.padEnd) {\n String.prototype.padEnd = function(targetLength, padString) {\n // If the string is already long enough, nothing to do!\n targetLength -= this.length;\n if (targetLength <= 0)\n return String(this);\n\n if (padString === undefined)\n padString = ' ';\n\n // In case the pad is multiple chars long.\n if (targetLength > padString.length)\n padString = padString.repeat((targetLength / padString.length) + 1);\n\n return String(this) + padString.slice(0, targetLength);\n };\n}\n// SOURCE FILE: libdot/js/lib_colors.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Namespace for color utilities.\n */\nlib.colors = {};\n\n/**\n * First, some canned regular expressions we're going to use in this file.\n *\n *\n * BRACE YOURSELF\n *\n * ,~~~~.\n * |>_< ~~\n * 3`---'-/.\n * 3:::::\\v\\\n * =o=:::::\\,\\\n * | :::::\\,,\\\n *\n * THE REGULAR EXPRESSIONS\n * ARE COMING.\n *\n * There's no way to break long RE literals in JavaScript. Fix that why don't\n * you? Oh, and also there's no way to write a string that doesn't interpret\n * escapes.\n *\n * Instead, we stoop to this .replace() trick.\n */\nlib.colors.re_ = {\n // CSS hex color, #RGB.\n hex16: /#([a-f0-9])([a-f0-9])([a-f0-9])/i,\n\n // CSS hex color, #RRGGBB.\n hex24: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/i,\n\n // CSS rgb color, rgb(rrr,ggg,bbb).\n rgb: new RegExp(\n ('^/s*rgb/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,' +\n '/s*(/d{1,3})/s*/)/s*$'\n ).replace(/\\//g, '\\\\'), 'i'),\n\n // CSS rgb color, rgb(rrr,ggg,bbb,aaa).\n rgba: new RegExp(\n ('^/s*rgba/s*' +\n '/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*' +\n '(?:,/s*(/d+(?:/./d+)?)/s*)/)/s*$'\n ).replace(/\\//g, '\\\\'), 'i'),\n\n // Either RGB or RGBA.\n rgbx: new RegExp(\n ('^/s*rgba?/s*' +\n '/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*' +\n '(?:,/s*(/d+(?:/./d+)?)/s*)?/)/s*$'\n ).replace(/\\//g, '\\\\'), 'i'),\n\n // An X11 \"rgb:dddd/dddd/dddd\" value.\n x11rgb: /^\\s*rgb:([a-f0-9]{1,4})\\/([a-f0-9]{1,4})\\/([a-f0-9]{1,4})\\s*$/i,\n\n // English color name.\n name: /[a-z][a-z0-9\\s]+/,\n};\n\n/**\n * Convert a CSS rgb(ddd,ddd,ddd) color value into an X11 color value.\n *\n * Other CSS color values are ignored to ensure sanitary data handling.\n *\n * Each 'ddd' component is a one byte value specified in decimal.\n *\n * @param {string} value The CSS color value to convert.\n * @return {string} The X11 color value or null if the value could not be\n * converted.\n */\nlib.colors.rgbToX11 = function(value) {\n function scale(v) {\n v = (Math.min(v, 255) * 257).toString(16);\n return lib.f.zpad(v, 4);\n }\n\n var ary = value.match(lib.colors.re_.rgbx);\n if (!ary)\n return null;\n\n return 'rgb:' + scale(ary[1]) + '/' + scale(ary[2]) + '/' + scale(ary[3]);\n};\n\n/**\n * Convert a legacy X11 colover value into an CSS rgb(...) color value.\n *\n * They take the form:\n * 12 bit: #RGB -> #R000G000B000\n * 24 bit: #RRGGBB -> #RR00GG00BB00\n * 36 bit: #RRRGGGBBB -> #RRR0GGG0BBB0\n * 48 bit: #RRRRGGGGBBBB\n * These are the most significant bits.\n *\n * Truncate values back down to 24 bit since that's all CSS supports.\n */\nlib.colors.x11HexToCSS = function(v) {\n if (!v.startsWith('#'))\n return null;\n // Strip the leading # off.\n v = v.substr(1);\n\n // Reject unknown sizes.\n if ([3, 6, 9, 12].indexOf(v.length) == -1)\n return null;\n\n // Reject non-hex values.\n if (v.match(/[^a-f0-9]/i))\n return null;\n\n // Split the colors out.\n var size = v.length / 3;\n var r = v.substr(0, size);\n var g = v.substr(size, size);\n var b = v.substr(size + size, size);\n\n // Normalize to 16 bits.\n function norm16(v) {\n v = parseInt(v, 16);\n return size == 2 ? v : // 16 bit\n size == 1 ? v << 4 : // 8 bit\n v >> (4 * (size - 2)); // 24 or 32 bit\n }\n return lib.colors.arrayToRGBA([r, g, b].map(norm16));\n};\n\n/**\n * Convert an X11 color value into an CSS rgb(...) color value.\n *\n * The X11 value may be an X11 color name, or an RGB value of the form\n * rgb:hhhh/hhhh/hhhh. If a component value is less than 4 digits it is\n * padded out to 4, then scaled down to fit in a single byte.\n *\n * @param {string} value The X11 color value to convert.\n * @return {string} The CSS color value or null if the value could not be\n * converted.\n */\nlib.colors.x11ToCSS = function(v) {\n function scale(v) {\n // Pad out values with less than four digits. This padding (probably)\n // matches xterm. It's difficult to say for sure since xterm seems to\n // arrive at a padded value and then perform some combination of\n // gamma correction, color space transformation, and quantization.\n\n if (v.length == 1) {\n // Single digits pad out to four by repeating the character. \"f\" becomes\n // \"ffff\". Scaling down a hex value of this pattern by 257 is the same\n // as cutting off one byte. We skip the middle step and just double\n // the character.\n return parseInt(v + v, 16);\n }\n\n if (v.length == 2) {\n // Similar deal here. X11 pads two digit values by repeating the\n // byte (or scale up by 257). Since we're going to scale it back\n // down anyway, we can just return the original value.\n return parseInt(v, 16);\n }\n\n if (v.length == 3) {\n // Three digit values seem to be padded by repeating the final digit.\n // e.g. 10f becomes 10ff.\n v = v + v.substr(2);\n }\n\n // Scale down the 2 byte value.\n return Math.round(parseInt(v, 16) / 257);\n }\n\n var ary = v.match(lib.colors.re_.x11rgb);\n if (!ary) {\n // Handle the legacy format.\n if (v.startsWith('#'))\n return lib.colors.x11HexToCSS(v);\n else\n return lib.colors.nameToRGB(v);\n }\n\n ary.splice(0, 1);\n return lib.colors.arrayToRGBA(ary.map(scale));\n};\n\n/**\n * Converts one or more CSS '#RRGGBB' color values into their rgb(...)\n * form.\n *\n * Arrays are converted in place. If a value cannot be converted, it is\n * replaced with null.\n *\n * @param {string|Array.} A single RGB value or array of RGB values to\n * convert.\n * @return {string|Array.} The converted value or values.\n */\nlib.colors.hexToRGB = function(arg) {\n var hex16 = lib.colors.re_.hex16;\n var hex24 = lib.colors.re_.hex24;\n\n function convert(hex) {\n if (hex.length == 4) {\n hex = hex.replace(hex16, function(h, r, g, b) {\n return \"#\" + r + r + g + g + b + b;\n });\n }\n var ary = hex.match(hex24);\n if (!ary)\n return null;\n\n return 'rgb(' + parseInt(ary[1], 16) + ', ' +\n parseInt(ary[2], 16) + ', ' +\n parseInt(ary[3], 16) + ')';\n }\n\n if (arg instanceof Array) {\n for (var i = 0; i < arg.length; i++) {\n arg[i] = convert(arg[i]);\n }\n } else {\n arg = convert(arg);\n }\n\n return arg;\n};\n\n/**\n * Converts one or more CSS rgb(...) forms into their '#RRGGBB' color values.\n *\n * If given an rgba(...) form, the alpha field is thrown away.\n *\n * Arrays are converted in place. If a value cannot be converted, it is\n * replaced with null.\n *\n * @param {string|Array.} A single rgb(...) value or array of rgb(...)\n * values to convert.\n * @return {string|Array.} The converted value or values.\n */\nlib.colors.rgbToHex = function(arg) {\n function convert(rgb) {\n var ary = lib.colors.crackRGB(rgb);\n if (!ary)\n return null;\n return '#' + lib.f.zpad(((parseInt(ary[0]) << 16) |\n (parseInt(ary[1]) << 8) |\n (parseInt(ary[2]) << 0)).toString(16), 6);\n }\n\n if (arg instanceof Array) {\n for (var i = 0; i < arg.length; i++) {\n arg[i] = convert(arg[i]);\n }\n } else {\n arg = convert(arg);\n }\n\n return arg;\n};\n\n/**\n * Take any valid css color definition and turn it into an rgb or rgba value.\n *\n * Returns null if the value could not be normalized.\n */\nlib.colors.normalizeCSS = function(def) {\n if (def.startsWith('#'))\n return lib.colors.hexToRGB(def);\n\n if (lib.colors.re_.rgbx.test(def))\n return def;\n\n return lib.colors.nameToRGB(def);\n};\n\n/**\n * Convert a 3 or 4 element array into an rgba(...) string.\n */\nlib.colors.arrayToRGBA = function(ary) {\n var alpha = (ary.length > 3) ? ary[3] : 1;\n return 'rgba(' + ary[0] + ', ' + ary[1] + ', ' + ary[2] + ', ' + alpha + ')';\n};\n\n/**\n * Overwrite the alpha channel of an rgb/rgba color.\n */\nlib.colors.setAlpha = function(rgb, alpha) {\n var ary = lib.colors.crackRGB(rgb);\n ary[3] = alpha;\n return lib.colors.arrayToRGBA(ary);\n};\n\n/**\n * Mix a percentage of a tint color into a base color.\n */\nlib.colors.mix = function(base, tint, percent) {\n var ary1 = lib.colors.crackRGB(base);\n var ary2 = lib.colors.crackRGB(tint);\n\n for (var i = 0; i < 4; ++i) {\n var diff = ary2[i] - ary1[i];\n ary1[i] = Math.round(parseInt(ary1[i]) + diff * percent);\n }\n\n return lib.colors.arrayToRGBA(ary1);\n};\n\n/**\n * Split an rgb/rgba color into an array of its components.\n *\n * On success, a 4 element array will be returned. For rgb values, the alpha\n * will be set to 1.\n */\nlib.colors.crackRGB = function(color) {\n if (color.startsWith('rgba')) {\n var ary = color.match(lib.colors.re_.rgba);\n if (ary) {\n ary.shift();\n return ary;\n }\n } else {\n var ary = color.match(lib.colors.re_.rgb);\n if (ary) {\n ary.shift();\n ary.push(1);\n return ary;\n }\n }\n\n console.error('Couldn\\'t crack: ' + color);\n return null;\n};\n\n/**\n * Convert an X11 color name into a CSS rgb(...) value.\n *\n * Names are stripped of spaces and converted to lowercase. If the name is\n * unknown, null is returned.\n *\n * This list of color name to RGB mapping is derived from the stock X11\n * rgb.txt file.\n *\n * @param {string} name The color name to convert.\n * @return {string} The corresponding CSS rgb(...) value.\n */\nlib.colors.nameToRGB = function(name) {\n if (name in lib.colors.colorNames)\n return lib.colors.colorNames[name];\n\n name = name.toLowerCase();\n if (name in lib.colors.colorNames)\n return lib.colors.colorNames[name];\n\n name = name.replace(/\\s+/g, '');\n if (name in lib.colors.colorNames)\n return lib.colors.colorNames[name];\n\n return null;\n};\n\n/**\n * The stock color palette.\n */\nlib.colors.stockColorPalette = lib.colors.hexToRGB\n ([// The \"ANSI 16\"...\n '#000000', '#CC0000', '#4E9A06', '#C4A000',\n '#3465A4', '#75507B', '#06989A', '#D3D7CF',\n '#555753', '#EF2929', '#00BA13', '#FCE94F',\n '#729FCF', '#F200CB', '#00B5BD', '#EEEEEC',\n\n // The 6x6 color cubes...\n '#000000', '#00005F', '#000087', '#0000AF', '#0000D7', '#0000FF',\n '#005F00', '#005F5F', '#005F87', '#005FAF', '#005FD7', '#005FFF',\n '#008700', '#00875F', '#008787', '#0087AF', '#0087D7', '#0087FF',\n '#00AF00', '#00AF5F', '#00AF87', '#00AFAF', '#00AFD7', '#00AFFF',\n '#00D700', '#00D75F', '#00D787', '#00D7AF', '#00D7D7', '#00D7FF',\n '#00FF00', '#00FF5F', '#00FF87', '#00FFAF', '#00FFD7', '#00FFFF',\n\n '#5F0000', '#5F005F', '#5F0087', '#5F00AF', '#5F00D7', '#5F00FF',\n '#5F5F00', '#5F5F5F', '#5F5F87', '#5F5FAF', '#5F5FD7', '#5F5FFF',\n '#5F8700', '#5F875F', '#5F8787', '#5F87AF', '#5F87D7', '#5F87FF',\n '#5FAF00', '#5FAF5F', '#5FAF87', '#5FAFAF', '#5FAFD7', '#5FAFFF',\n '#5FD700', '#5FD75F', '#5FD787', '#5FD7AF', '#5FD7D7', '#5FD7FF',\n '#5FFF00', '#5FFF5F', '#5FFF87', '#5FFFAF', '#5FFFD7', '#5FFFFF',\n\n '#870000', '#87005F', '#870087', '#8700AF', '#8700D7', '#8700FF',\n '#875F00', '#875F5F', '#875F87', '#875FAF', '#875FD7', '#875FFF',\n '#878700', '#87875F', '#878787', '#8787AF', '#8787D7', '#8787FF',\n '#87AF00', '#87AF5F', '#87AF87', '#87AFAF', '#87AFD7', '#87AFFF',\n '#87D700', '#87D75F', '#87D787', '#87D7AF', '#87D7D7', '#87D7FF',\n '#87FF00', '#87FF5F', '#87FF87', '#87FFAF', '#87FFD7', '#87FFFF',\n\n '#AF0000', '#AF005F', '#AF0087', '#AF00AF', '#AF00D7', '#AF00FF',\n '#AF5F00', '#AF5F5F', '#AF5F87', '#AF5FAF', '#AF5FD7', '#AF5FFF',\n '#AF8700', '#AF875F', '#AF8787', '#AF87AF', '#AF87D7', '#AF87FF',\n '#AFAF00', '#AFAF5F', '#AFAF87', '#AFAFAF', '#AFAFD7', '#AFAFFF',\n '#AFD700', '#AFD75F', '#AFD787', '#AFD7AF', '#AFD7D7', '#AFD7FF',\n '#AFFF00', '#AFFF5F', '#AFFF87', '#AFFFAF', '#AFFFD7', '#AFFFFF',\n\n '#D70000', '#D7005F', '#D70087', '#D700AF', '#D700D7', '#D700FF',\n '#D75F00', '#D75F5F', '#D75F87', '#D75FAF', '#D75FD7', '#D75FFF',\n '#D78700', '#D7875F', '#D78787', '#D787AF', '#D787D7', '#D787FF',\n '#D7AF00', '#D7AF5F', '#D7AF87', '#D7AFAF', '#D7AFD7', '#D7AFFF',\n '#D7D700', '#D7D75F', '#D7D787', '#D7D7AF', '#D7D7D7', '#D7D7FF',\n '#D7FF00', '#D7FF5F', '#D7FF87', '#D7FFAF', '#D7FFD7', '#D7FFFF',\n\n '#FF0000', '#FF005F', '#FF0087', '#FF00AF', '#FF00D7', '#FF00FF',\n '#FF5F00', '#FF5F5F', '#FF5F87', '#FF5FAF', '#FF5FD7', '#FF5FFF',\n '#FF8700', '#FF875F', '#FF8787', '#FF87AF', '#FF87D7', '#FF87FF',\n '#FFAF00', '#FFAF5F', '#FFAF87', '#FFAFAF', '#FFAFD7', '#FFAFFF',\n '#FFD700', '#FFD75F', '#FFD787', '#FFD7AF', '#FFD7D7', '#FFD7FF',\n '#FFFF00', '#FFFF5F', '#FFFF87', '#FFFFAF', '#FFFFD7', '#FFFFFF',\n\n // The greyscale ramp...\n '#080808', '#121212', '#1C1C1C', '#262626', '#303030', '#3A3A3A',\n '#444444', '#4E4E4E', '#585858', '#626262', '#6C6C6C', '#767676',\n '#808080', '#8A8A8A', '#949494', '#9E9E9E', '#A8A8A8', '#B2B2B2',\n '#BCBCBC', '#C6C6C6', '#D0D0D0', '#DADADA', '#E4E4E4', '#EEEEEE'\n ]);\n\n/**\n * The current color palette, possibly with user changes.\n */\nlib.colors.colorPalette = lib.colors.stockColorPalette;\n\n/**\n * Named colors according to the stock X11 rgb.txt file.\n */\nlib.colors.colorNames = {\n \"aliceblue\": \"rgb(240, 248, 255)\",\n \"antiquewhite\": \"rgb(250, 235, 215)\",\n \"antiquewhite1\": \"rgb(255, 239, 219)\",\n \"antiquewhite2\": \"rgb(238, 223, 204)\",\n \"antiquewhite3\": \"rgb(205, 192, 176)\",\n \"antiquewhite4\": \"rgb(139, 131, 120)\",\n \"aquamarine\": \"rgb(127, 255, 212)\",\n \"aquamarine1\": \"rgb(127, 255, 212)\",\n \"aquamarine2\": \"rgb(118, 238, 198)\",\n \"aquamarine3\": \"rgb(102, 205, 170)\",\n \"aquamarine4\": \"rgb(69, 139, 116)\",\n \"azure\": \"rgb(240, 255, 255)\",\n \"azure1\": \"rgb(240, 255, 255)\",\n \"azure2\": \"rgb(224, 238, 238)\",\n \"azure3\": \"rgb(193, 205, 205)\",\n \"azure4\": \"rgb(131, 139, 139)\",\n \"beige\": \"rgb(245, 245, 220)\",\n \"bisque\": \"rgb(255, 228, 196)\",\n \"bisque1\": \"rgb(255, 228, 196)\",\n \"bisque2\": \"rgb(238, 213, 183)\",\n \"bisque3\": \"rgb(205, 183, 158)\",\n \"bisque4\": \"rgb(139, 125, 107)\",\n \"black\": \"rgb(0, 0, 0)\",\n \"blanchedalmond\": \"rgb(255, 235, 205)\",\n \"blue\": \"rgb(0, 0, 255)\",\n \"blue1\": \"rgb(0, 0, 255)\",\n \"blue2\": \"rgb(0, 0, 238)\",\n \"blue3\": \"rgb(0, 0, 205)\",\n \"blue4\": \"rgb(0, 0, 139)\",\n \"blueviolet\": \"rgb(138, 43, 226)\",\n \"brown\": \"rgb(165, 42, 42)\",\n \"brown1\": \"rgb(255, 64, 64)\",\n \"brown2\": \"rgb(238, 59, 59)\",\n \"brown3\": \"rgb(205, 51, 51)\",\n \"brown4\": \"rgb(139, 35, 35)\",\n \"burlywood\": \"rgb(222, 184, 135)\",\n \"burlywood1\": \"rgb(255, 211, 155)\",\n \"burlywood2\": \"rgb(238, 197, 145)\",\n \"burlywood3\": \"rgb(205, 170, 125)\",\n \"burlywood4\": \"rgb(139, 115, 85)\",\n \"cadetblue\": \"rgb(95, 158, 160)\",\n \"cadetblue1\": \"rgb(152, 245, 255)\",\n \"cadetblue2\": \"rgb(142, 229, 238)\",\n \"cadetblue3\": \"rgb(122, 197, 205)\",\n \"cadetblue4\": \"rgb(83, 134, 139)\",\n \"chartreuse\": \"rgb(127, 255, 0)\",\n \"chartreuse1\": \"rgb(127, 255, 0)\",\n \"chartreuse2\": \"rgb(118, 238, 0)\",\n \"chartreuse3\": \"rgb(102, 205, 0)\",\n \"chartreuse4\": \"rgb(69, 139, 0)\",\n \"chocolate\": \"rgb(210, 105, 30)\",\n \"chocolate1\": \"rgb(255, 127, 36)\",\n \"chocolate2\": \"rgb(238, 118, 33)\",\n \"chocolate3\": \"rgb(205, 102, 29)\",\n \"chocolate4\": \"rgb(139, 69, 19)\",\n \"coral\": \"rgb(255, 127, 80)\",\n \"coral1\": \"rgb(255, 114, 86)\",\n \"coral2\": \"rgb(238, 106, 80)\",\n \"coral3\": \"rgb(205, 91, 69)\",\n \"coral4\": \"rgb(139, 62, 47)\",\n \"cornflowerblue\": \"rgb(100, 149, 237)\",\n \"cornsilk\": \"rgb(255, 248, 220)\",\n \"cornsilk1\": \"rgb(255, 248, 220)\",\n \"cornsilk2\": \"rgb(238, 232, 205)\",\n \"cornsilk3\": \"rgb(205, 200, 177)\",\n \"cornsilk4\": \"rgb(139, 136, 120)\",\n \"cyan\": \"rgb(0, 255, 255)\",\n \"cyan1\": \"rgb(0, 255, 255)\",\n \"cyan2\": \"rgb(0, 238, 238)\",\n \"cyan3\": \"rgb(0, 205, 205)\",\n \"cyan4\": \"rgb(0, 139, 139)\",\n \"darkblue\": \"rgb(0, 0, 139)\",\n \"darkcyan\": \"rgb(0, 139, 139)\",\n \"darkgoldenrod\": \"rgb(184, 134, 11)\",\n \"darkgoldenrod1\": \"rgb(255, 185, 15)\",\n \"darkgoldenrod2\": \"rgb(238, 173, 14)\",\n \"darkgoldenrod3\": \"rgb(205, 149, 12)\",\n \"darkgoldenrod4\": \"rgb(139, 101, 8)\",\n \"darkgray\": \"rgb(169, 169, 169)\",\n \"darkgreen\": \"rgb(0, 100, 0)\",\n \"darkgrey\": \"rgb(169, 169, 169)\",\n \"darkkhaki\": \"rgb(189, 183, 107)\",\n \"darkmagenta\": \"rgb(139, 0, 139)\",\n \"darkolivegreen\": \"rgb(85, 107, 47)\",\n \"darkolivegreen1\": \"rgb(202, 255, 112)\",\n \"darkolivegreen2\": \"rgb(188, 238, 104)\",\n \"darkolivegreen3\": \"rgb(162, 205, 90)\",\n \"darkolivegreen4\": \"rgb(110, 139, 61)\",\n \"darkorange\": \"rgb(255, 140, 0)\",\n \"darkorange1\": \"rgb(255, 127, 0)\",\n \"darkorange2\": \"rgb(238, 118, 0)\",\n \"darkorange3\": \"rgb(205, 102, 0)\",\n \"darkorange4\": \"rgb(139, 69, 0)\",\n \"darkorchid\": \"rgb(153, 50, 204)\",\n \"darkorchid1\": \"rgb(191, 62, 255)\",\n \"darkorchid2\": \"rgb(178, 58, 238)\",\n \"darkorchid3\": \"rgb(154, 50, 205)\",\n \"darkorchid4\": \"rgb(104, 34, 139)\",\n \"darkred\": \"rgb(139, 0, 0)\",\n \"darksalmon\": \"rgb(233, 150, 122)\",\n \"darkseagreen\": \"rgb(143, 188, 143)\",\n \"darkseagreen1\": \"rgb(193, 255, 193)\",\n \"darkseagreen2\": \"rgb(180, 238, 180)\",\n \"darkseagreen3\": \"rgb(155, 205, 155)\",\n \"darkseagreen4\": \"rgb(105, 139, 105)\",\n \"darkslateblue\": \"rgb(72, 61, 139)\",\n \"darkslategray\": \"rgb(47, 79, 79)\",\n \"darkslategray1\": \"rgb(151, 255, 255)\",\n \"darkslategray2\": \"rgb(141, 238, 238)\",\n \"darkslategray3\": \"rgb(121, 205, 205)\",\n \"darkslategray4\": \"rgb(82, 139, 139)\",\n \"darkslategrey\": \"rgb(47, 79, 79)\",\n \"darkturquoise\": \"rgb(0, 206, 209)\",\n \"darkviolet\": \"rgb(148, 0, 211)\",\n \"debianred\": \"rgb(215, 7, 81)\",\n \"deeppink\": \"rgb(255, 20, 147)\",\n \"deeppink1\": \"rgb(255, 20, 147)\",\n \"deeppink2\": \"rgb(238, 18, 137)\",\n \"deeppink3\": \"rgb(205, 16, 118)\",\n \"deeppink4\": \"rgb(139, 10, 80)\",\n \"deepskyblue\": \"rgb(0, 191, 255)\",\n \"deepskyblue1\": \"rgb(0, 191, 255)\",\n \"deepskyblue2\": \"rgb(0, 178, 238)\",\n \"deepskyblue3\": \"rgb(0, 154, 205)\",\n \"deepskyblue4\": \"rgb(0, 104, 139)\",\n \"dimgray\": \"rgb(105, 105, 105)\",\n \"dimgrey\": \"rgb(105, 105, 105)\",\n \"dodgerblue\": \"rgb(30, 144, 255)\",\n \"dodgerblue1\": \"rgb(30, 144, 255)\",\n \"dodgerblue2\": \"rgb(28, 134, 238)\",\n \"dodgerblue3\": \"rgb(24, 116, 205)\",\n \"dodgerblue4\": \"rgb(16, 78, 139)\",\n \"firebrick\": \"rgb(178, 34, 34)\",\n \"firebrick1\": \"rgb(255, 48, 48)\",\n \"firebrick2\": \"rgb(238, 44, 44)\",\n \"firebrick3\": \"rgb(205, 38, 38)\",\n \"firebrick4\": \"rgb(139, 26, 26)\",\n \"floralwhite\": \"rgb(255, 250, 240)\",\n \"forestgreen\": \"rgb(34, 139, 34)\",\n \"gainsboro\": \"rgb(220, 220, 220)\",\n \"ghostwhite\": \"rgb(248, 248, 255)\",\n \"gold\": \"rgb(255, 215, 0)\",\n \"gold1\": \"rgb(255, 215, 0)\",\n \"gold2\": \"rgb(238, 201, 0)\",\n \"gold3\": \"rgb(205, 173, 0)\",\n \"gold4\": \"rgb(139, 117, 0)\",\n \"goldenrod\": \"rgb(218, 165, 32)\",\n \"goldenrod1\": \"rgb(255, 193, 37)\",\n \"goldenrod2\": \"rgb(238, 180, 34)\",\n \"goldenrod3\": \"rgb(205, 155, 29)\",\n \"goldenrod4\": \"rgb(139, 105, 20)\",\n \"gray\": \"rgb(190, 190, 190)\",\n \"gray0\": \"rgb(0, 0, 0)\",\n \"gray1\": \"rgb(3, 3, 3)\",\n \"gray10\": \"rgb(26, 26, 26)\",\n \"gray100\": \"rgb(255, 255, 255)\",\n \"gray11\": \"rgb(28, 28, 28)\",\n \"gray12\": \"rgb(31, 31, 31)\",\n \"gray13\": \"rgb(33, 33, 33)\",\n \"gray14\": \"rgb(36, 36, 36)\",\n \"gray15\": \"rgb(38, 38, 38)\",\n \"gray16\": \"rgb(41, 41, 41)\",\n \"gray17\": \"rgb(43, 43, 43)\",\n \"gray18\": \"rgb(46, 46, 46)\",\n \"gray19\": \"rgb(48, 48, 48)\",\n \"gray2\": \"rgb(5, 5, 5)\",\n \"gray20\": \"rgb(51, 51, 51)\",\n \"gray21\": \"rgb(54, 54, 54)\",\n \"gray22\": \"rgb(56, 56, 56)\",\n \"gray23\": \"rgb(59, 59, 59)\",\n \"gray24\": \"rgb(61, 61, 61)\",\n \"gray25\": \"rgb(64, 64, 64)\",\n \"gray26\": \"rgb(66, 66, 66)\",\n \"gray27\": \"rgb(69, 69, 69)\",\n \"gray28\": \"rgb(71, 71, 71)\",\n \"gray29\": \"rgb(74, 74, 74)\",\n \"gray3\": \"rgb(8, 8, 8)\",\n \"gray30\": \"rgb(77, 77, 77)\",\n \"gray31\": \"rgb(79, 79, 79)\",\n \"gray32\": \"rgb(82, 82, 82)\",\n \"gray33\": \"rgb(84, 84, 84)\",\n \"gray34\": \"rgb(87, 87, 87)\",\n \"gray35\": \"rgb(89, 89, 89)\",\n \"gray36\": \"rgb(92, 92, 92)\",\n \"gray37\": \"rgb(94, 94, 94)\",\n \"gray38\": \"rgb(97, 97, 97)\",\n \"gray39\": \"rgb(99, 99, 99)\",\n \"gray4\": \"rgb(10, 10, 10)\",\n \"gray40\": \"rgb(102, 102, 102)\",\n \"gray41\": \"rgb(105, 105, 105)\",\n \"gray42\": \"rgb(107, 107, 107)\",\n \"gray43\": \"rgb(110, 110, 110)\",\n \"gray44\": \"rgb(112, 112, 112)\",\n \"gray45\": \"rgb(115, 115, 115)\",\n \"gray46\": \"rgb(117, 117, 117)\",\n \"gray47\": \"rgb(120, 120, 120)\",\n \"gray48\": \"rgb(122, 122, 122)\",\n \"gray49\": \"rgb(125, 125, 125)\",\n \"gray5\": \"rgb(13, 13, 13)\",\n \"gray50\": \"rgb(127, 127, 127)\",\n \"gray51\": \"rgb(130, 130, 130)\",\n \"gray52\": \"rgb(133, 133, 133)\",\n \"gray53\": \"rgb(135, 135, 135)\",\n \"gray54\": \"rgb(138, 138, 138)\",\n \"gray55\": \"rgb(140, 140, 140)\",\n \"gray56\": \"rgb(143, 143, 143)\",\n \"gray57\": \"rgb(145, 145, 145)\",\n \"gray58\": \"rgb(148, 148, 148)\",\n \"gray59\": \"rgb(150, 150, 150)\",\n \"gray6\": \"rgb(15, 15, 15)\",\n \"gray60\": \"rgb(153, 153, 153)\",\n \"gray61\": \"rgb(156, 156, 156)\",\n \"gray62\": \"rgb(158, 158, 158)\",\n \"gray63\": \"rgb(161, 161, 161)\",\n \"gray64\": \"rgb(163, 163, 163)\",\n \"gray65\": \"rgb(166, 166, 166)\",\n \"gray66\": \"rgb(168, 168, 168)\",\n \"gray67\": \"rgb(171, 171, 171)\",\n \"gray68\": \"rgb(173, 173, 173)\",\n \"gray69\": \"rgb(176, 176, 176)\",\n \"gray7\": \"rgb(18, 18, 18)\",\n \"gray70\": \"rgb(179, 179, 179)\",\n \"gray71\": \"rgb(181, 181, 181)\",\n \"gray72\": \"rgb(184, 184, 184)\",\n \"gray73\": \"rgb(186, 186, 186)\",\n \"gray74\": \"rgb(189, 189, 189)\",\n \"gray75\": \"rgb(191, 191, 191)\",\n \"gray76\": \"rgb(194, 194, 194)\",\n \"gray77\": \"rgb(196, 196, 196)\",\n \"gray78\": \"rgb(199, 199, 199)\",\n \"gray79\": \"rgb(201, 201, 201)\",\n \"gray8\": \"rgb(20, 20, 20)\",\n \"gray80\": \"rgb(204, 204, 204)\",\n \"gray81\": \"rgb(207, 207, 207)\",\n \"gray82\": \"rgb(209, 209, 209)\",\n \"gray83\": \"rgb(212, 212, 212)\",\n \"gray84\": \"rgb(214, 214, 214)\",\n \"gray85\": \"rgb(217, 217, 217)\",\n \"gray86\": \"rgb(219, 219, 219)\",\n \"gray87\": \"rgb(222, 222, 222)\",\n \"gray88\": \"rgb(224, 224, 224)\",\n \"gray89\": \"rgb(227, 227, 227)\",\n \"gray9\": \"rgb(23, 23, 23)\",\n \"gray90\": \"rgb(229, 229, 229)\",\n \"gray91\": \"rgb(232, 232, 232)\",\n \"gray92\": \"rgb(235, 235, 235)\",\n \"gray93\": \"rgb(237, 237, 237)\",\n \"gray94\": \"rgb(240, 240, 240)\",\n \"gray95\": \"rgb(242, 242, 242)\",\n \"gray96\": \"rgb(245, 245, 245)\",\n \"gray97\": \"rgb(247, 247, 247)\",\n \"gray98\": \"rgb(250, 250, 250)\",\n \"gray99\": \"rgb(252, 252, 252)\",\n \"green\": \"rgb(0, 255, 0)\",\n \"green1\": \"rgb(0, 255, 0)\",\n \"green2\": \"rgb(0, 238, 0)\",\n \"green3\": \"rgb(0, 205, 0)\",\n \"green4\": \"rgb(0, 139, 0)\",\n \"greenyellow\": \"rgb(173, 255, 47)\",\n \"grey\": \"rgb(190, 190, 190)\",\n \"grey0\": \"rgb(0, 0, 0)\",\n \"grey1\": \"rgb(3, 3, 3)\",\n \"grey10\": \"rgb(26, 26, 26)\",\n \"grey100\": \"rgb(255, 255, 255)\",\n \"grey11\": \"rgb(28, 28, 28)\",\n \"grey12\": \"rgb(31, 31, 31)\",\n \"grey13\": \"rgb(33, 33, 33)\",\n \"grey14\": \"rgb(36, 36, 36)\",\n \"grey15\": \"rgb(38, 38, 38)\",\n \"grey16\": \"rgb(41, 41, 41)\",\n \"grey17\": \"rgb(43, 43, 43)\",\n \"grey18\": \"rgb(46, 46, 46)\",\n \"grey19\": \"rgb(48, 48, 48)\",\n \"grey2\": \"rgb(5, 5, 5)\",\n \"grey20\": \"rgb(51, 51, 51)\",\n \"grey21\": \"rgb(54, 54, 54)\",\n \"grey22\": \"rgb(56, 56, 56)\",\n \"grey23\": \"rgb(59, 59, 59)\",\n \"grey24\": \"rgb(61, 61, 61)\",\n \"grey25\": \"rgb(64, 64, 64)\",\n \"grey26\": \"rgb(66, 66, 66)\",\n \"grey27\": \"rgb(69, 69, 69)\",\n \"grey28\": \"rgb(71, 71, 71)\",\n \"grey29\": \"rgb(74, 74, 74)\",\n \"grey3\": \"rgb(8, 8, 8)\",\n \"grey30\": \"rgb(77, 77, 77)\",\n \"grey31\": \"rgb(79, 79, 79)\",\n \"grey32\": \"rgb(82, 82, 82)\",\n \"grey33\": \"rgb(84, 84, 84)\",\n \"grey34\": \"rgb(87, 87, 87)\",\n \"grey35\": \"rgb(89, 89, 89)\",\n \"grey36\": \"rgb(92, 92, 92)\",\n \"grey37\": \"rgb(94, 94, 94)\",\n \"grey38\": \"rgb(97, 97, 97)\",\n \"grey39\": \"rgb(99, 99, 99)\",\n \"grey4\": \"rgb(10, 10, 10)\",\n \"grey40\": \"rgb(102, 102, 102)\",\n \"grey41\": \"rgb(105, 105, 105)\",\n \"grey42\": \"rgb(107, 107, 107)\",\n \"grey43\": \"rgb(110, 110, 110)\",\n \"grey44\": \"rgb(112, 112, 112)\",\n \"grey45\": \"rgb(115, 115, 115)\",\n \"grey46\": \"rgb(117, 117, 117)\",\n \"grey47\": \"rgb(120, 120, 120)\",\n \"grey48\": \"rgb(122, 122, 122)\",\n \"grey49\": \"rgb(125, 125, 125)\",\n \"grey5\": \"rgb(13, 13, 13)\",\n \"grey50\": \"rgb(127, 127, 127)\",\n \"grey51\": \"rgb(130, 130, 130)\",\n \"grey52\": \"rgb(133, 133, 133)\",\n \"grey53\": \"rgb(135, 135, 135)\",\n \"grey54\": \"rgb(138, 138, 138)\",\n \"grey55\": \"rgb(140, 140, 140)\",\n \"grey56\": \"rgb(143, 143, 143)\",\n \"grey57\": \"rgb(145, 145, 145)\",\n \"grey58\": \"rgb(148, 148, 148)\",\n \"grey59\": \"rgb(150, 150, 150)\",\n \"grey6\": \"rgb(15, 15, 15)\",\n \"grey60\": \"rgb(153, 153, 153)\",\n \"grey61\": \"rgb(156, 156, 156)\",\n \"grey62\": \"rgb(158, 158, 158)\",\n \"grey63\": \"rgb(161, 161, 161)\",\n \"grey64\": \"rgb(163, 163, 163)\",\n \"grey65\": \"rgb(166, 166, 166)\",\n \"grey66\": \"rgb(168, 168, 168)\",\n \"grey67\": \"rgb(171, 171, 171)\",\n \"grey68\": \"rgb(173, 173, 173)\",\n \"grey69\": \"rgb(176, 176, 176)\",\n \"grey7\": \"rgb(18, 18, 18)\",\n \"grey70\": \"rgb(179, 179, 179)\",\n \"grey71\": \"rgb(181, 181, 181)\",\n \"grey72\": \"rgb(184, 184, 184)\",\n \"grey73\": \"rgb(186, 186, 186)\",\n \"grey74\": \"rgb(189, 189, 189)\",\n \"grey75\": \"rgb(191, 191, 191)\",\n \"grey76\": \"rgb(194, 194, 194)\",\n \"grey77\": \"rgb(196, 196, 196)\",\n \"grey78\": \"rgb(199, 199, 199)\",\n \"grey79\": \"rgb(201, 201, 201)\",\n \"grey8\": \"rgb(20, 20, 20)\",\n \"grey80\": \"rgb(204, 204, 204)\",\n \"grey81\": \"rgb(207, 207, 207)\",\n \"grey82\": \"rgb(209, 209, 209)\",\n \"grey83\": \"rgb(212, 212, 212)\",\n \"grey84\": \"rgb(214, 214, 214)\",\n \"grey85\": \"rgb(217, 217, 217)\",\n \"grey86\": \"rgb(219, 219, 219)\",\n \"grey87\": \"rgb(222, 222, 222)\",\n \"grey88\": \"rgb(224, 224, 224)\",\n \"grey89\": \"rgb(227, 227, 227)\",\n \"grey9\": \"rgb(23, 23, 23)\",\n \"grey90\": \"rgb(229, 229, 229)\",\n \"grey91\": \"rgb(232, 232, 232)\",\n \"grey92\": \"rgb(235, 235, 235)\",\n \"grey93\": \"rgb(237, 237, 237)\",\n \"grey94\": \"rgb(240, 240, 240)\",\n \"grey95\": \"rgb(242, 242, 242)\",\n \"grey96\": \"rgb(245, 245, 245)\",\n \"grey97\": \"rgb(247, 247, 247)\",\n \"grey98\": \"rgb(250, 250, 250)\",\n \"grey99\": \"rgb(252, 252, 252)\",\n \"honeydew\": \"rgb(240, 255, 240)\",\n \"honeydew1\": \"rgb(240, 255, 240)\",\n \"honeydew2\": \"rgb(224, 238, 224)\",\n \"honeydew3\": \"rgb(193, 205, 193)\",\n \"honeydew4\": \"rgb(131, 139, 131)\",\n \"hotpink\": \"rgb(255, 105, 180)\",\n \"hotpink1\": \"rgb(255, 110, 180)\",\n \"hotpink2\": \"rgb(238, 106, 167)\",\n \"hotpink3\": \"rgb(205, 96, 144)\",\n \"hotpink4\": \"rgb(139, 58, 98)\",\n \"indianred\": \"rgb(205, 92, 92)\",\n \"indianred1\": \"rgb(255, 106, 106)\",\n \"indianred2\": \"rgb(238, 99, 99)\",\n \"indianred3\": \"rgb(205, 85, 85)\",\n \"indianred4\": \"rgb(139, 58, 58)\",\n \"ivory\": \"rgb(255, 255, 240)\",\n \"ivory1\": \"rgb(255, 255, 240)\",\n \"ivory2\": \"rgb(238, 238, 224)\",\n \"ivory3\": \"rgb(205, 205, 193)\",\n \"ivory4\": \"rgb(139, 139, 131)\",\n \"khaki\": \"rgb(240, 230, 140)\",\n \"khaki1\": \"rgb(255, 246, 143)\",\n \"khaki2\": \"rgb(238, 230, 133)\",\n \"khaki3\": \"rgb(205, 198, 115)\",\n \"khaki4\": \"rgb(139, 134, 78)\",\n \"lavender\": \"rgb(230, 230, 250)\",\n \"lavenderblush\": \"rgb(255, 240, 245)\",\n \"lavenderblush1\": \"rgb(255, 240, 245)\",\n \"lavenderblush2\": \"rgb(238, 224, 229)\",\n \"lavenderblush3\": \"rgb(205, 193, 197)\",\n \"lavenderblush4\": \"rgb(139, 131, 134)\",\n \"lawngreen\": \"rgb(124, 252, 0)\",\n \"lemonchiffon\": \"rgb(255, 250, 205)\",\n \"lemonchiffon1\": \"rgb(255, 250, 205)\",\n \"lemonchiffon2\": \"rgb(238, 233, 191)\",\n \"lemonchiffon3\": \"rgb(205, 201, 165)\",\n \"lemonchiffon4\": \"rgb(139, 137, 112)\",\n \"lightblue\": \"rgb(173, 216, 230)\",\n \"lightblue1\": \"rgb(191, 239, 255)\",\n \"lightblue2\": \"rgb(178, 223, 238)\",\n \"lightblue3\": \"rgb(154, 192, 205)\",\n \"lightblue4\": \"rgb(104, 131, 139)\",\n \"lightcoral\": \"rgb(240, 128, 128)\",\n \"lightcyan\": \"rgb(224, 255, 255)\",\n \"lightcyan1\": \"rgb(224, 255, 255)\",\n \"lightcyan2\": \"rgb(209, 238, 238)\",\n \"lightcyan3\": \"rgb(180, 205, 205)\",\n \"lightcyan4\": \"rgb(122, 139, 139)\",\n \"lightgoldenrod\": \"rgb(238, 221, 130)\",\n \"lightgoldenrod1\": \"rgb(255, 236, 139)\",\n \"lightgoldenrod2\": \"rgb(238, 220, 130)\",\n \"lightgoldenrod3\": \"rgb(205, 190, 112)\",\n \"lightgoldenrod4\": \"rgb(139, 129, 76)\",\n \"lightgoldenrodyellow\": \"rgb(250, 250, 210)\",\n \"lightgray\": \"rgb(211, 211, 211)\",\n \"lightgreen\": \"rgb(144, 238, 144)\",\n \"lightgrey\": \"rgb(211, 211, 211)\",\n \"lightpink\": \"rgb(255, 182, 193)\",\n \"lightpink1\": \"rgb(255, 174, 185)\",\n \"lightpink2\": \"rgb(238, 162, 173)\",\n \"lightpink3\": \"rgb(205, 140, 149)\",\n \"lightpink4\": \"rgb(139, 95, 101)\",\n \"lightsalmon\": \"rgb(255, 160, 122)\",\n \"lightsalmon1\": \"rgb(255, 160, 122)\",\n \"lightsalmon2\": \"rgb(238, 149, 114)\",\n \"lightsalmon3\": \"rgb(205, 129, 98)\",\n \"lightsalmon4\": \"rgb(139, 87, 66)\",\n \"lightseagreen\": \"rgb(32, 178, 170)\",\n \"lightskyblue\": \"rgb(135, 206, 250)\",\n \"lightskyblue1\": \"rgb(176, 226, 255)\",\n \"lightskyblue2\": \"rgb(164, 211, 238)\",\n \"lightskyblue3\": \"rgb(141, 182, 205)\",\n \"lightskyblue4\": \"rgb(96, 123, 139)\",\n \"lightslateblue\": \"rgb(132, 112, 255)\",\n \"lightslategray\": \"rgb(119, 136, 153)\",\n \"lightslategrey\": \"rgb(119, 136, 153)\",\n \"lightsteelblue\": \"rgb(176, 196, 222)\",\n \"lightsteelblue1\": \"rgb(202, 225, 255)\",\n \"lightsteelblue2\": \"rgb(188, 210, 238)\",\n \"lightsteelblue3\": \"rgb(162, 181, 205)\",\n \"lightsteelblue4\": \"rgb(110, 123, 139)\",\n \"lightyellow\": \"rgb(255, 255, 224)\",\n \"lightyellow1\": \"rgb(255, 255, 224)\",\n \"lightyellow2\": \"rgb(238, 238, 209)\",\n \"lightyellow3\": \"rgb(205, 205, 180)\",\n \"lightyellow4\": \"rgb(139, 139, 122)\",\n \"limegreen\": \"rgb(50, 205, 50)\",\n \"linen\": \"rgb(250, 240, 230)\",\n \"magenta\": \"rgb(255, 0, 255)\",\n \"magenta1\": \"rgb(255, 0, 255)\",\n \"magenta2\": \"rgb(238, 0, 238)\",\n \"magenta3\": \"rgb(205, 0, 205)\",\n \"magenta4\": \"rgb(139, 0, 139)\",\n \"maroon\": \"rgb(176, 48, 96)\",\n \"maroon1\": \"rgb(255, 52, 179)\",\n \"maroon2\": \"rgb(238, 48, 167)\",\n \"maroon3\": \"rgb(205, 41, 144)\",\n \"maroon4\": \"rgb(139, 28, 98)\",\n \"mediumaquamarine\": \"rgb(102, 205, 170)\",\n \"mediumblue\": \"rgb(0, 0, 205)\",\n \"mediumorchid\": \"rgb(186, 85, 211)\",\n \"mediumorchid1\": \"rgb(224, 102, 255)\",\n \"mediumorchid2\": \"rgb(209, 95, 238)\",\n \"mediumorchid3\": \"rgb(180, 82, 205)\",\n \"mediumorchid4\": \"rgb(122, 55, 139)\",\n \"mediumpurple\": \"rgb(147, 112, 219)\",\n \"mediumpurple1\": \"rgb(171, 130, 255)\",\n \"mediumpurple2\": \"rgb(159, 121, 238)\",\n \"mediumpurple3\": \"rgb(137, 104, 205)\",\n \"mediumpurple4\": \"rgb(93, 71, 139)\",\n \"mediumseagreen\": \"rgb(60, 179, 113)\",\n \"mediumslateblue\": \"rgb(123, 104, 238)\",\n \"mediumspringgreen\": \"rgb(0, 250, 154)\",\n \"mediumturquoise\": \"rgb(72, 209, 204)\",\n \"mediumvioletred\": \"rgb(199, 21, 133)\",\n \"midnightblue\": \"rgb(25, 25, 112)\",\n \"mintcream\": \"rgb(245, 255, 250)\",\n \"mistyrose\": \"rgb(255, 228, 225)\",\n \"mistyrose1\": \"rgb(255, 228, 225)\",\n \"mistyrose2\": \"rgb(238, 213, 210)\",\n \"mistyrose3\": \"rgb(205, 183, 181)\",\n \"mistyrose4\": \"rgb(139, 125, 123)\",\n \"moccasin\": \"rgb(255, 228, 181)\",\n \"navajowhite\": \"rgb(255, 222, 173)\",\n \"navajowhite1\": \"rgb(255, 222, 173)\",\n \"navajowhite2\": \"rgb(238, 207, 161)\",\n \"navajowhite3\": \"rgb(205, 179, 139)\",\n \"navajowhite4\": \"rgb(139, 121, 94)\",\n \"navy\": \"rgb(0, 0, 128)\",\n \"navyblue\": \"rgb(0, 0, 128)\",\n \"oldlace\": \"rgb(253, 245, 230)\",\n \"olivedrab\": \"rgb(107, 142, 35)\",\n \"olivedrab1\": \"rgb(192, 255, 62)\",\n \"olivedrab2\": \"rgb(179, 238, 58)\",\n \"olivedrab3\": \"rgb(154, 205, 50)\",\n \"olivedrab4\": \"rgb(105, 139, 34)\",\n \"orange\": \"rgb(255, 165, 0)\",\n \"orange1\": \"rgb(255, 165, 0)\",\n \"orange2\": \"rgb(238, 154, 0)\",\n \"orange3\": \"rgb(205, 133, 0)\",\n \"orange4\": \"rgb(139, 90, 0)\",\n \"orangered\": \"rgb(255, 69, 0)\",\n \"orangered1\": \"rgb(255, 69, 0)\",\n \"orangered2\": \"rgb(238, 64, 0)\",\n \"orangered3\": \"rgb(205, 55, 0)\",\n \"orangered4\": \"rgb(139, 37, 0)\",\n \"orchid\": \"rgb(218, 112, 214)\",\n \"orchid1\": \"rgb(255, 131, 250)\",\n \"orchid2\": \"rgb(238, 122, 233)\",\n \"orchid3\": \"rgb(205, 105, 201)\",\n \"orchid4\": \"rgb(139, 71, 137)\",\n \"palegoldenrod\": \"rgb(238, 232, 170)\",\n \"palegreen\": \"rgb(152, 251, 152)\",\n \"palegreen1\": \"rgb(154, 255, 154)\",\n \"palegreen2\": \"rgb(144, 238, 144)\",\n \"palegreen3\": \"rgb(124, 205, 124)\",\n \"palegreen4\": \"rgb(84, 139, 84)\",\n \"paleturquoise\": \"rgb(175, 238, 238)\",\n \"paleturquoise1\": \"rgb(187, 255, 255)\",\n \"paleturquoise2\": \"rgb(174, 238, 238)\",\n \"paleturquoise3\": \"rgb(150, 205, 205)\",\n \"paleturquoise4\": \"rgb(102, 139, 139)\",\n \"palevioletred\": \"rgb(219, 112, 147)\",\n \"palevioletred1\": \"rgb(255, 130, 171)\",\n \"palevioletred2\": \"rgb(238, 121, 159)\",\n \"palevioletred3\": \"rgb(205, 104, 137)\",\n \"palevioletred4\": \"rgb(139, 71, 93)\",\n \"papayawhip\": \"rgb(255, 239, 213)\",\n \"peachpuff\": \"rgb(255, 218, 185)\",\n \"peachpuff1\": \"rgb(255, 218, 185)\",\n \"peachpuff2\": \"rgb(238, 203, 173)\",\n \"peachpuff3\": \"rgb(205, 175, 149)\",\n \"peachpuff4\": \"rgb(139, 119, 101)\",\n \"peru\": \"rgb(205, 133, 63)\",\n \"pink\": \"rgb(255, 192, 203)\",\n \"pink1\": \"rgb(255, 181, 197)\",\n \"pink2\": \"rgb(238, 169, 184)\",\n \"pink3\": \"rgb(205, 145, 158)\",\n \"pink4\": \"rgb(139, 99, 108)\",\n \"plum\": \"rgb(221, 160, 221)\",\n \"plum1\": \"rgb(255, 187, 255)\",\n \"plum2\": \"rgb(238, 174, 238)\",\n \"plum3\": \"rgb(205, 150, 205)\",\n \"plum4\": \"rgb(139, 102, 139)\",\n \"powderblue\": \"rgb(176, 224, 230)\",\n \"purple\": \"rgb(160, 32, 240)\",\n \"purple1\": \"rgb(155, 48, 255)\",\n \"purple2\": \"rgb(145, 44, 238)\",\n \"purple3\": \"rgb(125, 38, 205)\",\n \"purple4\": \"rgb(85, 26, 139)\",\n \"red\": \"rgb(255, 0, 0)\",\n \"red1\": \"rgb(255, 0, 0)\",\n \"red2\": \"rgb(238, 0, 0)\",\n \"red3\": \"rgb(205, 0, 0)\",\n \"red4\": \"rgb(139, 0, 0)\",\n \"rosybrown\": \"rgb(188, 143, 143)\",\n \"rosybrown1\": \"rgb(255, 193, 193)\",\n \"rosybrown2\": \"rgb(238, 180, 180)\",\n \"rosybrown3\": \"rgb(205, 155, 155)\",\n \"rosybrown4\": \"rgb(139, 105, 105)\",\n \"royalblue\": \"rgb(65, 105, 225)\",\n \"royalblue1\": \"rgb(72, 118, 255)\",\n \"royalblue2\": \"rgb(67, 110, 238)\",\n \"royalblue3\": \"rgb(58, 95, 205)\",\n \"royalblue4\": \"rgb(39, 64, 139)\",\n \"saddlebrown\": \"rgb(139, 69, 19)\",\n \"salmon\": \"rgb(250, 128, 114)\",\n \"salmon1\": \"rgb(255, 140, 105)\",\n \"salmon2\": \"rgb(238, 130, 98)\",\n \"salmon3\": \"rgb(205, 112, 84)\",\n \"salmon4\": \"rgb(139, 76, 57)\",\n \"sandybrown\": \"rgb(244, 164, 96)\",\n \"seagreen\": \"rgb(46, 139, 87)\",\n \"seagreen1\": \"rgb(84, 255, 159)\",\n \"seagreen2\": \"rgb(78, 238, 148)\",\n \"seagreen3\": \"rgb(67, 205, 128)\",\n \"seagreen4\": \"rgb(46, 139, 87)\",\n \"seashell\": \"rgb(255, 245, 238)\",\n \"seashell1\": \"rgb(255, 245, 238)\",\n \"seashell2\": \"rgb(238, 229, 222)\",\n \"seashell3\": \"rgb(205, 197, 191)\",\n \"seashell4\": \"rgb(139, 134, 130)\",\n \"sienna\": \"rgb(160, 82, 45)\",\n \"sienna1\": \"rgb(255, 130, 71)\",\n \"sienna2\": \"rgb(238, 121, 66)\",\n \"sienna3\": \"rgb(205, 104, 57)\",\n \"sienna4\": \"rgb(139, 71, 38)\",\n \"skyblue\": \"rgb(135, 206, 235)\",\n \"skyblue1\": \"rgb(135, 206, 255)\",\n \"skyblue2\": \"rgb(126, 192, 238)\",\n \"skyblue3\": \"rgb(108, 166, 205)\",\n \"skyblue4\": \"rgb(74, 112, 139)\",\n \"slateblue\": \"rgb(106, 90, 205)\",\n \"slateblue1\": \"rgb(131, 111, 255)\",\n \"slateblue2\": \"rgb(122, 103, 238)\",\n \"slateblue3\": \"rgb(105, 89, 205)\",\n \"slateblue4\": \"rgb(71, 60, 139)\",\n \"slategray\": \"rgb(112, 128, 144)\",\n \"slategray1\": \"rgb(198, 226, 255)\",\n \"slategray2\": \"rgb(185, 211, 238)\",\n \"slategray3\": \"rgb(159, 182, 205)\",\n \"slategray4\": \"rgb(108, 123, 139)\",\n \"slategrey\": \"rgb(112, 128, 144)\",\n \"snow\": \"rgb(255, 250, 250)\",\n \"snow1\": \"rgb(255, 250, 250)\",\n \"snow2\": \"rgb(238, 233, 233)\",\n \"snow3\": \"rgb(205, 201, 201)\",\n \"snow4\": \"rgb(139, 137, 137)\",\n \"springgreen\": \"rgb(0, 255, 127)\",\n \"springgreen1\": \"rgb(0, 255, 127)\",\n \"springgreen2\": \"rgb(0, 238, 118)\",\n \"springgreen3\": \"rgb(0, 205, 102)\",\n \"springgreen4\": \"rgb(0, 139, 69)\",\n \"steelblue\": \"rgb(70, 130, 180)\",\n \"steelblue1\": \"rgb(99, 184, 255)\",\n \"steelblue2\": \"rgb(92, 172, 238)\",\n \"steelblue3\": \"rgb(79, 148, 205)\",\n \"steelblue4\": \"rgb(54, 100, 139)\",\n \"tan\": \"rgb(210, 180, 140)\",\n \"tan1\": \"rgb(255, 165, 79)\",\n \"tan2\": \"rgb(238, 154, 73)\",\n \"tan3\": \"rgb(205, 133, 63)\",\n \"tan4\": \"rgb(139, 90, 43)\",\n \"thistle\": \"rgb(216, 191, 216)\",\n \"thistle1\": \"rgb(255, 225, 255)\",\n \"thistle2\": \"rgb(238, 210, 238)\",\n \"thistle3\": \"rgb(205, 181, 205)\",\n \"thistle4\": \"rgb(139, 123, 139)\",\n \"tomato\": \"rgb(255, 99, 71)\",\n \"tomato1\": \"rgb(255, 99, 71)\",\n \"tomato2\": \"rgb(238, 92, 66)\",\n \"tomato3\": \"rgb(205, 79, 57)\",\n \"tomato4\": \"rgb(139, 54, 38)\",\n \"turquoise\": \"rgb(64, 224, 208)\",\n \"turquoise1\": \"rgb(0, 245, 255)\",\n \"turquoise2\": \"rgb(0, 229, 238)\",\n \"turquoise3\": \"rgb(0, 197, 205)\",\n \"turquoise4\": \"rgb(0, 134, 139)\",\n \"violet\": \"rgb(238, 130, 238)\",\n \"violetred\": \"rgb(208, 32, 144)\",\n \"violetred1\": \"rgb(255, 62, 150)\",\n \"violetred2\": \"rgb(238, 58, 140)\",\n \"violetred3\": \"rgb(205, 50, 120)\",\n \"violetred4\": \"rgb(139, 34, 82)\",\n \"wheat\": \"rgb(245, 222, 179)\",\n \"wheat1\": \"rgb(255, 231, 186)\",\n \"wheat2\": \"rgb(238, 216, 174)\",\n \"wheat3\": \"rgb(205, 186, 150)\",\n \"wheat4\": \"rgb(139, 126, 102)\",\n \"white\": \"rgb(255, 255, 255)\",\n \"whitesmoke\": \"rgb(245, 245, 245)\",\n \"yellow\": \"rgb(255, 255, 0)\",\n \"yellow1\": \"rgb(255, 255, 0)\",\n \"yellow2\": \"rgb(238, 238, 0)\",\n \"yellow3\": \"rgb(205, 205, 0)\",\n \"yellow4\": \"rgb(139, 139, 0)\",\n \"yellowgreen\": \"rgb(154, 205, 50)\"\n};\n// SOURCE FILE: libdot/js/lib_f.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Grab bag of utility functions.\n */\nlib.f = {};\n\n/**\n * Create a unique enum value.\n *\n * @suppress {lintChecks}\n * @param {string} name A human friendly name for debugging.\n * @return {Object} A unique enum that won't compare equal to anything else.\n */\nlib.f.createEnum = function(name) {\n // We use a String object as nothing else should be using them -- we want to\n // use string primitives normally. But debuggers will include our name.\n return new String(name);\n};\n\n/**\n * Replace variable references in a string.\n *\n * Variables are of the form %FUNCTION(VARNAME). FUNCTION is an optional\n * escape function to apply to the value.\n *\n * For example\n * lib.f.replaceVars(\"%(greeting), %encodeURIComponent(name)\",\n * { greeting: \"Hello\",\n * name: \"Google+\" });\n *\n * Will result in \"Hello, Google%2B\".\n */\nlib.f.replaceVars = function(str, vars) {\n return str.replace(/%([a-z]*)\\(([^\\)]+)\\)/gi, function(match, fn, varname) {\n if (typeof vars[varname] == 'undefined')\n throw 'Unknown variable: ' + varname;\n\n var rv = vars[varname];\n\n if (fn in lib.f.replaceVars.functions) {\n rv = lib.f.replaceVars.functions[fn](rv);\n } else if (fn) {\n throw 'Unknown escape function: ' + fn;\n }\n\n return rv;\n });\n};\n\n/**\n * Functions that can be used with replaceVars.\n *\n * Clients can add to this list to extend lib.f.replaceVars().\n */\nlib.f.replaceVars.functions = {\n encodeURI: encodeURI,\n encodeURIComponent: encodeURIComponent,\n escapeHTML: function(str) {\n var map = {\n '<': '<',\n '>': '>',\n '&': '&',\n '\"': '"',\n \"'\": '''\n };\n\n return str.replace(/[<>&\\\"\\']/g, function(m) { return map[m] });\n }\n};\n\n/**\n * Get the list of accepted UI languages.\n *\n * @param {function(Array)} callback Function to invoke with the results. The\n * parameter is a list of locale names.\n */\nlib.f.getAcceptLanguages = function(callback) {\n if (lib.f.getAcceptLanguages.chromeSupported()) {\n chrome.i18n.getAcceptLanguages(callback);\n } else {\n setTimeout(function() {\n callback([navigator.language.replace(/-/g, '_')]);\n }, 0);\n }\n};\n\nlib.f.getAcceptLanguages.chromeSupported = function() {\n return window.chrome && chrome.i18n;\n};\n\n/**\n * Parse a query string into a hash.\n *\n * This takes a url query string in the form 'name1=value&name2=value' and\n * converts it into an object of the form { name1: 'value', name2: 'value' }.\n * If a given name appears multiple times in the query string, only the\n * last value will appear in the result.\n *\n * Names and values are passed through decodeURIComponent before being added\n * to the result object.\n *\n * @param {string} queryString The string to parse. If it starts with a\n * leading '?', the '?' will be ignored.\n */\nlib.f.parseQuery = function(queryString) {\n if (queryString.startsWith('?'))\n queryString = queryString.substr(1);\n\n var rv = {};\n\n var pairs = queryString.split('&');\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split('=');\n rv[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\n }\n\n return rv;\n};\n\nlib.f.getURL = function(path) {\n if (lib.f.getURL.chromeSupported())\n return chrome.runtime.getURL(path);\n\n return path;\n};\n\nlib.f.getURL.chromeSupported = function() {\n return window.chrome && chrome.runtime && chrome.runtime.getURL;\n};\n\n/**\n * Clamp a given integer to a specified range.\n *\n * @param {integer} v The value to be clamped.\n * @param {integer} min The minimum acceptable value.\n * @param {integer} max The maximum acceptable value.\n */\nlib.f.clamp = function(v, min, max) {\n if (v < min)\n return min;\n if (v > max)\n return max;\n return v;\n};\n\n/**\n * Left pad a number to a given length with leading zeros.\n *\n * @param {string|integer} number The number to pad.\n * @param {integer} length The desired length.\n * @return {string} The padded number as a string.\n */\nlib.f.zpad = function(number, length) {\n return String(number).padStart(length, '0');\n};\n\n/**\n * Return a string containing a given number of space characters.\n *\n * This method maintains a static cache of the largest amount of whitespace\n * ever requested. It shouldn't be used to generate an insanely huge amount of\n * whitespace.\n *\n * @param {integer} length The desired amount of whitespace.\n * @param {string} A string of spaces of the requested length.\n */\nlib.f.getWhitespace = function(length) {\n if (length <= 0)\n return '';\n\n var f = this.getWhitespace;\n if (!f.whitespace)\n f.whitespace = ' ';\n\n while (length > f.whitespace.length) {\n f.whitespace += f.whitespace;\n }\n\n return f.whitespace.substr(0, length);\n};\n\n /**\n * Ensure that a function is called within a certain time limit.\n *\n * Simple usage looks like this...\n *\n * lib.registerInit(lib.f.alarm(onInit));\n *\n * This will log a warning to the console if onInit() is not invoked within\n * 5 seconds.\n *\n * If you're performing some operation that may take longer than 5 seconds you\n * can pass a duration in milliseconds as the optional second parameter.\n *\n * If you pass a string identifier instead of a callback function, you'll get a\n * wrapper generator rather than a single wrapper. Each call to the\n * generator will return a wrapped version of the callback wired to\n * a shared timeout. This is for cases where you want to ensure that at least\n * one of a set of callbacks is invoked before a timeout expires.\n *\n * var alarm = lib.f.alarm('fetch object');\n * lib.foo.fetchObject(alarm(onSuccess), alarm(onFailure));\n *\n * @param {function(*)} callback The function to wrap in an alarm.\n * @param {int} opt_ms Optional number of milliseconds to wait before raising\n * an alarm. Default is 5000 (5 seconds).\n * @return {function} If callback is a function then the return value will be\n * the wrapped callback. If callback is a string then the return value will\n * be a function that generates new wrapped callbacks.\n */\nlib.f.alarm = function(callback, opt_ms) {\n var ms = opt_ms || 5 * 1000;\n var stack = lib.f.getStack(1);\n\n return (function() {\n // This outer function is called immediately. It's here to capture a new\n // scope for the timeout variable.\n\n // The 'timeout' variable is shared by this timeout function, and the\n // callback wrapper.\n var timeout = setTimeout(function() {\n var name = (typeof callback == 'string') ? name : callback.name;\n name = name ? (': ' + name) : '';\n console.warn('lib.f.alarm: timeout expired: ' + (ms / 1000) + 's' + name);\n console.log(stack);\n timeout = null;\n }, ms);\n\n var wrapperGenerator = function(callback) {\n return function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n\n return callback.apply(null, arguments);\n }\n };\n\n if (typeof callback == 'string')\n return wrapperGenerator;\n\n return wrapperGenerator(callback);\n })();\n};\n\n/**\n * Return the current call stack after skipping a given number of frames.\n *\n * This method is intended to be used for debugging only. It returns an\n * Object instead of an Array, because the console stringifies arrays by\n * default and that's not what we want.\n *\n * A typical call might look like...\n *\n * console.log('Something wicked this way came', lib.f.getStack());\n * // Notice the comma ^\n *\n * This would print the message to the js console, followed by an object\n * which can be clicked to reveal the stack.\n *\n * @param {number} opt_ignoreFrames The optional number of stack frames to\n * ignore. The actual 'getStack' call is always ignored.\n */\nlib.f.getStack = function(opt_ignoreFrames) {\n var ignoreFrames = opt_ignoreFrames ? opt_ignoreFrames + 2 : 2;\n\n var stackArray;\n\n try {\n throw new Error();\n } catch (ex) {\n stackArray = ex.stack.split('\\n');\n }\n\n var stackObject = {};\n for (var i = ignoreFrames; i < stackArray.length; i++) {\n stackObject[i - ignoreFrames] = stackArray[i].replace(/^\\s*at\\s+/, '');\n }\n\n return stackObject;\n};\n\n/**\n * Divides the two numbers and floors the results, unless the remainder is less\n * than an incredibly small value, in which case it returns the ceiling.\n * This is useful when the number are truncated approximations of longer\n * values, and so doing division with these numbers yields a result incredibly\n * close to a whole number.\n *\n * @param {number} numerator\n * @param {number} denominator\n * @return {number}\n */\nlib.f.smartFloorDivide = function(numerator, denominator) {\n var val = numerator / denominator;\n var ceiling = Math.ceil(val);\n if (ceiling - val < .0001) {\n return ceiling;\n } else {\n return Math.floor(val);\n }\n};\n\n/**\n * Get a random integer in a range (inclusive).\n *\n * @param {number} min The lowest integer in the range.\n * @param {number} max The highest integer in the range.\n * @return {number} A random number between min & max.\n */\nlib.f.randomInt = function(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n};\n// SOURCE FILE: libdot/js/lib_message_manager.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * MessageManager class handles internationalized strings.\n *\n * Note: chrome.i18n isn't sufficient because...\n * 1. There's a bug in chrome that makes it unavailable in iframes:\n * https://crbug.com/130200\n * 2. The client code may not be packaged in a Chrome extension.\n * 3. The client code may be part of a library packaged in a third-party\n * Chrome extension.\n *\n * @param {Array} languages List of languages to load, in the order they\n * should be loaded. Newer messages replace older ones. 'en' is\n * automatically added as the first language if it is not already present.\n */\nlib.MessageManager = function(languages) {\n this.languages_ = languages.map(\n function(el) { return el.replace(/-/g, '_') });\n\n if (this.languages_.indexOf('en') == -1)\n this.languages_.unshift('en');\n\n this.messages = {};\n};\n\n/**\n * Add message definitions to the message manager.\n *\n * This takes an object of the same format of a Chrome messages.json file. See\n * .\n */\nlib.MessageManager.prototype.addMessages = function(defs) {\n for (var key in defs) {\n var def = defs[key];\n\n if (!def.placeholders) {\n this.messages[key] = def.message;\n } else {\n // Replace \"$NAME$\" placeholders with \"$1\", etc.\n this.messages[key] = def.message.replace(\n /\\$([a-z][^\\s\\$]+)\\$/ig,\n function(m, name) {\n return defs[key].placeholders[name.toLowerCase()].content;\n });\n }\n }\n};\n\n/**\n * Load the first available language message bundle.\n *\n * @param {string} pattern A url pattern containing a \"$1\" where the locale\n * name should go.\n * @param {function(Array,Array)} onComplete Function to be called when loading\n * is complete. The two arrays are the list of successful and failed\n * locale names. If the first parameter is length 0, no locales were\n * loaded.\n */\nlib.MessageManager.prototype.findAndLoadMessages = function(\n pattern, onComplete) {\n var languages = this.languages_.concat();\n var loaded = [];\n var failed = [];\n\n function onLanguageComplete(state) {\n if (state) {\n loaded = languages.shift();\n } else {\n failed = languages.shift();\n }\n\n if (languages.length) {\n tryNextLanguage();\n } else {\n onComplete(loaded, failed);\n }\n }\n\n var tryNextLanguage = function() {\n this.loadMessages(this.replaceReferences(pattern, languages),\n onLanguageComplete.bind(this, true),\n onLanguageComplete.bind(this, false));\n }.bind(this);\n\n tryNextLanguage();\n};\n\n/**\n * Load messages from a messages.json file.\n */\nlib.MessageManager.prototype.loadMessages = function(\n url, onSuccess, opt_onError) {\n var xhr = new XMLHttpRequest();\n\n xhr.onloadend = function() {\n if (xhr.status != 200) {\n if (opt_onError)\n opt_onError(xhr.status);\n\n return;\n }\n\n this.addMessages(JSON.parse(xhr.responseText));\n onSuccess();\n }.bind(this);\n\n xhr.open('GET', url);\n xhr.send();\n};\n\n/**\n * Replace $1...$n references with the elements of the args array.\n *\n * @param {string} msg String containing the message and argument references.\n * @param {Array} args Array containing the argument values.\n */\nlib.MessageManager.replaceReferences = function(msg, args) {\n return msg.replace(/\\$(\\d+)/g, function (m, index) {\n return args[index - 1];\n });\n};\n\n/**\n * Per-instance copy of replaceReferences.\n */\nlib.MessageManager.prototype.replaceReferences =\n lib.MessageManager.replaceReferences;\n\n/**\n * Get a message by name, optionally replacing arguments too.\n *\n * @param {string} msgname String containing the name of the message to get.\n * @param {Array} opt_args Optional array containing the argument values.\n * @param {string} opt_default Optional value to return if the msgname is not\n * found. Returns the message name by default.\n */\nlib.MessageManager.prototype.get = function(msgname, opt_args, opt_default) {\n var message;\n\n if (msgname in this.messages) {\n message = this.messages[msgname];\n\n } else {\n if (window.chrome.i18n)\n message = chrome.i18n.getMessage(msgname);\n\n if (!message) {\n console.warn('Unknown message: ' + msgname);\n return (typeof opt_default == 'undefined') ? msgname : opt_default;\n }\n }\n\n if (!opt_args)\n return message;\n\n if (!(opt_args instanceof Array))\n opt_args = [opt_args];\n\n return this.replaceReferences(message, opt_args);\n};\n\n/**\n * Process all of the \"i18n\" html attributes found in a given dom fragment.\n *\n * The real work happens in processI18nAttribute.\n */\nlib.MessageManager.prototype.processI18nAttributes = function(dom) {\n var nodes = dom.querySelectorAll('[i18n]');\n\n for (var i = 0; i < nodes.length; i++)\n this.processI18nAttribute(nodes[i]);\n};\n\n/**\n * Process the \"i18n\" attribute in the specified node.\n *\n * The i18n attribute should contain a JSON object. The keys are taken to\n * be attribute names, and the values are message names.\n *\n * If the JSON object has a \"_\" (underscore) key, its value is used as the\n * textContent of the element.\n *\n * Message names can refer to other attributes on the same element with by\n * prefixing with a dollar sign. For example...\n *\n * \n *\n * The aria-label message name will be computed as \"SEND_BUTTON_ARIA_LABEL\".\n * Notice that the \"id\" attribute was appended to the target attribute, and\n * the result converted to UPPER_AND_UNDER style.\n */\nlib.MessageManager.prototype.processI18nAttribute = function(node) {\n // Convert the \"lower-and-dashes\" attribute names into\n // \"UPPER_AND_UNDER\" style.\n function thunk(str) { return str.replace(/-/g, '_').toUpperCase() }\n\n var i18n = node.getAttribute('i18n');\n if (!i18n)\n return;\n\n try {\n i18n = JSON.parse(i18n);\n } catch (ex) {\n console.error('Can\\'t parse ' + node.tagName + '#' + node.id + ': ' + i18n);\n throw ex;\n }\n\n // Load all the messages specified in the i18n attributes.\n for (var key in i18n) {\n // The node attribute we'll be setting.\n var attr = key;\n\n var msgname = i18n[key];\n // For \"=foo\", re-use the referenced message name.\n if (msgname.startsWith('=')) {\n key = msgname.substr(1);\n msgname = i18n[key];\n }\n\n // For \"$foo\", calculate the message name.\n if (msgname.startsWith('$'))\n msgname = thunk(node.getAttribute(msgname.substr(1)) + '_' + key);\n\n // Finally load the message.\n var msg = this.get(msgname);\n if (attr == '_')\n node.textContent = msg;\n else\n node.setAttribute(attr, msg);\n }\n};\n// SOURCE FILE: libdot/js/lib_preference_manager.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Constructor for lib.PreferenceManager objects.\n *\n * These objects deal with persisting changes to stable storage and notifying\n * consumers when preferences change.\n *\n * It is intended that the backing store could be something other than HTML5\n * storage, but there aren't any use cases at the moment. In the future there\n * may be a chrome api to store sync-able name/value pairs, and we'd want\n * that.\n *\n * @param {lib.Storage.*} storage The storage object to use as a backing\n * store.\n * @param {string} opt_prefix The optional prefix to be used for all preference\n * names. The '/' character should be used to separate levels of hierarchy,\n * if you're going to have that kind of thing. If provided, the prefix\n * should start with a '/'. If not provided, it defaults to '/'.\n */\nlib.PreferenceManager = function(storage, opt_prefix) {\n this.storage = storage;\n this.storageObserver_ = this.onStorageChange_.bind(this);\n\n this.isActive_ = false;\n this.activate();\n\n this.trace = false;\n\n var prefix = opt_prefix || '/';\n if (!prefix.endsWith('/'))\n prefix += '/';\n\n this.prefix = prefix;\n\n this.prefRecords_ = {};\n this.globalObservers_ = [];\n\n this.childFactories_ = {};\n\n // Map of list-name to {map of child pref managers}\n // As in...\n //\n // this.childLists_ = {\n // 'profile-ids': {\n // 'one': PreferenceManager,\n // 'two': PreferenceManager,\n // ...\n // },\n //\n // 'frob-ids': {\n // ...\n // }\n // }\n this.childLists_ = {};\n};\n\n/**\n * Used internally to indicate that the current value of the preference should\n * be taken from the default value defined with the preference.\n *\n * Equality tests against this value MUST use '===' or '!==' to be accurate.\n */\nlib.PreferenceManager.prototype.DEFAULT_VALUE = lib.f.createEnum('DEFAULT');\n\n/**\n * An individual preference.\n *\n * These objects are managed by the PreferenceManager, you shouldn't need to\n * handle them directly.\n */\nlib.PreferenceManager.Record = function(name, defaultValue) {\n this.name = name;\n this.defaultValue = defaultValue;\n this.currentValue = this.DEFAULT_VALUE;\n this.observers = [];\n};\n\n/**\n * A local copy of the DEFAULT_VALUE constant to make it less verbose.\n */\nlib.PreferenceManager.Record.prototype.DEFAULT_VALUE =\n lib.PreferenceManager.prototype.DEFAULT_VALUE;\n\n/**\n * Register a callback to be invoked when this preference changes.\n *\n * @param {function(value, string, lib.PreferenceManager} observer The function\n * to invoke. It will receive the new value, the name of the preference,\n * and a reference to the PreferenceManager as parameters.\n */\nlib.PreferenceManager.Record.prototype.addObserver = function(observer) {\n this.observers.push(observer);\n};\n\n/**\n * Unregister an observer callback.\n *\n * @param {function} observer A previously registered callback.\n */\nlib.PreferenceManager.Record.prototype.removeObserver = function(observer) {\n var i = this.observers.indexOf(observer);\n if (i >= 0)\n this.observers.splice(i, 1);\n};\n\n/**\n * Fetch the value of this preference.\n */\nlib.PreferenceManager.Record.prototype.get = function() {\n if (this.currentValue === this.DEFAULT_VALUE) {\n if (/^(string|number)$/.test(typeof this.defaultValue))\n return this.defaultValue;\n\n if (typeof this.defaultValue == 'object') {\n // We want to return a COPY of the default value so that users can\n // modify the array or object without changing the default value.\n return JSON.parse(JSON.stringify(this.defaultValue));\n }\n\n return this.defaultValue;\n }\n\n return this.currentValue;\n};\n\n/**\n * Stop this preference manager from tracking storage changes.\n *\n * Call this if you're going to swap out one preference manager for another so\n * that you don't get notified about irrelevant changes.\n */\nlib.PreferenceManager.prototype.deactivate = function() {\n if (!this.isActive_)\n throw new Error('Not activated');\n\n this.isActive_ = false;\n this.storage.removeObserver(this.storageObserver_);\n};\n\n/**\n * Start tracking storage changes.\n *\n * If you previously deactivated this preference manager, you can reactivate it\n * with this method. You don't need to call this at initialization time, as\n * it's automatically called as part of the constructor.\n */\nlib.PreferenceManager.prototype.activate = function() {\n if (this.isActive_)\n throw new Error('Already activated');\n\n this.isActive_ = true;\n this.storage.addObserver(this.storageObserver_);\n};\n\n/**\n * Read the backing storage for these preferences.\n *\n * You should do this once at initialization time to prime the local cache\n * of preference values. The preference manager will monitor the backing\n * storage for changes, so you should not need to call this more than once.\n *\n * This function recursively reads storage for all child preference managers as\n * well.\n *\n * This function is asynchronous, if you need to read preference values, you\n * *must* wait for the callback.\n *\n * @param {function()} opt_callback Optional function to invoke when the read\n * has completed.\n */\nlib.PreferenceManager.prototype.readStorage = function(opt_callback) {\n var pendingChildren = 0;\n\n function onChildComplete() {\n if (--pendingChildren == 0 && opt_callback)\n opt_callback();\n }\n\n var keys = Object.keys(this.prefRecords_).map(\n function(el) { return this.prefix + el }.bind(this));\n\n if (this.trace)\n console.log('Preferences read: ' + this.prefix);\n\n this.storage.getItems(keys, function(items) {\n var prefixLength = this.prefix.length;\n\n for (var key in items) {\n var value = items[key];\n var name = key.substr(prefixLength);\n var needSync = (name in this.childLists_ &&\n (JSON.stringify(value) !=\n JSON.stringify(this.prefRecords_[name].currentValue)));\n\n this.prefRecords_[name].currentValue = value;\n\n if (needSync) {\n pendingChildren++;\n this.syncChildList(name, onChildComplete);\n }\n }\n\n if (pendingChildren == 0 && opt_callback)\n setTimeout(opt_callback);\n }.bind(this));\n};\n\n/**\n * Define a preference.\n *\n * This registers a name, default value, and onChange handler for a preference.\n *\n * @param {string} name The name of the preference. This will be prefixed by\n * the prefix of this PreferenceManager before written to local storage.\n * @param {string|number|boolean|Object|Array|null} value The default value of\n * this preference. Anything that can be represented in JSON is a valid\n * default value.\n * @param {function(value, string, lib.PreferenceManager} opt_observer A\n * function to invoke when the preference changes. It will receive the new\n * value, the name of the preference, and a reference to the\n * PreferenceManager as parameters.\n */\nlib.PreferenceManager.prototype.definePreference = function(\n name, value, opt_onChange) {\n\n var record = this.prefRecords_[name];\n if (record) {\n this.changeDefault(name, value);\n } else {\n record = this.prefRecords_[name] =\n new lib.PreferenceManager.Record(name, value);\n }\n\n if (opt_onChange)\n record.addObserver(opt_onChange);\n};\n\n/**\n * Define multiple preferences with a single function call.\n *\n * @param {Array} defaults An array of 3-element arrays. Each three element\n * array should contain the [key, value, onChange] parameters for a\n * preference.\n */\nlib.PreferenceManager.prototype.definePreferences = function(defaults) {\n for (var i = 0; i < defaults.length; i++) {\n this.definePreference(defaults[i][0], defaults[i][1], defaults[i][2]);\n }\n};\n\n/**\n * Define an ordered list of child preferences.\n *\n * Child preferences are different from just storing an array of JSON objects\n * in that each child is an instance of a preference manager. This means you\n * can observe changes to individual child preferences, and get some validation\n * that you're not reading or writing to an undefined child preference value.\n *\n * @param {string} listName A name for the list of children. This must be\n * unique in this preference manager. The listName will become a\n * preference on this PreferenceManager used to store the ordered list of\n * child ids. It is also used in get/add/remove operations to identify the\n * list of children to operate on.\n * @param {function} childFactory A function that will be used to generate\n * instances of these children. The factory function will receive the\n * parent lib.PreferenceManager object and a unique id for the new child\n * preferences.\n */\nlib.PreferenceManager.prototype.defineChildren = function(\n listName, childFactory) {\n\n // Define a preference to hold the ordered list of child ids.\n this.definePreference(listName, [],\n this.onChildListChange_.bind(this, listName));\n this.childFactories_[listName] = childFactory;\n this.childLists_[listName] = {};\n};\n\n/**\n * Register to observe preference changes.\n *\n * @param {Function} global A callback that will happen for every preference.\n * Pass null if you don't need one.\n * @param {Object} map A map of preference specific callbacks. Pass null if\n * you don't need any.\n */\nlib.PreferenceManager.prototype.addObservers = function(global, map) {\n if (global && typeof global != 'function')\n throw new Error('Invalid param: globals');\n\n if (global)\n this.globalObservers_.push(global);\n\n if (!map)\n return;\n\n for (var name in map) {\n if (!(name in this.prefRecords_))\n throw new Error('Unknown preference: ' + name);\n\n this.prefRecords_[name].addObserver(map[name]);\n }\n};\n\n/**\n * Dispatch the change observers for all known preferences.\n *\n * It may be useful to call this after readStorage completes, in order to\n * get application state in sync with user preferences.\n *\n * This can be used if you've changed a preference manager out from under\n * a live object, for example when switching to a different prefix.\n */\nlib.PreferenceManager.prototype.notifyAll = function() {\n for (var name in this.prefRecords_) {\n this.notifyChange_(name);\n }\n};\n\n/**\n * Notify the change observers for a given preference.\n *\n * @param {string} name The name of the preference that changed.\n */\nlib.PreferenceManager.prototype.notifyChange_ = function(name) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n var currentValue = record.get();\n\n for (var i = 0; i < this.globalObservers_.length; i++)\n this.globalObservers_[i](name, currentValue);\n\n for (var i = 0; i < record.observers.length; i++) {\n record.observers[i](currentValue, name, this);\n }\n};\n\n/**\n * Create a new child PreferenceManager for the given child list.\n *\n * The optional hint parameter is an opaque prefix added to the auto-generated\n * unique id for this child. Your child factory can parse out the prefix\n * and use it.\n *\n * @param {string} listName The child list to create the new instance from.\n * @param {string} opt_hint Optional hint to include in the child id.\n * @param {string} opt_id Optional id to override the generated id.\n */\nlib.PreferenceManager.prototype.createChild = function(listName, opt_hint,\n opt_id) {\n var ids = this.get(listName);\n var id;\n\n if (opt_id) {\n id = opt_id;\n if (ids.indexOf(id) != -1)\n throw new Error('Duplicate child: ' + listName + ': ' + id);\n\n } else {\n // Pick a random, unique 4-digit hex identifier for the new profile.\n while (!id || ids.indexOf(id) != -1) {\n id = lib.f.randomInt(1, 0xffff).toString(16);\n id = lib.f.zpad(id, 4);\n if (opt_hint)\n id = opt_hint + ':' + id;\n }\n }\n\n var childManager = this.childFactories_[listName](this, id);\n childManager.trace = this.trace;\n childManager.resetAll();\n\n this.childLists_[listName][id] = childManager;\n\n ids.push(id);\n this.set(listName, ids);\n\n return childManager;\n};\n\n/**\n * Remove a child preferences instance.\n *\n * Removes a child preference manager and clears any preferences stored in it.\n *\n * @param {string} listName The name of the child list containing the child to\n * remove.\n * @param {string} id The child ID.\n */\nlib.PreferenceManager.prototype.removeChild = function(listName, id) {\n var prefs = this.getChild(listName, id);\n prefs.resetAll();\n\n var ids = this.get(listName);\n var i = ids.indexOf(id);\n if (i != -1) {\n ids.splice(i, 1);\n this.set(listName, ids);\n }\n\n delete this.childLists_[listName][id];\n};\n\n/**\n * Return a child PreferenceManager instance for a given id.\n *\n * If the child list or child id is not known this will return the specified\n * default value or throw an exception if no default value is provided.\n *\n * @param {string} listName The child list to look in.\n * @param {string} id The child ID.\n * @param {*} opt_default The optional default value to return if the child\n * is not found.\n */\nlib.PreferenceManager.prototype.getChild = function(listName, id, opt_default) {\n if (!(listName in this.childLists_))\n throw new Error('Unknown child list: ' + listName);\n\n var childList = this.childLists_[listName];\n if (!(id in childList)) {\n if (typeof opt_default == 'undefined')\n throw new Error('Unknown \"' + listName + '\" child: ' + id);\n\n return opt_default;\n }\n\n return childList[id];\n};\n\n/**\n * Calculate the difference between two lists of child ids.\n *\n * Given two arrays of child ids, this function will return an object\n * with \"added\", \"removed\", and \"common\" properties. Each property is\n * a map of child-id to `true`. For example, given...\n *\n * a = ['child-x', 'child-y']\n * b = ['child-y']\n *\n * diffChildLists(a, b) =>\n * { added: { 'child-x': true }, removed: {}, common: { 'child-y': true } }\n *\n * The added/removed properties assume that `a` is the current list.\n *\n * @param {Array[string]} a The most recent list of child ids.\n * @param {Array[string]} b An older list of child ids.\n * @return {Object} An object with added/removed/common properties.\n */\nlib.PreferenceManager.diffChildLists = function(a, b) {\n var rv = {\n added: {},\n removed: {},\n common: {},\n };\n\n for (var i = 0; i < a.length; i++) {\n if (b.indexOf(a[i]) != -1) {\n rv.common[a[i]] = true;\n } else {\n rv.added[a[i]] = true;\n }\n }\n\n for (var i = 0; i < b.length; i++) {\n if ((b[i] in rv.added) || (b[i] in rv.common))\n continue;\n\n rv.removed[b[i]] = true;\n }\n\n return rv;\n};\n\n/**\n * Synchronize a list of child PreferenceManagers instances with the current\n * list stored in prefs.\n *\n * This will instantiate any missing managers and read current preference values\n * from storage. Any active managers that no longer appear in preferences will\n * be deleted.\n *\n * @param {string} listName The child list to synchronize.\n * @param {function()} opt_callback Optional function to invoke when the sync\n * is complete.\n */\nlib.PreferenceManager.prototype.syncChildList = function(\n listName, opt_callback) {\n\n var pendingChildren = 0;\n function onChildStorage() {\n if (--pendingChildren == 0 && opt_callback)\n opt_callback();\n }\n\n // The list of child ids that we *should* have a manager for.\n var currentIds = this.get(listName);\n\n // The known managers at the start of the sync. Any manager still in this\n // list at the end should be discarded.\n var oldIds = Object.keys(this.childLists_[listName]);\n\n var rv = lib.PreferenceManager.diffChildLists(currentIds, oldIds);\n\n for (var i = 0; i < currentIds.length; i++) {\n var id = currentIds[i];\n\n var managerIndex = oldIds.indexOf(id);\n if (managerIndex >= 0)\n oldIds.splice(managerIndex, 1);\n\n if (!this.childLists_[listName][id]) {\n var childManager = this.childFactories_[listName](this, id);\n if (!childManager) {\n console.warn('Unable to restore child: ' + listName + ': ' + id);\n continue;\n }\n\n childManager.trace = this.trace;\n this.childLists_[listName][id] = childManager;\n pendingChildren++;\n childManager.readStorage(onChildStorage);\n }\n }\n\n for (var i = 0; i < oldIds.length; i++) {\n delete this.childLists_[listName][oldIds[i]];\n }\n\n if (!pendingChildren && opt_callback)\n setTimeout(opt_callback);\n};\n\n/**\n * Reset a preference to its default state.\n *\n * This will dispatch the onChange handler if the preference value actually\n * changes.\n *\n * @param {string} name The preference to reset.\n */\nlib.PreferenceManager.prototype.reset = function(name) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n this.storage.removeItem(this.prefix + name);\n\n if (record.currentValue !== this.DEFAULT_VALUE) {\n record.currentValue = this.DEFAULT_VALUE;\n this.notifyChange_(name);\n }\n};\n\n/**\n * Reset all preferences back to their default state.\n */\nlib.PreferenceManager.prototype.resetAll = function() {\n var changed = [];\n\n for (var listName in this.childLists_) {\n var childList = this.childLists_[listName];\n for (var id in childList) {\n childList[id].resetAll();\n }\n }\n\n for (var name in this.prefRecords_) {\n if (this.prefRecords_[name].currentValue !== this.DEFAULT_VALUE) {\n this.prefRecords_[name].currentValue = this.DEFAULT_VALUE;\n changed.push(name);\n }\n }\n\n var keys = Object.keys(this.prefRecords_).map(function(el) {\n return this.prefix + el;\n }.bind(this));\n\n this.storage.removeItems(keys);\n\n changed.forEach(this.notifyChange_.bind(this));\n};\n\n/**\n * Return true if two values should be considered not-equal.\n *\n * If both values are the same scalar type and compare equal this function\n * returns false (no difference), otherwise return true.\n *\n * This is used in places where we want to check if a preference has changed.\n * Rather than take the time to compare complex values we just consider them\n * to always be different.\n *\n * @param {*} a A value to compare.\n * @param {*} b A value to compare.\n */\nlib.PreferenceManager.prototype.diff = function(a, b) {\n // If the types are different, or the type is not a simple primitive one.\n if ((typeof a) !== (typeof b) ||\n !(/^(undefined|boolean|number|string)$/.test(typeof a))) {\n return true;\n }\n\n return a !== b;\n};\n\n/**\n * Change the default value of a preference.\n *\n * This is useful when subclassing preference managers.\n *\n * The function does not alter the current value of the preference, unless\n * it has the old default value. When that happens, the change observers\n * will be notified.\n *\n * @param {string} name The name of the parameter to change.\n * @param {*} newValue The new default value for the preference.\n */\nlib.PreferenceManager.prototype.changeDefault = function(name, newValue) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n if (!this.diff(record.defaultValue, newValue)) {\n // Default value hasn't changed.\n return;\n }\n\n if (record.currentValue !== this.DEFAULT_VALUE) {\n // This pref has a specific value, just change the default and we're done.\n record.defaultValue = newValue;\n return;\n }\n\n record.defaultValue = newValue;\n\n this.notifyChange_(name);\n};\n\n/**\n * Change the default value of multiple preferences.\n *\n * @param {Object} map A map of name -> value pairs specifying the new default\n * values.\n */\nlib.PreferenceManager.prototype.changeDefaults = function(map) {\n for (var key in map) {\n this.changeDefault(key, map[key]);\n }\n};\n\n/**\n * Set a preference to a specific value.\n *\n * This will dispatch the onChange handler if the preference value actually\n * changes.\n *\n * @param {string} key The preference to set.\n * @param {*} value The value to set. Anything that can be represented in\n * JSON is a valid value.\n */\nlib.PreferenceManager.prototype.set = function(name, newValue) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n var oldValue = record.get();\n\n if (!this.diff(oldValue, newValue))\n return;\n\n if (this.diff(record.defaultValue, newValue)) {\n record.currentValue = newValue;\n this.storage.setItem(this.prefix + name, newValue);\n } else {\n record.currentValue = this.DEFAULT_VALUE;\n this.storage.removeItem(this.prefix + name);\n }\n\n // We need to manually send out the notification on this instance. If we\n // The storage event won't fire a notification because we've already changed\n // the currentValue, so it won't see a difference. If we delayed changing\n // currentValue until the storage event, a pref read immediately after a write\n // would return the previous value.\n //\n // The notification is in a timeout so clients don't accidentally depend on\n // a synchronous notification.\n setTimeout(this.notifyChange_.bind(this, name), 0);\n};\n\n/**\n * Get the value of a preference.\n *\n * @param {string} key The preference to get.\n */\nlib.PreferenceManager.prototype.get = function(name) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n return record.get();\n};\n\n/**\n * Return all non-default preferences as a JSON object.\n *\n * This includes any nested preference managers as well.\n */\nlib.PreferenceManager.prototype.exportAsJson = function() {\n var rv = {};\n\n for (var name in this.prefRecords_) {\n if (name in this.childLists_) {\n rv[name] = [];\n var childIds = this.get(name);\n for (var i = 0; i < childIds.length; i++) {\n var id = childIds[i];\n rv[name].push({id: id, json: this.getChild(name, id).exportAsJson()});\n }\n\n } else {\n var record = this.prefRecords_[name];\n if (record.currentValue != this.DEFAULT_VALUE)\n rv[name] = record.currentValue;\n }\n }\n\n return rv;\n};\n\n/**\n * Import a JSON blob of preferences previously generated with exportAsJson.\n *\n * This will create nested preference managers as well.\n */\nlib.PreferenceManager.prototype.importFromJson = function(json) {\n for (var name in json) {\n if (name in this.childLists_) {\n var childList = json[name];\n for (var i = 0; i < childList.length; i++) {\n var id = childList[i].id;\n\n var childPrefManager = this.childLists_[name][id];\n if (!childPrefManager)\n childPrefManager = this.createChild(name, null, id);\n\n childPrefManager.importFromJson(childList[i].json);\n }\n\n } else {\n this.set(name, json[name]);\n }\n }\n};\n\n/**\n * Called when one of the child list preferences changes.\n */\nlib.PreferenceManager.prototype.onChildListChange_ = function(listName) {\n this.syncChildList(listName);\n};\n\n/**\n * Called when a key in the storage changes.\n */\nlib.PreferenceManager.prototype.onStorageChange_ = function(map) {\n for (var key in map) {\n if (this.prefix) {\n if (key.lastIndexOf(this.prefix, 0) != 0)\n continue;\n }\n\n var name = key.substr(this.prefix.length);\n\n if (!(name in this.prefRecords_)) {\n // Sometimes we'll get notified about prefs that are no longer defined.\n continue;\n }\n\n var record = this.prefRecords_[name];\n\n var newValue = map[key].newValue;\n var currentValue = record.currentValue;\n if (currentValue === record.DEFAULT_VALUE)\n currentValue = (void 0);\n\n if (this.diff(currentValue, newValue)) {\n if (typeof newValue == 'undefined' || newValue === null) {\n record.currentValue = record.DEFAULT_VALUE;\n } else {\n record.currentValue = newValue;\n }\n\n this.notifyChange_(name);\n }\n }\n};\n// SOURCE FILE: libdot/js/lib_resource.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Storage for canned resources.\n *\n * These are usually non-JavaScript things that are collected during a build\n * step and converted into a series of 'lib.resource.add(...)' calls. See\n * the \"@resource\" directive from libdot/bin/concat.sh for the canonical use\n * case.\n *\n * This is global storage, so you should prefix your resource names to avoid\n * collisions.\n */\nlib.resource = {\n resources_: {}\n};\n\n/**\n * Add a resource.\n *\n * @param {string} name A name for the resource. You should prefix this to\n * avoid collisions with resources from a shared library.\n * @param {string} type A mime type for the resource, or \"raw\" if not\n * applicable.\n * @param {*} data The value of the resource.\n */\nlib.resource.add = function(name, type, data) {\n lib.resource.resources_[name] = {\n type: type,\n name: name,\n data: data\n };\n};\n\n/**\n * Retrieve a resource record.\n *\n * The resource data is stored on the \"data\" property of the returned object.\n *\n * @param {string} name The name of the resource to get.\n * @param {*} opt_defaultValue The optional value to return if the resource is\n * not defined.\n * @return {object} An object with \"type\", \"name\", and \"data\" properties.\n */\nlib.resource.get = function(name, opt_defaultValue) {\n if (!(name in lib.resource.resources_)) {\n if (typeof opt_defaultValue == 'undefined')\n throw 'Unknown resource: ' + name;\n\n return opt_defaultValue;\n }\n\n return lib.resource.resources_[name];\n};\n\n/**\n * Retrieve resource data.\n *\n * @param {string} name The name of the resource to get.\n * @param {*} opt_defaultValue The optional value to return if the resource is\n * not defined.\n * @return {*} The resource data.\n */\nlib.resource.getData = function(name, opt_defaultValue) {\n if (!(name in lib.resource.resources_)) {\n if (typeof opt_defaultValue == 'undefined')\n throw 'Unknown resource: ' + name;\n\n return opt_defaultValue;\n }\n\n return lib.resource.resources_[name].data;\n};\n\n/**\n * Retrieve resource as a data: url.\n *\n * @param {string} name The name of the resource to get.\n * @param {*} opt_defaultValue The optional value to return if the resource is\n * not defined.\n * @return {*} A data: url encoded version of the resource.\n */\nlib.resource.getDataUrl = function(name, opt_defaultValue) {\n var resource = lib.resource.get(name, opt_defaultValue);\n return 'data:' + resource.type + ',' + resource.data;\n};\n// SOURCE FILE: libdot/js/lib_storage.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Namespace for implementations of persistent, possibly cloud-backed\n * storage.\n */\nlib.Storage = new Object();\n// SOURCE FILE: libdot/js/lib_storage_chrome.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * chrome.storage based class with an async interface that is interchangeable\n * with other lib.Storage.* implementations.\n */\nlib.Storage.Chrome = function(storage) {\n this.storage_ = storage;\n this.observers_ = [];\n\n chrome.storage.onChanged.addListener(this.onChanged_.bind(this));\n};\n\n/**\n * Called by the storage implementation when the storage is modified.\n */\nlib.Storage.Chrome.prototype.onChanged_ = function(changes, areaname) {\n if (chrome.storage[areaname] != this.storage_)\n return;\n\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](changes);\n }\n};\n\n/**\n * Register a function to observe storage changes.\n *\n * @param {function(map)} callback The function to invoke when the storage\n * changes.\n */\nlib.Storage.Chrome.prototype.addObserver = function(callback) {\n this.observers_.push(callback);\n};\n\n/**\n * Unregister a change observer.\n *\n * @param {function} observer A previously registered callback.\n */\nlib.Storage.Chrome.prototype.removeObserver = function(callback) {\n var i = this.observers_.indexOf(callback);\n if (i != -1)\n this.observers_.splice(i, 1);\n};\n\n/**\n * Delete everything in this storage.\n *\n * @param {function(map)} callback The function to invoke when the delete\n * has completed.\n */\nlib.Storage.Chrome.prototype.clear = function(opt_callback) {\n this.storage_.clear();\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Return the current value of a storage item.\n *\n * @param {string} key The key to look up.\n * @param {function(value) callback The function to invoke when the value has\n * been retrieved.\n */\nlib.Storage.Chrome.prototype.getItem = function(key, callback) {\n this.storage_.get(key, callback);\n};\n/**\n * Fetch the values of multiple storage items.\n *\n * @param {Array} keys The keys to look up.\n * @param {function(map) callback The function to invoke when the values have\n * been retrieved.\n */\n\nlib.Storage.Chrome.prototype.getItems = function(keys, callback) {\n this.storage_.get(keys, callback);\n};\n\n/**\n * Set a value in storage.\n *\n * @param {string} key The key for the value to be stored.\n * @param {*} value The value to be stored. Anything that can be serialized\n * with JSON is acceptable.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Chrome.prototype.setItem = function(key, value, opt_callback) {\n var obj = {};\n obj[key] = value;\n this.storage_.set(obj, opt_callback);\n};\n\n/**\n * Set multiple values in storage.\n *\n * @param {Object} map A map of key/values to set in storage.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Chrome.prototype.setItems = function(obj, opt_callback) {\n this.storage_.set(obj, opt_callback);\n};\n\n/**\n * Remove an item from storage.\n *\n * @param {string} key The key to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Chrome.prototype.removeItem = function(key, opt_callback) {\n this.storage_.remove(key, opt_callback);\n};\n\n/**\n * Remove multiple items from storage.\n *\n * @param {Array} keys The keys to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Chrome.prototype.removeItems = function(keys, opt_callback) {\n this.storage_.remove(keys, opt_callback);\n};\n// SOURCE FILE: libdot/js/lib_storage_local.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * window.localStorage based class with an async interface that is\n * interchangeable with other lib.Storage.* implementations.\n */\nlib.Storage.Local = function() {\n this.observers_ = [];\n this.storage_ = window.localStorage;\n window.addEventListener('storage', this.onStorage_.bind(this));\n};\n\n/**\n * Called by the storage implementation when the storage is modified.\n */\nlib.Storage.Local.prototype.onStorage_ = function(e) {\n if (e.storageArea != this.storage_)\n return;\n\n // JS throws an exception if JSON.parse is given an empty string. So here we\n // only parse if the value is truthy. This mean the empty string, undefined\n // and null will not be parsed.\n var prevValue = e.oldValue ? JSON.parse(e.oldValue) : e.oldValue;\n var curValue = e.newValue ? JSON.parse(e.newValue) : e.newValue;\n var o = {};\n o[e.key] = {\n oldValue: prevValue,\n newValue: curValue\n };\n\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](o);\n }\n};\n\n/**\n * Register a function to observe storage changes.\n *\n * @param {function(map)} callback The function to invoke when the storage\n * changes.\n */\nlib.Storage.Local.prototype.addObserver = function(callback) {\n this.observers_.push(callback);\n};\n\n/**\n * Unregister a change observer.\n *\n * @param {function} observer A previously registered callback.\n */\nlib.Storage.Local.prototype.removeObserver = function(callback) {\n var i = this.observers_.indexOf(callback);\n if (i != -1)\n this.observers_.splice(i, 1);\n};\n\n/**\n * Delete everything in this storage.\n *\n * @param {function(map)} callback The function to invoke when the delete\n * has completed.\n */\nlib.Storage.Local.prototype.clear = function(opt_callback) {\n this.storage_.clear();\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Return the current value of a storage item.\n *\n * @param {string} key The key to look up.\n * @param {function(value) callback The function to invoke when the value has\n * been retrieved.\n */\nlib.Storage.Local.prototype.getItem = function(key, callback) {\n var value = this.storage_.getItem(key);\n\n if (typeof value == 'string') {\n try {\n value = JSON.parse(value);\n } catch (e) {\n // If we can't parse the value, just return it unparsed.\n }\n }\n\n setTimeout(callback.bind(null, value), 0);\n};\n\n/**\n * Fetch the values of multiple storage items.\n *\n * @param {Array} keys The keys to look up.\n * @param {function(map) callback The function to invoke when the values have\n * been retrieved.\n */\nlib.Storage.Local.prototype.getItems = function(keys, callback) {\n var rv = {};\n\n for (var i = keys.length - 1; i >= 0; i--) {\n var key = keys[i];\n var value = this.storage_.getItem(key);\n if (typeof value == 'string') {\n try {\n rv[key] = JSON.parse(value);\n } catch (e) {\n // If we can't parse the value, just return it unparsed.\n rv[key] = value;\n }\n } else {\n keys.splice(i, 1);\n }\n }\n\n setTimeout(callback.bind(null, rv), 0);\n};\n\n/**\n * Set a value in storage.\n *\n * @param {string} key The key for the value to be stored.\n * @param {*} value The value to be stored. Anything that can be serialized\n * with JSON is acceptable.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Local.prototype.setItem = function(key, value, opt_callback) {\n this.storage_.setItem(key, JSON.stringify(value));\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Set multiple values in storage.\n *\n * @param {Object} map A map of key/values to set in storage.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Local.prototype.setItems = function(obj, opt_callback) {\n for (var key in obj) {\n this.storage_.setItem(key, JSON.stringify(obj[key]));\n }\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Remove an item from storage.\n *\n * @param {string} key The key to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Local.prototype.removeItem = function(key, opt_callback) {\n this.storage_.removeItem(key);\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Remove multiple items from storage.\n *\n * @param {Array} keys The keys to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Local.prototype.removeItems = function(ary, opt_callback) {\n for (var i = 0; i < ary.length; i++) {\n this.storage_.removeItem(ary[i]);\n }\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n// SOURCE FILE: libdot/js/lib_storage_memory.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * In-memory storage class with an async interface that is interchangeable with\n * other lib.Storage.* implementations.\n */\nlib.Storage.Memory = function() {\n this.observers_ = [];\n this.storage_ = {};\n};\n\n/**\n * Register a function to observe storage changes.\n *\n * @param {function(map)} callback The function to invoke when the storage\n * changes.\n */\nlib.Storage.Memory.prototype.addObserver = function(callback) {\n this.observers_.push(callback);\n};\n\n/**\n * Unregister a change observer.\n *\n * @param {function} observer A previously registered callback.\n */\nlib.Storage.Memory.prototype.removeObserver = function(callback) {\n var i = this.observers_.indexOf(callback);\n if (i != -1)\n this.observers_.splice(i, 1);\n};\n\n/**\n * Delete everything in this storage.\n *\n * @param {function(map)} callback The function to invoke when the delete\n * has completed.\n */\nlib.Storage.Memory.prototype.clear = function(opt_callback) {\n var e = {};\n for (var key in this.storage_) {\n e[key] = {oldValue: this.storage_[key], newValue: (void 0)};\n }\n\n this.storage_ = {};\n\n setTimeout(function() {\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](e);\n }\n }.bind(this), 0);\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Return the current value of a storage item.\n *\n * @param {string} key The key to look up.\n * @param {function(value) callback The function to invoke when the value has\n * been retrieved.\n */\nlib.Storage.Memory.prototype.getItem = function(key, callback) {\n var value = this.storage_[key];\n\n if (typeof value == 'string') {\n try {\n value = JSON.parse(value);\n } catch (e) {\n // If we can't parse the value, just return it unparsed.\n }\n }\n\n setTimeout(callback.bind(null, value), 0);\n};\n\n/**\n * Fetch the values of multiple storage items.\n *\n * @param {Array} keys The keys to look up.\n * @param {function(map) callback The function to invoke when the values have\n * been retrieved.\n */\nlib.Storage.Memory.prototype.getItems = function(keys, callback) {\n var rv = {};\n\n for (var i = keys.length - 1; i >= 0; i--) {\n var key = keys[i];\n var value = this.storage_[key];\n if (typeof value == 'string') {\n try {\n rv[key] = JSON.parse(value);\n } catch (e) {\n // If we can't parse the value, just return it unparsed.\n rv[key] = value;\n }\n } else {\n keys.splice(i, 1);\n }\n }\n\n setTimeout(callback.bind(null, rv), 0);\n};\n\n/**\n * Set a value in storage.\n *\n * @param {string} key The key for the value to be stored.\n * @param {*} value The value to be stored. Anything that can be serialized\n * with JSON is acceptable.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Memory.prototype.setItem = function(key, value, opt_callback) {\n var oldValue = this.storage_[key];\n this.storage_[key] = JSON.stringify(value);\n\n var e = {};\n e[key] = {oldValue: oldValue, newValue: value};\n\n setTimeout(function() {\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](e);\n }\n }.bind(this), 0);\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Set multiple values in storage.\n *\n * @param {Object} map A map of key/values to set in storage.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Memory.prototype.setItems = function(obj, opt_callback) {\n var e = {};\n\n for (var key in obj) {\n e[key] = {oldValue: this.storage_[key], newValue: obj[key]};\n this.storage_[key] = JSON.stringify(obj[key]);\n }\n\n setTimeout(function() {\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](e);\n }\n }.bind(this));\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Remove an item from storage.\n *\n * @param {string} key The key to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Memory.prototype.removeItem = function(key, opt_callback) {\n delete this.storage_[key];\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Remove multiple items from storage.\n *\n * @param {Array} keys The keys to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Memory.prototype.removeItems = function(ary, opt_callback) {\n for (var i = 0; i < ary.length; i++) {\n delete this.storage_[ary[i]];\n }\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n// SOURCE FILE: libdot/js/lib_test_manager.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * @fileoverview JavaScript unit testing framework for synchronous and\n * asynchronous tests.\n *\n * This file contains the lib.TestManager and related classes. At the moment\n * it's all collected in a single file since it's reasonably small\n * (=~1k lines), and it's a lot easier to include one file into your test\n * harness than it is to include seven.\n *\n * The following classes are defined...\n *\n * lib.TestManager - The root class and entrypoint for creating test runs.\n * lib.TestManager.Log - Logging service.\n * lib.TestManager.Suite - A collection of tests.\n * lib.TestManager.Test - A single test.\n * lib.TestManager.TestRun - Manages the execution of a set of tests.\n * lib.TestManager.Result - A single test result.\n */\n\n/**\n * Root object in the unit test hierarchy, and keeper of the log object.\n *\n * @param {lib.TestManager.Log} opt_log Optional lib.TestManager.Log object.\n * Logs to the JavaScript console if omitted.\n */\nlib.TestManager = function(opt_log) {\n this.log = opt_log || new lib.TestManager.Log();\n}\n\n/**\n * Create a new test run object for this test manager.\n *\n * @param {Object} opt_cx An object to be passed to test suite setup(),\n * preamble(), and test cases during this test run. This object is opaque\n * to lib.TestManager.* code. It's entirely up to the test suite what it's\n * used for.\n */\nlib.TestManager.prototype.createTestRun = function(opt_cx) {\n return new lib.TestManager.TestRun(this, opt_cx);\n};\n\n/**\n * Called when a test run associated with this test manager completes.\n *\n * Clients may override this to call an appropriate function.\n */\nlib.TestManager.prototype.onTestRunComplete = function(testRun) {};\n\n/**\n * Called before a test associated with this test manager is run.\n *\n * @param {lib.TestManager.Result} result The result object for the upcoming\n * test.\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.prototype.testPreamble = function(result, cx) {};\n\n/**\n * Called after a test associated with this test manager finishes.\n *\n * @param {lib.TestManager.Result} result The result object for the finished\n * test.\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.prototype.testPostamble = function(result, cx) {};\n\n/**\n * Destination for test case output.\n *\n * Thw API will be the same as the console object. e.g. We support info(),\n * warn(), error(), etc... just like console.info(), etc...\n *\n * @param {Object} opt_console The console object to route all logging through.\n * Should provide saome API as the standard console API.\n */\nlib.TestManager.Log = function(opt_console=console) {\n this.save = false;\n this.data = '';\n this.prefix_ = '';\n this.prefixStack_ = 0;\n\n // Capture all the console entry points in case code at runtime calls these\n // directly. We want to be able to still see things.\n // We also expose the direct API to our callers (e.g. we provide warn()).\n this.console_ = opt_console;\n ['log', 'debug', 'info', 'warn', 'error'].forEach((level) => {\n let msgPrefix = '';\n switch (level) {\n case 'debug':\n case 'warn':\n case 'error':\n msgPrefix = level.toUpperCase() + ': ';\n break;\n }\n\n const oLog = this.console_[level];\n this[level] = this.console_[level] = (...args) => {\n if (this.save)\n this.data += this.prefix_ + msgPrefix + args.join(' ') + '\\n';\n oLog.apply(this.console_, args);\n };\n });\n\n // Wrap/bind the group functions.\n ['group', 'groupCollapsed'].forEach((group) => {\n const oGroup = this.console_[group];\n this[group] = this.console_[group] = (label='') => {\n oGroup(label);\n if (this.save)\n this.data += this.prefix_ + label + '\\n';\n this.prefix_ = ' '.repeat(++this.prefixStack_);\n };\n });\n\n const oGroupEnd = this.console_.groupEnd;\n this.groupEnd = this.console_.groupEnd = () => {\n oGroupEnd();\n this.prefix_ = ' '.repeat(--this.prefixStack_);\n };\n};\n\n/**\n * Returns a new constructor function that will inherit from\n * lib.TestManager.Suite.\n *\n * Use this function to create a new test suite subclass. It will return a\n * properly initialized constructor function for the subclass. You can then\n * override the setup() and preamble() methods if necessary and add test cases\n * to the subclass.\n *\n * var MyTests = new lib.TestManager.Suite('MyTests');\n *\n * MyTests.prototype.setup = function(cx) {\n * // Sets this.size to cx.size if it exists, or the default value of 10\n * // if not.\n * this.setDefault(cx, {size: 10});\n * };\n *\n * MyTests.prototype.preamble = function(result, cx) {\n * // Some tests (even successful ones) may side-effect this list, so\n * // recreate it before every test.\n * this.list = [];\n * for (var i = 0; i < this.size; i++) {\n * this.list[i] = i;\n * }\n * };\n *\n * // Basic synchronous test case.\n * MyTests.addTest('pop-length', function(result, cx) {\n * this.list.pop();\n *\n * // If this assertion fails, the testcase will stop here.\n * result.assertEQ(this.list.length, this.size - 1);\n *\n * // A test must indicate it has passed by calling this method.\n * result.pass();\n * });\n *\n * // Sample asynchronous test case.\n * MyTests.addTest('async-pop-length', function(result, cx) {\n * var self = this;\n *\n * var callback = function() {\n * result.assertEQ(self.list.length, self.size - 1);\n * result.pass();\n * };\n *\n * // Wait 100ms to check the array length for the sake of this example.\n * setTimeout(callback, 100);\n *\n * this.list.pop();\n *\n * // Indicate that this test needs another 200ms to complete.\n * // If the test does not report pass/fail by then, it is considered to\n * // have timed out.\n * result.requestTime(200);\n * });\n *\n * ...\n *\n * @param {string} suiteName The name of the test suite.\n */\nlib.TestManager.Suite = function(suiteName) {\n function ctor(testManager, cx) {\n this.testManager_ = testManager;\n this.suiteName = suiteName;\n\n this.setup(cx);\n }\n\n ctor.suiteName = suiteName;\n ctor.addTest = lib.TestManager.Suite.addTest;\n ctor.disableTest = lib.TestManager.Suite.disableTest;\n ctor.getTest = lib.TestManager.Suite.getTest;\n ctor.getTestList = lib.TestManager.Suite.getTestList;\n ctor.testList_ = [];\n ctor.testMap_ = {};\n ctor.prototype = Object.create(lib.TestManager.Suite.prototype);\n ctor.constructor = lib.TestManager.Suite;\n\n lib.TestManager.Suite.subclasses.push(ctor);\n\n return ctor;\n};\n\n/**\n * List of lib.TestManager.Suite subclasses, in the order they were defined.\n */\nlib.TestManager.Suite.subclasses = [];\n\n/**\n * Add a test to a lib.TestManager.Suite.\n *\n * This method is copied to new subclasses when they are created.\n */\nlib.TestManager.Suite.addTest = function(testName, testFunction) {\n if (testName in this.testMap_)\n throw 'Duplicate test name: ' + testName;\n\n var test = new lib.TestManager.Test(this, testName, testFunction);\n this.testMap_[testName] = test;\n this.testList_.push(test);\n};\n\n/**\n * Defines a disabled test.\n */\nlib.TestManager.Suite.disableTest = function(testName, testFunction) {\n if (testName in this.testMap_)\n throw 'Duplicate test name: ' + testName;\n\n var test = new lib.TestManager.Test(this, testName, testFunction);\n console.log('Disabled test: ' + test.fullName);\n};\n\n/**\n * Get a lib.TestManager.Test instance by name.\n *\n * This method is copied to new subclasses when they are created.\n *\n * @param {string} testName The name of the desired test.\n * @return {lib.TestManager.Test} The requested test, or undefined if it was not\n * found.\n */\nlib.TestManager.Suite.getTest = function(testName) {\n return this.testMap_[testName];\n};\n\n/**\n * Get an array of lib.TestManager.Tests associated with this Suite.\n *\n * This method is copied to new subclasses when they are created.\n */\nlib.TestManager.Suite.getTestList = function() {\n return this.testList_;\n};\n\n/**\n * Set properties on a test suite instance, pulling the property value from\n * the context if it exists and from the defaults dictionary if not.\n *\n * This is intended to be used in your test suite's setup() method to\n * define parameters for the test suite which may be overridden through the\n * context object. For example...\n *\n * MySuite.prototype.setup = function(cx) {\n * this.setDefaults(cx, {size: 10});\n * };\n *\n * If the context object has a 'size' property then this.size will be set to\n * the value of cx.size, otherwise this.size will get a default value of 10.\n *\n * @param {Object} cx The context object for a test run.\n * @param {Object} defaults An object containing name/value pairs to set on\n * this test suite instance. The value listed here will be used if the\n * name is not defined on the context object.\n */\nlib.TestManager.Suite.prototype.setDefaults = function(cx, defaults) {\n for (var k in defaults) {\n this[k] = (k in cx) ? cx[k] : defaults[k];\n }\n};\n\n/**\n * Subclassable method called to set up the test suite.\n *\n * The default implementation of this method is a no-op. If your test suite\n * requires some kind of suite-wide setup, this is the place to do it.\n *\n * It's fine to store state on the test suite instance, that state will be\n * accessible to all tests in the suite. If any test case fails, the entire\n * test suite object will be discarded and a new one will be created for\n * the remaining tests.\n *\n * Any side effects outside of this test suite instance must be idempotent.\n * For example, if you're adding DOM nodes to a document, make sure to first\n * test that they're not already there. If they are, remove them rather than\n * reuse them. You should not count on their state, since they were probably\n * left behind by a failed testcase.\n *\n * Any exception here will abort the remainder of the test run.\n *\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.Suite.prototype.setup = function(cx) {};\n\n/**\n * Subclassable method called to do pre-test set up.\n *\n * The default implementation of this method is a no-op. If your test suite\n * requires some kind of pre-test setup, this is the place to do it.\n *\n * This can be used to avoid a bunch of boilerplate setup/teardown code in\n * this suite's testcases.\n *\n * Any exception here will abort the remainder of the test run.\n *\n * @param {lib.TestManager.Result} result The result object for the upcoming\n * test.\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.Suite.prototype.preamble = function(result, cx) {};\n\n/**\n * Subclassable method called to do post-test tear-down.\n *\n * The default implementation of this method is a no-op. If your test suite\n * requires some kind of pre-test setup, this is the place to do it.\n *\n * This can be used to avoid a bunch of boilerplate setup/teardown code in\n * this suite's testcases.\n *\n * Any exception here will abort the remainder of the test run.\n *\n * @param {lib.TestManager.Result} result The result object for the finished\n * test.\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.Suite.prototype.postamble = function(result, cx) {};\n\n/**\n * Object representing a single test in a test suite.\n *\n * These are created as part of the lib.TestManager.Suite.addTest() method.\n * You should never have to construct one by hand.\n *\n * @param {lib.TestManager.Suite} suiteClass The test suite class containing\n * this test.\n * @param {string} testName The local name of this test case, not including the\n * test suite name.\n * @param {function(lib.TestManager.Result, Object)} testFunction The function\n * to invoke for this test case. This is passed a Result instance and the\n * context object associated with the test run.\n *\n */\nlib.TestManager.Test = function(suiteClass, testName, testFunction) {\n /**\n * The test suite class containing this function.\n */\n this.suiteClass = suiteClass;\n\n /**\n * The local name of this test, not including the test suite name.\n */\n this.testName = testName;\n\n /**\n * The global name of this test, including the test suite name.\n */\n this.fullName = suiteClass.suiteName + '[' + testName + ']';\n\n // The function to call for this test.\n this.testFunction_ = testFunction;\n};\n\n/**\n * Execute this test.\n *\n * This is called by a lib.TestManager.Result instance, as part of a\n * lib.TestManager.TestRun. You should not call it by hand.\n *\n * @param {lib.TestManager.Result} result The result object for the test.\n */\nlib.TestManager.Test.prototype.run = function(result) {\n try {\n // Tests are applied to the parent lib.TestManager.Suite subclass.\n this.testFunction_.apply(result.suite,\n [result, result.testRun.cx]);\n } catch (ex) {\n if (ex instanceof lib.TestManager.Result.TestComplete)\n return;\n\n result.println('Test raised an exception: ' + ex);\n\n if (ex.stack) {\n if (ex.stack instanceof Array) {\n result.println(ex.stack.join('\\n'));\n } else {\n result.println(ex.stack);\n }\n }\n\n result.completeTest_(result.FAILED, false);\n }\n};\n\n/**\n * Used to choose a set of tests and run them.\n *\n * It's slightly more convenient to construct one of these from\n * lib.TestManager.prototype.createTestRun().\n *\n * @param {lib.TestManager} testManager The testManager associated with this\n * TestRun.\n * @param {Object} cx A context to be passed into the tests. This can be used\n * to set parameters for the test suite or individual test cases.\n */\nlib.TestManager.TestRun = function(testManager, cx) {\n /**\n * The associated lib.TestManager instance.\n */\n this.testManager = testManager;\n\n /**\n * Shortcut to the lib.TestManager's log.\n */\n this.log = testManager.log;\n\n /**\n * The test run context. It's entirely up to the test suite and test cases\n * how this is used. It is opaque to lib.TestManager.* classes.\n */\n this.cx = cx || {};\n\n /**\n * The list of test cases that encountered failures.\n */\n this.failures = [];\n\n /**\n * The list of test cases that passed.\n */\n this.passes = [];\n\n /**\n * The time the test run started, or null if it hasn't been started yet.\n */\n this.startDate = null;\n\n /**\n * The time in milliseconds that the test run took to complete, or null if\n * it hasn't completed yet.\n */\n this.duration = null;\n\n /**\n * The most recent result object, or null if the test run hasn't started\n * yet. In order to detect late failures, this is not cleared when the test\n * completes.\n */\n this.currentResult = null;\n\n /**\n * Number of maximum failures. The test run will stop when this number is\n * reached. If 0 or omitted, the entire set of selected tests is run, even\n * if some fail.\n */\n this.maxFailures = 0;\n\n /**\n * True if this test run ended early because of an unexpected condition.\n */\n this.panic = false;\n\n // List of pending test cases.\n this.testQueue_ = [];\n\n};\n\n/**\n * This value can be passed to select() to indicate that all tests should\n * be selected.\n */\nlib.TestManager.TestRun.prototype.ALL_TESTS = lib.f.createEnum('');\n\n/**\n * Add a single test to the test run.\n */\nlib.TestManager.TestRun.prototype.selectTest = function(test) {\n this.testQueue_.push(test);\n};\n\nlib.TestManager.TestRun.prototype.selectSuite = function(\n suiteClass, opt_pattern) {\n var pattern = opt_pattern || this.ALL_TESTS;\n var selectCount = 0;\n var testList = suiteClass.getTestList();\n\n for (var j = 0; j < testList.length; j++) {\n var test = testList[j];\n // Note that we're using \"!==\" rather than \"!=\" so that we're matching\n // the ALL_TESTS String object, rather than the contents of the string.\n if (pattern !== this.ALL_TESTS) {\n if (pattern instanceof RegExp) {\n if (!pattern.test(test.testName))\n continue;\n } else if (test.testName != pattern) {\n continue;\n }\n }\n\n this.selectTest(test);\n selectCount++;\n }\n\n return selectCount;\n};\n\n/**\n * Selects one or more tests to gather results for.\n *\n * Selecting the same test more than once is allowed.\n *\n * @param {string|RegExp} pattern Pattern used to select tests.\n * If TestRun.prototype.ALL_TESTS, all tests are selected.\n * If a string, only the test that exactly matches is selected.\n * If a RegExp, only tests matching the RegExp are added.\n *\n * @return {int} The number of additional tests that have been selected into\n * this TestRun.\n */\nlib.TestManager.TestRun.prototype.selectPattern = function(pattern) {\n var selectCount = 0;\n\n for (var i = 0; i < lib.TestManager.Suite.subclasses.length; i++) {\n selectCount += this.selectSuite(lib.TestManager.Suite.subclasses[i],\n pattern);\n }\n\n if (!selectCount) {\n this.log.warn('No tests matched selection criteria: ' + pattern);\n }\n\n return selectCount;\n};\n\n/**\n * Hooked up to window.onerror during a test run in order to catch exceptions\n * that would otherwise go uncaught.\n */\nlib.TestManager.TestRun.prototype.onUncaughtException_ = function(\n message, file, line) {\n\n if (message.indexOf('Uncaught lib.TestManager.Result.TestComplete') == 0 ||\n message.indexOf('status: passed') != -1) {\n // This is a result.pass() or result.fail() call from a callback. We're\n // already going to deal with it as part of the completeTest_() call\n // that raised it. We can safely squelch this error message.\n return true;\n }\n\n if (!this.currentResult)\n return;\n\n if (message == 'Uncaught ' + this.currentResult.expectedErrorMessage_) {\n // Test cases may need to raise an unhandled exception as part of the test.\n return;\n }\n\n var when = 'during';\n\n if (this.currentResult.status != this.currentResult.PENDING)\n when = 'after';\n\n this.log.error('Uncaught exception ' + when + ' test case: ' +\n this.currentResult.test.fullName);\n this.log.error(message + ', ' + file + ':' + line);\n\n this.currentResult.completeTest_(this.currentResult.FAILED, false);\n\n return false;\n};\n\n/**\n * Called to when this test run has completed.\n *\n * This method typically re-runs itself asynchronously, in order to let the\n * DOM stabilize and short-term timeouts to complete before declaring the\n * test run complete.\n *\n * @param {boolean} opt_skipTimeout If true, the timeout is skipped and the\n * test run is completed immediately. This should only be used from within\n * this function.\n */\nlib.TestManager.TestRun.prototype.onTestRunComplete_ = function(\n opt_skipTimeout) {\n if (!opt_skipTimeout) {\n // The final test may have left a lingering setTimeout(..., 0), or maybe\n // poked at the DOM in a way that will trigger a event to fire at the end\n // of this stack, so we give things a chance to settle down before our\n // final cleanup...\n setTimeout(this.onTestRunComplete_.bind(this), 0, true);\n return;\n }\n\n this.duration = (new Date()) - this.startDate;\n\n this.log.groupEnd();\n this.log.info(this.passes.length + ' passed, ' +\n this.failures.length + ' failed, ' +\n this.msToSeconds_(this.duration));\n\n this.summarize();\n\n window.onerror = null;\n\n this.testManager.onTestRunComplete(this);\n};\n\n/**\n * Called by the lib.TestManager.Result object when a test completes.\n *\n * @param {lib.TestManager.Result} result The result object which has just\n * completed.\n */\nlib.TestManager.TestRun.prototype.onResultComplete = function(result) {\n try {\n this.testManager.testPostamble(result, this.cx);\n result.suite.postamble(result, this.ctx);\n } catch (ex) {\n this.log.error('Unexpected exception in postamble: ' +\n (ex.stack ? ex.stack : ex));\n this.panic = true;\n }\n\n if (result.status != result.PASSED)\n this.log.error(result.status);\n else if (result.duration > 500)\n this.log.warn('Slow test took ' + this.msToSeconds_(result.duration));\n this.log.groupEnd();\n\n if (result.status == result.FAILED) {\n this.failures.push(result);\n this.currentSuite = null;\n } else if (result.status == result.PASSED) {\n this.passes.push(result);\n } else {\n this.log.error('Unknown result status: ' + result.test.fullName + ': ' +\n result.status);\n return this.panic = true;\n }\n\n this.runNextTest_();\n};\n\n/**\n * Called by the lib.TestManager.Result object when a test which has already\n * completed reports another completion.\n *\n * This is usually indicative of a buggy testcase. It is probably reporting a\n * result on exit and then again from an asynchronous callback.\n *\n * It may also be the case that the last act of the testcase causes a DOM change\n * which triggers some event to run after the test returns. If the event\n * handler reports a failure or raises an uncaught exception, the test will\n * fail even though it has already completed.\n *\n * In any case, re-completing a test ALWAYS moves it into the failure pile.\n *\n * @param {lib.TestManager.Result} result The result object which has just\n * completed.\n * @param {string} lateStatus The status that the test attempted to record this\n * time around.\n */\nlib.TestManager.TestRun.prototype.onResultReComplete = function(\n result, lateStatus) {\n this.log.error('Late complete for test: ' + result.test.fullName + ': ' +\n lateStatus);\n\n // Consider any late completion a failure, even if it's a double-pass, since\n // it's a misuse of the testing API.\n var index = this.passes.indexOf(result);\n if (index >= 0) {\n this.passes.splice(index, 1);\n this.failures.push(result);\n }\n};\n\n/**\n * Run the next test in the queue.\n */\nlib.TestManager.TestRun.prototype.runNextTest_ = function() {\n if (this.panic || !this.testQueue_.length)\n return this.onTestRunComplete_();\n\n if (this.maxFailures && this.failures.length >= this.maxFailures) {\n this.log.error('Maximum failure count reached, aborting test run.');\n return this.onTestRunComplete_();\n }\n\n // Peek at the top test first. We remove it later just before it's about\n // to run, so that we don't disturb the incomplete test count in the\n // event that we fail before running it.\n var test = this.testQueue_[0];\n var suite = this.currentResult ? this.currentResult.suite : null;\n\n try {\n if (!suite || !(suite instanceof test.suiteClass)) {\n if (suite)\n this.log.groupEnd();\n this.log.group(test.suiteClass.suiteName);\n suite = new test.suiteClass(this.testManager, this.cx);\n }\n } catch (ex) {\n // If test suite setup fails we're not even going to try to run the tests.\n this.log.error('Exception during setup: ' + (ex.stack ? ex.stack : ex));\n this.panic = true;\n this.onTestRunComplete_();\n return;\n }\n\n try {\n this.log.group(test.testName);\n\n this.currentResult = new lib.TestManager.Result(this, suite, test);\n this.testManager.testPreamble(this.currentResult, this.cx);\n suite.preamble(this.currentResult, this.cx);\n\n this.testQueue_.shift();\n } catch (ex) {\n this.log.error('Unexpected exception during test preamble: ' +\n (ex.stack ? ex.stack : ex));\n this.log.groupEnd();\n\n this.panic = true;\n this.onTestRunComplete_();\n return;\n }\n\n try {\n this.currentResult.run();\n } catch (ex) {\n // Result.run() should catch test exceptions and turn them into failures.\n // If we got here, it means there is trouble in the testing framework.\n this.log.error('Unexpected exception during test run: ' +\n (ex.stack ? ex.stack : ex));\n this.panic = true;\n }\n};\n\n/**\n * Run the selected list of tests.\n *\n * Some tests may need to run asynchronously, so you cannot assume the run is\n * complete when this function returns. Instead, pass in a function to be\n * called back when the run has completed.\n *\n * This function will log the results of the test run as they happen into the\n * log defined by the associated lib.TestManager. By default this is\n * console.log, which can be viewed in the JavaScript console of most browsers.\n *\n * The browser state is determined by the last test to run. We intentionally\n * don't do any cleanup so that you can inspect the state of a failed test, or\n * leave the browser ready for manual testing.\n *\n * Any failures in lib.TestManager.* code or test suite setup or test case\n * preamble will cause the test run to abort.\n */\nlib.TestManager.TestRun.prototype.run = function() {\n this.log.info('Running ' + this.testQueue_.length + ' test(s)');\n\n window.onerror = this.onUncaughtException_.bind(this);\n this.startDate = new Date();\n this.runNextTest_();\n};\n\n/**\n * Format milliseconds as fractional seconds.\n */\nlib.TestManager.TestRun.prototype.msToSeconds_ = function(ms) {\n var secs = (ms / 1000).toFixed(2);\n return secs + 's';\n};\n\n/**\n * Log the current result summary.\n */\nlib.TestManager.TestRun.prototype.summarize = function() {\n if (this.failures.length) {\n for (var i = 0; i < this.failures.length; i++) {\n this.log.error('FAILED: ' + this.failures[i].test.fullName);\n }\n }\n\n if (this.testQueue_.length) {\n this.log.warn('Test run incomplete: ' + this.testQueue_.length +\n ' test(s) were not run.');\n }\n};\n\n/**\n * Record of the result of a single test.\n *\n * These are constructed during a test run, you shouldn't have to make one\n * on your own.\n *\n * An instance of this class is passed in to each test function. It can be\n * used to add messages to the test log, to record a test pass/fail state, to\n * test assertions, or to create exception-proof wrappers for callback\n * functions.\n *\n * @param {lib.TestManager.TestRun} testRun The TestRun instance associated with\n * this result.\n * @param {lib.TestManager.Suit} suite The Suite containing the test we're\n * collecting this result for.\n * @param {lib.TestManager.Test} test The test we're collecting this result for.\n */\nlib.TestManager.Result = function(testRun, suite, test) {\n /**\n * The TestRun instance associated with this result.\n */\n this.testRun = testRun;\n\n /**\n * The Suite containing the test we're collecting this result for.\n */\n this.suite = suite;\n\n /**\n * The test we're collecting this result for.\n */\n this.test = test;\n\n /**\n * The time we started to collect this result, or null if we haven't started.\n */\n this.startDate = null;\n\n /**\n * The time in milliseconds that the test took to complete, or null if\n * it hasn't completed yet.\n */\n this.duration = null;\n\n /**\n * The current status of this test result.\n */\n this.status = this.PENDING;\n\n // An error message that the test case is expected to generate.\n this.expectedErrorMessage_ = null;\n};\n\n/**\n * Possible values for this.status.\n */\nlib.TestManager.Result.prototype.PENDING = 'pending';\nlib.TestManager.Result.prototype.FAILED = 'FAILED';\nlib.TestManager.Result.prototype.PASSED = 'passed';\n\n/**\n * Exception thrown when a test completes (pass or fail), to ensure no more of\n * the test is run.\n */\nlib.TestManager.Result.TestComplete = function(result) {\n this.result = result;\n};\n\nlib.TestManager.Result.TestComplete.prototype.toString = function() {\n return 'lib.TestManager.Result.TestComplete: ' + this.result.test.fullName +\n ', status: ' + this.result.status;\n}\n\n/**\n * Start the test associated with this result.\n */\nlib.TestManager.Result.prototype.run = function() {\n var self = this;\n\n this.startDate = new Date();\n this.test.run(this);\n\n if (this.status == this.PENDING && !this.timeout_) {\n this.println('Test did not return a value and did not request more time.');\n this.completeTest_(this.FAILED, false);\n }\n};\n\n/**\n * Unhandled error message this test expects to generate.\n *\n * This must be the exact string that would appear in the JavaScript console,\n * minus the 'Uncaught ' prefix.\n *\n * The test case does *not* automatically fail if the error message is not\n * encountered.\n */\nlib.TestManager.Result.prototype.expectErrorMessage = function(str) {\n this.expectedErrorMessage_ = str;\n};\n\n/**\n * Function called when a test times out.\n */\nlib.TestManager.Result.prototype.onTimeout_ = function() {\n this.timeout_ = null;\n\n if (this.status != this.PENDING)\n return;\n\n this.println('Test timed out.');\n this.completeTest_(this.FAILED, false);\n};\n\n/**\n * Indicate that a test case needs more time to complete.\n *\n * Before a test case returns it must report a pass/fail result, or request more\n * time to do so.\n *\n * If a test does not report pass/fail before the time expires it will\n * be reported as a timeout failure. Any late pass/fails will be noted in the\n * test log, but will not affect the final result of the test.\n *\n * Test cases may call requestTime more than once. If you have a few layers\n * of asynchronous API to go through, you should call this once per layer with\n * an estimate of how long each callback will take to complete.\n *\n * @param {int} ms Number of milliseconds requested.\n */\nlib.TestManager.Result.prototype.requestTime = function(ms) {\n if (this.timeout_)\n clearTimeout(this.timeout_);\n\n this.timeout_ = setTimeout(this.onTimeout_.bind(this), ms);\n};\n\n/**\n * Report the completion of a test.\n *\n * @param {string} status The status of the test case.\n * @param {boolean} opt_throw Optional boolean indicating whether or not\n * to throw the TestComplete exception.\n */\nlib.TestManager.Result.prototype.completeTest_ = function(status, opt_throw) {\n if (this.status == this.PENDING) {\n this.duration = (new Date()) - this.startDate;\n this.status = status;\n\n this.testRun.onResultComplete(this);\n } else {\n this.testRun.onResultReComplete(this, status);\n }\n\n if (arguments.length < 2 || opt_throw)\n throw new lib.TestManager.Result.TestComplete(this);\n};\n\n/**\n * Check that two arrays are equal.\n */\nlib.TestManager.Result.prototype.arrayEQ_ = function(actual, expected) {\n if (!actual || !expected)\n return (!actual && !expected);\n\n if (actual.length != expected.length)\n return false;\n\n for (var i = 0; i < actual.length; ++i)\n if (actual[i] != expected[i])\n return false;\n\n return true;\n};\n\n/**\n * Assert that an actual value is exactly equal to the expected value.\n *\n * This uses the JavaScript '===' operator in order to avoid type coercion.\n *\n * If the assertion fails, the test is marked as a failure and a TestCompleted\n * exception is thrown.\n *\n * @param {*} actual The actual measured value.\n * @param {*} expected The value expected.\n * @param {string} opt_name An optional name used to identify this\n * assertion in the test log. If omitted it will be the file:line\n * of the caller.\n */\nlib.TestManager.Result.prototype.assertEQ = function(\n actual, expected, opt_name) {\n // Utility function to pretty up the log.\n function format(value) {\n if (typeof value == 'number')\n return value;\n\n var str = String(value);\n var ary = str.split('\\n').map(function (e) { return JSON.stringify(e) });\n if (ary.length > 1) {\n // If the string has newlines, start it off on its own line so that\n // it's easier to compare against another string with newlines.\n return '\\n' + ary.join('\\n');\n } else {\n return ary.join('\\n');\n }\n }\n\n if (actual === expected)\n return;\n\n // Deal with common object types since JavaScript can't.\n if (expected instanceof Array)\n if (this.arrayEQ_(actual, expected))\n return;\n\n var name = opt_name ? '[' + opt_name + ']' : '';\n\n this.fail('assertEQ' + name + ': ' + this.getCallerLocation_(1) + ': ' +\n format(actual) + ' !== ' + format(expected));\n};\n\n/**\n * Assert that a value is true.\n *\n * This uses the JavaScript '===' operator in order to avoid type coercion.\n * The must be the boolean value `true`, not just some \"truish\" value.\n *\n * If the assertion fails, the test is marked as a failure and a TestCompleted\n * exception is thrown.\n *\n * @param {boolean} actual The actual measured value.\n * @param {string} opt_name An optional name used to identify this\n * assertion in the test log. If omitted it will be the file:line\n * of the caller.\n */\nlib.TestManager.Result.prototype.assert = function(actual, opt_name) {\n if (actual === true)\n return;\n\n var name = opt_name ? '[' + opt_name + ']' : '';\n\n this.fail('assert' + name + ': ' + this.getCallerLocation_(1) + ': ' +\n String(actual));\n};\n\n/**\n * Return the filename:line of a calling stack frame.\n *\n * This uses a dirty hack. It throws an exception, catches it, and examines\n * the stack property of the caught exception.\n *\n * @param {int} frameIndex The stack frame to return. 0 is the frame that\n * called this method, 1 is its caller, and so on.\n * @return {string} A string of the format \"filename:linenumber\".\n */\nlib.TestManager.Result.prototype.getCallerLocation_ = function(frameIndex) {\n try {\n throw new Error();\n } catch (ex) {\n var frame = ex.stack.split('\\n')[frameIndex + 2];\n var ary = frame.match(/([^/]+:\\d+):\\d+\\)?$/);\n return ary ? ary[1] : '???';\n }\n};\n\n/**\n * Write a message to the result log.\n */\nlib.TestManager.Result.prototype.println = function(message) {\n this.testRun.log.info(message);\n};\n\n/**\n * Mark a failed test and exit out of the rest of the test.\n *\n * This will throw a TestCompleted exception, causing the current test to stop.\n *\n * @param {string} opt_message Optional message to add to the log.\n */\nlib.TestManager.Result.prototype.fail = function(opt_message) {\n if (arguments.length)\n this.println(opt_message);\n\n this.completeTest_(this.FAILED, true);\n};\n\n/**\n * Mark a passed test and exit out of the rest of the test.\n *\n * This will throw a TestCompleted exception, causing the current test to stop.\n */\nlib.TestManager.Result.prototype.pass = function() {\n this.completeTest_(this.PASSED, true);\n};\n// SOURCE FILE: libdot/js/lib_utf8.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n// TODO(davidben): When the string encoding API is implemented,\n// replace this with the native in-browser implementation.\n//\n// https://wiki.whatwg.org/wiki/StringEncoding\n// https://encoding.spec.whatwg.org/\n\n/**\n * A stateful UTF-8 decoder.\n */\nlib.UTF8Decoder = function() {\n // The number of bytes left in the current sequence.\n this.bytesLeft = 0;\n // The in-progress code point being decoded, if bytesLeft > 0.\n this.codePoint = 0;\n // The lower bound on the final code point, if bytesLeft > 0.\n this.lowerBound = 0;\n};\n\n/**\n * Decodes a some UTF-8 data, taking into account state from previous\n * data streamed through the encoder.\n *\n * @param {String} str data to decode, represented as a JavaScript\n * String with each code unit representing a byte between 0x00 to\n * 0xFF.\n * @return {String} The data decoded into a JavaScript UTF-16 string.\n */\nlib.UTF8Decoder.prototype.decode = function(str) {\n var ret = '';\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (this.bytesLeft == 0) {\n if (c <= 0x7F) {\n ret += str.charAt(i);\n } else if (0xC0 <= c && c <= 0xDF) {\n this.codePoint = c - 0xC0;\n this.bytesLeft = 1;\n this.lowerBound = 0x80;\n } else if (0xE0 <= c && c <= 0xEF) {\n this.codePoint = c - 0xE0;\n this.bytesLeft = 2;\n this.lowerBound = 0x800;\n } else if (0xF0 <= c && c <= 0xF7) {\n this.codePoint = c - 0xF0;\n this.bytesLeft = 3;\n this.lowerBound = 0x10000;\n } else if (0xF8 <= c && c <= 0xFB) {\n this.codePoint = c - 0xF8;\n this.bytesLeft = 4;\n this.lowerBound = 0x200000;\n } else if (0xFC <= c && c <= 0xFD) {\n this.codePoint = c - 0xFC;\n this.bytesLeft = 5;\n this.lowerBound = 0x4000000;\n } else {\n ret += '\\ufffd';\n }\n } else {\n if (0x80 <= c && c <= 0xBF) {\n this.bytesLeft--;\n this.codePoint = (this.codePoint << 6) + (c - 0x80);\n if (this.bytesLeft == 0) {\n // Got a full sequence. Check if it's within bounds and\n // filter out surrogate pairs.\n var codePoint = this.codePoint;\n if (codePoint < this.lowerBound\n || (0xD800 <= codePoint && codePoint <= 0xDFFF)\n || codePoint > 0x10FFFF) {\n ret += '\\ufffd';\n } else {\n // Encode as UTF-16 in the output.\n if (codePoint < 0x10000) {\n ret += String.fromCharCode(codePoint);\n } else {\n // Surrogate pair.\n codePoint -= 0x10000;\n ret += String.fromCharCode(\n 0xD800 + ((codePoint >>> 10) & 0x3FF),\n 0xDC00 + (codePoint & 0x3FF));\n }\n }\n }\n } else {\n // Too few bytes in multi-byte sequence. Rewind stream so we\n // don't lose the next byte.\n ret += '\\ufffd';\n this.bytesLeft = 0;\n i--;\n }\n }\n }\n return ret;\n};\n\n/**\n * Decodes UTF-8 data. This is a convenience function for when all the\n * data is already known.\n *\n * @param {String} str data to decode, represented as a JavaScript\n * String with each code unit representing a byte between 0x00 to\n * 0xFF.\n * @return {String} The data decoded into a JavaScript UTF-16 string.\n */\nlib.decodeUTF8 = function(utf8) {\n return (new lib.UTF8Decoder()).decode(utf8);\n};\n\n/**\n * Encodes a UTF-16 string into UTF-8.\n *\n * TODO(davidben): Do we need a stateful version of this that can\n * handle a surrogate pair split in two calls? What happens if a\n * keypress event would have contained a character outside the BMP?\n *\n * @param {String} str The string to encode.\n * @return {String} The string encoded as UTF-8, as a JavaScript\n * string with bytes represented as code units from 0x00 to 0xFF.\n */\nlib.encodeUTF8 = function(str) {\n var ret = '';\n for (var i = 0; i < str.length; i++) {\n // Get a unicode code point out of str.\n var c = str.charCodeAt(i);\n if (0xDC00 <= c && c <= 0xDFFF) {\n c = 0xFFFD;\n } else if (0xD800 <= c && c <= 0xDBFF) {\n if (i+1 < str.length) {\n var d = str.charCodeAt(i+1);\n if (0xDC00 <= d && d <= 0xDFFF) {\n // Swallow a surrogate pair.\n c = 0x10000 + ((c & 0x3FF) << 10) + (d & 0x3FF);\n i++;\n } else {\n c = 0xFFFD;\n }\n } else {\n c = 0xFFFD;\n }\n }\n\n // Encode c in UTF-8.\n var bytesLeft;\n if (c <= 0x7F) {\n ret += str.charAt(i);\n continue;\n } else if (c <= 0x7FF) {\n ret += String.fromCharCode(0xC0 | (c >>> 6));\n bytesLeft = 1;\n } else if (c <= 0xFFFF) {\n ret += String.fromCharCode(0xE0 | (c >>> 12));\n bytesLeft = 2;\n } else /* if (c <= 0x10FFFF) */ {\n ret += String.fromCharCode(0xF0 | (c >>> 18));\n bytesLeft = 3;\n }\n\n while (bytesLeft > 0) {\n bytesLeft--;\n ret += String.fromCharCode(0x80 | ((c >>> (6 * bytesLeft)) & 0x3F));\n }\n }\n return ret;\n};\n// SOURCE FILE: libdot/third_party/wcwidth/lib_wc.js\n// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.\n// Use of lib.wc source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * This JavaScript library is ported from the wcwidth.js module of node.js.\n * The original implementation can be found at:\n * https://npmjs.org/package/wcwidth.js\n */\n\n/**\n * JavaScript porting of Markus Kuhn's wcwidth() implementation\n *\n * The following explanation comes from the original C implementation:\n *\n * This is an implementation of wcwidth() and wcswidth() (defined in\n * IEEE Std 1002.1-2001) for Unicode.\n *\n * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html\n * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html\n *\n * In fixed-width output devices, Latin characters all occupy a single\n * \"cell\" position of equal width, whereas ideographic CJK characters\n * occupy two such cells. Interoperability between terminal-line\n * applications and (teletype-style) character terminals using the\n * UTF-8 encoding requires agreement on which character should advance\n * the cursor by how many cell positions. No established formal\n * standards exist at present on which Unicode character shall occupy\n * how many cell positions on character terminals. These routines are\n * a first attempt of defining such behavior based on simple rules\n * applied to data provided by the Unicode Consortium.\n *\n * For some graphical characters, the Unicode standard explicitly\n * defines a character-cell width via the definition of the East Asian\n * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.\n * In all these cases, there is no ambiguity about which width a\n * terminal shall use. For characters in the East Asian Ambiguous (A)\n * class, the width choice depends purely on a preference of backward\n * compatibility with either historic CJK or Western practice.\n * Choosing single-width for these characters is easy to justify as\n * the appropriate long-term solution, as the CJK practice of\n * displaying these characters as double-width comes from historic\n * implementation simplicity (8-bit encoded characters were displayed\n * single-width and 16-bit ones double-width, even for Greek,\n * Cyrillic, etc.) and not any typographic considerations.\n *\n * Much less clear is the choice of width for the Not East Asian\n * (Neutral) class. Existing practice does not dictate a width for any\n * of these characters. It would nevertheless make sense\n * typographically to allocate two character cells to characters such\n * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be\n * represented adequately with a single-width glyph. The following\n * routines at present merely assign a single-cell width to all\n * neutral characters, in the interest of simplicity. This is not\n * entirely satisfactory and should be reconsidered before\n * establishing a formal standard in lib.wc area. At the moment, the\n * decision which Not East Asian (Neutral) characters should be\n * represented by double-width glyphs cannot yet be answered by\n * applying a simple rule from the Unicode database content. Setting\n * up a proper standard for the behavior of UTF-8 character terminals\n * will require a careful analysis not only of each Unicode character,\n * but also of each presentation form, something the author of these\n * routines has avoided to do so far.\n *\n * http://www.unicode.org/unicode/reports/tr11/\n *\n * Markus Kuhn -- 2007-05-26 (Unicode 5.0)\n *\n * Permission to use, copy, modify, and distribute lib.wc software\n * for any purpose and without fee is hereby granted. The author\n * disclaims all warranties with regard to lib.wc software.\n *\n * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c\n */\n\n/**\n * The following function defines the column width of an ISO 10646 character\n * as follows:\n *\n * - The null character (U+0000) has a column width of 0.\n * - Other C0/C1 control characters and DEL will lead to a return value of -1.\n * - Non-spacing and enclosing combining characters (general category code Mn\n * or Me in the Unicode database) have a column width of 0.\n * - SOFT HYPHEN (U+00AD) has a column width of 1.\n * - Other format characters (general category code Cf in the Unicode database)\n * and ZERO WIDTH SPACE (U+200B) have a column width of 0.\n * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) have a\n * column width of 0.\n * - Spacing characters in the East Asian Wide (W) or East Asian Full-width (F)\n * category as defined in Unicode Technical Report #11 have a column width of\n * 2.\n * - East Asian Ambiguous characters are taken into account if\n * regardCjkAmbiguous flag is enabled. They have a column width of 2.\n * - All remaining characters (including all printable ISO 8859-1 and WGL4\n * characters, Unicode control characters, etc.) have a column width of 1.\n *\n * This implementation assumes that characters are encoded in ISO 10646.\n */\n\nlib.wc = {};\n\n// Width of a nul character.\nlib.wc.nulWidth = 0;\n\n// Width of a control character.\nlib.wc.controlWidth = 0;\n\n// Flag whether to consider East Asian Ambiguous characters.\nlib.wc.regardCjkAmbiguous = false;\n\n// Width of an East Asian Ambiguous character.\nlib.wc.cjkAmbiguousWidth = 2;\n\n// Sorted list of non-overlapping intervals of non-spacing characters\n// generated by \"uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c\"\nlib.wc.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 [ 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// Sorted list of non-overlapping intervals of East Asian Ambiguous characters\n// generated by \"uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c\"\nlib.wc.ambiguous = [\n [ 0x00A1, 0x00A1 ], [ 0x00A4, 0x00A4 ], [ 0x00A7, 0x00A8 ],\n [ 0x00AA, 0x00AA ], [ 0x00AE, 0x00AE ], [ 0x00B0, 0x00B4 ],\n [ 0x00B6, 0x00BA ], [ 0x00BC, 0x00BF ], [ 0x00C6, 0x00C6 ],\n [ 0x00D0, 0x00D0 ], [ 0x00D7, 0x00D8 ], [ 0x00DE, 0x00E1 ],\n [ 0x00E6, 0x00E6 ], [ 0x00E8, 0x00EA ], [ 0x00EC, 0x00ED ],\n [ 0x00F0, 0x00F0 ], [ 0x00F2, 0x00F3 ], [ 0x00F7, 0x00FA ],\n [ 0x00FC, 0x00FC ], [ 0x00FE, 0x00FE ], [ 0x0101, 0x0101 ],\n [ 0x0111, 0x0111 ], [ 0x0113, 0x0113 ], [ 0x011B, 0x011B ],\n [ 0x0126, 0x0127 ], [ 0x012B, 0x012B ], [ 0x0131, 0x0133 ],\n [ 0x0138, 0x0138 ], [ 0x013F, 0x0142 ], [ 0x0144, 0x0144 ],\n [ 0x0148, 0x014B ], [ 0x014D, 0x014D ], [ 0x0152, 0x0153 ],\n [ 0x0166, 0x0167 ], [ 0x016B, 0x016B ], [ 0x01CE, 0x01CE ],\n [ 0x01D0, 0x01D0 ], [ 0x01D2, 0x01D2 ], [ 0x01D4, 0x01D4 ],\n [ 0x01D6, 0x01D6 ], [ 0x01D8, 0x01D8 ], [ 0x01DA, 0x01DA ],\n [ 0x01DC, 0x01DC ], [ 0x0251, 0x0251 ], [ 0x0261, 0x0261 ],\n [ 0x02C4, 0x02C4 ], [ 0x02C7, 0x02C7 ], [ 0x02C9, 0x02CB ],\n [ 0x02CD, 0x02CD ], [ 0x02D0, 0x02D0 ], [ 0x02D8, 0x02DB ],\n [ 0x02DD, 0x02DD ], [ 0x02DF, 0x02DF ], [ 0x0391, 0x03A1 ],\n [ 0x03A3, 0x03A9 ], [ 0x03B1, 0x03C1 ], [ 0x03C3, 0x03C9 ],\n [ 0x0401, 0x0401 ], [ 0x0410, 0x044F ], [ 0x0451, 0x0451 ],\n [ 0x2010, 0x2010 ], [ 0x2013, 0x2016 ], [ 0x2018, 0x2019 ],\n [ 0x201C, 0x201D ], [ 0x2020, 0x2022 ], [ 0x2024, 0x2027 ],\n [ 0x2030, 0x2030 ], [ 0x2032, 0x2033 ], [ 0x2035, 0x2035 ],\n [ 0x203B, 0x203B ], [ 0x203E, 0x203E ], [ 0x2074, 0x2074 ],\n [ 0x207F, 0x207F ], [ 0x2081, 0x2084 ], [ 0x20AC, 0x20AC ],\n [ 0x2103, 0x2103 ], [ 0x2105, 0x2105 ], [ 0x2109, 0x2109 ],\n [ 0x2113, 0x2113 ], [ 0x2116, 0x2116 ], [ 0x2121, 0x2122 ],\n [ 0x2126, 0x2126 ], [ 0x212B, 0x212B ], [ 0x2153, 0x2154 ],\n [ 0x215B, 0x215E ], [ 0x2160, 0x216B ], [ 0x2170, 0x2179 ],\n [ 0x2190, 0x2199 ], [ 0x21B8, 0x21B9 ], [ 0x21D2, 0x21D2 ],\n [ 0x21D4, 0x21D4 ], [ 0x21E7, 0x21E7 ], [ 0x2200, 0x2200 ],\n [ 0x2202, 0x2203 ], [ 0x2207, 0x2208 ], [ 0x220B, 0x220B ],\n [ 0x220F, 0x220F ], [ 0x2211, 0x2211 ], [ 0x2215, 0x2215 ],\n [ 0x221A, 0x221A ], [ 0x221D, 0x2220 ], [ 0x2223, 0x2223 ],\n [ 0x2225, 0x2225 ], [ 0x2227, 0x222C ], [ 0x222E, 0x222E ],\n [ 0x2234, 0x2237 ], [ 0x223C, 0x223D ], [ 0x2248, 0x2248 ],\n [ 0x224C, 0x224C ], [ 0x2252, 0x2252 ], [ 0x2260, 0x2261 ],\n [ 0x2264, 0x2267 ], [ 0x226A, 0x226B ], [ 0x226E, 0x226F ],\n [ 0x2282, 0x2283 ], [ 0x2286, 0x2287 ], [ 0x2295, 0x2295 ],\n [ 0x2299, 0x2299 ], [ 0x22A5, 0x22A5 ], [ 0x22BF, 0x22BF ],\n [ 0x2312, 0x2312 ], [ 0x2460, 0x24E9 ], [ 0x24EB, 0x254B ],\n [ 0x2550, 0x2573 ], [ 0x2580, 0x258F ], [ 0x2592, 0x2595 ],\n [ 0x25A0, 0x25A1 ], [ 0x25A3, 0x25A9 ], [ 0x25B2, 0x25B3 ],\n [ 0x25B6, 0x25B7 ], [ 0x25BC, 0x25BD ], [ 0x25C0, 0x25C1 ],\n [ 0x25C6, 0x25C8 ], [ 0x25CB, 0x25CB ], [ 0x25CE, 0x25D1 ],\n [ 0x25E2, 0x25E5 ], [ 0x25EF, 0x25EF ], [ 0x2605, 0x2606 ],\n [ 0x2609, 0x2609 ], [ 0x260E, 0x260F ], [ 0x2614, 0x2615 ],\n [ 0x261C, 0x261C ], [ 0x261E, 0x261E ], [ 0x2640, 0x2640 ],\n [ 0x2642, 0x2642 ], [ 0x2660, 0x2661 ], [ 0x2663, 0x2665 ],\n [ 0x2667, 0x266A ], [ 0x266C, 0x266D ], [ 0x266F, 0x266F ],\n [ 0x273D, 0x273D ], [ 0x2776, 0x277F ], [ 0xE000, 0xF8FF ],\n [ 0xFFFD, 0xFFFD ], [ 0xF0000, 0xFFFFD ], [ 0x100000, 0x10FFFD ]\n];\n\n/**\n * Binary search to check if the given unicode character is a space character.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {boolean} True if the given character is a space character; false\n * otherwise.\n */\nlib.wc.isSpace = function(ucs) {\n // Auxiliary function for binary search in interval table.\n var min = 0, max = lib.wc.combining.length - 1;\n var mid;\n\n if (ucs < lib.wc.combining[0][0] || ucs > lib.wc.combining[max][1])\n return false;\n while (max >= min) {\n mid = Math.floor((min + max) / 2);\n if (ucs > lib.wc.combining[mid][1]) {\n min = mid + 1;\n } else if (ucs < lib.wc.combining[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * Auxiliary function for checking if the given unicode character is a East\n * Asian Ambiguous character.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {boolean} True if the given character is a East Asian Ambiguous\n * character.\n */\nlib.wc.isCjkAmbiguous = function(ucs) {\n var min = 0, max = lib.wc.ambiguous.length - 1;\n var mid;\n\n if (ucs < lib.wc.ambiguous[0][0] || ucs > lib.wc.ambiguous[max][1])\n return false;\n while (max >= min) {\n mid = Math.floor((min + max) / 2);\n if (ucs > lib.wc.ambiguous[mid][1]) {\n min = mid + 1;\n } else if (ucs < lib.wc.ambiguous[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * Determine the column width of the given character.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {integer} The column width of the given character.\n */\nlib.wc.charWidth = function(ucs) {\n if (lib.wc.regardCjkAmbiguous) {\n return lib.wc.charWidthRegardAmbiguous(ucs);\n } else {\n return lib.wc.charWidthDisregardAmbiguous(ucs);\n }\n};\n\n/**\n * Determine the column width of the given character without considering East\n * Asian Ambiguous characters.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {integer} The column width of the given character.\n */\nlib.wc.charWidthDisregardAmbiguous = function(ucs) {\n // Test for 8-bit control characters.\n if (ucs === 0)\n return lib.wc.nulWidth;\n if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))\n return lib.wc.controlWidth;\n\n // Optimize for ASCII characters.\n if (ucs < 0x7f)\n return 1;\n\n // Binary search in table of non-spacing characters.\n if (lib.wc.isSpace(ucs))\n return 0;\n\n // If we arrive here, ucs is not a combining or C0/C1 control character.\n return 1 +\n (ucs >= 0x1100 &&\n (ucs <= 0x115f || // Hangul Jamo init. consonants\n ucs == 0x2329 || ucs == 0x232a ||\n (ucs >= 0x2e80 && ucs <= 0xa4cf &&\n ucs != 0x303f) || // CJK ... Yi\n (ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables\n (ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compatibility Ideographs\n (ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms\n (ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compatibility Forms\n (ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms\n (ucs >= 0xffe0 && ucs <= 0xffe6) ||\n (ucs >= 0x20000 && ucs <= 0x2fffd) ||\n (ucs >= 0x30000 && ucs <= 0x3fffd)));\n // TODO: emoji characters usually require space for wide characters although\n // East Asian width spec says nothing. Should we add special cases for them?\n};\n\n/**\n * Determine the column width of the given character considering East Asian\n * Ambiguous characters.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {integer} The column width of the given character.\n */\nlib.wc.charWidthRegardAmbiguous = function(ucs) {\n if (lib.wc.isCjkAmbiguous(ucs))\n return lib.wc.cjkAmbiguousWidth;\n\n return lib.wc.charWidthDisregardAmbiguous(ucs);\n};\n\n/**\n * Determine the column width of the given string.\n *\n * @param {string} str A string.\n *\n * @return {integer} The column width of the given string.\n */\nlib.wc.strWidth = function(str) {\n var width, rv = 0;\n\n for (var i = 0; i < str.length;) {\n var codePoint = str.codePointAt(i);\n width = lib.wc.charWidth(codePoint);\n if (width < 0)\n return -1;\n rv += width;\n i += (codePoint <= 0xffff) ? 1 : 2;\n }\n\n return rv;\n};\n\n/**\n * Get the substring at the given column offset of the given column width.\n *\n * @param {string} str The string to get substring from.\n * @param {integer} start The starting column offset to get substring.\n * @param {integer} opt_width The column width of the substring.\n *\n * @return {string} The substring.\n */\nlib.wc.substr = function(str, start, opt_width) {\n var startIndex, endIndex, width;\n\n for (startIndex = 0, width = 0; startIndex < str.length; startIndex++) {\n width += lib.wc.charWidth(str.charCodeAt(startIndex));\n if (width > start)\n break;\n }\n\n if (opt_width != undefined) {\n for (endIndex = startIndex, width = 0;\n endIndex < str.length && width <= opt_width;\n width += lib.wc.charWidth(str.charCodeAt(endIndex)), endIndex++);\n if (width > opt_width)\n endIndex--;\n return str.substring(startIndex, endIndex);\n }\n\n return str.substr(startIndex);\n};\n\n/**\n * Get substring at the given start and end column offset.\n *\n * @param {string} str The string to get substring from.\n * @param {integer} start The starting column offset.\n * @param {integer} end The ending column offset.\n *\n * @return {string} The substring.\n */\nlib.wc.substring = function(str, start, end) {\n return lib.wc.substr(str, start, end - start);\n};\nlib.resource.add('libdot/changelog/version', 'text/plain',\n'1.16' +\n''\n);\n\nlib.resource.add('libdot/changelog/date', 'text/plain',\n'2017-08-16' +\n''\n);\n\n// SOURCE FILE: hterm/js/hterm.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.Storage');\n\n/**\n * @fileoverview Declares the hterm.* namespace and some basic shared utilities\n * that are too small to deserve dedicated files.\n */\nvar hterm = {};\n\n/**\n * The type of window hosting hterm.\n *\n * This is set as part of hterm.init(). The value is invalid until\n * initialization completes.\n */\nhterm.windowType = null;\n\n/**\n * Warning message to display in the terminal when browser zoom is enabled.\n *\n * You can replace it with your own localized message.\n */\nhterm.zoomWarningMessage = 'ZOOM != 100%';\n\n/**\n * Brief overlay message displayed when text is copied to the clipboard.\n *\n * By default it is the unicode BLACK SCISSORS character, but you can\n * replace it with your own localized message.\n *\n * This is only displayed when the 'enable-clipboard-notice' preference\n * is enabled.\n */\nhterm.notifyCopyMessage = '\\u2702';\n\n\n/**\n * Text shown in a desktop notification for the terminal\n * bell. \\u226a is a unicode EIGHTH NOTE, %(title) will\n * be replaced by the terminal title.\n */\nhterm.desktopNotificationTitle = '\\u266A %(title) \\u266A';\n\n/**\n * List of known hterm test suites.\n *\n * A test harness should ensure that they all exist before running.\n */\nhterm.testDeps = ['hterm.ScrollPort.Tests', 'hterm.Screen.Tests',\n 'hterm.Terminal.Tests', 'hterm.VT.Tests',\n 'hterm.VT.CannedTests'];\n\n/**\n * The hterm init function, registered with lib.registerInit().\n *\n * This is called during lib.init().\n *\n * @param {function} onInit The function lib.init() wants us to invoke when\n * initialization is complete.\n */\nlib.registerInit('hterm', function(onInit) {\n function onWindow(window) {\n hterm.windowType = window.type;\n setTimeout(onInit, 0);\n }\n\n function onTab(tab) {\n if (tab && window.chrome) {\n chrome.windows.get(tab.windowId, null, onWindow);\n } else {\n // TODO(rginda): This is where we end up for a v1 app's background page.\n // Maybe windowType = 'none' would be more appropriate, or something.\n hterm.windowType = 'normal';\n setTimeout(onInit, 0);\n }\n }\n\n if (!hterm.defaultStorage) {\n if (window.chrome && chrome.storage && chrome.storage.sync) {\n hterm.defaultStorage = new lib.Storage.Chrome(chrome.storage.sync);\n } else {\n hterm.defaultStorage = new lib.Storage.Local();\n }\n }\n\n // The chrome.tabs API is not supported in packaged apps, and detecting if\n // you're a packaged app is a little awkward.\n var isPackagedApp = false;\n if (window.chrome && chrome.runtime && chrome.runtime.getManifest) {\n var manifest = chrome.runtime.getManifest();\n isPackagedApp = manifest.app && manifest.app.background;\n }\n\n if (isPackagedApp) {\n // Packaged apps are never displayed in browser tabs.\n setTimeout(onWindow.bind(null, {type: 'popup'}), 0);\n } else {\n if (window.chrome && chrome.tabs) {\n // The getCurrent method gets the tab that is \"currently running\", not the\n // topmost or focused tab.\n chrome.tabs.getCurrent(onTab);\n } else {\n setTimeout(onWindow.bind(null, {type: 'normal'}), 0);\n }\n }\n});\n\n/**\n * Return decimal { width, height } for a given dom node.\n */\nhterm.getClientSize = function(dom) {\n return dom.getBoundingClientRect();\n};\n\n/**\n * Return decimal width for a given dom node.\n */\nhterm.getClientWidth = function(dom) {\n return dom.getBoundingClientRect().width;\n};\n\n/**\n * Return decimal height for a given dom node.\n */\nhterm.getClientHeight = function(dom) {\n return dom.getBoundingClientRect().height;\n};\n\n/**\n * Copy the current selection to the system clipboard.\n *\n * @param {HTMLDocument} The document with the selection to copy.\n */\nhterm.copySelectionToClipboard = function(document) {\n try {\n document.execCommand('copy');\n } catch (firefoxException) {\n // Ignore this. FF throws an exception if there was an error, even though\n // the spec says just return false.\n }\n};\n\n/**\n * Paste the system clipboard into the element with focus.\n *\n * Note: In Chrome/Firefox app/extension environments, you'll need the\n * \"clipboardRead\" permission. In other environments, this might always\n * fail as the browser frequently blocks access for security reasons.\n *\n * @param {HTMLDocument} The document to paste into.\n * @return {boolean} True if the paste succeeded.\n */\nhterm.pasteFromClipboard = function(document) {\n try {\n return document.execCommand('paste');\n } catch (firefoxException) {\n // Ignore this. FF 40 and older would incorrectly throw an exception if\n // there was an error instead of returning false.\n return false;\n }\n};\n\n/**\n * Create a new notification.\n *\n * @param {Object} params Various parameters for the notification.\n * @param {string} params.title The title (defaults to the window's title).\n * @param {string} params.body The message body (main text).\n */\nhterm.notify = function(params) {\n var def = (curr, fallback) => curr !== undefined ? curr : fallback;\n if (params === undefined || params === null)\n params = {};\n\n // Merge the user's choices with the default settings. We don't take it\n // directly in case it was stuffed with excess junk.\n var options = {\n 'body': params.body,\n 'icon': def(params.icon, lib.resource.getDataUrl('hterm/images/icon-96')),\n }\n\n var title = def(params.title, window.document.title);\n if (!title)\n title = 'hterm';\n title = lib.f.replaceVars(hterm.desktopNotificationTitle, {'title': title});\n\n var n = new Notification(title, options);\n n.onclick = function() {\n window.focus();\n this.close();\n };\n return n;\n};\n\n/**\n * Constructor for a hterm.Size record.\n *\n * Instances of this class have public read/write members for width and height.\n *\n * @param {integer} width The width of this record.\n * @param {integer} height The height of this record.\n */\nhterm.Size = function(width, height) {\n this.width = width;\n this.height = height;\n};\n\n/**\n * Adjust the width and height of this record.\n *\n * @param {integer} width The new width of this record.\n * @param {integer} height The new height of this record.\n */\nhterm.Size.prototype.resize = function(width, height) {\n this.width = width;\n this.height = height;\n};\n\n/**\n * Return a copy of this record.\n *\n * @return {hterm.Size} A new hterm.Size instance with the same width and\n * height.\n */\nhterm.Size.prototype.clone = function() {\n return new hterm.Size(this.width, this.height);\n};\n\n/**\n * Set the height and width of this instance based on another hterm.Size.\n *\n * @param {hterm.Size} that The object to copy from.\n */\nhterm.Size.prototype.setTo = function(that) {\n this.width = that.width;\n this.height = that.height;\n};\n\n/**\n * Test if another hterm.Size instance is equal to this one.\n *\n * @param {hterm.Size} that The other hterm.Size instance.\n * @return {boolean} True if both instances have the same width/height, false\n * otherwise.\n */\nhterm.Size.prototype.equals = function(that) {\n return this.width == that.width && this.height == that.height;\n};\n\n/**\n * Return a string representation of this instance.\n *\n * @return {string} A string that identifies the width and height of this\n * instance.\n */\nhterm.Size.prototype.toString = function() {\n return '[hterm.Size: ' + this.width + ', ' + this.height + ']';\n};\n\n/**\n * Constructor for a hterm.RowCol record.\n *\n * Instances of this class have public read/write members for row and column.\n *\n * This class includes an 'overflow' bit which is use to indicate that an\n * attempt has been made to move the cursor column passed the end of the\n * screen. When this happens we leave the cursor column set to the last column\n * of the screen but set the overflow bit. In this state cursor movement\n * happens normally, but any attempt to print new characters causes a cr/lf\n * first.\n *\n * @param {integer} row The row of this record.\n * @param {integer} column The column of this record.\n * @param {boolean} opt_overflow Optional boolean indicating that the RowCol\n * has overflowed.\n */\nhterm.RowCol = function(row, column, opt_overflow) {\n this.row = row;\n this.column = column;\n this.overflow = !!opt_overflow;\n};\n\n/**\n * Adjust the row and column of this record.\n *\n * @param {integer} row The new row of this record.\n * @param {integer} column The new column of this record.\n * @param {boolean} opt_overflow Optional boolean indicating that the RowCol\n * has overflowed.\n */\nhterm.RowCol.prototype.move = function(row, column, opt_overflow) {\n this.row = row;\n this.column = column;\n this.overflow = !!opt_overflow;\n};\n\n/**\n * Return a copy of this record.\n *\n * @return {hterm.RowCol} A new hterm.RowCol instance with the same row and\n * column.\n */\nhterm.RowCol.prototype.clone = function() {\n return new hterm.RowCol(this.row, this.column, this.overflow);\n};\n\n/**\n * Set the row and column of this instance based on another hterm.RowCol.\n *\n * @param {hterm.RowCol} that The object to copy from.\n */\nhterm.RowCol.prototype.setTo = function(that) {\n this.row = that.row;\n this.column = that.column;\n this.overflow = that.overflow;\n};\n\n/**\n * Test if another hterm.RowCol instance is equal to this one.\n *\n * @param {hterm.RowCol} that The other hterm.RowCol instance.\n * @return {boolean} True if both instances have the same row/column, false\n * otherwise.\n */\nhterm.RowCol.prototype.equals = function(that) {\n return (this.row == that.row && this.column == that.column &&\n this.overflow == that.overflow);\n};\n\n/**\n * Return a string representation of this instance.\n *\n * @return {string} A string that identifies the row and column of this\n * instance.\n */\nhterm.RowCol.prototype.toString = function() {\n return ('[hterm.RowCol: ' + this.row + ', ' + this.column + ', ' +\n this.overflow + ']');\n};\n// SOURCE FILE: hterm/js/hterm_frame.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f');\n\n/**\n * First draft of the interface between the terminal and a third party dialog.\n *\n * This is rough. It's just the terminal->dialog layer. To complete things\n * we'll also need a command->terminal layer. That will have to facilitate\n * command->terminal->dialog or direct command->dialog communication.\n *\n * I imagine this class will change significantly when that happens.\n */\n\n/**\n * Construct a new frame for the given terminal.\n *\n * @param terminal {hterm.Terminal} The parent terminal object.\n * @param url {String} The url to load in the frame.\n * @param opt_options {Object} Optional options for the frame. Not implemented.\n */\nhterm.Frame = function(terminal, url, opt_options) {\n this.terminal_ = terminal;\n this.div_ = terminal.div_;\n this.url = url;\n this.options = opt_options || {};\n this.iframe_ = null;\n this.container_ = null;\n this.messageChannel_ = null;\n};\n\n/**\n * Handle messages from the iframe.\n */\nhterm.Frame.prototype.onMessage_ = function(e) {\n switch (e.data.name) {\n case 'ipc-init-ok':\n // We get this response after we send them ipc-init and they finish.\n this.sendTerminalInfo_();\n return;\n case 'terminal-info-ok':\n // We get this response after we send them terminal-info and they finish.\n // Show the finished frame, and then rebind our message handler to the\n // callback below.\n this.container_.style.display = 'flex';\n this.messageChannel_.port1.onmessage = this.onMessage.bind(this);\n this.onLoad();\n return;\n default:\n console.log('Unknown message from frame:', e.data);\n return;\n }\n};\n\n/**\n * Clients could override this, I guess.\n *\n * It doesn't support multiple listeners, but I'm not sure that would make sense\n * here. It's probably better to speak directly to our parents.\n */\nhterm.Frame.prototype.onMessage = function() {};\n\n/**\n * Handle iframe onLoad event.\n */\nhterm.Frame.prototype.onLoad_ = function() {\n this.messageChannel_ = new MessageChannel();\n this.messageChannel_.port1.onmessage = this.onMessage_.bind(this);\n this.messageChannel_.port1.start();\n this.iframe_.contentWindow.postMessage(\n {name: 'ipc-init', argv: [{messagePort: this.messageChannel_.port2}]},\n this.url, [this.messageChannel_.port2]);\n};\n\n/**\n * Clients may override this.\n */\nhterm.Frame.prototype.onLoad = function() {};\n\n/**\n * Sends the terminal-info message to the iframe.\n */\nhterm.Frame.prototype.sendTerminalInfo_ = function() {\n lib.f.getAcceptLanguages(function(languages) {\n this.postMessage('terminal-info', [{\n acceptLanguages: languages,\n foregroundColor: this.terminal_.getForegroundColor(),\n backgroundColor: this.terminal_.getBackgroundColor(),\n cursorColor: this.terminal_.getCursorColor(),\n fontSize: this.terminal_.getFontSize(),\n fontFamily: this.terminal_.getFontFamily(),\n baseURL: lib.f.getURL('/')\n }]\n );\n }.bind(this));\n};\n\n/**\n * User clicked the close button on the frame decoration.\n */\nhterm.Frame.prototype.onCloseClicked_ = function() {\n this.close();\n};\n\n/**\n * Close this frame.\n */\nhterm.Frame.prototype.close = function() {\n if (!this.container_ || !this.container_.parentNode)\n return;\n\n this.container_.parentNode.removeChild(this.container_);\n this.onClose();\n};\n\n\n/**\n * Clients may override this.\n */\nhterm.Frame.prototype.onClose = function() {};\n\n/**\n * Send a message to the iframe.\n */\nhterm.Frame.prototype.postMessage = function(name, argv) {\n if (!this.messageChannel_)\n throw new Error('Message channel is not set up.');\n\n this.messageChannel_.port1.postMessage({name: name, argv: argv});\n};\n\n/**\n * Show the UI for this frame.\n *\n * The iframe src is not loaded until this method is called.\n */\nhterm.Frame.prototype.show = function() {\n var self = this;\n\n function opt(name, defaultValue) {\n if (name in self.options)\n return self.options[name];\n\n return defaultValue;\n }\n\n var self = this;\n\n if (this.container_ && this.container_.parentNode) {\n console.error('Frame already visible');\n return;\n }\n\n var headerHeight = '16px';\n\n var divSize = hterm.getClientSize(this.div_);\n\n var width = opt('width', 640);\n var height = opt('height', 480);\n var left = (divSize.width - width) / 2;\n var top = (divSize.height - height) / 2;\n\n var document = this.terminal_.document_;\n\n var container = this.container_ = document.createElement('div');\n container.style.cssText = (\n 'position: absolute;' +\n 'display: none;' +\n 'flex-direction: column;' +\n 'top: 10%;' +\n 'left: 4%;' +\n 'width: 90%;' +\n 'height: 80%;' +\n 'min-height: 20%;' +\n 'max-height: 80%;' +\n 'box-shadow: 0 0 2px ' + this.terminal_.getForegroundColor() + ';' +\n 'border: 2px ' + this.terminal_.getForegroundColor() + ' solid;');\n\n if (false) {\n // No use for the close button, so no use for the window header either.\n var header = document.createElement('div');\n header.style.cssText = (\n 'display: flex;' +\n 'justify-content: flex-end;' +\n 'height: ' + headerHeight + ';' +\n 'background-color: ' + this.terminal_.getForegroundColor() + ';' +\n 'color: ' + this.terminal_.getBackgroundColor() + ';' +\n 'font-size: 16px;' +\n 'font-family: ' + this.terminal_.getFontFamily());\n container.appendChild(header);\n\n var button = document.createElement('div');\n button.setAttribute('role', 'button');\n button.style.cssText = (\n 'margin-top: -3px;' +\n 'margin-right: 3px;' +\n 'cursor: pointer;');\n button.textContent = '\\u2a2f';\n button.addEventListener('click', this.onCloseClicked_.bind(this));\n header.appendChild(button);\n }\n\n var iframe = this.iframe_ = document.createElement('iframe');\n iframe.onload = this.onLoad_.bind(this);\n iframe.style.cssText = (\n 'display: flex;' +\n 'flex: 1;' +\n 'width: 100%');\n iframe.setAttribute('src', this.url);\n iframe.setAttribute('seamless', true);\n container.appendChild(iframe);\n\n this.div_.appendChild(container);\n};\n// SOURCE FILE: hterm/js/hterm_keyboard.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('hterm.Keyboard.KeyMap');\n\n/**\n * Keyboard handler.\n *\n * Consumes onKey* events and invokes onVTKeystroke on the associated\n * hterm.Terminal object.\n *\n * See also: [XTERM] as referenced in vt.js.\n *\n * @param {hterm.Terminal} The Terminal object associated with this keyboard.\n */\nhterm.Keyboard = function(terminal) {\n // The parent vt interpreter.\n this.terminal = terminal;\n\n // The element we're currently capturing keyboard events for.\n this.keyboardElement_ = null;\n\n // The event handlers we are interested in, and their bound callbacks, saved\n // so they can be uninstalled with removeEventListener, when required.\n this.handlers_ = [\n ['focusout', this.onFocusOut_.bind(this)],\n ['keydown', this.onKeyDown_.bind(this)],\n ['keypress', this.onKeyPress_.bind(this)],\n ['keyup', this.onKeyUp_.bind(this)],\n ['textInput', this.onTextInput_.bind(this)]\n ];\n\n /**\n * The current key map.\n */\n this.keyMap = new hterm.Keyboard.KeyMap(this);\n\n this.bindings = new hterm.Keyboard.Bindings(this);\n\n /**\n * none: Disable any AltGr related munging.\n * ctrl-alt: Assume Ctrl+Alt means AltGr.\n * left-alt: Assume left Alt means AltGr.\n * right-alt: Assume right Alt means AltGr.\n */\n this.altGrMode = 'none';\n\n /**\n * If true, Shift-Insert will fall through to the browser as a paste.\n * If false, the keystroke will be sent to the host.\n */\n this.shiftInsertPaste = true;\n\n /**\n * If true, home/end will control the terminal scrollbar and shift home/end\n * will send the VT keycodes. If false then home/end sends VT codes and\n * shift home/end scrolls.\n */\n this.homeKeysScroll = false;\n\n /**\n * Same as above, except for page up/page down.\n */\n this.pageKeysScroll = false;\n\n /**\n * If true, Ctrl-Plus/Minus/Zero controls zoom.\n * If false, Ctrl-Shift-Plus/Minus/Zero controls zoom, Ctrl-Minus sends ^_,\n * Ctrl-Plus/Zero do nothing.\n */\n this.ctrlPlusMinusZeroZoom = true;\n\n /**\n * Ctrl+C copies if true, sends ^C to host if false.\n * Ctrl+Shift+C sends ^C to host if true, copies if false.\n */\n this.ctrlCCopy = false;\n\n /**\n * Ctrl+V pastes if true, sends ^V to host if false.\n * Ctrl+Shift+V sends ^V to host if true, pastes if false.\n */\n this.ctrlVPaste = false;\n\n /**\n * Enable/disable application keypad.\n *\n * This changes the way numeric keys are sent from the keyboard.\n */\n this.applicationKeypad = false;\n\n /**\n * Enable/disable the application cursor mode.\n *\n * This changes the way cursor keys are sent from the keyboard.\n */\n this.applicationCursor = false;\n\n /**\n * If true, the backspace should send BS ('\\x08', aka ^H). Otherwise\n * the backspace key should send '\\x7f'.\n */\n this.backspaceSendsBackspace = false;\n\n /**\n * The encoding method for data sent to the host.\n */\n this.characterEncoding = 'utf-8';\n\n /**\n * Set whether the meta key sends a leading escape or not.\n */\n this.metaSendsEscape = true;\n\n /**\n * Set whether meta-V gets passed to host.\n */\n this.passMetaV = true;\n\n /**\n * Controls how the alt key is handled.\n *\n * escape....... Send an ESC prefix.\n * 8-bit........ Add 128 to the unshifted character as in xterm.\n * browser-key.. Wait for the keypress event and see what the browser says.\n * (This won't work well on platforms where the browser\n * performs a default action for some alt sequences.)\n *\n * This setting only matters when alt is distinct from meta (altIsMeta is\n * false.)\n */\n this.altSendsWhat = 'escape';\n\n /**\n * Set whether the alt key acts as a meta key, instead of producing 8-bit\n * characters.\n *\n * True to enable, false to disable, null to autodetect based on platform.\n */\n this.altIsMeta = false;\n\n /**\n * If true, tries to detect DEL key events that are from alt-backspace on\n * Chrome OS vs from a true DEL key press.\n *\n * Background: At the time of writing, on Chrome OS, alt-backspace is mapped\n * to DEL. Some users may be happy with this, but others may be frustrated\n * that it's impossible to do meta-backspace. If the user enables this pref,\n * we use a trick to tell a true DEL keypress from alt-backspace: on\n * alt-backspace, we will see the alt key go down, then get a DEL keystroke\n * that indicates that alt is not pressed. See https://crbug.com/174410 .\n */\n this.altBackspaceIsMetaBackspace = false;\n\n /**\n * Used to keep track of the current alt-key state, which is necessary for\n * the altBackspaceIsMetaBackspace preference above and for the altGrMode\n * preference. This is a bitmap with where bit positions correspond to the\n * \"location\" property of the key event.\n */\n this.altKeyPressed = 0;\n\n /**\n * If true, Chrome OS media keys will be mapped to their F-key equivalent.\n * E.g. \"Back\" will be mapped to F1. If false, Chrome will handle the keys.\n */\n this.mediaKeysAreFKeys = false;\n\n /**\n * Holds the previous setting of altSendsWhat when DECSET 1039 is used. When\n * DECRST 1039 is used, altSendsWhat is changed back to this and this is\n * nulled out.\n */\n this.previousAltSendsWhat_ = null;\n};\n\n/**\n * Special handling for keyCodes in a keyboard layout.\n */\nhterm.Keyboard.KeyActions = {\n /**\n * Call preventDefault and stopPropagation for this key event and nothing\n * else.\n */\n CANCEL: lib.f.createEnum('CANCEL'),\n\n /**\n * This performs the default terminal action for the key. If used in the\n * 'normal' action and the the keystroke represents a printable key, the\n * character will be sent to the host. If used in one of the modifier\n * actions, the terminal will perform the normal action after (possibly)\n * altering it.\n *\n * - If the normal sequence starts with CSI, the sequence will be adjusted\n * to include the modifier parameter as described in [XTERM] in the final\n * table of the \"PC-Style Function Keys\" section.\n *\n * - If the control key is down and the key represents a printable character,\n * and the uppercase version of the unshifted keycap is between\n * 64 (ASCII '@') and 95 (ASCII '_'), then the uppercase version of the\n * unshifted keycap minus 64 is sent. This makes '^@' send '\\x00' and\n * '^_' send '\\x1f'. (Note that one higher that 0x1f is 0x20, which is\n * the first printable ASCII value.)\n *\n * - If the alt key is down and the key represents a printable character then\n * the value of the character is shifted up by 128.\n *\n * - If meta is down and configured to send an escape, '\\x1b' will be sent\n * before the normal action is performed.\n */\n DEFAULT: lib.f.createEnum('DEFAULT'),\n\n /**\n * Causes the terminal to opt out of handling the key event, instead letting\n * the browser deal with it.\n */\n PASS: lib.f.createEnum('PASS'),\n\n /**\n * Insert the first or second character of the keyCap, based on e.shiftKey.\n * The key will be handled in onKeyDown, and e.preventDefault() will be\n * called.\n *\n * It is useful for a modified key action, where it essentially strips the\n * modifier while preventing the browser from reacting to the key.\n */\n STRIP: lib.f.createEnum('STRIP')\n};\n\n/**\n * Encode a string according to the 'send-encoding' preference.\n */\nhterm.Keyboard.prototype.encode = function(str) {\n if (this.characterEncoding == 'utf-8')\n return this.terminal.vt.encodeUTF8(str);\n\n return str;\n};\n\n/**\n * Capture keyboard events sent to the associated element.\n *\n * This enables the keyboard. Captured events are consumed by this class\n * and will not perform their default action or bubble to other elements.\n *\n * Passing a null element will uninstall the keyboard handlers.\n *\n * @param {HTMLElement} element The element whose events should be captured, or\n * null to disable the keyboard.\n */\nhterm.Keyboard.prototype.installKeyboard = function(element) {\n if (element == this.keyboardElement_)\n return;\n\n if (element && this.keyboardElement_)\n this.installKeyboard(null);\n\n for (var i = 0; i < this.handlers_.length; i++) {\n var handler = this.handlers_[i];\n if (element) {\n element.addEventListener(handler[0], handler[1]);\n } else {\n this.keyboardElement_.removeEventListener(handler[0], handler[1]);\n }\n }\n\n this.keyboardElement_ = element;\n};\n\n/**\n * Disable keyboard event capture.\n *\n * This will allow the browser to process key events normally.\n */\nhterm.Keyboard.prototype.uninstallKeyboard = function() {\n this.installKeyboard(null);\n};\n\n/**\n * Handle onTextInput events.\n *\n * We're not actually supposed to get these, but we do on the Mac in the case\n * where a third party app sends synthetic keystrokes to Chrome.\n */\nhterm.Keyboard.prototype.onTextInput_ = function(e) {\n if (!e.data)\n return;\n\n e.data.split('').forEach(this.terminal.onVTKeystroke.bind(this.terminal));\n};\n\n/**\n * Handle onKeyPress events.\n */\nhterm.Keyboard.prototype.onKeyPress_ = function(e) {\n var code;\n\n var key = String.fromCharCode(e.which);\n var lowerKey = key.toLowerCase();\n if ((e.ctrlKey || e.metaKey) && (lowerKey == 'c' || lowerKey == 'v')) {\n // On FF the key press (not key down) event gets fired for copy/paste.\n // Let it fall through for the default browser behavior.\n return;\n }\n\n if (e.altKey && this.altSendsWhat == 'browser-key' && e.charCode == 0) {\n // If we got here because we were expecting the browser to handle an\n // alt sequence but it didn't do it, then we might be on an OS without\n // an enabled IME system. In that case we fall back to xterm-like\n // behavior.\n //\n // This happens here only as a fallback. Typically these platforms should\n // set altSendsWhat to either 'escape' or '8-bit'.\n var ch = String.fromCharCode(e.keyCode);\n if (!e.shiftKey)\n ch = ch.toLowerCase();\n code = ch.charCodeAt(0) + 128;\n\n } else if (e.charCode >= 32) {\n ch = e.charCode;\n }\n\n if (ch)\n this.terminal.onVTKeystroke(String.fromCharCode(ch));\n\n e.preventDefault();\n e.stopPropagation();\n};\n\n/**\n * Prevent default handling for non-ctrl-shifted event.\n *\n * When combined with Chrome permission 'app.window.fullscreen.overrideEsc',\n * and called for both key down and key up events,\n * the ESC key remains usable within fullscreen Chrome app windows.\n */\nhterm.Keyboard.prototype.preventChromeAppNonCtrlShiftDefault_ = function(e) {\n if (!window.chrome || !window.chrome.app || !window.chrome.app.window)\n return;\n if (!e.ctrlKey || !e.shiftKey)\n e.preventDefault();\n};\n\nhterm.Keyboard.prototype.onFocusOut_ = function(e) {\n this.altKeyPressed = 0;\n};\n\nhterm.Keyboard.prototype.onKeyUp_ = function(e) {\n if (e.keyCode == 18)\n this.altKeyPressed = this.altKeyPressed & ~(1 << (e.location - 1));\n\n if (e.keyCode == 27)\n this.preventChromeAppNonCtrlShiftDefault_(e);\n};\n\n/**\n * Handle onKeyDown events.\n */\nhterm.Keyboard.prototype.onKeyDown_ = function(e) {\n if (e.keyCode == 18)\n this.altKeyPressed = this.altKeyPressed | (1 << (e.location - 1));\n\n if (e.keyCode == 27)\n this.preventChromeAppNonCtrlShiftDefault_(e);\n\n var keyDef = this.keyMap.keyDefs[e.keyCode];\n if (!keyDef) {\n console.warn('No definition for keyCode: ' + e.keyCode);\n return;\n }\n\n // The type of action we're going to use.\n var resolvedActionType = null;\n\n var self = this;\n function getAction(name) {\n // Get the key action for the given action name. If the action is a\n // function, dispatch it. If the action defers to the normal action,\n // resolve that instead.\n\n resolvedActionType = name;\n\n var action = keyDef[name];\n if (typeof action == 'function')\n action = action.apply(self.keyMap, [e, keyDef]);\n\n if (action === DEFAULT && name != 'normal')\n action = getAction('normal');\n\n return action;\n }\n\n // Note that we use the triple-equals ('===') operator to test equality for\n // these constants, in order to distinguish usage of the constant from usage\n // of a literal string that happens to contain the same bytes.\n var CANCEL = hterm.Keyboard.KeyActions.CANCEL;\n var DEFAULT = hterm.Keyboard.KeyActions.DEFAULT;\n var PASS = hterm.Keyboard.KeyActions.PASS;\n var STRIP = hterm.Keyboard.KeyActions.STRIP;\n\n var control = e.ctrlKey;\n var alt = this.altIsMeta ? false : e.altKey;\n var meta = this.altIsMeta ? (e.altKey || e.metaKey) : e.metaKey;\n\n // In the key-map, we surround the keyCap for non-printables in \"[...]\"\n var isPrintable = !(/^\\[\\w+\\]$/.test(keyDef.keyCap));\n\n switch (this.altGrMode) {\n case 'ctrl-alt':\n if (isPrintable && control && alt) {\n // ctrl-alt-printable means altGr. We clear out the control and\n // alt modifiers and wait to see the charCode in the keydown event.\n control = false;\n alt = false;\n }\n break;\n\n case 'right-alt':\n if (isPrintable && (this.terminal.keyboard.altKeyPressed & 2)) {\n control = false;\n alt = false;\n }\n break;\n\n case 'left-alt':\n if (isPrintable && (this.terminal.keyboard.altKeyPressed & 1)) {\n control = false;\n alt = false;\n }\n break;\n }\n\n var action;\n\n if (control) {\n action = getAction('control');\n } else if (alt) {\n action = getAction('alt');\n } else if (meta) {\n action = getAction('meta');\n } else {\n action = getAction('normal');\n }\n\n // If e.maskShiftKey was set (during getAction) it means the shift key is\n // already accounted for in the action, and we should not act on it any\n // further. This is currently only used for Ctrl-Shift-Tab, which should send\n // \"CSI Z\", not \"CSI 1 ; 2 Z\".\n var shift = !e.maskShiftKey && e.shiftKey;\n\n var keyDown = {\n keyCode: e.keyCode,\n shift: e.shiftKey, // not `var shift` from above.\n ctrl: control,\n alt: alt,\n meta: meta\n };\n\n var binding = this.bindings.getBinding(keyDown);\n\n if (binding) {\n // Clear out the modifier bits so we don't try to munge the sequence\n // further.\n shift = control = alt = meta = false;\n resolvedActionType = 'normal';\n action = binding.action;\n\n if (typeof action == 'function')\n action = action.call(this, this.terminal, keyDown);\n }\n\n if (alt && this.altSendsWhat == 'browser-key' && action == DEFAULT) {\n // When altSendsWhat is 'browser-key', we wait for the keypress event.\n // In keypress, the browser should have set the event.charCode to the\n // appropriate character.\n // TODO(rginda): Character compositions will need some black magic.\n action = PASS;\n }\n\n if (action === PASS || (action === DEFAULT && !(control || alt || meta))) {\n // If this key is supposed to be handled by the browser, or it is an\n // unmodified key with the default action, then exit this event handler.\n // If it's an unmodified key, it'll be handled in onKeyPress where we\n // can tell for sure which ASCII code to insert.\n //\n // This block needs to come before the STRIP test, otherwise we'll strip\n // the modifier and think it's ok to let the browser handle the keypress.\n // The browser won't know we're trying to ignore the modifiers and might\n // perform some default action.\n return;\n }\n\n if (action === STRIP) {\n alt = control = false;\n action = keyDef.normal;\n if (typeof action == 'function')\n action = action.apply(this.keyMap, [e, keyDef]);\n\n if (action == DEFAULT && keyDef.keyCap.length == 2)\n action = keyDef.keyCap.substr((shift ? 1 : 0), 1);\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n if (action === CANCEL)\n return;\n\n if (action !== DEFAULT && typeof action != 'string') {\n console.warn('Invalid action: ' + JSON.stringify(action));\n return;\n }\n\n // Strip the modifier that is associated with the action, since we assume that\n // modifier has already been accounted for in the action.\n if (resolvedActionType == 'control') {\n control = false;\n } else if (resolvedActionType == 'alt') {\n alt = false;\n } else if (resolvedActionType == 'meta') {\n meta = false;\n }\n\n if (action.substr(0, 2) == '\\x1b[' && (alt || control || shift)) {\n // The action is an escape sequence that and it was triggered in the\n // presence of a keyboard modifier, we may need to alter the action to\n // include the modifier before sending it.\n\n var mod;\n\n if (shift && !(alt || control)) {\n mod = ';2';\n } else if (alt && !(shift || control)) {\n mod = ';3';\n } else if (shift && alt && !control) {\n mod = ';4';\n } else if (control && !(shift || alt)) {\n mod = ';5';\n } else if (shift && control && !alt) {\n mod = ';6';\n } else if (alt && control && !shift) {\n mod = ';7';\n } else if (shift && alt && control) {\n mod = ';8';\n }\n\n if (action.length == 3) {\n // Some of the CSI sequences have zero parameters unless modified.\n action = '\\x1b[1' + mod + action.substr(2, 1);\n } else {\n // Others always have at least one parameter.\n action = action.substr(0, action.length - 1) + mod +\n action.substr(action.length - 1);\n }\n\n } else {\n if (action === DEFAULT) {\n action = keyDef.keyCap.substr((shift ? 1 : 0), 1);\n\n if (control) {\n var unshifted = keyDef.keyCap.substr(0, 1);\n var code = unshifted.charCodeAt(0);\n if (code >= 64 && code <= 95) {\n action = String.fromCharCode(code - 64);\n }\n }\n }\n\n if (alt && this.altSendsWhat == '8-bit' && action.length == 1) {\n var code = action.charCodeAt(0) + 128;\n action = String.fromCharCode(code);\n }\n\n // We respect alt/metaSendsEscape even if the keymap action was a literal\n // string. Otherwise, every overridden alt/meta action would have to\n // check alt/metaSendsEscape.\n if ((alt && this.altSendsWhat == 'escape') ||\n (meta && this.metaSendsEscape)) {\n action = '\\x1b' + action;\n }\n }\n\n this.terminal.onVTKeystroke(action);\n};\n// SOURCE FILE: hterm/js/hterm_keyboard_bindings.js\n// Copyright (c) 2015 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * A mapping from hterm.Keyboard.KeyPattern to an action.\n *\n * TODO(rginda): For now this bindings code is only used for user overrides.\n * hterm.Keyboard.KeyMap still handles all of the built-in key mappings.\n * It'd be nice if we migrated that over to be hterm.Keyboard.Bindings based.\n */\nhterm.Keyboard.Bindings = function() {\n this.bindings_ = {};\n};\n\n/**\n * Remove all bindings.\n */\nhterm.Keyboard.Bindings.prototype.clear = function () {\n this.bindings_ = {};\n};\n\n/**\n * Add a new binding.\n *\n * Internal API that assumes parsed objects as inputs.\n * See the public addBinding for more details.\n *\n * @param {hterm.Keyboard.KeyPattern} keyPattern\n * @param {string|function|hterm.Keyboard.KeyAction} action\n */\nhterm.Keyboard.Bindings.prototype.addBinding_ = function(keyPattern, action) {\n var binding = null;\n var list = this.bindings_[keyPattern.keyCode];\n if (list) {\n for (var i = 0; i < list.length; i++) {\n if (list[i].keyPattern.matchKeyPattern(keyPattern)) {\n binding = list[i];\n break;\n }\n }\n }\n\n if (binding) {\n binding.action = action;\n } else {\n binding = {keyPattern: keyPattern, action: action};\n\n if (!list) {\n this.bindings_[keyPattern.keyCode] = [binding];\n } else {\n this.bindings_[keyPattern.keyCode].push(binding);\n\n list.sort(function(a, b) {\n return hterm.Keyboard.KeyPattern.sortCompare(\n a.keyPattern, b.keyPattern);\n });\n }\n }\n};\n\n/**\n * Add a new binding.\n *\n * If a binding for the keyPattern already exists it will be overridden.\n *\n * More specific keyPatterns take precedence over those with wildcards. Given\n * bindings for \"Ctrl-A\" and \"Ctrl-*-A\", and a \"Ctrl-A\" keydown, the \"Ctrl-A\"\n * binding will match even if \"Ctrl-*-A\" was created last.\n *\n * If action is a string, it will be passed through hterm.Parser.parseKeyAction.\n *\n * For example:\n * // Will replace Ctrl-P keystrokes with the string \"hiya!\".\n * addBinding('Ctrl-P', \"'hiya!'\");\n * // Will cancel the keystroke entirely (make it do nothing).\n * addBinding('Alt-D', hterm.Keyboard.KeyActions.CANCEL);\n * // Will execute the code and return the action.\n * addBinding('Ctrl-T', function() {\n * console.log('Got a T!');\n * return hterm.Keyboard.KeyActions.PASS;\n * });\n *\n * @param {string|hterm.Keyboard.KeyPattern} keyPattern\n * @param {string|function|hterm.Keyboard.KeyAction} action\n */\nhterm.Keyboard.Bindings.prototype.addBinding = function(key, action) {\n // If we're given a hterm.Keyboard.KeyPattern object, pass it down.\n if (typeof key != 'string') {\n this.addBinding_(key, action);\n return;\n }\n\n // Here we treat key as a string.\n var p = new hterm.Parser();\n\n p.reset(key);\n var sequence;\n\n try {\n sequence = p.parseKeySequence();\n } catch (ex) {\n console.error(ex);\n return;\n }\n\n if (!p.isComplete()) {\n console.error(p.error('Expected end of sequence: ' + sequence));\n return;\n }\n\n // If action is a string, parse it. Otherwise assume it's callable.\n if (typeof action == 'string') {\n p.reset(action);\n try {\n action = p.parseKeyAction();\n } catch (ex) {\n console.error(ex);\n return;\n }\n }\n\n if (!p.isComplete()) {\n console.error(p.error('Expected end of sequence: ' + sequence));\n return;\n }\n\n this.addBinding_(new hterm.Keyboard.KeyPattern(sequence), action);\n};\n\n/**\n * Add multiple bindings at a time using a map of {string: string, ...}\n *\n * This uses hterm.Parser to parse the maps key into KeyPatterns, and the\n * map values into {string|function|KeyAction}.\n *\n * For example:\n * {\n * // Will replace Ctrl-P keystrokes with the string \"hiya!\".\n * 'Ctrl-P': \"'hiya!'\",\n * // Will cancel the keystroke entirely (make it do nothing).\n * 'Alt-D': hterm.Keyboard.KeyActions.CANCEL,\n * }\n *\n * @param {Object} map\n */\nhterm.Keyboard.Bindings.prototype.addBindings = function(map) {\n for (var key in map) {\n this.addBinding(key, map[key]);\n }\n};\n\n/**\n * Return the binding that is the best match for the given keyDown record,\n * or null if there is no match.\n *\n * @param {Object} keyDown An object with a keyCode property and zero or\n * more boolean properties representing key modifiers. These property names\n * must match those defined in hterm.Keyboard.KeyPattern.modifiers.\n */\nhterm.Keyboard.Bindings.prototype.getBinding = function(keyDown) {\n var list = this.bindings_[keyDown.keyCode];\n if (!list)\n return null;\n\n for (var i = 0; i < list.length; i++) {\n var binding = list[i];\n if (binding.keyPattern.matchKeyDown(keyDown))\n return binding;\n }\n\n return null;\n};\n// SOURCE FILE: hterm/js/hterm_keyboard_keymap.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('hterm.Keyboard.KeyActions');\n\n/**\n * The default key map for hterm.\n *\n * Contains a mapping of keyCodes to keyDefs (aka key definitions). The key\n * definition tells the hterm.Keyboard class how to handle keycodes.\n *\n * This should work for most cases, as the printable characters get handled\n * in the keypress event. In that case, even if the keycap is wrong in the\n * key map, the correct character should be sent.\n *\n * Different layouts, such as Dvorak should work with this keymap, as those\n * layouts typically move keycodes around on the keyboard without disturbing\n * the actual keycaps.\n *\n * There may be issues with control keys on non-US keyboards or with keyboards\n * that very significantly from the expectations here, in which case we may\n * have to invent new key maps.\n *\n * The sequences defined in this key map come from [XTERM] as referenced in\n * vt.js, starting with the section titled \"Alt and Meta Keys\".\n */\nhterm.Keyboard.KeyMap = function(keyboard) {\n this.keyboard = keyboard;\n this.keyDefs = {};\n this.reset();\n};\n\n/**\n * Add a single key definition.\n *\n * The definition is a hash containing the following keys: 'keyCap', 'normal',\n * 'control', and 'alt'.\n *\n * - keyCap is a string identifying the key. For printable\n * keys, the key cap should be exactly two characters, starting with the\n * unshifted version. For example, 'aA', 'bB', '1!' and '=+'. For\n * non-printable the key cap should be surrounded in square braces, as in\n * '[INS]', '[LEFT]'. By convention, non-printable keycaps are in uppercase\n * but this is not a strict requirement.\n *\n * - Normal is the action that should be performed when they key is pressed\n * in the absence of any modifier. See below for the supported actions.\n *\n * - Control is the action that should be performed when they key is pressed\n * along with the control modifier. See below for the supported actions.\n *\n * - Alt is the action that should be performed when they key is pressed\n * along with the alt modifier. See below for the supported actions.\n *\n * - Meta is the action that should be performed when they key is pressed\n * along with the meta modifier. See below for the supported actions.\n *\n * Actions can be one of the hterm.Keyboard.KeyActions as documented below,\n * a literal string, or an array. If the action is a literal string then\n * the string is sent directly to the host. If the action is an array it\n * is taken to be an escape sequence that may be altered by modifier keys.\n * The second-to-last element of the array will be overwritten with the\n * state of the modifier keys, as specified in the final table of \"PC-Style\n * Function Keys\" from [XTERM].\n */\nhterm.Keyboard.KeyMap.prototype.addKeyDef = function(keyCode, def) {\n if (keyCode in this.keyDefs)\n console.warn('Duplicate keyCode: ' + keyCode);\n\n this.keyDefs[keyCode] = def;\n};\n\n/**\n * Add multiple key definitions in a single call.\n *\n * This function takes the key definitions as variable argument list. Each\n * argument is the key definition specified as an array.\n *\n * (If the function took everything as one big hash we couldn't detect\n * duplicates, and there would be a lot more typing involved.)\n *\n * Each key definition should have 6 elements: (keyCode, keyCap, normal action,\n * control action, alt action and meta action). See KeyMap.addKeyDef for the\n * meaning of these elements.\n */\nhterm.Keyboard.KeyMap.prototype.addKeyDefs = function(var_args) {\n for (var i = 0; i < arguments.length; i++) {\n this.addKeyDef(arguments[i][0],\n { keyCap: arguments[i][1],\n normal: arguments[i][2],\n control: arguments[i][3],\n alt: arguments[i][4],\n meta: arguments[i][5]\n });\n }\n};\n\n/**\n * Set up the default state for this keymap.\n */\nhterm.Keyboard.KeyMap.prototype.reset = function() {\n this.keyDefs = {};\n\n var self = this;\n\n // This function is used by the \"macro\" functions below. It makes it\n // possible to use the call() macro as an argument to any other macro.\n function resolve(action, e, k) {\n if (typeof action == 'function')\n return action.apply(self, [e, k]);\n\n return action;\n }\n\n // If not application keypad a, else b. The keys that care about\n // application keypad ignore it when the key is modified.\n function ak(a, b) {\n return function(e, k) {\n var action = (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey ||\n !self.keyboard.applicationKeypad) ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // If mod or not application cursor a, else b. The keys that care about\n // application cursor ignore it when the key is modified.\n function ac(a, b) {\n return function(e, k) {\n var action = (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey ||\n !self.keyboard.applicationCursor) ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // If not backspace-sends-backspace keypad a, else b.\n function bs(a, b) {\n return function(e, k) {\n var action = !self.keyboard.backspaceSendsBackspace ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // If not e.shiftKey a, else b.\n function sh(a, b) {\n return function(e, k) {\n var action = !e.shiftKey ? a : b;\n e.maskShiftKey = true;\n return resolve(action, e, k);\n };\n }\n\n // If not e.altKey a, else b.\n function alt(a, b) {\n return function(e, k) {\n var action = !e.altKey ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // If no modifiers a, else b.\n function mod(a, b) {\n return function(e, k) {\n var action = !(e.shiftKey || e.ctrlKey || e.altKey || e.metaKey) ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // Compute a control character for a given character.\n function ctl(ch) { return String.fromCharCode(ch.charCodeAt(0) - 64) }\n\n // Call a method on the keymap instance.\n function c(m) { return function (e, k) { return this[m](e, k) } }\n\n // Ignore if not trapping media keys.\n function med(fn) {\n return function(e, k) {\n if (!self.keyboard.mediaKeysAreFKeys) {\n // Block Back, Forward, and Reload keys to avoid navigating away from\n // the current page.\n return (e.keyCode == 166 || e.keyCode == 167 || e.keyCode == 168) ?\n hterm.Keyboard.KeyActions.CANCEL :\n hterm.Keyboard.KeyActions.PASS;\n }\n return resolve(fn, e, k);\n };\n }\n\n var ESC = '\\x1b';\n var CSI = '\\x1b[';\n var SS3 = '\\x1bO';\n\n var CANCEL = hterm.Keyboard.KeyActions.CANCEL;\n var DEFAULT = hterm.Keyboard.KeyActions.DEFAULT;\n var PASS = hterm.Keyboard.KeyActions.PASS;\n var STRIP = hterm.Keyboard.KeyActions.STRIP;\n\n this.addKeyDefs(\n // These fields are: [keycode, keycap, normal, control, alt, meta]\n\n // The browser sends the keycode 0 for some keys. We'll just assume it's\n // going to do the right thing by default for those keys.\n [0, '[UNKNOWN]', PASS, PASS, PASS, PASS],\n\n // First row.\n [27, '[ESC]', ESC, DEFAULT, DEFAULT, DEFAULT],\n [112, '[F1]', mod(SS3 + 'P', CSI + 'P'), DEFAULT, CSI + \"23~\", DEFAULT],\n [113, '[F2]', mod(SS3 + 'Q', CSI + 'Q'), DEFAULT, CSI + \"24~\", DEFAULT],\n [114, '[F3]', mod(SS3 + 'R', CSI + 'R'), DEFAULT, CSI + \"25~\", DEFAULT],\n [115, '[F4]', mod(SS3 + 'S', CSI + 'S'), DEFAULT, CSI + \"26~\", DEFAULT],\n [116, '[F5]', CSI + '15~', DEFAULT, CSI + \"28~\", DEFAULT],\n [117, '[F6]', CSI + '17~', DEFAULT, CSI + \"29~\", DEFAULT],\n [118, '[F7]', CSI + '18~', DEFAULT, CSI + \"31~\", DEFAULT],\n [119, '[F8]', CSI + '19~', DEFAULT, CSI + \"32~\", DEFAULT],\n [120, '[F9]', CSI + '20~', DEFAULT, CSI + \"33~\", DEFAULT],\n [121, '[F10]', CSI + '21~', DEFAULT, CSI + \"34~\", DEFAULT],\n [122, '[F11]', CSI + '23~', DEFAULT, CSI + \"42~\", DEFAULT],\n [123, '[F12]', CSI + '24~', DEFAULT, CSI + \"43~\", DEFAULT],\n\n // Second row.\n [192, '`~', DEFAULT, sh(ctl('@'), ctl('^')), DEFAULT, PASS],\n [49, '1!', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [50, '2@', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [51, '3#', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [52, '4$', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [53, '5%', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [54, '6^', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [55, '7&', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [56, '8*', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [57, '9(', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [48, '0)', DEFAULT, c('onPlusMinusZero_'),c('onAltNum_'),c('onPlusMinusZero_')],\n [189, '-_', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n [187, '=+', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n // Firefox -_ and =+\n [173, '-_', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n [61, '=+', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n // Firefox Italian +*\n [171, '+*', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n\n [8, '[BKSP]', bs('\\x7f', '\\b'), bs('\\b', '\\x7f'), DEFAULT, DEFAULT],\n\n // Third row.\n [9, '[TAB]', sh('\\t', CSI + 'Z'), STRIP, PASS, DEFAULT],\n [81, 'qQ', DEFAULT, ctl('Q'), DEFAULT, DEFAULT],\n [87, 'wW', DEFAULT, ctl('W'), DEFAULT, DEFAULT],\n [69, 'eE', DEFAULT, ctl('E'), DEFAULT, DEFAULT],\n [82, 'rR', DEFAULT, ctl('R'), DEFAULT, DEFAULT],\n [84, 'tT', DEFAULT, ctl('T'), DEFAULT, DEFAULT],\n [89, 'yY', DEFAULT, ctl('Y'), DEFAULT, DEFAULT],\n [85, 'uU', DEFAULT, ctl('U'), DEFAULT, DEFAULT],\n [73, 'iI', DEFAULT, ctl('I'), DEFAULT, DEFAULT],\n [79, 'oO', DEFAULT, ctl('O'), DEFAULT, DEFAULT],\n [80, 'pP', DEFAULT, ctl('P'), DEFAULT, DEFAULT],\n [219, '[{', DEFAULT, ctl('['), DEFAULT, DEFAULT],\n [221, ']}', DEFAULT, ctl(']'), DEFAULT, DEFAULT],\n [220, '\\\\|', DEFAULT, ctl('\\\\'), DEFAULT, DEFAULT],\n\n // Fourth row. (We let Ctrl-Shift-J pass for Chrome DevTools.)\n [20, '[CAPS]', PASS, PASS, PASS, DEFAULT],\n [65, 'aA', DEFAULT, ctl('A'), DEFAULT, DEFAULT],\n [83, 'sS', DEFAULT, ctl('S'), DEFAULT, DEFAULT],\n [68, 'dD', DEFAULT, ctl('D'), DEFAULT, DEFAULT],\n [70, 'fF', DEFAULT, ctl('F'), DEFAULT, DEFAULT],\n [71, 'gG', DEFAULT, ctl('G'), DEFAULT, DEFAULT],\n [72, 'hH', DEFAULT, ctl('H'), DEFAULT, DEFAULT],\n [74, 'jJ', DEFAULT, sh(ctl('J'), PASS), DEFAULT, DEFAULT],\n [75, 'kK', DEFAULT, sh(ctl('K'), c('onClear_')), DEFAULT, DEFAULT],\n [76, 'lL', DEFAULT, sh(ctl('L'), PASS), DEFAULT, DEFAULT],\n [186, ';:', DEFAULT, STRIP, DEFAULT, DEFAULT],\n [222, '\\'\"', DEFAULT, STRIP, DEFAULT, DEFAULT],\n [13, '[ENTER]', '\\r', CANCEL, CANCEL, DEFAULT],\n\n // Fifth row. This includes the copy/paste shortcuts. On some\n // platforms it's Ctrl-C/V, on others it's Meta-C/V. We assume either\n // Ctrl-C/Meta-C should pass to the browser when there is a selection,\n // and Ctrl-Shift-V/Meta-*-V should always pass to the browser (since\n // these seem to be recognized as paste too).\n [16, '[SHIFT]', PASS, PASS, PASS, DEFAULT],\n [90, 'zZ', DEFAULT, ctl('Z'), DEFAULT, DEFAULT],\n [88, 'xX', DEFAULT, ctl('X'), DEFAULT, DEFAULT],\n [67, 'cC', DEFAULT, c('onCtrlC_'), DEFAULT, c('onMetaC_')],\n [86, 'vV', DEFAULT, c('onCtrlV_'), DEFAULT, c('onMetaV_')],\n [66, 'bB', DEFAULT, sh(ctl('B'), PASS), DEFAULT, sh(DEFAULT, PASS)],\n [78, 'nN', DEFAULT, c('onCtrlN_'), DEFAULT, c('onMetaN_')],\n [77, 'mM', DEFAULT, ctl('M'), DEFAULT, DEFAULT],\n [188, ',<', DEFAULT, alt(STRIP, PASS), DEFAULT, DEFAULT],\n [190, '.>', DEFAULT, alt(STRIP, PASS), DEFAULT, DEFAULT],\n [191, '/?', DEFAULT, sh(ctl('_'), ctl('?')), DEFAULT, DEFAULT],\n\n // Sixth and final row.\n [17, '[CTRL]', PASS, PASS, PASS, PASS],\n [18, '[ALT]', PASS, PASS, PASS, PASS],\n [91, '[LAPL]', PASS, PASS, PASS, PASS],\n [32, ' ', DEFAULT, ctl('@'), DEFAULT, DEFAULT],\n [92, '[RAPL]', PASS, PASS, PASS, PASS],\n [93, '[RMENU]', PASS, PASS, PASS, PASS],\n\n // These things.\n [42, '[PRTSCR]', PASS, PASS, PASS, PASS],\n [145, '[SCRLK]', PASS, PASS, PASS, PASS],\n [19, '[BREAK]', PASS, PASS, PASS, PASS],\n\n // The block of six keys above the arrows.\n [45, '[INSERT]', c('onKeyInsert_'), DEFAULT, DEFAULT, DEFAULT],\n [36, '[HOME]', c('onKeyHome_'), DEFAULT, DEFAULT, DEFAULT],\n [33, '[PGUP]', c('onKeyPageUp_'), DEFAULT, DEFAULT, DEFAULT],\n [46, '[DEL]', c('onKeyDel_'), DEFAULT, DEFAULT, DEFAULT],\n [35, '[END]', c('onKeyEnd_'), DEFAULT, DEFAULT, DEFAULT],\n [34, '[PGDOWN]', c('onKeyPageDown_'), DEFAULT, DEFAULT, DEFAULT],\n\n // Arrow keys. When unmodified they respect the application cursor state,\n // otherwise they always send the CSI codes.\n [38, '[UP]', c('onKeyArrowUp_'), DEFAULT, DEFAULT, DEFAULT],\n [40, '[DOWN]', c('onKeyArrowDown_'), DEFAULT, DEFAULT, DEFAULT],\n [39, '[RIGHT]', ac(CSI + 'C', SS3 + 'C'), DEFAULT, DEFAULT, DEFAULT],\n [37, '[LEFT]', ac(CSI + 'D', SS3 + 'D'), DEFAULT, DEFAULT, DEFAULT],\n\n [144, '[NUMLOCK]', PASS, PASS, PASS, PASS],\n\n // With numlock off, the keypad generates the same key codes as the arrows\n // and 'block of six' for some keys, and null key codes for the rest.\n\n // Keypad with numlock on generates unique key codes...\n [96, '[KP0]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [97, '[KP1]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [98, '[KP2]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [99, '[KP3]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [100, '[KP4]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [101, '[KP5]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [102, '[KP6]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [103, '[KP7]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [104, '[KP8]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [105, '[KP9]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [107, '[KP+]', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n [109, '[KP-]', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n [106, '[KP*]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [111, '[KP/]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [110, '[KP.]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n\n // Chrome OS keyboard top row.\n [166, '[BACK]', med(mod(SS3+'P', CSI+'P')), DEFAULT, CSI+\"23~\", DEFAULT],\n [167, '[FWD]', med(mod(SS3+'Q', CSI+'Q')), DEFAULT, CSI+\"24~\", DEFAULT],\n [168, '[RELOAD]', med(mod(SS3+'R', CSI+'R')), DEFAULT, CSI+\"25~\", DEFAULT],\n [183, '[FSCR]', med(mod(SS3+'S', CSI+'S')), DEFAULT, CSI+\"26~\", DEFAULT],\n [182, '[WINS]', med(CSI + '15~'), DEFAULT, CSI+\"28~\", DEFAULT],\n [216, '[BRIT-]', med(CSI + '17~'), DEFAULT, CSI+\"29~\", DEFAULT],\n [217, '[BRIT+]', med(CSI + '18~'), DEFAULT, CSI+\"31~\", DEFAULT]\n\n // 173 [MUTE], 174 [VOL-] and 175 [VOL+] are trapped by the Chrome OS\n // window manager, so we'll never see them. Note that 173 is also\n // Firefox's -_ keycode.\n );\n};\n\n/**\n * Either allow the paste or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyInsert_ = function(e) {\n if (this.keyboard.shiftInsertPaste && e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n return '\\x1b[2~';\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyHome_ = function(e) {\n if (!this.keyboard.homeKeysScroll ^ e.shiftKey) {\n if ((e.altey || e.ctrlKey || e.shiftKey) ||\n !this.keyboard.applicationCursor) {\n return '\\x1b[H';\n }\n\n return '\\x1bOH';\n }\n\n this.keyboard.terminal.scrollHome();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyEnd_ = function(e) {\n if (!this.keyboard.homeKeysScroll ^ e.shiftKey) {\n if ((e.altKey || e.ctrlKey || e.shiftKey) ||\n !this.keyboard.applicationCursor) {\n return '\\x1b[F';\n }\n\n return '\\x1bOF';\n }\n\n this.keyboard.terminal.scrollEnd();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyPageUp_ = function(e) {\n if (!this.keyboard.pageKeysScroll ^ e.shiftKey)\n return '\\x1b[5~';\n\n this.keyboard.terminal.scrollPageUp();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either send a true DEL, or sub in meta-backspace.\n *\n * On Chrome OS, if we know the alt key is down, but we get a DEL event that\n * claims that the alt key is not pressed, we know the DEL was a synthetic\n * one from a user that hit alt-backspace. Based on a user pref, we can sub\n * in meta-backspace in this case.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyDel_ = function(e) {\n if (this.keyboard.altBackspaceIsMetaBackspace &&\n this.keyboard.altKeyPressed && !e.altKey)\n return '\\x1b\\x7f';\n return '\\x1b[3~';\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyPageDown_ = function(e) {\n if (!this.keyboard.pageKeysScroll ^ e.shiftKey)\n return '\\x1b[6~';\n\n this.keyboard.terminal.scrollPageDown();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyArrowUp_ = function(e) {\n if (!this.keyboard.applicationCursor && e.shiftKey) {\n this.keyboard.terminal.scrollLineUp();\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n return (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey ||\n !this.keyboard.applicationCursor) ? '\\x1b[A' : '\\x1bOA';\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyArrowDown_ = function(e) {\n if (!this.keyboard.applicationCursor && e.shiftKey) {\n this.keyboard.terminal.scrollLineDown();\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n return (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey ||\n !this.keyboard.applicationCursor) ? '\\x1b[B' : '\\x1bOB';\n};\n\n/**\n * Clear the primary/alternate screens and the scrollback buffer.\n */\nhterm.Keyboard.KeyMap.prototype.onClear_ = function(e, keyDef) {\n this.keyboard.terminal.wipeContents();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either pass Ctrl-1..9 to the browser or send them to the host.\n *\n * Note that Ctrl-1 and Ctrl-9 don't actually have special sequences mapped\n * to them in xterm or gnome-terminal. The range is really Ctrl-2..8, but\n * we handle 1..9 since Chrome treats the whole range special.\n */\nhterm.Keyboard.KeyMap.prototype.onCtrlNum_ = function(e, keyDef) {\n // Compute a control character for a given character.\n function ctl(ch) { return String.fromCharCode(ch.charCodeAt(0) - 64) }\n\n if (this.keyboard.terminal.passCtrlNumber && !e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n switch (keyDef.keyCap.substr(0, 1)) {\n case '1': return '1';\n case '2': return ctl('@');\n case '3': return ctl('[');\n case '4': return ctl('\\\\');\n case '5': return ctl(']');\n case '6': return ctl('^');\n case '7': return ctl('_');\n case '8': return '\\x7f';\n case '9': return '9';\n }\n};\n\n/**\n * Either pass Alt-1..9 to the browser or send them to the host.\n */\nhterm.Keyboard.KeyMap.prototype.onAltNum_ = function(e, keyDef) {\n if (this.keyboard.terminal.passAltNumber && !e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n return hterm.Keyboard.KeyActions.DEFAULT;\n};\n\n/**\n * Either pass Meta-1..9 to the browser or send them to the host.\n */\nhterm.Keyboard.KeyMap.prototype.onMetaNum_ = function(e, keyDef) {\n if (this.keyboard.terminal.passMetaNumber && !e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n return hterm.Keyboard.KeyActions.DEFAULT;\n};\n\n/**\n * Either send a ^C or interpret the keystroke as a copy command.\n */\nhterm.Keyboard.KeyMap.prototype.onCtrlC_ = function(e, keyDef) {\n var selection = this.keyboard.terminal.getDocument().getSelection();\n\n if (!selection.isCollapsed) {\n if (this.keyboard.ctrlCCopy && !e.shiftKey) {\n // Ctrl-C should copy if there is a selection, send ^C otherwise.\n // Perform the copy by letting the browser handle Ctrl-C. On most\n // browsers, this is the *only* way to place text on the clipboard from\n // the 'drive-by' web.\n if (this.keyboard.terminal.clearSelectionAfterCopy) {\n setTimeout(selection.collapseToEnd.bind(selection), 50);\n }\n return hterm.Keyboard.KeyActions.PASS;\n }\n\n if (!this.keyboard.ctrlCCopy && e.shiftKey) {\n // Ctrl-Shift-C should copy if there is a selection, send ^C otherwise.\n // Perform the copy manually. This only works in situations where\n // document.execCommand('copy') is allowed.\n if (this.keyboard.terminal.clearSelectionAfterCopy) {\n setTimeout(selection.collapseToEnd.bind(selection), 50);\n }\n this.keyboard.terminal.copySelectionToClipboard();\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n }\n\n return '\\x03';\n};\n\n/**\n * Either send a ^N or open a new window to the same location.\n */\nhterm.Keyboard.KeyMap.prototype.onCtrlN_ = function(e, keyDef) {\n if (e.shiftKey) {\n window.open(document.location.href, '',\n 'chrome=no,close=yes,resize=yes,scrollbars=yes,' +\n 'minimizable=yes,width=' + window.innerWidth +\n ',height=' + window.innerHeight);\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n return '\\x0e';\n};\n\n/**\n * Either send a ^V or issue a paste command.\n *\n * The default behavior is to paste if the user presses Ctrl-Shift-V, and send\n * a ^V if the user presses Ctrl-V. This can be flipped with the\n * 'ctrl-v-paste' preference.\n *\n */\nhterm.Keyboard.KeyMap.prototype.onCtrlV_ = function(e, keyDef) {\n if ((!e.shiftKey && this.keyboard.ctrlVPaste) ||\n (e.shiftKey && !this.keyboard.ctrlVPaste)) {\n // We try to do the pasting ourselves as not all browsers/OSs bind Ctrl-V to\n // pasting. Notably, on macOS, Ctrl-V/Ctrl-Shift-V do nothing.\n // However, this might run into web restrictions, so if it fails, we still\n // fallback to the letting the native behavior (hopefully) save us.\n if (this.keyboard.terminal.paste())\n return hterm.Keyboard.KeyActions.CANCEL;\n else\n return hterm.Keyboard.KeyActions.PASS;\n }\n\n return '\\x16';\n};\n\n/**\n * Either the default action or open a new window to the same location.\n */\nhterm.Keyboard.KeyMap.prototype.onMetaN_ = function(e, keyDef) {\n if (e.shiftKey) {\n window.open(document.location.href, '',\n 'chrome=no,close=yes,resize=yes,scrollbars=yes,' +\n 'minimizable=yes,width=' + window.outerWidth +\n ',height=' + window.outerHeight);\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n return hterm.Keyboard.KeyActions.DEFAULT;\n};\n\n/**\n * Either send a Meta-C or allow the browser to interpret the keystroke as a\n * copy command.\n *\n * If there is no selection, or if the user presses Meta-Shift-C, then we'll\n * transmit an '\\x1b' (if metaSendsEscape is on) followed by 'c' or 'C'.\n *\n * If there is a selection, we defer to the browser. In this case we clear out\n * the selection so the user knows we heard them, and also to give them a\n * chance to send a Meta-C by just hitting the key again.\n */\nhterm.Keyboard.KeyMap.prototype.onMetaC_ = function(e, keyDef) {\n var document = this.keyboard.terminal.getDocument();\n if (e.shiftKey || document.getSelection().isCollapsed) {\n // If the shift key is being held, or there is no document selection, send\n // a Meta-C. The keyboard code will add the ESC if metaSendsEscape is true,\n // we just have to decide between 'c' and 'C'.\n return keyDef.keyCap.substr(e.shiftKey ? 1 : 0, 1);\n }\n\n // Otherwise let the browser handle it as a copy command.\n if (this.keyboard.terminal.clearSelectionAfterCopy) {\n setTimeout(function() { document.getSelection().collapseToEnd() }, 50);\n }\n return hterm.Keyboard.KeyActions.PASS;\n};\n\n/**\n * Either PASS or DEFAULT Meta-V, depending on preference.\n *\n * Always PASS Meta-Shift-V to allow browser to interpret the keystroke as\n * a paste command.\n */\nhterm.Keyboard.KeyMap.prototype.onMetaV_ = function(e, keyDef) {\n if (e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n return this.keyboard.passMetaV ?\n hterm.Keyboard.KeyActions.PASS :\n hterm.Keyboard.KeyActions.DEFAULT;\n};\n\n/**\n * Handle font zooming.\n *\n * The browser's built-in zoom has a bit of an issue at certain zoom levels.\n * At some magnifications, the measured height of a row of text differs from\n * the height that was explicitly set.\n *\n * We override the browser zoom keys to change the ScrollPort's font size to\n * avoid the issue.\n */\nhterm.Keyboard.KeyMap.prototype.onPlusMinusZero_ = function(e, keyDef) {\n if (!(this.keyboard.ctrlPlusMinusZeroZoom ^ e.shiftKey)) {\n // If ctrl-PMZ controls zoom and the shift key is pressed, or\n // ctrl-shift-PMZ controls zoom and this shift key is not pressed,\n // then we want to send the control code instead of affecting zoom.\n if (keyDef.keyCap == '-_')\n return '\\x1f'; // ^_\n\n // Only ^_ is valid, the other sequences have no meaning.\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n if (this.keyboard.terminal.getZoomFactor() != 1) {\n // If we're not at 1:1 zoom factor, let the Ctrl +/-/0 keys control the\n // browser zoom, so it's easier to for the user to get back to 100%.\n return hterm.Keyboard.KeyActions.PASS;\n }\n\n var cap = keyDef.keyCap.substr(0, 1);\n if (cap == '0') {\n this.keyboard.terminal.setFontSize(0);\n } else {\n var size = this.keyboard.terminal.getFontSize();\n\n if (cap == '-' || keyDef.keyCap == '[KP-]') {\n size -= 1;\n } else {\n size += 1;\n }\n\n this.keyboard.terminal.setFontSize(size);\n }\n\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n// SOURCE FILE: hterm/js/hterm_keyboard_keypattern.js\n// Copyright (c) 2015 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * A record of modifier bits and keycode used to define a key binding.\n *\n * The modifier names are enumerated in the static KeyPattern.modifiers\n * property below. Each modifier can be true, false, or \"*\". True means\n * the modifier key must be present, false means it must not, and \"*\" means\n * it doesn't matter.\n */\nhterm.Keyboard.KeyPattern = function(spec) {\n this.wildcardCount = 0;\n this.keyCode = spec.keyCode;\n\n hterm.Keyboard.KeyPattern.modifiers.forEach(function(mod) {\n this[mod] = spec[mod] || false;\n if (this[mod] == '*')\n this.wildcardCount++;\n }.bind(this));\n};\n\n/**\n * Valid modifier names.\n */\nhterm.Keyboard.KeyPattern.modifiers = [\n 'shift', 'ctrl', 'alt', 'meta'\n];\n\n/**\n * A compare callback for Array.prototype.sort().\n *\n * The bindings code wants to be sure to search through the strictest key\n * patterns first, so that loosely defined patterns have a lower priority than\n * exact patterns.\n *\n * @param {hterm.Keyboard.KeyPattern} a\n * @param {hterm.Keyboard.KeyPattern} b\n */\nhterm.Keyboard.KeyPattern.sortCompare = function(a, b) {\n if (a.wildcardCount < b.wildcardCount)\n return -1;\n\n if (a.wildcardCount > b.wildcardCount)\n return 1;\n\n return 0;\n};\n\n/**\n * Private method used to match this key pattern against other key patterns\n * or key down events.\n *\n * @param {Object} The object to match.\n * @param {boolean} True if we should ignore wildcards. Useful when you want\n * to perform and exact match against another key pattern.\n */\nhterm.Keyboard.KeyPattern.prototype.match_ = function(obj, exactMatch) {\n if (this.keyCode != obj.keyCode)\n return false;\n\n var rv = true;\n\n hterm.Keyboard.KeyPattern.modifiers.forEach(function(mod) {\n var modValue = (mod in obj) ? obj[mod] : false;\n if (!rv || (!exactMatch && this[mod] == '*') || this[mod] == modValue)\n return;\n\n rv = false;\n }.bind(this));\n\n return rv;\n};\n\n/**\n * Return true if the given keyDown object is a match for this key pattern.\n *\n * @param {Object} keyDown An object with a keyCode property and zero or\n * more boolean properties representing key modifiers. These property names\n * must match those defined in hterm.Keyboard.KeyPattern.modifiers.\n */\nhterm.Keyboard.KeyPattern.prototype.matchKeyDown = function(keyDown) {\n return this.match_(keyDown, false);\n};\n\n/**\n * Return true if the given hterm.Keyboard.KeyPattern is exactly the same as\n * this one.\n *\n * @param {hterm.Keyboard.KeyPattern}\n */\nhterm.Keyboard.KeyPattern.prototype.matchKeyPattern = function(keyPattern) {\n return this.match_(keyPattern, true);\n};\n// SOURCE FILE: hterm/js/hterm_options.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * @fileoverview This file implements the hterm.Options class,\n * which stores current operating conditions for the terminal. This object is\n * used instead of a series of parameters to allow saving/restoring of cursor\n * conditions easily, and to provide an easy place for common configuration\n * options.\n *\n * Original code by Cory Maccarrone.\n */\n\n/**\n * Constructor for the hterm.Options class, optionally acting as a copy\n * constructor.\n *\n * The defaults are as defined in http://www.vt100.net/docs/vt510-rm/DECSTR\n * except that we enable autowrap (wraparound) by default since that seems to\n * be what xterm does.\n *\n * @param {hterm.Options=} opt_copy Optional instance to copy.\n * @constructor\n */\nhterm.Options = function(opt_copy) {\n // All attributes in this class are public to allow easy access by the\n // terminal.\n\n this.wraparound = opt_copy ? opt_copy.wraparound : true;\n this.reverseWraparound = opt_copy ? opt_copy.reverseWraparound : false;\n this.originMode = opt_copy ? opt_copy.originMode : false;\n this.autoCarriageReturn = opt_copy ? opt_copy.autoCarriageReturn : false;\n this.cursorVisible = opt_copy ? opt_copy.cursorVisible : false;\n this.cursorBlink = opt_copy ? opt_copy.cursorBlink : false;\n this.insertMode = opt_copy ? opt_copy.insertMode : false;\n this.reverseVideo = opt_copy ? opt_copy.reverseVideo : false;\n this.bracketedPaste = opt_copy ? opt_copy.bracketedPaste : false;\n};\n// SOURCE FILE: hterm/js/hterm_parser.js\n// Copyright (c) 2015 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('hterm.Keyboard.KeyActions');\n\n/**\n * @constructor\n * Parses the key definition syntax used for user keyboard customizations.\n */\nhterm.Parser = function() {\n /**\n * @type {string} The source string.\n */\n this.source = '';\n\n /**\n * @type {number} The current position.\n */\n this.pos = 0;\n\n /**\n * @type {string?} The character at the current position.\n */\n this.ch = null;\n};\n\nhterm.Parser.prototype.error = function(message) {\n return new Error('Parse error at ' + this.pos + ': ' + message);\n};\n\nhterm.Parser.prototype.isComplete = function() {\n return this.pos == this.source.length;\n};\n\nhterm.Parser.prototype.reset = function(source, opt_pos) {\n this.source = source;\n this.pos = opt_pos || 0;\n this.ch = source.substr(0, 1);\n};\n\n/**\n * Parse a key sequence.\n *\n * A key sequence is zero or more of the key modifiers defined in\n * hterm.Parser.identifiers.modifierKeys followed by a key code. Key\n * codes can be an integer or an identifier from\n * hterm.Parser.identifiers.keyCodes. Modifiers and keyCodes should be joined\n * by the dash character.\n *\n * An asterisk \"*\" can be used to indicate that the unspecified modifiers\n * are optional.\n *\n * For example:\n * A: Matches only an unmodified \"A\" character.\n * 65: Same as above.\n * 0x41: Same as above.\n * Ctrl-A: Matches only Ctrl-A.\n * Ctrl-65: Same as above.\n * Ctrl-0x41: Same as above.\n * Ctrl-Shift-A: Matches only Ctrl-Shift-A.\n * Ctrl-*-A: Matches Ctrl-A, as well as any other key sequence that includes\n * at least the Ctrl and A keys.\n *\n * @return {Object} An object with shift, ctrl, alt, meta, keyCode\n * properties.\n */\nhterm.Parser.prototype.parseKeySequence = function() {\n var rv = {\n keyCode: null\n };\n\n for (var k in hterm.Parser.identifiers.modifierKeys) {\n rv[hterm.Parser.identifiers.modifierKeys[k]] = false;\n }\n\n while (this.pos < this.source.length) {\n this.skipSpace();\n\n var token = this.parseToken();\n if (token.type == 'integer') {\n rv.keyCode = token.value;\n\n } else if (token.type == 'identifier') {\n var ucValue = token.value.toUpperCase();\n if (ucValue in hterm.Parser.identifiers.modifierKeys &&\n hterm.Parser.identifiers.modifierKeys.hasOwnProperty(ucValue)) {\n var mod = hterm.Parser.identifiers.modifierKeys[ucValue];\n if (rv[mod] && rv[mod] != '*')\n throw this.error('Duplicate modifier: ' + token.value);\n rv[mod] = true;\n\n } else if (ucValue in hterm.Parser.identifiers.keyCodes &&\n hterm.Parser.identifiers.keyCodes.hasOwnProperty(ucValue)) {\n rv.keyCode = hterm.Parser.identifiers.keyCodes[ucValue];\n\n } else {\n throw this.error('Unknown key: ' + token.value);\n }\n\n } else if (token.type == 'symbol') {\n if (token.value == '*') {\n for (var id in hterm.Parser.identifiers.modifierKeys) {\n var p = hterm.Parser.identifiers.modifierKeys[id];\n if (!rv[p])\n rv[p] = '*';\n }\n } else {\n throw this.error('Unexpected symbol: ' + token.value);\n }\n } else {\n throw this.error('Expected integer or identifier');\n }\n\n this.skipSpace();\n\n if (this.ch != '-')\n break;\n\n if (rv.keyCode != null)\n throw this.error('Extra definition after target key');\n\n this.advance(1);\n }\n\n if (rv.keyCode == null)\n throw this.error('Missing target key');\n\n return rv;\n};\n\nhterm.Parser.prototype.parseKeyAction = function() {\n this.skipSpace();\n\n var token = this.parseToken();\n\n if (token.type == 'string')\n return token.value;\n\n if (token.type == 'identifier') {\n if (token.value in hterm.Parser.identifiers.actions &&\n hterm.Parser.identifiers.actions.hasOwnProperty(token.value))\n return hterm.Parser.identifiers.actions[token.value];\n\n throw this.error('Unknown key action: ' + token.value);\n }\n\n throw this.error('Expected string or identifier');\n\n};\n\nhterm.Parser.prototype.peekString = function() {\n return this.ch == '\\'' || this.ch == '\"';\n};\n\nhterm.Parser.prototype.peekIdentifier = function() {\n return this.ch.match(/[a-z_]/i);\n};\n\nhterm.Parser.prototype.peekInteger = function() {\n return this.ch.match(/[0-9]/);\n};\n\nhterm.Parser.prototype.parseToken = function() {\n if (this.ch == '*') {\n var rv = {type: 'symbol', value: this.ch};\n this.advance(1);\n return rv;\n }\n\n if (this.peekIdentifier())\n return {type: 'identifier', value: this.parseIdentifier()};\n\n if (this.peekString())\n return {type: 'string', value: this.parseString()};\n\n if (this.peekInteger())\n return {type: 'integer', value: this.parseInteger()};\n\n\n throw this.error('Unexpected token');\n};\n\nhterm.Parser.prototype.parseIdentifier = function() {\n if (!this.peekIdentifier())\n throw this.error('Expected identifier');\n\n return this.parsePattern(/[a-z0-9_]+/ig);\n};\n\nhterm.Parser.prototype.parseInteger = function() {\n var base = 10;\n\n if (this.ch == '0' && this.pos < this.source.length - 1 &&\n this.source.substr(this.pos + 1, 1) == 'x') {\n return parseInt(this.parsePattern(/0x[0-9a-f]+/gi));\n }\n\n return parseInt(this.parsePattern(/\\d+/g));\n};\n\n/**\n * Parse a single or double quoted string.\n *\n * The current position should point at the initial quote character. Single\n * quoted strings will be treated literally, double quoted will process escapes.\n *\n * TODO(rginda): Variable interpolation.\n *\n * @param {ParseState} parseState\n * @param {string} quote A single or double-quote character.\n * @return {string}\n */\nhterm.Parser.prototype.parseString = function() {\n var result = '';\n\n var quote = this.ch;\n if (quote != '\"' && quote != '\\'')\n throw this.error('String expected');\n\n this.advance(1);\n\n var re = new RegExp('[\\\\\\\\' + quote + ']', 'g');\n\n while (this.pos < this.source.length) {\n re.lastIndex = this.pos;\n if (!re.exec(this.source))\n throw this.error('Unterminated string literal');\n\n result += this.source.substring(this.pos, re.lastIndex - 1);\n\n this.advance(re.lastIndex - this.pos - 1);\n\n if (quote == '\"' && this.ch == '\\\\') {\n this.advance(1);\n result += this.parseEscape();\n continue;\n }\n\n if (quote == '\\'' && this.ch == '\\\\') {\n result += this.ch;\n this.advance(1);\n continue;\n }\n\n if (this.ch == quote) {\n this.advance(1);\n return result;\n }\n }\n\n throw this.error('Unterminated string literal');\n};\n\n\n/**\n * Parse an escape code from the current position (which should point to\n * the first character AFTER the leading backslash.)\n *\n * @return {string}\n */\nhterm.Parser.prototype.parseEscape = function() {\n var map = {\n '\"': '\"',\n '\\'': '\\'',\n '\\\\': '\\\\',\n 'a': '\\x07',\n 'b': '\\x08',\n 'e': '\\x1b',\n 'f': '\\x0c',\n 'n': '\\x0a',\n 'r': '\\x0d',\n 't': '\\x09',\n 'v': '\\x0b',\n 'x': function() {\n var value = this.parsePattern(/[a-z0-9]{2}/ig);\n return String.fromCharCode(parseInt(value, 16));\n },\n 'u': function() {\n var value = this.parsePattern(/[a-z0-9]{4}/ig);\n return String.fromCharCode(parseInt(value, 16));\n }\n };\n\n if (!(this.ch in map && map.hasOwnProperty(this.ch)))\n throw this.error('Unknown escape: ' + this.ch);\n\n var value = map[this.ch];\n this.advance(1);\n\n if (typeof value == 'function')\n value = value.call(this);\n\n return value;\n};\n\n/**\n * Parse the given pattern starting from the current position.\n *\n * @param {RegExp} pattern A pattern representing the characters to span. MUST\n * include the \"global\" RegExp flag.\n * @return {string}\n */\nhterm.Parser.prototype.parsePattern = function(pattern) {\n if (!pattern.global)\n throw this.error('Internal error: Span patterns must be global');\n\n pattern.lastIndex = this.pos;\n var ary = pattern.exec(this.source);\n\n if (!ary || pattern.lastIndex - ary[0].length != this.pos)\n throw this.error('Expected match for: ' + pattern);\n\n this.pos = pattern.lastIndex - 1;\n this.advance(1);\n\n return ary[0];\n};\n\n\n/**\n * Advance the current position.\n *\n * @param {number} count\n */\nhterm.Parser.prototype.advance = function(count) {\n this.pos += count;\n this.ch = this.source.substr(this.pos, 1);\n};\n\n/**\n * @param {string=} opt_expect A list of valid non-whitespace characters to\n * terminate on.\n * @return {void}\n */\nhterm.Parser.prototype.skipSpace = function(opt_expect) {\n if (!/\\s/.test(this.ch))\n return;\n\n var re = /\\s+/gm;\n re.lastIndex = this.pos;\n\n var source = this.source;\n if (re.exec(source))\n this.pos = re.lastIndex;\n\n this.ch = this.source.substr(this.pos, 1);\n\n if (opt_expect) {\n if (this.ch.indexOf(opt_expect) == -1) {\n throw this.error('Expected one of ' + opt_expect + ', found: ' +\n this.ch);\n }\n }\n};\n// SOURCE FILE: hterm/js/hterm_parser_identifiers.js\n// Copyright (c) 2015 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Collections of identifier for hterm.Parser.\n */\nhterm.Parser.identifiers = {};\n\n/**\n * Modifier key names used when defining key sequences.\n *\n * These are upper case so we can normalize the user input and be forgiving.\n * \"CTRL-A\" and \"Ctrl-A\" and \"ctrl-a\" are all accepted.\n *\n * Note: Names here cannot overlap with hterm.Parser.identifiers.keyCodes.\n */\nhterm.Parser.identifiers.modifierKeys = {\n SHIFT: 'shift',\n CTRL: 'ctrl',\n // Common alias.\n CONTROL: 'ctrl',\n ALT: 'alt',\n META: 'meta'\n};\n\n/**\n * Key codes useful when defining key sequences.\n *\n * Punctuation is mostly left out of this list because they can move around\n * based on keyboard locale and browser.\n *\n * In a key sequence like \"Ctrl-ESC\", the ESC comes from this list of\n * identifiers. It is equivalent to \"Ctrl-27\" and \"Ctrl-0x1b\".\n *\n * These are upper case so we can normalize the user input and be forgiving.\n * \"Ctrl-ESC\" and \"Ctrl-Esc\" an \"Ctrl-esc\" are all accepted.\n *\n * We also include common aliases for the same key. \"Esc\" and \"Escape\" are the\n * same key.\n *\n * Note: Names here cannot overlap with hterm.Parser.identifiers.modifierKeys.\n */\nhterm.Parser.identifiers.keyCodes = {\n // Top row.\n ESCAPE: 27,\n ESC: 27,\n F1: 112,\n F2: 113,\n F3: 114,\n F4: 115,\n F5: 116,\n F6: 117,\n F7: 118,\n F8: 119,\n F9: 120,\n F10: 121,\n F11: 122,\n F12: 123,\n\n // Row two.\n ONE: 49,\n TWO: 50,\n THREE: 51,\n FOUR: 52,\n FIVE: 53,\n SIX: 54,\n SEVEN: 55,\n EIGHT: 56,\n NINE: 57,\n ZERO: 48,\n BACKSPACE: 8,\n BKSP: 8,\n BS: 8,\n\n // Row three.\n TAB: 9,\n Q: 81,\n W: 87,\n E: 69,\n R: 82,\n T: 84,\n Y: 89,\n U: 85,\n I: 73,\n O: 79,\n P: 80,\n\n // Row four.\n CAPS_LOCK: 20,\n CAPSLOCK: 20,\n CAPS: 20,\n A: 65,\n S: 83,\n D: 68,\n F: 70,\n G: 71,\n H: 72,\n J: 74,\n K: 75,\n L: 76,\n // We map enter and return together even though enter should really be 10\n // because most people don't know or care about the history here. Plus,\n // most keyboards/programs map them together already. If they really want\n // to bind them differently, they can also use the numeric value.\n ENTER: 13,\n ENT: 13,\n RETURN: 13,\n RET: 13,\n\n // Row five.\n Z: 90,\n X: 88,\n C: 67,\n V: 86,\n B: 66,\n N: 78,\n M: 77,\n\n // Etc.\n SPACE: 32,\n SP: 32,\n PRINT_SCREEN: 42,\n PRTSC: 42,\n SCROLL_LOCK: 145,\n SCRLK: 145,\n BREAK: 19,\n BRK: 19,\n INSERT: 45,\n INS: 45,\n HOME: 36,\n PAGE_UP: 33,\n PGUP: 33,\n DELETE: 46,\n DEL: 46,\n END: 35,\n PAGE_DOWN: 34,\n PGDOWN: 34,\n PGDN: 34,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n LEFT: 37,\n NUMLOCK: 144,\n\n // Keypad\n KP0: 96,\n KP1: 97,\n KP2: 98,\n KP3: 99,\n KP4: 100,\n KP5: 101,\n KP6: 102,\n KP7: 103,\n KP8: 104,\n KP9: 105,\n KP_PLUS: 107,\n KP_ADD: 107,\n KP_MINUS: 109,\n KP_SUBTRACT: 109,\n KP_STAR: 106,\n KP_MULTIPLY: 106,\n KP_DIVIDE: 111,\n KP_DECIMAL: 110,\n KP_PERIOD: 110,\n\n // Chrome OS media keys\n NAVIGATE_BACK: 166,\n NAVIGATE_FORWARD: 167,\n RELOAD: 168,\n FULL_SCREEN: 183,\n WINDOW_OVERVIEW: 182,\n BRIGHTNESS_UP: 216,\n BRIGHTNESS_DOWN: 217\n};\n\n/**\n * Identifiers for use in key actions.\n */\nhterm.Parser.identifiers.actions = {\n /**\n * Prevent the browser and operating system from handling the event.\n */\n CANCEL: hterm.Keyboard.KeyActions.CANCEL,\n\n /**\n * Wait for a \"keypress\" event, send the keypress charCode to the host.\n */\n DEFAULT: hterm.Keyboard.KeyActions.DEFAULT,\n\n /**\n * Let the browser or operating system handle the key.\n */\n PASS: hterm.Keyboard.KeyActions.PASS,\n\n /**\n * Scroll the terminal one page up.\n */\n scrollPageUp: function(terminal) {\n terminal.scrollPageUp();\n return hterm.Keyboard.KeyActions.CANCEL;\n },\n\n /**\n * Scroll the terminal one page down.\n */\n scrollPageDown: function(terminal) {\n terminal.scrollPageDown();\n return hterm.Keyboard.KeyActions.CANCEL;\n },\n\n /**\n * Scroll the terminal to the top.\n */\n scrollToTop: function(terminal) {\n terminal.scrollEnd();\n return hterm.Keyboard.KeyActions.CANCEL;\n },\n\n /**\n * Scroll the terminal to the bottom.\n */\n scrollToBottom: function(terminal) {\n terminal.scrollEnd();\n return hterm.Keyboard.KeyActions.CANCEL;\n },\n\n /**\n * Clear the terminal and scrollback buffer.\n */\n clearScrollback: function(terminal) {\n terminal.wipeContents();\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n};\n// SOURCE FILE: hterm/js/hterm_preference_manager.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f', 'lib.Storage');\n\n/**\n * PreferenceManager subclass managing global NaSSH preferences.\n *\n * This is currently just an ordered list of known connection profiles.\n */\nhterm.PreferenceManager = function(profileId) {\n lib.PreferenceManager.call(this, hterm.defaultStorage,\n '/hterm/profiles/' + profileId);\n var defs = hterm.PreferenceManager.defaultPreferences;\n Object.keys(defs).forEach(function(key) {\n this.definePreference(key, defs[key][1]);\n }.bind(this));\n};\n\nhterm.PreferenceManager.categories = {};\nhterm.PreferenceManager.categories.Keyboard = 'Keyboard';\nhterm.PreferenceManager.categories.Appearance = 'Appearance';\nhterm.PreferenceManager.categories.CopyPaste = 'CopyPaste';\nhterm.PreferenceManager.categories.Sounds = 'Sounds';\nhterm.PreferenceManager.categories.Scrolling = 'Scrolling';\nhterm.PreferenceManager.categories.Encoding = 'Encoding';\nhterm.PreferenceManager.categories.Miscellaneous = 'Miscellaneous';\n\n/**\n * List of categories, ordered by display order (top to bottom)\n */\nhterm.PreferenceManager.categoryDefinitions = [\n { id: hterm.PreferenceManager.categories.Appearance,\n text: 'Appearance (fonts, colors, images)'},\n { id: hterm.PreferenceManager.categories.CopyPaste,\n text: 'Copy & Paste'},\n { id: hterm.PreferenceManager.categories.Encoding,\n text: 'Encoding'},\n { id: hterm.PreferenceManager.categories.Keyboard,\n text: 'Keyboard'},\n { id: hterm.PreferenceManager.categories.Scrolling,\n text: 'Scrolling'},\n { id: hterm.PreferenceManager.categories.Sounds,\n text: 'Sounds'},\n { id: hterm.PreferenceManager.categories.Miscellaneous,\n text: 'Misc.'}\n];\n\n\nhterm.PreferenceManager.defaultPreferences = {\n 'alt-gr-mode':\n [hterm.PreferenceManager.categories.Keyboard, null,\n [null, 'none', 'ctrl-alt', 'left-alt', 'right-alt'],\n 'Select an AltGr detection hack^Wheuristic.\\n' +\n '\\n' +\n '\\'null\\': Autodetect based on navigator.language:\\n' +\n ' \\'en-us\\' => \\'none\\', else => \\'right-alt\\'\\n' +\n '\\'none\\': Disable any AltGr related munging.\\n' +\n '\\'ctrl-alt\\': Assume Ctrl+Alt means AltGr.\\n' +\n '\\'left-alt\\': Assume left Alt means AltGr.\\n' +\n '\\'right-alt\\': Assume right Alt means AltGr.\\n'],\n\n 'alt-backspace-is-meta-backspace':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If set, undoes the Chrome OS Alt-Backspace->DEL remap, so that ' +\n 'alt-backspace indeed is alt-backspace.'],\n\n 'alt-is-meta':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'Set whether the alt key acts as a meta key or as a distinct alt key.'],\n\n 'alt-sends-what':\n [hterm.PreferenceManager.categories.Keyboard, 'escape',\n ['escape', '8-bit', 'browser-key'],\n 'Controls how the alt key is handled.\\n' +\n '\\n' +\n ' escape....... Send an ESC prefix.\\n' +\n ' 8-bit........ Add 128 to the unshifted character as in xterm.\\n' +\n ' browser-key.. Wait for the keypress event and see what the browser \\n' +\n ' says. (This won\\'t work well on platforms where the \\n' +\n ' browser performs a default action for some alt sequences.)'\n ],\n\n 'audible-bell-sound':\n [hterm.PreferenceManager.categories.Sounds, 'lib-resource:hterm/audio/bell',\n 'url',\n 'URL of the terminal bell sound. Empty string for no audible bell.'],\n\n 'desktop-notification-bell':\n [hterm.PreferenceManager.categories.Sounds, false, 'bool',\n 'If true, terminal bells in the background will create a Web ' +\n 'Notification. https://www.w3.org/TR/notifications/\\n' +\n '\\n'+\n 'Displaying notifications requires permission from the user. When this ' +\n 'option is set to true, hterm will attempt to ask the user for permission ' +\n 'if necessary. Note browsers may not show this permission request if it ' +\n 'did not originate from a user action.\\n' +\n '\\n' +\n 'Chrome extensions with the \"notifications\" permission have permission to ' +\n 'display notifications.'],\n\n 'background-color':\n [hterm.PreferenceManager.categories.Appearance, 'rgb(16, 16, 16)', 'color',\n 'The background color for text with no other color attributes.'],\n\n 'background-image':\n [hterm.PreferenceManager.categories.Appearance, '', 'string',\n 'CSS value of the background image. Empty string for no image.\\n' +\n '\\n' +\n 'For example:\\n' +\n ' url(https://goo.gl/anedTK)\\n' +\n ' linear-gradient(top bottom, blue, red)'],\n\n 'background-size':\n [hterm.PreferenceManager.categories.Appearance, '', 'string',\n 'CSS value of the background image size. Defaults to none.'],\n\n 'background-position':\n [hterm.PreferenceManager.categories.Appearance, '', 'string',\n 'CSS value of the background image position.\\n' +\n '\\n' +\n 'For example:\\n' +\n ' 10% 10%\\n' +\n ' center'],\n\n 'backspace-sends-backspace':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If true, the backspace should send BS (\\'\\\\x08\\', aka ^H). Otherwise ' +\n 'the backspace key should send \\'\\\\x7f\\'.'],\n\n 'character-map-overrides':\n [hterm.PreferenceManager.categories.Appearance, null, 'value',\n 'This is specified as an object. It is a sparse array, where each ' +\n 'property is the character set code and the value is an object that is ' +\n 'a sparse array itself. In that sparse array, each property is the ' +\n 'received character and the value is the displayed character.\\n' +\n '\\n' +\n 'For example:\\n' +\n ' {\"0\":{\"+\":\"\\\\u2192\",\",\":\"\\\\u2190\",\"-\":\"\\\\u2191\",\".\":\"\\\\u2193\", ' +\n '\"0\":\"\\\\u2588\"}}'\n ],\n\n 'close-on-exit':\n [hterm.PreferenceManager.categories.Miscellaneous, true, 'bool',\n 'Whether or not to close the window when the command exits.'],\n\n 'cursor-blink':\n [hterm.PreferenceManager.categories.Appearance, false, 'bool',\n 'Whether or not to blink the cursor by default.'],\n\n 'cursor-blink-cycle':\n [hterm.PreferenceManager.categories.Appearance, [1000, 500], 'value',\n 'The cursor blink rate in milliseconds.\\n' +\n '\\n' +\n 'A two element array, the first of which is how long the cursor should be ' +\n 'on, second is how long it should be off.'],\n\n 'cursor-color':\n [hterm.PreferenceManager.categories.Appearance, 'rgba(255, 0, 0, 0.5)',\n 'color',\n 'The color of the visible cursor.'],\n\n 'color-palette-overrides':\n [hterm.PreferenceManager.categories.Appearance, null, 'value',\n 'Override colors in the default palette.\\n' +\n '\\n' +\n 'This can be specified as an array or an object. If specified as an ' +\n 'object it is assumed to be a sparse array, where each property ' +\n 'is a numeric index into the color palette.\\n' +\n '\\n' +\n 'Values can be specified as almost any css color value. This ' +\n 'includes #RGB, #RRGGBB, rgb(...), rgba(...), and any color names ' +\n 'that are also part of the stock X11 rgb.txt file.\\n' +\n '\\n' +\n 'You can use \\'null\\' to specify that the default value should be not ' +\n 'be changed. This is useful for skipping a small number of indices ' +\n 'when the value is specified as an array.'],\n\n 'copy-on-select':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Automatically copy mouse selection to the clipboard.'],\n\n 'use-default-window-copy':\n [hterm.PreferenceManager.categories.CopyPaste, false, 'bool',\n 'Whether to use the default window copy behavior'],\n\n 'clear-selection-after-copy':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Whether to clear the selection after copying.'],\n\n 'ctrl-plus-minus-zero-zoom':\n [hterm.PreferenceManager.categories.Keyboard, true, 'bool',\n 'If true, Ctrl-Plus/Minus/Zero controls zoom.\\n' +\n 'If false, Ctrl-Shift-Plus/Minus/Zero controls zoom, Ctrl-Minus sends ^_, ' +\n 'Ctrl-Plus/Zero do nothing.'],\n\n 'ctrl-c-copy':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'Ctrl+C copies if true, send ^C to host if false.\\n' +\n 'Ctrl+Shift+C sends ^C to host if true, copies if false.'],\n\n 'ctrl-v-paste':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'Ctrl+V pastes if true, send ^V to host if false.\\n' +\n 'Ctrl+Shift+V sends ^V to host if true, pastes if false.'],\n\n 'east-asian-ambiguous-as-two-column':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'Set whether East Asian Ambiguous characters have two column width.'],\n\n 'enable-8-bit-control':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'True to enable 8-bit control characters, false to ignore them.\\n' +\n '\\n' +\n 'We\\'ll respect the two-byte versions of these control characters ' +\n 'regardless of this setting.'],\n\n 'enable-bold':\n [hterm.PreferenceManager.categories.Appearance, null, 'tristate',\n 'True if we should use bold weight font for text with the bold/bright ' +\n 'attribute. False to use the normal weight font. Null to autodetect.'],\n\n 'enable-bold-as-bright':\n [hterm.PreferenceManager.categories.Appearance, true, 'bool',\n 'True if we should use bright colors (8-15 on a 16 color palette) ' +\n 'for any text with the bold attribute. False otherwise.'],\n\n 'enable-blink':\n [hterm.PreferenceManager.categories.Appearance, true, 'bool',\n 'True if we should respect the blink attribute. False to ignore it. '],\n\n 'enable-clipboard-notice':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Show a message in the terminal when the host writes to the clipboard.'],\n\n 'enable-clipboard-write':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Allow the host to write directly to the system clipboard.'],\n\n 'enable-dec12':\n [hterm.PreferenceManager.categories.Miscellaneous, false, 'bool',\n 'Respect the host\\'s attempt to change the cursor blink status using ' +\n 'DEC Private Mode 12.'],\n\n 'environment':\n [hterm.PreferenceManager.categories.Miscellaneous, {'TERM': 'xterm-256color'},\n 'value',\n 'The default environment variables, as an object.'],\n\n 'font-family':\n [hterm.PreferenceManager.categories.Appearance,\n '\"DejaVu Sans Mono\", \"Everson Mono\", FreeMono, \"Menlo\", \"Terminal\", ' +\n 'monospace', 'string',\n 'Default font family for the terminal text.'],\n\n 'font-size':\n [hterm.PreferenceManager.categories.Appearance, 15, 'int',\n 'The default font size in pixels.'],\n\n 'font-smoothing':\n [hterm.PreferenceManager.categories.Appearance, 'antialiased', 'string',\n 'CSS font-smoothing property.'],\n\n 'foreground-color':\n [hterm.PreferenceManager.categories.Appearance, 'rgb(240, 240, 240)', 'color',\n 'The foreground color for text with no other color attributes.'],\n\n 'home-keys-scroll':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If true, home/end will control the terminal scrollbar and shift home/end ' +\n 'will send the VT keycodes. If false then home/end sends VT codes and ' +\n 'shift home/end scrolls.'],\n\n 'keybindings':\n [hterm.PreferenceManager.categories.Keyboard, null, 'value',\n 'A map of key sequence to key actions. Key sequences include zero or ' +\n 'more modifier keys followed by a key code. Key codes can be decimal or ' +\n 'hexadecimal numbers, or a key identifier. Key actions can be specified ' +\n 'a string to send to the host, or an action identifier. For a full ' +\n 'explanation of the format, see https://goo.gl/LWRndr.\\n' +\n '\\n' +\n 'Sample keybindings:\\n' +\n '{\\n' +\n ' \"Ctrl-Alt-K\": \"clearScrollback\",\\n' +\n ' \"Ctrl-Shift-L\": \"PASS\",\\n' +\n ' \"Ctrl-H\": \"\\'HELLO\\\\n\\'\"\\n' +\n '}'],\n\n 'max-string-sequence':\n [hterm.PreferenceManager.categories.Encoding, 100000, 'int',\n 'Max length of a DCS, OSC, PM, or APS sequence before we give up and ' +\n 'ignore the code.'],\n\n 'media-keys-are-fkeys':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If true, convert media keys to their Fkey equivalent. If false, let ' +\n 'the browser handle the keys.'],\n\n 'meta-sends-escape':\n [hterm.PreferenceManager.categories.Keyboard, true, 'bool',\n 'Set whether the meta key sends a leading escape or not.'],\n\n 'mouse-right-click-paste':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Paste on right mouse button clicks.\\n' +\n '\\n' +\n 'This option is activate independent of the \"mouse-paste-button\" ' +\n 'setting.\\n' +\n '\\n' +\n 'Note: This will handle left & right handed mice correctly.'],\n\n 'mouse-paste-button':\n [hterm.PreferenceManager.categories.CopyPaste, null,\n [null, 0, 1, 2, 3, 4, 5, 6],\n 'Mouse paste button, or null to autodetect.\\n' +\n '\\n' +\n 'For autodetect, we\\'ll use the middle mouse button for non-X11 ' +\n 'platforms (including Chrome OS). On X11, we\\'ll use the right mouse ' +\n 'button (since the native window manager should paste via the middle ' +\n 'mouse button).\\n' +\n '\\n' +\n '0 == left (primary) button.\\n' +\n '1 == middle (auxiliary) button.\\n' +\n '2 == right (secondary) button.\\n' +\n '\\n' +\n 'This option is activate independent of the \"mouse-right-click-paste\" ' +\n 'setting.\\n' +\n '\\n' +\n 'Note: This will handle left & right handed mice correctly.'],\n\n 'word-break-match-left':\n [hterm.PreferenceManager.categories.CopyPaste,\n '[^\\\\s\\\\[\\\\](){}<>\"\\'\\\\^!@#$%&*,;:`]', 'string',\n 'Regular expression to halt matching to the left (start) of a selection.\\n' +\n '\\n' +\n 'Normally this is a character class to reject specific characters.\\n' +\n 'We allow \"~\" and \".\" by default as paths frequently start with those.'],\n\n 'word-break-match-right':\n [hterm.PreferenceManager.categories.CopyPaste,\n '[^\\\\s\\\\[\\\\](){}<>\"\\'\\\\^!@#$%&*,;:~.`]', 'string',\n 'Regular expression to halt matching to the right (end) of a selection.\\n' +\n '\\n' +\n 'Normally this is a character class to reject specific characters.'],\n\n 'word-break-match-middle':\n [hterm.PreferenceManager.categories.CopyPaste,\n '[^\\\\s\\\\[\\\\](){}<>\"\\'\\\\^]*', 'string',\n 'Regular expression to match all the characters in the middle.\\n' +\n '\\n' +\n 'Normally this is a character class to reject specific characters.\\n' +\n '\\n' +\n 'Used to expand the selection surrounding the starting point.'],\n\n 'page-keys-scroll':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If true, page up/down will control the terminal scrollbar and shift ' +\n 'page up/down will send the VT keycodes. If false then page up/down ' +\n 'sends VT codes and shift page up/down scrolls.'],\n\n 'pass-alt-number':\n [hterm.PreferenceManager.categories.Keyboard, null, 'tristate',\n 'Set whether we should pass Alt-1..9 to the browser.\\n' +\n '\\n' +\n 'This is handy when running hterm in a browser tab, so that you don\\'t ' +\n 'lose Chrome\\'s \"switch to tab\" keyboard accelerators. When not running ' +\n 'in a tab it\\'s better to send these keys to the host so they can be ' +\n 'used in vim or emacs.\\n' +\n '\\n' +\n 'If true, Alt-1..9 will be handled by the browser. If false, Alt-1..9 ' +\n 'will be sent to the host. If null, autodetect based on browser platform ' +\n 'and window type.'],\n\n 'pass-ctrl-number':\n [hterm.PreferenceManager.categories.Keyboard, null, 'tristate',\n 'Set whether we should pass Ctrl-1..9 to the browser.\\n' +\n '\\n' +\n 'This is handy when running hterm in a browser tab, so that you don\\'t ' +\n 'lose Chrome\\'s \"switch to tab\" keyboard accelerators. When not running ' +\n 'in a tab it\\'s better to send these keys to the host so they can be ' +\n 'used in vim or emacs.\\n' +\n '\\n' +\n 'If true, Ctrl-1..9 will be handled by the browser. If false, Ctrl-1..9 ' +\n 'will be sent to the host. If null, autodetect based on browser platform ' +\n 'and window type.'],\n\n 'pass-meta-number':\n [hterm.PreferenceManager.categories.Keyboard, null, 'tristate',\n 'Set whether we should pass Meta-1..9 to the browser.\\n' +\n '\\n' +\n 'This is handy when running hterm in a browser tab, so that you don\\'t ' +\n 'lose Chrome\\'s \"switch to tab\" keyboard accelerators. When not running ' +\n 'in a tab it\\'s better to send these keys to the host so they can be ' +\n 'used in vim or emacs.\\n' +\n '\\n' +\n 'If true, Meta-1..9 will be handled by the browser. If false, Meta-1..9 ' +\n 'will be sent to the host. If null, autodetect based on browser platform ' +\n 'and window type.'],\n\n 'pass-meta-v':\n [hterm.PreferenceManager.categories.Keyboard, true, 'bool',\n 'Set whether meta-V gets passed to host.'],\n\n 'receive-encoding':\n [hterm.PreferenceManager.categories.Encoding, 'utf-8', ['utf-8', 'raw'],\n 'Set the expected encoding for data received from the host.\\n' +\n '\\n' +\n 'Valid values are \\'utf-8\\' and \\'raw\\'.'],\n\n 'scroll-on-keystroke':\n [hterm.PreferenceManager.categories.Scrolling, true, 'bool',\n 'If true, scroll to the bottom on any keystroke.'],\n\n 'scroll-on-output':\n [hterm.PreferenceManager.categories.Scrolling, false, 'bool',\n 'If true, scroll to the bottom on terminal output.'],\n\n 'scrollbar-visible':\n [hterm.PreferenceManager.categories.Scrolling, true, 'bool',\n 'The vertical scrollbar mode.'],\n\n 'scroll-wheel-may-send-arrow-keys':\n [hterm.PreferenceManager.categories.Scrolling, false, 'bool',\n 'When using the alternative screen buffer, and DECCKM (Application Cursor ' +\n 'Keys) is active, mouse wheel scroll events will emulate arrow keys.\\n' +\n '\\n' +\n 'It can be temporarily disabled by holding the shift key.\\n' +\n '\\n' +\n 'This frequently comes up when using pagers (less) or reading man pages ' +\n 'or text editors (vi/nano) or using screen/tmux.'],\n\n 'scroll-wheel-move-multiplier':\n [hterm.PreferenceManager.categories.Scrolling, 1, 'int',\n 'The multiplier for the pixel delta in wheel events caused by the ' +\n 'scroll wheel. Alters how fast the page scrolls.'],\n\n 'send-encoding':\n [hterm.PreferenceManager.categories.Encoding, 'utf-8', ['utf-8', 'raw'],\n 'Set the encoding for data sent to host.'],\n\n 'terminal-encoding':\n [hterm.PreferenceManager.categories.Encoding, 'iso-2022',\n ['iso-2022', 'utf-8', 'utf-8-locked'],\n 'The default terminal encoding (DOCS).\\n' +\n '\\n' +\n 'ISO-2022 enables character map translations (like graphics maps).\\n' +\n 'UTF-8 disables support for those.\\n' +\n '\\n' +\n 'The locked variant means the encoding cannot be changed at runtime ' +\n 'via terminal escape sequences.\\n' +\n '\\n' +\n 'You should stick with UTF-8 unless you notice broken rendering with ' +\n 'legacy applications.'],\n\n 'shift-insert-paste':\n [hterm.PreferenceManager.categories.Keyboard, true, 'bool',\n 'Shift + Insert pastes if true, sent to host if false.'],\n\n 'user-css':\n [hterm.PreferenceManager.categories.Appearance, '', 'url',\n 'URL of user stylesheet to include in the terminal document.'],\n\n 'user-css-text':\n [hterm.PreferenceManager.categories.Appearance, '', 'multiline-string',\n 'Custom CSS text for styling the terminal.'],\n};\n\nhterm.PreferenceManager.prototype =\n Object.create(lib.PreferenceManager.prototype);\nhterm.PreferenceManager.constructor = hterm.PreferenceManager;\n// SOURCE FILE: hterm/js/hterm_pubsub.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Utility class used to add publish/subscribe/unsubscribe functionality to\n * an existing object.\n */\nhterm.PubSub = function() {\n this.observers_ = {};\n};\n\n/**\n * Add publish, subscribe, and unsubscribe methods to an existing object.\n *\n * No other properties of the object are touched, so there is no need to\n * worry about clashing private properties.\n *\n * @param {Object} obj The object to add this behavior to.\n */\nhterm.PubSub.addBehavior = function(obj) {\n var pubsub = new hterm.PubSub();\n for (var m in hterm.PubSub.prototype) {\n obj[m] = hterm.PubSub.prototype[m].bind(pubsub);\n }\n};\n\n/**\n * Subscribe to be notified of messages about a subject.\n *\n * @param {string} subject The subject to subscribe to.\n * @param {function(Object)} callback The function to invoke for notifications.\n */\nhterm.PubSub.prototype.subscribe = function(subject, callback) {\n if (!(subject in this.observers_))\n this.observers_[subject] = [];\n\n this.observers_[subject].push(callback);\n};\n\n/**\n * Unsubscribe from a subject.\n *\n * @param {string} subject The subject to unsubscribe from.\n * @param {function(Object)} callback A callback previously registered via\n * subscribe().\n */\nhterm.PubSub.prototype.unsubscribe = function(subject, callback) {\n var list = this.observers_[subject];\n if (!list)\n throw 'Invalid subject: ' + subject;\n\n var i = list.indexOf(callback);\n if (i < 0)\n throw 'Not subscribed: ' + subject;\n\n list.splice(i, 1);\n};\n\n/**\n * Publish a message about a subject.\n *\n * Subscribers (and the optional final callback) are invoked asynchronously.\n * This method will return before anyone is actually notified.\n *\n * @param {string} subject The subject to publish about.\n * @param {Object} e An arbitrary object associated with this notification.\n * @param {function(Object)} opt_lastCallback An optional function to call after\n * all subscribers have been notified.\n */\nhterm.PubSub.prototype.publish = function(subject, e, opt_lastCallback) {\n function notifyList(i) {\n // Set this timeout before invoking the callback, so we don't have to\n // concern ourselves with exceptions.\n if (i < list.length - 1)\n setTimeout(notifyList, 0, i + 1);\n\n list[i](e);\n }\n\n var list = this.observers_[subject];\n if (list) {\n // Copy the list, in case it changes while we're notifying.\n list = [].concat(list);\n }\n\n if (opt_lastCallback) {\n if (list) {\n list.push(opt_lastCallback);\n } else {\n list = [opt_lastCallback];\n }\n }\n\n if (list)\n setTimeout(notifyList, 0, 0);\n};\n// SOURCE FILE: hterm/js/hterm_screen.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f', 'lib.wc',\n 'hterm.RowCol', 'hterm.Size', 'hterm.TextAttributes');\n\n/**\n * @fileoverview This class represents a single terminal screen full of text.\n *\n * It maintains the current cursor position and has basic methods for text\n * insert and overwrite, and adding or removing rows from the screen.\n *\n * This class has no knowledge of the scrollback buffer.\n *\n * The number of rows on the screen is determined only by the number of rows\n * that the caller inserts into the screen. If a caller wants to ensure a\n * constant number of rows on the screen, it's their responsibility to remove a\n * row for each row inserted.\n *\n * The screen width, in contrast, is enforced locally.\n *\n *\n * In practice...\n * - The hterm.Terminal class holds two hterm.Screen instances. One for the\n * primary screen and one for the alternate screen.\n *\n * - The html.Screen class only cares that rows are HTMLElements. In the\n * larger context of hterm, however, the rows happen to be displayed by an\n * hterm.ScrollPort and have to follow a few rules as a result. Each\n * row must be rooted by the custom HTML tag 'x-row', and each must have a\n * rowIndex property that corresponds to the index of the row in the context\n * of the scrollback buffer. These invariants are enforced by hterm.Terminal\n * because that is the class using the hterm.Screen in the context of an\n * hterm.ScrollPort.\n */\n\n/**\n * Create a new screen instance.\n *\n * The screen initially has no rows and a maximum column count of 0.\n *\n * @param {integer} opt_columnCount The maximum number of columns for this\n * screen. See insertString() and overwriteString() for information about\n * what happens when too many characters are added too a row. Defaults to\n * 0 if not provided.\n */\nhterm.Screen = function(opt_columnCount) {\n /**\n * Public, read-only access to the rows in this screen.\n */\n this.rowsArray = [];\n\n // The max column width for this screen.\n this.columnCount_ = opt_columnCount || 80;\n\n // The current color, bold, underline and blink attributes.\n this.textAttributes = new hterm.TextAttributes(window.document);\n\n // Current zero-based cursor coordinates.\n this.cursorPosition = new hterm.RowCol(0, 0);\n\n // The node containing the row that the cursor is positioned on.\n this.cursorRowNode_ = null;\n\n // The node containing the span of text that the cursor is positioned on.\n this.cursorNode_ = null;\n\n // The offset in column width into cursorNode_ where the cursor is positioned.\n this.cursorOffset_ = null;\n\n // Regexes for expanding word selections.\n this.wordBreakMatchLeft = null;\n this.wordBreakMatchRight = null;\n this.wordBreakMatchMiddle = null;\n};\n\n/**\n * Return the screen size as an hterm.Size object.\n *\n * @return {hterm.Size} hterm.Size object representing the current number\n * of rows and columns in this screen.\n */\nhterm.Screen.prototype.getSize = function() {\n return new hterm.Size(this.columnCount_, this.rowsArray.length);\n};\n\n/**\n * Return the current number of rows in this screen.\n *\n * @return {integer} The number of rows in this screen.\n */\nhterm.Screen.prototype.getHeight = function() {\n return this.rowsArray.length;\n};\n\n/**\n * Return the current number of columns in this screen.\n *\n * @return {integer} The number of columns in this screen.\n */\nhterm.Screen.prototype.getWidth = function() {\n return this.columnCount_;\n};\n\n/**\n * Set the maximum number of columns per row.\n *\n * @param {integer} count The maximum number of columns per row.\n */\nhterm.Screen.prototype.setColumnCount = function(count) {\n this.columnCount_ = count;\n\n if (this.cursorPosition.column >= count)\n this.setCursorPosition(this.cursorPosition.row, count - 1);\n};\n\n/**\n * Remove the first row from the screen and return it.\n *\n * @return {HTMLElement} The first row in this screen.\n */\nhterm.Screen.prototype.shiftRow = function() {\n return this.shiftRows(1)[0];\n};\n\n/**\n * Remove rows from the top of the screen and return them as an array.\n *\n * @param {integer} count The number of rows to remove.\n * @return {Array.} The selected rows.\n */\nhterm.Screen.prototype.shiftRows = function(count) {\n return this.rowsArray.splice(0, count);\n};\n\n/**\n * Insert a row at the top of the screen.\n *\n * @param {HTMLElement} row The row to insert.\n */\nhterm.Screen.prototype.unshiftRow = function(row) {\n this.rowsArray.splice(0, 0, row);\n};\n\n/**\n * Insert rows at the top of the screen.\n *\n * @param {Array.} rows The rows to insert.\n */\nhterm.Screen.prototype.unshiftRows = function(rows) {\n this.rowsArray.unshift.apply(this.rowsArray, rows);\n};\n\n/**\n * Remove the last row from the screen and return it.\n *\n * @return {HTMLElement} The last row in this screen.\n */\nhterm.Screen.prototype.popRow = function() {\n return this.popRows(1)[0];\n};\n\n/**\n * Remove rows from the bottom of the screen and return them as an array.\n *\n * @param {integer} count The number of rows to remove.\n * @return {Array.} The selected rows.\n */\nhterm.Screen.prototype.popRows = function(count) {\n return this.rowsArray.splice(this.rowsArray.length - count, count);\n};\n\n/**\n * Insert a row at the bottom of the screen.\n *\n * @param {HTMLElement} row The row to insert.\n */\nhterm.Screen.prototype.pushRow = function(row) {\n this.rowsArray.push(row);\n};\n\n/**\n * Insert rows at the bottom of the screen.\n *\n * @param {Array.} rows The rows to insert.\n */\nhterm.Screen.prototype.pushRows = function(rows) {\n rows.push.apply(this.rowsArray, rows);\n};\n\n/**\n * Insert a row at the specified row of the screen.\n *\n * @param {integer} index The index to insert the row.\n * @param {HTMLElement} row The row to insert.\n */\nhterm.Screen.prototype.insertRow = function(index, row) {\n this.rowsArray.splice(index, 0, row);\n};\n\n/**\n * Insert rows at the specified row of the screen.\n *\n * @param {integer} index The index to insert the rows.\n * @param {Array.} rows The rows to insert.\n */\nhterm.Screen.prototype.insertRows = function(index, rows) {\n for (var i = 0; i < rows.length; i++) {\n this.rowsArray.splice(index + i, 0, rows[i]);\n }\n};\n\n/**\n * Remove a row from the screen and return it.\n *\n * @param {integer} index The index of the row to remove.\n * @return {HTMLElement} The selected row.\n */\nhterm.Screen.prototype.removeRow = function(index) {\n return this.rowsArray.splice(index, 1)[0];\n};\n\n/**\n * Remove rows from the bottom of the screen and return them as an array.\n *\n * @param {integer} index The index to start removing rows.\n * @param {integer} count The number of rows to remove.\n * @return {Array.} The selected rows.\n */\nhterm.Screen.prototype.removeRows = function(index, count) {\n return this.rowsArray.splice(index, count);\n};\n\n/**\n * Invalidate the current cursor position.\n *\n * This sets this.cursorPosition to (0, 0) and clears out some internal\n * data.\n *\n * Attempting to insert or overwrite text while the cursor position is invalid\n * will raise an obscure exception.\n */\nhterm.Screen.prototype.invalidateCursorPosition = function() {\n this.cursorPosition.move(0, 0);\n this.cursorRowNode_ = null;\n this.cursorNode_ = null;\n this.cursorOffset_ = null;\n};\n\n/**\n * Clear the contents of the cursor row.\n */\nhterm.Screen.prototype.clearCursorRow = function() {\n this.cursorRowNode_.innerHTML = '';\n this.cursorRowNode_.removeAttribute('line-overflow');\n this.cursorOffset_ = 0;\n this.cursorPosition.column = 0;\n this.cursorPosition.overflow = false;\n\n var text;\n if (this.textAttributes.isDefault()) {\n text = '';\n } else {\n text = lib.f.getWhitespace(this.columnCount_);\n }\n\n // We shouldn't honor inverse colors when clearing an area, to match\n // xterm's back color erase behavior.\n var inverse = this.textAttributes.inverse;\n this.textAttributes.inverse = false;\n this.textAttributes.syncColors();\n\n var node = this.textAttributes.createContainer(text);\n this.cursorRowNode_.appendChild(node);\n this.cursorNode_ = node;\n\n this.textAttributes.inverse = inverse;\n this.textAttributes.syncColors();\n};\n\n/**\n * Mark the current row as having overflowed to the next line.\n *\n * The line overflow state is used when converting a range of rows into text.\n * It makes it possible to recombine two or more overflow terminal rows into\n * a single line.\n *\n * This is distinct from the cursor being in the overflow state. Cursor\n * overflow indicates that printing at the cursor position will commit a\n * line overflow, unless it is preceded by a repositioning of the cursor\n * to a non-overflow state.\n */\nhterm.Screen.prototype.commitLineOverflow = function() {\n this.cursorRowNode_.setAttribute('line-overflow', true);\n};\n\n/**\n * Relocate the cursor to a give row and column.\n *\n * @param {integer} row The zero based row.\n * @param {integer} column The zero based column.\n */\nhterm.Screen.prototype.setCursorPosition = function(row, column) {\n if (!this.rowsArray.length) {\n console.warn('Attempt to set cursor position on empty screen.');\n return;\n }\n\n if (row >= this.rowsArray.length) {\n console.error('Row out of bounds: ' + row);\n row = this.rowsArray.length - 1;\n } else if (row < 0) {\n console.error('Row out of bounds: ' + row);\n row = 0;\n }\n\n if (column >= this.columnCount_) {\n console.error('Column out of bounds: ' + column);\n column = this.columnCount_ - 1;\n } else if (column < 0) {\n console.error('Column out of bounds: ' + column);\n column = 0;\n }\n\n this.cursorPosition.overflow = false;\n\n var rowNode = this.rowsArray[row];\n var node = rowNode.firstChild;\n\n if (!node) {\n node = rowNode.ownerDocument.createTextNode('');\n rowNode.appendChild(node);\n }\n\n var currentColumn = 0;\n\n if (rowNode == this.cursorRowNode_) {\n if (column >= this.cursorPosition.column - this.cursorOffset_) {\n node = this.cursorNode_;\n currentColumn = this.cursorPosition.column - this.cursorOffset_;\n }\n } else {\n this.cursorRowNode_ = rowNode;\n }\n\n this.cursorPosition.move(row, column);\n\n while (node) {\n var offset = column - currentColumn;\n var width = hterm.TextAttributes.nodeWidth(node);\n if (!node.nextSibling || width > offset) {\n this.cursorNode_ = node;\n this.cursorOffset_ = offset;\n return;\n }\n\n currentColumn += width;\n node = node.nextSibling;\n }\n};\n\n/**\n * Set the provided selection object to be a caret selection at the current\n * cursor position.\n */\nhterm.Screen.prototype.syncSelectionCaret = function(selection) {\n try {\n selection.collapse(this.cursorNode_, this.cursorOffset_);\n } catch (firefoxIgnoredException) {\n // FF can throw an exception if the range is off, rather than just not\n // performing the collapse.\n }\n};\n\n/**\n * Split a single node into two nodes at the given offset.\n *\n * For example:\n * Given the DOM fragment '
Hello World
', call splitNode_\n * passing the span and an offset of 6. This would modify the fragment to\n * become: '
Hello World
'. If the span\n * had any attributes they would have been copied to the new span as well.\n *\n * The to-be-split node must have a container, so that the new node can be\n * placed next to it.\n *\n * @param {HTMLNode} node The node to split.\n * @param {integer} offset The offset into the node where the split should\n * occur.\n */\nhterm.Screen.prototype.splitNode_ = function(node, offset) {\n var afterNode = node.cloneNode(false);\n\n var textContent = node.textContent;\n node.textContent = hterm.TextAttributes.nodeSubstr(node, 0, offset);\n afterNode.textContent = lib.wc.substr(textContent, offset);\n\n if (afterNode.textContent)\n node.parentNode.insertBefore(afterNode, node.nextSibling);\n if (!node.textContent)\n node.parentNode.removeChild(node);\n};\n\n/**\n * Ensure that text is clipped and the cursor is clamped to the column count.\n */\nhterm.Screen.prototype.maybeClipCurrentRow = function() {\n var width = hterm.TextAttributes.nodeWidth(this.cursorRowNode_);\n\n if (width <= this.columnCount_) {\n // Current row does not need clipping, but may need clamping.\n if (this.cursorPosition.column >= this.columnCount_) {\n this.setCursorPosition(this.cursorPosition.row, this.columnCount_ - 1);\n this.cursorPosition.overflow = true;\n }\n\n return;\n }\n\n // Save off the current column so we can maybe restore it later.\n var currentColumn = this.cursorPosition.column;\n\n // Move the cursor to the final column.\n this.setCursorPosition(this.cursorPosition.row, this.columnCount_ - 1);\n\n // Remove any text that partially overflows.\n width = hterm.TextAttributes.nodeWidth(this.cursorNode_);\n\n if (this.cursorOffset_ < width - 1) {\n this.cursorNode_.textContent = hterm.TextAttributes.nodeSubstr(\n this.cursorNode_, 0, this.cursorOffset_ + 1);\n }\n\n // Remove all nodes after the cursor.\n var rowNode = this.cursorRowNode_;\n var node = this.cursorNode_.nextSibling;\n\n while (node) {\n rowNode.removeChild(node);\n node = this.cursorNode_.nextSibling;\n }\n\n if (currentColumn < this.columnCount_) {\n // If the cursor was within the screen before we started then restore its\n // position.\n this.setCursorPosition(this.cursorPosition.row, currentColumn);\n } else {\n // Otherwise leave it at the the last column in the overflow state.\n this.cursorPosition.overflow = true;\n }\n};\n\n/**\n * Insert a string at the current character position using the current\n * text attributes.\n *\n * You must call maybeClipCurrentRow() after in order to clip overflowed\n * text and clamp the cursor.\n *\n * It is also up to the caller to properly maintain the line overflow state\n * using hterm.Screen..commitLineOverflow().\n */\nhterm.Screen.prototype.insertString = function(str) {\n var cursorNode = this.cursorNode_;\n var cursorNodeText = cursorNode.textContent;\n\n this.cursorRowNode_.removeAttribute('line-overflow');\n\n // We may alter the width of the string by prepending some missing\n // whitespaces, so we need to record the string width ahead of time.\n var strWidth = lib.wc.strWidth(str);\n\n // No matter what, before this function exits the cursor column will have\n // moved this much.\n this.cursorPosition.column += strWidth;\n\n // Local cache of the cursor offset.\n var offset = this.cursorOffset_;\n\n // Reverse offset is the offset measured from the end of the string.\n // Zero implies that the cursor is at the end of the cursor node.\n var reverseOffset = hterm.TextAttributes.nodeWidth(cursorNode) - offset;\n\n if (reverseOffset < 0) {\n // A negative reverse offset means the cursor is positioned past the end\n // of the characters on this line. We'll need to insert the missing\n // whitespace.\n var ws = lib.f.getWhitespace(-reverseOffset);\n\n // This whitespace should be completely unstyled. Underline, background\n // color, and strikethrough would be visible on whitespace, so we can't use\n // one of those spans to hold the text.\n if (!(this.textAttributes.underline ||\n this.textAttributes.strikethrough ||\n this.textAttributes.background ||\n this.textAttributes.wcNode ||\n !this.textAttributes.asciiNode ||\n this.textAttributes.tileData != null)) {\n // Best case scenario, we can just pretend the spaces were part of the\n // original string.\n str = ws + str;\n } else if (cursorNode.nodeType == 3 ||\n !(cursorNode.wcNode ||\n !cursorNode.asciiNode ||\n cursorNode.tileNode ||\n cursorNode.style.textDecoration ||\n cursorNode.style.backgroundColor)) {\n // Second best case, the current node is able to hold the whitespace.\n cursorNode.textContent = (cursorNodeText += ws);\n } else {\n // Worst case, we have to create a new node to hold the whitespace.\n var wsNode = cursorNode.ownerDocument.createTextNode(ws);\n this.cursorRowNode_.insertBefore(wsNode, cursorNode.nextSibling);\n this.cursorNode_ = cursorNode = wsNode;\n this.cursorOffset_ = offset = -reverseOffset;\n cursorNodeText = ws;\n }\n\n // We now know for sure that we're at the last character of the cursor node.\n reverseOffset = 0;\n }\n\n if (this.textAttributes.matchesContainer(cursorNode)) {\n // The new text can be placed directly in the cursor node.\n if (reverseOffset == 0) {\n cursorNode.textContent = cursorNodeText + str;\n } else if (offset == 0) {\n cursorNode.textContent = str + cursorNodeText;\n } else {\n cursorNode.textContent =\n hterm.TextAttributes.nodeSubstr(cursorNode, 0, offset) +\n str + hterm.TextAttributes.nodeSubstr(cursorNode, offset);\n }\n\n this.cursorOffset_ += strWidth;\n return;\n }\n\n // The cursor node is the wrong style for the new text. If we're at the\n // beginning or end of the cursor node, then the adjacent node is also a\n // potential candidate.\n\n if (offset == 0) {\n // At the beginning of the cursor node, the check the previous sibling.\n var previousSibling = cursorNode.previousSibling;\n if (previousSibling &&\n this.textAttributes.matchesContainer(previousSibling)) {\n previousSibling.textContent += str;\n this.cursorNode_ = previousSibling;\n this.cursorOffset_ = lib.wc.strWidth(previousSibling.textContent);\n return;\n }\n\n var newNode = this.textAttributes.createContainer(str);\n this.cursorRowNode_.insertBefore(newNode, cursorNode);\n this.cursorNode_ = newNode;\n this.cursorOffset_ = strWidth;\n return;\n }\n\n if (reverseOffset == 0) {\n // At the end of the cursor node, the check the next sibling.\n var nextSibling = cursorNode.nextSibling;\n if (nextSibling &&\n this.textAttributes.matchesContainer(nextSibling)) {\n nextSibling.textContent = str + nextSibling.textContent;\n this.cursorNode_ = nextSibling;\n this.cursorOffset_ = lib.wc.strWidth(str);\n return;\n }\n\n var newNode = this.textAttributes.createContainer(str);\n this.cursorRowNode_.insertBefore(newNode, nextSibling);\n this.cursorNode_ = newNode;\n // We specifically need to include any missing whitespace here, since it's\n // going in a new node.\n this.cursorOffset_ = hterm.TextAttributes.nodeWidth(newNode);\n return;\n }\n\n // Worst case, we're somewhere in the middle of the cursor node. We'll\n // have to split it into two nodes and insert our new container in between.\n this.splitNode_(cursorNode, offset);\n var newNode = this.textAttributes.createContainer(str);\n this.cursorRowNode_.insertBefore(newNode, cursorNode.nextSibling);\n this.cursorNode_ = newNode;\n this.cursorOffset_ = strWidth;\n};\n\n/**\n * Overwrite the text at the current cursor position.\n *\n * You must call maybeClipCurrentRow() after in order to clip overflowed\n * text and clamp the cursor.\n *\n * It is also up to the caller to properly maintain the line overflow state\n * using hterm.Screen..commitLineOverflow().\n */\nhterm.Screen.prototype.overwriteString = function(str) {\n var maxLength = this.columnCount_ - this.cursorPosition.column;\n if (!maxLength)\n return [str];\n\n var width = lib.wc.strWidth(str);\n if (this.textAttributes.matchesContainer(this.cursorNode_) &&\n this.cursorNode_.textContent.substr(this.cursorOffset_) == str) {\n // This overwrite would be a no-op, just move the cursor and return.\n this.cursorOffset_ += width;\n this.cursorPosition.column += width;\n return;\n }\n\n this.deleteChars(Math.min(width, maxLength));\n this.insertString(str);\n};\n\n/**\n * Forward-delete one or more characters at the current cursor position.\n *\n * Text to the right of the deleted characters is shifted left. Only affects\n * characters on the same row as the cursor.\n *\n * @param {integer} count The column width of characters to delete. This is\n * clamped to the column width minus the cursor column.\n * @return {integer} The column width of the characters actually deleted.\n */\nhterm.Screen.prototype.deleteChars = function(count) {\n var node = this.cursorNode_;\n var offset = this.cursorOffset_;\n\n var currentCursorColumn = this.cursorPosition.column;\n count = Math.min(count, this.columnCount_ - currentCursorColumn);\n if (!count)\n return 0;\n\n var rv = count;\n var startLength, endLength;\n\n while (node && count) {\n startLength = hterm.TextAttributes.nodeWidth(node);\n node.textContent = hterm.TextAttributes.nodeSubstr(node, 0, offset) +\n hterm.TextAttributes.nodeSubstr(node, offset + count);\n endLength = hterm.TextAttributes.nodeWidth(node);\n count -= startLength - endLength;\n if (offset < startLength && endLength && startLength == endLength) {\n // No characters were deleted when there should be. We're probably trying\n // to delete one column width from a wide character node. We remove the\n // wide character node here and replace it with a single space.\n var spaceNode = this.textAttributes.createContainer(' ');\n node.parentNode.insertBefore(spaceNode, node.nextSibling);\n node.textContent = '';\n endLength = 0;\n count -= 1;\n }\n\n var nextNode = node.nextSibling;\n if (endLength == 0 && node != this.cursorNode_) {\n node.parentNode.removeChild(node);\n }\n node = nextNode;\n offset = 0;\n }\n\n // Remove this.cursorNode_ if it is an empty non-text node.\n if (this.cursorNode_.nodeType != 3 && !this.cursorNode_.textContent) {\n var cursorNode = this.cursorNode_;\n if (cursorNode.previousSibling) {\n this.cursorNode_ = cursorNode.previousSibling;\n this.cursorOffset_ = hterm.TextAttributes.nodeWidth(\n cursorNode.previousSibling);\n } else if (cursorNode.nextSibling) {\n this.cursorNode_ = cursorNode.nextSibling;\n this.cursorOffset_ = 0;\n } else {\n var emptyNode = this.cursorRowNode_.ownerDocument.createTextNode('');\n this.cursorRowNode_.appendChild(emptyNode);\n this.cursorNode_ = emptyNode;\n this.cursorOffset_ = 0;\n }\n this.cursorRowNode_.removeChild(cursorNode);\n }\n\n return rv;\n};\n\n/**\n * Finds first X-ROW of a line containing specified X-ROW.\n * Used to support line overflow.\n *\n * @param {Node} row X-ROW to begin search for first row of line.\n * @return {Node} The X-ROW that is at the beginning of the line.\n **/\nhterm.Screen.prototype.getLineStartRow_ = function(row) {\n while (row.previousSibling &&\n row.previousSibling.hasAttribute('line-overflow')) {\n row = row.previousSibling;\n }\n return row;\n};\n\n/**\n * Gets text of a line beginning with row.\n * Supports line overflow.\n *\n * @param {Node} row First X-ROW of line.\n * @return {string} Text content of line.\n **/\nhterm.Screen.prototype.getLineText_ = function(row) {\n var rowText = \"\";\n while (row) {\n rowText += row.textContent;\n if (row.hasAttribute('line-overflow')) {\n row = row.nextSibling;\n } else {\n break;\n }\n }\n return rowText;\n};\n\n/**\n * Returns X-ROW that is ancestor of the node.\n *\n * @param {Node} node Node to get X-ROW ancestor for.\n * @return {Node} X-ROW ancestor of node, or null if not found.\n **/\nhterm.Screen.prototype.getXRowAncestor_ = function(node) {\n while (node) {\n if (node.nodeName === 'X-ROW')\n break;\n node = node.parentNode;\n }\n return node;\n};\n\n/**\n * Returns position within line of character at offset within node.\n * Supports line overflow.\n *\n * @param {Node} row X-ROW at beginning of line.\n * @param {Node} node Node to get position of.\n * @param {integer} offset Offset into node.\n *\n * @return {integer} Position within line of character at offset within node.\n **/\nhterm.Screen.prototype.getPositionWithOverflow_ = function(row, node, offset) {\n if (!node)\n return -1;\n var ancestorRow = this.getXRowAncestor_(node);\n if (!ancestorRow)\n return -1;\n var position = 0;\n while (ancestorRow != row) {\n position += hterm.TextAttributes.nodeWidth(row);\n if (row.hasAttribute('line-overflow') && row.nextSibling) {\n row = row.nextSibling;\n } else {\n return -1;\n }\n }\n return position + this.getPositionWithinRow_(row, node, offset);\n};\n\n/**\n * Returns position within row of character at offset within node.\n * Does not support line overflow.\n *\n * @param {Node} row X-ROW to get position within.\n * @param {Node} node Node to get position for.\n * @param {integer} offset Offset within node to get position for.\n * @return {integer} Position within row of character at offset within node.\n **/\nhterm.Screen.prototype.getPositionWithinRow_ = function(row, node, offset) {\n if (node.parentNode != row) {\n // If we traversed to the top node, then there's nothing to find here.\n if (node.parentNode == null)\n return -1;\n\n return this.getPositionWithinRow_(node.parentNode, node, offset) +\n this.getPositionWithinRow_(row, node.parentNode, 0);\n }\n var position = 0;\n for (var i = 0; i < row.childNodes.length; i++) {\n var currentNode = row.childNodes[i];\n if (currentNode == node)\n return position + offset;\n position += hterm.TextAttributes.nodeWidth(currentNode);\n }\n return -1;\n};\n\n/**\n * Returns the node and offset corresponding to position within line.\n * Supports line overflow.\n *\n * @param {Node} row X-ROW at beginning of line.\n * @param {integer} position Position within line to retrieve node and offset.\n * @return {Array} Two element array containing node and offset respectively.\n **/\nhterm.Screen.prototype.getNodeAndOffsetWithOverflow_ = function(row, position) {\n while (row && position > hterm.TextAttributes.nodeWidth(row)) {\n if (row.hasAttribute('line-overflow') && row.nextSibling) {\n position -= hterm.TextAttributes.nodeWidth(row);\n row = row.nextSibling;\n } else {\n return -1;\n }\n }\n return this.getNodeAndOffsetWithinRow_(row, position);\n};\n\n/**\n * Returns the node and offset corresponding to position within row.\n * Does not support line overflow.\n *\n * @param {Node} row X-ROW to get position within.\n * @param {integer} position Position within row to retrieve node and offset.\n * @return {Array} Two element array containing node and offset respectively.\n **/\nhterm.Screen.prototype.getNodeAndOffsetWithinRow_ = function(row, position) {\n for (var i = 0; i < row.childNodes.length; i++) {\n var node = row.childNodes[i];\n var nodeTextWidth = hterm.TextAttributes.nodeWidth(node);\n if (position <= nodeTextWidth) {\n if (node.nodeName === 'SPAN') {\n /** Drill down to node contained by SPAN. **/\n return this.getNodeAndOffsetWithinRow_(node, position);\n } else {\n return [node, position];\n }\n }\n position -= nodeTextWidth;\n }\n return null;\n};\n\n/**\n * Returns the node and offset corresponding to position within line.\n * Supports line overflow.\n *\n * @param {Node} row X-ROW at beginning of line.\n * @param {integer} start Start position of range within line.\n * @param {integer} end End position of range within line.\n * @param {Range} range Range to modify.\n **/\nhterm.Screen.prototype.setRange_ = function(row, start, end, range) {\n var startNodeAndOffset = this.getNodeAndOffsetWithOverflow_(row, start);\n if (startNodeAndOffset == null)\n return;\n var endNodeAndOffset = this.getNodeAndOffsetWithOverflow_(row, end);\n if (endNodeAndOffset == null)\n return;\n range.setStart(startNodeAndOffset[0], startNodeAndOffset[1]);\n range.setEnd(endNodeAndOffset[0], endNodeAndOffset[1]);\n};\n\n/**\n * Expands selection to surround URLs.\n *\n * @param {Selection} selection Selection to expand.\n **/\nhterm.Screen.prototype.expandSelection = function(selection) {\n if (!selection)\n return;\n\n var range = selection.getRangeAt(0);\n if (!range || range.toString().match(/\\s/))\n return;\n\n var row = this.getLineStartRow_(this.getXRowAncestor_(range.startContainer));\n if (!row)\n return;\n\n var startPosition = this.getPositionWithOverflow_(row,\n range.startContainer,\n range.startOffset);\n if (startPosition == -1)\n return;\n var endPosition = this.getPositionWithOverflow_(row,\n range.endContainer,\n range.endOffset);\n if (endPosition == -1)\n return;\n\n // Use the user configurable match settings.\n var leftMatch = this.wordBreakMatchLeft;\n var rightMatch = this.wordBreakMatchRight;\n var insideMatch = this.wordBreakMatchMiddle;\n\n //Move start to the left.\n var rowText = this.getLineText_(row);\n var lineUpToRange = lib.wc.substring(rowText, 0, endPosition);\n var leftRegularExpression = new RegExp(leftMatch + insideMatch + \"$\");\n var expandedStart = lineUpToRange.search(leftRegularExpression);\n if (expandedStart == -1 || expandedStart > startPosition)\n return;\n\n //Move end to the right.\n var lineFromRange = lib.wc.substring(rowText, startPosition,\n lib.wc.strWidth(rowText));\n var rightRegularExpression = new RegExp(\"^\" + insideMatch + rightMatch);\n var found = lineFromRange.match(rightRegularExpression);\n if (!found)\n return;\n var expandedEnd = startPosition + lib.wc.strWidth(found[0]);\n if (expandedEnd == -1 || expandedEnd < endPosition)\n return;\n\n this.setRange_(row, expandedStart, expandedEnd, range);\n selection.addRange(range);\n};\n// SOURCE FILE: hterm/js/hterm_scrollport.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f', 'hterm.PubSub', 'hterm.Size');\n\n/**\n * A 'viewport' view of fixed-height rows with support for selection and\n * copy-to-clipboard.\n *\n * 'Viewport' in this case means that only the visible rows are in the DOM.\n * If the rowProvider has 100,000 rows, but the ScrollPort is only 25 rows\n * tall, then only 25 dom nodes are created. The ScrollPort will ask the\n * RowProvider to create new visible rows on demand as they are scrolled in\n * to the visible area.\n *\n * This viewport is designed so that select and copy-to-clipboard still works,\n * even when all or part of the selection is scrolled off screen.\n *\n * Note that the X11 mouse clipboard does not work properly when all or part\n * of the selection is off screen. It would be difficult to fix this without\n * adding significant overhead to pathologically large selection cases.\n *\n * The RowProvider should return rows rooted by the custom tag name 'x-row'.\n * This ensures that we can quickly assign the correct display height\n * to the rows with css.\n *\n * @param {RowProvider} rowProvider An object capable of providing rows as\n * raw text or row nodes.\n */\nhterm.ScrollPort = function(rowProvider) {\n hterm.PubSub.addBehavior(this);\n\n this.rowProvider_ = rowProvider;\n\n // SWAG the character size until we can measure it.\n this.characterSize = new hterm.Size(10, 10);\n\n // DOM node used for character measurement.\n this.ruler_ = null;\n\n this.selection = new hterm.ScrollPort.Selection(this);\n\n // A map of rowIndex => rowNode for each row that is drawn as part of a\n // pending redraw_() call. Null if there is no pending redraw_ call.\n this.currentRowNodeCache_ = null;\n\n // A map of rowIndex => rowNode for each row that was drawn as part of the\n // previous redraw_() call.\n this.previousRowNodeCache_ = {};\n\n // Used during scroll events to detect when the underlying cause is a resize.\n this.lastScreenWidth_ = null;\n this.lastScreenHeight_ = null;\n\n // True if the user should be allowed to select text in the terminal.\n // This is disabled when the host requests mouse drag events so that we don't\n // end up with two notions of selection.\n this.selectionEnabled_ = true;\n\n // The last row count returned by the row provider, re-populated during\n // syncScrollHeight().\n this.lastRowCount_ = 0;\n\n // The scroll wheel pixel delta multiplier to increase/decrease\n // the scroll speed of mouse wheel events. See: https://goo.gl/sXelnq\n this.scrollWheelMultiplier_ = 1;\n\n // The last touch events we saw to support touch based scrolling. Indexed\n // by touch identifier since we can have more than one touch active.\n this.lastTouch_ = {};\n\n /**\n * True if the last scroll caused the scrollport to show the final row.\n */\n this.isScrolledEnd = true;\n\n /**\n * A guess at the current scrollbar width, fixed in resize().\n */\n this.currentScrollbarWidthPx = 16;\n\n /**\n * Whether the ctrl-v key on the screen should paste.\n */\n this.ctrlVPaste = false;\n\n this.div_ = null;\n this.document_ = null;\n\n // Collection of active timeout handles.\n this.timeouts_ = {};\n\n this.observers_ = {};\n\n this.DEBUG_ = false;\n}\n\n/**\n * Proxy for the native selection object which understands how to walk up the\n * DOM to find the containing row node and sort out which comes first.\n *\n * @param {hterm.ScrollPort} scrollPort The parent hterm.ScrollPort instance.\n */\nhterm.ScrollPort.Selection = function(scrollPort) {\n this.scrollPort_ = scrollPort;\n\n /**\n * The row containing the start of the selection.\n *\n * This may be partially or fully selected. It may be the selection anchor\n * or the focus, but its rowIndex is guaranteed to be less-than-or-equal-to\n * that of the endRow.\n *\n * If only one row is selected then startRow == endRow. If there is no\n * selection or the selection is collapsed then startRow == null.\n */\n this.startRow = null;\n\n /**\n * The row containing the end of the selection.\n *\n * This may be partially or fully selected. It may be the selection anchor\n * or the focus, but its rowIndex is guaranteed to be greater-than-or-equal-to\n * that of the startRow.\n *\n * If only one row is selected then startRow == endRow. If there is no\n * selection or the selection is collapsed then startRow == null.\n */\n this.endRow = null;\n\n /**\n * True if startRow != endRow.\n */\n this.isMultiline = null;\n\n /**\n * True if the selection is just a point rather than a range.\n */\n this.isCollapsed = null;\n};\n\n/**\n * Given a list of DOM nodes and a container, return the DOM node that\n * is first according to a depth-first search.\n *\n * Returns null if none of the children are found.\n */\nhterm.ScrollPort.Selection.prototype.findFirstChild = function(\n parent, childAry) {\n var node = parent.firstChild;\n\n while (node) {\n if (childAry.indexOf(node) != -1)\n return node;\n\n if (node.childNodes.length) {\n var rv = this.findFirstChild(node, childAry);\n if (rv)\n return rv;\n }\n\n node = node.nextSibling;\n }\n\n return null;\n};\n\n/**\n * Synchronize this object with the current DOM selection.\n *\n * This is a one-way synchronization, the DOM selection is copied to this\n * object, not the other way around.\n */\nhterm.ScrollPort.Selection.prototype.sync = function() {\n var self = this;\n\n // The dom selection object has no way to tell which nodes come first in\n // the document, so we have to figure that out.\n //\n // This function is used when we detect that the \"anchor\" node is first.\n function anchorFirst() {\n self.startRow = anchorRow;\n self.startNode = selection.anchorNode;\n self.startOffset = selection.anchorOffset;\n self.endRow = focusRow;\n self.endNode = selection.focusNode;\n self.endOffset = selection.focusOffset;\n }\n\n // This function is used when we detect that the \"focus\" node is first.\n function focusFirst() {\n self.startRow = focusRow;\n self.startNode = selection.focusNode;\n self.startOffset = selection.focusOffset;\n self.endRow = anchorRow;\n self.endNode = selection.anchorNode;\n self.endOffset = selection.anchorOffset;\n }\n\n var selection = this.scrollPort_.getDocument().getSelection();\n\n this.startRow = null;\n this.endRow = null;\n this.isMultiline = null;\n this.isCollapsed = !selection || selection.isCollapsed;\n\n if (this.isCollapsed)\n return;\n\n var anchorRow = selection.anchorNode;\n while (anchorRow && !('rowIndex' in anchorRow)) {\n anchorRow = anchorRow.parentNode;\n }\n\n if (!anchorRow) {\n console.error('Selection anchor is not rooted in a row node: ' +\n selection.anchorNode.nodeName);\n return;\n }\n\n var focusRow = selection.focusNode;\n while (focusRow && !('rowIndex' in focusRow)) {\n focusRow = focusRow.parentNode;\n }\n\n if (!focusRow) {\n console.error('Selection focus is not rooted in a row node: ' +\n selection.focusNode.nodeName);\n return;\n }\n\n if (anchorRow.rowIndex < focusRow.rowIndex) {\n anchorFirst();\n\n } else if (anchorRow.rowIndex > focusRow.rowIndex) {\n focusFirst();\n\n } else if (selection.focusNode == selection.anchorNode) {\n if (selection.anchorOffset < selection.focusOffset) {\n anchorFirst();\n } else {\n focusFirst();\n }\n\n } else {\n // The selection starts and ends in the same row, but isn't contained all\n // in a single node.\n var firstNode = this.findFirstChild(\n anchorRow, [selection.anchorNode, selection.focusNode]);\n\n if (!firstNode)\n throw new Error('Unexpected error syncing selection.');\n\n if (firstNode == selection.anchorNode) {\n anchorFirst();\n } else {\n focusFirst();\n }\n }\n\n this.isMultiline = anchorRow.rowIndex != focusRow.rowIndex;\n};\n\n\n/**\n * Turn a div into this hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.decorate = function(div) {\n this.div_ = div;\n\n this.iframe_ = div.ownerDocument.createElement('iframe');\n this.iframe_.style.cssText = (\n 'border: 0;' +\n 'height: 100%;' +\n 'position: absolute;' +\n 'width: 100%');\n\n // Set the iframe src to # in FF. Otherwise when the frame's\n // load event fires in FF it clears out the content of the iframe.\n if ('mozInnerScreenX' in window) // detect a FF only property\n this.iframe_.src = '#';\n\n div.appendChild(this.iframe_);\n\n this.iframe_.contentWindow.addEventListener('resize',\n this.onResize_.bind(this));\n\n var doc = this.document_ = this.iframe_.contentDocument;\n doc.body.style.cssText = (\n 'margin: 0px;' +\n 'padding: 0px;' +\n 'height: 100%;' +\n 'width: 100%;' +\n 'overflow: hidden;' +\n 'cursor: var(--hterm-mouse-cursor-style);' +\n '-webkit-user-select: none;' +\n '-moz-user-select: none;');\n\n if (this.DEBUG_) {\n // When we're debugging we add padding to the body so that the offscreen\n // elements are visible.\n this.document_.body.style.paddingTop =\n this.document_.body.style.paddingBottom =\n 'calc(var(--hterm-charsize-height) * 3)';\n }\n\n var style = doc.createElement('style');\n style.textContent = (\n 'x-row {' +\n ' display: block;' +\n ' height: var(--hterm-charsize-height);' +\n ' line-height: var(--hterm-charsize-height);' +\n '}');\n doc.head.appendChild(style);\n\n this.userCssLink_ = doc.createElement('link');\n this.userCssLink_.setAttribute('rel', 'stylesheet');\n\n this.userCssText_ = doc.createElement('style');\n doc.head.appendChild(this.userCssText_);\n\n // TODO(rginda): Sorry, this 'screen_' isn't the same thing as hterm.Screen\n // from screen.js. I need to pick a better name for one of them to avoid\n // the collision.\n // We make this field editable even though we don't actually allow anything\n // to be edited here so that Chrome will do the right thing with virtual\n // keyboards and IMEs. But make sure we turn off all the input helper logic\n // that doesn't make sense here, and might inadvertently mung or save input.\n // Some of these attributes are standard while others are browser specific,\n // but should be safely ignored by other browsers.\n this.screen_ = doc.createElement('x-screen');\n this.screen_.setAttribute('contenteditable', 'true');\n this.screen_.setAttribute('spellcheck', 'false');\n this.screen_.setAttribute('autocomplete', 'off');\n this.screen_.setAttribute('autocorrect', 'off');\n this.screen_.setAttribute('autocaptalize', 'none');\n this.screen_.setAttribute('role', 'textbox');\n this.screen_.setAttribute('tabindex', '-1');\n this.screen_.style.cssText = (\n 'caret-color: transparent;' +\n 'display: block;' +\n 'font-family: monospace;' +\n 'font-size: 15px;' +\n 'font-variant-ligatures: none;' +\n 'height: 100%;' +\n 'overflow-y: scroll; overflow-x: hidden;' +\n 'white-space: pre;' +\n 'width: 100%;' +\n 'outline: none !important');\n\n doc.body.appendChild(this.screen_);\n\n this.screen_.addEventListener('scroll', this.onScroll_.bind(this));\n this.screen_.addEventListener('wheel', this.onScrollWheel_.bind(this));\n this.screen_.addEventListener('touchstart', this.onTouch_.bind(this));\n this.screen_.addEventListener('touchmove', this.onTouch_.bind(this));\n this.screen_.addEventListener('touchend', this.onTouch_.bind(this));\n this.screen_.addEventListener('touchcancel', this.onTouch_.bind(this));\n this.screen_.addEventListener('copy', this.onCopy_.bind(this));\n this.screen_.addEventListener('paste', this.onPaste_.bind(this));\n // Disable drag & drop of text/content. We don't handle it at all (yet?),\n // and the default behavior just confuses hterm.\n this.screen_.addEventListener('drop', function(e) {\n e.preventDefault();\n return false;\n });\n\n doc.body.addEventListener('keydown', this.onBodyKeyDown_.bind(this));\n\n // This is the main container for the fixed rows.\n this.rowNodes_ = doc.createElement('div');\n this.rowNodes_.id = 'hterm:row-nodes';\n this.rowNodes_.style.cssText = (\n 'display: block;' +\n 'position: fixed;' +\n 'overflow: hidden;' +\n '-webkit-user-select: text;' +\n '-moz-user-select: text;');\n this.screen_.appendChild(this.rowNodes_);\n\n // Two nodes to hold offscreen text during the copy event.\n this.topSelectBag_ = doc.createElement('x-select-bag');\n this.topSelectBag_.style.cssText = (\n 'display: block;' +\n 'overflow: hidden;' +\n 'height: var(--hterm-charsize-height);' +\n 'white-space: pre;');\n\n this.bottomSelectBag_ = this.topSelectBag_.cloneNode();\n\n // Nodes above the top fold and below the bottom fold are hidden. They are\n // only used to hold rows that are part of the selection but are currently\n // scrolled off the top or bottom of the visible range.\n this.topFold_ = doc.createElement('x-fold');\n this.topFold_.id = 'hterm:top-fold-for-row-selection';\n this.topFold_.style.cssText = 'display: block;';\n this.rowNodes_.appendChild(this.topFold_);\n\n this.bottomFold_ = this.topFold_.cloneNode();\n this.bottomFold_.id = 'hterm:bottom-fold-for-row-selection';\n this.rowNodes_.appendChild(this.bottomFold_);\n\n // This hidden div accounts for the vertical space that would be consumed by\n // all the rows in the buffer if they were visible. It's what causes the\n // scrollbar to appear on the 'x-screen', and it moves within the screen when\n // the scrollbar is moved.\n //\n // It is set 'visibility: hidden' to keep the browser from trying to include\n // it in the selection when a user 'drag selects' upwards (drag the mouse to\n // select and scroll at the same time). Without this, the selection gets\n // out of whack.\n this.scrollArea_ = doc.createElement('div');\n this.scrollArea_.id = 'hterm:scrollarea';\n this.scrollArea_.style.cssText = 'visibility: hidden';\n this.screen_.appendChild(this.scrollArea_);\n\n // This svg element is used to detect when the browser is zoomed. It must be\n // placed in the outermost document for currentScale to be correct.\n // TODO(rginda): This means that hterm nested in an iframe will not correctly\n // detect browser zoom level. We should come up with a better solution.\n // Note: This must be http:// else Chrome cannot create the element correctly.\n var xmlns = 'http://www.w3.org/2000/svg';\n this.svg_ = this.div_.ownerDocument.createElementNS(xmlns, 'svg');\n this.svg_.id = 'hterm:zoom-detector';\n this.svg_.setAttribute('xmlns', xmlns);\n this.svg_.setAttribute('version', '1.1');\n this.svg_.style.cssText = (\n 'position: absolute;' +\n 'top: 0;' +\n 'left: 0;' +\n 'visibility: hidden');\n\n\n // We send focus to this element just before a paste happens, so we can\n // capture the pasted text and forward it on to someone who cares.\n this.pasteTarget_ = doc.createElement('textarea');\n this.pasteTarget_.id = 'hterm:ctrl-v-paste-target';\n this.pasteTarget_.setAttribute('tabindex', '-1');\n this.pasteTarget_.style.cssText = (\n 'position: absolute;' +\n 'height: 1px;' +\n 'width: 1px;' +\n 'left: 0px; ' +\n 'bottom: 0px;' +\n 'opacity: 0');\n this.pasteTarget_.contentEditable = true;\n\n this.screen_.appendChild(this.pasteTarget_);\n this.pasteTarget_.addEventListener(\n 'textInput', this.handlePasteTargetTextInput_.bind(this));\n\n this.resize();\n};\n\n/**\n * Select the font-family and font-smoothing for this scrollport.\n *\n * @param {string} fontFamily Value of the CSS 'font-family' to use for this\n * scrollport. Should be a monospace font.\n * @param {string} opt_smoothing Optional value for '-webkit-font-smoothing'.\n * Defaults to an empty string if not specified.\n */\nhterm.ScrollPort.prototype.setFontFamily = function(fontFamily, opt_smoothing) {\n this.screen_.style.fontFamily = fontFamily;\n if (opt_smoothing) {\n this.screen_.style.webkitFontSmoothing = opt_smoothing;\n } else {\n this.screen_.style.webkitFontSmoothing = '';\n }\n\n this.syncCharacterSize();\n};\n\nhterm.ScrollPort.prototype.getFontFamily = function() {\n return this.screen_.style.fontFamily;\n};\n\n/**\n * Set a custom stylesheet to include in the scrollport.\n *\n * Defaults to null, meaning no custom css is loaded. Set it back to null or\n * the empty string to remove a previously applied custom css.\n */\nhterm.ScrollPort.prototype.setUserCssUrl = function(url) {\n if (url) {\n this.userCssLink_.setAttribute('href', url);\n\n if (!this.userCssLink_.parentNode)\n this.document_.head.appendChild(this.userCssLink_);\n } else if (this.userCssLink_.parentNode) {\n this.document_.head.removeChild(this.userCssLink_);\n }\n};\n\nhterm.ScrollPort.prototype.setUserCssText = function(text) {\n this.userCssText_.textContent = text;\n};\n\nhterm.ScrollPort.prototype.focus = function() {\n this.iframe_.focus();\n this.screen_.focus();\n};\n\nhterm.ScrollPort.prototype.getForegroundColor = function() {\n return this.screen_.style.color;\n};\n\nhterm.ScrollPort.prototype.setForegroundColor = function(color) {\n this.screen_.style.color = color;\n};\n\nhterm.ScrollPort.prototype.getBackgroundColor = function() {\n return this.screen_.style.backgroundColor;\n};\n\nhterm.ScrollPort.prototype.setBackgroundColor = function(color) {\n this.screen_.style.backgroundColor = color;\n};\n\nhterm.ScrollPort.prototype.setBackgroundImage = function(image) {\n this.screen_.style.backgroundImage = image;\n};\n\nhterm.ScrollPort.prototype.setBackgroundSize = function(size) {\n this.screen_.style.backgroundSize = size;\n};\n\nhterm.ScrollPort.prototype.setBackgroundPosition = function(position) {\n this.screen_.style.backgroundPosition = position;\n};\n\nhterm.ScrollPort.prototype.setCtrlVPaste = function(ctrlVPaste) {\n this.ctrlVPaste = ctrlVPaste;\n};\n\n/**\n * Get the usable size of the scrollport screen.\n *\n * The width will not include the scrollbar width.\n */\nhterm.ScrollPort.prototype.getScreenSize = function() {\n var size = hterm.getClientSize(this.screen_);\n return {\n height: size.height,\n width: size.width - this.currentScrollbarWidthPx\n };\n};\n\n/**\n * Get the usable width of the scrollport screen.\n *\n * This the widget width minus scrollbar width.\n */\nhterm.ScrollPort.prototype.getScreenWidth = function() {\n return this.getScreenSize().width ;\n};\n\n/**\n * Get the usable height of the scrollport screen.\n */\nhterm.ScrollPort.prototype.getScreenHeight = function() {\n return this.getScreenSize().height;\n};\n\n/**\n * Return the document that holds the visible rows of this hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.getDocument = function() {\n return this.document_;\n};\n\n/**\n * Returns the x-screen element that holds the rows of this hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.getScreenNode = function() {\n return this.screen_;\n};\n\n/**\n * Clear out any cached rowNodes.\n */\nhterm.ScrollPort.prototype.resetCache = function() {\n this.currentRowNodeCache_ = null;\n this.previousRowNodeCache_ = {};\n};\n\n/**\n * Change the current rowProvider.\n *\n * This will clear the row cache and cause a redraw.\n *\n * @param {Object} rowProvider An object capable of providing the rows\n * in this hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.setRowProvider = function(rowProvider) {\n this.resetCache();\n this.rowProvider_ = rowProvider;\n this.scheduleRedraw();\n};\n\n/**\n * Inform the ScrollPort that the root DOM nodes for some or all of the visible\n * rows are no longer valid.\n *\n * Specifically, this should be called if this.rowProvider_.getRowNode() now\n * returns an entirely different node than it did before. It does not\n * need to be called if the content of a row node is the only thing that\n * changed.\n *\n * This skips some of the overhead of a full redraw, but should not be used\n * in cases where the scrollport has been scrolled, or when the row count has\n * changed.\n */\nhterm.ScrollPort.prototype.invalidate = function() {\n var node = this.topFold_.nextSibling;\n while (node != this.bottomFold_) {\n var nextSibling = node.nextSibling;\n node.parentElement.removeChild(node);\n node = nextSibling;\n }\n\n this.previousRowNodeCache_ = null;\n var topRowIndex = this.getTopRowIndex();\n var bottomRowIndex = this.getBottomRowIndex(topRowIndex);\n\n this.drawVisibleRows_(topRowIndex, bottomRowIndex);\n};\n\nhterm.ScrollPort.prototype.scheduleInvalidate = function() {\n if (this.timeouts_.invalidate)\n return;\n\n var self = this;\n this.timeouts_.invalidate = setTimeout(function () {\n delete self.timeouts_.invalidate;\n self.invalidate();\n }, 0);\n};\n\n/**\n * Set the font size of the ScrollPort.\n */\nhterm.ScrollPort.prototype.setFontSize = function(px) {\n this.screen_.style.fontSize = px + 'px';\n this.syncCharacterSize();\n};\n\n/**\n * Return the current font size of the ScrollPort.\n */\nhterm.ScrollPort.prototype.getFontSize = function() {\n return parseInt(this.screen_.style.fontSize);\n};\n\n/**\n * Measure the size of a single character in pixels.\n *\n * @param {string} opt_weight The font weight to measure, or 'normal' if\n * omitted.\n * @return {hterm.Size} A new hterm.Size object.\n */\nhterm.ScrollPort.prototype.measureCharacterSize = function(opt_weight) {\n // Number of lines used to average the height of a single character.\n var numberOfLines = 100;\n // Number of chars per line used to average the width of a single character.\n var lineLength = 100;\n\n if (!this.ruler_) {\n this.ruler_ = this.document_.createElement('div');\n this.ruler_.id = 'hterm:ruler-character-size';\n this.ruler_.style.cssText = (\n 'position: absolute;' +\n 'top: 0;' +\n 'left: 0;' +\n 'visibility: hidden;' +\n 'height: auto !important;' +\n 'width: auto !important;');\n\n // We need to put the text in a span to make the size calculation\n // work properly in Firefox\n this.rulerSpan_ = this.document_.createElement('span');\n this.rulerSpan_.id = 'hterm:ruler-span-workaround';\n this.rulerSpan_.innerHTML =\n ('X'.repeat(lineLength) + '\\r').repeat(numberOfLines);\n this.ruler_.appendChild(this.rulerSpan_);\n\n this.rulerBaseline_ = this.document_.createElement('span');\n this.rulerSpan_.id = 'hterm:ruler-baseline';\n // We want to collapse it on the baseline\n this.rulerBaseline_.style.fontSize = '0px';\n this.rulerBaseline_.textContent = 'X';\n }\n\n this.rulerSpan_.style.fontWeight = opt_weight || '';\n\n this.rowNodes_.appendChild(this.ruler_);\n var rulerSize = hterm.getClientSize(this.rulerSpan_);\n\n var size = new hterm.Size(rulerSize.width / lineLength,\n rulerSize.height / numberOfLines);\n\n this.ruler_.appendChild(this.rulerBaseline_);\n size.baseline = this.rulerBaseline_.offsetTop;\n this.ruler_.removeChild(this.rulerBaseline_);\n\n this.rowNodes_.removeChild(this.ruler_);\n\n this.div_.ownerDocument.body.appendChild(this.svg_);\n size.zoomFactor = this.svg_.currentScale;\n this.div_.ownerDocument.body.removeChild(this.svg_);\n\n return size;\n};\n\n/**\n * Synchronize the character size.\n *\n * This will re-measure the current character size and adjust the height\n * of an x-row to match.\n */\nhterm.ScrollPort.prototype.syncCharacterSize = function() {\n this.characterSize = this.measureCharacterSize();\n\n this.resize();\n};\n\n/**\n * Reset dimensions and visible row count to account for a change in the\n * dimensions of the 'x-screen'.\n */\nhterm.ScrollPort.prototype.resize = function() {\n this.currentScrollbarWidthPx = hterm.getClientWidth(this.screen_) -\n this.screen_.clientWidth;\n\n this.syncScrollHeight();\n this.syncRowNodesDimensions_();\n\n var self = this;\n this.publish(\n 'resize', { scrollPort: this },\n function() {\n self.scrollRowToBottom(self.rowProvider_.getRowCount());\n self.scheduleRedraw();\n });\n};\n\n/**\n * Set the position and size of the row nodes element.\n */\nhterm.ScrollPort.prototype.syncRowNodesDimensions_ = function() {\n var screenSize = this.getScreenSize();\n\n this.lastScreenWidth_ = screenSize.width;\n this.lastScreenHeight_ = screenSize.height;\n\n // We don't want to show a partial row because it would be distracting\n // in a terminal, so we floor any fractional row count.\n this.visibleRowCount = lib.f.smartFloorDivide(\n screenSize.height, this.characterSize.height);\n\n // Then compute the height of our integral number of rows.\n var visibleRowsHeight = this.visibleRowCount * this.characterSize.height;\n\n // Then the difference between the screen height and total row height needs to\n // be made up for as top margin. We need to record this value so it\n // can be used later to determine the topRowIndex.\n this.visibleRowTopMargin = 0;\n this.visibleRowBottomMargin = screenSize.height - visibleRowsHeight;\n\n this.topFold_.style.marginBottom = this.visibleRowTopMargin + 'px';\n\n\n var topFoldOffset = 0;\n var node = this.topFold_.previousSibling;\n while (node) {\n topFoldOffset += hterm.getClientHeight(node);\n node = node.previousSibling;\n }\n\n // Set the dimensions of the visible rows container.\n this.rowNodes_.style.width = screenSize.width + 'px';\n this.rowNodes_.style.height = visibleRowsHeight + topFoldOffset + 'px';\n this.rowNodes_.style.left = this.screen_.offsetLeft + 'px';\n this.rowNodes_.style.top = this.screen_.offsetTop - topFoldOffset + 'px';\n};\n\nhterm.ScrollPort.prototype.syncScrollHeight = function() {\n // Resize the scroll area to appear as though it contains every row.\n this.lastRowCount_ = this.rowProvider_.getRowCount();\n this.scrollArea_.style.height = (this.characterSize.height *\n this.lastRowCount_ +\n this.visibleRowTopMargin +\n this.visibleRowBottomMargin +\n 'px');\n};\n\n/**\n * Schedule a redraw to happen asynchronously.\n *\n * If this method is called multiple times before the redraw has a chance to\n * run only one redraw occurs.\n */\nhterm.ScrollPort.prototype.scheduleRedraw = function() {\n if (this.timeouts_.redraw)\n return;\n\n var self = this;\n this.timeouts_.redraw = setTimeout(function () {\n delete self.timeouts_.redraw;\n self.redraw_();\n }, 0);\n};\n\n/**\n * Redraw the current hterm.ScrollPort based on the current scrollbar position.\n *\n * When redrawing, we are careful to make sure that the rows that start or end\n * the current selection are not touched in any way. Doing so would disturb\n * the selection, and cleaning up after that would cause flashes at best and\n * incorrect selection at worst. Instead, we modify the DOM around these nodes.\n * We even stash the selection start/end outside of the visible area if\n * they are not supposed to be visible in the hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.redraw_ = function() {\n this.resetSelectBags_();\n this.selection.sync();\n\n this.syncScrollHeight();\n\n this.currentRowNodeCache_ = {};\n\n var topRowIndex = this.getTopRowIndex();\n var bottomRowIndex = this.getBottomRowIndex(topRowIndex);\n\n this.drawTopFold_(topRowIndex);\n this.drawBottomFold_(bottomRowIndex);\n this.drawVisibleRows_(topRowIndex, bottomRowIndex);\n\n this.syncRowNodesDimensions_();\n\n this.previousRowNodeCache_ = this.currentRowNodeCache_;\n this.currentRowNodeCache_ = null;\n\n this.isScrolledEnd = (\n this.getTopRowIndex() + this.visibleRowCount >= this.lastRowCount_);\n};\n\n/**\n * Ensure that the nodes above the top fold are as they should be.\n *\n * If the selection start and/or end nodes are above the visible range\n * of this hterm.ScrollPort then the dom will be adjusted so that they appear\n * before the top fold (the first x-fold element, aka this.topFold).\n *\n * If not, the top fold will be the first element.\n *\n * It is critical that this method does not move the selection nodes. Doing\n * so would clear the current selection. Instead, the rest of the DOM is\n * adjusted around them.\n */\nhterm.ScrollPort.prototype.drawTopFold_ = function(topRowIndex) {\n if (!this.selection.startRow ||\n this.selection.startRow.rowIndex >= topRowIndex) {\n // Selection is entirely below the top fold, just make sure the fold is\n // the first child.\n if (this.rowNodes_.firstChild != this.topFold_)\n this.rowNodes_.insertBefore(this.topFold_, this.rowNodes_.firstChild);\n\n return;\n }\n\n if (!this.selection.isMultiline ||\n this.selection.endRow.rowIndex >= topRowIndex) {\n // Only the startRow is above the fold.\n if (this.selection.startRow.nextSibling != this.topFold_)\n this.rowNodes_.insertBefore(this.topFold_,\n this.selection.startRow.nextSibling);\n } else {\n // Both rows are above the fold.\n if (this.selection.endRow.nextSibling != this.topFold_) {\n this.rowNodes_.insertBefore(this.topFold_,\n this.selection.endRow.nextSibling);\n }\n\n // Trim any intermediate lines.\n while (this.selection.startRow.nextSibling !=\n this.selection.endRow) {\n this.rowNodes_.removeChild(this.selection.startRow.nextSibling);\n }\n }\n\n while(this.rowNodes_.firstChild != this.selection.startRow) {\n this.rowNodes_.removeChild(this.rowNodes_.firstChild);\n }\n};\n\n/**\n * Ensure that the nodes below the bottom fold are as they should be.\n *\n * If the selection start and/or end nodes are below the visible range\n * of this hterm.ScrollPort then the dom will be adjusted so that they appear\n * after the bottom fold (the second x-fold element, aka this.bottomFold).\n *\n * If not, the bottom fold will be the last element.\n *\n * It is critical that this method does not move the selection nodes. Doing\n * so would clear the current selection. Instead, the rest of the DOM is\n * adjusted around them.\n */\nhterm.ScrollPort.prototype.drawBottomFold_ = function(bottomRowIndex) {\n if (!this.selection.endRow ||\n this.selection.endRow.rowIndex <= bottomRowIndex) {\n // Selection is entirely above the bottom fold, just make sure the fold is\n // the last child.\n if (this.rowNodes_.lastChild != this.bottomFold_)\n this.rowNodes_.appendChild(this.bottomFold_);\n\n return;\n }\n\n if (!this.selection.isMultiline ||\n this.selection.startRow.rowIndex <= bottomRowIndex) {\n // Only the endRow is below the fold.\n if (this.bottomFold_.nextSibling != this.selection.endRow)\n this.rowNodes_.insertBefore(this.bottomFold_,\n this.selection.endRow);\n } else {\n // Both rows are below the fold.\n if (this.bottomFold_.nextSibling != this.selection.startRow) {\n this.rowNodes_.insertBefore(this.bottomFold_,\n this.selection.startRow);\n }\n\n // Trim any intermediate lines.\n while (this.selection.startRow.nextSibling !=\n this.selection.endRow) {\n this.rowNodes_.removeChild(this.selection.startRow.nextSibling);\n }\n }\n\n while(this.rowNodes_.lastChild != this.selection.endRow) {\n this.rowNodes_.removeChild(this.rowNodes_.lastChild);\n }\n};\n\n/**\n * Ensure that the rows between the top and bottom folds are as they should be.\n *\n * This method assumes that drawTopFold_() and drawBottomFold_() have already\n * run, and that they have left any visible selection row (selection start\n * or selection end) between the folds.\n *\n * It recycles DOM nodes from the previous redraw where possible, but will ask\n * the rowSource to make new nodes if necessary.\n *\n * It is critical that this method does not move the selection nodes. Doing\n * so would clear the current selection. Instead, the rest of the DOM is\n * adjusted around them.\n */\nhterm.ScrollPort.prototype.drawVisibleRows_ = function(\n topRowIndex, bottomRowIndex) {\n var self = this;\n\n // Keep removing nodes, starting with currentNode, until we encounter\n // targetNode. Throws on failure.\n function removeUntilNode(currentNode, targetNode) {\n while (currentNode != targetNode) {\n if (!currentNode)\n throw 'Did not encounter target node';\n\n if (currentNode == self.bottomFold_)\n throw 'Encountered bottom fold before target node';\n\n var deadNode = currentNode;\n currentNode = currentNode.nextSibling;\n deadNode.parentNode.removeChild(deadNode);\n }\n }\n\n // Shorthand for things we're going to use a lot.\n var selectionStartRow = this.selection.startRow;\n var selectionEndRow = this.selection.endRow;\n var bottomFold = this.bottomFold_;\n\n // The node we're examining during the current iteration.\n var node = this.topFold_.nextSibling;\n\n var targetDrawCount = Math.min(this.visibleRowCount,\n this.rowProvider_.getRowCount());\n\n for (var drawCount = 0; drawCount < targetDrawCount; drawCount++) {\n var rowIndex = topRowIndex + drawCount;\n\n if (node == bottomFold) {\n // We've hit the bottom fold, we need to insert a new row.\n var newNode = this.fetchRowNode_(rowIndex);\n if (!newNode) {\n console.log(\"Couldn't fetch row index: \" + rowIndex);\n break;\n }\n\n this.rowNodes_.insertBefore(newNode, node);\n continue;\n }\n\n if (node.rowIndex == rowIndex) {\n // This node is in the right place, move along.\n node = node.nextSibling;\n continue;\n }\n\n if (selectionStartRow && selectionStartRow.rowIndex == rowIndex) {\n // The selection start row is supposed to be here, remove nodes until\n // we find it.\n removeUntilNode(node, selectionStartRow);\n node = selectionStartRow.nextSibling;\n continue;\n }\n\n if (selectionEndRow && selectionEndRow.rowIndex == rowIndex) {\n // The selection end row is supposed to be here, remove nodes until\n // we find it.\n removeUntilNode(node, selectionEndRow);\n node = selectionEndRow.nextSibling;\n continue;\n }\n\n if (node == selectionStartRow || node == selectionEndRow) {\n // We encountered the start/end of the selection, but we don't want it\n // yet. Insert a new row instead.\n var newNode = this.fetchRowNode_(rowIndex);\n if (!newNode) {\n console.log(\"Couldn't fetch row index: \" + rowIndex);\n break;\n }\n\n this.rowNodes_.insertBefore(newNode, node);\n continue;\n }\n\n // There is nothing special about this node, but it's in our way. Replace\n // it with the node that should be here.\n var newNode = this.fetchRowNode_(rowIndex);\n if (!newNode) {\n console.log(\"Couldn't fetch row index: \" + rowIndex);\n break;\n }\n\n if (node == newNode) {\n node = node.nextSibling;\n continue;\n }\n\n this.rowNodes_.insertBefore(newNode, node);\n if (!newNode.nextSibling)\n debugger;\n this.rowNodes_.removeChild(node);\n node = newNode.nextSibling;\n }\n\n if (node != this.bottomFold_)\n removeUntilNode(node, bottomFold);\n};\n\n/**\n * Empty out both select bags and remove them from the document.\n *\n * These nodes hold the text between the start and end of the selection\n * when that text is otherwise off screen. They are filled out in the\n * onCopy_ event.\n */\nhterm.ScrollPort.prototype.resetSelectBags_ = function() {\n if (this.topSelectBag_.parentNode) {\n this.topSelectBag_.textContent = '';\n this.topSelectBag_.parentNode.removeChild(this.topSelectBag_);\n }\n\n if (this.bottomSelectBag_.parentNode) {\n this.bottomSelectBag_.textContent = '';\n this.bottomSelectBag_.parentNode.removeChild(this.bottomSelectBag_);\n }\n};\n\n/**\n * Place a row node in the cache of visible nodes.\n *\n * This method may only be used during a redraw_.\n */\nhterm.ScrollPort.prototype.cacheRowNode_ = function(rowNode) {\n this.currentRowNodeCache_[rowNode.rowIndex] = rowNode;\n};\n\n/**\n * Fetch the row node for the given index.\n *\n * This will return a node from the cache if possible, or will request one\n * from the RowProvider if not.\n *\n * If a redraw_ is in progress the row will be added to the current cache.\n */\nhterm.ScrollPort.prototype.fetchRowNode_ = function(rowIndex) {\n var node;\n\n if (this.previousRowNodeCache_ && rowIndex in this.previousRowNodeCache_) {\n node = this.previousRowNodeCache_[rowIndex];\n } else {\n node = this.rowProvider_.getRowNode(rowIndex);\n }\n\n if (this.currentRowNodeCache_)\n this.cacheRowNode_(node);\n\n return node;\n};\n\n/**\n * Select all rows in the viewport.\n */\nhterm.ScrollPort.prototype.selectAll = function() {\n var firstRow;\n\n if (this.topFold_.nextSibling.rowIndex != 0) {\n while (this.topFold_.previousSibling) {\n this.rowNodes_.removeChild(this.topFold_.previousSibling);\n }\n\n firstRow = this.fetchRowNode_(0);\n this.rowNodes_.insertBefore(firstRow, this.topFold_);\n this.syncRowNodesDimensions_();\n } else {\n firstRow = this.topFold_.nextSibling;\n }\n\n var lastRowIndex = this.rowProvider_.getRowCount() - 1;\n var lastRow;\n\n if (this.bottomFold_.previousSibling.rowIndex != lastRowIndex) {\n while (this.bottomFold_.nextSibling) {\n this.rowNodes_.removeChild(this.bottomFold_.nextSibling);\n }\n\n lastRow = this.fetchRowNode_(lastRowIndex);\n this.rowNodes_.appendChild(lastRow);\n } else {\n lastRow = this.bottomFold_.previousSibling.rowIndex;\n }\n\n var selection = this.document_.getSelection();\n selection.collapse(firstRow, 0);\n selection.extend(lastRow, lastRow.childNodes.length);\n\n this.selection.sync();\n};\n\n/**\n * Return the maximum scroll position in pixels.\n */\nhterm.ScrollPort.prototype.getScrollMax_ = function(e) {\n return (hterm.getClientHeight(this.scrollArea_) +\n this.visibleRowTopMargin + this.visibleRowBottomMargin -\n hterm.getClientHeight(this.screen_));\n};\n\n/**\n * Scroll the given rowIndex to the top of the hterm.ScrollPort.\n *\n * @param {integer} rowIndex Index of the target row.\n */\nhterm.ScrollPort.prototype.scrollRowToTop = function(rowIndex) {\n this.syncScrollHeight();\n\n this.isScrolledEnd = (\n rowIndex + this.visibleRowCount >= this.lastRowCount_);\n\n var scrollTop = rowIndex * this.characterSize.height +\n this.visibleRowTopMargin;\n\n var scrollMax = this.getScrollMax_();\n if (scrollTop > scrollMax)\n scrollTop = scrollMax;\n\n if (this.screen_.scrollTop == scrollTop)\n return;\n\n this.screen_.scrollTop = scrollTop;\n this.scheduleRedraw();\n};\n\n/**\n * Scroll the given rowIndex to the bottom of the hterm.ScrollPort.\n *\n * @param {integer} rowIndex Index of the target row.\n */\nhterm.ScrollPort.prototype.scrollRowToBottom = function(rowIndex) {\n this.syncScrollHeight();\n\n this.isScrolledEnd = (\n rowIndex + this.visibleRowCount >= this.lastRowCount_);\n\n var scrollTop = rowIndex * this.characterSize.height +\n this.visibleRowTopMargin + this.visibleRowBottomMargin;\n scrollTop -= this.visibleRowCount * this.characterSize.height;\n\n if (scrollTop < 0)\n scrollTop = 0;\n\n if (this.screen_.scrollTop == scrollTop)\n return;\n\n this.screen_.scrollTop = scrollTop;\n};\n\n/**\n * Return the row index of the first visible row.\n *\n * This is based on the scroll position. If a redraw_ is in progress this\n * returns the row that *should* be at the top.\n */\nhterm.ScrollPort.prototype.getTopRowIndex = function() {\n return Math.round(this.screen_.scrollTop / this.characterSize.height);\n};\n\n/**\n * Return the row index of the last visible row.\n *\n * This is based on the scroll position. If a redraw_ is in progress this\n * returns the row that *should* be at the bottom.\n */\nhterm.ScrollPort.prototype.getBottomRowIndex = function(topRowIndex) {\n return topRowIndex + this.visibleRowCount - 1;\n};\n\n/**\n * Handler for scroll events.\n *\n * The onScroll event fires when scrollArea's scrollTop property changes. This\n * may be due to the user manually move the scrollbar, or a programmatic change.\n */\nhterm.ScrollPort.prototype.onScroll_ = function(e) {\n var screenSize = this.getScreenSize();\n if (screenSize.width != this.lastScreenWidth_ ||\n screenSize.height != this.lastScreenHeight_) {\n // This event may also fire during a resize (but before the resize event!).\n // This happens when the browser moves the scrollbar as part of the resize.\n // In these cases, we want to ignore the scroll event and let onResize\n // handle things. If we don't, then we end up scrolling to the wrong\n // position after a resize.\n this.resize();\n return;\n }\n\n this.redraw_();\n this.publish('scroll', { scrollPort: this });\n};\n\n/**\n * Clients can override this if they want to hear scrollwheel events.\n *\n * Clients may call event.preventDefault() if they want to keep the scrollport\n * from also handling the events.\n */\nhterm.ScrollPort.prototype.onScrollWheel = function(e) {};\n\n/**\n * Handler for scroll-wheel events.\n *\n * The onScrollWheel event fires when the user moves their scrollwheel over this\n * hterm.ScrollPort. Because the frontmost element in the hterm.ScrollPort is\n * a fixed position DIV, the scroll wheel does nothing by default. Instead, we\n * have to handle it manually.\n */\nhterm.ScrollPort.prototype.onScrollWheel_ = function(e) {\n this.onScrollWheel(e);\n\n if (e.defaultPrevented)\n return;\n\n // Figure out how far this event wants us to scroll.\n var delta = this.scrollWheelDelta(e);\n\n var top = this.screen_.scrollTop - delta;\n if (top < 0)\n top = 0;\n\n var scrollMax = this.getScrollMax_();\n if (top > scrollMax)\n top = scrollMax;\n\n if (top != this.screen_.scrollTop) {\n // Moving scrollTop causes a scroll event, which triggers the redraw.\n this.screen_.scrollTop = top;\n\n // Only preventDefault when we've actually scrolled. If there's nothing\n // to scroll we want to pass the event through so Chrome can detect the\n // overscroll.\n e.preventDefault();\n }\n};\n\n/**\n * Calculate how far a wheel event should scroll.\n *\n * @param {WheelEvent} e The mouse wheel event to process.\n * @return {number} How far (in pixels) to scroll.\n */\nhterm.ScrollPort.prototype.scrollWheelDelta = function(e) {\n var delta;\n\n switch (e.deltaMode) {\n case WheelEvent.DOM_DELTA_PIXEL:\n delta = e.deltaY * this.scrollWheelMultiplier_;\n break;\n case WheelEvent.DOM_DELTA_LINE:\n delta = e.deltaY * this.characterSize.height;\n break;\n case WheelEvent.DOM_DELTA_PAGE:\n delta = e.deltaY * this.characterSize.height * this.screen_.getHeight();\n break;\n }\n\n // The sign is inverted from what we would expect.\n return delta * -1;\n};\n\n\n/**\n * Clients can override this if they want to hear touch events.\n *\n * Clients may call event.preventDefault() if they want to keep the scrollport\n * from also handling the events.\n */\nhterm.ScrollPort.prototype.onTouch = function(e) {};\n\n/**\n * Handler for touch events.\n */\nhterm.ScrollPort.prototype.onTouch_ = function(e) {\n this.onTouch(e);\n\n if (e.defaultPrevented)\n return;\n\n // Extract the fields from the Touch event that we need. If we saved the\n // event directly, it has references to other objects (like x-row) that\n // might stick around for a long time. This way we only have small objects\n // in our lastTouch_ state.\n var scrubTouch = function(t) {\n return {\n id: t.identifier,\n y: t.clientY,\n x: t.clientX,\n };\n };\n\n var i, touch;\n switch (e.type) {\n case 'touchstart':\n // Save the current set of touches.\n for (i = 0; i < e.changedTouches.length; ++i) {\n touch = scrubTouch(e.changedTouches[i]);\n this.lastTouch_[touch.id] = touch;\n }\n break;\n\n case 'touchcancel':\n case 'touchend':\n // Throw away existing touches that we're finished with.\n for (i = 0; i < e.changedTouches.length; ++i)\n delete this.lastTouch_[e.changedTouches[i].identifier];\n break;\n\n case 'touchmove':\n // Walk all of the touches in this one event and merge all of their\n // changes into one delta. This lets multiple fingers scroll faster.\n var delta = 0;\n for (i = 0; i < e.changedTouches.length; ++i) {\n touch = scrubTouch(e.changedTouches[i]);\n delta += (this.lastTouch_[touch.id].y - touch.y);\n this.lastTouch_[touch.id] = touch;\n }\n\n // Invert to match the touchscreen scrolling direction of browser windows.\n delta *= -1;\n\n var top = this.screen_.scrollTop - delta;\n if (top < 0)\n top = 0;\n\n var scrollMax = this.getScrollMax_();\n if (top > scrollMax)\n top = scrollMax;\n\n if (top != this.screen_.scrollTop) {\n // Moving scrollTop causes a scroll event, which triggers the redraw.\n this.screen_.scrollTop = top;\n }\n break;\n }\n\n // To disable gestures or anything else interfering with our scrolling.\n e.preventDefault();\n};\n\n/**\n * Handler for resize events.\n *\n * The browser will resize us such that the top row stays at the top, but we\n * prefer to the bottom row to stay at the bottom.\n */\nhterm.ScrollPort.prototype.onResize_ = function(e) {\n // Re-measure, since onResize also happens for browser zoom changes.\n this.syncCharacterSize();\n this.resize();\n};\n\n/**\n * Clients can override this if they want to hear copy events.\n *\n * Clients may call event.preventDefault() if they want to keep the scrollport\n * from also handling the events.\n */\nhterm.ScrollPort.prototype.onCopy = function(e) { };\n\n/**\n * Handler for copy-to-clipboard events.\n *\n * If some or all of the selected rows are off screen we may need to fill in\n * the rows between selection start and selection end. This handler determines\n * if we're missing some of the selected text, and if so populates one or both\n * of the \"select bags\" with the missing text.\n */\nhterm.ScrollPort.prototype.onCopy_ = function(e) {\n this.onCopy(e);\n\n if (e.defaultPrevented)\n return;\n\n this.resetSelectBags_();\n this.selection.sync();\n\n if (!this.selection.startRow ||\n this.selection.endRow.rowIndex - this.selection.startRow.rowIndex < 2) {\n return;\n }\n\n var topRowIndex = this.getTopRowIndex();\n var bottomRowIndex = this.getBottomRowIndex(topRowIndex);\n\n if (this.selection.startRow.rowIndex < topRowIndex) {\n // Start of selection is above the top fold.\n var endBackfillIndex;\n\n if (this.selection.endRow.rowIndex < topRowIndex) {\n // Entire selection is above the top fold.\n endBackfillIndex = this.selection.endRow.rowIndex;\n } else {\n // Selection extends below the top fold.\n endBackfillIndex = this.topFold_.nextSibling.rowIndex;\n }\n\n this.topSelectBag_.textContent = this.rowProvider_.getRowsText(\n this.selection.startRow.rowIndex + 1, endBackfillIndex);\n this.rowNodes_.insertBefore(this.topSelectBag_,\n this.selection.startRow.nextSibling);\n this.syncRowNodesDimensions_();\n }\n\n if (this.selection.endRow.rowIndex > bottomRowIndex) {\n // Selection ends below the bottom fold.\n var startBackfillIndex;\n\n if (this.selection.startRow.rowIndex > bottomRowIndex) {\n // Entire selection is below the bottom fold.\n startBackfillIndex = this.selection.startRow.rowIndex + 1;\n } else {\n // Selection starts above the bottom fold.\n startBackfillIndex = this.bottomFold_.previousSibling.rowIndex + 1;\n }\n\n this.bottomSelectBag_.textContent = this.rowProvider_.getRowsText(\n startBackfillIndex, this.selection.endRow.rowIndex);\n this.rowNodes_.insertBefore(this.bottomSelectBag_, this.selection.endRow);\n }\n};\n\n/**\n * Focuses on the paste target on a ctrl-v keydown event, as in\n * FF a content editable element must be focused before the paste event.\n */\nhterm.ScrollPort.prototype.onBodyKeyDown_ = function(e) {\n if (!this.ctrlVPaste)\n return;\n\n var key = String.fromCharCode(e.which);\n var lowerKey = key.toLowerCase();\n if ((e.ctrlKey || e.metaKey) && lowerKey == \"v\")\n this.pasteTarget_.focus();\n};\n\n/**\n * Handle a paste event on the the ScrollPort's screen element.\n */\nhterm.ScrollPort.prototype.onPaste_ = function(e) {\n this.pasteTarget_.focus();\n\n var self = this;\n setTimeout(function() {\n self.publish('paste', { text: self.pasteTarget_.value });\n self.pasteTarget_.value = '';\n self.screen_.focus();\n }, 0);\n};\n\n/**\n * Handles a textInput event on the paste target. Stops this from\n * propagating as we want this to be handled in the onPaste_ method.\n */\nhterm.ScrollPort.prototype.handlePasteTargetTextInput_ = function(e) {\n e.stopPropagation();\n};\n\n/**\n * Set the vertical scrollbar mode of the ScrollPort.\n */\nhterm.ScrollPort.prototype.setScrollbarVisible = function(state) {\n this.screen_.style.overflowY = state ? 'scroll' : 'hidden';\n};\n\n/**\n * Set scroll wheel multiplier. This alters how much the screen scrolls on\n * mouse wheel events.\n */\nhterm.ScrollPort.prototype.setScrollWheelMoveMultipler = function(multiplier) {\n this.scrollWheelMultiplier_ = multiplier;\n};\n// SOURCE FILE: hterm/js/hterm_terminal.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.colors', 'lib.PreferenceManager', 'lib.resource', 'lib.wc',\n 'lib.f', 'hterm.Keyboard', 'hterm.Options', 'hterm.PreferenceManager',\n 'hterm.Screen', 'hterm.ScrollPort', 'hterm.Size',\n 'hterm.TextAttributes', 'hterm.VT');\n\n/**\n * Constructor for the Terminal class.\n *\n * A Terminal pulls together the hterm.ScrollPort, hterm.Screen and hterm.VT100\n * classes to provide the complete terminal functionality.\n *\n * There are a number of lower-level Terminal methods that can be called\n * directly to manipulate the cursor, text, scroll region, and other terminal\n * attributes. However, the primary method is interpret(), which parses VT\n * escape sequences and invokes the appropriate Terminal methods.\n *\n * This class was heavily influenced by Cory Maccarrone's Framebuffer class.\n *\n * TODO(rginda): Eventually we're going to need to support characters which are\n * displayed twice as wide as standard latin characters. This is to support\n * CJK (and possibly other character sets).\n *\n * @param {string} opt_profileId Optional preference profile name. If not\n * provided, defaults to 'default'.\n */\nhterm.Terminal = function(opt_profileId) {\n this.profileId_ = null;\n\n // Two screen instances.\n this.primaryScreen_ = new hterm.Screen();\n this.alternateScreen_ = new hterm.Screen();\n\n // The \"current\" screen.\n this.screen_ = this.primaryScreen_;\n\n // The local notion of the screen size. ScreenBuffers also have a size which\n // indicates their present size. During size changes, the two may disagree.\n // Also, the inactive screen's size is not altered until it is made the active\n // screen.\n this.screenSize = new hterm.Size(0, 0);\n\n // The scroll port we'll be using to display the visible rows.\n this.scrollPort_ = new hterm.ScrollPort(this);\n this.scrollPort_.subscribe('resize', this.onResize_.bind(this));\n this.scrollPort_.subscribe('scroll', this.onScroll_.bind(this));\n this.scrollPort_.subscribe('paste', this.onPaste_.bind(this));\n this.scrollPort_.onCopy = this.onCopy_.bind(this);\n\n // The div that contains this terminal.\n this.div_ = null;\n\n // The document that contains the scrollPort. Defaulted to the global\n // document here so that the terminal is functional even if it hasn't been\n // inserted into a document yet, but re-set in decorate().\n this.document_ = window.document;\n\n // The rows that have scrolled off screen and are no longer addressable.\n this.scrollbackRows_ = [];\n\n // Saved tab stops.\n this.tabStops_ = [];\n\n // Keep track of whether default tab stops have been erased; after a TBC\n // clears all tab stops, defaults aren't restored on resize until a reset.\n this.defaultTabStops = true;\n\n // The VT's notion of the top and bottom rows. Used during some VT\n // cursor positioning and scrolling commands.\n this.vtScrollTop_ = null;\n this.vtScrollBottom_ = null;\n\n // The DIV element for the visible cursor.\n this.cursorNode_ = null;\n\n // The current cursor shape of the terminal.\n this.cursorShape_ = hterm.Terminal.cursorShape.BLOCK;\n\n // The current color of the cursor.\n this.cursorColor_ = null;\n\n // Cursor blink on/off cycle in ms, overwritten by prefs once they're loaded.\n this.cursorBlinkCycle_ = [100, 100];\n\n // Pre-bound onCursorBlink_ handler, so we don't have to do this for each\n // cursor on/off servicing.\n this.myOnCursorBlink_ = this.onCursorBlink_.bind(this);\n\n // These prefs are cached so we don't have to read from local storage with\n // each output and keystroke. They are initialized by the preference manager.\n this.backgroundColor_ = null;\n this.foregroundColor_ = null;\n this.scrollOnOutput_ = null;\n this.scrollOnKeystroke_ = null;\n this.scrollWheelArrowKeys_ = null;\n\n // True if we should override mouse event reporting to allow local selection.\n this.defeatMouseReports_ = false;\n\n // Terminal bell sound.\n this.bellAudio_ = this.document_.createElement('audio');\n this.bellAudio_.id = 'hterm:bell-audio';\n this.bellAudio_.setAttribute('preload', 'auto');\n\n // All terminal bell notifications that have been generated (not necessarily\n // shown).\n this.bellNotificationList_ = [];\n\n // Whether we have permission to display notifications.\n this.desktopNotificationBell_ = false;\n\n // Cursor position and attributes saved with DECSC.\n this.savedOptions_ = {};\n\n // The current mode bits for the terminal.\n this.options_ = new hterm.Options();\n\n // Timeouts we might need to clear.\n this.timeouts_ = {};\n\n // The VT escape sequence interpreter.\n this.vt = new hterm.VT(this);\n\n // The keyboard handler.\n this.keyboard = new hterm.Keyboard(this);\n\n // General IO interface that can be given to third parties without exposing\n // the entire terminal object.\n this.io = new hterm.Terminal.IO(this);\n\n // True if mouse-click-drag should scroll the terminal.\n this.enableMouseDragScroll = true;\n\n this.copyOnSelect = null;\n this.mouseRightClickPaste = null;\n this.mousePasteButton = null;\n\n // Whether to use the default window copy behavior.\n this.useDefaultWindowCopy = false;\n\n this.clearSelectionAfterCopy = true;\n\n this.realizeSize_(80, 24);\n this.setDefaultTabStops();\n\n this.setProfile(opt_profileId || 'default',\n function() { this.onTerminalReady(); }.bind(this));\n};\n\n/**\n * Possible cursor shapes.\n */\nhterm.Terminal.cursorShape = {\n BLOCK: 'BLOCK',\n BEAM: 'BEAM',\n UNDERLINE: 'UNDERLINE'\n};\n\n/**\n * Clients should override this to be notified when the terminal is ready\n * for use.\n *\n * The terminal initialization is asynchronous, and shouldn't be used before\n * this method is called.\n */\nhterm.Terminal.prototype.onTerminalReady = function() { };\n\n/**\n * Default tab with of 8 to match xterm.\n */\nhterm.Terminal.prototype.tabWidth = 8;\n\n/**\n * Select a preference profile.\n *\n * This will load the terminal preferences for the given profile name and\n * associate subsequent preference changes with the new preference profile.\n *\n * @param {string} profileId The name of the preference profile. Forward slash\n * characters will be removed from the name.\n * @param {function} opt_callback Optional callback to invoke when the profile\n * transition is complete.\n */\nhterm.Terminal.prototype.setProfile = function(profileId, opt_callback) {\n this.profileId_ = profileId.replace(/\\//g, '');\n\n var terminal = this;\n\n if (this.prefs_)\n this.prefs_.deactivate();\n\n this.prefs_ = new hterm.PreferenceManager(this.profileId_);\n this.prefs_.addObservers(null, {\n 'alt-gr-mode': function(v) {\n if (v == null) {\n if (navigator.language.toLowerCase() == 'en-us') {\n v = 'none';\n } else {\n v = 'right-alt';\n }\n } else if (typeof v == 'string') {\n v = v.toLowerCase();\n } else {\n v = 'none';\n }\n\n if (!/^(none|ctrl-alt|left-alt|right-alt)$/.test(v))\n v = 'none';\n\n terminal.keyboard.altGrMode = v;\n },\n\n 'alt-backspace-is-meta-backspace': function(v) {\n terminal.keyboard.altBackspaceIsMetaBackspace = v;\n },\n\n 'alt-is-meta': function(v) {\n terminal.keyboard.altIsMeta = v;\n },\n\n 'alt-sends-what': function(v) {\n if (!/^(escape|8-bit|browser-key)$/.test(v))\n v = 'escape';\n\n terminal.keyboard.altSendsWhat = v;\n },\n\n 'audible-bell-sound': function(v) {\n var ary = v.match(/^lib-resource:(\\S+)/);\n if (ary) {\n terminal.bellAudio_.setAttribute('src',\n lib.resource.getDataUrl(ary[1]));\n } else {\n terminal.bellAudio_.setAttribute('src', v);\n }\n },\n\n 'desktop-notification-bell': function(v) {\n if (v && Notification) {\n terminal.desktopNotificationBell_ =\n Notification.permission === 'granted';\n if (!terminal.desktopNotificationBell_) {\n // Note: We don't call Notification.requestPermission here because\n // Chrome requires the call be the result of a user action (such as an\n // onclick handler), and pref listeners are run asynchronously.\n //\n // A way of working around this would be to display a dialog in the\n // terminal with a \"click-to-request-permission\" button.\n console.warn('desktop-notification-bell is true but we do not have ' +\n 'permission to display notifications.');\n }\n } else {\n terminal.desktopNotificationBell_ = false;\n }\n },\n\n 'background-color': function(v) {\n terminal.setBackgroundColor(v);\n },\n\n 'background-image': function(v) {\n terminal.scrollPort_.setBackgroundImage(v);\n },\n\n 'background-size': function(v) {\n terminal.scrollPort_.setBackgroundSize(v);\n },\n\n 'background-position': function(v) {\n terminal.scrollPort_.setBackgroundPosition(v);\n },\n\n 'backspace-sends-backspace': function(v) {\n terminal.keyboard.backspaceSendsBackspace = v;\n },\n\n 'character-map-overrides': function(v) {\n if (!(v == null || v instanceof Object)) {\n console.warn('Preference character-map-modifications is not an ' +\n 'object: ' + v);\n return;\n }\n\n terminal.vt.characterMaps.reset();\n terminal.vt.characterMaps.setOverrides(v);\n },\n\n 'cursor-blink': function(v) {\n terminal.setCursorBlink(!!v);\n },\n\n 'cursor-blink-cycle': function(v) {\n if (v instanceof Array &&\n typeof v[0] == 'number' &&\n typeof v[1] == 'number') {\n terminal.cursorBlinkCycle_ = v;\n } else if (typeof v == 'number') {\n terminal.cursorBlinkCycle_ = [v, v];\n } else {\n // Fast blink indicates an error.\n terminal.cursorBlinkCycle_ = [100, 100];\n }\n },\n\n 'cursor-color': function(v) {\n terminal.setCursorColor(v);\n },\n\n 'color-palette-overrides': function(v) {\n if (!(v == null || v instanceof Object || v instanceof Array)) {\n console.warn('Preference color-palette-overrides is not an array or ' +\n 'object: ' + v);\n return;\n }\n\n lib.colors.colorPalette = lib.colors.stockColorPalette.concat();\n\n if (v) {\n for (var key in v) {\n var i = parseInt(key);\n if (isNaN(i) || i < 0 || i > 255) {\n console.log('Invalid value in palette: ' + key + ': ' + v[key]);\n continue;\n }\n\n if (v[i]) {\n var rgb = lib.colors.normalizeCSS(v[i]);\n if (rgb)\n lib.colors.colorPalette[i] = rgb;\n }\n }\n }\n\n terminal.primaryScreen_.textAttributes.resetColorPalette();\n terminal.alternateScreen_.textAttributes.resetColorPalette();\n },\n\n 'copy-on-select': function(v) {\n terminal.copyOnSelect = !!v;\n },\n\n 'use-default-window-copy': function(v) {\n terminal.useDefaultWindowCopy = !!v;\n },\n\n 'clear-selection-after-copy': function(v) {\n terminal.clearSelectionAfterCopy = !!v;\n },\n\n 'ctrl-plus-minus-zero-zoom': function(v) {\n terminal.keyboard.ctrlPlusMinusZeroZoom = v;\n },\n\n 'ctrl-c-copy': function(v) {\n terminal.keyboard.ctrlCCopy = v;\n },\n\n 'ctrl-v-paste': function(v) {\n terminal.keyboard.ctrlVPaste = v;\n terminal.scrollPort_.setCtrlVPaste(v);\n },\n\n 'east-asian-ambiguous-as-two-column': function(v) {\n lib.wc.regardCjkAmbiguous = v;\n },\n\n 'enable-8-bit-control': function(v) {\n terminal.vt.enable8BitControl = !!v;\n },\n\n 'enable-bold': function(v) {\n terminal.syncBoldSafeState();\n },\n\n 'enable-bold-as-bright': function(v) {\n terminal.primaryScreen_.textAttributes.enableBoldAsBright = !!v;\n terminal.alternateScreen_.textAttributes.enableBoldAsBright = !!v;\n },\n\n 'enable-blink': function(v) {\n terminal.syncBlinkState();\n },\n\n 'enable-clipboard-write': function(v) {\n terminal.vt.enableClipboardWrite = !!v;\n },\n\n 'enable-dec12': function(v) {\n terminal.vt.enableDec12 = !!v;\n },\n\n 'font-family': function(v) {\n terminal.syncFontFamily();\n },\n\n 'font-size': function(v) {\n terminal.setFontSize(v);\n },\n\n 'font-smoothing': function(v) {\n terminal.syncFontFamily();\n },\n\n 'foreground-color': function(v) {\n terminal.setForegroundColor(v);\n },\n\n 'home-keys-scroll': function(v) {\n terminal.keyboard.homeKeysScroll = v;\n },\n\n 'keybindings': function(v) {\n terminal.keyboard.bindings.clear();\n\n if (!v)\n return;\n\n if (!(v instanceof Object)) {\n console.error('Error in keybindings preference: Expected object');\n return;\n }\n\n try {\n terminal.keyboard.bindings.addBindings(v);\n } catch (ex) {\n console.error('Error in keybindings preference: ' + ex);\n }\n },\n\n 'max-string-sequence': function(v) {\n terminal.vt.maxStringSequence = v;\n },\n\n 'media-keys-are-fkeys': function(v) {\n terminal.keyboard.mediaKeysAreFKeys = v;\n },\n\n 'meta-sends-escape': function(v) {\n terminal.keyboard.metaSendsEscape = v;\n },\n\n 'mouse-right-click-paste': function(v) {\n terminal.mouseRightClickPaste = v;\n },\n\n 'mouse-paste-button': function(v) {\n terminal.syncMousePasteButton();\n },\n\n 'page-keys-scroll': function(v) {\n terminal.keyboard.pageKeysScroll = v;\n },\n\n 'pass-alt-number': function(v) {\n if (v == null) {\n var osx = window.navigator.userAgent.match(/Mac OS X/);\n\n // Let Alt-1..9 pass to the browser (to control tab switching) on\n // non-OS X systems, or if hterm is not opened in an app window.\n v = (!osx && hterm.windowType != 'popup');\n }\n\n terminal.passAltNumber = v;\n },\n\n 'pass-ctrl-number': function(v) {\n if (v == null) {\n var osx = window.navigator.userAgent.match(/Mac OS X/);\n\n // Let Ctrl-1..9 pass to the browser (to control tab switching) on\n // non-OS X systems, or if hterm is not opened in an app window.\n v = (!osx && hterm.windowType != 'popup');\n }\n\n terminal.passCtrlNumber = v;\n },\n\n 'pass-meta-number': function(v) {\n if (v == null) {\n var osx = window.navigator.userAgent.match(/Mac OS X/);\n\n // Let Meta-1..9 pass to the browser (to control tab switching) on\n // OS X systems, or if hterm is not opened in an app window.\n v = (osx && hterm.windowType != 'popup');\n }\n\n terminal.passMetaNumber = v;\n },\n\n 'pass-meta-v': function(v) {\n terminal.keyboard.passMetaV = v;\n },\n\n 'receive-encoding': function(v) {\n if (!(/^(utf-8|raw)$/).test(v)) {\n console.warn('Invalid value for \"receive-encoding\": ' + v);\n v = 'utf-8';\n }\n\n terminal.vt.characterEncoding = v;\n },\n\n 'scroll-on-keystroke': function(v) {\n terminal.scrollOnKeystroke_ = v;\n },\n\n 'scroll-on-output': function(v) {\n terminal.scrollOnOutput_ = v;\n },\n\n 'scrollbar-visible': function(v) {\n terminal.setScrollbarVisible(v);\n },\n\n 'scroll-wheel-may-send-arrow-keys': function(v) {\n terminal.scrollWheelArrowKeys_ = v;\n },\n\n 'scroll-wheel-move-multiplier': function(v) {\n terminal.setScrollWheelMoveMultipler(v);\n },\n\n 'send-encoding': function(v) {\n if (!(/^(utf-8|raw)$/).test(v)) {\n console.warn('Invalid value for \"send-encoding\": ' + v);\n v = 'utf-8';\n }\n\n terminal.keyboard.characterEncoding = v;\n },\n\n 'shift-insert-paste': function(v) {\n terminal.keyboard.shiftInsertPaste = v;\n },\n\n 'terminal-encoding': function(v) {\n terminal.vt.setEncoding(v);\n },\n\n 'user-css': function(v) {\n terminal.scrollPort_.setUserCssUrl(v);\n },\n\n 'user-css-text': function(v) {\n terminal.scrollPort_.setUserCssText(v);\n },\n\n 'word-break-match-left': function(v) {\n terminal.primaryScreen_.wordBreakMatchLeft = v;\n terminal.alternateScreen_.wordBreakMatchLeft = v;\n },\n\n 'word-break-match-right': function(v) {\n terminal.primaryScreen_.wordBreakMatchRight = v;\n terminal.alternateScreen_.wordBreakMatchRight = v;\n },\n\n 'word-break-match-middle': function(v) {\n terminal.primaryScreen_.wordBreakMatchMiddle = v;\n terminal.alternateScreen_.wordBreakMatchMiddle = v;\n },\n });\n\n this.prefs_.readStorage(function() {\n this.prefs_.notifyAll();\n\n if (opt_callback)\n opt_callback();\n }.bind(this));\n};\n\n\n/**\n * Returns the preferences manager used for configuring this terminal.\n *\n * @return {hterm.PreferenceManager}\n */\nhterm.Terminal.prototype.getPrefs = function() {\n return this.prefs_;\n};\n\n/**\n * Enable or disable bracketed paste mode.\n *\n * @param {boolean} state The value to set.\n */\nhterm.Terminal.prototype.setBracketedPaste = function(state) {\n this.options_.bracketedPaste = state;\n};\n\n/**\n * Set the color for the cursor.\n *\n * If you want this setting to persist, set it through prefs_, rather than\n * with this method.\n *\n * @param {string} color The color to set.\n */\nhterm.Terminal.prototype.setCursorColor = function(color) {\n this.cursorColor_ = color;\n this.cursorNode_.style.backgroundColor = color;\n this.cursorNode_.style.borderColor = color;\n};\n\n/**\n * Return the current cursor color as a string.\n * @return {string}\n */\nhterm.Terminal.prototype.getCursorColor = function() {\n return this.cursorColor_;\n};\n\n/**\n * Enable or disable mouse based text selection in the terminal.\n *\n * @param {boolean} state The value to set.\n */\nhterm.Terminal.prototype.setSelectionEnabled = function(state) {\n this.enableMouseDragScroll = state;\n};\n\n/**\n * Set the background color.\n *\n * If you want this setting to persist, set it through prefs_, rather than\n * with this method.\n *\n * @param {string} color The color to set.\n */\nhterm.Terminal.prototype.setBackgroundColor = function(color) {\n this.backgroundColor_ = lib.colors.normalizeCSS(color);\n this.primaryScreen_.textAttributes.setDefaults(\n this.foregroundColor_, this.backgroundColor_);\n this.alternateScreen_.textAttributes.setDefaults(\n this.foregroundColor_, this.backgroundColor_);\n this.scrollPort_.setBackgroundColor(color);\n};\n\n/**\n * Return the current terminal background color.\n *\n * Intended for use by other classes, so we don't have to expose the entire\n * prefs_ object.\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getBackgroundColor = function() {\n return this.backgroundColor_;\n};\n\n/**\n * Set the foreground color.\n *\n * If you want this setting to persist, set it through prefs_, rather than\n * with this method.\n *\n * @param {string} color The color to set.\n */\nhterm.Terminal.prototype.setForegroundColor = function(color) {\n this.foregroundColor_ = lib.colors.normalizeCSS(color);\n this.primaryScreen_.textAttributes.setDefaults(\n this.foregroundColor_, this.backgroundColor_);\n this.alternateScreen_.textAttributes.setDefaults(\n this.foregroundColor_, this.backgroundColor_);\n this.scrollPort_.setForegroundColor(color);\n};\n\n/**\n * Return the current terminal foreground color.\n *\n * Intended for use by other classes, so we don't have to expose the entire\n * prefs_ object.\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getForegroundColor = function() {\n return this.foregroundColor_;\n};\n\n/**\n * Create a new instance of a terminal command and run it with a given\n * argument string.\n *\n * @param {function} commandClass The constructor for a terminal command.\n * @param {string} argString The argument string to pass to the command.\n */\nhterm.Terminal.prototype.runCommandClass = function(commandClass, argString) {\n var environment = this.prefs_.get('environment');\n if (typeof environment != 'object' || environment == null)\n environment = {};\n\n var self = this;\n this.command = new commandClass(\n { argString: argString || '',\n io: this.io.push(),\n environment: environment,\n onExit: function(code) {\n self.io.pop();\n self.uninstallKeyboard();\n if (self.prefs_.get('close-on-exit'))\n window.close();\n }\n });\n\n this.installKeyboard();\n this.command.run();\n};\n\n/**\n * Returns true if the current screen is the primary screen, false otherwise.\n *\n * @return {boolean}\n */\nhterm.Terminal.prototype.isPrimaryScreen = function() {\n return this.screen_ == this.primaryScreen_;\n};\n\n/**\n * Install the keyboard handler for this terminal.\n *\n * This will prevent the browser from seeing any keystrokes sent to the\n * terminal.\n */\nhterm.Terminal.prototype.installKeyboard = function() {\n this.keyboard.installKeyboard(this.scrollPort_.getDocument().body);\n}\n\n/**\n * Uninstall the keyboard handler for this terminal.\n */\nhterm.Terminal.prototype.uninstallKeyboard = function() {\n this.keyboard.installKeyboard(null);\n}\n\n/**\n * Set a CSS variable.\n *\n * Normally this is used to set variables in the hterm namespace.\n *\n * @param {string} name The variable to set.\n * @param {string} value The value to assign to the variable.\n * @param {string?} opt_prefix The variable namespace/prefix to use.\n */\nhterm.Terminal.prototype.setCssVar = function(name, value,\n opt_prefix='--hterm-') {\n this.document_.documentElement.style.setProperty(\n `${opt_prefix}${name}`, value);\n};\n\n/**\n * Set the font size for this terminal.\n *\n * Call setFontSize(0) to reset to the default font size.\n *\n * This function does not modify the font-size preference.\n *\n * @param {number} px The desired font size, in pixels.\n */\nhterm.Terminal.prototype.setFontSize = function(px) {\n if (px === 0)\n px = this.prefs_.get('font-size');\n\n this.scrollPort_.setFontSize(px);\n this.setCssVar('charsize-width', this.scrollPort_.characterSize.width + 'px');\n this.setCssVar('charsize-height',\n this.scrollPort_.characterSize.height + 'px');\n};\n\n/**\n * Get the current font size.\n *\n * @return {number}\n */\nhterm.Terminal.prototype.getFontSize = function() {\n return this.scrollPort_.getFontSize();\n};\n\n/**\n * Get the current font family.\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getFontFamily = function() {\n return this.scrollPort_.getFontFamily();\n};\n\n/**\n * Set the CSS \"font-family\" for this terminal.\n */\nhterm.Terminal.prototype.syncFontFamily = function() {\n this.scrollPort_.setFontFamily(this.prefs_.get('font-family'),\n this.prefs_.get('font-smoothing'));\n this.syncBoldSafeState();\n};\n\n/**\n * Set this.mousePasteButton based on the mouse-paste-button pref,\n * autodetecting if necessary.\n */\nhterm.Terminal.prototype.syncMousePasteButton = function() {\n var button = this.prefs_.get('mouse-paste-button');\n if (typeof button == 'number') {\n this.mousePasteButton = button;\n return;\n }\n\n var ary = navigator.userAgent.match(/\\(X11;\\s+(\\S+)/);\n if (!ary || ary[1] == 'CrOS') {\n this.mousePasteButton = 1; // Middle mouse button.\n } else {\n this.mousePasteButton = 2; // Right mouse button.\n }\n};\n\n/**\n * Enable or disable bold based on the enable-bold pref, autodetecting if\n * necessary.\n */\nhterm.Terminal.prototype.syncBoldSafeState = function() {\n var enableBold = this.prefs_.get('enable-bold');\n if (enableBold !== null) {\n this.primaryScreen_.textAttributes.enableBold = enableBold;\n this.alternateScreen_.textAttributes.enableBold = enableBold;\n return;\n }\n\n var normalSize = this.scrollPort_.measureCharacterSize();\n var boldSize = this.scrollPort_.measureCharacterSize('bold');\n\n var isBoldSafe = normalSize.equals(boldSize);\n if (!isBoldSafe) {\n console.warn('Bold characters disabled: Size of bold weight differs ' +\n 'from normal. Font family is: ' +\n this.scrollPort_.getFontFamily());\n }\n\n this.primaryScreen_.textAttributes.enableBold = isBoldSafe;\n this.alternateScreen_.textAttributes.enableBold = isBoldSafe;\n};\n\n/**\n * Enable or disable blink based on the enable-blink pref.\n */\nhterm.Terminal.prototype.syncBlinkState = function() {\n this.setCssVar('node-duration',\n this.prefs_.get('enable-blink') ? '0.7s' : '0');\n};\n\n/**\n * Set the mouse cursor style based on the current terminal mode.\n */\nhterm.Terminal.prototype.syncMouseStyle = function() {\n this.setCssVar('mouse-cursor-style',\n this.vt.mouseReport == this.vt.MOUSE_REPORT_DISABLED ?\n 'var(--hterm-mouse-cursor-text)' :\n 'var(--hterm-mouse-cursor-pointer)');\n};\n\n/**\n * Return a copy of the current cursor position.\n *\n * @return {hterm.RowCol} The RowCol object representing the current position.\n */\nhterm.Terminal.prototype.saveCursor = function() {\n return this.screen_.cursorPosition.clone();\n};\n\n/**\n * Return the current text attributes.\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getTextAttributes = function() {\n return this.screen_.textAttributes;\n};\n\n/**\n * Set the text attributes.\n *\n * @param {string} textAttributes The attributes to set.\n */\nhterm.Terminal.prototype.setTextAttributes = function(textAttributes) {\n this.screen_.textAttributes = textAttributes;\n};\n\n/**\n * Return the current browser zoom factor applied to the terminal.\n *\n * @return {number} The current browser zoom factor.\n */\nhterm.Terminal.prototype.getZoomFactor = function() {\n return this.scrollPort_.characterSize.zoomFactor;\n};\n\n/**\n * Change the title of this terminal's window.\n *\n * @param {string} title The title to set.\n */\nhterm.Terminal.prototype.setWindowTitle = function(title) {\n window.document.title = title;\n};\n\n/**\n * Restore a previously saved cursor position.\n *\n * @param {hterm.RowCol} cursor The position to restore.\n */\nhterm.Terminal.prototype.restoreCursor = function(cursor) {\n var row = lib.f.clamp(cursor.row, 0, this.screenSize.height - 1);\n var column = lib.f.clamp(cursor.column, 0, this.screenSize.width - 1);\n this.screen_.setCursorPosition(row, column);\n if (cursor.column > column ||\n cursor.column == column && cursor.overflow) {\n this.screen_.cursorPosition.overflow = true;\n }\n};\n\n/**\n * Clear the cursor's overflow flag.\n */\nhterm.Terminal.prototype.clearCursorOverflow = function() {\n this.screen_.cursorPosition.overflow = false;\n};\n\n/**\n * Sets the cursor shape\n *\n * @param {string} shape The shape to set.\n */\nhterm.Terminal.prototype.setCursorShape = function(shape) {\n this.cursorShape_ = shape;\n this.restyleCursor_();\n}\n\n/**\n * Get the cursor shape\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getCursorShape = function() {\n return this.cursorShape_;\n}\n\n/**\n * Set the width of the terminal, resizing the UI to match.\n *\n * @param {number} columnCount\n */\nhterm.Terminal.prototype.setWidth = function(columnCount) {\n if (columnCount == null) {\n this.div_.style.width = '100%';\n return;\n }\n\n this.div_.style.width = Math.ceil(\n this.scrollPort_.characterSize.width *\n columnCount + this.scrollPort_.currentScrollbarWidthPx) + 'px';\n this.realizeSize_(columnCount, this.screenSize.height);\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * Set the height of the terminal, resizing the UI to match.\n *\n * @param {number} rowCount The height in rows.\n */\nhterm.Terminal.prototype.setHeight = function(rowCount) {\n if (rowCount == null) {\n this.div_.style.height = '100%';\n return;\n }\n\n this.div_.style.height =\n this.scrollPort_.characterSize.height * rowCount + 'px';\n this.realizeSize_(this.screenSize.width, rowCount);\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * Deal with terminal size changes.\n *\n * @param {number} columnCount The number of columns.\n * @param {number} rowCount The number of rows.\n */\nhterm.Terminal.prototype.realizeSize_ = function(columnCount, rowCount) {\n if (columnCount != this.screenSize.width)\n this.realizeWidth_(columnCount);\n\n if (rowCount != this.screenSize.height)\n this.realizeHeight_(rowCount);\n\n // Send new terminal size to plugin.\n this.io.onTerminalResize_(columnCount, rowCount);\n};\n\n/**\n * Deal with terminal width changes.\n *\n * This function does what needs to be done when the terminal width changes\n * out from under us. It happens here rather than in onResize_() because this\n * code may need to run synchronously to handle programmatic changes of\n * terminal width.\n *\n * Relying on the browser to send us an async resize event means we may not be\n * in the correct state yet when the next escape sequence hits.\n *\n * @param {number} columnCount The number of columns.\n */\nhterm.Terminal.prototype.realizeWidth_ = function(columnCount) {\n if (columnCount <= 0)\n throw new Error('Attempt to realize bad width: ' + columnCount);\n\n var deltaColumns = columnCount - this.screen_.getWidth();\n\n this.screenSize.width = columnCount;\n this.screen_.setColumnCount(columnCount);\n\n if (deltaColumns > 0) {\n if (this.defaultTabStops)\n this.setDefaultTabStops(this.screenSize.width - deltaColumns);\n } else {\n for (var i = this.tabStops_.length - 1; i >= 0; i--) {\n if (this.tabStops_[i] < columnCount)\n break;\n\n this.tabStops_.pop();\n }\n }\n\n this.screen_.setColumnCount(this.screenSize.width);\n};\n\n/**\n * Deal with terminal height changes.\n *\n * This function does what needs to be done when the terminal height changes\n * out from under us. It happens here rather than in onResize_() because this\n * code may need to run synchronously to handle programmatic changes of\n * terminal height.\n *\n * Relying on the browser to send us an async resize event means we may not be\n * in the correct state yet when the next escape sequence hits.\n *\n * @param {number} rowCount The number of rows.\n */\nhterm.Terminal.prototype.realizeHeight_ = function(rowCount) {\n if (rowCount <= 0)\n throw new Error('Attempt to realize bad height: ' + rowCount);\n\n var deltaRows = rowCount - this.screen_.getHeight();\n\n this.screenSize.height = rowCount;\n\n var cursor = this.saveCursor();\n\n if (deltaRows < 0) {\n // Screen got smaller.\n deltaRows *= -1;\n while (deltaRows) {\n var lastRow = this.getRowCount() - 1;\n if (lastRow - this.scrollbackRows_.length == cursor.row)\n break;\n\n if (this.getRowText(lastRow))\n break;\n\n this.screen_.popRow();\n deltaRows--;\n }\n\n var ary = this.screen_.shiftRows(deltaRows);\n this.scrollbackRows_.push.apply(this.scrollbackRows_, ary);\n\n // We just removed rows from the top of the screen, we need to update\n // the cursor to match.\n cursor.row = Math.max(cursor.row - deltaRows, 0);\n } else if (deltaRows > 0) {\n // Screen got larger.\n\n if (deltaRows <= this.scrollbackRows_.length) {\n var scrollbackCount = Math.min(deltaRows, this.scrollbackRows_.length);\n var rows = this.scrollbackRows_.splice(\n this.scrollbackRows_.length - scrollbackCount, scrollbackCount);\n this.screen_.unshiftRows(rows);\n deltaRows -= scrollbackCount;\n cursor.row += scrollbackCount;\n }\n\n if (deltaRows)\n this.appendRows_(deltaRows);\n }\n\n this.setVTScrollRegion(null, null);\n this.restoreCursor(cursor);\n};\n\n/**\n * Scroll the terminal to the top of the scrollback buffer.\n */\nhterm.Terminal.prototype.scrollHome = function() {\n this.scrollPort_.scrollRowToTop(0);\n};\n\n/**\n * Scroll the terminal to the end.\n */\nhterm.Terminal.prototype.scrollEnd = function() {\n this.scrollPort_.scrollRowToBottom(this.getRowCount());\n};\n\n/**\n * Scroll the terminal one page up (minus one line) relative to the current\n * position.\n */\nhterm.Terminal.prototype.scrollPageUp = function() {\n var i = this.scrollPort_.getTopRowIndex();\n this.scrollPort_.scrollRowToTop(i - this.screenSize.height + 1);\n};\n\n/**\n * Scroll the terminal one page down (minus one line) relative to the current\n * position.\n */\nhterm.Terminal.prototype.scrollPageDown = function() {\n var i = this.scrollPort_.getTopRowIndex();\n this.scrollPort_.scrollRowToTop(i + this.screenSize.height - 1);\n};\n\n/**\n * Scroll the terminal one line up relative to the current position.\n */\nhterm.Terminal.prototype.scrollLineUp = function() {\n var i = this.scrollPort_.getTopRowIndex();\n this.scrollPort_.scrollRowToTop(i - 1);\n};\n\n/**\n * Scroll the terminal one line down relative to the current position.\n */\nhterm.Terminal.prototype.scrollLineDown = function() {\n var i = this.scrollPort_.getTopRowIndex();\n this.scrollPort_.scrollRowToTop(i + 1);\n};\n\n/**\n * Clear primary screen, secondary screen, and the scrollback buffer.\n */\nhterm.Terminal.prototype.wipeContents = function() {\n this.scrollbackRows_.length = 0;\n this.scrollPort_.resetCache();\n\n [this.primaryScreen_, this.alternateScreen_].forEach(function(screen) {\n var bottom = screen.getHeight();\n if (bottom > 0) {\n this.renumberRows_(0, bottom);\n this.clearHome(screen);\n }\n }.bind(this));\n\n this.syncCursorPosition_();\n this.scrollPort_.invalidate();\n};\n\n/**\n * Full terminal reset.\n */\nhterm.Terminal.prototype.reset = function() {\n this.clearAllTabStops();\n this.setDefaultTabStops();\n\n this.clearHome(this.primaryScreen_);\n this.primaryScreen_.textAttributes.reset();\n\n this.clearHome(this.alternateScreen_);\n this.alternateScreen_.textAttributes.reset();\n\n this.setCursorBlink(!!this.prefs_.get('cursor-blink'));\n\n this.vt.reset();\n\n this.softReset();\n};\n\n/**\n * Soft terminal reset.\n *\n * Perform a soft reset to the default values listed in\n * http://www.vt100.net/docs/vt510-rm/DECSTR#T5-9\n */\nhterm.Terminal.prototype.softReset = function() {\n // Reset terminal options to their default values.\n this.options_ = new hterm.Options();\n\n // We show the cursor on soft reset but do not alter the blink state.\n this.options_.cursorBlink = !!this.timeouts_.cursorBlink;\n\n // Xterm also resets the color palette on soft reset, even though it doesn't\n // seem to be documented anywhere.\n this.primaryScreen_.textAttributes.resetColorPalette();\n this.alternateScreen_.textAttributes.resetColorPalette();\n\n // The xterm man page explicitly says this will happen on soft reset.\n this.setVTScrollRegion(null, null);\n\n // Xterm also shows the cursor on soft reset, but does not alter the blink\n // state.\n this.setCursorVisible(true);\n};\n\n/**\n * Move the cursor forward to the next tab stop, or to the last column\n * if no more tab stops are set.\n */\nhterm.Terminal.prototype.forwardTabStop = function() {\n var column = this.screen_.cursorPosition.column;\n\n for (var i = 0; i < this.tabStops_.length; i++) {\n if (this.tabStops_[i] > column) {\n this.setCursorColumn(this.tabStops_[i]);\n return;\n }\n }\n\n // xterm does not clear the overflow flag on HT or CHT.\n var overflow = this.screen_.cursorPosition.overflow;\n this.setCursorColumn(this.screenSize.width - 1);\n this.screen_.cursorPosition.overflow = overflow;\n};\n\n/**\n * Move the cursor backward to the previous tab stop, or to the first column\n * if no previous tab stops are set.\n */\nhterm.Terminal.prototype.backwardTabStop = function() {\n var column = this.screen_.cursorPosition.column;\n\n for (var i = this.tabStops_.length - 1; i >= 0; i--) {\n if (this.tabStops_[i] < column) {\n this.setCursorColumn(this.tabStops_[i]);\n return;\n }\n }\n\n this.setCursorColumn(1);\n};\n\n/**\n * Set a tab stop at the given column.\n *\n * @param {integer} column Zero based column.\n */\nhterm.Terminal.prototype.setTabStop = function(column) {\n for (var i = this.tabStops_.length - 1; i >= 0; i--) {\n if (this.tabStops_[i] == column)\n return;\n\n if (this.tabStops_[i] < column) {\n this.tabStops_.splice(i + 1, 0, column);\n return;\n }\n }\n\n this.tabStops_.splice(0, 0, column);\n};\n\n/**\n * Clear the tab stop at the current cursor position.\n *\n * No effect if there is no tab stop at the current cursor position.\n */\nhterm.Terminal.prototype.clearTabStopAtCursor = function() {\n var column = this.screen_.cursorPosition.column;\n\n var i = this.tabStops_.indexOf(column);\n if (i == -1)\n return;\n\n this.tabStops_.splice(i, 1);\n};\n\n/**\n * Clear all tab stops.\n */\nhterm.Terminal.prototype.clearAllTabStops = function() {\n this.tabStops_.length = 0;\n this.defaultTabStops = false;\n};\n\n/**\n * Set up the default tab stops, starting from a given column.\n *\n * This sets a tabstop every (column % this.tabWidth) column, starting\n * from the specified column, or 0 if no column is provided. It also flags\n * future resizes to set them up.\n *\n * This does not clear the existing tab stops first, use clearAllTabStops\n * for that.\n *\n * @param {integer} opt_start Optional starting zero based starting column, useful\n * for filling out missing tab stops when the terminal is resized.\n */\nhterm.Terminal.prototype.setDefaultTabStops = function(opt_start) {\n var start = opt_start || 0;\n var w = this.tabWidth;\n // Round start up to a default tab stop.\n start = start - 1 - ((start - 1) % w) + w;\n for (var i = start; i < this.screenSize.width; i += w) {\n this.setTabStop(i);\n }\n\n this.defaultTabStops = true;\n};\n\n/**\n * Interpret a sequence of characters.\n *\n * Incomplete escape sequences are buffered until the next call.\n *\n * @param {string} str Sequence of characters to interpret or pass through.\n */\nhterm.Terminal.prototype.interpret = function(str) {\n this.vt.interpret(str);\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * Take over the given DIV for use as the terminal display.\n *\n * @param {HTMLDivElement} div The div to use as the terminal display.\n */\nhterm.Terminal.prototype.decorate = function(div) {\n this.div_ = div;\n\n this.scrollPort_.decorate(div);\n this.scrollPort_.setBackgroundImage(this.prefs_.get('background-image'));\n this.scrollPort_.setBackgroundSize(this.prefs_.get('background-size'));\n this.scrollPort_.setBackgroundPosition(\n this.prefs_.get('background-position'));\n this.scrollPort_.setUserCssUrl(this.prefs_.get('user-css'));\n this.scrollPort_.setUserCssText(this.prefs_.get('user-css-text'));\n\n this.div_.focus = this.focus.bind(this);\n\n this.setFontSize(this.prefs_.get('font-size'));\n this.syncFontFamily();\n\n this.setScrollbarVisible(this.prefs_.get('scrollbar-visible'));\n this.setScrollWheelMoveMultipler(\n this.prefs_.get('scroll-wheel-move-multiplier'));\n\n this.document_ = this.scrollPort_.getDocument();\n\n this.document_.body.oncontextmenu = function() { return false; };\n\n var onMouse = this.onMouse_.bind(this);\n var screenNode = this.scrollPort_.getScreenNode();\n screenNode.addEventListener('mousedown', onMouse);\n screenNode.addEventListener('mouseup', onMouse);\n screenNode.addEventListener('mousemove', onMouse);\n this.scrollPort_.onScrollWheel = onMouse;\n\n screenNode.addEventListener(\n 'focus', this.onFocusChange_.bind(this, true));\n // Listen for mousedown events on the screenNode as in FF the focus\n // events don't bubble.\n screenNode.addEventListener('mousedown', function() {\n setTimeout(this.onFocusChange_.bind(this, true));\n }.bind(this));\n\n screenNode.addEventListener(\n 'blur', this.onFocusChange_.bind(this, false));\n\n var style = this.document_.createElement('style');\n style.textContent =\n ('.cursor-node[focus=\"false\"] {' +\n ' box-sizing: border-box;' +\n ' background-color: transparent !important;' +\n ' border-width: 2px;' +\n ' border-style: solid;' +\n '}' +\n '.wc-node {' +\n ' display: inline-block;' +\n ' text-align: center;' +\n ' width: calc(var(--hterm-charsize-width) * 2);' +\n ' line-height: var(--hterm-charsize-height);' +\n '}' +\n ':root {' +\n ' --hterm-charsize-width: ' + this.scrollPort_.characterSize.width + 'px;' +\n ' --hterm-charsize-height: ' + this.scrollPort_.characterSize.height + 'px;' +\n ' --hterm-cursor-offset-col: 0;' +\n ' --hterm-cursor-offset-row: 0;' +\n ' --hterm-blink-node-duration: 0.7s;' +\n ' --hterm-mouse-cursor-text: text;' +\n ' --hterm-mouse-cursor-pointer: default;' +\n ' --hterm-mouse-cursor-style: var(--hterm-mouse-cursor-text);' +\n '}' +\n '@keyframes blink {' +\n ' from { opacity: 1.0; }' +\n ' to { opacity: 0.0; }' +\n '}' +\n '.blink-node {' +\n ' animation-name: blink;' +\n ' animation-duration: var(--hterm-blink-node-duration);' +\n ' animation-iteration-count: infinite;' +\n ' animation-timing-function: ease-in-out;' +\n ' animation-direction: alternate;' +\n '}');\n this.document_.head.appendChild(style);\n\n this.cursorNode_ = this.document_.createElement('div');\n this.cursorNode_.id = 'hterm:terminal-cursor';\n this.cursorNode_.className = 'cursor-node';\n this.cursorNode_.style.cssText =\n ('position: absolute;' +\n 'left: calc(var(--hterm-charsize-width) * var(--hterm-cursor-offset-col));' +\n 'top: calc(var(--hterm-charsize-height) * var(--hterm-cursor-offset-row));' +\n 'display: block;' +\n 'width: var(--hterm-charsize-width);' +\n 'height: var(--hterm-charsize-height);' +\n '-webkit-transition: opacity, background-color 100ms linear;' +\n '-moz-transition: opacity, background-color 100ms linear;');\n\n this.setCursorColor(this.prefs_.get('cursor-color'));\n this.setCursorBlink(!!this.prefs_.get('cursor-blink'));\n this.restyleCursor_();\n\n this.document_.body.appendChild(this.cursorNode_);\n\n // When 'enableMouseDragScroll' is off we reposition this element directly\n // under the mouse cursor after a click. This makes Chrome associate\n // subsequent mousemove events with the scroll-blocker. Since the\n // scroll-blocker is a peer (not a child) of the scrollport, the mousemove\n // events do not cause the scrollport to scroll.\n //\n // It's a hack, but it's the cleanest way I could find.\n this.scrollBlockerNode_ = this.document_.createElement('div');\n this.scrollBlockerNode_.id = 'hterm:mouse-drag-scroll-blocker';\n this.scrollBlockerNode_.style.cssText =\n ('position: absolute;' +\n 'top: -99px;' +\n 'display: block;' +\n 'width: 10px;' +\n 'height: 10px;');\n this.document_.body.appendChild(this.scrollBlockerNode_);\n\n this.scrollPort_.onScrollWheel = onMouse;\n ['mousedown', 'mouseup', 'mousemove', 'click', 'dblclick',\n ].forEach(function(event) {\n this.scrollBlockerNode_.addEventListener(event, onMouse);\n this.cursorNode_.addEventListener(event, onMouse);\n this.document_.addEventListener(event, onMouse);\n }.bind(this));\n\n this.cursorNode_.addEventListener('mousedown', function() {\n setTimeout(this.focus.bind(this));\n }.bind(this));\n\n this.setReverseVideo(false);\n\n this.scrollPort_.focus();\n this.scrollPort_.scheduleRedraw();\n};\n\n/**\n * Return the HTML document that contains the terminal DOM nodes.\n *\n * @return {HTMLDocument}\n */\nhterm.Terminal.prototype.getDocument = function() {\n return this.document_;\n};\n\n/**\n * Focus the terminal.\n */\nhterm.Terminal.prototype.focus = function() {\n this.scrollPort_.focus();\n};\n\n/**\n * Return the HTML Element for a given row index.\n *\n * This is a method from the RowProvider interface. The ScrollPort uses\n * it to fetch rows on demand as they are scrolled into view.\n *\n * TODO(rginda): Consider saving scrollback rows as (HTML source, text content)\n * pairs to conserve memory.\n *\n * @param {integer} index The zero-based row index, measured relative to the\n * start of the scrollback buffer. On-screen rows will always have the\n * largest indices.\n * @return {HTMLElement} The 'x-row' element containing for the requested row.\n */\nhterm.Terminal.prototype.getRowNode = function(index) {\n if (index < this.scrollbackRows_.length)\n return this.scrollbackRows_[index];\n\n var screenIndex = index - this.scrollbackRows_.length;\n return this.screen_.rowsArray[screenIndex];\n};\n\n/**\n * Return the text content for a given range of rows.\n *\n * This is a method from the RowProvider interface. The ScrollPort uses\n * it to fetch text content on demand when the user attempts to copy their\n * selection to the clipboard.\n *\n * @param {integer} start The zero-based row index to start from, measured\n * relative to the start of the scrollback buffer. On-screen rows will\n * always have the largest indices.\n * @param {integer} end The zero-based row index to end on, measured\n * relative to the start of the scrollback buffer.\n * @return {string} A single string containing the text value of the range of\n * rows. Lines will be newline delimited, with no trailing newline.\n */\nhterm.Terminal.prototype.getRowsText = function(start, end) {\n var ary = [];\n for (var i = start; i < end; i++) {\n var node = this.getRowNode(i);\n ary.push(node.textContent);\n if (i < end - 1 && !node.getAttribute('line-overflow'))\n ary.push('\\n');\n }\n\n return ary.join('');\n};\n\n/**\n * Return the text content for a given row.\n *\n * This is a method from the RowProvider interface. The ScrollPort uses\n * it to fetch text content on demand when the user attempts to copy their\n * selection to the clipboard.\n *\n * @param {integer} index The zero-based row index to return, measured\n * relative to the start of the scrollback buffer. On-screen rows will\n * always have the largest indices.\n * @return {string} A string containing the text value of the selected row.\n */\nhterm.Terminal.prototype.getRowText = function(index) {\n var node = this.getRowNode(index);\n return node.textContent;\n};\n\n/**\n * Return the total number of rows in the addressable screen and in the\n * scrollback buffer of this terminal.\n *\n * This is a method from the RowProvider interface. The ScrollPort uses\n * it to compute the size of the scrollbar.\n *\n * @return {integer} The number of rows in this terminal.\n */\nhterm.Terminal.prototype.getRowCount = function() {\n return this.scrollbackRows_.length + this.screen_.rowsArray.length;\n};\n\n/**\n * Create DOM nodes for new rows and append them to the end of the terminal.\n *\n * This is the only correct way to add a new DOM node for a row. Notice that\n * the new row is appended to the bottom of the list of rows, and does not\n * require renumbering (of the rowIndex property) of previous rows.\n *\n * If you think you want a new blank row somewhere in the middle of the\n * terminal, look into moveRows_().\n *\n * This method does not pay attention to vtScrollTop/Bottom, since you should\n * be using moveRows() in cases where they would matter.\n *\n * The cursor will be positioned at column 0 of the first inserted line.\n *\n * @param {number} count The number of rows to created.\n */\nhterm.Terminal.prototype.appendRows_ = function(count) {\n var cursorRow = this.screen_.rowsArray.length;\n var offset = this.scrollbackRows_.length + cursorRow;\n for (var i = 0; i < count; i++) {\n var row = this.document_.createElement('x-row');\n row.appendChild(this.document_.createTextNode(''));\n row.rowIndex = offset + i;\n this.screen_.pushRow(row);\n }\n\n var extraRows = this.screen_.rowsArray.length - this.screenSize.height;\n if (extraRows > 0) {\n var ary = this.screen_.shiftRows(extraRows);\n Array.prototype.push.apply(this.scrollbackRows_, ary);\n if (this.scrollPort_.isScrolledEnd)\n this.scheduleScrollDown_();\n }\n\n if (cursorRow >= this.screen_.rowsArray.length)\n cursorRow = this.screen_.rowsArray.length - 1;\n\n this.setAbsoluteCursorPosition(cursorRow, 0);\n};\n\n/**\n * Relocate rows from one part of the addressable screen to another.\n *\n * This is used to recycle rows during VT scrolls (those which are driven\n * by VT commands, rather than by the user manipulating the scrollbar.)\n *\n * In this case, the blank lines scrolled into the scroll region are made of\n * the nodes we scrolled off. These have their rowIndex properties carefully\n * renumbered so as not to confuse the ScrollPort.\n *\n * @param {number} fromIndex The start index.\n * @param {number} count The number of rows to move.\n * @param {number} toIndex The destination index.\n */\nhterm.Terminal.prototype.moveRows_ = function(fromIndex, count, toIndex) {\n var ary = this.screen_.removeRows(fromIndex, count);\n this.screen_.insertRows(toIndex, ary);\n\n var start, end;\n if (fromIndex < toIndex) {\n start = fromIndex;\n end = toIndex + count;\n } else {\n start = toIndex;\n end = fromIndex + count;\n }\n\n this.renumberRows_(start, end);\n this.scrollPort_.scheduleInvalidate();\n};\n\n/**\n * Renumber the rowIndex property of the given range of rows.\n *\n * The start and end indices are relative to the screen, not the scrollback.\n * Rows in the scrollback buffer cannot be renumbered. Since they are not\n * addressable (you can't delete them, scroll them, etc), you should have\n * no need to renumber scrollback rows.\n *\n * @param {number} start The start index.\n * @param {number} end The end index.\n * @param {hterm.Screen} opt_screen The screen to renumber.\n */\nhterm.Terminal.prototype.renumberRows_ = function(start, end, opt_screen) {\n var screen = opt_screen || this.screen_;\n\n var offset = this.scrollbackRows_.length;\n for (var i = start; i < end; i++) {\n screen.rowsArray[i].rowIndex = offset + i;\n }\n};\n\n/**\n * Print a string to the terminal.\n *\n * This respects the current insert and wraparound modes. It will add new lines\n * to the end of the terminal, scrolling off the top into the scrollback buffer\n * if necessary.\n *\n * The string is *not* parsed for escape codes. Use the interpret() method if\n * that's what you're after.\n *\n * @param{string} str The string to print.\n */\nhterm.Terminal.prototype.print = function(str) {\n var startOffset = 0;\n\n var strWidth = lib.wc.strWidth(str);\n\n while (startOffset < strWidth) {\n if (this.options_.wraparound && this.screen_.cursorPosition.overflow) {\n this.screen_.commitLineOverflow();\n this.newLine();\n }\n\n var count = strWidth - startOffset;\n var didOverflow = false;\n var substr;\n\n if (this.screen_.cursorPosition.column + count >= this.screenSize.width) {\n didOverflow = true;\n count = this.screenSize.width - this.screen_.cursorPosition.column;\n }\n\n if (didOverflow && !this.options_.wraparound) {\n // If the string overflowed the line but wraparound is off, then the\n // last printed character should be the last of the string.\n // TODO: This will add to our problems with multibyte UTF-16 characters.\n substr = lib.wc.substr(str, startOffset, count - 1) +\n lib.wc.substr(str, strWidth - 1);\n count = strWidth;\n } else {\n substr = lib.wc.substr(str, startOffset, count);\n }\n\n var tokens = hterm.TextAttributes.splitWidecharString(substr);\n for (var i = 0; i < tokens.length; i++) {\n this.screen_.textAttributes.wcNode = tokens[i].wcNode;\n this.screen_.textAttributes.asciiNode = tokens[i].asciiNode;\n\n if (this.options_.insertMode) {\n this.screen_.insertString(tokens[i].str);\n } else {\n this.screen_.overwriteString(tokens[i].str);\n }\n this.screen_.textAttributes.wcNode = false;\n this.screen_.textAttributes.asciiNode = true;\n }\n\n this.screen_.maybeClipCurrentRow();\n startOffset += count;\n }\n\n this.scheduleSyncCursorPosition_();\n\n if (this.scrollOnOutput_)\n this.scrollPort_.scrollRowToBottom(this.getRowCount());\n};\n\n/**\n * Set the VT scroll region.\n *\n * This also resets the cursor position to the absolute (0, 0) position, since\n * that's what xterm appears to do.\n *\n * Setting the scroll region to the full height of the terminal will clear\n * the scroll region. This is *NOT* what most terminals do. We're explicitly\n * going \"off-spec\" here because it makes `screen` and `tmux` overflow into the\n * local scrollback buffer, which means the scrollbars and shift-pgup/pgdn\n * continue to work as most users would expect.\n *\n * @param {integer} scrollTop The zero-based top of the scroll region.\n * @param {integer} scrollBottom The zero-based bottom of the scroll region,\n * inclusive.\n */\nhterm.Terminal.prototype.setVTScrollRegion = function(scrollTop, scrollBottom) {\n if (scrollTop == 0 && scrollBottom == this.screenSize.height - 1) {\n this.vtScrollTop_ = null;\n this.vtScrollBottom_ = null;\n } else {\n this.vtScrollTop_ = scrollTop;\n this.vtScrollBottom_ = scrollBottom;\n }\n};\n\n/**\n * Return the top row index according to the VT.\n *\n * This will return 0 unless the terminal has been told to restrict scrolling\n * to some lower row. It is used for some VT cursor positioning and scrolling\n * commands.\n *\n * @return {integer} The topmost row in the terminal's scroll region.\n */\nhterm.Terminal.prototype.getVTScrollTop = function() {\n if (this.vtScrollTop_ != null)\n return this.vtScrollTop_;\n\n return 0;\n};\n\n/**\n * Return the bottom row index according to the VT.\n *\n * This will return the height of the terminal unless the it has been told to\n * restrict scrolling to some higher row. It is used for some VT cursor\n * positioning and scrolling commands.\n *\n * @return {integer} The bottom most row in the terminal's scroll region.\n */\nhterm.Terminal.prototype.getVTScrollBottom = function() {\n if (this.vtScrollBottom_ != null)\n return this.vtScrollBottom_;\n\n return this.screenSize.height - 1;\n}\n\n/**\n * Process a '\\n' character.\n *\n * If the cursor is on the final row of the terminal this will append a new\n * blank row to the screen and scroll the topmost row into the scrollback\n * buffer.\n *\n * Otherwise, this moves the cursor to column zero of the next row.\n */\nhterm.Terminal.prototype.newLine = function() {\n var cursorAtEndOfScreen = (this.screen_.cursorPosition.row ==\n this.screen_.rowsArray.length - 1);\n\n if (this.vtScrollBottom_ != null) {\n // A VT Scroll region is active, we never append new rows.\n if (this.screen_.cursorPosition.row == this.vtScrollBottom_) {\n // We're at the end of the VT Scroll Region, perform a VT scroll.\n this.vtScrollUp(1);\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, 0);\n } else if (cursorAtEndOfScreen) {\n // We're at the end of the screen, the only thing to do is put the\n // cursor to column 0.\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, 0);\n } else {\n // Anywhere else, advance the cursor row, and reset the column.\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row + 1, 0);\n }\n } else if (cursorAtEndOfScreen) {\n // We're at the end of the screen. Append a new row to the terminal,\n // shifting the top row into the scrollback.\n this.appendRows_(1);\n } else {\n // Anywhere else in the screen just moves the cursor.\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row + 1, 0);\n }\n};\n\n/**\n * Like newLine(), except maintain the cursor column.\n */\nhterm.Terminal.prototype.lineFeed = function() {\n var column = this.screen_.cursorPosition.column;\n this.newLine();\n this.setCursorColumn(column);\n};\n\n/**\n * If autoCarriageReturn is set then newLine(), else lineFeed().\n */\nhterm.Terminal.prototype.formFeed = function() {\n if (this.options_.autoCarriageReturn) {\n this.newLine();\n } else {\n this.lineFeed();\n }\n};\n\n/**\n * Move the cursor up one row, possibly inserting a blank line.\n *\n * The cursor column is not changed.\n */\nhterm.Terminal.prototype.reverseLineFeed = function() {\n var scrollTop = this.getVTScrollTop();\n var currentRow = this.screen_.cursorPosition.row;\n\n if (currentRow == scrollTop) {\n this.insertLines(1);\n } else {\n this.setAbsoluteCursorRow(currentRow - 1);\n }\n};\n\n/**\n * Replace all characters to the left of the current cursor with the space\n * character.\n *\n * TODO(rginda): This should probably *remove* the characters (not just replace\n * with a space) if there are no characters at or beyond the current cursor\n * position.\n */\nhterm.Terminal.prototype.eraseToLeft = function() {\n var cursor = this.saveCursor();\n this.setCursorColumn(0);\n this.screen_.overwriteString(lib.f.getWhitespace(cursor.column + 1));\n this.restoreCursor(cursor);\n};\n\n/**\n * Erase a given number of characters to the right of the cursor.\n *\n * The cursor position is unchanged.\n *\n * If the current background color is not the default background color this\n * will insert spaces rather than delete. This is unfortunate because the\n * trailing space will affect text selection, but it's difficult to come up\n * with a way to style empty space that wouldn't trip up the hterm.Screen\n * code.\n *\n * eraseToRight is ignored in the presence of a cursor overflow. This deviates\n * from xterm, but agrees with gnome-terminal and konsole, xfce4-terminal. See\n * crbug.com/232390 for details.\n *\n * @param {number} opt_count The number of characters to erase.\n */\nhterm.Terminal.prototype.eraseToRight = function(opt_count) {\n if (this.screen_.cursorPosition.overflow)\n return;\n\n var maxCount = this.screenSize.width - this.screen_.cursorPosition.column;\n var count = opt_count ? Math.min(opt_count, maxCount) : maxCount;\n\n if (this.screen_.textAttributes.background ===\n this.screen_.textAttributes.DEFAULT_COLOR) {\n var cursorRow = this.screen_.rowsArray[this.screen_.cursorPosition.row];\n if (hterm.TextAttributes.nodeWidth(cursorRow) <=\n this.screen_.cursorPosition.column + count) {\n this.screen_.deleteChars(count);\n this.clearCursorOverflow();\n return;\n }\n }\n\n var cursor = this.saveCursor();\n this.screen_.overwriteString(lib.f.getWhitespace(count));\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Erase the current line.\n *\n * The cursor position is unchanged.\n */\nhterm.Terminal.prototype.eraseLine = function() {\n var cursor = this.saveCursor();\n this.screen_.clearCursorRow();\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Erase all characters from the start of the screen to the current cursor\n * position, regardless of scroll region.\n *\n * The cursor position is unchanged.\n */\nhterm.Terminal.prototype.eraseAbove = function() {\n var cursor = this.saveCursor();\n\n this.eraseToLeft();\n\n for (var i = 0; i < cursor.row; i++) {\n this.setAbsoluteCursorPosition(i, 0);\n this.screen_.clearCursorRow();\n }\n\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Erase all characters from the current cursor position to the end of the\n * screen, regardless of scroll region.\n *\n * The cursor position is unchanged.\n */\nhterm.Terminal.prototype.eraseBelow = function() {\n var cursor = this.saveCursor();\n\n this.eraseToRight();\n\n var bottom = this.screenSize.height - 1;\n for (var i = cursor.row + 1; i <= bottom; i++) {\n this.setAbsoluteCursorPosition(i, 0);\n this.screen_.clearCursorRow();\n }\n\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Fill the terminal with a given character.\n *\n * This methods does not respect the VT scroll region.\n *\n * @param {string} ch The character to use for the fill.\n */\nhterm.Terminal.prototype.fill = function(ch) {\n var cursor = this.saveCursor();\n\n this.setAbsoluteCursorPosition(0, 0);\n for (var row = 0; row < this.screenSize.height; row++) {\n for (var col = 0; col < this.screenSize.width; col++) {\n this.setAbsoluteCursorPosition(row, col);\n this.screen_.overwriteString(ch);\n }\n }\n\n this.restoreCursor(cursor);\n};\n\n/**\n * Erase the entire display and leave the cursor at (0, 0).\n *\n * This does not respect the scroll region.\n *\n * @param {hterm.Screen} opt_screen Optional screen to operate on. Defaults\n * to the current screen.\n */\nhterm.Terminal.prototype.clearHome = function(opt_screen) {\n var screen = opt_screen || this.screen_;\n var bottom = screen.getHeight();\n\n if (bottom == 0) {\n // Empty screen, nothing to do.\n return;\n }\n\n for (var i = 0; i < bottom; i++) {\n screen.setCursorPosition(i, 0);\n screen.clearCursorRow();\n }\n\n screen.setCursorPosition(0, 0);\n};\n\n/**\n * Erase the entire display without changing the cursor position.\n *\n * The cursor position is unchanged. This does not respect the scroll\n * region.\n *\n * @param {hterm.Screen} opt_screen Optional screen to operate on. Defaults\n * to the current screen.\n */\nhterm.Terminal.prototype.clear = function(opt_screen) {\n var screen = opt_screen || this.screen_;\n var cursor = screen.cursorPosition.clone();\n this.clearHome(screen);\n screen.setCursorPosition(cursor.row, cursor.column);\n};\n\n/**\n * VT command to insert lines at the current cursor row.\n *\n * This respects the current scroll region. Rows pushed off the bottom are\n * lost (they won't show up in the scrollback buffer).\n *\n * @param {integer} count The number of lines to insert.\n */\nhterm.Terminal.prototype.insertLines = function(count) {\n var cursorRow = this.screen_.cursorPosition.row;\n\n var bottom = this.getVTScrollBottom();\n count = Math.min(count, bottom - cursorRow);\n\n // The moveCount is the number of rows we need to relocate to make room for\n // the new row(s). The count is the distance to move them.\n var moveCount = bottom - cursorRow - count + 1;\n if (moveCount)\n this.moveRows_(cursorRow, moveCount, cursorRow + count);\n\n for (var i = count - 1; i >= 0; i--) {\n this.setAbsoluteCursorPosition(cursorRow + i, 0);\n this.screen_.clearCursorRow();\n }\n};\n\n/**\n * VT command to delete lines at the current cursor row.\n *\n * New rows are added to the bottom of scroll region to take their place. New\n * rows are strictly there to take up space and have no content or style.\n *\n * @param {number} count The number of lines to delete.\n */\nhterm.Terminal.prototype.deleteLines = function(count) {\n var cursor = this.saveCursor();\n\n var top = cursor.row;\n var bottom = this.getVTScrollBottom();\n\n var maxCount = bottom - top + 1;\n count = Math.min(count, maxCount);\n\n var moveStart = bottom - count + 1;\n if (count != maxCount)\n this.moveRows_(top, count, moveStart);\n\n for (var i = 0; i < count; i++) {\n this.setAbsoluteCursorPosition(moveStart + i, 0);\n this.screen_.clearCursorRow();\n }\n\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Inserts the given number of spaces at the current cursor position.\n *\n * The cursor position is not changed.\n *\n * @param {number} count The number of spaces to insert.\n */\nhterm.Terminal.prototype.insertSpace = function(count) {\n var cursor = this.saveCursor();\n\n var ws = lib.f.getWhitespace(count || 1);\n this.screen_.insertString(ws);\n this.screen_.maybeClipCurrentRow();\n\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Forward-delete the specified number of characters starting at the cursor\n * position.\n *\n * @param {integer} count The number of characters to delete.\n */\nhterm.Terminal.prototype.deleteChars = function(count) {\n var deleted = this.screen_.deleteChars(count);\n if (deleted && !this.screen_.textAttributes.isDefault()) {\n var cursor = this.saveCursor();\n this.setCursorColumn(this.screenSize.width - deleted);\n this.screen_.insertString(lib.f.getWhitespace(deleted));\n this.restoreCursor(cursor);\n }\n\n this.clearCursorOverflow();\n};\n\n/**\n * Shift rows in the scroll region upwards by a given number of lines.\n *\n * New rows are inserted at the bottom of the scroll region to fill the\n * vacated rows. The new rows not filled out with the current text attributes.\n *\n * This function does not affect the scrollback rows at all. Rows shifted\n * off the top are lost.\n *\n * The cursor position is not altered.\n *\n * @param {integer} count The number of rows to scroll.\n */\nhterm.Terminal.prototype.vtScrollUp = function(count) {\n var cursor = this.saveCursor();\n\n this.setAbsoluteCursorRow(this.getVTScrollTop());\n this.deleteLines(count);\n\n this.restoreCursor(cursor);\n};\n\n/**\n * Shift rows below the cursor down by a given number of lines.\n *\n * This function respects the current scroll region.\n *\n * New rows are inserted at the top of the scroll region to fill the\n * vacated rows. The new rows not filled out with the current text attributes.\n *\n * This function does not affect the scrollback rows at all. Rows shifted\n * off the bottom are lost.\n *\n * @param {integer} count The number of rows to scroll.\n */\nhterm.Terminal.prototype.vtScrollDown = function(opt_count) {\n var cursor = this.saveCursor();\n\n this.setAbsoluteCursorPosition(this.getVTScrollTop(), 0);\n this.insertLines(opt_count);\n\n this.restoreCursor(cursor);\n};\n\n\n/**\n * Set the cursor position.\n *\n * The cursor row is relative to the scroll region if the terminal has\n * 'origin mode' enabled, or relative to the addressable screen otherwise.\n *\n * @param {integer} row The new zero-based cursor row.\n * @param {integer} row The new zero-based cursor column.\n */\nhterm.Terminal.prototype.setCursorPosition = function(row, column) {\n if (this.options_.originMode) {\n this.setRelativeCursorPosition(row, column);\n } else {\n this.setAbsoluteCursorPosition(row, column);\n }\n};\n\n/**\n * Move the cursor relative to its current position.\n *\n * @param {number} row\n * @param {number} column\n */\nhterm.Terminal.prototype.setRelativeCursorPosition = function(row, column) {\n var scrollTop = this.getVTScrollTop();\n row = lib.f.clamp(row + scrollTop, scrollTop, this.getVTScrollBottom());\n column = lib.f.clamp(column, 0, this.screenSize.width - 1);\n this.screen_.setCursorPosition(row, column);\n};\n\n/**\n * Move the cursor to the specified position.\n *\n * @param {number} row\n * @param {number} column\n */\nhterm.Terminal.prototype.setAbsoluteCursorPosition = function(row, column) {\n row = lib.f.clamp(row, 0, this.screenSize.height - 1);\n column = lib.f.clamp(column, 0, this.screenSize.width - 1);\n this.screen_.setCursorPosition(row, column);\n};\n\n/**\n * Set the cursor column.\n *\n * @param {integer} column The new zero-based cursor column.\n */\nhterm.Terminal.prototype.setCursorColumn = function(column) {\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, column);\n};\n\n/**\n * Return the cursor column.\n *\n * @return {integer} The zero-based cursor column.\n */\nhterm.Terminal.prototype.getCursorColumn = function() {\n return this.screen_.cursorPosition.column;\n};\n\n/**\n * Set the cursor row.\n *\n * The cursor row is relative to the scroll region if the terminal has\n * 'origin mode' enabled, or relative to the addressable screen otherwise.\n *\n * @param {integer} row The new cursor row.\n */\nhterm.Terminal.prototype.setAbsoluteCursorRow = function(row) {\n this.setAbsoluteCursorPosition(row, this.screen_.cursorPosition.column);\n};\n\n/**\n * Return the cursor row.\n *\n * @return {integer} The zero-based cursor row.\n */\nhterm.Terminal.prototype.getCursorRow = function() {\n return this.screen_.cursorPosition.row;\n};\n\n/**\n * Request that the ScrollPort redraw itself soon.\n *\n * The redraw will happen asynchronously, soon after the call stack winds down.\n * Multiple calls will be coalesced into a single redraw.\n */\nhterm.Terminal.prototype.scheduleRedraw_ = function() {\n if (this.timeouts_.redraw)\n return;\n\n var self = this;\n this.timeouts_.redraw = setTimeout(function() {\n delete self.timeouts_.redraw;\n self.scrollPort_.redraw_();\n }, 0);\n};\n\n/**\n * Request that the ScrollPort be scrolled to the bottom.\n *\n * The scroll will happen asynchronously, soon after the call stack winds down.\n * Multiple calls will be coalesced into a single scroll.\n *\n * This affects the scrollbar position of the ScrollPort, and has nothing to\n * do with the VT scroll commands.\n */\nhterm.Terminal.prototype.scheduleScrollDown_ = function() {\n if (this.timeouts_.scrollDown)\n return;\n\n var self = this;\n this.timeouts_.scrollDown = setTimeout(function() {\n delete self.timeouts_.scrollDown;\n self.scrollPort_.scrollRowToBottom(self.getRowCount());\n }, 10);\n};\n\n/**\n * Move the cursor up a specified number of rows.\n *\n * @param {integer} count The number of rows to move the cursor.\n */\nhterm.Terminal.prototype.cursorUp = function(count) {\n return this.cursorDown(-(count || 1));\n};\n\n/**\n * Move the cursor down a specified number of rows.\n *\n * @param {integer} count The number of rows to move the cursor.\n */\nhterm.Terminal.prototype.cursorDown = function(count) {\n count = count || 1;\n var minHeight = (this.options_.originMode ? this.getVTScrollTop() : 0);\n var maxHeight = (this.options_.originMode ? this.getVTScrollBottom() :\n this.screenSize.height - 1);\n\n var row = lib.f.clamp(this.screen_.cursorPosition.row + count,\n minHeight, maxHeight);\n this.setAbsoluteCursorRow(row);\n};\n\n/**\n * Move the cursor left a specified number of columns.\n *\n * If reverse wraparound mode is enabled and the previous row wrapped into\n * the current row then we back up through the wraparound as well.\n *\n * @param {integer} count The number of columns to move the cursor.\n */\nhterm.Terminal.prototype.cursorLeft = function(count) {\n count = count || 1;\n\n if (count < 1)\n return;\n\n var currentColumn = this.screen_.cursorPosition.column;\n if (this.options_.reverseWraparound) {\n if (this.screen_.cursorPosition.overflow) {\n // If this cursor is in the right margin, consume one count to get it\n // back to the last column. This only applies when we're in reverse\n // wraparound mode.\n count--;\n this.clearCursorOverflow();\n\n if (!count)\n return;\n }\n\n var newRow = this.screen_.cursorPosition.row;\n var newColumn = currentColumn - count;\n if (newColumn < 0) {\n newRow = newRow - Math.floor(count / this.screenSize.width) - 1;\n if (newRow < 0) {\n // xterm also wraps from row 0 to the last row.\n newRow = this.screenSize.height + newRow % this.screenSize.height;\n }\n newColumn = this.screenSize.width + newColumn % this.screenSize.width;\n }\n\n this.setCursorPosition(Math.max(newRow, 0), newColumn);\n\n } else {\n var newColumn = Math.max(currentColumn - count, 0);\n this.setCursorColumn(newColumn);\n }\n};\n\n/**\n * Move the cursor right a specified number of columns.\n *\n * @param {integer} count The number of columns to move the cursor.\n */\nhterm.Terminal.prototype.cursorRight = function(count) {\n count = count || 1;\n\n if (count < 1)\n return;\n\n var column = lib.f.clamp(this.screen_.cursorPosition.column + count,\n 0, this.screenSize.width - 1);\n this.setCursorColumn(column);\n};\n\n/**\n * Reverse the foreground and background colors of the terminal.\n *\n * This only affects text that was drawn with no attributes.\n *\n * TODO(rginda): Test xterm to see if reverse is respected for text that has\n * been drawn with attributes that happen to coincide with the default\n * 'no-attribute' colors. My guess is probably not.\n *\n * @param {boolean} state The state to set.\n */\nhterm.Terminal.prototype.setReverseVideo = function(state) {\n this.options_.reverseVideo = state;\n if (state) {\n this.scrollPort_.setForegroundColor(this.prefs_.get('background-color'));\n this.scrollPort_.setBackgroundColor(this.prefs_.get('foreground-color'));\n } else {\n this.scrollPort_.setForegroundColor(this.prefs_.get('foreground-color'));\n this.scrollPort_.setBackgroundColor(this.prefs_.get('background-color'));\n }\n};\n\n/**\n * Ring the terminal bell.\n *\n * This will not play the bell audio more than once per second.\n */\nhterm.Terminal.prototype.ringBell = function() {\n this.cursorNode_.style.backgroundColor =\n this.scrollPort_.getForegroundColor();\n\n var self = this;\n setTimeout(function() {\n self.cursorNode_.style.backgroundColor = self.prefs_.get('cursor-color');\n }, 200);\n\n // bellSquelchTimeout_ affects both audio and notification bells.\n if (this.bellSquelchTimeout_)\n return;\n\n if (this.bellAudio_.getAttribute('src')) {\n this.bellAudio_.play();\n this.bellSequelchTimeout_ = setTimeout(function() {\n delete this.bellSquelchTimeout_;\n }.bind(this), 500);\n } else {\n delete this.bellSquelchTimeout_;\n }\n\n if (this.desktopNotificationBell_ && !this.document_.hasFocus()) {\n var n = hterm.notify();\n this.bellNotificationList_.push(n);\n // TODO: Should we try to raise the window here?\n n.onclick = function() { self.closeBellNotifications_(); };\n }\n};\n\n/**\n * Set the origin mode bit.\n *\n * If origin mode is on, certain VT cursor and scrolling commands measure their\n * row parameter relative to the VT scroll region. Otherwise, row 0 corresponds\n * to the top of the addressable screen.\n *\n * Defaults to off.\n *\n * @param {boolean} state True to set origin mode, false to unset.\n */\nhterm.Terminal.prototype.setOriginMode = function(state) {\n this.options_.originMode = state;\n this.setCursorPosition(0, 0);\n};\n\n/**\n * Set the insert mode bit.\n *\n * If insert mode is on, existing text beyond the cursor position will be\n * shifted right to make room for new text. Otherwise, new text overwrites\n * any existing text.\n *\n * Defaults to off.\n *\n * @param {boolean} state True to set insert mode, false to unset.\n */\nhterm.Terminal.prototype.setInsertMode = function(state) {\n this.options_.insertMode = state;\n};\n\n/**\n * Set the auto carriage return bit.\n *\n * If auto carriage return is on then a formfeed character is interpreted\n * as a newline, otherwise it's the same as a linefeed. The difference boils\n * down to whether or not the cursor column is reset.\n *\n * @param {boolean} state The state to set.\n */\nhterm.Terminal.prototype.setAutoCarriageReturn = function(state) {\n this.options_.autoCarriageReturn = state;\n};\n\n/**\n * Set the wraparound mode bit.\n *\n * If wraparound mode is on, certain VT commands will allow the cursor to wrap\n * to the start of the following row. Otherwise, the cursor is clamped to the\n * end of the screen and attempts to write past it are ignored.\n *\n * Defaults to on.\n *\n * @param {boolean} state True to set wraparound mode, false to unset.\n */\nhterm.Terminal.prototype.setWraparound = function(state) {\n this.options_.wraparound = state;\n};\n\n/**\n * Set the reverse-wraparound mode bit.\n *\n * If wraparound mode is off, certain VT commands will allow the cursor to wrap\n * to the end of the previous row. Otherwise, the cursor is clamped to column\n * 0.\n *\n * Defaults to off.\n *\n * @param {boolean} state True to set reverse-wraparound mode, false to unset.\n */\nhterm.Terminal.prototype.setReverseWraparound = function(state) {\n this.options_.reverseWraparound = state;\n};\n\n/**\n * Selects between the primary and alternate screens.\n *\n * If alternate mode is on, the alternate screen is active. Otherwise the\n * primary screen is active.\n *\n * Swapping screens has no effect on the scrollback buffer.\n *\n * Each screen maintains its own cursor position.\n *\n * Defaults to off.\n *\n * @param {boolean} state True to set alternate mode, false to unset.\n */\nhterm.Terminal.prototype.setAlternateMode = function(state) {\n var cursor = this.saveCursor();\n this.screen_ = state ? this.alternateScreen_ : this.primaryScreen_;\n\n if (this.screen_.rowsArray.length &&\n this.screen_.rowsArray[0].rowIndex != this.scrollbackRows_.length) {\n // If the screen changed sizes while we were away, our rowIndexes may\n // be incorrect.\n var offset = this.scrollbackRows_.length;\n var ary = this.screen_.rowsArray;\n for (var i = 0; i < ary.length; i++) {\n ary[i].rowIndex = offset + i;\n }\n }\n\n this.realizeWidth_(this.screenSize.width);\n this.realizeHeight_(this.screenSize.height);\n this.scrollPort_.syncScrollHeight();\n this.scrollPort_.invalidate();\n\n this.restoreCursor(cursor);\n this.scrollPort_.resize();\n};\n\n/**\n * Set the cursor-blink mode bit.\n *\n * If cursor-blink is on, the cursor will blink when it is visible. Otherwise\n * a visible cursor does not blink.\n *\n * You should make sure to turn blinking off if you're going to dispose of a\n * terminal, otherwise you'll leak a timeout.\n *\n * Defaults to on.\n *\n * @param {boolean} state True to set cursor-blink mode, false to unset.\n */\nhterm.Terminal.prototype.setCursorBlink = function(state) {\n this.options_.cursorBlink = state;\n\n if (!state && this.timeouts_.cursorBlink) {\n clearTimeout(this.timeouts_.cursorBlink);\n delete this.timeouts_.cursorBlink;\n }\n\n if (this.options_.cursorVisible)\n this.setCursorVisible(true);\n};\n\n/**\n * Set the cursor-visible mode bit.\n *\n * If cursor-visible is on, the cursor will be visible. Otherwise it will not.\n *\n * Defaults to on.\n *\n * @param {boolean} state True to set cursor-visible mode, false to unset.\n */\nhterm.Terminal.prototype.setCursorVisible = function(state) {\n this.options_.cursorVisible = state;\n\n if (!state) {\n if (this.timeouts_.cursorBlink) {\n clearTimeout(this.timeouts_.cursorBlink);\n delete this.timeouts_.cursorBlink;\n }\n this.cursorNode_.style.opacity = '0';\n return;\n }\n\n this.syncCursorPosition_();\n\n this.cursorNode_.style.opacity = '1';\n\n if (this.options_.cursorBlink) {\n if (this.timeouts_.cursorBlink)\n return;\n\n this.onCursorBlink_();\n } else {\n if (this.timeouts_.cursorBlink) {\n clearTimeout(this.timeouts_.cursorBlink);\n delete this.timeouts_.cursorBlink;\n }\n }\n};\n\n/**\n * Synchronizes the visible cursor and document selection with the current\n * cursor coordinates.\n */\nhterm.Terminal.prototype.syncCursorPosition_ = function() {\n var topRowIndex = this.scrollPort_.getTopRowIndex();\n var bottomRowIndex = this.scrollPort_.getBottomRowIndex(topRowIndex);\n var cursorRowIndex = this.scrollbackRows_.length +\n this.screen_.cursorPosition.row;\n\n if (cursorRowIndex > bottomRowIndex) {\n // Cursor is scrolled off screen, move it outside of the visible area.\n this.setCssVar('cursor-offset-row', '-1');\n return;\n }\n\n if (this.options_.cursorVisible &&\n this.cursorNode_.style.display == 'none') {\n // Re-display the terminal cursor if it was hidden by the mouse cursor.\n this.cursorNode_.style.display = '';\n }\n\n // Position the cursor using CSS variable math. If we do the math in JS,\n // the float math will end up being more precise than the CSS which will\n // cause the cursor tracking to be off.\n this.setCssVar(\n 'cursor-offset-row',\n `${cursorRowIndex - topRowIndex} + ` +\n `${this.scrollPort_.visibleRowTopMargin}px`);\n this.setCssVar('cursor-offset-col', this.screen_.cursorPosition.column);\n\n this.cursorNode_.setAttribute('title',\n '(' + this.screen_.cursorPosition.column +\n ', ' + this.screen_.cursorPosition.row +\n ')');\n\n // Update the caret for a11y purposes.\n var selection = this.document_.getSelection();\n if (selection && selection.isCollapsed)\n this.screen_.syncSelectionCaret(selection);\n};\n\n/**\n * Adjusts the style of this.cursorNode_ according to the current cursor shape\n * and character cell dimensions.\n */\nhterm.Terminal.prototype.restyleCursor_ = function() {\n var shape = this.cursorShape_;\n\n if (this.cursorNode_.getAttribute('focus') == 'false') {\n // Always show a block cursor when unfocused.\n shape = hterm.Terminal.cursorShape.BLOCK;\n }\n\n var style = this.cursorNode_.style;\n\n switch (shape) {\n case hterm.Terminal.cursorShape.BEAM:\n style.height = 'var(--hterm-charsize-height)';\n style.backgroundColor = 'transparent';\n style.borderBottomStyle = null;\n style.borderLeftStyle = 'solid';\n break;\n\n case hterm.Terminal.cursorShape.UNDERLINE:\n style.height = this.scrollPort_.characterSize.baseline + 'px';\n style.backgroundColor = 'transparent';\n style.borderBottomStyle = 'solid';\n // correct the size to put it exactly at the baseline\n style.borderLeftStyle = null;\n break;\n\n default:\n style.height = 'var(--hterm-charsize-height)';\n style.backgroundColor = this.cursorColor_;\n style.borderBottomStyle = null;\n style.borderLeftStyle = null;\n break;\n }\n};\n\n/**\n * Synchronizes the visible cursor with the current cursor coordinates.\n *\n * The sync will happen asynchronously, soon after the call stack winds down.\n * Multiple calls will be coalesced into a single sync.\n */\nhterm.Terminal.prototype.scheduleSyncCursorPosition_ = function() {\n if (this.timeouts_.syncCursor)\n return;\n\n var self = this;\n this.timeouts_.syncCursor = setTimeout(function() {\n self.syncCursorPosition_();\n delete self.timeouts_.syncCursor;\n }, 0);\n};\n\n/**\n * Show or hide the zoom warning.\n *\n * The zoom warning is a message warning the user that their browser zoom must\n * be set to 100% in order for hterm to function properly.\n *\n * @param {boolean} state True to show the message, false to hide it.\n */\nhterm.Terminal.prototype.showZoomWarning_ = function(state) {\n if (!this.zoomWarningNode_) {\n if (!state)\n return;\n\n this.zoomWarningNode_ = this.document_.createElement('div');\n this.zoomWarningNode_.id = 'hterm:zoom-warning';\n this.zoomWarningNode_.style.cssText = (\n 'color: black;' +\n 'background-color: #ff2222;' +\n 'font-size: large;' +\n 'border-radius: 8px;' +\n 'opacity: 0.75;' +\n 'padding: 0.2em 0.5em 0.2em 0.5em;' +\n 'top: 0.5em;' +\n 'right: 1.2em;' +\n 'position: absolute;' +\n '-webkit-text-size-adjust: none;' +\n '-webkit-user-select: none;' +\n '-moz-text-size-adjust: none;' +\n '-moz-user-select: none;');\n\n this.zoomWarningNode_.addEventListener('click', function(e) {\n this.parentNode.removeChild(this);\n });\n }\n\n this.zoomWarningNode_.textContent = lib.MessageManager.replaceReferences(\n hterm.zoomWarningMessage,\n [parseInt(this.scrollPort_.characterSize.zoomFactor * 100)]);\n\n this.zoomWarningNode_.style.fontFamily = this.prefs_.get('font-family');\n\n if (state) {\n if (!this.zoomWarningNode_.parentNode)\n this.div_.parentNode.appendChild(this.zoomWarningNode_);\n } else if (this.zoomWarningNode_.parentNode) {\n this.zoomWarningNode_.parentNode.removeChild(this.zoomWarningNode_);\n }\n};\n\n/**\n * Show the terminal overlay for a given amount of time.\n *\n * The terminal overlay appears in inverse video in a large font, centered\n * over the terminal. You should probably keep the overlay message brief,\n * since it's in a large font and you probably aren't going to check the size\n * of the terminal first.\n *\n * @param {string} msg The text (not HTML) message to display in the overlay.\n * @param {number} opt_timeout The amount of time to wait before fading out\n * the overlay. Defaults to 1.5 seconds. Pass null to have the overlay\n * stay up forever (or until the next overlay).\n */\nhterm.Terminal.prototype.showOverlay = function(msg, opt_timeout) {\n if (!this.overlayNode_) {\n if (!this.div_)\n return;\n\n this.overlayNode_ = this.document_.createElement('div');\n this.overlayNode_.style.cssText = (\n 'border-radius: 15px;' +\n 'font-size: xx-large;' +\n 'opacity: 0.75;' +\n 'padding: 0.2em 0.5em 0.2em 0.5em;' +\n 'position: absolute;' +\n '-webkit-user-select: none;' +\n '-webkit-transition: opacity 180ms ease-in;' +\n '-moz-user-select: none;' +\n '-moz-transition: opacity 180ms ease-in;');\n\n this.overlayNode_.addEventListener('mousedown', function(e) {\n e.preventDefault();\n e.stopPropagation();\n }, true);\n }\n\n this.overlayNode_.style.color = this.prefs_.get('background-color');\n this.overlayNode_.style.backgroundColor = this.prefs_.get('foreground-color');\n this.overlayNode_.style.fontFamily = this.prefs_.get('font-family');\n\n this.overlayNode_.textContent = msg;\n this.overlayNode_.style.opacity = '0.75';\n\n if (!this.overlayNode_.parentNode)\n this.div_.appendChild(this.overlayNode_);\n\n var divSize = hterm.getClientSize(this.div_);\n var overlaySize = hterm.getClientSize(this.overlayNode_);\n\n this.overlayNode_.style.top =\n (divSize.height - overlaySize.height) / 2 + 'px';\n this.overlayNode_.style.left = (divSize.width - overlaySize.width -\n this.scrollPort_.currentScrollbarWidthPx) / 2 + 'px';\n\n var self = this;\n\n if (this.overlayTimeout_)\n clearTimeout(this.overlayTimeout_);\n\n if (opt_timeout === null)\n return;\n\n this.overlayTimeout_ = setTimeout(function() {\n self.overlayNode_.style.opacity = '0';\n self.overlayTimeout_ = setTimeout(function() {\n if (self.overlayNode_.parentNode)\n self.overlayNode_.parentNode.removeChild(self.overlayNode_);\n self.overlayTimeout_ = null;\n self.overlayNode_.style.opacity = '0.75';\n }, 200);\n }, opt_timeout || 1500);\n};\n\n/**\n * Paste from the system clipboard to the terminal.\n */\nhterm.Terminal.prototype.paste = function() {\n return hterm.pasteFromClipboard(this.document_);\n};\n\n/**\n * Copy a string to the system clipboard.\n *\n * Note: If there is a selected range in the terminal, it'll be cleared.\n *\n * @param {string} str The string to copy.\n */\nhterm.Terminal.prototype.copyStringToClipboard = function(str) {\n if (this.prefs_.get('enable-clipboard-notice'))\n setTimeout(this.showOverlay.bind(this, hterm.notifyCopyMessage, 500), 200);\n\n var copySource = this.document_.createElement('pre');\n copySource.id = 'hterm:copy-to-clipboard-source';\n copySource.textContent = str;\n copySource.style.cssText = (\n '-webkit-user-select: text;' +\n '-moz-user-select: text;' +\n 'position: absolute;' +\n 'top: -99px');\n\n this.document_.body.appendChild(copySource);\n\n var selection = this.document_.getSelection();\n var anchorNode = selection.anchorNode;\n var anchorOffset = selection.anchorOffset;\n var focusNode = selection.focusNode;\n var focusOffset = selection.focusOffset;\n\n selection.selectAllChildren(copySource);\n\n hterm.copySelectionToClipboard(this.document_);\n\n // IE doesn't support selection.extend. This means that the selection\n // won't return on IE.\n if (selection.extend) {\n selection.collapse(anchorNode, anchorOffset);\n selection.extend(focusNode, focusOffset);\n }\n\n copySource.parentNode.removeChild(copySource);\n};\n\n/**\n * Returns the selected text, or null if no text is selected.\n *\n * @return {string|null}\n */\nhterm.Terminal.prototype.getSelectionText = function() {\n var selection = this.scrollPort_.selection;\n selection.sync();\n\n if (selection.isCollapsed)\n return null;\n\n\n // Start offset measures from the beginning of the line.\n var startOffset = selection.startOffset;\n var node = selection.startNode;\n\n if (node.nodeName != 'X-ROW') {\n // If the selection doesn't start on an x-row node, then it must be\n // somewhere inside the x-row. Add any characters from previous siblings\n // into the start offset.\n\n if (node.nodeName == '#text' && node.parentNode.nodeName == 'SPAN') {\n // If node is the text node in a styled span, move up to the span node.\n node = node.parentNode;\n }\n\n while (node.previousSibling) {\n node = node.previousSibling;\n startOffset += hterm.TextAttributes.nodeWidth(node);\n }\n }\n\n // End offset measures from the end of the line.\n var endOffset = (hterm.TextAttributes.nodeWidth(selection.endNode) -\n selection.endOffset);\n node = selection.endNode;\n\n if (node.nodeName != 'X-ROW') {\n // If the selection doesn't end on an x-row node, then it must be\n // somewhere inside the x-row. Add any characters from following siblings\n // into the end offset.\n\n if (node.nodeName == '#text' && node.parentNode.nodeName == 'SPAN') {\n // If node is the text node in a styled span, move up to the span node.\n node = node.parentNode;\n }\n\n while (node.nextSibling) {\n node = node.nextSibling;\n endOffset += hterm.TextAttributes.nodeWidth(node);\n }\n }\n\n var rv = this.getRowsText(selection.startRow.rowIndex,\n selection.endRow.rowIndex + 1);\n return lib.wc.substring(rv, startOffset, lib.wc.strWidth(rv) - endOffset);\n};\n\n/**\n * Copy the current selection to the system clipboard, then clear it after a\n * short delay.\n */\nhterm.Terminal.prototype.copySelectionToClipboard = function() {\n var text = this.getSelectionText();\n if (text != null)\n this.copyStringToClipboard(text);\n};\n\nhterm.Terminal.prototype.overlaySize = function() {\n this.showOverlay(this.screenSize.width + 'x' + this.screenSize.height);\n};\n\n/**\n * Invoked by hterm.Terminal.Keyboard when a VT keystroke is detected.\n *\n * @param {string} string The VT string representing the keystroke, in UTF-16.\n */\nhterm.Terminal.prototype.onVTKeystroke = function(string) {\n if (this.scrollOnKeystroke_)\n this.scrollPort_.scrollRowToBottom(this.getRowCount());\n\n this.io.onVTKeystroke(this.keyboard.encode(string));\n};\n\n/**\n * Launches url in a new tab.\n *\n * @param {string} url URL to launch in a new tab.\n */\nhterm.Terminal.prototype.openUrl = function(url) {\n if (window.chrome && window.chrome.browser) {\n // For Chrome v2 apps, we need to use this API to properly open windows.\n chrome.browser.openTab({'url': url});\n } else {\n var win = window.open(url, '_blank');\n win.focus();\n }\n}\n\n/**\n * Open the selected url.\n */\nhterm.Terminal.prototype.openSelectedUrl_ = function() {\n var str = this.getSelectionText();\n\n // If there is no selection, try and expand wherever they clicked.\n if (str == null) {\n this.screen_.expandSelection(this.document_.getSelection());\n str = this.getSelectionText();\n\n // If clicking in empty space, return.\n if (str == null)\n return;\n }\n\n // Make sure URL is valid before opening.\n if (str.length > 2048 || str.search(/[\\s\\[\\](){}<>\"'\\\\^`]/) >= 0)\n return;\n\n // If the URI isn't anchored, it'll open relative to the extension.\n // We have no way of knowing the correct schema, so assume http.\n if (str.search('^[a-zA-Z][a-zA-Z0-9+.-]*://') < 0) {\n // We have to whitelist a few protocols that lack authorities and thus\n // never use the //. Like mailto.\n switch (str.split(':', 1)[0]) {\n case 'mailto':\n break;\n default:\n str = 'http://' + str;\n break;\n }\n }\n\n this.openUrl(str);\n}\n\n\n/**\n * Add the terminalRow and terminalColumn properties to mouse events and\n * then forward on to onMouse().\n *\n * The terminalRow and terminalColumn properties contain the (row, column)\n * coordinates for the mouse event.\n *\n * @param {Event} e The mouse event to handle.\n */\nhterm.Terminal.prototype.onMouse_ = function(e) {\n if (e.processedByTerminalHandler_) {\n // We register our event handlers on the document, as well as the cursor\n // and the scroll blocker. Mouse events that occur on the cursor or\n // scroll blocker will also appear on the document, but we don't want to\n // process them twice.\n //\n // We can't just prevent bubbling because that has other side effects, so\n // we decorate the event object with this property instead.\n return;\n }\n\n var reportMouseEvents = (!this.defeatMouseReports_ &&\n this.vt.mouseReport != this.vt.MOUSE_REPORT_DISABLED);\n\n e.processedByTerminalHandler_ = true;\n\n // One based row/column stored on the mouse event.\n e.terminalRow = parseInt((e.clientY - this.scrollPort_.visibleRowTopMargin) /\n this.scrollPort_.characterSize.height) + 1;\n e.terminalColumn = parseInt(e.clientX /\n this.scrollPort_.characterSize.width) + 1;\n\n if (e.type == 'mousedown' && e.terminalColumn > this.screenSize.width) {\n // Mousedown in the scrollbar area.\n return;\n }\n\n if (this.options_.cursorVisible && !reportMouseEvents) {\n // If the cursor is visible and we're not sending mouse events to the\n // host app, then we want to hide the terminal cursor when the mouse\n // cursor is over top. This keeps the terminal cursor from interfering\n // with local text selection.\n if (e.terminalRow - 1 == this.screen_.cursorPosition.row &&\n e.terminalColumn - 1 == this.screen_.cursorPosition.column) {\n this.cursorNode_.style.display = 'none';\n } else if (this.cursorNode_.style.display == 'none') {\n this.cursorNode_.style.display = '';\n }\n }\n\n if (e.type == 'mousedown') {\n if (e.altKey || !reportMouseEvents) {\n // If VT mouse reporting is disabled, or has been defeated with\n // alt-mousedown, then the mouse will act on the local selection.\n this.defeatMouseReports_ = true;\n this.setSelectionEnabled(true);\n } else {\n // Otherwise we defer ownership of the mouse to the VT.\n this.defeatMouseReports_ = false;\n this.document_.getSelection().collapseToEnd();\n this.setSelectionEnabled(false);\n e.preventDefault();\n }\n }\n\n if (!reportMouseEvents) {\n if (e.type == 'dblclick' && this.copyOnSelect) {\n this.screen_.expandSelection(this.document_.getSelection());\n this.copySelectionToClipboard(this.document_);\n }\n\n if (e.type == 'click' && !e.shiftKey && (e.ctrlKey || e.metaKey)) {\n // Debounce this event with the dblclick event. If you try to doubleclick\n // a URL to open it, Chrome will fire click then dblclick, but we won't\n // have expanded the selection text at the first click event.\n clearTimeout(this.timeouts_.openUrl);\n this.timeouts_.openUrl = setTimeout(this.openSelectedUrl_.bind(this),\n 500);\n return;\n }\n\n if (e.type == 'mousedown') {\n if ((this.mouseRightClickPaste && e.button == 2 /* right button */) ||\n e.button == this.mousePasteButton) {\n if (!this.paste())\n console.warning('Could not paste manually due to web restrictions');;\n }\n }\n\n if (e.type == 'mouseup' && e.button == 0 && this.copyOnSelect &&\n !this.document_.getSelection().isCollapsed) {\n this.copySelectionToClipboard(this.document_);\n }\n\n if ((e.type == 'mousemove' || e.type == 'mouseup') &&\n this.scrollBlockerNode_.engaged) {\n // Disengage the scroll-blocker after one of these events.\n this.scrollBlockerNode_.engaged = false;\n this.scrollBlockerNode_.style.top = '-99px';\n }\n\n // Emulate arrow key presses via scroll wheel events.\n if (this.scrollWheelArrowKeys_ && !e.shiftKey &&\n this.keyboard.applicationCursor && !this.isPrimaryScreen()) {\n if (e.type == 'wheel') {\n var delta = this.scrollPort_.scrollWheelDelta(e);\n var lines = lib.f.smartFloorDivide(\n Math.abs(delta), this.scrollPort_.characterSize.height);\n\n var data = '\\x1bO' + (delta < 0 ? 'B' : 'A');\n this.io.sendString(data.repeat(lines));\n\n e.preventDefault();\n }\n }\n } else /* if (this.reportMouseEvents) */ {\n if (!this.scrollBlockerNode_.engaged) {\n if (e.type == 'mousedown') {\n // Move the scroll-blocker into place if we want to keep the scrollport\n // from scrolling.\n this.scrollBlockerNode_.engaged = true;\n this.scrollBlockerNode_.style.top = (e.clientY - 5) + 'px';\n this.scrollBlockerNode_.style.left = (e.clientX - 5) + 'px';\n } else if (e.type == 'mousemove') {\n // Oh. This means that drag-scroll was disabled AFTER the mouse down,\n // in which case it's too late to engage the scroll-blocker.\n this.document_.getSelection().collapseToEnd();\n e.preventDefault();\n }\n }\n\n this.onMouse(e);\n }\n\n if (e.type == 'mouseup' && this.document_.getSelection().isCollapsed) {\n // Restore this on mouseup in case it was temporarily defeated with a\n // alt-mousedown. Only do this when the selection is empty so that\n // we don't immediately kill the users selection.\n this.defeatMouseReports_ = false;\n }\n};\n\n/**\n * Clients should override this if they care to know about mouse events.\n *\n * The event parameter will be a normal DOM mouse click event with additional\n * 'terminalRow' and 'terminalColumn' properties.\n *\n * @param {Event} e The mouse event to handle.\n */\nhterm.Terminal.prototype.onMouse = function(e) { };\n\n/**\n * React when focus changes.\n *\n * @param {boolean} focused True if focused, false otherwise.\n */\nhterm.Terminal.prototype.onFocusChange_ = function(focused) {\n this.cursorNode_.setAttribute('focus', focused);\n this.restyleCursor_();\n if (focused === true)\n this.closeBellNotifications_();\n};\n\n/**\n * React when the ScrollPort is scrolled.\n */\nhterm.Terminal.prototype.onScroll_ = function() {\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * React when text is pasted into the scrollPort.\n *\n * @param {Event} e The DOM paste event to handle.\n */\nhterm.Terminal.prototype.onPaste_ = function(e) {\n var data = e.text.replace(/\\n/mg, '\\r');\n data = this.keyboard.encode(data);\n if (this.options_.bracketedPaste)\n data = '\\x1b[200~' + data + '\\x1b[201~';\n\n this.io.sendString(data);\n};\n\n/**\n * React when the user tries to copy from the scrollPort.\n *\n * @param {Event} e The DOM copy event.\n */\nhterm.Terminal.prototype.onCopy_ = function(e) {\n if (!this.useDefaultWindowCopy) {\n e.preventDefault();\n setTimeout(this.copySelectionToClipboard.bind(this), 0);\n }\n};\n\n/**\n * React when the ScrollPort is resized.\n *\n * Note: This function should not directly contain code that alters the internal\n * state of the terminal. That kind of code belongs in realizeWidth or\n * realizeHeight, so that it can be executed synchronously in the case of a\n * programmatic width change.\n */\nhterm.Terminal.prototype.onResize_ = function() {\n var columnCount = Math.floor(this.scrollPort_.getScreenWidth() /\n this.scrollPort_.characterSize.width) || 0;\n var rowCount = lib.f.smartFloorDivide(this.scrollPort_.getScreenHeight(),\n this.scrollPort_.characterSize.height) || 0;\n\n if (columnCount <= 0 || rowCount <= 0) {\n // We avoid these situations since they happen sometimes when the terminal\n // gets removed from the document or during the initial load, and we can't\n // deal with that.\n // This can also happen if called before the scrollPort calculates the\n // character size, meaning we dived by 0 above and default to 0 values.\n return;\n }\n\n var isNewSize = (columnCount != this.screenSize.width ||\n rowCount != this.screenSize.height);\n\n // We do this even if the size didn't change, just to be sure everything is\n // in sync.\n this.realizeSize_(columnCount, rowCount);\n this.showZoomWarning_(this.scrollPort_.characterSize.zoomFactor != 1);\n\n if (isNewSize)\n this.overlaySize();\n\n this.restyleCursor_();\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * Service the cursor blink timeout.\n */\nhterm.Terminal.prototype.onCursorBlink_ = function() {\n if (!this.options_.cursorBlink) {\n delete this.timeouts_.cursorBlink;\n return;\n }\n\n if (this.cursorNode_.getAttribute('focus') == 'false' ||\n this.cursorNode_.style.opacity == '0') {\n this.cursorNode_.style.opacity = '1';\n this.timeouts_.cursorBlink = setTimeout(this.myOnCursorBlink_,\n this.cursorBlinkCycle_[0]);\n } else {\n this.cursorNode_.style.opacity = '0';\n this.timeouts_.cursorBlink = setTimeout(this.myOnCursorBlink_,\n this.cursorBlinkCycle_[1]);\n }\n};\n\n/**\n * Set the scrollbar-visible mode bit.\n *\n * If scrollbar-visible is on, the vertical scrollbar will be visible.\n * Otherwise it will not.\n *\n * Defaults to on.\n *\n * @param {boolean} state True to set scrollbar-visible mode, false to unset.\n */\nhterm.Terminal.prototype.setScrollbarVisible = function(state) {\n this.scrollPort_.setScrollbarVisible(state);\n};\n\n/**\n * Set the scroll wheel move multiplier. This will affect how fast the page\n * scrolls on wheel events.\n *\n * Defaults to 1.\n *\n * @param {number} multiplier The multiplier to set.\n */\nhterm.Terminal.prototype.setScrollWheelMoveMultipler = function(multiplier) {\n this.scrollPort_.setScrollWheelMoveMultipler(multiplier);\n};\n\n/**\n * Close all web notifications created by terminal bells.\n */\nhterm.Terminal.prototype.closeBellNotifications_ = function() {\n this.bellNotificationList_.forEach(function(n) {\n n.close();\n });\n this.bellNotificationList_.length = 0;\n};\n// SOURCE FILE: hterm/js/hterm_terminal_io.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.encodeUTF8');\n\n/**\n * Input/Output interface used by commands to communicate with the terminal.\n *\n * Commands like `nassh` and `crosh` receive an instance of this class as\n * part of their argv object. This allows them to write to and read from the\n * terminal without exposing them to an entire hterm.Terminal instance.\n *\n * The active command must override the onVTKeystroke() and sendString() methods\n * of this class in order to receive keystrokes and send output to the correct\n * destination.\n *\n * Isolating commands from the terminal provides the following benefits:\n * - Provides a mechanism to save and restore onVTKeystroke and sendString\n * handlers when invoking subcommands (see the push() and pop() methods).\n * - The isolation makes it easier to make changes in Terminal and supporting\n * classes without affecting commands.\n * - In The Future commands may run in web workers where they would only be able\n * to talk to a Terminal instance through an IPC mechanism.\n *\n * @param {hterm.Terminal}\n */\nhterm.Terminal.IO = function(terminal) {\n this.terminal_ = terminal;\n\n // The IO object to restore on IO.pop().\n this.previousIO_ = null;\n};\n\n/**\n * Show the terminal overlay for a given amount of time.\n *\n * The terminal overlay appears in inverse video in a large font, centered\n * over the terminal. You should probably keep the overlay message brief,\n * since it's in a large font and you probably aren't going to check the size\n * of the terminal first.\n *\n * @param {string} msg The text (not HTML) message to display in the overlay.\n * @param {number} opt_timeout The amount of time to wait before fading out\n * the overlay. Defaults to 1.5 seconds. Pass null to have the overlay\n * stay up forever (or until the next overlay).\n */\nhterm.Terminal.IO.prototype.showOverlay = function(message, opt_timeout) {\n this.terminal_.showOverlay(message, opt_timeout);\n};\n\n/**\n * Open an frame in the current terminal window, pointed to the specified\n * url.\n *\n * Eventually we'll probably need size/position/decoration options.\n * The user should also be able to move/resize the frame.\n *\n * @param {string} url The URL to load in the frame.\n * @param {Object} opt_options Optional frame options. Not implemented.\n */\nhterm.Terminal.IO.prototype.createFrame = function(url, opt_options) {\n return new hterm.Frame(this.terminal_, url, opt_options);\n};\n\n/**\n * Change the preference profile for the terminal.\n *\n * @param profileName {string} The name of the preference profile to activate.\n */\nhterm.Terminal.IO.prototype.setTerminalProfile = function(profileName) {\n this.terminal_.setProfile(profileName);\n};\n\n/**\n * Create a new hterm.Terminal.IO instance and make it active on the Terminal\n * object associated with this instance.\n *\n * This is used to pass control of the terminal IO off to a subcommand. The\n * IO.pop() method can be used to restore control when the subcommand completes.\n */\nhterm.Terminal.IO.prototype.push = function() {\n var io = new hterm.Terminal.IO(this.terminal_);\n io.keyboardCaptured_ = this.keyboardCaptured_;\n\n io.columnCount = this.columnCount;\n io.rowCount = this.rowCount;\n\n io.previousIO_ = this.terminal_.io;\n this.terminal_.io = io;\n\n return io;\n};\n\n/**\n * Restore the Terminal's previous IO object.\n */\nhterm.Terminal.IO.prototype.pop = function() {\n this.terminal_.io = this.previousIO_;\n};\n\n/**\n * Called when data needs to be sent to the current command.\n *\n * Clients should override this to receive notification of pending data.\n *\n * @param {string} string The data to send.\n */\nhterm.Terminal.IO.prototype.sendString = function(string) {\n // Override this.\n console.log('Unhandled sendString: ' + string);\n};\n\n/**\n * Called when a terminal keystroke is detected.\n *\n * Clients should override this to receive notification of keystrokes.\n *\n * The keystroke data will be encoded according to the 'send-encoding'\n * preference.\n *\n * @param {string} string The VT key sequence.\n */\nhterm.Terminal.IO.prototype.onVTKeystroke = function(string) {\n // Override this.\n console.log('Unobserverd VT keystroke: ' + JSON.stringify(string));\n};\n\nhterm.Terminal.IO.prototype.onTerminalResize_ = function(width, height) {\n var obj = this;\n while (obj) {\n obj.columnCount = width;\n obj.rowCount = height;\n obj = obj.previousIO_;\n }\n\n this.onTerminalResize(width, height);\n};\n\n/**\n * Called when terminal size is changed.\n *\n * Clients should override this to receive notification of resize.\n *\n * @param {string|integer} terminal width.\n * @param {string|integer} terminal height.\n */\nhterm.Terminal.IO.prototype.onTerminalResize = function(width, height) {\n // Override this.\n};\n\n/**\n * Write a UTF-8 encoded byte string to the terminal.\n *\n * @param {string} string The UTF-8 encoded string to print.\n */\nhterm.Terminal.IO.prototype.writeUTF8 = function(string) {\n if (this.terminal_.io != this)\n throw 'Attempt to print from inactive IO object.';\n\n this.terminal_.interpret(string);\n};\n\n/**\n * Write a UTF-8 encoded byte string to the terminal followed by crlf.\n *\n * @param {string} string The UTF-8 encoded string to print.\n */\nhterm.Terminal.IO.prototype.writelnUTF8 = function(string) {\n if (this.terminal_.io != this)\n throw 'Attempt to print from inactive IO object.';\n\n this.terminal_.interpret(string + '\\r\\n');\n};\n\n/**\n * Write a UTF-16 JavaScript string to the terminal.\n *\n * @param {string} string The string to print.\n */\nhterm.Terminal.IO.prototype.print =\nhterm.Terminal.IO.prototype.writeUTF16 = function(string) {\n this.writeUTF8(lib.encodeUTF8(string));\n};\n\n/**\n * Print a UTF-16 JavaScript string to the terminal followed by a newline.\n *\n * @param {string} string The string to print.\n */\nhterm.Terminal.IO.prototype.println =\nhterm.Terminal.IO.prototype.writelnUTF16 = function(string) {\n this.writelnUTF8(lib.encodeUTF8(string));\n};\n// SOURCE FILE: hterm/js/hterm_text_attributes.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.colors');\n\n/**\n * Constructor for TextAttribute objects.\n *\n * These objects manage a set of text attributes such as foreground/\n * background color, bold, faint, italic, blink, underline, and strikethrough.\n *\n * TextAttribute instances can be used to construct a DOM container implementing\n * the current attributes, or to test an existing DOM container for\n * compatibility with the current attributes.\n *\n * @constructor\n * @param {HTMLDocument} document The parent document to use when creating\n * new DOM containers.\n */\nhterm.TextAttributes = function(document) {\n this.document_ = document;\n // These variables contain the source of the color as either:\n // SRC_DEFAULT (use context default)\n // SRC_RGB (specified in 'rgb( r, g, b)' form)\n // number (representing the index from color palette to use)\n this.foregroundSource = this.SRC_DEFAULT;\n this.backgroundSource = this.SRC_DEFAULT;\n\n // These properties cache the value in the color table, but foregroundSource\n // and backgroundSource contain the canonical values.\n this.foreground = this.DEFAULT_COLOR;\n this.background = this.DEFAULT_COLOR;\n\n this.defaultForeground = 'rgb(255, 255, 255)';\n this.defaultBackground = 'rgb(0, 0, 0)';\n\n this.bold = false;\n this.faint = false;\n this.italic = false;\n this.blink = false;\n this.underline = false;\n this.strikethrough = false;\n this.inverse = false;\n this.invisible = false;\n this.wcNode = false;\n this.asciiNode = true;\n this.tileData = null;\n\n this.colorPalette = null;\n this.resetColorPalette();\n};\n\n/**\n * If false, we ignore the bold attribute.\n *\n * This is used for fonts that have a bold version that is a different size\n * than the normal weight version.\n */\nhterm.TextAttributes.prototype.enableBold = true;\n\n/**\n * If true, use bright colors (if available) for bold text.\n *\n * This setting is independent of the enableBold setting.\n */\nhterm.TextAttributes.prototype.enableBoldAsBright = true;\n\n/**\n * A sentinel constant meaning \"whatever the default color is in this context\".\n */\nhterm.TextAttributes.prototype.DEFAULT_COLOR = lib.f.createEnum('');\n\n/**\n * A constant string used to specify that source color is context default.\n */\nhterm.TextAttributes.prototype.SRC_DEFAULT = 'default';\n\n\n/**\n * A constant string used to specify that the source of a color is a valid\n * rgb( r, g, b) specifier.\n */\nhterm.TextAttributes.prototype.SRC_RGB = 'rgb';\n\n/**\n * The document object which should own the DOM nodes created by this instance.\n *\n * @param {HTMLDocument} document The parent document.\n */\nhterm.TextAttributes.prototype.setDocument = function(document) {\n this.document_ = document;\n};\n\n/**\n * Create a deep copy of this object.\n *\n * @return {hterm.TextAttributes} A deep copy of this object.\n */\nhterm.TextAttributes.prototype.clone = function() {\n var rv = new hterm.TextAttributes(null);\n\n for (var key in this) {\n rv[key] = this[key];\n }\n\n rv.colorPalette = this.colorPalette.concat();\n return rv;\n};\n\n/**\n * Reset the current set of attributes.\n *\n * This does not affect the palette. Use resetColorPalette() for that.\n * It also doesn't affect the tile data, it's not meant to.\n */\nhterm.TextAttributes.prototype.reset = function() {\n this.foregroundSource = this.SRC_DEFAULT;\n this.backgroundSource = this.SRC_DEFAULT;\n this.foreground = this.DEFAULT_COLOR;\n this.background = this.DEFAULT_COLOR;\n this.bold = false;\n this.faint = false;\n this.italic = false;\n this.blink = false;\n this.underline = false;\n this.strikethrough = false;\n this.inverse = false;\n this.invisible = false;\n this.wcNode = false;\n this.asciiNode = true;\n};\n\n/**\n * Reset the color palette to the default state.\n */\nhterm.TextAttributes.prototype.resetColorPalette = function() {\n this.colorPalette = lib.colors.colorPalette.concat();\n this.syncColors();\n};\n\n/**\n * Test if the current attributes describe unstyled text.\n *\n * @return {boolean} True if the current attributes describe unstyled text.\n */\nhterm.TextAttributes.prototype.isDefault = function() {\n return (this.foregroundSource == this.SRC_DEFAULT &&\n this.backgroundSource == this.SRC_DEFAULT &&\n !this.bold &&\n !this.faint &&\n !this.italic &&\n !this.blink &&\n !this.underline &&\n !this.strikethrough &&\n !this.inverse &&\n !this.invisible &&\n !this.wcNode &&\n this.asciiNode &&\n this.tileData == null);\n};\n\n/**\n * Create a DOM container (a span or a text node) with a style to match the\n * current set of attributes.\n *\n * This method will create a plain text node if the text is unstyled, or\n * an HTML span if the text is styled. Due to lack of monospace wide character\n * fonts on certain systems (e.g. Chrome OS), we need to put each wide character\n * in a span of CSS class '.wc-node' which has double column width.\n * Each vt_tiledata tile is also represented by a span with a single\n * character, with CSS classes '.tile' and '.tile_'.\n *\n * @param {string} opt_textContent Optional text content for the new container.\n * @return {HTMLNode} An HTML span or text nodes styled to match the current\n * attributes.\n */\nhterm.TextAttributes.prototype.createContainer = function(opt_textContent) {\n if (this.isDefault())\n return this.document_.createTextNode(opt_textContent);\n\n var span = this.document_.createElement('span');\n var style = span.style;\n var classes = [];\n\n if (this.foreground != this.DEFAULT_COLOR)\n style.color = this.foreground;\n\n if (this.background != this.DEFAULT_COLOR)\n style.backgroundColor = this.background;\n\n if (this.enableBold && this.bold)\n style.fontWeight = 'bold';\n\n if (this.faint)\n span.faint = true;\n\n if (this.italic)\n style.fontStyle = 'italic';\n\n if (this.blink) {\n classes.push('blink-node');\n span.blinkNode = true;\n }\n\n var textDecoration = '';\n if (this.underline) {\n textDecoration += ' underline';\n span.underline = true;\n }\n if (this.strikethrough) {\n textDecoration += ' line-through';\n span.strikethrough = true;\n }\n if (textDecoration) {\n style.textDecoration = textDecoration;\n }\n\n if (this.wcNode) {\n classes.push('wc-node');\n span.wcNode = true;\n span.asciiNode = false;\n }\n\n if (this.tileData != null) {\n classes.push('tile');\n classes.push('tile_' + this.tileData);\n span.tileNode = true;\n }\n\n if (opt_textContent)\n span.textContent = opt_textContent;\n\n if (classes.length)\n span.className = classes.join(' ');\n\n return span;\n};\n\n/**\n * Tests if the provided object (string, span or text node) has the same\n * style as this TextAttributes instance.\n *\n * This indicates that text with these attributes could be inserted directly\n * into the target DOM node.\n *\n * For the purposes of this method, a string is considered a text node.\n *\n * @param {string|HTMLNode} obj The object to test.\n * @return {boolean} True if the provided container has the same style as\n * this attributes instance.\n */\nhterm.TextAttributes.prototype.matchesContainer = function(obj) {\n if (typeof obj == 'string' || obj.nodeType == 3)\n return this.isDefault();\n\n var style = obj.style;\n\n // We don't want to put multiple characters in a wcNode or a tile.\n // See the comments in createContainer.\n return (!(this.wcNode || obj.wcNode) &&\n this.asciiNode == this.asciiNode &&\n !(this.tileData != null || obj.tileNode) &&\n this.foreground == style.color &&\n this.background == style.backgroundColor &&\n (this.enableBold && this.bold) == !!style.fontWeight &&\n this.blink == obj.blinkNode &&\n this.italic == !!style.fontStyle &&\n !!this.underline == !!obj.underline &&\n !!this.strikethrough == !!obj.strikethrough);\n};\n\nhterm.TextAttributes.prototype.setDefaults = function(foreground, background) {\n this.defaultForeground = foreground;\n this.defaultBackground = background;\n\n this.syncColors();\n};\n\n/**\n * Updates foreground and background properties based on current indices and\n * other state.\n *\n * @param {string} terminalForeground The terminal foreground color for use as\n * inverse text background.\n * @param {string} terminalBackground The terminal background color for use as\n * inverse text foreground.\n *\n */\nhterm.TextAttributes.prototype.syncColors = function() {\n function getBrightIndex(i) {\n if (i < 8) {\n // If the color is from the lower half of the ANSI 16, add 8.\n return i + 8;\n }\n\n // If it's not from the 16 color palette, ignore bold requests. This\n // matches the behavior of gnome-terminal.\n return i;\n }\n\n var foregroundSource = this.foregroundSource;\n var backgroundSource = this.backgroundSource;\n var defaultForeground = this.DEFAULT_COLOR;\n var defaultBackground = this.DEFAULT_COLOR;\n\n if (this.inverse) {\n foregroundSource = this.backgroundSource;\n backgroundSource = this.foregroundSource;\n // We can't inherit the container's color anymore.\n defaultForeground = this.defaultBackground;\n defaultBackground = this.defaultForeground;\n }\n\n if (this.enableBoldAsBright && this.bold) {\n if (foregroundSource != this.SRC_DEFAULT &&\n foregroundSource != this.SRC_RGB) {\n foregroundSource = getBrightIndex(foregroundSource);\n }\n }\n\n if (this.invisible) {\n foregroundSource = backgroundSource;\n defaultForeground = this.defaultBackground;\n }\n\n // Set fore/background colors unless already specified in rgb(r, g, b) form.\n if (foregroundSource != this.SRC_RGB) {\n this.foreground = ((foregroundSource == this.SRC_DEFAULT) ?\n defaultForeground : this.colorPalette[foregroundSource]);\n }\n\n if (this.faint && !this.invisible) {\n var colorToMakeFaint = ((this.foreground == this.DEFAULT_COLOR) ?\n this.defaultForeground : this.foreground);\n this.foreground = lib.colors.mix(colorToMakeFaint, 'rgb(0, 0, 0)', 0.3333);\n }\n\n if (backgroundSource != this.SRC_RGB) {\n this.background = ((backgroundSource == this.SRC_DEFAULT) ?\n defaultBackground : this.colorPalette[backgroundSource]);\n }\n};\n\n/**\n * Static method used to test if the provided objects (strings, spans or\n * text nodes) have the same style.\n *\n * For the purposes of this method, a string is considered a text node.\n *\n * @param {string|HTMLNode} obj1 An object to test.\n * @param {string|HTMLNode} obj2 Another object to test.\n * @return {boolean} True if the containers have the same style.\n */\nhterm.TextAttributes.containersMatch = function(obj1, obj2) {\n if (typeof obj1 == 'string')\n return hterm.TextAttributes.containerIsDefault(obj2);\n\n if (obj1.nodeType != obj2.nodeType)\n return false;\n\n if (obj1.nodeType == 3)\n return true;\n\n var style1 = obj1.style;\n var style2 = obj2.style;\n\n return (style1.color == style2.color &&\n style1.backgroundColor == style2.backgroundColor &&\n style1.fontWeight == style2.fontWeight &&\n style1.fontStyle == style2.fontStyle &&\n style1.textDecoration == style2.textDecoration);\n};\n\n/**\n * Static method to test if a given DOM container represents unstyled text.\n *\n * For the purposes of this method, a string is considered a text node.\n *\n * @param {string|HTMLNode} obj1 An object to test.\n * @return {boolean} True if the object is unstyled.\n */\nhterm.TextAttributes.containerIsDefault = function(obj) {\n return typeof obj == 'string' || obj.nodeType == 3;\n};\n\n/**\n * Static method to get the column width of a node's textContent.\n *\n * @param {HTMLElement} node The HTML element to get the width of textContent\n * from.\n * @return {integer} The column width of the node's textContent.\n */\nhterm.TextAttributes.nodeWidth = function(node) {\n if (!node.asciiNode) {\n return lib.wc.strWidth(node.textContent);\n } else {\n return node.textContent.length;\n }\n}\n\n/**\n * Static method to get the substr of a node's textContent. The start index\n * and substr width are computed in column width.\n *\n * @param {HTMLElement} node The HTML element to get the substr of textContent\n * from.\n * @param {integer} start The starting offset in column width.\n * @param {integer} width The width to capture in column width.\n * @return {integer} The extracted substr of the node's textContent.\n */\nhterm.TextAttributes.nodeSubstr = function(node, start, width) {\n if (!node.asciiNode) {\n return lib.wc.substr(node.textContent, start, width);\n } else {\n return node.textContent.substr(start, width);\n }\n}\n\n/**\n * Static method to get the substring based of a node's textContent. The\n * start index of end index are computed in column width.\n *\n * @param {HTMLElement} node The HTML element to get the substr of textContent\n * from.\n * @param {integer} start The starting offset in column width.\n * @param {integer} end The ending offset in column width.\n * @return {integer} The extracted substring of the node's textContent.\n */\nhterm.TextAttributes.nodeSubstring = function(node, start, end) {\n if (!node.asciiNode) {\n return lib.wc.substring(node.textContent, start, end);\n } else {\n return node.textContent.substring(start, end);\n }\n};\n\n/**\n * Static method to split a string into contiguous runs of single-width\n * characters and runs of double-width characters.\n *\n * @param {string} str The string to split.\n * @return {Array} An array of objects that contain substrings of str, where\n * each substring is either a contiguous runs of single-width characters\n * or a double-width character. For objects that contain a double-width\n * character, its wcNode property is set to true. For objects that contain\n * only ASCII content, its asciiNode property is set to true.\n */\nhterm.TextAttributes.splitWidecharString = function(str) {\n var rv = [];\n var base = 0, length = 0;\n var asciiNode = true;\n\n for (var i = 0; i < str.length;) {\n var c = str.codePointAt(i);\n var increment = (c <= 0xffff) ? 1 : 2;\n if (c < 128) {\n length += increment;\n } else if (lib.wc.charWidth(c) <= 1) {\n length += increment;\n asciiNode = false;\n } else {\n if (length) {\n rv.push({\n str: str.substr(base, length),\n asciiNode: asciiNode,\n });\n asciiNode = true;\n }\n rv.push({\n str: str.substr(i, increment),\n wcNode: true,\n asciiNode: false,\n });\n base = i + increment;\n length = 0;\n }\n i += increment;\n }\n\n if (length) {\n rv.push({\n str: str.substr(base, length),\n asciiNode: asciiNode,\n });\n }\n\n return rv;\n};\n// SOURCE FILE: hterm/js/hterm_vt.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.colors', 'lib.f', 'lib.UTF8Decoder',\n 'hterm.VT.CharacterMap');\n\n/**\n * Constructor for the VT escape sequence interpreter.\n *\n * The interpreter operates on a terminal object capable of performing cursor\n * move operations, painting characters, etc.\n *\n * This interpreter is intended to be compatible with xterm, though it\n * ignores some of the more esoteric escape sequences.\n *\n * Control sequences are documented in hterm/doc/ControlSequences.md.\n *\n * @param {hterm.Terminal} terminal Terminal to use with the interpreter.\n */\nhterm.VT = function(terminal) {\n /**\n * The display terminal object associated with this virtual terminal.\n */\n this.terminal = terminal;\n\n terminal.onMouse = this.onTerminalMouse_.bind(this);\n this.mouseReport = this.MOUSE_REPORT_DISABLED;\n\n // Parse state left over from the last parse. You should use the parseState\n // instance passed into your parse routine, rather than reading\n // this.parseState_ directly.\n this.parseState_ = new hterm.VT.ParseState(this.parseUnknown_);\n\n // Any \"leading modifiers\" for the escape sequence, such as '?', ' ', or the\n // other modifiers handled in this.parseCSI_.\n this.leadingModifier_ = '';\n\n // Any \"trailing modifiers\". Same character set as a leading modifier,\n // except these are found after the numeric arguments.\n this.trailingModifier_ = '';\n\n // Whether or not to respect the escape codes for setting terminal width.\n this.allowColumnWidthChanges_ = false;\n\n // The amount of time we're willing to wait for the end of an OSC sequence.\n this.oscTimeLimit_ = 20000;\n\n // Decoder to maintain UTF-8 decode state.\n this.utf8Decoder_ = new lib.UTF8Decoder();\n\n /**\n * Whether to accept the 8-bit control characters.\n *\n * An 8-bit control character is one with the eighth bit set. These\n * didn't work on 7-bit terminals so they all have two byte equivalents.\n * Most hosts still only use the two-byte versions.\n *\n * We ignore 8-bit control codes by default. This is in order to avoid\n * issues with \"accidental\" usage of codes that need to be terminated.\n * The \"accident\" usually involves cat'ing binary data.\n */\n this.enable8BitControl = false;\n\n /**\n * Whether to allow the OSC 52 sequence to write to the system clipboard.\n */\n this.enableClipboardWrite = true;\n\n /**\n * Respect the host's attempt to change the cursor blink status using\n * the DEC Private mode 12.\n */\n this.enableDec12 = false;\n\n /**\n * The expected encoding method for data received from the host.\n */\n this.characterEncoding = 'utf-8';\n\n /**\n * Max length of an unterminated DCS, OSC, PM or APC sequence before we give\n * up and ignore the code.\n *\n * These all end with a String Terminator (ST, '\\x9c', ESC '\\\\') or\n * (BEL, '\\x07') character, hence the \"string sequence\" moniker.\n */\n this.maxStringSequence = 1024;\n\n /**\n * If true, emit warnings when we encounter a control character or escape\n * sequence that we don't recognize or explicitly ignore.\n */\n this.warnUnimplemented = true;\n\n /**\n * The set of available character maps (used by G0...G3 below).\n */\n this.characterMaps = new hterm.VT.CharacterMaps();\n\n /**\n * The default G0...G3 character maps.\n * We default to the US/ASCII map everywhere as that aligns with other\n * terminals, and it makes it harder to accidentally switch to the graphics\n * character map (Ctrl-N). Any program that wants to use the graphics map\n * will usually select it anyways since there's no guarantee what state any\n * of the maps are in at any particular time.\n */\n this.G0 = this.G1 = this.G2 = this.G3 =\n this.characterMaps.getMap('B');\n\n /**\n * The 7-bit visible character set.\n *\n * This is a mapping from inbound data to display glyph. The GL set\n * contains the 94 bytes from 0x21 to 0x7e.\n *\n * The default GL set is 'B', US ASCII.\n */\n this.GL = 'G0';\n\n /**\n * The 8-bit visible character set.\n *\n * This is a mapping from inbound data to display glyph. The GR set\n * contains the 94 bytes from 0xa1 to 0xfe.\n */\n this.GR = 'G0';\n\n /**\n * The current encoding of the terminal.\n *\n * We only support ECMA-35 and UTF-8, so go with a boolean here.\n * The encoding can be locked too.\n */\n this.codingSystemUtf8_ = false;\n this.codingSystemLocked_ = false;\n\n // Construct a regular expression to match the known one-byte control chars.\n // This is used in parseUnknown_ to quickly scan a string for the next\n // control character.\n this.cc1Pattern_ = null;\n this.updateEncodingState_();\n\n // Saved state used in DECSC.\n //\n // This is a place to store a copy VT state, it is *not* the active state.\n this.savedState_ = new hterm.VT.CursorState(this);\n};\n\n/**\n * No mouse events.\n */\nhterm.VT.prototype.MOUSE_REPORT_DISABLED = 0;\n\n/**\n * DECSET mode 1000.\n *\n * Report mouse down/up events only.\n */\nhterm.VT.prototype.MOUSE_REPORT_CLICK = 1;\n\n/**\n * DECSET mode 1002.\n *\n * Report mouse down/up and movement while a button is down.\n */\nhterm.VT.prototype.MOUSE_REPORT_DRAG = 3;\n\n/**\n * ParseState constructor.\n *\n * This object tracks the current state of the parse. It has fields for the\n * current buffer, position in the buffer, and the parse function.\n *\n * @param {function} defaultFunc The default parser function.\n * @param {string} opt_buf Optional string to use as the current buffer.\n */\nhterm.VT.ParseState = function(defaultFunction, opt_buf) {\n this.defaultFunction = defaultFunction;\n this.buf = opt_buf || null;\n this.pos = 0;\n this.func = defaultFunction;\n this.args = [];\n};\n\n/**\n * Reset the parser function, buffer, and position.\n */\nhterm.VT.ParseState.prototype.reset = function(opt_buf) {\n this.resetParseFunction();\n this.resetBuf(opt_buf || '');\n this.resetArguments();\n};\n\n/**\n * Reset the parser function only.\n */\nhterm.VT.ParseState.prototype.resetParseFunction = function() {\n this.func = this.defaultFunction;\n};\n\n/**\n * Reset the buffer and position only.\n *\n * @param {string} buf Optional new value for buf, defaults to null.\n */\nhterm.VT.ParseState.prototype.resetBuf = function(opt_buf) {\n this.buf = (typeof opt_buf == 'string') ? opt_buf : null;\n this.pos = 0;\n};\n\n/**\n * Reset the arguments list only.\n *\n * @param {string} opt_arg_zero Optional initial value for args[0].\n */\nhterm.VT.ParseState.prototype.resetArguments = function(opt_arg_zero) {\n this.args.length = 0;\n if (typeof opt_arg_zero != 'undefined')\n this.args[0] = opt_arg_zero;\n};\n\n/**\n * Get an argument as an integer.\n *\n * @param {number} argnum The argument number to retrieve.\n */\nhterm.VT.ParseState.prototype.iarg = function(argnum, defaultValue) {\n var str = this.args[argnum];\n if (str) {\n var ret = parseInt(str, 10);\n // An argument of zero is treated as the default value.\n if (ret == 0)\n ret = defaultValue;\n return ret;\n }\n return defaultValue;\n};\n\n/**\n * Advance the parse position.\n *\n * @param {integer} count The number of bytes to advance.\n */\nhterm.VT.ParseState.prototype.advance = function(count) {\n this.pos += count;\n};\n\n/**\n * Return the remaining portion of the buffer without affecting the parse\n * position.\n *\n * @return {string} The remaining portion of the buffer.\n */\nhterm.VT.ParseState.prototype.peekRemainingBuf = function() {\n return this.buf.substr(this.pos);\n};\n\n/**\n * Return the next single character in the buffer without affecting the parse\n * position.\n *\n * @return {string} The next character in the buffer.\n */\nhterm.VT.ParseState.prototype.peekChar = function() {\n return this.buf.substr(this.pos, 1);\n};\n\n/**\n * Return the next single character in the buffer and advance the parse\n * position one byte.\n *\n * @return {string} The next character in the buffer.\n */\nhterm.VT.ParseState.prototype.consumeChar = function() {\n return this.buf.substr(this.pos++, 1);\n};\n\n/**\n * Return true if the buffer is empty, or the position is past the end.\n */\nhterm.VT.ParseState.prototype.isComplete = function() {\n return this.buf == null || this.buf.length <= this.pos;\n};\n\nhterm.VT.CursorState = function(vt) {\n this.vt_ = vt;\n this.save();\n};\n\nhterm.VT.CursorState.prototype.save = function() {\n this.cursor = this.vt_.terminal.saveCursor();\n\n this.textAttributes = this.vt_.terminal.getTextAttributes().clone();\n\n this.GL = this.vt_.GL;\n this.GR = this.vt_.GR;\n\n this.G0 = this.vt_.G0;\n this.G1 = this.vt_.G1;\n this.G2 = this.vt_.G2;\n this.G3 = this.vt_.G3;\n};\n\nhterm.VT.CursorState.prototype.restore = function() {\n this.vt_.terminal.restoreCursor(this.cursor);\n\n this.vt_.terminal.setTextAttributes(this.textAttributes.clone());\n\n this.vt_.GL = this.GL;\n this.vt_.GR = this.GR;\n\n this.vt_.G0 = this.G0;\n this.vt_.G1 = this.G1;\n this.vt_.G2 = this.G2;\n this.vt_.G3 = this.G3;\n};\n\nhterm.VT.prototype.reset = function() {\n this.G0 = this.characterMaps.getMap('B');\n this.G1 = this.characterMaps.getMap('0');\n this.G2 = this.characterMaps.getMap('B');\n this.G3 = this.characterMaps.getMap('B');\n\n this.GL = 'G0';\n this.GR = 'G0';\n\n this.savedState_ = new hterm.VT.CursorState(this);\n\n this.mouseReport = this.MOUSE_REPORT_DISABLED;\n};\n\n/**\n * Handle terminal mouse events.\n *\n * See the \"Mouse Tracking\" section of [xterm].\n */\nhterm.VT.prototype.onTerminalMouse_ = function(e) {\n if (this.mouseReport == this.MOUSE_REPORT_DISABLED)\n return;\n\n // Temporary storage for our response.\n var response;\n\n // Modifier key state.\n var mod = 0;\n if (e.shiftKey)\n mod |= 4;\n if (e.metaKey || (this.terminal.keyboard.altIsMeta && e.altKey))\n mod |= 8;\n if (e.ctrlKey)\n mod |= 16;\n\n // TODO(rginda): We should also support mode 1005 and/or 1006 to extend the\n // coordinate space. Though, after poking around just a little, I wasn't\n // able to get vi or emacs to use either of these modes.\n var x = String.fromCharCode(lib.f.clamp(e.terminalColumn + 32, 32, 255));\n var y = String.fromCharCode(lib.f.clamp(e.terminalRow + 32, 32, 255));\n\n switch (e.type) {\n case 'wheel':\n // Mouse wheel is treated as button 1 or 2 plus an additional 64.\n b = (((e.deltaY * -1) > 0) ? 0 : 1) + 96;\n b |= mod;\n response = '\\x1b[M' + String.fromCharCode(b) + x + y;\n\n // Keep the terminal from scrolling.\n e.preventDefault();\n break;\n\n case 'mousedown':\n // Buttons are encoded as button number plus 32.\n var b = Math.min(e.button, 2) + 32;\n\n // And mix in the modifier keys.\n b |= mod;\n\n response = '\\x1b[M' + String.fromCharCode(b) + x + y;\n break;\n\n case 'mouseup':\n // Mouse up has no indication of which button was released.\n response = '\\x1b[M\\x23' + x + y;\n break;\n\n case 'mousemove':\n if (this.mouseReport == this.MOUSE_REPORT_DRAG && e.buttons) {\n // Standard button bits. The XTerm protocol only reports the first\n // button press (e.g. if left & right are pressed, right is ignored),\n // and it only supports the first three buttons. If none of them are\n // pressed, then XTerm flags it as a release. We'll do the same.\n b = 32;\n\n // Priority here matches XTerm: left, middle, right.\n if (e.buttons & 0x1) {\n // Report left button.\n b += 0;\n } else if (e.buttons & 0x4) {\n // Report middle button.\n b += 1;\n } else if (e.buttons & 0x2) {\n // Report right button.\n b += 2;\n } else {\n // Release higher buttons.\n b += 3;\n }\n\n // Add 32 to indicate mouse motion.\n b += 32;\n\n // And mix in the modifier keys.\n b |= mod;\n\n response = '\\x1b[M' + String.fromCharCode(b) + x + y;\n }\n\n break;\n\n case 'click':\n case 'dblclick':\n break;\n\n default:\n console.error('Unknown mouse event: ' + e.type, e);\n break;\n }\n\n if (response)\n this.terminal.io.sendString(response);\n};\n\n/**\n * Interpret a string of characters, displaying the results on the associated\n * terminal object.\n *\n * The buffer will be decoded according to the 'receive-encoding' preference.\n */\nhterm.VT.prototype.interpret = function(buf) {\n this.parseState_.resetBuf(this.decode(buf));\n\n while (!this.parseState_.isComplete()) {\n var func = this.parseState_.func;\n var pos = this.parseState_.pos;\n var buf = this.parseState_.buf;\n\n this.parseState_.func.call(this, this.parseState_);\n\n if (this.parseState_.func == func && this.parseState_.pos == pos &&\n this.parseState_.buf == buf) {\n throw 'Parser did not alter the state!';\n }\n }\n};\n\n/**\n * Decode a string according to the 'receive-encoding' preference.\n */\nhterm.VT.prototype.decode = function(str) {\n if (this.characterEncoding == 'utf-8')\n return this.decodeUTF8(str);\n\n return str;\n};\n\n/**\n * Encode a UTF-16 string as UTF-8.\n *\n * See also: https://en.wikipedia.org/wiki/UTF-16\n */\nhterm.VT.prototype.encodeUTF8 = function(str) {\n return lib.encodeUTF8(str);\n};\n\n/**\n * Decode a UTF-8 string into UTF-16.\n */\nhterm.VT.prototype.decodeUTF8 = function(str) {\n return this.utf8Decoder_.decode(str);\n};\n\n/**\n * Set the encoding of the terminal.\n *\n * @param {string} encoding The name of the encoding to set.\n */\nhterm.VT.prototype.setEncoding = function(encoding) {\n switch (encoding) {\n default:\n console.warn('Invalid value for \"terminal-encoding\": ' + encoding);\n // Fall through.\n case 'iso-2022':\n this.codingSystemUtf8_ = false;\n this.codingSystemLocked_ = false;\n break;\n case 'utf-8-locked':\n this.codingSystemUtf8_ = true;\n this.codingSystemLocked_ = true;\n break;\n case 'utf-8':\n this.codingSystemUtf8_ = true;\n this.codingSystemLocked_ = false;\n break;\n }\n\n this.updateEncodingState_();\n};\n\n/**\n * Refresh internal state when the encoding changes.\n */\nhterm.VT.prototype.updateEncodingState_ = function() {\n // If we're in UTF8 mode, don't suport 8-bit escape sequences as we'll never\n // see those -- everything should be UTF8!\n var cc1 = Object.keys(hterm.VT.CC1)\n .filter((e) => !this.codingSystemUtf8_ || e.charCodeAt() < 0x80)\n .map((e) => '\\\\x' + lib.f.zpad(e.charCodeAt().toString(16), 2))\n .join('');\n this.cc1Pattern_ = new RegExp(`[${cc1}]`);\n};\n\n/**\n * The default parse function.\n *\n * This will scan the string for the first 1-byte control character (C0/C1\n * characters from [CTRL]). Any plain text coming before the code will be\n * printed to the terminal, then the control character will be dispatched.\n */\nhterm.VT.prototype.parseUnknown_ = function(parseState) {\n var self = this;\n\n function print(str) {\n if (!self.codingSystemUtf8_ && self[self.GL].GL)\n str = self[self.GL].GL(str);\n\n self.terminal.print(str);\n };\n\n // Search for the next contiguous block of plain text.\n var buf = parseState.peekRemainingBuf();\n var nextControl = buf.search(this.cc1Pattern_);\n\n if (nextControl == 0) {\n // We've stumbled right into a control character.\n this.dispatch('CC1', buf.substr(0, 1), parseState);\n parseState.advance(1);\n return;\n }\n\n if (nextControl == -1) {\n // There are no control characters in this string.\n print(buf);\n parseState.reset();\n return;\n }\n\n print(buf.substr(0, nextControl));\n this.dispatch('CC1', buf.substr(nextControl, 1), parseState);\n parseState.advance(nextControl + 1);\n};\n\n/**\n * Parse a Control Sequence Introducer code and dispatch it.\n *\n * See [CSI] for some useful information about these codes.\n */\nhterm.VT.prototype.parseCSI_ = function(parseState) {\n var ch = parseState.peekChar();\n var args = parseState.args;\n\n if (ch >= '@' && ch <= '~') {\n // This is the final character.\n this.dispatch('CSI', this.leadingModifier_ + this.trailingModifier_ + ch,\n parseState);\n parseState.resetParseFunction();\n\n } else if (ch == ';') {\n // Parameter delimiter.\n if (this.trailingModifier_) {\n // Parameter delimiter after the trailing modifier. That's a paddlin'.\n parseState.resetParseFunction();\n\n } else {\n if (!args.length) {\n // They omitted the first param, we need to supply it.\n args.push('');\n }\n\n args.push('');\n }\n\n } else if (ch >= '0' && ch <= '9') {\n // Next byte in the current parameter.\n\n if (this.trailingModifier_) {\n // Numeric parameter after the trailing modifier. That's a paddlin'.\n parseState.resetParseFunction();\n } else {\n if (!args.length) {\n args[0] = ch;\n } else {\n args[args.length - 1] += ch;\n }\n }\n\n } else if (ch >= ' ' && ch <= '?' && ch != ':') {\n // Modifier character.\n if (!args.length) {\n this.leadingModifier_ += ch;\n } else {\n this.trailingModifier_ += ch;\n }\n\n } else if (this.cc1Pattern_.test(ch)) {\n // Control character.\n this.dispatch('CC1', ch, parseState);\n\n } else {\n // Unexpected character in sequence, bail out.\n parseState.resetParseFunction();\n }\n\n parseState.advance(1);\n};\n\n/**\n * Skip over the string until the next String Terminator (ST, 'ESC \\') or\n * Bell (BEL, '\\x07').\n *\n * The string is accumulated in parseState.args[0]. Make sure to reset the\n * arguments (with parseState.resetArguments) before starting the parse.\n *\n * You can detect that parsing in complete by checking that the parse\n * function has changed back to the default parse function.\n *\n * If we encounter more than maxStringSequence characters, we send back\n * the unterminated sequence to be re-parsed with the default parser function.\n *\n * @return {boolean} If true, parsing is ongoing or complete. If false, we've\n * exceeded the max string sequence.\n */\nhterm.VT.prototype.parseUntilStringTerminator_ = function(parseState) {\n var buf = parseState.peekRemainingBuf();\n var nextTerminator = buf.search(/(\\x1b\\\\|\\x07)/);\n var args = parseState.args;\n\n if (!args.length) {\n args[0] = '';\n args[1] = new Date();\n }\n\n if (nextTerminator == -1) {\n // No terminator here, have to wait for the next string.\n\n args[0] += buf;\n\n var abortReason;\n\n if (args[0].length > this.maxStringSequence)\n abortReason = 'too long: ' + args[0].length;\n\n if (args[0].indexOf('\\x1b') != -1)\n abortReason = 'embedded escape: ' + args[0].indexOf('\\x1b');\n\n if (new Date() - args[1] > this.oscTimeLimit_)\n abortReason = 'timeout expired: ' + new Date() - args[1];\n\n if (abortReason) {\n console.log('parseUntilStringTerminator_: aborting: ' + abortReason,\n args[0]);\n parseState.reset(args[0]);\n return false;\n }\n\n parseState.advance(buf.length);\n return true;\n }\n\n if (args[0].length + nextTerminator > this.maxStringSequence) {\n // We found the end of the sequence, but we still think it's too long.\n parseState.reset(args[0] + buf);\n return false;\n }\n\n args[0] += buf.substr(0, nextTerminator);\n\n parseState.resetParseFunction();\n parseState.advance(nextTerminator +\n (buf.substr(nextTerminator, 1) == '\\x1b' ? 2 : 1));\n\n return true;\n};\n\n/**\n * Dispatch to the function that handles a given CC1, ESC, or CSI or VT52 code.\n */\nhterm.VT.prototype.dispatch = function(type, code, parseState) {\n var handler = hterm.VT[type][code];\n if (!handler) {\n if (this.warnUnimplemented)\n console.warn('Unknown ' + type + ' code: ' + JSON.stringify(code));\n return;\n }\n\n if (handler == hterm.VT.ignore) {\n if (this.warnUnimplemented)\n console.warn('Ignored ' + type + ' code: ' + JSON.stringify(code));\n return;\n }\n\n if (type == 'CC1' && code > '\\x7f' && !this.enable8BitControl) {\n // It's kind of a hack to put this here, but...\n //\n // If we're dispatching a 'CC1' code, and it's got the eighth bit set,\n // but we're not supposed to handle 8-bit codes? Just ignore it.\n //\n // This prevents an errant (DCS, '\\x90'), (OSC, '\\x9d'), (PM, '\\x9e') or\n // (APC, '\\x9f') from locking up the terminal waiting for its expected\n // (ST, '\\x9c') or (BEL, '\\x07').\n console.warn('Ignoring 8-bit control code: 0x' +\n code.charCodeAt(0).toString(16));\n return;\n }\n\n handler.apply(this, [parseState, code]);\n};\n\n/**\n * Set one of the ANSI defined terminal mode bits.\n *\n * Invoked in response to SM/RM.\n *\n * Unexpected and unimplemented values are silently ignored.\n */\nhterm.VT.prototype.setANSIMode = function(code, state) {\n if (code == 4) { // Insert Mode (IRM)\n this.terminal.setInsertMode(state);\n } else if (code == 20) { // Automatic Newline (LNM)\n this.terminal.setAutoCarriageReturn(state);\n } else if (this.warnUnimplemented) {\n console.warn('Unimplemented ANSI Mode: ' + code);\n }\n};\n\n/**\n * Set or reset one of the DEC Private modes.\n *\n * Invoked in response to DECSET/DECRST.\n */\nhterm.VT.prototype.setDECMode = function(code, state) {\n switch (parseInt(code, 10)) {\n case 1: // DECCKM\n this.terminal.keyboard.applicationCursor = state;\n break;\n\n case 3: // DECCOLM\n if (this.allowColumnWidthChanges_) {\n this.terminal.setWidth(state ? 132 : 80);\n\n this.terminal.clearHome();\n this.terminal.setVTScrollRegion(null, null);\n }\n break;\n\n case 5: // DECSCNM\n this.terminal.setReverseVideo(state);\n break;\n\n case 6: // DECOM\n this.terminal.setOriginMode(state);\n break;\n\n case 7: // DECAWM\n this.terminal.setWraparound(state);\n break;\n\n case 12: // Start blinking cursor\n if (this.enableDec12)\n this.terminal.setCursorBlink(state);\n break;\n\n case 25: // DECTCEM\n this.terminal.setCursorVisible(state);\n break;\n\n case 30: // Show scrollbar\n this.terminal.setScrollbarVisible(state);\n break;\n\n case 40: // Allow 80 - 132 (DECCOLM) Mode\n this.terminal.allowColumnWidthChanges_ = state;\n break;\n\n case 45: // Reverse-wraparound Mode\n this.terminal.setReverseWraparound(state);\n break;\n\n case 67: // Backarrow key sends backspace (DECBKM)\n this.terminal.keyboard.backspaceSendsBackspace = state;\n break;\n\n case 1000: // Report on mouse clicks only.\n this.mouseReport = (\n state ? this.MOUSE_REPORT_CLICK : this.MOUSE_REPORT_DISABLED);\n this.terminal.syncMouseStyle();\n break;\n\n case 1002: // Report on mouse clicks and drags\n this.mouseReport = (\n state ? this.MOUSE_REPORT_DRAG : this.MOUSE_REPORT_DISABLED);\n this.terminal.syncMouseStyle();\n break;\n\n case 1010: // Scroll to bottom on tty output\n this.terminal.scrollOnOutput = state;\n break;\n\n case 1011: // Scroll to bottom on key press\n this.terminal.scrollOnKeystroke = state;\n break;\n\n case 1036: // Send ESC when Meta modifies a key\n this.terminal.keyboard.metaSendsEscape = state;\n break;\n\n case 1039: // Send ESC when Alt modifies a key\n if (state) {\n if (!this.terminal.keyboard.previousAltSendsWhat_) {\n this.terminal.keyboard.previousAltSendsWhat_ =\n this.terminal.keyboard.altSendsWhat;\n this.terminal.keyboard.altSendsWhat = 'escape';\n }\n } else if (this.terminal.keyboard.previousAltSendsWhat_) {\n this.terminal.keyboard.altSendsWhat =\n this.terminal.keyboard.previousAltSendsWhat_;\n this.terminal.keyboard.previousAltSendsWhat_ = null;\n }\n break;\n\n case 47: // Use Alternate Screen Buffer\n case 1047:\n this.terminal.setAlternateMode(state);\n break;\n\n case 1048: // Save cursor as in DECSC.\n this.savedState_.save();\n\n case 1049: // 1047 + 1048 + clear.\n if (state) {\n this.savedState_.save();\n this.terminal.setAlternateMode(state);\n this.terminal.clear();\n } else {\n this.terminal.setAlternateMode(state);\n this.savedState_.restore();\n }\n\n break;\n\n case 2004: // Bracketed paste mode.\n this.terminal.setBracketedPaste(state);\n break;\n\n default:\n if (this.warnUnimplemented)\n console.warn('Unimplemented DEC Private Mode: ' + code);\n break;\n }\n};\n\n/**\n * Function shared by control characters and escape sequences that are\n * ignored.\n */\nhterm.VT.ignore = function() {};\n\n/**\n * Collection of control characters expressed in a single byte.\n *\n * This includes the characters from the C0 and C1 sets (see [CTRL]) that we\n * care about. Two byte versions of the C1 codes are defined in the\n * hterm.VT.ESC collection.\n *\n * The 'CC1' mnemonic here refers to the fact that these are one-byte Control\n * Codes. It's only used in this source file and not defined in any of the\n * referenced documents.\n */\nhterm.VT.CC1 = {};\n\n/**\n * Collection of two-byte and three-byte sequences starting with ESC.\n */\nhterm.VT.ESC = {};\n\n/**\n * Collection of CSI (Control Sequence Introducer) sequences.\n *\n * These sequences begin with 'ESC [', and may take zero or more arguments.\n */\nhterm.VT.CSI = {};\n\n/**\n * Collection of OSC (Operating System Control) sequences.\n *\n * These sequences begin with 'ESC ]', followed by a function number and a\n * string terminated by either ST or BEL.\n */\nhterm.VT.OSC = {};\n\n/**\n * Collection of VT52 sequences.\n *\n * When in VT52 mode, other sequences are disabled.\n */\nhterm.VT.VT52 = {};\n\n/**\n * Null (NUL).\n *\n * Silently ignored.\n */\nhterm.VT.CC1['\\x00'] = hterm.VT.ignore;\n\n/**\n * Enquiry (ENQ).\n *\n * Transmit answerback message.\n *\n * The default answerback message in xterm is an empty string, so we just\n * ignore this.\n */\nhterm.VT.CC1['\\x05'] = hterm.VT.ignore;\n\n/**\n * Ring Bell (BEL).\n */\nhterm.VT.CC1['\\x07'] = function() {\n this.terminal.ringBell();\n};\n\n/**\n * Backspace (BS).\n *\n * Move the cursor to the left one character position, unless it is at the\n * left margin, in which case no action occurs.\n */\nhterm.VT.CC1['\\x08'] = function() {\n this.terminal.cursorLeft(1);\n};\n\n/**\n * Horizontal Tab (HT).\n *\n * Move the cursor to the next tab stop, or to the right margin if no further\n * tab stops are present on the line.\n */\nhterm.VT.CC1['\\x09'] = function() {\n this.terminal.forwardTabStop();\n};\n\n/**\n * Line Feed (LF).\n *\n * This code causes a line feed or a new line operation. See Automatic\n * Newline (LNM).\n */\nhterm.VT.CC1['\\x0a'] = function() {\n this.terminal.formFeed();\n};\n\n/**\n * Vertical Tab (VT).\n *\n * Interpreted as LF.\n */\nhterm.VT.CC1['\\x0b'] = hterm.VT.CC1['\\x0a'];\n\n/**\n * Form Feed (FF).\n *\n * Interpreted as LF.\n */\nhterm.VT.CC1['\\x0c'] = hterm.VT.CC1['\\x0a'];\n\n/**\n * Carriage Return (CR).\n *\n * Move cursor to the left margin on the current line.\n */\nhterm.VT.CC1['\\x0d'] = function() {\n this.terminal.setCursorColumn(0);\n};\n\n/**\n * Shift Out (SO), aka Lock Shift 0 (LS1).\n *\n * Invoke G1 character set in GL.\n */\nhterm.VT.CC1['\\x0e'] = function() {\n this.GL = 'G1';\n};\n\n/**\n * Shift In (SI), aka Lock Shift 0 (LS0).\n *\n * Invoke G0 character set in GL.\n */\nhterm.VT.CC1['\\x0f'] = function() {\n this.GL = 'G0';\n};\n\n/**\n * Transmit On (XON).\n *\n * Not currently implemented.\n *\n * TODO(rginda): Implement?\n */\nhterm.VT.CC1['\\x11'] = hterm.VT.ignore;\n\n/**\n * Transmit Off (XOFF).\n *\n * Not currently implemented.\n *\n * TODO(rginda): Implement?\n */\nhterm.VT.CC1['\\x13'] = hterm.VT.ignore;\n\n/**\n * Cancel (CAN).\n *\n * If sent during a control sequence, the sequence is immediately terminated\n * and not executed.\n *\n * It also causes the error character to be displayed.\n */\nhterm.VT.CC1['\\x18'] = function(parseState) {\n // If we've shifted in the G1 character set, shift it back out to\n // the default character set.\n if (this.GL == 'G1') {\n this.GL = 'G0';\n }\n parseState.resetParseFunction();\n this.terminal.print('?');\n};\n\n/**\n * Substitute (SUB).\n *\n * Interpreted as CAN.\n */\nhterm.VT.CC1['\\x1a'] = hterm.VT.CC1['\\x18'];\n\n/**\n * Escape (ESC).\n */\nhterm.VT.CC1['\\x1b'] = function(parseState) {\n function parseESC(parseState) {\n var ch = parseState.consumeChar();\n\n if (ch == '\\x1b')\n return;\n\n this.dispatch('ESC', ch, parseState);\n\n if (parseState.func == parseESC)\n parseState.resetParseFunction();\n };\n\n parseState.func = parseESC;\n};\n\n/**\n * Delete (DEL).\n */\nhterm.VT.CC1['\\x7f'] = hterm.VT.ignore;\n\n// 8 bit control characters and their two byte equivalents, below...\n\n/**\n * Index (IND).\n *\n * Like newline, only keep the X position\n */\nhterm.VT.CC1['\\x84'] =\nhterm.VT.ESC['D'] = function() {\n this.terminal.lineFeed();\n};\n\n/**\n * Next Line (NEL).\n *\n * Like newline, but doesn't add lines.\n */\nhterm.VT.CC1['\\x85'] =\nhterm.VT.ESC['E'] = function() {\n this.terminal.setCursorColumn(0);\n this.terminal.cursorDown(1);\n};\n\n/**\n * Horizontal Tabulation Set (HTS).\n */\nhterm.VT.CC1['\\x88'] =\nhterm.VT.ESC['H'] = function() {\n this.terminal.setTabStop(this.terminal.getCursorColumn());\n};\n\n/**\n * Reverse Index (RI).\n *\n * Move up one line.\n */\nhterm.VT.CC1['\\x8d'] =\nhterm.VT.ESC['M'] = function() {\n this.terminal.reverseLineFeed();\n};\n\n/**\n * Single Shift 2 (SS2).\n *\n * Select of G2 Character Set for the next character only.\n *\n * Not currently implemented.\n */\nhterm.VT.CC1['\\x8e'] =\nhterm.VT.ESC['N'] = hterm.VT.ignore;\n\n/**\n * Single Shift 3 (SS3).\n *\n * Select of G3 Character Set for the next character only.\n *\n * Not currently implemented.\n */\nhterm.VT.CC1['\\x8f'] =\nhterm.VT.ESC['O'] = hterm.VT.ignore;\n\n/**\n * Device Control String (DCS).\n *\n * Indicate a DCS sequence. See Device-Control functions in [XTERM].\n * Not currently implemented.\n *\n * TODO(rginda): Consider implementing DECRQSS, the rest don't seem applicable.\n */\nhterm.VT.CC1['\\x90'] =\nhterm.VT.ESC['P'] = function(parseState) {\n parseState.resetArguments();\n parseState.func = this.parseUntilStringTerminator_;\n};\n\n/**\n * Start of Guarded Area (SPA).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x96'] =\nhterm.VT.ESC['V'] = hterm.VT.ignore;\n\n/**\n * End of Guarded Area (EPA).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x97'] =\nhterm.VT.ESC['W'] = hterm.VT.ignore;\n\n/**\n * Start of String (SOS).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x98'] =\nhterm.VT.ESC['X'] = hterm.VT.ignore;\n\n/**\n * Single Character Introducer (SCI, also DECID).\n *\n * Return Terminal ID. Obsolete form of 'ESC [ c' (DA).\n */\nhterm.VT.CC1['\\x9a'] =\nhterm.VT.ESC['Z'] = function() {\n this.terminal.io.sendString('\\x1b[?1;2c');\n};\n\n/**\n * Control Sequence Introducer (CSI).\n *\n * The lead into most escape sequences. See [CSI].\n */\nhterm.VT.CC1['\\x9b'] =\nhterm.VT.ESC['['] = function(parseState) {\n parseState.resetArguments();\n this.leadingModifier_ = '';\n this.trailingModifier_ = '';\n parseState.func = this.parseCSI_;\n};\n\n/**\n * String Terminator (ST).\n *\n * Used to terminate DCS/OSC/PM/APC commands which may take string arguments.\n *\n * We don't directly handle it here, as it's only used to terminate other\n * sequences. See the 'parseUntilStringTerminator_' method.\n */\nhterm.VT.CC1['\\x9c'] =\nhterm.VT.ESC['\\\\'] = hterm.VT.ignore;\n\n/**\n * Operating System Command (OSC).\n *\n * Commands relating to the operating system.\n */\nhterm.VT.CC1['\\x9d'] =\nhterm.VT.ESC[']'] = function(parseState) {\n parseState.resetArguments();\n\n function parseOSC(parseState) {\n if (!this.parseUntilStringTerminator_(parseState)) {\n // The string sequence was too long.\n return;\n }\n\n if (parseState.func == parseOSC) {\n // We're not done parsing the string yet.\n return;\n }\n\n // We're done.\n var ary = parseState.args[0].match(/^(\\d+);(.*)$/);\n if (ary) {\n parseState.args[0] = ary[2];\n this.dispatch('OSC', ary[1], parseState);\n } else {\n console.warn('Invalid OSC: ' + JSON.stringify(parseState.args[0]));\n }\n };\n\n parseState.func = parseOSC;\n};\n\n/**\n * Privacy Message (PM).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x9e'] =\nhterm.VT.ESC['^'] = function(parseState) {\n parseState.resetArguments();\n parseState.func = this.parseUntilStringTerminator_;\n};\n\n/**\n * Application Program Control (APC).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x9f'] =\nhterm.VT.ESC['_'] = function(parseState) {\n parseState.resetArguments();\n parseState.func = this.parseUntilStringTerminator_;\n};\n\n/**\n * ESC \\x20 - Unclear to me where these originated, possibly in xterm.\n *\n * Not currently implemented:\n * ESC \\x20 F - Select 7 bit escape codes in responses (S7C1T).\n * ESC \\x20 G - Select 8 bit escape codes in responses (S8C1T).\n * NB: We currently assume S7C1T always.\n *\n * Will not implement:\n * ESC \\x20 L - Set ANSI conformance level 1.\n * ESC \\x20 M - Set ANSI conformance level 2.\n * ESC \\x20 N - Set ANSI conformance level 3.\n */\nhterm.VT.ESC['\\x20'] = function(parseState) {\n parseState.func = function(parseState) {\n var ch = parseState.consumeChar();\n if (this.warnUnimplemented)\n console.warn('Unimplemented sequence: ESC 0x20 ' + ch);\n parseState.resetParseFunction();\n };\n};\n\n/**\n * DEC 'ESC #' sequences.\n */\nhterm.VT.ESC['#'] = function(parseState) {\n parseState.func = function(parseState) {\n var ch = parseState.consumeChar();\n if (ch == '8') // DEC Screen Alignment Test (DECALN)\n this.terminal.fill('E');\n\n parseState.resetParseFunction();\n };\n};\n\n/**\n * Designate Other Coding System (DOCS).\n */\nhterm.VT.ESC['%'] = function(parseState) {\n parseState.func = function(parseState) {\n var ch = parseState.consumeChar();\n\n // If we've locked the encoding, then just eat the bytes and return.\n if (this.codingSystemLocked_) {\n if (ch == '/')\n parseState.consumeChar();\n parseState.resetParseFunction();\n return;\n }\n\n // Process the encoding requests.\n switch (ch) {\n case '@':\n // Switch to ECMA 35.\n this.setEncoding('iso-2022');\n break;\n\n case 'G':\n // Switch to UTF-8.\n this.setEncoding('utf-8');\n break;\n\n case '/':\n // One way transition to something else.\n ch = parseState.consumeChar();\n switch (ch) {\n case 'G': // UTF-8 Level 1.\n case 'H': // UTF-8 Level 2.\n case 'I': // UTF-8 Level 3.\n // We treat all UTF-8 levels the same.\n this.setEncoding('utf-8-locked');\n break;\n\n default:\n if (this.warnUnimplemented)\n console.warn('Unknown ESC % / argument: ' + JSON.stringify(ch));\n break;\n }\n break;\n\n default:\n if (this.warnUnimplemented)\n console.warn('Unknown ESC % argument: ' + JSON.stringify(ch));\n break;\n }\n\n parseState.resetParseFunction();\n };\n};\n\n/**\n * Character Set Selection (SCS).\n *\n * ESC ( Ps - Set G0 character set (VT100).\n * ESC ) Ps - Set G1 character set (VT220).\n * ESC * Ps - Set G2 character set (VT220).\n * ESC + Ps - Set G3 character set (VT220).\n * ESC - Ps - Set G1 character set (VT300).\n * ESC . Ps - Set G2 character set (VT300).\n * ESC / Ps - Set G3 character set (VT300).\n *\n * All other sequences are echoed to the terminal.\n */\nhterm.VT.ESC['('] =\nhterm.VT.ESC[')'] =\nhterm.VT.ESC['*'] =\nhterm.VT.ESC['+'] =\nhterm.VT.ESC['-'] =\nhterm.VT.ESC['.'] =\nhterm.VT.ESC['/'] = function(parseState, code) {\n parseState.func = function(parseState) {\n var ch = parseState.consumeChar();\n if (ch == '\\x1b') {\n parseState.resetParseFunction();\n parseState.func();\n return;\n }\n\n var map = this.characterMaps.getMap(ch);\n if (map !== undefined) {\n if (code == '(') {\n this.G0 = map;\n } else if (code == ')' || code == '-') {\n this.G1 = map;\n } else if (code == '*' || code == '.') {\n this.G2 = map;\n } else if (code == '+' || code == '/') {\n this.G3 = map;\n }\n } else if (this.warnUnimplemented) {\n console.log('Invalid character set for \"' + code + '\": ' + ch);\n }\n\n parseState.resetParseFunction();\n };\n};\n\n/**\n * Back Index (DECBI).\n *\n * VT420 and up. Not currently implemented.\n */\nhterm.VT.ESC['6'] = hterm.VT.ignore;\n\n/**\n * Save Cursor (DECSC).\n */\nhterm.VT.ESC['7'] = function() {\n this.savedState_.save();\n};\n\n/**\n * Restore Cursor (DECRC).\n */\nhterm.VT.ESC['8'] = function() {\n this.savedState_.restore();\n};\n\n/**\n * Forward Index (DECFI).\n *\n * VT210 and up. Not currently implemented.\n */\nhterm.VT.ESC['9'] = hterm.VT.ignore;\n\n/**\n * Application keypad (DECKPAM).\n */\nhterm.VT.ESC['='] = function() {\n this.terminal.keyboard.applicationKeypad = true;\n};\n\n/**\n * Normal keypad (DECKPNM).\n */\nhterm.VT.ESC['>'] = function() {\n this.terminal.keyboard.applicationKeypad = false;\n};\n\n/**\n * Cursor to lower left corner of screen.\n *\n * Will not implement.\n *\n * This is only recognized by xterm when the hpLowerleftBugCompat resource is\n * set.\n */\nhterm.VT.ESC['F'] = hterm.VT.ignore;\n\n/**\n * Full Reset (RIS).\n */\nhterm.VT.ESC['c'] = function() {\n this.reset();\n this.terminal.reset();\n};\n\n/**\n * Memory lock/unlock.\n *\n * Will not implement.\n */\nhterm.VT.ESC['l'] =\nhterm.VT.ESC['m'] = hterm.VT.ignore;\n\n/**\n * Lock Shift 2 (LS2)\n *\n * Invoke the G2 Character Set as GL.\n */\nhterm.VT.ESC['n'] = function() {\n this.GL = 'G2';\n};\n\n/**\n * Lock Shift 3 (LS3)\n *\n * Invoke the G3 Character Set as GL.\n */\nhterm.VT.ESC['o'] = function() {\n this.GL = 'G3';\n};\n\n/**\n * Lock Shift 2, Right (LS3R)\n *\n * Invoke the G3 Character Set as GR.\n */\nhterm.VT.ESC['|'] = function() {\n this.GR = 'G3';\n};\n\n/**\n * Lock Shift 2, Right (LS2R)\n *\n * Invoke the G2 Character Set as GR.\n */\nhterm.VT.ESC['}'] = function() {\n this.GR = 'G2';\n};\n\n/**\n * Lock Shift 1, Right (LS1R)\n *\n * Invoke the G1 Character Set as GR.\n */\nhterm.VT.ESC['~'] = function() {\n this.GR = 'G1';\n};\n\n/**\n * Change icon name and window title.\n *\n * We only change the window title.\n */\nhterm.VT.OSC['0'] = function(parseState) {\n this.terminal.setWindowTitle(parseState.args[0]);\n};\n\n/**\n * Change window title.\n */\nhterm.VT.OSC['2'] = hterm.VT.OSC['0'];\n\n/**\n * Set/read color palette.\n */\nhterm.VT.OSC['4'] = function(parseState) {\n // Args come in as a single 'index1;rgb1 ... ;indexN;rgbN' string.\n // We split on the semicolon and iterate through the pairs.\n var args = parseState.args[0].split(';');\n\n var pairCount = parseInt(args.length / 2);\n var colorPalette = this.terminal.getTextAttributes().colorPalette;\n var responseArray = [];\n\n for (var pairNumber = 0; pairNumber < pairCount; ++pairNumber) {\n var colorIndex = parseInt(args[pairNumber * 2]);\n var colorValue = args[pairNumber * 2 + 1];\n\n if (colorIndex >= colorPalette.length)\n continue;\n\n if (colorValue == '?') {\n // '?' means we should report back the current color value.\n colorValue = lib.colors.rgbToX11(colorPalette[colorIndex]);\n if (colorValue)\n responseArray.push(colorIndex + ';' + colorValue);\n\n continue;\n }\n\n colorValue = lib.colors.x11ToCSS(colorValue);\n if (colorValue)\n colorPalette[colorIndex] = colorValue;\n }\n\n if (responseArray.length)\n this.terminal.io.sendString('\\x1b]4;' + responseArray.join(';') + '\\x07');\n};\n\n/**\n * iTerm2 growl notifications.\n */\nhterm.VT.OSC['9'] = function(parseState) {\n // This just dumps the entire string as the message.\n hterm.notify({'body': parseState.args[0]});\n};\n\n/**\n * Change VT100 text foreground color.\n */\nhterm.VT.OSC['10'] = function(parseState) {\n // Args come in as a single string, but extra args will chain to the following\n // OSC sequences.\n var args = parseState.args[0].split(';');\n if (!args)\n return;\n\n var colorArg;\n var colorX11 = lib.colors.x11ToCSS(args.shift());\n if (colorX11)\n this.terminal.setForegroundColor(colorX11);\n\n if (args.length > 0) {\n parseState.args[0] = args.join(';');\n hterm.VT.OSC['11'].apply(this, [parseState]);\n }\n};\n\n/**\n * Change VT100 text background color.\n */\nhterm.VT.OSC['11'] = function(parseState) {\n // Args come in as a single string, but extra args will chain to the following\n // OSC sequences.\n var args = parseState.args[0].split(';');\n if (!args)\n return;\n\n var colorArg;\n var colorX11 = lib.colors.x11ToCSS(args.shift());\n if (colorX11)\n this.terminal.setBackgroundColor(colorX11);\n\n /* Note: If we support OSC 12+, we'd chain it here.\n if (args.length > 0) {\n parseState.args[0] = args.join(';');\n hterm.VT.OSC['12'].apply(this, [parseState]);\n }\n */\n};\n\n/**\n * Set the cursor shape.\n *\n * Parameter is expected to be in the form \"CursorShape=number\", where number is\n * one of:\n *\n * 0 - Block\n * 1 - I-Beam\n * 2 - Underline\n *\n * This is a bit of a de-facto standard supported by iTerm 2 and Konsole. See\n * also: DECSCUSR.\n *\n * Invalid numbers will restore the cursor to the block shape.\n */\nhterm.VT.OSC['50'] = function(parseState) {\n var args = parseState.args[0].match(/CursorShape=(.)/i);\n if (!args) {\n console.warn('Could not parse OSC 50 args: ' + parseState.args[0]);\n return;\n }\n\n switch (args[1]) {\n case '1': // CursorShape=1: I-Beam.\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);\n break;\n\n case '2': // CursorShape=2: Underline.\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);\n break;\n\n default: // CursorShape=0: Block.\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK);\n }\n};\n\n/**\n * Set/read system clipboard.\n *\n * Read is not implemented due to security considerations. A remote app\n * that is able to both write and read to the clipboard could essentially\n * take over your session.\n *\n * The clipboard data will be decoded according to the 'receive-encoding'\n * preference.\n */\nhterm.VT.OSC['52'] = function(parseState) {\n // Args come in as a single 'clipboard;b64-data' string. The clipboard\n // parameter is used to select which of the X clipboards to address. Since\n // we're not integrating with X, we treat them all the same.\n var args = parseState.args[0].match(/^[cps01234567]*;(.*)/);\n if (!args)\n return;\n\n var data = window.atob(args[1]);\n if (data)\n this.terminal.copyStringToClipboard(this.decode(data));\n};\n\n/**\n * URxvt perl modules.\n *\n * This is the escape system used by rxvt-unicode and its perl modules.\n * Obviously we don't support perl or custom modules, so we list a few common\n * ones that we find useful.\n *\n * Technically there is no format here, but most modules obey:\n * ;\n */\nhterm.VT.OSC['777'] = function(parseState) {\n var ary;\n var urxvtMod = parseState.args[0].split(';', 1)[0];\n\n switch (urxvtMod) {\n case 'notify':\n // Format:\n // notify;title;message\n var title, message;\n ary = parseState.args[0].match(/^[^;]+;([^;]*)(;([\\s\\S]*))?$/);\n if (ary) {\n title = ary[1];\n message = ary[3];\n }\n hterm.notify({'title': title, 'body': message});\n break;\n\n default:\n console.warn('Unknown urxvt module: ' + parseState.args[0]);\n break;\n }\n};\n\n/**\n * Insert (blank) characters (ICH).\n */\nhterm.VT.CSI['@'] = function(parseState) {\n this.terminal.insertSpace(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Up (CUU).\n */\nhterm.VT.CSI['A'] = function(parseState) {\n this.terminal.cursorUp(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Down (CUD).\n */\nhterm.VT.CSI['B'] = function(parseState) {\n this.terminal.cursorDown(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Forward (CUF).\n */\nhterm.VT.CSI['C'] = function(parseState) {\n this.terminal.cursorRight(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Backward (CUB).\n */\nhterm.VT.CSI['D'] = function(parseState) {\n this.terminal.cursorLeft(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Next Line (CNL).\n *\n * This is like Cursor Down, except the cursor moves to the beginning of the\n * line as well.\n */\nhterm.VT.CSI['E'] = function(parseState) {\n this.terminal.cursorDown(parseState.iarg(0, 1));\n this.terminal.setCursorColumn(0);\n};\n\n/**\n * Cursor Preceding Line (CPL).\n *\n * This is like Cursor Up, except the cursor moves to the beginning of the\n * line as well.\n */\nhterm.VT.CSI['F'] = function(parseState) {\n this.terminal.cursorUp(parseState.iarg(0, 1));\n this.terminal.setCursorColumn(0);\n};\n\n/**\n * Cursor Character Absolute (CHA).\n */\nhterm.VT.CSI['G'] = function(parseState) {\n this.terminal.setCursorColumn(parseState.iarg(0, 1) - 1);\n};\n\n/**\n * Cursor Position (CUP).\n */\nhterm.VT.CSI['H'] = function(parseState) {\n this.terminal.setCursorPosition(parseState.iarg(0, 1) - 1,\n parseState.iarg(1, 1) - 1);\n};\n\n/**\n * Cursor Forward Tabulation (CHT).\n */\nhterm.VT.CSI['I'] = function(parseState) {\n var count = parseState.iarg(0, 1);\n count = lib.f.clamp(count, 1, this.terminal.screenSize.width);\n for (var i = 0; i < count; i++) {\n this.terminal.forwardTabStop();\n }\n};\n\n/**\n * Erase in Display (ED, DECSED).\n */\nhterm.VT.CSI['J'] =\nhterm.VT.CSI['?J'] = function(parseState, code) {\n var arg = parseState.args[0];\n\n if (!arg || arg == 0) {\n this.terminal.eraseBelow();\n } else if (arg == 1) {\n this.terminal.eraseAbove();\n } else if (arg == 2) {\n this.terminal.clear();\n } else if (arg == 3) {\n // The xterm docs say this means \"Erase saved lines\", but we'll just clear\n // the display since killing the scrollback seems rude.\n this.terminal.clear();\n }\n};\n\n/**\n * Erase in line (EL, DECSEL).\n */\nhterm.VT.CSI['K'] =\nhterm.VT.CSI['?K'] = function(parseState, code) {\n var arg = parseState.args[0];\n\n if (!arg || arg == 0) {\n this.terminal.eraseToRight();\n } else if (arg == 1) {\n this.terminal.eraseToLeft();\n } else if (arg == 2) {\n this.terminal.eraseLine();\n }\n};\n\n/**\n * Insert Lines (IL).\n */\nhterm.VT.CSI['L'] = function(parseState) {\n this.terminal.insertLines(parseState.iarg(0, 1));\n};\n\n/**\n * Delete Lines (DL).\n */\nhterm.VT.CSI['M'] = function(parseState) {\n this.terminal.deleteLines(parseState.iarg(0, 1));\n};\n\n/**\n * Delete Characters (DCH).\n *\n * This command shifts the line contents left, starting at the cursor position.\n */\nhterm.VT.CSI['P'] = function(parseState) {\n this.terminal.deleteChars(parseState.iarg(0, 1));\n};\n\n/**\n * Scroll Up (SU).\n */\nhterm.VT.CSI['S'] = function(parseState) {\n this.terminal.vtScrollUp(parseState.iarg(0, 1));\n};\n\n/**\n * Scroll Down (SD).\n * Also 'Initiate highlight mouse tracking'. Will not implement this part.\n */\nhterm.VT.CSI['T'] = function(parseState) {\n if (parseState.args.length <= 1)\n this.terminal.vtScrollDown(parseState.iarg(0, 1));\n};\n\n/**\n * Reset one or more features of the title modes to the default value.\n *\n * ESC [ > Ps T\n *\n * Normally, \"reset\" disables the feature. It is possible to disable the\n * ability to reset features by compiling a different default for the title\n * modes into xterm.\n *\n * Ps values:\n * 0 - Do not set window/icon labels using hexadecimal.\n * 1 - Do not query window/icon labels using hexadecimal.\n * 2 - Do not set window/icon labels using UTF-8.\n * 3 - Do not query window/icon labels using UTF-8.\n *\n * Will not implement.\n */\nhterm.VT.CSI['>T'] = hterm.VT.ignore;\n\n/**\n * Erase Characters (ECH).\n */\nhterm.VT.CSI['X'] = function(parseState) {\n this.terminal.eraseToRight(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Backward Tabulation (CBT).\n */\nhterm.VT.CSI['Z'] = function(parseState) {\n var count = parseState.iarg(0, 1);\n count = lib.f.clamp(count, 1, this.terminal.screenSize.width);\n for (var i = 0; i < count; i++) {\n this.terminal.backwardTabStop();\n }\n};\n\n/**\n * Character Position Absolute (HPA).\n *\n * Same as Cursor Character Absolute (CHA).\n */\nhterm.VT.CSI['`'] = hterm.VT.CSI['G'];\n\n/**\n * Character Position Relative (HPR).\n */\nhterm.VT.CSI['a'] = function(parseState) {\n this.terminal.setCursorColumn(this.terminal.getCursorColumn() +\n parseState.iarg(0, 1));\n};\n\n/**\n * Repeat the preceding graphic character.\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['b'] = hterm.VT.ignore;\n\n/**\n * Send Device Attributes (Primary DA).\n *\n * TODO(rginda): This is hardcoded to send back 'VT100 with Advanced Video\n * Option', but it may be more correct to send a VT220 response once\n * we fill out the 'Not currently implemented' parts.\n */\nhterm.VT.CSI['c'] = function(parseState) {\n if (!parseState.args[0] || parseState.args[0] == 0) {\n this.terminal.io.sendString('\\x1b[?1;2c');\n }\n};\n\n/**\n * Send Device Attributes (Secondary DA).\n *\n * TODO(rginda): This is hardcoded to send back 'VT100' but it may be more\n * correct to send a VT220 response once we fill out more 'Not currently\n * implemented' parts.\n */\nhterm.VT.CSI['>c'] = function(parseState) {\n this.terminal.io.sendString('\\x1b[>0;256;0c');\n};\n\n/**\n * Line Position Absolute (VPA).\n */\nhterm.VT.CSI['d'] = function(parseState) {\n this.terminal.setAbsoluteCursorRow(parseState.iarg(0, 1) - 1);\n};\n\n/**\n * Horizontal and Vertical Position (HVP).\n *\n * Same as Cursor Position (CUP).\n */\nhterm.VT.CSI['f'] = hterm.VT.CSI['H'];\n\n/**\n * Tab Clear (TBC).\n */\nhterm.VT.CSI['g'] = function(parseState) {\n if (!parseState.args[0] || parseState.args[0] == 0) {\n // Clear tab stop at cursor.\n this.terminal.clearTabStopAtCursor(false);\n } else if (parseState.args[0] == 3) {\n // Clear all tab stops.\n this.terminal.clearAllTabStops();\n }\n};\n\n/**\n * Set Mode (SM).\n */\nhterm.VT.CSI['h'] = function(parseState) {\n for (var i = 0; i < parseState.args.length; i++) {\n this.setANSIMode(parseState.args[i], true);\n }\n};\n\n/**\n * DEC Private Mode Set (DECSET).\n */\nhterm.VT.CSI['?h'] = function(parseState) {\n for (var i = 0; i < parseState.args.length; i++) {\n this.setDECMode(parseState.args[i], true);\n }\n};\n\n/**\n * Media Copy (MC).\n * Media Copy (MC, DEC Specific).\n *\n * These commands control the printer. Will not implement.\n */\nhterm.VT.CSI['i'] =\nhterm.VT.CSI['?i'] = hterm.VT.ignore;\n\n/**\n * Reset Mode (RM).\n */\nhterm.VT.CSI['l'] = function(parseState) {\n for (var i = 0; i < parseState.args.length; i++) {\n this.setANSIMode(parseState.args[i], false);\n }\n};\n\n/**\n * DEC Private Mode Reset (DECRST).\n */\nhterm.VT.CSI['?l'] = function(parseState) {\n for (var i = 0; i < parseState.args.length; i++) {\n this.setDECMode(parseState.args[i], false);\n }\n};\n\n/**\n * Character Attributes (SGR).\n *\n * Iterate through the list of arguments, applying the attribute changes based\n * on the argument value...\n */\nhterm.VT.CSI['m'] = function(parseState) {\n function get256(i) {\n if (parseState.args.length < i + 2 || parseState.args[i + 1] != 5)\n return null;\n\n return parseState.iarg(i + 2, 0);\n }\n\n function getTrueColor(i) {\n if (parseState.args.length < i + 5 || parseState.args[i + 1] != 2)\n return null;\n var r = parseState.iarg(i + 2, 0);\n var g = parseState.iarg(i + 3, 0);\n var b = parseState.iarg(i + 4, 0);\n\n return 'rgb(' + r + ' ,' + g + ' ,' + b + ')';\n }\n\n var attrs = this.terminal.getTextAttributes();\n\n if (!parseState.args.length) {\n attrs.reset();\n return;\n }\n\n for (var i = 0; i < parseState.args.length; i++) {\n var arg = parseState.iarg(i, 0);\n\n if (arg < 30) {\n if (arg == 0) { // Normal (default).\n attrs.reset();\n } else if (arg == 1) { // Bold.\n attrs.bold = true;\n } else if (arg == 2) { // Faint.\n attrs.faint = true;\n } else if (arg == 3) { // Italic.\n attrs.italic = true;\n } else if (arg == 4) { // Underline.\n attrs.underline = true;\n } else if (arg == 5) { // Blink.\n attrs.blink = true;\n } else if (arg == 7) { // Inverse.\n attrs.inverse = true;\n } else if (arg == 8) { // Invisible.\n attrs.invisible = true;\n } else if (arg == 9) { // Crossed out.\n attrs.strikethrough = true;\n } else if (arg == 22) { // Not bold & not faint.\n attrs.bold = false;\n attrs.faint = false;\n } else if (arg == 23) { // Not italic.\n attrs.italic = false;\n } else if (arg == 24) { // Not underlined.\n attrs.underline = false;\n } else if (arg == 25) { // Not blink.\n attrs.blink = false;\n } else if (arg == 27) { // Steady.\n attrs.inverse = false;\n } else if (arg == 28) { // Visible.\n attrs.invisible = false;\n } else if (arg == 29) { // Not crossed out.\n attrs.strikethrough = false;\n }\n\n } else if (arg < 50) {\n // Select fore/background color from bottom half of 16 color palette\n // or from the 256 color palette or alternative specify color in fully\n // qualified rgb(r, g, b) form.\n if (arg < 38) {\n attrs.foregroundSource = arg - 30;\n\n } else if (arg == 38) {\n // First check for true color definition\n var trueColor = getTrueColor(i);\n if (trueColor != null) {\n attrs.foregroundSource = attrs.SRC_RGB;\n attrs.foreground = trueColor;\n\n i += 5;\n } else {\n // Check for 256 color\n var c = get256(i);\n if (c == null)\n break;\n\n i += 2;\n\n if (c >= attrs.colorPalette.length)\n continue;\n\n attrs.foregroundSource = c;\n }\n\n } else if (arg == 39) {\n attrs.foregroundSource = attrs.SRC_DEFAULT;\n\n } else if (arg < 48) {\n attrs.backgroundSource = arg - 40;\n\n } else if (arg == 48) {\n // First check for true color definition\n var trueColor = getTrueColor(i);\n if (trueColor != null) {\n attrs.backgroundSource = attrs.SRC_RGB;\n attrs.background = trueColor;\n\n i += 5;\n } else {\n // Check for 256 color\n var c = get256(i);\n if (c == null)\n break;\n\n i += 2;\n\n if (c >= attrs.colorPalette.length)\n continue;\n\n attrs.backgroundSource = c;\n }\n } else {\n attrs.backgroundSource = attrs.SRC_DEFAULT;\n }\n\n } else if (arg >= 90 && arg <= 97) {\n attrs.foregroundSource = arg - 90 + 8;\n\n } else if (arg >= 100 && arg <= 107) {\n attrs.backgroundSource = arg - 100 + 8;\n }\n }\n\n attrs.setDefaults(this.terminal.getForegroundColor(),\n this.terminal.getBackgroundColor());\n};\n\n/**\n * Set xterm-specific keyboard modes.\n *\n * Will not implement.\n */\nhterm.VT.CSI['>m'] = hterm.VT.ignore;\n\n/**\n * Device Status Report (DSR, DEC Specific).\n *\n * 5 - Status Report. Result (OK) is CSI 0 n\n * 6 - Report Cursor Position (CPR) [row;column]. Result is CSI r ; c R\n */\nhterm.VT.CSI['n'] = function(parseState) {\n if (parseState.args[0] == 5) {\n this.terminal.io.sendString('\\x1b0n');\n } else if (parseState.args[0] == 6) {\n var row = this.terminal.getCursorRow() + 1;\n var col = this.terminal.getCursorColumn() + 1;\n this.terminal.io.sendString('\\x1b[' + row + ';' + col + 'R');\n }\n};\n\n/**\n * Disable modifiers which may be enabled via CSI['>m'].\n *\n * Will not implement.\n */\nhterm.VT.CSI['>n'] = hterm.VT.ignore;\n\n/**\n * Device Status Report (DSR, DEC Specific).\n *\n * 6 - Report Cursor Position (CPR) [row;column] as CSI ? r ; c R\n * 15 - Report Printer status as CSI ? 1 0 n (ready) or\n * CSI ? 1 1 n (not ready).\n * 25 - Report UDK status as CSI ? 2 0 n (unlocked) or CSI ? 2 1 n (locked).\n * 26 - Report Keyboard status as CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).\n * The last two parameters apply to VT400 & up, and denote keyboard ready\n * and LK01 respectively.\n * 53 - Report Locator status as CSI ? 5 3 n Locator available, if compiled-in,\n * or CSI ? 5 0 n No Locator, if not.\n */\nhterm.VT.CSI['?n'] = function(parseState) {\n if (parseState.args[0] == 6) {\n var row = this.terminal.getCursorRow() + 1;\n var col = this.terminal.getCursorColumn() + 1;\n this.terminal.io.sendString('\\x1b[' + row + ';' + col + 'R');\n } else if (parseState.args[0] == 15) {\n this.terminal.io.sendString('\\x1b[?11n');\n } else if (parseState.args[0] == 25) {\n this.terminal.io.sendString('\\x1b[?21n');\n } else if (parseState.args[0] == 26) {\n this.terminal.io.sendString('\\x1b[?12;1;0;0n');\n } else if (parseState.args[0] == 53) {\n this.terminal.io.sendString('\\x1b[?50n');\n }\n};\n\n/**\n * This is used by xterm to decide whether to hide the pointer cursor as the\n * user types.\n *\n * Valid values for the parameter:\n * 0 - Never hide the pointer.\n * 1 - Hide if the mouse tracking mode is not enabled.\n * 2 - Always hide the pointer.\n *\n * If no parameter is given, xterm uses the default, which is 1.\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['>p'] = hterm.VT.ignore;\n\n/**\n * Soft terminal reset (DECSTR).\n */\nhterm.VT.CSI['!p'] = function() {\n this.reset();\n this.terminal.softReset();\n};\n\n/**\n * Request ANSI Mode (DECRQM).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['$p'] = hterm.VT.ignore;\nhterm.VT.CSI['?$p'] = hterm.VT.ignore;\n\n/**\n * Set conformance level (DECSCL).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['\"p'] = hterm.VT.ignore;\n\n/**\n * Load LEDs (DECLL).\n *\n * Not currently implemented. Could be implemented as virtual LEDs overlaying\n * the terminal if anyone cares.\n */\nhterm.VT.CSI['q'] = hterm.VT.ignore;\n\n/**\n * Set cursor style (DECSCUSR, VT520).\n */\nhterm.VT.CSI[' q'] = function(parseState) {\n var arg = parseState.args[0];\n\n if (arg == 0 || arg == 1) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK);\n this.terminal.setCursorBlink(true);\n } else if (arg == 2) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK);\n this.terminal.setCursorBlink(false);\n } else if (arg == 3) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);\n this.terminal.setCursorBlink(true);\n } else if (arg == 4) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);\n this.terminal.setCursorBlink(false);\n } else if (arg == 5) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);\n this.terminal.setCursorBlink(true);\n } else if (arg == 6) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);\n this.terminal.setCursorBlink(false);\n } else {\n console.warn('Unknown cursor style: ' + arg);\n }\n};\n\n/**\n * Select character protection attribute (DECSCA).\n *\n * Will not implement.\n */\nhterm.VT.CSI['\"q'] = hterm.VT.ignore;\n\n/**\n * Set Scrolling Region (DECSTBM).\n */\nhterm.VT.CSI['r'] = function(parseState) {\n var args = parseState.args;\n var scrollTop = args[0] ? parseInt(args[0], 10) -1 : null;\n var scrollBottom = args[1] ? parseInt(args[1], 10) - 1 : null;\n this.terminal.setVTScrollRegion(scrollTop, scrollBottom);\n this.terminal.setCursorPosition(0, 0);\n};\n\n/**\n * Restore DEC Private Mode Values.\n *\n * Will not implement.\n */\nhterm.VT.CSI['?r'] = hterm.VT.ignore;\n\n/**\n * Change Attributes in Rectangular Area (DECCARA)\n *\n * Will not implement.\n */\nhterm.VT.CSI['$r'] = hterm.VT.ignore;\n\n/**\n * Save cursor (ANSI.SYS)\n */\nhterm.VT.CSI['s'] = function() {\n this.savedState_.save();\n};\n\n/**\n * Save DEC Private Mode Values.\n *\n * Will not implement.\n */\nhterm.VT.CSI['?s'] = hterm.VT.ignore;\n\n/**\n * Window manipulation (from dtterm, as well as extensions).\n *\n * Will not implement.\n */\nhterm.VT.CSI['t'] = hterm.VT.ignore;\n\n/**\n * Reverse Attributes in Rectangular Area (DECRARA).\n *\n * Will not implement.\n */\nhterm.VT.CSI['$t'] = hterm.VT.ignore;\n\n/**\n * Set one or more features of the title modes.\n *\n * Will not implement.\n */\nhterm.VT.CSI['>t'] = hterm.VT.ignore;\n\n/**\n * Set warning-bell volume (DECSWBV, VT520).\n *\n * Will not implement.\n */\nhterm.VT.CSI[' t'] = hterm.VT.ignore;\n\n/**\n * Restore cursor (ANSI.SYS).\n */\nhterm.VT.CSI['u'] = function() {\n this.savedState_.restore();\n};\n\n/**\n * Set margin-bell volume (DECSMBV, VT520).\n *\n * Will not implement.\n */\nhterm.VT.CSI[' u'] = hterm.VT.ignore;\n\n/**\n * Copy Rectangular Area (DECCRA, VT400 and up).\n *\n * Will not implement.\n */\nhterm.VT.CSI['$v'] = hterm.VT.ignore;\n\n/**\n * Enable Filter Rectangle (DECEFR).\n *\n * Will not implement.\n */\nhterm.VT.CSI['\\'w'] = hterm.VT.ignore;\n\n/**\n * Request Terminal Parameters (DECREQTPARM).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['x'] = hterm.VT.ignore;\n\n/**\n * Select Attribute Change Extent (DECSACE).\n *\n * Will not implement.\n */\nhterm.VT.CSI['*x'] = hterm.VT.ignore;\n\n/**\n * Fill Rectangular Area (DECFRA), VT420 and up.\n *\n * Will not implement.\n */\nhterm.VT.CSI['$x'] = hterm.VT.ignore;\n\n/**\n * vt_tiledata (as used by NAOhack and UnNetHack)\n * (see https://nethackwiki.com/wiki/Vt_tiledata for more info)\n *\n * Implemented as far as we care (start a glyph and end a glyph).\n */\nhterm.VT.CSI['z'] = function(parseState) {\n if (parseState.args.length < 1)\n return;\n var arg = parseState.args[0];\n if (arg == 0) {\n // Start a glyph (one parameter, the glyph number).\n if (parseState.args.length < 2)\n return;\n this.terminal.getTextAttributes().tileData = parseState.args[1];\n } else if (arg == 1) {\n // End a glyph.\n this.terminal.getTextAttributes().tileData = null;\n }\n};\n\n/**\n * Enable Locator Reporting (DECELR).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['\\'z'] = hterm.VT.ignore;\n\n/**\n * Erase Rectangular Area (DECERA), VT400 and up.\n *\n * Will not implement.\n */\nhterm.VT.CSI['$z'] = hterm.VT.ignore;\n\n/**\n * Select Locator Events (DECSLE).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['\\'{'] = hterm.VT.ignore;\n\n/**\n * Request Locator Position (DECRQLP).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['\\'|'] = hterm.VT.ignore;\n\n/**\n * Insert Columns (DECIC), VT420 and up.\n *\n * Will not implement.\n */\nhterm.VT.CSI['\\'}'] = hterm.VT.ignore;\n\n/**\n * Delete P s Columns (DECDC), VT420 and up.\n *\n * Will not implement.\n */\nhterm.VT.CSI['\\'~'] = hterm.VT.ignore;\n// SOURCE FILE: hterm/js/hterm_vt_character_map.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f');\n\n/**\n * Character map object.\n *\n * Mapping from received to display character, used depending on the active\n * VT character set.\n *\n * GR maps are not currently supported.\n *\n * @param {string} description A human readable description of this map.\n * @param {Object} glmap The GL mapping from input to output characters.\n */\nhterm.VT.CharacterMap = function(description, glmap) {\n /**\n * Short description for this character set, useful for debugging.\n */\n this.description = description;\n\n /**\n * The function to call to when this map is installed in GL.\n */\n this.GL = null;\n\n // Always keep an unmodified reference to the map.\n // This allows us to sanely reset back to the original state.\n this.glmapBase_ = glmap;\n\n // Now sync the internal state as needed.\n this.sync_();\n};\n\n/**\n * Internal helper for resyncing internal state.\n *\n * Used when the mappings change.\n *\n * @param {Object?} opt_glmap Additional mappings to overlay on top of the\n * base mapping.\n */\nhterm.VT.CharacterMap.prototype.sync_ = function(opt_glmap) {\n // If there are no maps, then reset the state back.\n if (!this.glmapBase_ && !opt_glmap) {\n this.GL = null;\n delete this.glmap_;\n delete this.glre_;\n return;\n }\n\n // Set the the GL mapping. If we're given a custom mapping, then create a\n // new object to hold the merged map. This way we can cleanly reset back.\n if (opt_glmap)\n this.glmap_ = Object.assign({}, this.glmapBase_, opt_glmap);\n else\n this.glmap_ = this.glmapBase_;\n\n var glchars = Object.keys(this.glmap_).map((key) =>\n '\\\\x' + lib.f.zpad(key.charCodeAt(0).toString(16)));\n this.glre_ = new RegExp('[' + glchars.join('') + ']', 'g');\n\n this.GL = (str) => str.replace(this.glre_, (ch) => this.glmap_[ch]);\n};\n\n/**\n * Reset map back to original mappings (discarding runtime updates).\n *\n * Specifically, any calls to setOverrides will be discarded.\n */\nhterm.VT.CharacterMap.prototype.reset = function() {\n // If we haven't been given a custom mapping, then there's nothing to reset.\n if (this.glmap_ !== this.glmapBase_)\n this.sync_();\n};\n\n/**\n * Merge custom changes to this map.\n *\n * The input map need not duplicate the existing mappings as it is merged with\n * the existing base map (what was created with). Subsequent calls to this\n * will throw away previous override settings.\n *\n * @param {Object} glmap The custom map to override existing mappings.\n */\nhterm.VT.CharacterMap.prototype.setOverrides = function(glmap) {\n this.sync_(glmap);\n};\n\n/**\n * Return a copy of this mapping.\n *\n * @return {hterm.VT.CharacterMap} A new hterm.VT.CharacterMap instance.\n */\nhterm.VT.CharacterMap.prototype.clone = function() {\n var map = new hterm.VT.CharacterMap(this.description, this.glmapBase_);\n if (this.glmap_ !== this.glmapBase_)\n map.setOverrides(this.glmap_);\n return map;\n};\n\n/**\n * Table of character maps.\n */\nhterm.VT.CharacterMaps = function() {\n this.maps_ = hterm.VT.CharacterMaps.DefaultMaps;\n\n // Always keep an unmodified reference to the map.\n // This allows us to sanely reset back to the original state.\n this.mapsBase_ = this.maps_;\n};\n\n/**\n * Look up a previously registered map.\n *\n * @param {String} name The name of the map to lookup.\n * @return {hterm.VT.CharacterMap} The map, if it's been registered.\n */\nhterm.VT.CharacterMaps.prototype.getMap = function(name) {\n if (this.maps_.hasOwnProperty(name))\n return this.maps_[name];\n else\n return undefined;\n};\n\n/**\n * Register a new map.\n *\n * Any previously registered maps by this name will be discarded.\n *\n * @param {String} name The name of the map.\n * @param {hterm.VT.CharacterMap} map The map to register.\n */\nhterm.VT.CharacterMaps.prototype.addMap = function(name, map) {\n if (this.maps_ === this.mapsBase_)\n this.maps_ = Object.assign({}, this.mapsBase_);\n this.maps_[name] = map;\n};\n\n/**\n * Reset the table and all its maps back to original state.\n */\nhterm.VT.CharacterMaps.prototype.reset = function() {\n if (this.maps_ !== hterm.VT.CharacterMaps.DefaultMaps)\n this.maps_ = hterm.VT.CharacterMaps.DefaultMaps;\n};\n\n/**\n * Merge custom changes to this table.\n *\n * @param {Object} maps A set of hterm.VT.CharacterMap objects.\n */\nhterm.VT.CharacterMaps.prototype.setOverrides = function(maps) {\n if (this.maps_ === this.mapsBase_)\n this.maps_ = Object.assign({}, this.mapsBase_);\n\n for (var name in maps) {\n var map = this.getMap(name);\n if (map !== undefined) {\n this.maps_[name] = map.clone();\n this.maps_[name].setOverrides(maps[name]);\n } else\n this.addMap(name, new hterm.VT.CharacterMap('user ' + name, maps[name]));\n }\n};\n\n/**\n * The default set of supported character maps.\n */\nhterm.VT.CharacterMaps.DefaultMaps = {};\n\n/**\n * VT100 Graphic character map.\n * http://vt100.net/docs/vt220-rm/table2-4.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['0'] = new hterm.VT.CharacterMap(\n 'graphic', {\n '\\x60':'\\u25c6', // ` -> diamond\n '\\x61':'\\u2592', // a -> grey-box\n '\\x62':'\\u2409', // b -> h/t\n '\\x63':'\\u240c', // c -> f/f\n '\\x64':'\\u240d', // d -> c/r\n '\\x65':'\\u240a', // e -> l/f\n '\\x66':'\\u00b0', // f -> degree\n '\\x67':'\\u00b1', // g -> +/-\n '\\x68':'\\u2424', // h -> n/l\n '\\x69':'\\u240b', // i -> v/t\n '\\x6a':'\\u2518', // j -> bottom-right\n '\\x6b':'\\u2510', // k -> top-right\n '\\x6c':'\\u250c', // l -> top-left\n '\\x6d':'\\u2514', // m -> bottom-left\n '\\x6e':'\\u253c', // n -> line-cross\n '\\x6f':'\\u23ba', // o -> scan1\n '\\x70':'\\u23bb', // p -> scan3\n '\\x71':'\\u2500', // q -> scan5\n '\\x72':'\\u23bc', // r -> scan7\n '\\x73':'\\u23bd', // s -> scan9\n '\\x74':'\\u251c', // t -> left-tee\n '\\x75':'\\u2524', // u -> right-tee\n '\\x76':'\\u2534', // v -> bottom-tee\n '\\x77':'\\u252c', // w -> top-tee\n '\\x78':'\\u2502', // x -> vertical-line\n '\\x79':'\\u2264', // y -> less-equal\n '\\x7a':'\\u2265', // z -> greater-equal\n '\\x7b':'\\u03c0', // { -> pi\n '\\x7c':'\\u2260', // | -> not-equal\n '\\x7d':'\\u00a3', // } -> british-pound\n '\\x7e':'\\u00b7', // ~ -> dot\n });\n\n/**\n * British character map.\n * http://vt100.net/docs/vt220-rm/table2-5.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['A'] = new hterm.VT.CharacterMap(\n 'british', {\n '\\x23': '\\u00a3', // # -> british-pound\n });\n\n/**\n * US ASCII map, no changes.\n */\nhterm.VT.CharacterMaps.DefaultMaps['B'] = new hterm.VT.CharacterMap(\n 'us', null);\n\n/**\n * Dutch character map.\n * http://vt100.net/docs/vt220-rm/table2-6.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['4'] = new hterm.VT.CharacterMap(\n 'dutch', {\n '\\x23': '\\u00a3', // # -> british-pound\n\n '\\x40': '\\u00be', // @ -> 3/4\n\n '\\x5b': '\\u0132', // [ -> 'ij' ligature (xterm goes with \\u00ff?)\n '\\x5c': '\\u00bd', // \\ -> 1/2\n '\\x5d': '\\u007c', // ] -> vertical bar\n\n '\\x7b': '\\u00a8', // { -> two dots\n '\\x7c': '\\u0066', // | -> f\n '\\x7d': '\\u00bc', // } -> 1/4\n '\\x7e': '\\u00b4', // ~ -> acute\n });\n\n/**\n * Finnish character map.\n * http://vt100.net/docs/vt220-rm/table2-7.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['C'] =\nhterm.VT.CharacterMaps.DefaultMaps['5'] = new hterm.VT.CharacterMap(\n 'finnish', {\n '\\x5b': '\\u00c4', // [ -> 'A' umlaut\n '\\x5c': '\\u00d6', // \\ -> 'O' umlaut\n '\\x5d': '\\u00c5', // ] -> 'A' ring\n '\\x5e': '\\u00dc', // ~ -> 'u' umlaut\n\n '\\x60': '\\u00e9', // ` -> 'e' acute\n\n '\\x7b': '\\u00e4', // { -> 'a' umlaut\n '\\x7c': '\\u00f6', // | -> 'o' umlaut\n '\\x7d': '\\u00e5', // } -> 'a' ring\n '\\x7e': '\\u00fc', // ~ -> 'u' umlaut\n });\n\n/**\n * French character map.\n * http://vt100.net/docs/vt220-rm/table2-8.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['R'] = new hterm.VT.CharacterMap(\n 'french', {\n '\\x23': '\\u00a3', // # -> british-pound\n\n '\\x40': '\\u00e0', // @ -> 'a' grave\n\n '\\x5b': '\\u00b0', // [ -> ring\n '\\x5c': '\\u00e7', // \\ -> 'c' cedilla\n '\\x5d': '\\u00a7', // ] -> section symbol (double s)\n\n '\\x7b': '\\u00e9', // { -> 'e' acute\n '\\x7c': '\\u00f9', // | -> 'u' grave\n '\\x7d': '\\u00e8', // } -> 'e' grave\n '\\x7e': '\\u00a8', // ~ -> umlaut\n });\n\n/**\n * French Canadian character map.\n * http://vt100.net/docs/vt220-rm/table2-9.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['Q'] = new hterm.VT.CharacterMap(\n 'french canadian', {\n '\\x40': '\\u00e0', // @ -> 'a' grave\n\n '\\x5b': '\\u00e2', // [ -> 'a' circumflex\n '\\x5c': '\\u00e7', // \\ -> 'c' cedilla\n '\\x5d': '\\u00ea', // ] -> 'e' circumflex\n '\\x5e': '\\u00ee', // ^ -> 'i' circumflex\n\n '\\x60': '\\u00f4', // ` -> 'o' circumflex\n\n '\\x7b': '\\u00e9', // { -> 'e' acute\n '\\x7c': '\\u00f9', // | -> 'u' grave\n '\\x7d': '\\u00e8', // } -> 'e' grave\n '\\x7e': '\\u00fb', // ~ -> 'u' circumflex\n });\n\n/**\n * German character map.\n * http://vt100.net/docs/vt220-rm/table2-10.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['K'] = new hterm.VT.CharacterMap(\n 'german', {\n '\\x40': '\\u00a7', // @ -> section symbol (double s)\n\n '\\x5b': '\\u00c4', // [ -> 'A' umlaut\n '\\x5c': '\\u00d6', // \\ -> 'O' umlaut\n '\\x5d': '\\u00dc', // ] -> 'U' umlaut\n\n '\\x7b': '\\u00e4', // { -> 'a' umlaut\n '\\x7c': '\\u00f6', // | -> 'o' umlaut\n '\\x7d': '\\u00fc', // } -> 'u' umlaut\n '\\x7e': '\\u00df', // ~ -> eszett\n });\n\n/**\n * Italian character map.\n * http://vt100.net/docs/vt220-rm/table2-11.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['Y'] = new hterm.VT.CharacterMap(\n 'italian', {\n '\\x23': '\\u00a3', // # -> british-pound\n\n '\\x40': '\\u00a7', // @ -> section symbol (double s)\n\n '\\x5b': '\\u00b0', // [ -> ring\n '\\x5c': '\\u00e7', // \\ -> 'c' cedilla\n '\\x5d': '\\u00e9', // ] -> 'e' acute\n\n '\\x60': '\\u00f9', // ` -> 'u' grave\n\n '\\x7b': '\\u00e0', // { -> 'a' grave\n '\\x7c': '\\u00f2', // | -> 'o' grave\n '\\x7d': '\\u00e8', // } -> 'e' grave\n '\\x7e': '\\u00ec', // ~ -> 'i' grave\n });\n\n/**\n * Norwegian/Danish character map.\n * http://vt100.net/docs/vt220-rm/table2-12.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['E'] =\nhterm.VT.CharacterMaps.DefaultMaps['6'] = new hterm.VT.CharacterMap(\n 'norwegian/danish', {\n '\\x40': '\\u00c4', // @ -> 'A' umlaut\n\n '\\x5b': '\\u00c6', // [ -> 'AE' ligature\n '\\x5c': '\\u00d8', // \\ -> 'O' stroke\n '\\x5d': '\\u00c5', // ] -> 'A' ring\n '\\x5e': '\\u00dc', // ^ -> 'U' umlaut\n\n '\\x60': '\\u00e4', // ` -> 'a' umlaut\n\n '\\x7b': '\\u00e6', // { -> 'ae' ligature\n '\\x7c': '\\u00f8', // | -> 'o' stroke\n '\\x7d': '\\u00e5', // } -> 'a' ring\n '\\x7e': '\\u00fc', // ~ -> 'u' umlaut\n });\n\n/**\n * Spanish character map.\n * http://vt100.net/docs/vt220-rm/table2-13.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['Z'] = new hterm.VT.CharacterMap(\n 'spanish', {\n '\\x23': '\\u00a3', // # -> british-pound\n\n '\\x40': '\\u00a7', // @ -> section symbol (double s)\n\n '\\x5b': '\\u00a1', // [ -> '!' inverted\n '\\x5c': '\\u00d1', // \\ -> 'N' tilde\n '\\x5d': '\\u00bf', // ] -> '?' inverted\n\n '\\x7b': '\\u00b0', // { -> ring\n '\\x7c': '\\u00f1', // | -> 'n' tilde\n '\\x7d': '\\u00e7', // } -> 'c' cedilla\n });\n\n/**\n * Swedish character map.\n * http://vt100.net/docs/vt220-rm/table2-14.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['7'] =\nhterm.VT.CharacterMaps.DefaultMaps['H'] = new hterm.VT.CharacterMap(\n 'swedish', {\n '\\x40': '\\u00c9', // @ -> 'E' acute\n\n '\\x5b': '\\u00c4', // [ -> 'A' umlaut\n '\\x5c': '\\u00d6', // \\ -> 'O' umlaut\n '\\x5d': '\\u00c5', // ] -> 'A' ring\n '\\x5e': '\\u00dc', // ^ -> 'U' umlaut\n\n '\\x60': '\\u00e9', // ` -> 'e' acute\n\n '\\x7b': '\\u00e4', // { -> 'a' umlaut\n '\\x7c': '\\u00f6', // | -> 'o' umlaut\n '\\x7d': '\\u00e5', // } -> 'a' ring\n '\\x7e': '\\u00fc', // ~ -> 'u' umlaut\n });\n\n/**\n * Swiss character map.\n * http://vt100.net/docs/vt220-rm/table2-15.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['='] = new hterm.VT.CharacterMap(\n 'swiss', {\n '\\x23': '\\u00f9', // # -> 'u' grave\n\n '\\x40': '\\u00e0', // @ -> 'a' grave\n\n '\\x5b': '\\u00e9', // [ -> 'e' acute\n '\\x5c': '\\u00e7', // \\ -> 'c' cedilla\n '\\x5d': '\\u00ea', // ] -> 'e' circumflex\n '\\x5e': '\\u00ee', // ^ -> 'i' circumflex\n '\\x5f': '\\u00e8', // _ -> 'e' grave\n\n '\\x60': '\\u00f4', // ` -> 'o' circumflex\n\n '\\x7b': '\\u00e4', // { -> 'a' umlaut\n '\\x7c': '\\u00f6', // | -> 'o' umlaut\n '\\x7d': '\\u00fc', // } -> 'u' umlaut\n '\\x7e': '\\u00fb', // ~ -> 'u' circumflex\n });\nlib.resource.add('hterm/audio/bell', 'audio/ogg;base64',\n'T2dnUwACAAAAAAAAAADhqW5KAAAAAMFvEjYBHgF2b3JiaXMAAAAAAYC7AAAAAAAAAHcBAAAAAAC4' +\n'AU9nZ1MAAAAAAAAAAAAA4aluSgEAAAAAesI3EC3//////////////////8kDdm9yYmlzHQAAAFhp' +\n'cGguT3JnIGxpYlZvcmJpcyBJIDIwMDkwNzA5AAAAAAEFdm9yYmlzKUJDVgEACAAAADFMIMWA0JBV' +\n'AAAQAABgJCkOk2ZJKaWUoSh5mJRISSmllMUwiZiUicUYY4wxxhhjjDHGGGOMIDRkFQAABACAKAmO' +\n'o+ZJas45ZxgnjnKgOWlOOKcgB4pR4DkJwvUmY26mtKZrbs4pJQgNWQUAAAIAQEghhRRSSCGFFGKI' +\n'IYYYYoghhxxyyCGnnHIKKqigggoyyCCDTDLppJNOOumoo4466ii00EILLbTSSkwx1VZjrr0GXXxz' +\n'zjnnnHPOOeecc84JQkNWAQAgAAAEQgYZZBBCCCGFFFKIKaaYcgoyyIDQkFUAACAAgAAAAABHkRRJ' +\n'sRTLsRzN0SRP8ixREzXRM0VTVE1VVVVVdV1XdmXXdnXXdn1ZmIVbuH1ZuIVb2IVd94VhGIZhGIZh' +\n'GIZh+H3f933f930gNGQVACABAKAjOZbjKaIiGqLiOaIDhIasAgBkAAAEACAJkiIpkqNJpmZqrmmb' +\n'tmirtm3LsizLsgyEhqwCAAABAAQAAAAAAKBpmqZpmqZpmqZpmqZpmqZpmqZpmmZZlmVZlmVZlmVZ' +\n'lmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZQGjIKgBAAgBAx3Ecx3EkRVIkx3IsBwgNWQUAyAAA' +\n'CABAUizFcjRHczTHczzHczxHdETJlEzN9EwPCA1ZBQAAAgAIAAAAAABAMRzFcRzJ0SRPUi3TcjVX' +\n'cz3Xc03XdV1XVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVYHQkFUAAAQAACGdZpZq' +\n'gAgzkGEgNGQVAIAAAAAYoQhDDAgNWQUAAAQAAIih5CCa0JrzzTkOmuWgqRSb08GJVJsnuamYm3PO' +\n'OeecbM4Z45xzzinKmcWgmdCac85JDJqloJnQmnPOeRKbB62p0ppzzhnnnA7GGWGcc85p0poHqdlY' +\n'm3POWdCa5qi5FJtzzomUmye1uVSbc84555xzzjnnnHPOqV6czsE54Zxzzonam2u5CV2cc875ZJzu' +\n'zQnhnHPOOeecc84555xzzglCQ1YBAEAAAARh2BjGnYIgfY4GYhQhpiGTHnSPDpOgMcgppB6NjkZK' +\n'qYNQUhknpXSC0JBVAAAgAACEEFJIIYUUUkghhRRSSCGGGGKIIaeccgoqqKSSiirKKLPMMssss8wy' +\n'y6zDzjrrsMMQQwwxtNJKLDXVVmONteaec645SGultdZaK6WUUkoppSA0ZBUAAAIAQCBkkEEGGYUU' +\n'UkghhphyyimnoIIKCA1ZBQAAAgAIAAAA8CTPER3RER3RER3RER3RER3P8RxREiVREiXRMi1TMz1V' +\n'VFVXdm1Zl3Xbt4Vd2HXf133f141fF4ZlWZZlWZZlWZZlWZZlWZZlCUJDVgEAIAAAAEIIIYQUUkgh' +\n'hZRijDHHnINOQgmB0JBVAAAgAIAAAAAAR3EUx5EcyZEkS7IkTdIszfI0T/M00RNFUTRNUxVd0RV1' +\n'0xZlUzZd0zVl01Vl1XZl2bZlW7d9WbZ93/d93/d93/d93/d939d1IDRkFQAgAQCgIzmSIimSIjmO' +\n'40iSBISGrAIAZAAABACgKI7iOI4jSZIkWZImeZZniZqpmZ7pqaIKhIasAgAAAQAEAAAAAACgaIqn' +\n'mIqniIrniI4oiZZpiZqquaJsyq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7rukBo' +\n'yCoAQAIAQEdyJEdyJEVSJEVyJAcIDVkFAMgAAAgAwDEcQ1Ikx7IsTfM0T/M00RM90TM9VXRFFwgN' +\n'WQUAAAIACAAAAAAAwJAMS7EczdEkUVIt1VI11VItVVQ9VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' +\n'VVVVVVVVVVVV1TRN0zSB0JCVAAAZAAAjQQYZhBCKcpBCbj1YCDHmJAWhOQahxBiEpxAzDDkNInSQ' +\n'QSc9uJI5wwzz4FIoFURMg40lN44gDcKmXEnlOAhCQ1YEAFEAAIAxyDHEGHLOScmgRM4xCZ2UyDkn' +\n'pZPSSSktlhgzKSWmEmPjnKPSScmklBhLip2kEmOJrQAAgAAHAIAAC6HQkBUBQBQAAGIMUgophZRS' +\n'zinmkFLKMeUcUko5p5xTzjkIHYTKMQadgxAppRxTzinHHITMQeWcg9BBKAAAIMABACDAQig0ZEUA' +\n'ECcA4HAkz5M0SxQlSxNFzxRl1xNN15U0zTQ1UVRVyxNV1VRV2xZNVbYlTRNNTfRUVRNFVRVV05ZN' +\n'VbVtzzRl2VRV3RZV1bZl2xZ+V5Z13zNNWRZV1dZNVbV115Z9X9ZtXZg0zTQ1UVRVTRRV1VRV2zZV' +\n'17Y1UXRVUVVlWVRVWXZlWfdVV9Z9SxRV1VNN2RVVVbZV2fVtVZZ94XRVXVdl2fdVWRZ+W9eF4fZ9' +\n'4RhV1dZN19V1VZZ9YdZlYbd13yhpmmlqoqiqmiiqqqmqtm2qrq1bouiqoqrKsmeqrqzKsq+rrmzr' +\n'miiqrqiqsiyqqiyrsqz7qizrtqiquq3KsrCbrqvrtu8LwyzrunCqrq6rsuz7qizruq3rxnHrujB8' +\n'pinLpqvquqm6um7runHMtm0co6rqvirLwrDKsu/rui+0dSFRVXXdlF3jV2VZ921fd55b94WybTu/' +\n'rfvKceu60vg5z28cubZtHLNuG7+t+8bzKz9hOI6lZ5q2baqqrZuqq+uybivDrOtCUVV9XZVl3zdd' +\n'WRdu3zeOW9eNoqrquirLvrDKsjHcxm8cuzAcXds2jlvXnbKtC31jyPcJz2vbxnH7OuP2daOvDAnH' +\n'jwAAgAEHAIAAE8pAoSErAoA4AQAGIecUUxAqxSB0EFLqIKRUMQYhc05KxRyUUEpqIZTUKsYgVI5J' +\n'yJyTEkpoKZTSUgehpVBKa6GU1lJrsabUYu0gpBZKaS2U0lpqqcbUWowRYxAy56RkzkkJpbQWSmkt' +\n'c05K56CkDkJKpaQUS0otVsxJyaCj0kFIqaQSU0mptVBKa6WkFktKMbYUW24x1hxKaS2kEltJKcYU' +\n'U20txpojxiBkzknJnJMSSmktlNJa5ZiUDkJKmYOSSkqtlZJSzJyT0kFIqYOOSkkptpJKTKGU1kpK' +\n'sYVSWmwx1pxSbDWU0lpJKcaSSmwtxlpbTLV1EFoLpbQWSmmttVZraq3GUEprJaUYS0qxtRZrbjHm' +\n'GkppraQSW0mpxRZbji3GmlNrNabWam4x5hpbbT3WmnNKrdbUUo0txppjbb3VmnvvIKQWSmktlNJi' +\n'ai3G1mKtoZTWSiqxlZJabDHm2lqMOZTSYkmpxZJSjC3GmltsuaaWamwx5ppSi7Xm2nNsNfbUWqwt' +\n'xppTS7XWWnOPufVWAADAgAMAQIAJZaDQkJUAQBQAAEGIUs5JaRByzDkqCULMOSepckxCKSlVzEEI' +\n'JbXOOSkpxdY5CCWlFksqLcVWaykptRZrLQAAoMABACDABk2JxQEKDVkJAEQBACDGIMQYhAYZpRiD' +\n'0BikFGMQIqUYc05KpRRjzknJGHMOQioZY85BKCmEUEoqKYUQSkklpQIAAAocAAACbNCUWByg0JAV' +\n'AUAUAABgDGIMMYYgdFQyKhGETEonqYEQWgutddZSa6XFzFpqrbTYQAithdYySyXG1FpmrcSYWisA' +\n'AOzAAQDswEIoNGQlAJAHAEAYoxRjzjlnEGLMOegcNAgx5hyEDirGnIMOQggVY85BCCGEzDkIIYQQ' +\n'QuYchBBCCKGDEEIIpZTSQQghhFJK6SCEEEIppXQQQgihlFIKAAAqcAAACLBRZHOCkaBCQ1YCAHkA' +\n'AIAxSjkHoZRGKcYglJJSoxRjEEpJqXIMQikpxVY5B6GUlFrsIJTSWmw1dhBKaS3GWkNKrcVYa64h' +\n'pdZirDXX1FqMteaaa0otxlprzbkAANwFBwCwAxtFNicYCSo0ZCUAkAcAgCCkFGOMMYYUYoox55xD' +\n'CCnFmHPOKaYYc84555RijDnnnHOMMeecc845xphzzjnnHHPOOeecc44555xzzjnnnHPOOeecc845' +\n'55xzzgkAACpwAAAIsFFkc4KRoEJDVgIAqQAAABFWYowxxhgbCDHGGGOMMUYSYowxxhhjbDHGGGOM' +\n'McaYYowxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHG' +\n'GFtrrbXWWmuttdZaa6211lprrQBAvwoHAP8HG1ZHOCkaCyw0ZCUAEA4AABjDmHOOOQYdhIYp6KSE' +\n'DkIIoUNKOSglhFBKKSlzTkpKpaSUWkqZc1JSKiWlllLqIKTUWkottdZaByWl1lJqrbXWOgiltNRa' +\n'a6212EFIKaXWWostxlBKSq212GKMNYZSUmqtxdhirDGk0lJsLcYYY6yhlNZaazHGGGstKbXWYoy1' +\n'xlprSam11mKLNdZaCwDgbnAAgEiwcYaVpLPC0eBCQ1YCACEBAARCjDnnnHMQQgghUoox56CDEEII' +\n'IURKMeYcdBBCCCGEjDHnoIMQQgghhJAx5hx0EEIIIYQQOucchBBCCKGEUkrnHHQQQgghlFBC6SCE' +\n'EEIIoYRSSikdhBBCKKGEUkopJYQQQgmllFJKKaWEEEIIoYQSSimllBBCCKWUUkoppZQSQgghlFJK' +\n'KaWUUkIIoZRQSimllFJKCCGEUkoppZRSSgkhhFBKKaWUUkopIYQSSimllFJKKaUAAIADBwCAACPo' +\n'JKPKImw04cIDUGjISgCADAAAcdhq6ynWyCDFnISWS4SQchBiLhFSijlHsWVIGcUY1ZQxpRRTUmvo' +\n'nGKMUU+dY0oxw6yUVkookYLScqy1dswBAAAgCAAwECEzgUABFBjIAIADhAQpAKCwwNAxXAQE5BIy' +\n'CgwKx4Rz0mkDABCEyAyRiFgMEhOqgaJiOgBYXGDIB4AMjY20iwvoMsAFXdx1IIQgBCGIxQEUkICD' +\n'E2544g1PuMEJOkWlDgIAAAAA4AAAHgAAkg0gIiKaOY4Ojw+QEJERkhKTE5QAAAAAALABgA8AgCQF' +\n'iIiIZo6jw+MDJERkhKTE5AQlAAAAAAAAAAAACAgIAAAAAAAEAAAACAhPZ2dTAAQYOwAAAAAAAOGp' +\n'bkoCAAAAmc74DRgyNjM69TAzOTk74dnLubewsbagmZiNp4d0KbsExSY/I3XUTwJgkeZdn1HY4zoj' +\n'33/q9DFtv3Ui1/jmx7lCUtPt18/sYf9MkgAsAGRBd3gMGP4sU+qCPYBy9VrA3YqJosW3W2/ef1iO' +\n'/u3cg8ZG/57jU+pPmbGEJUgkfnaI39DbPqxddZphbMRmCc5rKlkUMkyx8iIoug5dJv1OYH9a59c+' +\n'3Gevqc7Z2XFdDjL/qHztRfjWEWxJ/aiGezjohu9HsCZdQBKbiH0VtU/3m85lDG2T/+xkZcYnX+E+' +\n'aqzv/xTgOoTFG+x7SNqQ4N+oAABSxuVXw77Jd5bmmTmuJakX7509HH0kGYKvARPpwfOSAPySPAc2' +\n'EkneDwB2HwAAJlQDYK5586N79GJCjx4+p6aDUd27XSvRyXLJkIC5YZ1jLv5lpOhZTz0s+DmnF1di' +\n'ptrnM6UDgIW11Xh8cHTd0/SmbgOAdxcyWwMAAGIrZ3fNSfZbzKiYrK4+tPqtnMVLOeWOG2kVvUY+' +\n'p2PJ/hkCl5aFRO4TLGYPZcIU3vYM1hohS4jHFlnyW/2T5J7kGsShXWT8N05V+3C/GPqJ1QdWisGP' +\n'xEzHqXISBPIinWDUt7IeJv/f5OtzBxpTzZZQ+CYEhHXfqG4aABQli72GJhN4oJv+hXcApAJSErAW' +\n'8G2raAX4NUcABnVt77CzZAB+LsHcVe+Q4h+QB1wh/ZrJTPxSBdI8mgTeAdTsQOoFUEng9BHcVPhx' +\n'SRRYkKWZJXOFYP6V4AEripJoEjXgA2wJRZHSExmJDm8F0A6gEXsg5a4ZsALItrMB7+fh7UKLvYWS' +\n'dtsDwFf1mzYzS1F82N1h2Oyt2e76B1QdS0SAsQigLPMOgJS9JRC7hFXA6kUsLFNKD5cA5cTRvgSq' +\n'Pc3Fl99xW3QTi/MHR8DEm6WnvaVQATwRqRKjywQ9BrrhugR2AKTsPQeQckrAOgDOhbTESyrXQ50C' +\n'kNpXdtWjW7W2/3UjeX3U95gIdalfRAoAmqUEiwp53hCdcCwlg47fcbfzlmQMAgaBkh7c+fcDgF+i' +\n'fwDXfzegLPcLYJsAAJQArTXjnh/uXGy3v1Hk3pV6/3t5ruW81f6prfbM2Q3WNVy98BwUtbCwhFhA' +\n'WuPev6Oe/4ZaFQUcgKrVs4defzh1TADA1DEh5b3VlDaECw5b+bPfkKos3tIAue3vJZOih3ga3l6O' +\n'3PSfIkrLv0PAS86PPdL7g8oc2KteNFKKzKRehOv2gJoFLBPXmaXvPBQILgJon0bbWBszrYZYYwE7' +\n'jl2j+vTdU7Vpk21LiU0QajPkywAAHqbUC0/YsYOdb4e6BOp7E0cCi04Ao/TgD8ZVAMid6h/A8IeB' +\n'Nkp6/xsAACZELEYIk+yvI6Qz1NN6lIftB/6IMWjWJNOqPTMedAmyaj6Es0QBklJpiSWWHnQ2CoYb' +\n'GWAmt+0gLQBFKCBnp2QUUQZ/1thtZDBJUpFWY82z34ocorB62oX7qB5y0oPAv/foxH25wVmgIHf2' +\n'xFOr8leZcBq1Kx3ZvCq9Bga639AxuHuPNL/71YCF4EywJpqHFAX6XF0sjVbuANnvvdLcrufYwOM/' +\n'iDa6iA468AYAAB6mNBMXcgTD8HSRqJ4vw8CjAlCEPACASlX/APwPOJKl9xQAAAPmnev2eWp33Xgy' +\n'w3Dvfz6myGk3oyP8YTKsCOvzAgALQi0o1c6Nzs2O2Pg2h4ACIJAgAGP0aNn5x0BDgVfH7u2TtyfD' +\n'cRIuYAyQhBF/lvSRAttgA6TPbWZA9gaUrZWAUEAA+Dx47Q3/r87HxUUqZmB0BmUuMlojFjHt1gDu' +\n'nnvuX8MImsjSq5WkzSzGS62OEIlOufWWezxWpv6FBgDgJVltfXFYtNAAnqU0xQoD0YLiXo5cF5QV' +\n'4CnY1tBLAkZCOABAhbk/AM+/AwSCCdlWAAAMcFjS7owb8GVDzveDiZvznbt2tF4bL5odN1YKl88T' +\n'AEABCZvufq9YCTBtMwVAQUEAwGtNltzSaHvADYC3TxLVjqiRA+OZAMhzcqEgRcAOwoCgvdTxsTHL' +\n'QEF6+oOb2+PAI8ciPQcXg7pOY+LjxQSv2fjmFuj34gGwz310/bGK6z3xgT887eomWULEaDd04wHe' +\n'tYxdjcgV2SxvSwn0VoZXJRqkRC5ASQ/muVoAUsX7AgAQMBNaVwAAlABRxT/1PmfqLqSRNDbhXb07' +\n'berpB3b94jpuWEZjBCD2OcdXFpCKEgCDfcFPMw8AAADUwT4lnUm50lmwrpMMhPQIKj6u0E8fr2vG' +\n'BngMNdIlrZsigjahljud6AFVg+tzXwUnXL3TJLpajaWKA4VAAAAMiFfqJgKAZ08XrtS3dxtQNYcp' +\n'PvYEG8ClvrQRJgBephwnNWJjtGqmp6VEPSvBe7EBiU3qgJbQAwD4Le8LAMDMhHbNAAAlgK+tFs5O' +\n'+YyJc9yCnJa3rxLPulGnxwsXV9Fsk2k4PisCAHC8FkwbGE9gJQAAoMnyksj0CdFMZLLgoz8M+Fxz' +\n'iwYBgIx+zHiCBAKAlBKNpF1sO9JpVcyEi9ar15YlHgrut5fPJnkdJ6vEwZPyAHQBIEDUrlMcBAAd' +\n'2KAS0Qq+JwRsE4AJZtMnAD6GnOYwYlOIZvtzUNdjreB7fiMkWI0CmBB6AIAKc38A9osEFlTSGECB' +\n'+cbeRDC0aRpLHqNPplcK/76Lxn2rpmqyXsYJWRi/FQAAAKBQk9MCAOibrQBQADCDsqpooPutd+05' +\n'Ce9g6iEdiYXgVmQAI4+4wskEBEiBloNQ6Ki0/KTQ0QjWfjxzi+AeuXKoMjEVfQOZzr0y941qLgM2' +\n'AExvbZOqcxZ6J6krlrj4y2j9AdgKDx6GnJsVLhbc42uq584+ouSdNBpoCiCVHrz+WzUA/DDtD8AT' +\n'gA3h0lMCAAzcFv+S+fSSNkeYWlTpb34mf2RfmqqJeMeklhHAfu7VoAEACgAApKRktL+KkQDWMwYC' +\n'UAAAAHCKsp80xhp91UjqQBw3x45cetqkjQEyu3G9B6N+R650Uq8OVig7wOm6Wun0ea4lKDPoabJs' +\n'6aLqgbhPzpv4KR4iODilw88ZpY7q1IOMcbASAOAVtmcCnobcrkG4KGS7/ZnskVWRNF9J0RUHKOnB' +\n'yy9WA8Dv6L4AAARMCQUA4GritfVM2lcZfH3Q3T/vZ47J2YHhcmBazjfdyuV25gLAzrc0cwAAAAAY' +\n'Ch6PdwAAAGyWjFW4yScjaWa2mGcofHxWxewKALglWBpLUvwwk+UOh5eNGyUOs1/EF+pZr+ud5Ozo' +\n'GwYdAABg2p52LiSgAY/ZVlOmilEgHn6G3OcwYjzI7vOj1t6xsx4S3lBY96EUQBF6AIBAmPYH4PoG' +\n'YCoJAADWe+OZJZi7/x76/yH7Lzf9M5XzRKnFPmveMsilQHwVAAAAAKB3LQD8PCIAAADga0QujBLy' +\n'wzeJ4a6Z/ERVBAUlAEDqvoM7BQBAuAguzFqILtmjH3Kd4wfKobnOhA3z85qWoRPm9hwoOHoDAAlC' +\n'bwDAA56FHAuXflHo3fe2ttG9XUDeA9YmYCBQ0oPr/1QC8IvuCwAAApbUAQCK22MmE3O78VAbHQT9' +\n'PIPNoT9zNc3l2Oe7TAVLANBufT8MAQAAAGzT4PS8AQAAoELGHb2uaCwwEv1EWhFriUkbAaAZ27/f' +\n'VZnTZXbWz3BwWpjUaMZKRj7dZ0J//gUeTdpVEwAAZOFsNxKAjQSgA+ABPoY8Jj5y2wje81jsXc/1' +\n'TOQWTDYZBmAkNDiqVwuA2NJ9AQAAEBKAt9Vrsfs/2N19MO91S9rd8EHTZHnzC5MYmfQEACy/FBcA' +\n'AADA5c4gi4z8RANs/m6FNXVo9DV46JG1BBDukqlw/Va5G7QbuGVSI+2aZaoLXJrdVj2zlC9Z5QEA' +\n'EFz/5QzgVZwAAAAA/oXcxyC6WfTu+09Ve/c766J4VTAGUFmA51+VANKi/QPoPwYgYAkA715OH4S0' +\n's5KDHvj99MMq8TPFc3roKZnGOoT1bmIhVgc7XAMBAAAAAMAW1VbQw3gapzOpJd+Kd2fc4iSO62fJ' +\n'v9+movui1wUNPAj059N3OVxzk4gV73PmE8FIA2F5mRq37Evc76vLXfF4rD5UJJAw46hW6LZCb5sN' +\n'Ldx+kzMCAAB+hfy95+965ZCLP7B3/VlTHCvDEKtQhTm4KiCgAEAbrfbWTPssAAAAXpee1tVrozYY' +\n'n41wD1aeYtkKfswN5/SXPO0JDnhO/4laUortv/s412fybe/nONdncoCHnBVliu0CQGBWlPY/5Kwo' +\n'm2L/kruPM6Q7oz4tvDQy+bZ3HzOi+gNHA4DZEgA=' +\n''\n);\n\nlib.resource.add('hterm/images/icon-96', 'image/png;base64',\n'iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdC' +\n'AK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dE' +\n'AP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAFKhJREFUeNrtXXlsXMd5/30z8649uDzE' +\n'mxRFibIsOXZ8VInTJFYSW3actE1ctWkctEF6I0VRFEWAoihQoAjQFmiBogWaIEADFCmQXklto04T' +\n'O0ndWI4bxZalWHJinTYtkRJFkctzl9zd977+8c49+UjuipbCD1y+9+ae75vvmJlv3gO2YRu2YRu2' +\n'YRu2YUuAtroBN3nfeKsaSXWurarvRvUrTnlccV/5a3lDReRKFdc4Za6nzvW2b7OIpwZh7N37iHYi' +\n'Pztyvy4iqA00Tng/WXH1f3GQsFki0Qbz+cAV12jeRkTwwUd2yfsVI89OjbLrwnoJILw8EoAOIAFg' +\n'LwDTCxcAJBEJIiIAgoiICAIgIgIBJGpdPRCRq3sPCBAJAii8QgAk/PIFkSBBQvh3QRkQXtECBKpx' +\n'H9br5hMikhcg4QV4dYkgARFBSkmlUmnp7LmLX8rl8q95OPKJ0DQCkPeTEcQrAD179+7+7LsP3vtJ' +\n'w9A1ZvbwFfQM/r1/AyD64KLBv5JHIaIwIpI5GIbevd82r0I3OMjvJfOo5ffCqw1EhIRlQQi3a37p' +\n'0atfTVB22PhIuHt95tnnBr75zHN/AGASoYjyxVVTCOCPfOWN9sGfue+df/L4r3z8MSGUOv3aWYDI' +\n'q43BEXXEQRPCQK5qFleFMdduOwMV3WKUBXFVyVXhtm3jrjtvw13vuL1uPXGAAUghkGlLPXJ9ZvZz' +\n'L738oz8HsOhFF2u3aH0E8JEvAWhe+n2PHD70Z7/xmccfLBSK9M1nX0AqnYFSKiB7fIiOzg3k21Be' +\n'YHW1gMkr1/DBB+6HkGLTxmRfbxf9+qc/8WszM9lzF99468twxZCAq5wbQiMCREWPBkDXde3eI489' +\n'+he/+1u/et/c3AK+/uSzyLTvgK7rm+tBE4CZA1HRaFT7oqNQKCCdsqBp61GD9eHBD77XunJ16o/+' +\n'6q+/cLJYLP2fhzfGGkRYiwBRK2fnL/3iRz7/uT/8nfuuz2Txla8+hXRbJ6QUKBaLuJmgVLJRKuSh' +\n'lIBpatiEFApACIFHH/lA//NHj33qe0ePvQJXEa/JnHEIoABYd925/zOPf+JjBxMJC//yxX+GYaZg' +\n'GAZse00ue1uByyWMQrGEldVVKCWbQgAA6OnegQP7997zvaPH2gGsIpQidWuoRwA/o2/bDz70off+' +\n'nFIa/fczz2Pq2hzSbRksLCxsNT43BI7jYCW/ihd/cBKWZTZhQcFV9qMjQ0gmEwm4hkqsOVEjDogq' +\n'37bOjvaElBKLizmYVgKWZW01HjeOLGaAbUipoJTWHAKwa4KYpmHCJUB0lQCoU0scK0gCMJRSqqOj' +\n'Hel0EqZpIpFIbDUeNwwOM2y7gO4dnWhrSzVFBDEzMpkULNM04BIgFsS1ggxNUzKVSiCRsEBEUEoF' +\n'iRq2v5HNXjMd18pSHVeZnuuniZaopIIQBAIhnUqgvb1tU3OBKFiWCdMydABWBH+bIoCvA3RNU9Ky' +\n'DOiahG2XAAAzszO4NHkZINcKALuddRHi3VWFReLcWy8dhxO5aFpvkhamD5HFwQQuStgwLPpsOza4' +\n'5GD/yD4MDw2jVCrCMHSkUwmws3kCMADD0GCZpialMG3bia4trVsJ+xkJAKSUStM0oWsSQrgTGdu2' +\n'MXllEmezF/HRhz+C4b6hyEgrnyjVLLzhcho1iFsDiGomOzt+Ds/8z7PIzmfR39eP1dVVSOEijR0n' +\n'RsFrg1ISpmkoQ9cTufxKrBbHmoUoJZWmlPDXRZgdMDNsx8HuXbtx3zvvhRQKTdFmLQACoT2dwY9e' +\n'fRWlvA1m1xJy2IEggkPrnUvXB9M0lGkaiVx+xR/ADQuPRQAppaY0JfzOBB0joFAs4Oyb59E0Y7pF' +\n'4DDDdmw47LgygQHbbs7Ij4JpGMIwjGRFcF0xFJcDdE0pUb3YQ1hYWsDFSxff7vgHMyO3kkMGiaAP' +\n'zScAwzB0YVlmAuHo3zQHkKaUppTHAUQBLQnAYm4J41feCldAGeHe2FaCq9fdXQMP8qt5sB6OlGbP' +\n'4pkBwzBgGHoKMdcIG82Ew0RK6UqTxHAJEHSBCLmVHCavXwUcwGpXMJIS2YnVhrq01cAOQxkC7YMG' +\n'5i6vwi65LV4trIK10GJyHLvpTTR0DZZlJtEEMxR+IVJJTSlFAFdZL47joFgswrEZ3X06Dv3eAH78' +\n'7Vm8/t0s8nMld9PjBhHCN1G7dlm490g3rIzCt/5yHIWiA5dxGQ5HOcBpatuYGZquwTSNTXMAogVo' +\n'SukuAXwlzFUpSRCyl1cx+VoOBz/Zi93vyeDE16bx1iuLsIsOSLSWCuwwEh0a9h/uxDs+2gWnxDj+' +\n'79dQKjhlg4bZl/vkiaDmtkvXNFimmURMJ4VYOkBpSldSug91TDYiIDdXwtEvTeDNlxZw3y/34PDn' +\n'duLCi/M4+eQ0Zt5cCdI1G/FKFxg5mME9R7rRMWTi/AtzOPnENLKXV2tyrA+lFqzkKk3BNI0k3BWE' +\n'5swDXA7wlm0bFEkEODbjzWPzmDqTw4HDnbjz57swdHcKp56+jte/k0VurtRUInSPJXD3Y90YfXcb' +\n'Zt7I49t/M45LJ5ZgF7lMAbsN9BfiXE5uthXEzFBK+TpAhrVunAAEeEp4DQ4oyyQI+fkSjn/tGsZf' +\n'WcA9j3Xjvk/0Yte72vD8FyZw/Y2VauRsAA483ImDn+oF28DL/zqFn3wni/xcESSoTvkExxdBBNil' +\n'FnCAlLBMM+Hhdk3HtThoIE1TulTuDlscAgAuNxCA6XN5HP+Pa8heWsHAgSQyA0ZzFr8IGHhHCuke' +\n'HedfmMOpb8wgly021jXkTsjYm9C0YjNJSgFvHuAP7qbMA3TpcwAo1ooDOwwjKTH2QDvu/lg3lCnw' +\n'g69cxcSpJc8dZJPgACeeuAYhgf0Pd6JjyMArX5/GlZ8sg23U5TCf+ESt0QFCCFiWYcF131kT4lhB' +\n'pDSXAMy+Eq1PAXYAIYHBu9O490g3evclMf7yAk785zSuX8i7Y68ZOoCA6xdW8N2/u4TRd2dw75Fu' +\n'PPqnu3Dmu7N49RszWLiyGvgGRfM47HjNdzmg6U6kRLAs02wGAXwieBwgggoaMUD7oI67fmEHbjvU' +\n'gfmrBTz395fw5ksLKK26pmgzO0wCsFcZ576XxeTpZdzxaCfu+HAXRg624eST0zh/dB6FXDjK3TUg' +\n'VwQREUot0AFCEEx3U8ZoBgEAVwdoUnheFnWGLztA1y4Tj/zxCIyUwI+emsaPn5nF8qyvFFs0D/C8' +\n'05Zni3jpq1MY/+EC7jnSg/f+5gB69yXw/BcnYBfDIeMrYaLW6ACAYFmmjpi7YqpmCRWMq2maLgIO' +\n'qFcUQ7MErp5ZxqmnZ0Jx0+IJWNBIr5qpszl852/fwp73ZNC3PwmhKCQAUWCGAu5MuNlriEQEy6za' +\n'FauLhHg6QClNejte9YQICcL1i3k8/4UJd/bZZHETGwGCYK8yzjw3h4vHFmAXym19dxfNE0Etcqkx' +\n'TVPTdd0qFApRPNaEtcxQAiA0TelCeKvRDTSoXWTYJb5ho75Rq0kApbwDrphrOREd0Ip5AOBuyhiG' +\n'HsttpB4BohiUmqZpgel4Mx1qournYCbcUg4wpLccUasVZVCLAJUZhKaUTp5hvTWCpXnAcEIOsG00' +\n'fxuVYRq6MA3dX5JuCGt5xhEAqWkq4IC4M+GYbV0/bLJ6h92dmlaJIG9ThkyzbE9gQ0rYB6lpSgUc' +\n'0CT8C0nQzPUvCDk2o7iysUU0gmsFcSCCnJZspeq6BtPUk3HSxrGChKZpmu/U2gwKsMPo2Z/E+397' +\n'AELFL48EMHFqGd//x0k49gYwR+VWUGvmAQxD12GZZgox1tpiuSa6HOCJIJ8umxo5hELOxvSFPEiu' +\n'IxcR5idXNzVqqwnQXBZghr8r5m/KbHgxzs+oNE1T/sBvhggiAcyOr+B//+FyUzsfD0ERM7RFIkjT' +\n'gj2BNTmgnhUUXcd2N4SpBUp4C6DVHABmaEr5+8L+rtiGlTADUK4I8kJ8XeDDes/KAw37zPUSrYUn' +\n'5tpJOJqE4ThOSACn+RzAAKSU/p7AmgI2phWkyeB4ZqQiAsFZtkFOZI+Ao7SgytVgeJoQVBkf+HRG' +\n'rxVhVBFGqHj24imSP3psFUAylYCSEsWSDdu2y86WNQukuytmIdwVq3tSJo5zrtI0JUMjiAJzbrB/' +\n'AA8YRnCWNnLON3JuFyEiIj8AZen9Vc0wL0JkRtMgGlfjDHBwDSLKzwp7dRZL+aYivZwAApZlWnAP' +\n't0TxuSYBKocCA1BKUxIgMBy0taUAOCiVikilUkin0/FbFnEz3xxQLGMg6rpemX9paQm37x2DlLLM' +\n'U6IZIITwOUCraEAVERotR4ccoDQJAI7DGBrsx8MP3o+nv/V9dHf3BAc1IjguO00d+OpHffYrw5ir' +\n'09WMi5wd4PC8QLDHXHGmIHr1G8dgsOOgoyOJB973LjR/KSLYFYtuymxYCZOUUtM8z2i/w48cPgTT' +\n'MPDD46eQX1mG768Smqq+qAFEROwIQSASZVdBAiQIQggI8q7+c/AjSCEgZBgm/TgZ3stovKy4Rsqz' +\n'LBMjOweRSiXhNOFwRi0CmJbhE2BTm/KspNQ0pcrMVaUkDj/0fnzg0P0olkqhs+4a71xoeA0LKCur' +\n'Irhmf2rJzca9cl0Um3U0qZoAqNwV25AS9pEdnA2IguM4kFLC95bYLPiiJYIjtEI83BggWKapCSEs' +\n'x3E2txinlPJOx9z8k7AbBUTBSRkrl8tv+GUdDIClksphFsvL+ZacKLn1gL3V0DICrOuQXvSohUNE' +\n'2rnz41QqcdPNtVsRGEBbOgnbdkjTVKUZWgWqRn4fHABOoVBcNE2ztHPnoL7NAfHANHS8dPzE0sxM' +\n'dsILqvsGrXocEGRYXFx67fUz5y729e7Yw4ADjumb2AJoWq2xCtrwdh0TQRz74YmLpZI9HitHjTCC' +\n'a0KZANKGoX88lUo+pCmlhBASYMmAjE76Ea4CoNyerDYuUZHRXwiq2Pan8r/yNkcMAiqvv+pwFFWm' +\n'pQqbl6isaqoVVtajsJfB0piXwCEidhyHp6/PHpudnfs8gDm4b07xX+xXBnEW43jv2Ojo73/20x+e' +\n'zc47Fy6MN/IOXZ+ZxBvIE6eeCovbn0FXzjXqt4urEsVlGsPQ8NFHP0RP/dez4sv/9G8ZuK8wq2uK' +\n'xtkRs+44cNs7e3t61NEXXwVIVUye1o+f+nnXsT1ZlrwiH9dKjLp+TZVhoRNy/Jb5PrPjlyfAzDiw' +\n'f28vgD4AV+AuS5dq5au3FuS/I0IB6B3bM7L7wsW3IJSBjvb2ls0gb3YgIiym0hi/NImB/p5Mpi09' +\n'Or+weBqu+CliHYtx/ruCpGWZu3cOD/Sceu08ioUiFhcX12rHTy0QEXTdwKVLV7B/326tt3fHnvmF' +\n'RQMu8v03aAERIjTyC5IAtJGdg/s7OjLmbHYBXV29TVt6uFVB13VMXZtFwrIwMNA3dvbcGxaAFYQb' +\n'9LE5QAFI7Nk9cgdAyOeL2CFlS8XPrbDUoZTC4lIexVIJw0P9IwDScBVxzVOT9QggvbiuvWOjY9ns' +\n'PBxmLC0tbc+G1wApJWyHMTObxcjwYB+ALgBTCN8+WTYpa0QAQUTDu0eH+ycmp5BOtyGVSm0r4Big' +\n'6wYmJqYwNNTfIaXss237DEIRVMYFUQIEnnDwOGBwoG9ff19P+tXT52BZiVtCRLS6D8wM0zRx6fJV' +\n'/Oz991jdOzp3Xp2a9iVKlTlayQFR89PYPTp8wLJMys4tItNuYH5+fqvx97YHIQQ0XcfUtRmkUgnq' +\n'7+8duTo1raGOj1AlB0TnAOm9Y6O35XJ5MAskk8lt8bMOmMzOwHEYw0P9IydOnjYR6oC6BADK5wD9' +\n'e8d2DV65Og3dMKGUuuUUcCvFkcPA/PwCRnYODAJoA3AdNRy1anGABCA7O9vHRnYOdrx84sdgBubm' +\n'5rY5ICa4m/8Sk1enMTQ00A2gG8BbKOcCBmpzgASgj44M7+/oaJfXpmfR3t5xy07AWsUFhUIRlyem' +\n'cOcde9OpVHJgaWn5FawhgqLfhkmOje26nZmRyxXQtePmfU3xVoFpmbg2PYtMW1rr6+3eeX5pOaqE' +\n'gyWJShHkJ9px297RXddnsiiWbCwuLv5UiJ9aX/bYSBlE7nV5OYe2dAqDA727zl94s5IAZSIoKv9F' +\n'ImHt2rN7pDs7N4/l5WVIOesRwH8Tbs2qgwvXi6uKr9PB+u8ujomSeKlonZG0RmRl6AcPHcTAQC8G' +\n'B/uGEb5RPToh46j3bhCxc3hg39Bgn9nbswPpVBK53ErZR2tqOV358eVx4X2wzRRx2K103q12yEXo' +\n'5Bvcry99I4ewuI5kYdsj6SIOxV5omXOwphS6ujoghMDw0EAvXEvoSgTfAKrfaUMA9F0jQ7d3d3ch' +\n'k0njoQ+9b83NiK0VTnHendOqdnLdIIY7K3YJ0N8ppeixbecMYixFpHaNDI+mU0n3pdl8a9n+NxJ8' +\n'7ujv7030dO8YvHL1mr8zWsYBlZrZymTSKaUlQNLAVo/vmxsIxCV0tLeJzs72bo8AboSH71qroStL' +\n'S8u567PzyK86G9ox32yjW1lU6/sTrYFhmQqWZSGdSmZqpVZlqV3IzcxkZ6evTWFpebWmT2+tj6MF' +\n'76OtdbSL61gyzDXTlZ0hKE9Q9rEGrrK8uELec1Vc+bcJIvfRwyM1wpiry2sU5opvRqYtCcuUKBSK' +\n'JYQf/QzcFX0CRN0Rc8dPnD5qJZ7okVKCHYd8V27/RRcM9gAAewc/2bsLH+GnCf+Xp/PmFsFtEBum' +\n'Lqss8oTIX9lzUFCQJ9rAijRV92VtjTxHyquqpKzLjn+Fu+xsKyULzLzyxhuXnkSNL66WnYRB+KnC' +\n'DNydHP/dZzpCU7WWUuAGzxwjvlYZ9cLWm4cbxMUpD2vkqQzzkVwEUIC7Gb/iXQvez3fSYlWR0YZL' +\n'uUUvkYHw453+JGK9EKdTrdT0Db2TW9CO6DeGSyhHetWXVqOfvXAq7m0vY9xvBW+28RvJ3ygP4ca3' +\n'KcpJUU7wER/VAQBqK2H/DRZ+hspDe81EYKsQsZV1Vg7oKNKjyGegsXNuFOE302Ywr/G8Fe2pq4fq' +\n'IfZmQvjbHbZ6AGzDNmzDNmzD2xT+H+5UT7Tyxc2HAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE2LTA2' +\n'LTMwVDExOjUwOjAyLTA0OjAwOaSkCgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMy0xMS0wMVQxMDoz' +\n'ODoyNC0wNDowMNba8BsAAAAASUVORK5CYII=' +\n''\n);\n\nlib.resource.add('hterm/concat/date', 'text/plain',\n'Tue, 22 Aug 2017 06:42:31 +0000' +\n''\n);\n\nlib.resource.add('hterm/changelog/version', 'text/plain',\n'1.70' +\n''\n);\n\nlib.resource.add('hterm/changelog/date', 'text/plain',\n'2017-08-16' +\n''\n);\n\nlib.resource.add('hterm/git/HEAD', 'text/plain',\n'git rev-parse HEAD' +\n''\n);\n\n// SOURCE FILE: hterm/js/hterm_export.js\nmodule.exports = {\n hterm: hterm,\n lib: lib\n};\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/libapps/hterm/dist/js/hterm_module.js\n// module id = 14\n// module chunks = 0","import { TermHterm } from \"./hterm\";\nimport { TermXterm } from \"./xterm\";\nimport { Terminal, WebTTY, protocols } from \"./webtty\";\nimport { ConnectionFactory } from \"./websocket\";\n\n// @TODO remove these\ndeclare var gotty_auth_token: string;\ndeclare var gotty_term: string;\n\nconst elem = document.getElementById(\"terminal\")\n\nif (elem !== null) {\n var term: Terminal;\n if (gotty_term == \"hterm\") {\n term = new TermHterm(elem);\n } else {\n term = new TermXterm(elem);\n }\n const httpsEnabled = window.location.protocol == \"https:\";\n const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';\n const args = window.location.search;\n const factory = new ConnectionFactory(url, protocols);\n const wt = new WebTTY(term, factory, args, gotty_auth_token);\n const closer = wt.open();\n\n window.addEventListener(\"unload\", () => {\n closer();\n term.close();\n });\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.ts","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar CompositionHelper = (function () {\n function CompositionHelper(textarea, compositionView, terminal) {\n this.textarea = textarea;\n this.compositionView = compositionView;\n this.terminal = terminal;\n this.isComposing = false;\n this.isSendingComposition = false;\n this.compositionPosition = { start: null, end: null };\n }\n CompositionHelper.prototype.compositionstart = function () {\n this.isComposing = true;\n this.compositionPosition.start = this.textarea.value.length;\n this.compositionView.textContent = '';\n this.compositionView.classList.add('active');\n };\n CompositionHelper.prototype.compositionupdate = function (ev) {\n var _this = this;\n this.compositionView.textContent = ev.data;\n this.updateCompositionElements();\n setTimeout(function () {\n _this.compositionPosition.end = _this.textarea.value.length;\n }, 0);\n };\n CompositionHelper.prototype.compositionend = function () {\n this.finalizeComposition(true);\n };\n CompositionHelper.prototype.keydown = function (ev) {\n if (this.isComposing || this.isSendingComposition) {\n if (ev.keyCode === 229) {\n return false;\n }\n else if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {\n return false;\n }\n else {\n this.finalizeComposition(false);\n }\n }\n if (ev.keyCode === 229) {\n this.handleAnyTextareaChanges();\n return false;\n }\n return true;\n };\n CompositionHelper.prototype.finalizeComposition = function (waitForPropogation) {\n var _this = this;\n this.compositionView.classList.remove('active');\n this.isComposing = false;\n this.clearTextareaPosition();\n if (!waitForPropogation) {\n this.isSendingComposition = false;\n var input = this.textarea.value.substring(this.compositionPosition.start, this.compositionPosition.end);\n this.terminal.handler(input);\n }\n else {\n var currentCompositionPosition_1 = {\n start: this.compositionPosition.start,\n end: this.compositionPosition.end,\n };\n this.isSendingComposition = true;\n setTimeout(function () {\n if (_this.isSendingComposition) {\n _this.isSendingComposition = false;\n var input = void 0;\n if (_this.isComposing) {\n input = _this.textarea.value.substring(currentCompositionPosition_1.start, currentCompositionPosition_1.end);\n }\n else {\n input = _this.textarea.value.substring(currentCompositionPosition_1.start);\n }\n _this.terminal.handler(input);\n }\n }, 0);\n }\n };\n CompositionHelper.prototype.handleAnyTextareaChanges = function () {\n var _this = this;\n var oldValue = this.textarea.value;\n setTimeout(function () {\n if (!_this.isComposing) {\n var newValue = _this.textarea.value;\n var diff = newValue.replace(oldValue, '');\n if (diff.length > 0) {\n _this.terminal.handler(diff);\n }\n }\n }, 0);\n };\n CompositionHelper.prototype.updateCompositionElements = function (dontRecurse) {\n var _this = this;\n if (!this.isComposing) {\n return;\n }\n var cursor = this.terminal.element.querySelector('.terminal-cursor');\n if (cursor) {\n var xtermRows = this.terminal.element.querySelector('.xterm-rows');\n var cursorTop = xtermRows.offsetTop + cursor.offsetTop;\n this.compositionView.style.left = cursor.offsetLeft + 'px';\n this.compositionView.style.top = cursorTop + 'px';\n this.compositionView.style.height = cursor.offsetHeight + 'px';\n this.compositionView.style.lineHeight = cursor.offsetHeight + 'px';\n var compositionViewBounds = this.compositionView.getBoundingClientRect();\n this.textarea.style.left = cursor.offsetLeft + 'px';\n this.textarea.style.top = cursorTop + 'px';\n this.textarea.style.width = compositionViewBounds.width + 'px';\n this.textarea.style.height = compositionViewBounds.height + 'px';\n this.textarea.style.lineHeight = compositionViewBounds.height + 'px';\n }\n if (!dontRecurse) {\n setTimeout(function () { return _this.updateCompositionElements(true); }, 0);\n }\n };\n ;\n CompositionHelper.prototype.clearTextareaPosition = function () {\n this.textarea.style.left = '';\n this.textarea.style.top = '';\n };\n ;\n return CompositionHelper;\n}());\nexports.CompositionHelper = CompositionHelper;\n\n//# sourceMappingURL=CompositionHelper.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/CompositionHelper.js\n// module id = 16\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EscapeSequences_1 = require(\"./EscapeSequences\");\nvar Charsets_1 = require(\"./Charsets\");\nvar InputHandler = (function () {\n function InputHandler(_terminal) {\n this._terminal = _terminal;\n }\n InputHandler.prototype.addChar = function (char, code) {\n if (char >= ' ') {\n var ch_width = wcwidth(code);\n if (this._terminal.charset && this._terminal.charset[char]) {\n char = this._terminal.charset[char];\n }\n var row = this._terminal.y + this._terminal.ybase;\n if (!ch_width && this._terminal.x) {\n if (this._terminal.lines.get(row)[this._terminal.x - 1]) {\n if (!this._terminal.lines.get(row)[this._terminal.x - 1][2]) {\n if (this._terminal.lines.get(row)[this._terminal.x - 2])\n this._terminal.lines.get(row)[this._terminal.x - 2][1] += char;\n }\n else {\n this._terminal.lines.get(row)[this._terminal.x - 1][1] += char;\n }\n this._terminal.updateRange(this._terminal.y);\n }\n return;\n }\n if (this._terminal.x + ch_width - 1 >= this._terminal.cols) {\n if (this._terminal.wraparoundMode) {\n this._terminal.x = 0;\n this._terminal.y++;\n if (this._terminal.y > this._terminal.scrollBottom) {\n this._terminal.y--;\n this._terminal.scroll(true);\n }\n else {\n this._terminal.lines.get(this._terminal.y).isWrapped = true;\n }\n }\n else {\n if (ch_width === 2)\n return;\n }\n }\n row = this._terminal.y + this._terminal.ybase;\n if (this._terminal.insertMode) {\n for (var moves = 0; moves < ch_width; ++moves) {\n var removed = this._terminal.lines.get(this._terminal.y + this._terminal.ybase).pop();\n if (removed[2] === 0\n && this._terminal.lines.get(row)[this._terminal.cols - 2]\n && this._terminal.lines.get(row)[this._terminal.cols - 2][2] === 2) {\n this._terminal.lines.get(row)[this._terminal.cols - 2] = [this._terminal.curAttr, ' ', 1];\n }\n this._terminal.lines.get(row).splice(this._terminal.x, 0, [this._terminal.curAttr, ' ', 1]);\n }\n }\n this._terminal.lines.get(row)[this._terminal.x] = [this._terminal.curAttr, char, ch_width];\n this._terminal.x++;\n this._terminal.updateRange(this._terminal.y);\n if (ch_width === 2) {\n this._terminal.lines.get(row)[this._terminal.x] = [this._terminal.curAttr, '', 0];\n this._terminal.x++;\n }\n }\n };\n InputHandler.prototype.bell = function () {\n var _this = this;\n if (!this._terminal.visualBell) {\n return;\n }\n this._terminal.element.style.borderColor = 'white';\n setTimeout(function () { return _this._terminal.element.style.borderColor = ''; }, 10);\n if (this._terminal.popOnBell) {\n this._terminal.focus();\n }\n };\n InputHandler.prototype.lineFeed = function () {\n if (this._terminal.convertEol) {\n this._terminal.x = 0;\n }\n this._terminal.y++;\n if (this._terminal.y > this._terminal.scrollBottom) {\n this._terminal.y--;\n this._terminal.scroll();\n }\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x--;\n }\n };\n InputHandler.prototype.carriageReturn = function () {\n this._terminal.x = 0;\n };\n InputHandler.prototype.backspace = function () {\n if (this._terminal.x > 0) {\n this._terminal.x--;\n }\n };\n InputHandler.prototype.tab = function () {\n this._terminal.x = this._terminal.nextStop();\n };\n InputHandler.prototype.shiftOut = function () {\n this._terminal.setgLevel(1);\n };\n InputHandler.prototype.shiftIn = function () {\n this._terminal.setgLevel(0);\n };\n InputHandler.prototype.insertChars = function (params) {\n var param, row, j, ch;\n param = params[0];\n if (param < 1)\n param = 1;\n row = this._terminal.y + this._terminal.ybase;\n j = this._terminal.x;\n ch = [this._terminal.eraseAttr(), ' ', 1];\n while (param-- && j < this._terminal.cols) {\n this._terminal.lines.get(row).splice(j++, 0, ch);\n this._terminal.lines.get(row).pop();\n }\n };\n InputHandler.prototype.cursorUp = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y -= param;\n if (this._terminal.y < 0) {\n this._terminal.y = 0;\n }\n };\n InputHandler.prototype.cursorDown = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y += param;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x--;\n }\n };\n InputHandler.prototype.cursorForward = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.x += param;\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x = this._terminal.cols - 1;\n }\n };\n InputHandler.prototype.cursorBackward = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x--;\n }\n this._terminal.x -= param;\n if (this._terminal.x < 0) {\n this._terminal.x = 0;\n }\n };\n InputHandler.prototype.cursorNextLine = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y += param;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n this._terminal.x = 0;\n };\n ;\n InputHandler.prototype.cursorPrecedingLine = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y -= param;\n if (this._terminal.y < 0) {\n this._terminal.y = 0;\n }\n this._terminal.x = 0;\n };\n ;\n InputHandler.prototype.cursorCharAbsolute = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.x = param - 1;\n };\n InputHandler.prototype.cursorPosition = function (params) {\n var row, col;\n row = params[0] - 1;\n if (params.length >= 2) {\n col = params[1] - 1;\n }\n else {\n col = 0;\n }\n if (row < 0) {\n row = 0;\n }\n else if (row >= this._terminal.rows) {\n row = this._terminal.rows - 1;\n }\n if (col < 0) {\n col = 0;\n }\n else if (col >= this._terminal.cols) {\n col = this._terminal.cols - 1;\n }\n this._terminal.x = col;\n this._terminal.y = row;\n };\n InputHandler.prototype.cursorForwardTab = function (params) {\n var param = params[0] || 1;\n while (param--) {\n this._terminal.x = this._terminal.nextStop();\n }\n };\n InputHandler.prototype.eraseInDisplay = function (params) {\n var j;\n switch (params[0]) {\n case 0:\n this._terminal.eraseRight(this._terminal.x, this._terminal.y);\n j = this._terminal.y + 1;\n for (; j < this._terminal.rows; j++) {\n this._terminal.eraseLine(j);\n }\n break;\n case 1:\n this._terminal.eraseLeft(this._terminal.x, this._terminal.y);\n j = this._terminal.y;\n while (j--) {\n this._terminal.eraseLine(j);\n }\n break;\n case 2:\n j = this._terminal.rows;\n while (j--)\n this._terminal.eraseLine(j);\n break;\n case 3:\n var scrollBackSize = this._terminal.lines.length - this._terminal.rows;\n if (scrollBackSize > 0) {\n this._terminal.lines.trimStart(scrollBackSize);\n this._terminal.ybase = Math.max(this._terminal.ybase - scrollBackSize, 0);\n this._terminal.ydisp = Math.max(this._terminal.ydisp - scrollBackSize, 0);\n }\n break;\n }\n };\n InputHandler.prototype.eraseInLine = function (params) {\n switch (params[0]) {\n case 0:\n this._terminal.eraseRight(this._terminal.x, this._terminal.y);\n break;\n case 1:\n this._terminal.eraseLeft(this._terminal.x, this._terminal.y);\n break;\n case 2:\n this._terminal.eraseLine(this._terminal.y);\n break;\n }\n };\n InputHandler.prototype.insertLines = function (params) {\n var param, row, j;\n param = params[0];\n if (param < 1) {\n param = 1;\n }\n row = this._terminal.y + this._terminal.ybase;\n j = this._terminal.rows - 1 - this._terminal.scrollBottom;\n j = this._terminal.rows - 1 + this._terminal.ybase - j + 1;\n while (param--) {\n if (this._terminal.lines.length === this._terminal.lines.maxLength) {\n this._terminal.lines.trimStart(1);\n this._terminal.ybase--;\n this._terminal.ydisp--;\n row--;\n j--;\n }\n this._terminal.lines.splice(row, 0, this._terminal.blankLine(true));\n this._terminal.lines.splice(j, 1);\n }\n this._terminal.updateRange(this._terminal.y);\n this._terminal.updateRange(this._terminal.scrollBottom);\n };\n InputHandler.prototype.deleteLines = function (params) {\n var param, row, j;\n param = params[0];\n if (param < 1) {\n param = 1;\n }\n row = this._terminal.y + this._terminal.ybase;\n j = this._terminal.rows - 1 - this._terminal.scrollBottom;\n j = this._terminal.rows - 1 + this._terminal.ybase - j;\n while (param--) {\n if (this._terminal.lines.length === this._terminal.lines.maxLength) {\n this._terminal.lines.trimStart(1);\n this._terminal.ybase -= 1;\n this._terminal.ydisp -= 1;\n }\n this._terminal.lines.splice(j + 1, 0, this._terminal.blankLine(true));\n this._terminal.lines.splice(row, 1);\n }\n this._terminal.updateRange(this._terminal.y);\n this._terminal.updateRange(this._terminal.scrollBottom);\n };\n InputHandler.prototype.deleteChars = function (params) {\n var param, row, ch;\n param = params[0];\n if (param < 1) {\n param = 1;\n }\n row = this._terminal.y + this._terminal.ybase;\n ch = [this._terminal.eraseAttr(), ' ', 1];\n while (param--) {\n this._terminal.lines.get(row).splice(this._terminal.x, 1);\n this._terminal.lines.get(row).push(ch);\n }\n };\n InputHandler.prototype.scrollUp = function (params) {\n var param = params[0] || 1;\n while (param--) {\n this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollTop, 1);\n this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollBottom, 0, this._terminal.blankLine());\n }\n this._terminal.updateRange(this._terminal.scrollTop);\n this._terminal.updateRange(this._terminal.scrollBottom);\n };\n InputHandler.prototype.scrollDown = function (params) {\n var param = params[0] || 1;\n while (param--) {\n this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollBottom, 1);\n this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollTop, 0, this._terminal.blankLine());\n }\n this._terminal.updateRange(this._terminal.scrollTop);\n this._terminal.updateRange(this._terminal.scrollBottom);\n };\n InputHandler.prototype.eraseChars = function (params) {\n var param, row, j, ch;\n param = params[0];\n if (param < 1) {\n param = 1;\n }\n row = this._terminal.y + this._terminal.ybase;\n j = this._terminal.x;\n ch = [this._terminal.eraseAttr(), ' ', 1];\n while (param-- && j < this._terminal.cols) {\n this._terminal.lines.get(row)[j++] = ch;\n }\n };\n InputHandler.prototype.cursorBackwardTab = function (params) {\n var param = params[0] || 1;\n while (param--) {\n this._terminal.x = this._terminal.prevStop();\n }\n };\n InputHandler.prototype.charPosAbsolute = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.x = param - 1;\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x = this._terminal.cols - 1;\n }\n };\n InputHandler.prototype.HPositionRelative = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.x += param;\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x = this._terminal.cols - 1;\n }\n };\n InputHandler.prototype.repeatPrecedingCharacter = function (params) {\n var param = params[0] || 1, line = this._terminal.lines.get(this._terminal.ybase + this._terminal.y), ch = line[this._terminal.x - 1] || [this._terminal.defAttr, ' ', 1];\n while (param--) {\n line[this._terminal.x++] = ch;\n }\n };\n InputHandler.prototype.sendDeviceAttributes = function (params) {\n if (params[0] > 0) {\n return;\n }\n if (!this._terminal.prefix) {\n if (this._terminal.is('xterm') || this._terminal.is('rxvt-unicode') || this._terminal.is('screen')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[?1;2c');\n }\n else if (this._terminal.is('linux')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[?6c');\n }\n }\n else if (this._terminal.prefix === '>') {\n if (this._terminal.is('xterm')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[>0;276;0c');\n }\n else if (this._terminal.is('rxvt-unicode')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[>85;95;0c');\n }\n else if (this._terminal.is('linux')) {\n this._terminal.send(params[0] + 'c');\n }\n else if (this._terminal.is('screen')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[>83;40003;0c');\n }\n }\n };\n InputHandler.prototype.linePosAbsolute = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y = param - 1;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n };\n InputHandler.prototype.VPositionRelative = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y += param;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x--;\n }\n };\n InputHandler.prototype.HVPosition = function (params) {\n if (params[0] < 1)\n params[0] = 1;\n if (params[1] < 1)\n params[1] = 1;\n this._terminal.y = params[0] - 1;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n this._terminal.x = params[1] - 1;\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x = this._terminal.cols - 1;\n }\n };\n InputHandler.prototype.tabClear = function (params) {\n var param = params[0];\n if (param <= 0) {\n delete this._terminal.tabs[this._terminal.x];\n }\n else if (param === 3) {\n this._terminal.tabs = {};\n }\n };\n InputHandler.prototype.setMode = function (params) {\n if (params.length > 1) {\n for (var i = 0; i < params.length; i++) {\n this.setMode([params[i]]);\n }\n return;\n }\n if (!this._terminal.prefix) {\n switch (params[0]) {\n case 4:\n this._terminal.insertMode = true;\n break;\n case 20:\n break;\n }\n }\n else if (this._terminal.prefix === '?') {\n switch (params[0]) {\n case 1:\n this._terminal.applicationCursor = true;\n break;\n case 2:\n this._terminal.setgCharset(0, Charsets_1.DEFAULT_CHARSET);\n this._terminal.setgCharset(1, Charsets_1.DEFAULT_CHARSET);\n this._terminal.setgCharset(2, Charsets_1.DEFAULT_CHARSET);\n this._terminal.setgCharset(3, Charsets_1.DEFAULT_CHARSET);\n break;\n case 3:\n this._terminal.savedCols = this._terminal.cols;\n this._terminal.resize(132, this._terminal.rows);\n break;\n case 6:\n this._terminal.originMode = true;\n break;\n case 7:\n this._terminal.wraparoundMode = true;\n break;\n case 12:\n break;\n case 66:\n this._terminal.log('Serial port requested application keypad.');\n this._terminal.applicationKeypad = true;\n this._terminal.viewport.syncScrollArea();\n break;\n case 9:\n case 1000:\n case 1002:\n case 1003:\n this._terminal.x10Mouse = params[0] === 9;\n this._terminal.vt200Mouse = params[0] === 1000;\n this._terminal.normalMouse = params[0] > 1000;\n this._terminal.mouseEvents = true;\n this._terminal.element.classList.add('enable-mouse-events');\n this._terminal.selectionManager.disable();\n this._terminal.log('Binding to mouse events.');\n break;\n case 1004:\n this._terminal.sendFocus = true;\n break;\n case 1005:\n this._terminal.utfMouse = true;\n break;\n case 1006:\n this._terminal.sgrMouse = true;\n break;\n case 1015:\n this._terminal.urxvtMouse = true;\n break;\n case 25:\n this._terminal.cursorHidden = false;\n break;\n case 1049:\n ;\n case 47:\n case 1047:\n if (!this._terminal.normal) {\n var normal = {\n lines: this._terminal.lines,\n ybase: this._terminal.ybase,\n ydisp: this._terminal.ydisp,\n x: this._terminal.x,\n y: this._terminal.y,\n scrollTop: this._terminal.scrollTop,\n scrollBottom: this._terminal.scrollBottom,\n tabs: this._terminal.tabs\n };\n this._terminal.reset();\n this._terminal.viewport.syncScrollArea();\n this._terminal.normal = normal;\n this._terminal.showCursor();\n }\n break;\n }\n }\n };\n InputHandler.prototype.resetMode = function (params) {\n if (params.length > 1) {\n for (var i = 0; i < params.length; i++) {\n this.resetMode([params[i]]);\n }\n return;\n }\n if (!this._terminal.prefix) {\n switch (params[0]) {\n case 4:\n this._terminal.insertMode = false;\n break;\n case 20:\n break;\n }\n }\n else if (this._terminal.prefix === '?') {\n switch (params[0]) {\n case 1:\n this._terminal.applicationCursor = false;\n break;\n case 3:\n if (this._terminal.cols === 132 && this._terminal.savedCols) {\n this._terminal.resize(this._terminal.savedCols, this._terminal.rows);\n }\n delete this._terminal.savedCols;\n break;\n case 6:\n this._terminal.originMode = false;\n break;\n case 7:\n this._terminal.wraparoundMode = false;\n break;\n case 12:\n break;\n case 66:\n this._terminal.log('Switching back to normal keypad.');\n this._terminal.applicationKeypad = false;\n this._terminal.viewport.syncScrollArea();\n break;\n case 9:\n case 1000:\n case 1002:\n case 1003:\n this._terminal.x10Mouse = false;\n this._terminal.vt200Mouse = false;\n this._terminal.normalMouse = false;\n this._terminal.mouseEvents = false;\n this._terminal.element.classList.remove('enable-mouse-events');\n this._terminal.selectionManager.enable();\n break;\n case 1004:\n this._terminal.sendFocus = false;\n break;\n case 1005:\n this._terminal.utfMouse = false;\n break;\n case 1006:\n this._terminal.sgrMouse = false;\n break;\n case 1015:\n this._terminal.urxvtMouse = false;\n break;\n case 25:\n this._terminal.cursorHidden = true;\n break;\n case 1049:\n ;\n case 47:\n case 1047:\n if (this._terminal.normal) {\n this._terminal.lines = this._terminal.normal.lines;\n this._terminal.ybase = this._terminal.normal.ybase;\n this._terminal.ydisp = this._terminal.normal.ydisp;\n this._terminal.x = this._terminal.normal.x;\n this._terminal.y = this._terminal.normal.y;\n this._terminal.scrollTop = this._terminal.normal.scrollTop;\n this._terminal.scrollBottom = this._terminal.normal.scrollBottom;\n this._terminal.tabs = this._terminal.normal.tabs;\n this._terminal.normal = null;\n this._terminal.selectionManager.setBuffer(this._terminal.lines);\n this._terminal.refresh(0, this._terminal.rows - 1);\n this._terminal.viewport.syncScrollArea();\n this._terminal.showCursor();\n }\n break;\n }\n }\n };\n InputHandler.prototype.charAttributes = function (params) {\n if (params.length === 1 && params[0] === 0) {\n this._terminal.curAttr = this._terminal.defAttr;\n return;\n }\n var l = params.length, i = 0, flags = this._terminal.curAttr >> 18, fg = (this._terminal.curAttr >> 9) & 0x1ff, bg = this._terminal.curAttr & 0x1ff, p;\n for (; i < l; i++) {\n p = params[i];\n if (p >= 30 && p <= 37) {\n fg = p - 30;\n }\n else if (p >= 40 && p <= 47) {\n bg = p - 40;\n }\n else if (p >= 90 && p <= 97) {\n p += 8;\n fg = p - 90;\n }\n else if (p >= 100 && p <= 107) {\n p += 8;\n bg = p - 100;\n }\n else if (p === 0) {\n flags = this._terminal.defAttr >> 18;\n fg = (this._terminal.defAttr >> 9) & 0x1ff;\n bg = this._terminal.defAttr & 0x1ff;\n }\n else if (p === 1) {\n flags |= 1;\n }\n else if (p === 4) {\n flags |= 2;\n }\n else if (p === 5) {\n flags |= 4;\n }\n else if (p === 7) {\n flags |= 8;\n }\n else if (p === 8) {\n flags |= 16;\n }\n else if (p === 22) {\n flags &= ~1;\n }\n else if (p === 24) {\n flags &= ~2;\n }\n else if (p === 25) {\n flags &= ~4;\n }\n else if (p === 27) {\n flags &= ~8;\n }\n else if (p === 28) {\n flags &= ~16;\n }\n else if (p === 39) {\n fg = (this._terminal.defAttr >> 9) & 0x1ff;\n }\n else if (p === 49) {\n bg = this._terminal.defAttr & 0x1ff;\n }\n else if (p === 38) {\n if (params[i + 1] === 2) {\n i += 2;\n fg = this._terminal.matchColor(params[i] & 0xff, params[i + 1] & 0xff, params[i + 2] & 0xff);\n if (fg === -1)\n fg = 0x1ff;\n i += 2;\n }\n else if (params[i + 1] === 5) {\n i += 2;\n p = params[i] & 0xff;\n fg = p;\n }\n }\n else if (p === 48) {\n if (params[i + 1] === 2) {\n i += 2;\n bg = this._terminal.matchColor(params[i] & 0xff, params[i + 1] & 0xff, params[i + 2] & 0xff);\n if (bg === -1)\n bg = 0x1ff;\n i += 2;\n }\n else if (params[i + 1] === 5) {\n i += 2;\n p = params[i] & 0xff;\n bg = p;\n }\n }\n else if (p === 100) {\n fg = (this._terminal.defAttr >> 9) & 0x1ff;\n bg = this._terminal.defAttr & 0x1ff;\n }\n else {\n this._terminal.error('Unknown SGR attribute: %d.', p);\n }\n }\n this._terminal.curAttr = (flags << 18) | (fg << 9) | bg;\n };\n InputHandler.prototype.deviceStatus = function (params) {\n if (!this._terminal.prefix) {\n switch (params[0]) {\n case 5:\n this._terminal.send(EscapeSequences_1.C0.ESC + '[0n');\n break;\n case 6:\n this._terminal.send(EscapeSequences_1.C0.ESC + '['\n + (this._terminal.y + 1)\n + ';'\n + (this._terminal.x + 1)\n + 'R');\n break;\n }\n }\n else if (this._terminal.prefix === '?') {\n switch (params[0]) {\n case 6:\n this._terminal.send(EscapeSequences_1.C0.ESC + '[?'\n + (this._terminal.y + 1)\n + ';'\n + (this._terminal.x + 1)\n + 'R');\n break;\n case 15:\n break;\n case 25:\n break;\n case 26:\n break;\n case 53:\n break;\n }\n }\n };\n InputHandler.prototype.softReset = function (params) {\n this._terminal.cursorHidden = false;\n this._terminal.insertMode = false;\n this._terminal.originMode = false;\n this._terminal.wraparoundMode = true;\n this._terminal.applicationKeypad = false;\n this._terminal.viewport.syncScrollArea();\n this._terminal.applicationCursor = false;\n this._terminal.scrollTop = 0;\n this._terminal.scrollBottom = this._terminal.rows - 1;\n this._terminal.curAttr = this._terminal.defAttr;\n this._terminal.x = this._terminal.y = 0;\n this._terminal.charset = null;\n this._terminal.glevel = 0;\n this._terminal.charsets = [null];\n };\n InputHandler.prototype.setCursorStyle = function (params) {\n var param = params[0] < 1 ? 1 : params[0];\n switch (param) {\n case 1:\n case 2:\n this._terminal.setOption('cursorStyle', 'block');\n break;\n case 3:\n case 4:\n this._terminal.setOption('cursorStyle', 'underline');\n break;\n case 5:\n case 6:\n this._terminal.setOption('cursorStyle', 'bar');\n break;\n }\n var isBlinking = param % 2 === 1;\n this._terminal.setOption('cursorBlink', isBlinking);\n };\n InputHandler.prototype.setScrollRegion = function (params) {\n if (this._terminal.prefix)\n return;\n this._terminal.scrollTop = (params[0] || 1) - 1;\n this._terminal.scrollBottom = (params[1] && params[1] <= this._terminal.rows ? params[1] : this._terminal.rows) - 1;\n this._terminal.x = 0;\n this._terminal.y = 0;\n };\n InputHandler.prototype.saveCursor = function (params) {\n this._terminal.savedX = this._terminal.x;\n this._terminal.savedY = this._terminal.y;\n };\n InputHandler.prototype.restoreCursor = function (params) {\n this._terminal.x = this._terminal.savedX || 0;\n this._terminal.y = this._terminal.savedY || 0;\n };\n return InputHandler;\n}());\nexports.InputHandler = InputHandler;\nvar wcwidth = (function (opts) {\n var 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 [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 function bisearch(ucs) {\n var min = 0;\n var max = COMBINING.length - 1;\n var mid;\n if (ucs < COMBINING[0][0] || ucs > COMBINING[max][1])\n return false;\n while (max >= min) {\n mid = Math.floor((min + max) / 2);\n if (ucs > COMBINING[mid][1])\n min = mid + 1;\n else if (ucs < COMBINING[mid][0])\n max = mid - 1;\n else\n return true;\n }\n return false;\n }\n function wcwidth(ucs) {\n if (ucs === 0)\n return opts.nul;\n if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))\n return opts.control;\n if (bisearch(ucs))\n return 0;\n if (isWide(ucs)) {\n return 2;\n }\n return 1;\n }\n function isWide(ucs) {\n return (ucs >= 0x1100 && (ucs <= 0x115f ||\n ucs === 0x2329 ||\n ucs === 0x232a ||\n (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs !== 0x303f) ||\n (ucs >= 0xac00 && ucs <= 0xd7a3) ||\n (ucs >= 0xf900 && ucs <= 0xfaff) ||\n (ucs >= 0xfe10 && ucs <= 0xfe19) ||\n (ucs >= 0xfe30 && ucs <= 0xfe6f) ||\n (ucs >= 0xff00 && ucs <= 0xff60) ||\n (ucs >= 0xffe0 && ucs <= 0xffe6) ||\n (ucs >= 0x20000 && ucs <= 0x2fffd) ||\n (ucs >= 0x30000 && ucs <= 0x3fffd)));\n }\n return wcwidth;\n})({ nul: 0, control: 0 });\n\n//# sourceMappingURL=InputHandler.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/InputHandler.js\n// module id = 17\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar INVALID_LINK_CLASS = 'xterm-invalid-link';\nvar protocolClause = '(https?:\\\\/\\\\/)';\nvar domainCharacterSet = '[\\\\da-z\\\\.-]+';\nvar negatedDomainCharacterSet = '[^\\\\da-z\\\\.-]+';\nvar domainBodyClause = '(' + domainCharacterSet + ')';\nvar tldClause = '([a-z\\\\.]{2,6})';\nvar ipClause = '((\\\\d{1,3}\\\\.){3}\\\\d{1,3})';\nvar localHostClause = '(localhost)';\nvar portClause = '(:\\\\d{1,5})';\nvar hostClause = '((' + domainBodyClause + '\\\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?';\nvar pathClause = '(\\\\/[\\\\/\\\\w\\\\.\\\\-%~]*)*';\nvar queryStringHashFragmentCharacterSet = '[0-9\\\\w\\\\[\\\\]\\\\(\\\\)\\\\/\\\\?\\\\!#@$%&\\'*+,:;~\\\\=\\\\.\\\\-]*';\nvar queryStringClause = '(\\\\?' + queryStringHashFragmentCharacterSet + ')?';\nvar hashFragmentClause = '(#' + queryStringHashFragmentCharacterSet + ')?';\nvar negatedPathCharacterSet = '[^\\\\/\\\\w\\\\.\\\\-%]+';\nvar bodyClause = hostClause + pathClause + queryStringClause + hashFragmentClause;\nvar start = '(?:^|' + negatedDomainCharacterSet + ')(';\nvar end = ')($|' + negatedPathCharacterSet + ')';\nvar strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end);\nvar HYPERTEXT_LINK_MATCHER_ID = 0;\nvar Linkifier = (function () {\n function Linkifier() {\n this._nextLinkMatcherId = HYPERTEXT_LINK_MATCHER_ID;\n this._rowTimeoutIds = [];\n this._linkMatchers = [];\n this.registerLinkMatcher(strictUrlRegex, null, { matchIndex: 1 });\n }\n Linkifier.prototype.attachToDom = function (document, rows) {\n this._document = document;\n this._rows = rows;\n };\n Linkifier.prototype.linkifyRow = function (rowIndex) {\n if (!this._document) {\n return;\n }\n var timeoutId = this._rowTimeoutIds[rowIndex];\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n this._rowTimeoutIds[rowIndex] = setTimeout(this._linkifyRow.bind(this, rowIndex), Linkifier.TIME_BEFORE_LINKIFY);\n };\n Linkifier.prototype.setHypertextLinkHandler = function (handler) {\n this._linkMatchers[HYPERTEXT_LINK_MATCHER_ID].handler = handler;\n };\n Linkifier.prototype.setHypertextValidationCallback = function (callback) {\n this._linkMatchers[HYPERTEXT_LINK_MATCHER_ID].validationCallback = callback;\n };\n Linkifier.prototype.registerLinkMatcher = function (regex, handler, options) {\n if (options === void 0) { options = {}; }\n if (this._nextLinkMatcherId !== HYPERTEXT_LINK_MATCHER_ID && !handler) {\n throw new Error('handler must be defined');\n }\n var matcher = {\n id: this._nextLinkMatcherId++,\n regex: regex,\n handler: handler,\n matchIndex: options.matchIndex,\n validationCallback: options.validationCallback,\n priority: options.priority || 0\n };\n this._addLinkMatcherToList(matcher);\n return matcher.id;\n };\n Linkifier.prototype._addLinkMatcherToList = function (matcher) {\n if (this._linkMatchers.length === 0) {\n this._linkMatchers.push(matcher);\n return;\n }\n for (var 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 this._linkMatchers.splice(0, 0, matcher);\n };\n Linkifier.prototype.deregisterLinkMatcher = function (matcherId) {\n for (var i = 1; 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 Linkifier.prototype._linkifyRow = function (rowIndex) {\n var row = this._rows[rowIndex];\n if (!row) {\n return;\n }\n var text = row.textContent;\n for (var i = 0; i < this._linkMatchers.length; i++) {\n var matcher = this._linkMatchers[i];\n var linkElements = this._doLinkifyRow(row, matcher);\n if (linkElements.length > 0) {\n if (matcher.validationCallback) {\n var _loop_1 = function (j) {\n var element = linkElements[j];\n matcher.validationCallback(element.textContent, element, function (isValid) {\n if (!isValid) {\n element.classList.add(INVALID_LINK_CLASS);\n }\n });\n };\n for (var j = 0; j < linkElements.length; j++) {\n _loop_1(j);\n }\n }\n return;\n }\n }\n };\n Linkifier.prototype._doLinkifyRow = function (row, matcher) {\n var result = [];\n var isHttpLinkMatcher = matcher.id === HYPERTEXT_LINK_MATCHER_ID;\n var nodes = row.childNodes;\n var match = row.textContent.match(matcher.regex);\n if (!match || match.length === 0) {\n return result;\n }\n var uri = match[typeof matcher.matchIndex !== 'number' ? 0 : matcher.matchIndex];\n var rowStartIndex = match.index + uri.length;\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n var searchIndex = node.textContent.indexOf(uri);\n if (searchIndex >= 0) {\n var linkElement = this._createAnchorElement(uri, matcher.handler, isHttpLinkMatcher);\n if (node.textContent.length === uri.length) {\n if (node.nodeType === 3) {\n this._replaceNode(node, linkElement);\n }\n else {\n var element = node;\n if (element.nodeName === 'A') {\n return result;\n }\n element.innerHTML = '';\n element.appendChild(linkElement);\n }\n }\n else if (node.childNodes.length > 1) {\n for (var j = 0; j < node.childNodes.length; j++) {\n var childNode = node.childNodes[j];\n var childSearchIndex = childNode.textContent.indexOf(uri);\n if (childSearchIndex !== -1) {\n this._replaceNodeSubstringWithNode(childNode, linkElement, uri, childSearchIndex);\n break;\n }\n }\n }\n else {\n var nodesAdded = this._replaceNodeSubstringWithNode(node, linkElement, uri, searchIndex);\n i += nodesAdded;\n }\n result.push(linkElement);\n match = row.textContent.substring(rowStartIndex).match(matcher.regex);\n if (!match || match.length === 0) {\n return result;\n }\n uri = match[typeof matcher.matchIndex !== 'number' ? 0 : matcher.matchIndex];\n rowStartIndex += match.index + uri.length;\n }\n }\n return result;\n };\n Linkifier.prototype._createAnchorElement = function (uri, handler, isHypertextLinkHandler) {\n var element = this._document.createElement('a');\n element.textContent = uri;\n element.draggable = false;\n if (isHypertextLinkHandler) {\n element.href = uri;\n element.target = '_blank';\n element.addEventListener('click', function (event) {\n if (handler) {\n return handler(event, uri);\n }\n });\n }\n else {\n element.addEventListener('click', function (event) {\n if (element.classList.contains(INVALID_LINK_CLASS)) {\n return;\n }\n return handler(event, uri);\n });\n }\n return element;\n };\n Linkifier.prototype._replaceNode = function (oldNode) {\n var newNodes = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n newNodes[_i - 1] = arguments[_i];\n }\n var parent = oldNode.parentNode;\n for (var i = 0; i < newNodes.length; i++) {\n parent.insertBefore(newNodes[i], oldNode);\n }\n parent.removeChild(oldNode);\n };\n Linkifier.prototype._replaceNodeSubstringWithNode = function (targetNode, newNode, substring, substringIndex) {\n if (targetNode.childNodes.length === 1) {\n targetNode = targetNode.childNodes[0];\n }\n if (targetNode.nodeType !== 3) {\n throw new Error('targetNode must be a text node or only contain a single text node');\n }\n var fullText = targetNode.textContent;\n if (substringIndex === 0) {\n var rightText_1 = fullText.substring(substring.length);\n var rightTextNode_1 = this._document.createTextNode(rightText_1);\n this._replaceNode(targetNode, newNode, rightTextNode_1);\n return 0;\n }\n if (substringIndex === targetNode.textContent.length - substring.length) {\n var leftText_1 = fullText.substring(0, substringIndex);\n var leftTextNode_1 = this._document.createTextNode(leftText_1);\n this._replaceNode(targetNode, leftTextNode_1, newNode);\n return 0;\n }\n var leftText = fullText.substring(0, substringIndex);\n var leftTextNode = this._document.createTextNode(leftText);\n var rightText = fullText.substring(substringIndex + substring.length);\n var rightTextNode = this._document.createTextNode(rightText);\n this._replaceNode(targetNode, leftTextNode, newNode, rightTextNode);\n return 1;\n };\n return Linkifier;\n}());\nLinkifier.TIME_BEFORE_LINKIFY = 200;\nexports.Linkifier = Linkifier;\n\n//# sourceMappingURL=Linkifier.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Linkifier.js\n// module id = 18\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EscapeSequences_1 = require(\"./EscapeSequences\");\nvar Charsets_1 = require(\"./Charsets\");\nvar normalStateHandler = {};\nnormalStateHandler[EscapeSequences_1.C0.BEL] = function (parser, handler) { return handler.bell(); };\nnormalStateHandler[EscapeSequences_1.C0.LF] = function (parser, handler) { return handler.lineFeed(); };\nnormalStateHandler[EscapeSequences_1.C0.VT] = normalStateHandler[EscapeSequences_1.C0.LF];\nnormalStateHandler[EscapeSequences_1.C0.FF] = normalStateHandler[EscapeSequences_1.C0.LF];\nnormalStateHandler[EscapeSequences_1.C0.CR] = function (parser, handler) { return handler.carriageReturn(); };\nnormalStateHandler[EscapeSequences_1.C0.BS] = function (parser, handler) { return handler.backspace(); };\nnormalStateHandler[EscapeSequences_1.C0.HT] = function (parser, handler) { return handler.tab(); };\nnormalStateHandler[EscapeSequences_1.C0.SO] = function (parser, handler) { return handler.shiftOut(); };\nnormalStateHandler[EscapeSequences_1.C0.SI] = function (parser, handler) { return handler.shiftIn(); };\nnormalStateHandler[EscapeSequences_1.C0.ESC] = function (parser, handler) { return parser.setState(ParserState.ESCAPED); };\nvar escapedStateHandler = {};\nescapedStateHandler['['] = function (parser, terminal) {\n terminal.params = [];\n terminal.currentParam = 0;\n parser.setState(ParserState.CSI_PARAM);\n};\nescapedStateHandler[']'] = function (parser, terminal) {\n terminal.params = [];\n terminal.currentParam = 0;\n parser.setState(ParserState.OSC);\n};\nescapedStateHandler['P'] = function (parser, terminal) {\n terminal.params = [];\n terminal.currentParam = 0;\n parser.setState(ParserState.DCS);\n};\nescapedStateHandler['_'] = function (parser, terminal) {\n parser.setState(ParserState.IGNORE);\n};\nescapedStateHandler['^'] = function (parser, terminal) {\n parser.setState(ParserState.IGNORE);\n};\nescapedStateHandler['c'] = function (parser, terminal) {\n terminal.reset();\n};\nescapedStateHandler['E'] = function (parser, terminal) {\n terminal.x = 0;\n terminal.index();\n parser.setState(ParserState.NORMAL);\n};\nescapedStateHandler['D'] = function (parser, terminal) {\n terminal.index();\n parser.setState(ParserState.NORMAL);\n};\nescapedStateHandler['M'] = function (parser, terminal) {\n terminal.reverseIndex();\n parser.setState(ParserState.NORMAL);\n};\nescapedStateHandler['%'] = function (parser, terminal) {\n terminal.setgLevel(0);\n terminal.setgCharset(0, Charsets_1.DEFAULT_CHARSET);\n parser.setState(ParserState.NORMAL);\n parser.skipNextChar();\n};\nescapedStateHandler[EscapeSequences_1.C0.CAN] = function (parser) { return parser.setState(ParserState.NORMAL); };\nvar csiParamStateHandler = {};\ncsiParamStateHandler['?'] = function (parser) { return parser.setPrefix('?'); };\ncsiParamStateHandler['>'] = function (parser) { return parser.setPrefix('>'); };\ncsiParamStateHandler['!'] = function (parser) { return parser.setPrefix('!'); };\ncsiParamStateHandler['0'] = function (parser) { return parser.setParam(parser.getParam() * 10); };\ncsiParamStateHandler['1'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 1); };\ncsiParamStateHandler['2'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 2); };\ncsiParamStateHandler['3'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 3); };\ncsiParamStateHandler['4'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 4); };\ncsiParamStateHandler['5'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 5); };\ncsiParamStateHandler['6'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 6); };\ncsiParamStateHandler['7'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 7); };\ncsiParamStateHandler['8'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 8); };\ncsiParamStateHandler['9'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 9); };\ncsiParamStateHandler['$'] = function (parser) { return parser.setPostfix('$'); };\ncsiParamStateHandler['\"'] = function (parser) { return parser.setPostfix('\"'); };\ncsiParamStateHandler[' '] = function (parser) { return parser.setPostfix(' '); };\ncsiParamStateHandler['\\''] = function (parser) { return parser.setPostfix('\\''); };\ncsiParamStateHandler[';'] = function (parser) { return parser.finalizeParam(); };\ncsiParamStateHandler[EscapeSequences_1.C0.CAN] = function (parser) { return parser.setState(ParserState.NORMAL); };\nvar csiStateHandler = {};\ncsiStateHandler['@'] = function (handler, params, prefix) { return handler.insertChars(params); };\ncsiStateHandler['A'] = function (handler, params, prefix) { return handler.cursorUp(params); };\ncsiStateHandler['B'] = function (handler, params, prefix) { return handler.cursorDown(params); };\ncsiStateHandler['C'] = function (handler, params, prefix) { return handler.cursorForward(params); };\ncsiStateHandler['D'] = function (handler, params, prefix) { return handler.cursorBackward(params); };\ncsiStateHandler['E'] = function (handler, params, prefix) { return handler.cursorNextLine(params); };\ncsiStateHandler['F'] = function (handler, params, prefix) { return handler.cursorPrecedingLine(params); };\ncsiStateHandler['G'] = function (handler, params, prefix) { return handler.cursorCharAbsolute(params); };\ncsiStateHandler['H'] = function (handler, params, prefix) { return handler.cursorPosition(params); };\ncsiStateHandler['I'] = function (handler, params, prefix) { return handler.cursorForwardTab(params); };\ncsiStateHandler['J'] = function (handler, params, prefix) { return handler.eraseInDisplay(params); };\ncsiStateHandler['K'] = function (handler, params, prefix) { return handler.eraseInLine(params); };\ncsiStateHandler['L'] = function (handler, params, prefix) { return handler.insertLines(params); };\ncsiStateHandler['M'] = function (handler, params, prefix) { return handler.deleteLines(params); };\ncsiStateHandler['P'] = function (handler, params, prefix) { return handler.deleteChars(params); };\ncsiStateHandler['S'] = function (handler, params, prefix) { return handler.scrollUp(params); };\ncsiStateHandler['T'] = function (handler, params, prefix) {\n if (params.length < 2 && !prefix) {\n handler.scrollDown(params);\n }\n};\ncsiStateHandler['X'] = function (handler, params, prefix) { return handler.eraseChars(params); };\ncsiStateHandler['Z'] = function (handler, params, prefix) { return handler.cursorBackwardTab(params); };\ncsiStateHandler['`'] = function (handler, params, prefix) { return handler.charPosAbsolute(params); };\ncsiStateHandler['a'] = function (handler, params, prefix) { return handler.HPositionRelative(params); };\ncsiStateHandler['b'] = function (handler, params, prefix) { return handler.repeatPrecedingCharacter(params); };\ncsiStateHandler['c'] = function (handler, params, prefix) { return handler.sendDeviceAttributes(params); };\ncsiStateHandler['d'] = function (handler, params, prefix) { return handler.linePosAbsolute(params); };\ncsiStateHandler['e'] = function (handler, params, prefix) { return handler.VPositionRelative(params); };\ncsiStateHandler['f'] = function (handler, params, prefix) { return handler.HVPosition(params); };\ncsiStateHandler['g'] = function (handler, params, prefix) { return handler.tabClear(params); };\ncsiStateHandler['h'] = function (handler, params, prefix) { return handler.setMode(params); };\ncsiStateHandler['l'] = function (handler, params, prefix) { return handler.resetMode(params); };\ncsiStateHandler['m'] = function (handler, params, prefix) { return handler.charAttributes(params); };\ncsiStateHandler['n'] = function (handler, params, prefix) { return handler.deviceStatus(params); };\ncsiStateHandler['p'] = function (handler, params, prefix) {\n switch (prefix) {\n case '!':\n handler.softReset(params);\n break;\n }\n};\ncsiStateHandler['q'] = function (handler, params, prefix, postfix) {\n if (postfix === ' ') {\n handler.setCursorStyle(params);\n }\n};\ncsiStateHandler['r'] = function (handler, params) { return handler.setScrollRegion(params); };\ncsiStateHandler['s'] = function (handler, params) { return handler.saveCursor(params); };\ncsiStateHandler['u'] = function (handler, params) { return handler.restoreCursor(params); };\ncsiStateHandler[EscapeSequences_1.C0.CAN] = function (handler, params, prefix, postfix, parser) { return parser.setState(ParserState.NORMAL); };\nvar ParserState;\n(function (ParserState) {\n ParserState[ParserState[\"NORMAL\"] = 0] = \"NORMAL\";\n ParserState[ParserState[\"ESCAPED\"] = 1] = \"ESCAPED\";\n ParserState[ParserState[\"CSI_PARAM\"] = 2] = \"CSI_PARAM\";\n ParserState[ParserState[\"CSI\"] = 3] = \"CSI\";\n ParserState[ParserState[\"OSC\"] = 4] = \"OSC\";\n ParserState[ParserState[\"CHARSET\"] = 5] = \"CHARSET\";\n ParserState[ParserState[\"DCS\"] = 6] = \"DCS\";\n ParserState[ParserState[\"IGNORE\"] = 7] = \"IGNORE\";\n})(ParserState || (ParserState = {}));\nvar Parser = (function () {\n function Parser(_inputHandler, _terminal) {\n this._inputHandler = _inputHandler;\n this._terminal = _terminal;\n this._state = ParserState.NORMAL;\n }\n Parser.prototype.parse = function (data) {\n var l = data.length, j, cs, ch, code, low;\n this._position = 0;\n if (this._terminal.surrogate_high) {\n data = this._terminal.surrogate_high + data;\n this._terminal.surrogate_high = '';\n }\n for (; this._position < l; this._position++) {\n ch = data[this._position];\n code = data.charCodeAt(this._position);\n if (0xD800 <= code && code <= 0xDBFF) {\n low = data.charCodeAt(this._position + 1);\n if (isNaN(low)) {\n this._terminal.surrogate_high = ch;\n continue;\n }\n code = ((code - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n ch += data.charAt(this._position + 1);\n }\n if (0xDC00 <= code && code <= 0xDFFF)\n continue;\n switch (this._state) {\n case ParserState.NORMAL:\n if (ch in normalStateHandler) {\n normalStateHandler[ch](this, this._inputHandler);\n }\n else {\n this._inputHandler.addChar(ch, code);\n }\n break;\n case ParserState.ESCAPED:\n if (ch in escapedStateHandler) {\n escapedStateHandler[ch](this, this._terminal);\n break;\n }\n switch (ch) {\n case '(':\n case ')':\n case '*':\n case '+':\n case '-':\n case '.':\n switch (ch) {\n case '(':\n this._terminal.gcharset = 0;\n break;\n case ')':\n this._terminal.gcharset = 1;\n break;\n case '*':\n this._terminal.gcharset = 2;\n break;\n case '+':\n this._terminal.gcharset = 3;\n break;\n case '-':\n this._terminal.gcharset = 1;\n break;\n case '.':\n this._terminal.gcharset = 2;\n break;\n }\n this._state = ParserState.CHARSET;\n break;\n case '/':\n this._terminal.gcharset = 3;\n this._state = ParserState.CHARSET;\n this._position--;\n break;\n case 'N':\n break;\n case 'O':\n break;\n case 'n':\n this._terminal.setgLevel(2);\n break;\n case 'o':\n this._terminal.setgLevel(3);\n break;\n case '|':\n this._terminal.setgLevel(3);\n break;\n case '}':\n this._terminal.setgLevel(2);\n break;\n case '~':\n this._terminal.setgLevel(1);\n break;\n case '7':\n this._inputHandler.saveCursor();\n this._state = ParserState.NORMAL;\n break;\n case '8':\n this._inputHandler.restoreCursor();\n this._state = ParserState.NORMAL;\n break;\n case '#':\n this._state = ParserState.NORMAL;\n this._position++;\n break;\n case 'H':\n this._terminal.tabSet();\n this._state = ParserState.NORMAL;\n break;\n case '=':\n this._terminal.log('Serial port requested application keypad.');\n this._terminal.applicationKeypad = true;\n this._terminal.viewport.syncScrollArea();\n this._state = ParserState.NORMAL;\n break;\n case '>':\n this._terminal.log('Switching back to normal keypad.');\n this._terminal.applicationKeypad = false;\n this._terminal.viewport.syncScrollArea();\n this._state = ParserState.NORMAL;\n break;\n default:\n this._state = ParserState.NORMAL;\n this._terminal.error('Unknown ESC control: %s.', ch);\n break;\n }\n break;\n case ParserState.CHARSET:\n if (ch in Charsets_1.CHARSETS) {\n cs = Charsets_1.CHARSETS[ch];\n if (ch === '/') {\n this.skipNextChar();\n }\n }\n else {\n cs = Charsets_1.DEFAULT_CHARSET;\n }\n this._terminal.setgCharset(this._terminal.gcharset, cs);\n this._terminal.gcharset = null;\n this._state = ParserState.NORMAL;\n break;\n case ParserState.OSC:\n if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) {\n if (ch === EscapeSequences_1.C0.ESC)\n this._position++;\n this._terminal.params.push(this._terminal.currentParam);\n switch (this._terminal.params[0]) {\n case 0:\n case 1:\n case 2:\n if (this._terminal.params[1]) {\n this._terminal.title = this._terminal.params[1];\n this._terminal.handleTitle(this._terminal.title);\n }\n break;\n case 3:\n break;\n case 4:\n case 5:\n break;\n case 10:\n case 11:\n case 12:\n case 13:\n case 14:\n case 15:\n case 16:\n case 17:\n case 18:\n case 19:\n break;\n case 46:\n break;\n case 50:\n break;\n case 51:\n break;\n case 52:\n break;\n case 104:\n case 105:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n break;\n }\n this._terminal.params = [];\n this._terminal.currentParam = 0;\n this._state = ParserState.NORMAL;\n }\n else {\n if (!this._terminal.params.length) {\n if (ch >= '0' && ch <= '9') {\n this._terminal.currentParam =\n this._terminal.currentParam * 10 + ch.charCodeAt(0) - 48;\n }\n else if (ch === ';') {\n this._terminal.params.push(this._terminal.currentParam);\n this._terminal.currentParam = '';\n }\n }\n else {\n this._terminal.currentParam += ch;\n }\n }\n break;\n case ParserState.CSI_PARAM:\n if (ch in csiParamStateHandler) {\n csiParamStateHandler[ch](this);\n break;\n }\n this.finalizeParam();\n this._state = ParserState.CSI;\n case ParserState.CSI:\n if (ch in csiStateHandler) {\n csiStateHandler[ch](this._inputHandler, this._terminal.params, this._terminal.prefix, this._terminal.postfix, this);\n }\n else {\n this._terminal.error('Unknown CSI code: %s.', ch);\n }\n this._state = ParserState.NORMAL;\n this._terminal.prefix = '';\n this._terminal.postfix = '';\n break;\n case ParserState.DCS:\n if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) {\n if (ch === EscapeSequences_1.C0.ESC)\n this._position++;\n var pt = void 0;\n var valid = void 0;\n switch (this._terminal.prefix) {\n case '':\n break;\n case '$q':\n pt = this._terminal.currentParam;\n valid = false;\n switch (pt) {\n case '\"q':\n pt = '0\"q';\n break;\n case '\"p':\n pt = '61\"p';\n break;\n case 'r':\n pt = ''\n + (this._terminal.scrollTop + 1)\n + ';'\n + (this._terminal.scrollBottom + 1)\n + 'r';\n break;\n case 'm':\n pt = '0m';\n break;\n default:\n this._terminal.error('Unknown DCS Pt: %s.', pt);\n pt = '';\n break;\n }\n this._terminal.send(EscapeSequences_1.C0.ESC + 'P' + +valid + '$r' + pt + EscapeSequences_1.C0.ESC + '\\\\');\n break;\n case '+p':\n break;\n case '+q':\n pt = this._terminal.currentParam;\n valid = false;\n this._terminal.send(EscapeSequences_1.C0.ESC + 'P' + +valid + '+r' + pt + EscapeSequences_1.C0.ESC + '\\\\');\n break;\n default:\n this._terminal.error('Unknown DCS prefix: %s.', this._terminal.prefix);\n break;\n }\n this._terminal.currentParam = 0;\n this._terminal.prefix = '';\n this._state = ParserState.NORMAL;\n }\n else if (!this._terminal.currentParam) {\n if (!this._terminal.prefix && ch !== '$' && ch !== '+') {\n this._terminal.currentParam = ch;\n }\n else if (this._terminal.prefix.length === 2) {\n this._terminal.currentParam = ch;\n }\n else {\n this._terminal.prefix += ch;\n }\n }\n else {\n this._terminal.currentParam += ch;\n }\n break;\n case ParserState.IGNORE:\n if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) {\n if (ch === EscapeSequences_1.C0.ESC)\n this._position++;\n this._state = ParserState.NORMAL;\n }\n break;\n }\n }\n return this._state;\n };\n Parser.prototype.setState = function (state) {\n this._state = state;\n };\n Parser.prototype.setPrefix = function (prefix) {\n this._terminal.prefix = prefix;\n };\n Parser.prototype.setPostfix = function (postfix) {\n this._terminal.postfix = postfix;\n };\n Parser.prototype.setParam = function (param) {\n this._terminal.currentParam = param;\n };\n Parser.prototype.getParam = function () {\n return this._terminal.currentParam;\n };\n Parser.prototype.finalizeParam = function () {\n this._terminal.params.push(this._terminal.currentParam);\n this._terminal.currentParam = 0;\n };\n Parser.prototype.skipNextChar = function () {\n this._position++;\n };\n return Parser;\n}());\nexports.Parser = Parser;\n\n//# sourceMappingURL=Parser.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Parser.js\n// module id = 19\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar DomElementObjectPool_1 = require(\"./utils/DomElementObjectPool\");\nvar MAX_REFRESH_FRAME_SKIP = 5;\nvar FLAGS;\n(function (FLAGS) {\n FLAGS[FLAGS[\"BOLD\"] = 1] = \"BOLD\";\n FLAGS[FLAGS[\"UNDERLINE\"] = 2] = \"UNDERLINE\";\n FLAGS[FLAGS[\"BLINK\"] = 4] = \"BLINK\";\n FLAGS[FLAGS[\"INVERSE\"] = 8] = \"INVERSE\";\n FLAGS[FLAGS[\"INVISIBLE\"] = 16] = \"INVISIBLE\";\n})(FLAGS || (FLAGS = {}));\n;\nvar brokenBold = null;\nvar Renderer = (function () {\n function Renderer(_terminal) {\n this._terminal = _terminal;\n this._refreshRowsQueue = [];\n this._refreshFramesSkipped = 0;\n this._refreshAnimationFrame = null;\n this._spanElementObjectPool = new DomElementObjectPool_1.DomElementObjectPool('span');\n if (brokenBold === null) {\n brokenBold = checkBoldBroken(this._terminal.element);\n }\n this._spanElementObjectPool = new DomElementObjectPool_1.DomElementObjectPool('span');\n }\n Renderer.prototype.queueRefresh = function (start, end) {\n this._refreshRowsQueue.push({ start: start, end: end });\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = window.requestAnimationFrame(this._refreshLoop.bind(this));\n }\n };\n Renderer.prototype._refreshLoop = function () {\n var skipFrame = this._terminal.writeBuffer.length > 0 && this._refreshFramesSkipped++ <= MAX_REFRESH_FRAME_SKIP;\n if (skipFrame) {\n this._refreshAnimationFrame = window.requestAnimationFrame(this._refreshLoop.bind(this));\n return;\n }\n this._refreshFramesSkipped = 0;\n var start;\n var end;\n if (this._refreshRowsQueue.length > 4) {\n start = 0;\n end = this._terminal.rows - 1;\n }\n else {\n start = this._refreshRowsQueue[0].start;\n end = this._refreshRowsQueue[0].end;\n for (var i = 1; i < this._refreshRowsQueue.length; i++) {\n if (this._refreshRowsQueue[i].start < start) {\n start = this._refreshRowsQueue[i].start;\n }\n if (this._refreshRowsQueue[i].end > end) {\n end = this._refreshRowsQueue[i].end;\n }\n }\n }\n this._refreshRowsQueue = [];\n this._refreshAnimationFrame = null;\n this._refresh(start, end);\n };\n Renderer.prototype._refresh = function (start, end) {\n var parent;\n if (end - start >= this._terminal.rows / 2) {\n parent = this._terminal.element.parentNode;\n if (parent) {\n this._terminal.element.removeChild(this._terminal.rowContainer);\n }\n }\n var width = this._terminal.cols;\n var y = start;\n if (end >= this._terminal.rows) {\n this._terminal.log('`end` is too large. Most likely a bad CSR.');\n end = this._terminal.rows - 1;\n }\n for (; y <= end; y++) {\n var row = y + this._terminal.ydisp;\n var line = this._terminal.lines.get(row);\n var x = void 0;\n if (this._terminal.y === y - (this._terminal.ybase - this._terminal.ydisp) &&\n this._terminal.cursorState &&\n !this._terminal.cursorHidden) {\n x = this._terminal.x;\n }\n else {\n x = -1;\n }\n var attr = this._terminal.defAttr;\n var documentFragment = document.createDocumentFragment();\n var innerHTML = '';\n var currentElement = void 0;\n while (this._terminal.children[y].children.length) {\n var child = this._terminal.children[y].children[0];\n this._terminal.children[y].removeChild(child);\n this._spanElementObjectPool.release(child);\n }\n for (var i = 0; i < width; i++) {\n var data = line[i][0];\n var ch = line[i][1];\n var ch_width = line[i][2];\n if (!ch_width) {\n continue;\n }\n if (i === x) {\n data = -1;\n }\n if (data !== attr) {\n if (attr !== this._terminal.defAttr) {\n if (innerHTML) {\n currentElement.innerHTML = innerHTML;\n innerHTML = '';\n }\n documentFragment.appendChild(currentElement);\n currentElement = null;\n }\n if (data !== this._terminal.defAttr) {\n if (innerHTML && !currentElement) {\n currentElement = this._spanElementObjectPool.acquire();\n }\n if (currentElement) {\n if (innerHTML) {\n currentElement.innerHTML = innerHTML;\n innerHTML = '';\n }\n documentFragment.appendChild(currentElement);\n }\n currentElement = this._spanElementObjectPool.acquire();\n if (data === -1) {\n currentElement.classList.add('reverse-video');\n currentElement.classList.add('terminal-cursor');\n }\n else {\n var bg = data & 0x1ff;\n var fg = (data >> 9) & 0x1ff;\n var flags = data >> 18;\n if (flags & FLAGS.BOLD) {\n if (!brokenBold) {\n currentElement.classList.add('xterm-bold');\n }\n if (fg < 8) {\n fg += 8;\n }\n }\n if (flags & FLAGS.UNDERLINE) {\n currentElement.classList.add('xterm-underline');\n }\n if (flags & FLAGS.BLINK) {\n currentElement.classList.add('xterm-blink');\n }\n if (flags & FLAGS.INVERSE) {\n var temp = bg;\n bg = fg;\n fg = temp;\n if ((flags & 1) && fg < 8) {\n fg += 8;\n }\n }\n if (flags & FLAGS.INVISIBLE) {\n currentElement.classList.add('xterm-hidden');\n }\n if (flags & FLAGS.INVERSE) {\n if (bg === 257) {\n bg = 15;\n }\n if (fg === 256) {\n fg = 0;\n }\n }\n if (bg < 256) {\n currentElement.classList.add(\"xterm-bg-color-\" + bg);\n }\n if (fg < 256) {\n currentElement.classList.add(\"xterm-color-\" + fg);\n }\n }\n }\n }\n if (ch_width === 2) {\n innerHTML += \"\" + ch + \"\";\n }\n else if (ch.charCodeAt(0) > 255) {\n innerHTML += \"\" + ch + \"\";\n }\n else {\n switch (ch) {\n case '&':\n innerHTML += '&';\n break;\n case '<':\n innerHTML += '<';\n break;\n case '>':\n innerHTML += '>';\n break;\n default:\n if (ch <= ' ') {\n innerHTML += ' ';\n }\n else {\n innerHTML += ch;\n }\n break;\n }\n }\n attr = data;\n }\n if (innerHTML && !currentElement) {\n currentElement = this._spanElementObjectPool.acquire();\n }\n if (currentElement) {\n if (innerHTML) {\n currentElement.innerHTML = innerHTML;\n innerHTML = '';\n }\n documentFragment.appendChild(currentElement);\n currentElement = null;\n }\n this._terminal.children[y].appendChild(documentFragment);\n }\n if (parent) {\n this._terminal.element.appendChild(this._terminal.rowContainer);\n }\n this._terminal.emit('refresh', { element: this._terminal.element, start: start, end: end });\n };\n ;\n Renderer.prototype.refreshSelection = function (start, end) {\n while (this._terminal.selectionContainer.children.length) {\n this._terminal.selectionContainer.removeChild(this._terminal.selectionContainer.children[0]);\n }\n if (!start || !end) {\n return;\n }\n var viewportStartRow = start[1] - this._terminal.ydisp;\n var viewportEndRow = end[1] - this._terminal.ydisp;\n var viewportCappedStartRow = Math.max(viewportStartRow, 0);\n var viewportCappedEndRow = Math.min(viewportEndRow, this._terminal.rows - 1);\n if (viewportCappedStartRow >= this._terminal.rows || viewportCappedEndRow < 0) {\n return;\n }\n var documentFragment = document.createDocumentFragment();\n var startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n var endCol = viewportCappedStartRow === viewportCappedEndRow ? end[0] : this._terminal.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow, startCol, endCol));\n var middleRowsCount = viewportCappedEndRow - viewportCappedStartRow - 1;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._terminal.cols, middleRowsCount));\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n var endCol_1 = viewportEndRow === viewportCappedEndRow ? end[0] : this._terminal.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, endCol_1));\n }\n this._terminal.selectionContainer.appendChild(documentFragment);\n };\n Renderer.prototype._createSelectionElement = function (row, colStart, colEnd, rowCount) {\n if (rowCount === void 0) { rowCount = 1; }\n var element = document.createElement('div');\n element.style.height = rowCount * this._terminal.charMeasure.height + \"px\";\n element.style.top = row * this._terminal.charMeasure.height + \"px\";\n element.style.left = colStart * this._terminal.charMeasure.width + \"px\";\n element.style.width = this._terminal.charMeasure.width * (colEnd - colStart) + \"px\";\n return element;\n };\n return Renderer;\n}());\nexports.Renderer = Renderer;\nfunction checkBoldBroken(terminal) {\n var document = terminal.ownerDocument;\n var el = document.createElement('span');\n el.innerHTML = 'hello world';\n terminal.appendChild(el);\n var w1 = el.offsetWidth;\n var h1 = el.offsetHeight;\n el.style.fontWeight = 'bold';\n var w2 = el.offsetWidth;\n var h2 = el.offsetHeight;\n terminal.removeChild(el);\n return w1 !== w2 || h1 !== h2;\n}\n\n//# sourceMappingURL=Renderer.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Renderer.js\n// module id = 20\n// module chunks = 0","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Mouse = require(\"./utils/Mouse\");\nvar Browser = require(\"./utils/Browser\");\nvar EventEmitter_1 = require(\"./EventEmitter\");\nvar SelectionModel_1 = require(\"./SelectionModel\");\nvar DRAG_SCROLL_MAX_THRESHOLD = 50;\nvar DRAG_SCROLL_MAX_SPEED = 15;\nvar DRAG_SCROLL_INTERVAL = 50;\nvar CLEAR_MOUSE_DOWN_TIME = 400;\nvar CLEAR_MOUSE_DISTANCE = 10;\nvar WORD_SEPARATORS = ' ()[]{}\\'\"';\nvar LINE_DATA_CHAR_INDEX = 1;\nvar LINE_DATA_WIDTH_INDEX = 2;\nvar NON_BREAKING_SPACE_CHAR = String.fromCharCode(160);\nvar ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g');\nvar SelectionMode;\n(function (SelectionMode) {\n SelectionMode[SelectionMode[\"NORMAL\"] = 0] = \"NORMAL\";\n SelectionMode[SelectionMode[\"WORD\"] = 1] = \"WORD\";\n SelectionMode[SelectionMode[\"LINE\"] = 2] = \"LINE\";\n})(SelectionMode || (SelectionMode = {}));\nvar SelectionManager = (function (_super) {\n __extends(SelectionManager, _super);\n function SelectionManager(_terminal, _buffer, _rowContainer, _charMeasure) {\n var _this = _super.call(this) || this;\n _this._terminal = _terminal;\n _this._buffer = _buffer;\n _this._rowContainer = _rowContainer;\n _this._charMeasure = _charMeasure;\n _this._initListeners();\n _this.enable();\n _this._model = new SelectionModel_1.SelectionModel(_terminal);\n _this._lastMouseDownTime = 0;\n _this._activeSelectionMode = SelectionMode.NORMAL;\n return _this;\n }\n SelectionManager.prototype._initListeners = function () {\n var _this = this;\n this._bufferTrimListener = function (amount) { return _this._onTrim(amount); };\n this._mouseMoveListener = function (event) { return _this._onMouseMove(event); };\n this._mouseDownListener = function (event) { return _this._onMouseDown(event); };\n this._mouseUpListener = function (event) { return _this._onMouseUp(event); };\n };\n SelectionManager.prototype.disable = function () {\n this.clearSelection();\n this._buffer.off('trim', this._bufferTrimListener);\n this._rowContainer.removeEventListener('mousedown', this._mouseDownListener);\n };\n SelectionManager.prototype.enable = function () {\n this._buffer.on('trim', this._bufferTrimListener);\n this._rowContainer.addEventListener('mousedown', this._mouseDownListener);\n };\n SelectionManager.prototype.setBuffer = function (buffer) {\n this._buffer = buffer;\n this.clearSelection();\n };\n Object.defineProperty(SelectionManager.prototype, \"hasSelection\", {\n get: function () {\n var start = this._model.finalSelectionStart;\n var end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SelectionManager.prototype, \"selectionText\", {\n get: function () {\n var start = this._model.finalSelectionStart;\n var end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return '';\n }\n var startRowEndCol = start[1] === end[1] ? end[0] : null;\n var result = [];\n result.push(this._translateBufferLineToString(this._buffer.get(start[1]), true, start[0], startRowEndCol));\n for (var i = start[1] + 1; i <= end[1] - 1; i++) {\n var bufferLine = this._buffer.get(i);\n var lineText = this._translateBufferLineToString(bufferLine, true);\n if (bufferLine.isWrapped) {\n result[result.length - 1] += lineText;\n }\n else {\n result.push(lineText);\n }\n }\n if (start[1] !== end[1]) {\n var bufferLine = this._buffer.get(end[1]);\n var lineText = this._translateBufferLineToString(bufferLine, true, 0, end[0]);\n if (bufferLine.isWrapped) {\n result[result.length - 1] += lineText;\n }\n else {\n result.push(lineText);\n }\n }\n var formattedResult = result.map(function (line) {\n return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');\n }).join(Browser.isMSWindows ? '\\r\\n' : '\\n');\n return formattedResult;\n },\n enumerable: true,\n configurable: true\n });\n SelectionManager.prototype.clearSelection = function () {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n };\n SelectionManager.prototype._translateBufferLineToString = function (line, trimRight, startCol, endCol) {\n if (startCol === void 0) { startCol = 0; }\n if (endCol === void 0) { endCol = null; }\n var lineString = '';\n var widthAdjustedStartCol = startCol;\n var widthAdjustedEndCol = endCol;\n for (var i = 0; i < line.length; i++) {\n var char = line[i];\n lineString += char[LINE_DATA_CHAR_INDEX];\n if (char[LINE_DATA_WIDTH_INDEX] === 0) {\n if (startCol >= i) {\n widthAdjustedStartCol--;\n }\n if (endCol >= i) {\n widthAdjustedEndCol--;\n }\n }\n }\n var finalEndCol = widthAdjustedEndCol || line.length;\n if (trimRight) {\n var rightWhitespaceIndex = lineString.search(/\\s+$/);\n if (rightWhitespaceIndex !== -1) {\n finalEndCol = Math.min(finalEndCol, rightWhitespaceIndex);\n }\n if (finalEndCol <= widthAdjustedStartCol) {\n return '';\n }\n }\n return lineString.substring(widthAdjustedStartCol, finalEndCol);\n };\n SelectionManager.prototype.refresh = function (isNewSelection) {\n var _this = this;\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = window.requestAnimationFrame(function () { return _this._refresh(); });\n }\n if (Browser.isLinux && isNewSelection) {\n var selectionText = this.selectionText;\n if (selectionText.length) {\n this.emit('newselection', this.selectionText);\n }\n }\n };\n SelectionManager.prototype._refresh = function () {\n this._refreshAnimationFrame = null;\n this.emit('refresh', { start: this._model.finalSelectionStart, end: this._model.finalSelectionEnd });\n };\n SelectionManager.prototype.selectAll = function () {\n this._model.isSelectAllActive = true;\n this.refresh();\n };\n SelectionManager.prototype._onTrim = function (amount) {\n var needsRefresh = this._model.onTrim(amount);\n if (needsRefresh) {\n this.refresh();\n }\n };\n SelectionManager.prototype._getMouseBufferCoords = function (event) {\n var coords = Mouse.getCoords(event, this._rowContainer, this._charMeasure, this._terminal.cols, this._terminal.rows, true);\n coords[0]--;\n coords[1]--;\n coords[1] += this._terminal.ydisp;\n return coords;\n };\n SelectionManager.prototype._getMouseEventScrollAmount = function (event) {\n var offset = Mouse.getCoordsRelativeToElement(event, this._rowContainer)[1];\n var terminalHeight = this._terminal.rows * this._charMeasure.height;\n if (offset >= 0 && offset <= terminalHeight) {\n return 0;\n }\n if (offset > terminalHeight) {\n offset -= terminalHeight;\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 SelectionManager.prototype._onMouseDown = function (event) {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n this._dragScrollAmount = 0;\n this._setMouseClickCount(event);\n if (event.shiftKey) {\n this._onShiftClick(event);\n }\n else {\n if (this._clickCount === 1) {\n this._onSingleClick(event);\n }\n else if (this._clickCount === 2) {\n this._onDoubleClick(event);\n }\n else if (this._clickCount === 3) {\n this._onTripleClick(event);\n }\n }\n this._addMouseDownListeners();\n this.refresh(true);\n };\n SelectionManager.prototype._addMouseDownListeners = function () {\n var _this = this;\n this._rowContainer.ownerDocument.addEventListener('mousemove', this._mouseMoveListener);\n this._rowContainer.ownerDocument.addEventListener('mouseup', this._mouseUpListener);\n this._dragScrollIntervalTimer = setInterval(function () { return _this._dragScroll(); }, DRAG_SCROLL_INTERVAL);\n };\n SelectionManager.prototype._removeMouseDownListeners = function () {\n this._rowContainer.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener);\n this._rowContainer.ownerDocument.removeEventListener('mouseup', this._mouseUpListener);\n clearInterval(this._dragScrollIntervalTimer);\n this._dragScrollIntervalTimer = null;\n };\n SelectionManager.prototype._onShiftClick = function (event) {\n if (this._model.selectionStart) {\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n }\n };\n SelectionManager.prototype._onSingleClick = function (event) {\n this._model.selectionStartLength = 0;\n this._model.isSelectAllActive = false;\n this._activeSelectionMode = SelectionMode.NORMAL;\n this._model.selectionStart = this._getMouseBufferCoords(event);\n if (this._model.selectionStart) {\n this._model.selectionEnd = null;\n var char = this._buffer.get(this._model.selectionStart[1])[this._model.selectionStart[0]];\n if (char[LINE_DATA_WIDTH_INDEX] === 0) {\n this._model.selectionStart[0]++;\n }\n }\n };\n SelectionManager.prototype._onDoubleClick = function (event) {\n var coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.WORD;\n this._selectWordAt(coords);\n }\n };\n SelectionManager.prototype._onTripleClick = function (event) {\n var coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.LINE;\n this._selectLineAt(coords[1]);\n }\n };\n SelectionManager.prototype._setMouseClickCount = function (event) {\n var currentTime = (new Date()).getTime();\n if (currentTime - this._lastMouseDownTime > CLEAR_MOUSE_DOWN_TIME || this._distanceFromLastMousePosition(event) > CLEAR_MOUSE_DISTANCE) {\n this._clickCount = 0;\n }\n this._lastMouseDownTime = currentTime;\n this._lastMousePosition = [event.pageX, event.pageY];\n this._clickCount++;\n };\n SelectionManager.prototype._distanceFromLastMousePosition = function (event) {\n var result = Math.max(Math.abs(this._lastMousePosition[0] - event.pageX), Math.abs(this._lastMousePosition[1] - event.pageY));\n return result;\n };\n SelectionManager.prototype._onMouseMove = function (event) {\n var previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n if (this._activeSelectionMode === SelectionMode.LINE) {\n if (this._model.selectionEnd[1] < this._model.selectionStart[1]) {\n this._model.selectionEnd[0] = 0;\n }\n else {\n this._model.selectionEnd[0] = this._terminal.cols;\n }\n }\n else if (this._activeSelectionMode === SelectionMode.WORD) {\n this._selectToWordAt(this._model.selectionEnd);\n }\n this._dragScrollAmount = this._getMouseEventScrollAmount(event);\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd[0] = this._terminal.cols - 1;\n }\n else if (this._dragScrollAmount < 0) {\n this._model.selectionEnd[0] = 0;\n }\n if (this._model.selectionEnd[1] < this._buffer.length) {\n var char = this._buffer.get(this._model.selectionEnd[1])[this._model.selectionEnd[0]];\n if (char && char[2] === 0) {\n this._model.selectionEnd[0]++;\n }\n }\n if (!previousSelectionEnd ||\n previousSelectionEnd[0] !== this._model.selectionEnd[0] ||\n previousSelectionEnd[1] !== this._model.selectionEnd[1]) {\n this.refresh(true);\n }\n };\n SelectionManager.prototype._dragScroll = function () {\n if (this._dragScrollAmount) {\n this._terminal.scrollDisp(this._dragScrollAmount, false);\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd = [this._terminal.cols - 1, this._terminal.ydisp + this._terminal.rows];\n }\n else {\n this._model.selectionEnd = [0, this._terminal.ydisp];\n }\n this.refresh();\n }\n };\n SelectionManager.prototype._onMouseUp = function (event) {\n this._removeMouseDownListeners();\n };\n SelectionManager.prototype._convertViewportColToCharacterIndex = function (bufferLine, coords) {\n var charIndex = coords[0];\n for (var i = 0; coords[0] >= i; i++) {\n var char = bufferLine[i];\n if (char[LINE_DATA_WIDTH_INDEX] === 0) {\n charIndex--;\n }\n }\n return charIndex;\n };\n SelectionManager.prototype._getWordAt = function (coords) {\n var bufferLine = this._buffer.get(coords[1]);\n var line = this._translateBufferLineToString(bufferLine, false);\n var endIndex = this._convertViewportColToCharacterIndex(bufferLine, coords);\n var startIndex = endIndex;\n var charOffset = coords[0] - startIndex;\n var leftWideCharCount = 0;\n var rightWideCharCount = 0;\n if (line.charAt(startIndex) === ' ') {\n while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') {\n startIndex--;\n }\n while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') {\n endIndex++;\n }\n }\n else {\n var startCol = coords[0];\n var endCol = coords[0];\n if (bufferLine[startCol][LINE_DATA_WIDTH_INDEX] === 0) {\n leftWideCharCount++;\n startCol--;\n }\n if (bufferLine[endCol][LINE_DATA_WIDTH_INDEX] === 2) {\n rightWideCharCount++;\n endCol++;\n }\n while (startIndex > 0 && !this._isCharWordSeparator(line.charAt(startIndex - 1))) {\n if (bufferLine[startCol - 1][LINE_DATA_WIDTH_INDEX] === 0) {\n leftWideCharCount++;\n startCol--;\n }\n startIndex--;\n startCol--;\n }\n while (endIndex + 1 < line.length && !this._isCharWordSeparator(line.charAt(endIndex + 1))) {\n if (bufferLine[endCol + 1][LINE_DATA_WIDTH_INDEX] === 2) {\n rightWideCharCount++;\n endCol++;\n }\n endIndex++;\n endCol++;\n }\n }\n var start = startIndex + charOffset - leftWideCharCount;\n var length = Math.min(endIndex - startIndex + leftWideCharCount + rightWideCharCount + 1, this._terminal.cols);\n return { start: start, length: length };\n };\n SelectionManager.prototype._selectWordAt = function (coords) {\n var wordPosition = this._getWordAt(coords);\n this._model.selectionStart = [wordPosition.start, coords[1]];\n this._model.selectionStartLength = wordPosition.length;\n };\n SelectionManager.prototype._selectToWordAt = function (coords) {\n var wordPosition = this._getWordAt(coords);\n this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : (wordPosition.start + wordPosition.length), coords[1]];\n };\n SelectionManager.prototype._isCharWordSeparator = function (char) {\n return WORD_SEPARATORS.indexOf(char) >= 0;\n };\n SelectionManager.prototype._selectLineAt = function (line) {\n this._model.selectionStart = [0, line];\n this._model.selectionStartLength = this._terminal.cols;\n };\n return SelectionManager;\n}(EventEmitter_1.EventEmitter));\nexports.SelectionManager = SelectionManager;\n\n//# sourceMappingURL=SelectionManager.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/SelectionManager.js\n// module id = 21\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar SelectionModel = (function () {\n function SelectionModel(_terminal) {\n this._terminal = _terminal;\n this.clearSelection();\n }\n SelectionModel.prototype.clearSelection = function () {\n this.selectionStart = null;\n this.selectionEnd = null;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n };\n Object.defineProperty(SelectionModel.prototype, \"finalSelectionStart\", {\n get: function () {\n if (this.isSelectAllActive) {\n return [0, 0];\n }\n if (!this.selectionEnd || !this.selectionStart) {\n return this.selectionStart;\n }\n return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SelectionModel.prototype, \"finalSelectionEnd\", {\n get: function () {\n if (this.isSelectAllActive) {\n return [this._terminal.cols, this._terminal.ybase + this._terminal.rows - 1];\n }\n if (!this.selectionStart) {\n return null;\n }\n if (!this.selectionEnd || this.areSelectionValuesReversed()) {\n return [this.selectionStart[0] + this.selectionStartLength, this.selectionStart[1]];\n }\n if (this.selectionStartLength) {\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 enumerable: true,\n configurable: true\n });\n SelectionModel.prototype.areSelectionValuesReversed = function () {\n var start = this.selectionStart;\n var end = this.selectionEnd;\n return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);\n };\n SelectionModel.prototype.onTrim = function (amount) {\n if (this.selectionStart) {\n this.selectionStart[1] -= amount;\n }\n if (this.selectionEnd) {\n this.selectionEnd[1] -= amount;\n }\n if (this.selectionEnd && this.selectionEnd[1] < 0) {\n this.clearSelection();\n return true;\n }\n if (this.selectionStart && this.selectionStart[1] < 0) {\n this.selectionStart[1] = 0;\n }\n return false;\n };\n return SelectionModel;\n}());\nexports.SelectionModel = SelectionModel;\n\n//# sourceMappingURL=SelectionModel.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/SelectionModel.js\n// module id = 22\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Viewport = (function () {\n function Viewport(terminal, viewportElement, scrollArea, charMeasure) {\n var _this = this;\n this.terminal = terminal;\n this.viewportElement = viewportElement;\n this.scrollArea = scrollArea;\n this.charMeasure = charMeasure;\n this.currentRowHeight = 0;\n this.lastRecordedBufferLength = 0;\n this.lastRecordedViewportHeight = 0;\n this.terminal.on('scroll', this.syncScrollArea.bind(this));\n this.terminal.on('resize', this.syncScrollArea.bind(this));\n this.viewportElement.addEventListener('scroll', this.onScroll.bind(this));\n setTimeout(function () { return _this.syncScrollArea(); }, 0);\n }\n Viewport.prototype.refresh = function () {\n if (this.charMeasure.height > 0) {\n var rowHeightChanged = this.charMeasure.height !== this.currentRowHeight;\n if (rowHeightChanged) {\n this.currentRowHeight = this.charMeasure.height;\n this.viewportElement.style.lineHeight = this.charMeasure.height + 'px';\n this.terminal.rowContainer.style.lineHeight = this.charMeasure.height + 'px';\n }\n var viewportHeightChanged = this.lastRecordedViewportHeight !== this.terminal.rows;\n if (rowHeightChanged || viewportHeightChanged) {\n this.lastRecordedViewportHeight = this.terminal.rows;\n this.viewportElement.style.height = this.charMeasure.height * this.terminal.rows + 'px';\n this.terminal.selectionContainer.style.height = this.viewportElement.style.height;\n }\n this.scrollArea.style.height = (this.charMeasure.height * this.lastRecordedBufferLength) + 'px';\n }\n };\n Viewport.prototype.syncScrollArea = function () {\n if (this.lastRecordedBufferLength !== this.terminal.lines.length) {\n this.lastRecordedBufferLength = this.terminal.lines.length;\n this.refresh();\n }\n else if (this.lastRecordedViewportHeight !== this.terminal.rows) {\n this.refresh();\n }\n else {\n if (this.charMeasure.height !== this.currentRowHeight) {\n this.refresh();\n }\n }\n var scrollTop = this.terminal.ydisp * this.currentRowHeight;\n if (this.viewportElement.scrollTop !== scrollTop) {\n this.viewportElement.scrollTop = scrollTop;\n }\n };\n Viewport.prototype.onScroll = function (ev) {\n var newRow = Math.round(this.viewportElement.scrollTop / this.currentRowHeight);\n var diff = newRow - this.terminal.ydisp;\n this.terminal.scrollDisp(diff, true);\n };\n Viewport.prototype.onWheel = function (ev) {\n if (ev.deltaY === 0) {\n return;\n }\n var multiplier = 1;\n if (ev.deltaMode === WheelEvent.DOM_DELTA_LINE) {\n multiplier = this.currentRowHeight;\n }\n else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n multiplier = this.currentRowHeight * this.terminal.rows;\n }\n this.viewportElement.scrollTop += ev.deltaY * multiplier;\n ev.preventDefault();\n };\n ;\n Viewport.prototype.onTouchStart = function (ev) {\n this.lastTouchY = ev.touches[0].pageY;\n };\n ;\n Viewport.prototype.onTouchMove = function (ev) {\n var deltaY = this.lastTouchY - ev.touches[0].pageY;\n this.lastTouchY = ev.touches[0].pageY;\n if (deltaY === 0) {\n return;\n }\n this.viewportElement.scrollTop += deltaY;\n ev.preventDefault();\n };\n ;\n return Viewport;\n}());\nexports.Viewport = Viewport;\n\n//# sourceMappingURL=Viewport.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Viewport.js\n// module id = 23\n// module chunks = 0","var map = {\n\t\"./attach/attach\": 4,\n\t\"./attach/attach.js\": 4,\n\t\"./attach/package.json\": 25,\n\t\"./fit/fit\": 5,\n\t\"./fit/fit.js\": 5,\n\t\"./fit/package.json\": 26,\n\t\"./fullscreen/fullscreen\": 6,\n\t\"./fullscreen/fullscreen.css\": 27,\n\t\"./fullscreen/fullscreen.js\": 6,\n\t\"./fullscreen/package.json\": 28,\n\t\"./terminado/package.json\": 29,\n\t\"./terminado/terminado\": 7,\n\t\"./terminado/terminado.js\": 7\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 24;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons ^\\.\\/.*$\n// module id = 24\n// module chunks = 0","module.exports = {\"name\":\"xterm.attach\",\"main\":\"attach.js\",\"private\":true}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/attach/package.json\n// module id = 25\n// module chunks = 0","module.exports = {\"name\":\"xterm.fit\",\"main\":\"fit.js\",\"private\":true}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/fit/package.json\n// module id = 26\n// module chunks = 0","module.exports = {\"name\":\"xterm.fullscreen\",\"main\":\"fullscreen.js\",\"private\":true}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/fullscreen/package.json\n// module id = 28\n// module chunks = 0","module.exports = {\"name\":\"xterm.terminado\",\"main\":\"terminado.js\",\"private\":true}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/terminado/package.json\n// module id = 29\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction prepareTextForTerminal(text, isMSWindows) {\n if (isMSWindows) {\n return text.replace(/\\r?\\n/g, '\\r');\n }\n return text;\n}\nexports.prepareTextForTerminal = prepareTextForTerminal;\nfunction copyHandler(ev, term, selectionManager) {\n if (term.browser.isMSIE) {\n window.clipboardData.setData('Text', selectionManager.selectionText);\n }\n else {\n ev.clipboardData.setData('text/plain', selectionManager.selectionText);\n }\n ev.preventDefault();\n}\nexports.copyHandler = copyHandler;\nfunction pasteHandler(ev, term) {\n ev.stopPropagation();\n var text;\n var dispatchPaste = function (text) {\n text = prepareTextForTerminal(text, term.browser.isMSWindows);\n term.handler(text);\n term.textarea.value = '';\n term.emit('paste', text);\n return term.cancel(ev);\n };\n if (term.browser.isMSIE) {\n if (window.clipboardData) {\n text = window.clipboardData.getData('Text');\n dispatchPaste(text);\n }\n }\n else {\n if (ev.clipboardData) {\n text = ev.clipboardData.getData('text/plain');\n dispatchPaste(text);\n }\n }\n}\nexports.pasteHandler = pasteHandler;\nfunction moveTextAreaUnderMouseCursor(ev, textarea) {\n textarea.style.position = 'fixed';\n textarea.style.width = '20px';\n textarea.style.height = '20px';\n textarea.style.left = (ev.clientX - 10) + 'px';\n textarea.style.top = (ev.clientY - 10) + 'px';\n textarea.style.zIndex = '1000';\n textarea.focus();\n setTimeout(function () {\n textarea.style.position = null;\n textarea.style.width = null;\n textarea.style.height = null;\n textarea.style.left = null;\n textarea.style.top = null;\n textarea.style.zIndex = null;\n }, 4);\n}\nexports.moveTextAreaUnderMouseCursor = moveTextAreaUnderMouseCursor;\nfunction rightClickHandler(ev, textarea, selectionManager) {\n moveTextAreaUnderMouseCursor(ev, textarea);\n textarea.value = selectionManager.selectionText;\n textarea.select();\n}\nexports.rightClickHandler = rightClickHandler;\n\n//# sourceMappingURL=Clipboard.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/handlers/Clipboard.js\n// module id = 30\n// module chunks = 0","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EventEmitter_js_1 = require(\"../EventEmitter.js\");\nvar CharMeasure = (function (_super) {\n __extends(CharMeasure, _super);\n function CharMeasure(document, parentElement) {\n var _this = _super.call(this) || this;\n _this._document = document;\n _this._parentElement = parentElement;\n return _this;\n }\n Object.defineProperty(CharMeasure.prototype, \"width\", {\n get: function () {\n return this._width;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CharMeasure.prototype, \"height\", {\n get: function () {\n return this._height;\n },\n enumerable: true,\n configurable: true\n });\n CharMeasure.prototype.measure = function () {\n var _this = this;\n if (!this._measureElement) {\n this._measureElement = this._document.createElement('span');\n this._measureElement.style.position = 'absolute';\n this._measureElement.style.top = '0';\n this._measureElement.style.left = '-9999em';\n this._measureElement.textContent = 'W';\n this._measureElement.setAttribute('aria-hidden', 'true');\n this._parentElement.appendChild(this._measureElement);\n setTimeout(function () { return _this._doMeasure(); }, 0);\n }\n else {\n this._doMeasure();\n }\n };\n CharMeasure.prototype._doMeasure = function () {\n var geometry = this._measureElement.getBoundingClientRect();\n if (geometry.width === 0 || geometry.height === 0) {\n return;\n }\n if (this._width !== geometry.width || this._height !== geometry.height) {\n this._width = geometry.width;\n this._height = geometry.height;\n this.emit('charsizechanged');\n }\n };\n return CharMeasure;\n}(EventEmitter_js_1.EventEmitter));\nexports.CharMeasure = CharMeasure;\n\n//# sourceMappingURL=CharMeasure.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/CharMeasure.js\n// module id = 31\n// module chunks = 0","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EventEmitter_1 = require(\"../EventEmitter\");\nvar CircularList = (function (_super) {\n __extends(CircularList, _super);\n function CircularList(maxLength) {\n var _this = _super.call(this) || this;\n _this._array = new Array(maxLength);\n _this._startIndex = 0;\n _this._length = 0;\n return _this;\n }\n Object.defineProperty(CircularList.prototype, \"maxLength\", {\n get: function () {\n return this._array.length;\n },\n set: function (newMaxLength) {\n var newArray = new Array(newMaxLength);\n for (var i = 0; i < Math.min(newMaxLength, this.length); i++) {\n newArray[i] = this._array[this._getCyclicIndex(i)];\n }\n this._array = newArray;\n this._startIndex = 0;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CircularList.prototype, \"length\", {\n get: function () {\n return this._length;\n },\n set: function (newLength) {\n if (newLength > this._length) {\n for (var i = this._length; i < newLength; i++) {\n this._array[i] = undefined;\n }\n }\n this._length = newLength;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CircularList.prototype, \"forEach\", {\n get: function () {\n var _this = this;\n return function (callbackfn) {\n var i = 0;\n var length = _this.length;\n for (var i_1 = 0; i_1 < length; i_1++) {\n callbackfn(_this.get(i_1), i_1);\n }\n };\n },\n enumerable: true,\n configurable: true\n });\n CircularList.prototype.get = function (index) {\n return this._array[this._getCyclicIndex(index)];\n };\n CircularList.prototype.set = function (index, value) {\n this._array[this._getCyclicIndex(index)] = value;\n };\n CircularList.prototype.push = function (value) {\n this._array[this._getCyclicIndex(this._length)] = value;\n if (this._length === this.maxLength) {\n this._startIndex++;\n if (this._startIndex === this.maxLength) {\n this._startIndex = 0;\n }\n this.emit('trim', 1);\n }\n else {\n this._length++;\n }\n };\n CircularList.prototype.pop = function () {\n return this._array[this._getCyclicIndex(this._length-- - 1)];\n };\n CircularList.prototype.splice = function (start, deleteCount) {\n var items = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n items[_i - 2] = arguments[_i];\n }\n if (deleteCount) {\n for (var 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 }\n if (items && items.length) {\n for (var i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (var i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (this._length + items.length > this.maxLength) {\n var countToTrim = (this._length + items.length) - this.maxLength;\n this._startIndex += countToTrim;\n this._length = this.maxLength;\n this.emit('trim', countToTrim);\n }\n else {\n this._length += items.length;\n }\n }\n };\n CircularList.prototype.trimStart = function (count) {\n if (count > this._length) {\n count = this._length;\n }\n this._startIndex += count;\n this._length -= count;\n this.emit('trim', count);\n };\n CircularList.prototype.shiftElements = function (start, count, offset) {\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 if (offset > 0) {\n for (var i = count - 1; i >= 0; i--) {\n this.set(start + i + offset, this.get(start + i));\n }\n var 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.emit('trim', 1);\n }\n }\n }\n else {\n for (var i = 0; i < count; i++) {\n this.set(start + i + offset, this.get(start + i));\n }\n }\n };\n CircularList.prototype._getCyclicIndex = function (index) {\n return (this._startIndex + index) % this.maxLength;\n };\n return CircularList;\n}(EventEmitter_1.EventEmitter));\nexports.CircularList = CircularList;\n\n//# sourceMappingURL=CircularList.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/CircularList.js\n// module id = 32\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar DomElementObjectPool = (function () {\n function DomElementObjectPool(type) {\n this.type = type;\n this._type = type;\n this._pool = [];\n this._inUse = {};\n }\n DomElementObjectPool.prototype.acquire = function () {\n var element;\n if (this._pool.length === 0) {\n element = this._createNew();\n }\n else {\n element = this._pool.pop();\n }\n this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)] = element;\n return element;\n };\n DomElementObjectPool.prototype.release = function (element) {\n if (!this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)]) {\n throw new Error('Could not release an element not yet acquired');\n }\n delete this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)];\n this._cleanElement(element);\n this._pool.push(element);\n };\n DomElementObjectPool.prototype._createNew = function () {\n var element = document.createElement(this._type);\n var id = DomElementObjectPool._objectCount++;\n element.setAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE, id.toString(10));\n return element;\n };\n DomElementObjectPool.prototype._cleanElement = function (element) {\n element.className = '';\n element.innerHTML = '';\n };\n return DomElementObjectPool;\n}());\nDomElementObjectPool.OBJECT_ID_ATTRIBUTE = 'data-obj-id';\nDomElementObjectPool._objectCount = 0;\nexports.DomElementObjectPool = DomElementObjectPool;\n\n//# sourceMappingURL=DomElementObjectPool.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/DomElementObjectPool.js\n// module id = 33\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction contains(arr, el) {\n return arr.indexOf(el) >= 0;\n}\nexports.contains = contains;\n;\n\n//# sourceMappingURL=Generic.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/Generic.js\n// module id = 34\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap e07bf020f10a44c91562","webpack:///./~/xterm/lib/xterm.js","webpack:///./~/xterm/lib/EventEmitter.js","webpack:///./~/xterm/lib/EscapeSequences.js","webpack:///./~/xterm/lib/Charsets.js","webpack:///./~/xterm/lib/addons/attach/attach.js","webpack:///./~/xterm/lib/addons/fit/fit.js","webpack:///./~/xterm/lib/addons/fullscreen/fullscreen.js","webpack:///./~/xterm/lib/addons/terminado/terminado.js","webpack:///./~/xterm/lib/utils/Browser.js","webpack:///./~/xterm/lib/utils/Mouse.js","webpack:///./src/hterm.ts","webpack:///./src/websocket.ts","webpack:///./src/webtty.ts","webpack:///./src/xterm.ts","webpack:///./~/libapps/hterm/dist/js/hterm_module.js","webpack:///./src/main.ts","webpack:///./~/xterm/lib/CompositionHelper.js","webpack:///./~/xterm/lib/InputHandler.js","webpack:///./~/xterm/lib/Linkifier.js","webpack:///./~/xterm/lib/Parser.js","webpack:///./~/xterm/lib/Renderer.js","webpack:///./~/xterm/lib/SelectionManager.js","webpack:///./~/xterm/lib/SelectionModel.js","webpack:///./~/xterm/lib/Viewport.js","webpack:///./~/xterm/lib/addons ^\\.\\/.*$","webpack:///./~/xterm/lib/addons/attach/package.json","webpack:///./~/xterm/lib/addons/fit/package.json","webpack:///./~/xterm/lib/addons/fullscreen/package.json","webpack:///./~/xterm/lib/addons/terminado/package.json","webpack:///./~/xterm/lib/handlers/Clipboard.js","webpack:///./~/xterm/lib/utils/CharMeasure.js","webpack:///./~/xterm/lib/utils/CircularList.js","webpack:///./~/xterm/lib/utils/DomElementObjectPool.js","webpack:///./~/xterm/lib/utils/Generic.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AChEA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA,UAAU,QAAQ;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,UAAU,SAAS;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,iBAAiB;AAC7C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,gDAAgD,8CAA8C;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,iBAAiB;AAC7C,KAAK;AACL;AACA,2BAA2B,iBAAiB;AAC5C,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL,mCAAmC,yCAAyC,EAAE;AAC9E,iEAAiE,yCAAyC,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,4CAA4C;AACtE,iCAAiC,wCAAwC;AACzE,gCAAgC,0CAA0C;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,cAAc;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,iEAAiE;AACjE,wHAAwH;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,iEAAiE;AACjE,wHAAwH;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,iEAAiE;AACjE,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,iEAAiE;AACjE,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,mCAAmC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,eAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,6BAA6B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;AC5lDA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AC1DA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,qCAAqC;AACtC;;AAEA;;;;;;;;ACzCA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;;AAEA;;;;;;;AChKA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,UAAU;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;AC7HD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B;AAC/B;AACA,kCAAkC;AAClC;AACA;;AAEA;AACA;;AAEA,gBAAgB;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;ACrFD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;ACjDD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB,aAAa,UAAU;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB,aAAa,QAAQ;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;;;;;;;ACtID;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACdA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;;;;;;;;;;ACnCA,mCAAgC;AAEhC;IAYI,eAAY,IAAiB;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1D,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAAA,CAAC;IAEF,oBAAI,GAAJ;QACI,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACtD,CAAC;IAAA,CAAC;IAEF,sBAAM,GAAN,UAAO,IAAY;QACf,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,2BAAW,GAAX,UAAY,OAAe,EAAE,OAAe;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,6BAAa,GAAb;QACI,iEAAiE;QACjE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,8BAAc,GAAd,UAAe,KAAa;QACxB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAAA,CAAC;IAEF,8BAAc,GAAd,UAAe,KAAa;QAA5B,iBAIC;QAHG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YAC3B,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IAEF,uBAAO,GAAP,UAAQ,QAAiC;QACrC,IAAI,CAAC,EAAE,CAAC,aAAa,GAAG,UAAC,IAAI;YACzB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC;QACF,IAAI,CAAC,EAAE,CAAC,UAAU,GAAG,UAAC,IAAI;YACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC;IACN,CAAC;IAAA,CAAC;IAEF,wBAAQ,GAAR,UAAS,QAAiD;QAA1D,iBAMC;QALG,IAAI,CAAC,EAAE,CAAC,gBAAgB,GAAG,UAAC,OAAe,EAAE,IAAY;YACrD,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACN,CAAC;IAAA,CAAC;IAEF,0BAAU,GAAV;QACI,IAAI,CAAC,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,UAAU,GAAG,IAAI;QACzB,IAAI,CAAC,EAAE,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IAED,qBAAK,GAAL;QACI,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAED,qBAAK,GAAL;QACI,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IACL,YAAC;AAAD,CAAC;AAzFY,sBAAK;;;;;;;;;;ACFlB;IAII,2BAAY,GAAW,EAAE,SAAmB;QACxC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF,kCAAM,GAAN;QACI,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAAA,CAAC;IACN,wBAAC;AAAD,CAAC;AAZY,8CAAiB;AAc9B;IAII,oBAAY,GAAW,EAAE,SAAmB;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,yBAAI,GAAJ;QACI,6BAA6B;IACjC,CAAC;IAAA,CAAC;IAEF,0BAAK,GAAL;QACI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAAA,CAAC;IAEF,yBAAI,GAAJ,UAAK,IAAY;QACb,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAAA,CAAC;IAEF,2BAAM,GAAN;QACI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU;YAC5C,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YACzC,MAAM,CAAC,IAAI;QACf,CAAC;QACD,MAAM,CAAC,KAAK;IAChB,CAAC;IAED,2BAAM,GAAN,UAAO,QAAoB;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,UAAC,KAAK;YACrB,QAAQ,EAAE,CAAC;QACf,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,8BAAS,GAAT,UAAU,QAAgC;QACtC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,UAAC,KAAK;YACxB,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,4BAAO,GAAP,UAAQ,QAAoB;QACxB,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,UAAC,KAAK;YACtB,QAAQ,EAAE,CAAC;QACf,CAAC,CAAC;IACN,CAAC;IAAA,CAAC;IACN,iBAAC;AAAD,CAAC;AA7CY,gCAAU;;;;;;;;;;ACdV,iBAAS,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEvB,uBAAe,GAAG,GAAG,CAAC;AACtB,gBAAQ,GAAG,GAAG,CAAC;AACf,eAAO,GAAG,GAAG,CAAC;AACd,yBAAiB,GAAG,GAAG,CAAC;AAExB,wBAAgB,GAAG,GAAG,CAAC;AACvB,iBAAS,GAAG,GAAG,CAAC;AAChB,eAAO,GAAG,GAAG,CAAC;AACd,yBAAiB,GAAG,GAAG,CAAC;AACxB,yBAAiB,GAAG,GAAG,CAAC;AACxB,uBAAe,GAAG,GAAG,CAAC;AAgCnC;IAOI,gBAAY,IAAc,EAAE,iBAAoC,EAAE,IAAY,EAAE,SAAiB;QAC7F,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACxB,CAAC;IAAA,CAAC;IAEF,qBAAI,GAAJ;QAAA,iBA2FC;QA1FG,IAAI,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;QACjD,IAAI,SAAiB,CAAC;QACtB,IAAI,gBAAwB,CAAC;QAE7B,IAAM,KAAK,GAAG;YACV,UAAU,CAAC,MAAM,CAAC;gBACd,IAAM,QAAQ,GAAG,KAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAElC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAC1B;oBACI,SAAS,EAAE,KAAI,CAAC,IAAI;oBACpB,SAAS,EAAE,KAAI,CAAC,SAAS;iBAC5B,CACJ,CAAC,CAAC;gBAGH,IAAM,aAAa,GAAG,UAAC,OAAe,EAAE,IAAY;oBAChD,UAAU,CAAC,IAAI,CACX,yBAAiB,GAAG,IAAI,CAAC,SAAS,CAC9B;wBACI,OAAO,EAAE,OAAO;wBAChB,IAAI,EAAE,IAAI;qBACb,CACJ,CACJ,CAAC;gBACN,CAAC,CAAC;gBAEF,KAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;gBAClC,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAE/C,KAAI,CAAC,IAAI,CAAC,OAAO,CACb,UAAC,KAAa;oBACV,UAAU,CAAC,IAAI,CAAC,gBAAQ,GAAG,KAAK,CAAC,CAAC;gBACtC,CAAC,CACJ,CAAC;gBAEF,SAAS,GAAG,WAAW,CAAC;oBACpB,UAAU,CAAC,IAAI,CAAC,eAAO,CAAC;gBAC5B,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;YAElB,CAAC,CAAC,CAAC;YAEH,UAAU,CAAC,SAAS,CAAC,UAAC,IAAI;gBACtB,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC9B,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACd,KAAK,iBAAS;wBACV,KAAI,CAAC,IAAI,CAAC,MAAM,CACZ,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAS,CAAC;4BACjE,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBACjE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CACf,CAAC;wBACF,KAAK,CAAC;oBACV,KAAK,eAAO;wBACR,KAAK,CAAC;oBACV,KAAK,yBAAiB;wBAClB,KAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;wBAClC,KAAK,CAAC;oBACV,KAAK,yBAAiB;wBAClB,IAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;wBACxC,KAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;wBACtC,KAAK,CAAC;oBACV,KAAK,uBAAe;wBAChB,IAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;wBAC1C,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,aAAa,GAAG,UAAU,CAAC;wBAChE,KAAI,CAAC,SAAS,GAAG,aAAa,CAAC;wBAC/B,KAAK,CAAC;gBACd,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,UAAU,CAAC,OAAO,CAAC;gBACf,aAAa,CAAC,SAAS,CAAC,CAAC;gBACzB,KAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACvB,KAAI,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;gBAC9C,EAAE,CAAC,CAAC,KAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;oBACrB,gBAAgB,GAAG,UAAU,CAAC;wBAC1B,UAAU,GAAG,KAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;wBAC7C,KAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;wBAClB,KAAK,EAAE,CAAC;oBACZ,CAAC,EAAE,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,UAAU,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QAED,KAAK,EAAE,CAAC;QACR,MAAM,CAAC;YACH,YAAY,CAAC,gBAAgB,CAAC,CAAC;YAC/B,UAAU,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;IACL,CAAC;IAAA,CAAC;IACN,aAAC;AAAD,CAAC;AA3GY,wBAAM;AA2GlB,CAAC;;;;;;;;;;ACvJF,kCAA8B;AAE9B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEtB;IAUI,eAAY,IAAiB;QAA7B,iBAqBC;QApBG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAEvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,eAAe,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAG3B,IAAI,CAAC,cAAc,GAAG;YAClB,KAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAChB,KAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YAC3B,KAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAI,CAAC,cAAc,CAAC,CAAC;QACjG,CAAC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;YACjB,KAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,cAAQ,KAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF,oBAAI,GAAJ;QACI,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC7D,CAAC;IAAA,CAAC;IAEF,sBAAM,GAAN,UAAO,IAAY;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAA,CAAC;IAEF,2BAAW,GAAX,UAAY,OAAe,EAAE,OAAe;QAA5C,iBAYC;QAXG,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEpC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YACpB,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC;QACD,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;gBAC3B,KAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAI,CAAC,OAAO,CAAC,CAAC;YACxC,CAAC,EAAE,OAAO,CAAC,CAAC;QAChB,CAAC;IACL,CAAC;IAAA,CAAC;IAEF,6BAAa,GAAb;QACI,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;IACL,CAAC;IAED,8BAAc,GAAd,UAAe,KAAa;QACxB,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,CAAC;IAAA,CAAC;IAEF,8BAAc,GAAd,UAAe,KAAa;IAC5B,CAAC;IAAA,CAAC;IAEF,uBAAO,GAAP,UAAQ,QAAiC;QACrC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;YACtB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IAEP,CAAC;IAAA,CAAC;IAEF,wBAAQ,GAAR,UAAS,QAAiD;QACtD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAC,IAAI;YACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;IAAA,CAAC;IAEF,0BAAU,GAAV;QACI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED,qBAAK,GAAL;QACI,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,qBAAK,GAAL;QACI,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IACL,YAAC;AAAD,CAAC;AAhGY,sBAAK;;;;;;;;ACJlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,iBAAiB,sBAAsB;AACvC;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,mBAAmB;AAC9B,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qBAAqB,EAAE,WAAW,EAAE,WAAW,EAAE;;AAEjD;AACA;AACA,2BAA2B,IAAI,YAAY,IAAI;AAC/C,eAAe,IAAI;AACnB;;AAEA;AACA;AACA;AACA,iBAAiB,IAAI,YAAY,IAAI,YAAY,IAAI;AACrD;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,IAAI,YAAY,IAAI,YAAY,IAAI;AACrD;AACA;;AAEA;AACA,6BAA6B,IAAI,aAAa,IAAI,aAAa,IAAI;;AAEnE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,OAAO;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,gBAAgB;AAChB,iBAAiB;AACjB,kBAAkB;AAClB,iBAAiB;AACjB;;AAEA,kDAAkD,gBAAgB;AAClE;AACA;;AAEA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2CAA2C,iCAAiC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,IAAI;AACf;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA,4BAA4B,uBAAuB;AACnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA,oBAAoB,+BAA+B;;AAEnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,sBAAsB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,kBAAkB;AACnC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,8CAA8C;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,8CAA8C;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,0BAA0B;;AAE9C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,wCAAwC;AACnD;AACA;AACA,WAAW,8CAA8C;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA,iBAAiB,qBAAqB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iBAAiB,kCAAkC;AACnD;;AAEA,iBAAiB,6BAA6B;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,SAAS,kBAAkB,aAAa,WAAW,kBAAkB;AAC9E;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,YAAY,OAAO;AACnB;AACA;AACA;AACA,aAAa;AACb,eAAe;AACf,cAAc;AACd;;AAEA,iBAAiB,cAAc;AAC/B;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,iBAAiB,cAAc;AAC/B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,iBAAiB,uBAAuB;AACxC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,qBAAqB;AAC1C;AACA,uBAAuB,qDAAqD;AAC5E;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,sBAAsB;AAC3C;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,YAAY,EAAE;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,YAAY,EAAE;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW;AACX;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW;AACX;AACA;AACA;AACA;;AAEA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;;AAEA;;AAEA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW;AACX;AACA;AACA;AACA;;AAEA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;;AAEZ;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,oBAAoB;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,SAAS;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,qBAAqB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,SAAS;AACtC;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;AACA,WAAW,OAAO;AAClB;AACA,WAAW,yCAAyC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,qBAAqB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA,YAAY,IAAI;AAChB;AACA;AACA;AACA;;AAEA,iBAAiB,6CAA6C;AAC9D;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,0BAA0B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,wBAAwB;AACnC;AACA,WAAW,qBAAqB;AAChC;AACA,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,IAAI;AACf;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,EAAE;AACb,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,2BAA2B;AAC3E;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,IAAI;AACf;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ,kDAAkD;AACtE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,YAAY,OAAO;AACnB;AACA;AACA;;AAEA,iCAAiC,yBAAyB;AAC1D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAoC,cAAc;AAClD,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL,sCAAsC,eAAe;AACrD;AACA;AACA,CAAC;;AAED;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6DAA6D,eAAe;;AAE5E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,aAAa;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,eAAe;AACnC,eAAe,OAAO;AACtB,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,0BAA0B,wCAAwC,EAAE;AAC3E;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C,uBAAuB;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,0BAA0B;AAC1B,qBAAqB;AACrB,8BAA8B;AAC9B,gBAAgB;AAChB,gBAAgB;AAChB,kBAAkB;AAClB,mBAAmB;AACnB,uBAAuB;AACvB,uBAAuB;AACvB,uEAAuE;AACvE,qEAAqE;;AAErE;AACA;AACA;AACA;AACA,uBAAuB;AACvB,mCAAmC;AACnC,sCAAsC;AACtC,uEAAuE;AACvE,4DAA4D;AAC5D,yBAAyB;AACzB;AACA;;AAEA;AACA;AACA;AACA,0BAA0B;AAC1B,2BAA2B;AAC3B,yBAAyB;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd,KAAK;AACL,cAAc;AACd;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0BAA0B;AACrC,WAAW,yCAAyC;AACpD;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH,eAAe;;AAEf;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,WAAW,iCAAiC;AAC5C,WAAW,yCAAyC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mDAAmD;AACnD;AACA;AACA,oBAAoB,0BAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,iBAAiB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB;;AAEpB;AACA,iBAAiB,yBAAyB,uBAAuB;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,0CAA0C;AACrE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0BAA0B;AACrC,WAAW,0BAA0B;AACrC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;;AAEA;AACA,YAAY,OAAO;AACnB;AACA;;AAEA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO;AACP;AACA;;AAEA,OAAO;AACP;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,YAAY;;AAEZ;AACA,YAAY;;AAEZ;AACA,YAAY;;;AAGZ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,EAAE;AAChD;AACA,KAAK;AACL;AACA,8CAA8C,EAAE;AAChD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH,+CAA+C;AAC/C,GAAG;AACH,yBAAyB;AACzB,GAAG;AACH,qBAAqB;AACrB,GAAG;AACH,qBAAqB;AACrB,GAAG;AACH,sBAAsB;AACtB,GAAG;AACH,mBAAmB;AACnB,GAAG;AACH;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAK;AACb,oBAAoB;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,sDAAsD,yBAAyB;AAC/E;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,oBAAoB;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,oBAAoB;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,oBAAoB;AAC/B;AACA;AACA,iBAAiB,iBAAiB;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,YAAY;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,YAAY,MAAM;AAClB;AACA;AACA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;;AAEA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB,oBAAoB;AACpB,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB,oBAAoB;AACpB,oBAAoB;AACpB,mBAAmB;AACnB,wBAAwB;AACxB,+CAA+C;AAC/C,iCAAiC;AACjC,8BAA8B;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd,wBAAwB;AACxB,8CAA8C;AAC9C,mDAAmD;AACnD,QAAQ;AACR;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC,sBAAsB;AACtB,8BAA8B;AAC9B,uBAAuB;AACvB,oCAAoC;AACpC,oBAAoB;AACpB,0BAA0B,oBAAoB;AAC9C,wBAAwB;AACxB,mBAAmB;AACnB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;AACA;AACA;AACA,sBAAsB;AACtB,uBAAuB;AACvB,wBAAwB;AACxB,iCAAiC;AACjC,8BAA8B;AAC9B;;AAEA;AACA;AACA;AACA,sBAAsB;AACtB,wBAAwB;AACxB,4CAA4C;AAC5C,wBAAwB;;AAExB;;AAEA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,cAAc;AACd,eAAe;AACf;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,iBAAiB;AACjB,gBAAgB;AAChB,eAAe;AACf,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,gBAAgB;AAChB,iBAAiB;AACjB,4BAA4B;AAC5B,iCAAiC;AACjC,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,yBAAyB,6BAA6B;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,mBAAmB;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,WAAW;AACtB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,6BAA6B;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,6BAA6B;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,6BAA6B;AAC9C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,gCAAgC;AAC7D;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,8DAA8D;AAC9D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,8BAA8B,wBAAwB,EAAE;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;;AAEvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL,GAAG;;AAEH;AACA;;AAEA;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,SAAS,WAAW,EAAE,KAAK;AAC3B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6CAA6C;AAC7C;AACA,8BAA8B;AAC9B,GAAG;AACH,8BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,aAAa;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH,2CAA2C,QAAQ;AACnD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,2BAA2B;AAChD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,kDAAkD,cAAc;;AAEhE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC,iCAAiC;AACjC,mDAAmD;AACnD,4BAA4B;AAC5B,8BAA8B;AAC9B,SAAS;AACT,kBAAkB;AAClB,gCAAgC;AAChC,6BAA6B;AAC7B,uDAAuD;AACvD,oDAAoD;AACpD,SAAS;AACT,eAAe;AACf,iFAAiF;AACjF,mFAAmF;AACnF,uCAAuC;AACvC,uCAAuC;AACvC,4CAA4C;AAC5C,0CAA0C;AAC1C,gDAAgD;AAChD,qEAAqE;AACrE,SAAS;AACT,0BAA0B;AAC1B,gBAAgB,cAAc,EAAE;AAChC,cAAc,cAAc,EAAE;AAC9B,SAAS;AACT,qBAAqB;AACrB,gCAAgC;AAChC,+DAA+D;AAC/D,8CAA8C;AAC9C,iDAAiD;AACjD,yCAAyC;AACzC,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,iFAAiF;AACjF,iFAAiF;AACjF,uBAAuB;AACvB,2CAA2C;AAC3C,6CAA6C;AAC7C,mEAAmE;AACnE,gEAAgE;;AAEhE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,mBAAmB;AACnB,uBAAuB;AACvB,oBAAoB;AACpB,qBAAqB;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,aAAa;AACxB;AACA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,OAAO;AACjB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,mBAAmB,mBAAmB;AACtC;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iBAAiB,gBAAgB;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,8BAA8B,aAAa;AAC3C;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA,mBAAmB,8BAA8B;AACjD,qBAAqB,6BAA6B;AAClD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,WAAW;AAC5B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,gCAAgC;AAC5D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS,6BAA6B;AACtC,SAAS,qCAAqC;AAC9C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB;AACtB,mCAAmC;AACnC,0BAA0B;AAC1B,4BAA4B;AAC5B,uBAAuB;AACvB,0CAA0C;AAC1C,oBAAoB;AACpB,sBAAsB;AACtB,4BAA4B;AAC5B,wCAAwC;AACxC,mCAAmC;AACnC,qCAAqC;AACrC,gCAAgC;;AAEhC;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B;AAC7B,6BAA6B;AAC7B,uBAAuB;AACvB,0CAA0C;AAC1C,4BAA4B;AAC5B,mCAAmC;AACnC,mDAAmD;AACnD,gCAAgC;AAChC,gDAAgD;;AAEhD;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,8BAA8B;AAC9B,0BAA0B;AAC1B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,4BAA4B,WAAW;AACvC,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA,gDAAgD;;AAEhD;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,eAAe;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,qBAAqB;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B,WAAW,gBAAgB;AAC3B,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,IAAI;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,GAAG,kBAAkB;AACrB;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA,GAAG;AACH;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,GAAG;AACH;AACA;;AAEA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,GAAG,uBAAuB;AAC1B;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sCAAsC,UAAU,OAAO;AACvD;AACA,wCAAwC;;AAExC;AACA;AACA;;AAEA,0BAA0B,wBAAwB;AAClD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC,yBAAyB;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA,uDAAuD;AACvD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,uBAAuB;AACxC;AACA;AACA;AACA,4CAA4C;;AAE5C;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA,0CAA0C,GAAG,IAAI,KAAK;AACtD;AACA;AACA;AACA;AACA,oBAAoB,gCAAgC;AACpD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAW;AAC5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,IAAI;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,4BAA4B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,4BAA4B;AAC7C;;AAEA;AACA,qBAAqB;AACrB;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,qBAAqB;AAC5B;AACA,OAAO,sBAAsB;AAC7B;AACA;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA,OAAO,sBAAsB;AAC7B;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA,OAAO;AACP;;AAEA,OAAO;AACP;;AAEA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA,KAAK;AACL;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yCAAyC,0BAA0B;AACnE;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,kDAAkD;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C,oBAAoB;AAC9D;AACA;AACA;AACA,6CAA6C,IAAI,IAAI;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH,0CAA0C,EAAE,EAAE;AAC9C,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,sBAAsB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,sBAAsB;AACjC;AACA;AACA;AACA,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA,4BAA4B;AAC5B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,6BAA6B;AAC7B;AACA,6BAA6B;AAC7B;AACA,KAAK;AACL,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC9jjBA,sCAAgC;AAChC,sCAAgC;AAChC,uCAAuD;AACvD,0CAAgD;AAMhD,IAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC;AAEhD,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAChB,IAAI,IAAc,CAAC;IACnB,EAAE,CAAC,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC;QACxB,IAAI,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,IAAI,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,IAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC;IAC1D,IAAM,GAAG,GAAG,CAAC,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzG,IAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpC,IAAM,OAAO,GAAG,IAAI,6BAAiB,CAAC,GAAG,EAAE,kBAAS,CAAC,CAAC;IACtD,IAAM,EAAE,GAAG,IAAI,eAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC7D,IAAM,QAAM,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IAEzB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE;QAC9B,QAAM,EAAE,CAAC;QACT,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAAA,CAAC;;;;;;;;AC7BF;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,8CAA8C,EAAE;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AC5HA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,uDAAuD,EAAE;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,yBAAyB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,IAAI;AACxE;AACA;AACA,qEAAqE,GAAG;AACxE;AACA;AACA;AACA;AACA;AACA,qEAAqE,MAAM;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG,qBAAqB;;AAEzB;;;;;;;;ACx6BA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA,2BAA2B,IAAI;AAC/B,sBAAsB,IAAI,KAAK,EAAE,IAAI,IAAI;AACzC;AACA,wBAAwB,IAAI;AAC5B;AACA;AACA,mFAAmF;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,gBAAgB;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,cAAc;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,QAAQ;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,mCAAmC,yBAAyB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,4BAA4B;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;;;;;;;;ACzOA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA,2EAA2E,uBAAuB;AAClG,0EAA0E,2BAA2B;AACrG;AACA;AACA,0EAA0E,iCAAiC;AAC3G,0EAA0E,4BAA4B;AACtG,0EAA0E,sBAAsB;AAChG,0EAA0E,2BAA2B;AACrG,0EAA0E,0BAA0B;AACpG,2EAA2E,6CAA6C;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,4CAA4C;AAC/G;AACA,+CAA+C,8BAA8B;AAC7E,+CAA+C,8BAA8B;AAC7E,+CAA+C,8BAA8B;AAC7E,+CAA+C,gDAAgD;AAC/F,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,oDAAoD;AACnG,+CAA+C,+BAA+B;AAC9E,+CAA+C,+BAA+B;AAC9E,+CAA+C,+BAA+B;AAC9E,gDAAgD,gCAAgC;AAChF,uBAAuB,wBAAwB,+BAA+B;AAC9E,oEAAoE,4CAA4C;AAChH;AACA,2DAA2D,oCAAoC;AAC/F,2DAA2D,iCAAiC;AAC5F,2DAA2D,mCAAmC;AAC9F,2DAA2D,sCAAsC;AACjG,2DAA2D,uCAAuC;AAClG,2DAA2D,uCAAuC;AAClG,2DAA2D,4CAA4C;AACvG,2DAA2D,2CAA2C;AACtG,2DAA2D,uCAAuC;AAClG,2DAA2D,yCAAyC;AACpG,2DAA2D,uCAAuC;AAClG,2DAA2D,oCAAoC;AAC/F,2DAA2D,oCAAoC;AAC/F,2DAA2D,oCAAoC;AAC/F,2DAA2D,oCAAoC;AAC/F,2DAA2D,iCAAiC;AAC5F;AACA;AACA;AACA;AACA;AACA,2DAA2D,mCAAmC;AAC9F,2DAA2D,0CAA0C;AACrG,2DAA2D,wCAAwC;AACnG,2DAA2D,0CAA0C;AACrG,2DAA2D,iDAAiD;AAC5G,2DAA2D,6CAA6C;AACxG,2DAA2D,wCAAwC;AACnG,2DAA2D,0CAA0C;AACrG,2DAA2D,mCAAmC;AAC9F,2DAA2D,iCAAiC;AAC5F,2DAA2D,gCAAgC;AAC3F,2DAA2D,kCAAkC;AAC7F,2DAA2D,uCAAuC;AAClG,2DAA2D,qCAAqC;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,wCAAwC;AAC3F,mDAAmD,mCAAmC;AACtF,mDAAmD,sCAAsC;AACzF,iGAAiG,4CAA4C;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,kCAAkC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,oBAAoB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AC7dA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,sBAAsB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,yBAAyB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mCAAmC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA,8CAA8C;AAC9C;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,0DAA0D;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,cAAc;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACrRA;AACA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,sCAAsC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,8BAA8B;AACpF,oDAAoD,kCAAkC;AACtF,oDAAoD,kCAAkC;AACtF,kDAAkD,gCAAgC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,iBAAiB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,cAAc;AAChD,gCAAgC,eAAe;AAC/C;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oFAAoF,yBAAyB,EAAE;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,6EAA6E;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,4BAA4B,EAAE;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;ACrZA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;ACxEA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,+BAA+B,EAAE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uB;;;;;;AC7BA,kBAAkB,wD;;;;;;ACAlB,kBAAkB,kD;;;;;;;;;;;;ACAlB,kBAAkB,gE;;;;;;ACAlB,kBAAkB,8D;;;;;;;ACAlB;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;ACpEA;AACA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,2BAA2B,EAAE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AClEA;AACA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,uDAAuD;AAChF;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,2BAA2B,yCAAyC;AACpE;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,0CAA0C,eAAe;AACzD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,cAAc;AAC/C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA,+BAA+B,gCAAgC;AAC/D;AACA;AACA;AACA;AACA;AACA,0CAA0C,YAAY;AACtD;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;;;;;;;;AClKA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;;;;;;;;AC5CA;AACA,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;;AAEA","file":"./dist/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 15);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e07bf020f10a44c91562","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar CompositionHelper_1 = require(\"./CompositionHelper\");\nvar EventEmitter_1 = require(\"./EventEmitter\");\nvar Viewport_1 = require(\"./Viewport\");\nvar Clipboard_1 = require(\"./handlers/Clipboard\");\nvar CircularList_1 = require(\"./utils/CircularList\");\nvar EscapeSequences_1 = require(\"./EscapeSequences\");\nvar InputHandler_1 = require(\"./InputHandler\");\nvar Parser_1 = require(\"./Parser\");\nvar Renderer_1 = require(\"./Renderer\");\nvar Linkifier_1 = require(\"./Linkifier\");\nvar SelectionManager_1 = require(\"./SelectionManager\");\nvar CharMeasure_1 = require(\"./utils/CharMeasure\");\nvar Browser = require(\"./utils/Browser\");\nvar Mouse_1 = require(\"./utils/Mouse\");\nvar document = (typeof window != 'undefined') ? window.document : null;\nvar WRITE_BUFFER_PAUSE_THRESHOLD = 5;\nvar WRITE_BATCH_SIZE = 300;\nvar CURSOR_BLINK_INTERVAL = 600;\nfunction Terminal(options) {\n var self = this;\n if (!(this instanceof Terminal)) {\n return new Terminal(arguments[0], arguments[1], arguments[2]);\n }\n self.browser = Browser;\n self.cancel = Terminal.cancel;\n EventEmitter_1.EventEmitter.call(this);\n if (typeof options === 'number') {\n options = {\n cols: arguments[0],\n rows: arguments[1],\n handler: arguments[2]\n };\n }\n options = options || {};\n Object.keys(Terminal.defaults).forEach(function (key) {\n if (options[key] == null) {\n options[key] = Terminal.options[key];\n if (Terminal[key] !== Terminal.defaults[key]) {\n options[key] = Terminal[key];\n }\n }\n self[key] = options[key];\n });\n if (options.colors.length === 8) {\n options.colors = options.colors.concat(Terminal._colors.slice(8));\n }\n else if (options.colors.length === 16) {\n options.colors = options.colors.concat(Terminal._colors.slice(16));\n }\n else if (options.colors.length === 10) {\n options.colors = options.colors.slice(0, -2).concat(Terminal._colors.slice(8, -2), options.colors.slice(-2));\n }\n else if (options.colors.length === 18) {\n options.colors = options.colors.concat(Terminal._colors.slice(16, -2), options.colors.slice(-2));\n }\n this.colors = options.colors;\n this.options = options;\n this.parent = options.body || options.parent || (document ? document.getElementsByTagName('body')[0] : null);\n this.cols = options.cols || options.geometry[0];\n this.rows = options.rows || options.geometry[1];\n this.geometry = [this.cols, this.rows];\n if (options.handler) {\n this.on('data', options.handler);\n }\n this.ybase = 0;\n this.ydisp = 0;\n this.x = 0;\n this.y = 0;\n this.cursorState = 0;\n this.cursorHidden = false;\n this.convertEol;\n this.queue = '';\n this.scrollTop = 0;\n this.scrollBottom = this.rows - 1;\n this.customKeyEventHandler = null;\n this.cursorBlinkInterval = null;\n this.applicationKeypad = false;\n this.applicationCursor = false;\n this.originMode = false;\n this.insertMode = false;\n this.wraparoundMode = true;\n this.normal = null;\n this.charset = null;\n this.gcharset = null;\n this.glevel = 0;\n this.charsets = [null];\n this.decLocator;\n this.x10Mouse;\n this.vt200Mouse;\n this.vt300Mouse;\n this.normalMouse;\n this.mouseEvents;\n this.sendFocus;\n this.utfMouse;\n this.sgrMouse;\n this.urxvtMouse;\n this.element;\n this.children;\n this.refreshStart;\n this.refreshEnd;\n this.savedX;\n this.savedY;\n this.savedCols;\n this.readable = true;\n this.writable = true;\n this.defAttr = (0 << 18) | (257 << 9) | (256 << 0);\n this.curAttr = this.defAttr;\n this.params = [];\n this.currentParam = 0;\n this.prefix = '';\n this.postfix = '';\n this.inputHandler = new InputHandler_1.InputHandler(this);\n this.parser = new Parser_1.Parser(this.inputHandler, this);\n this.renderer = this.renderer || null;\n this.selectionManager = this.selectionManager || null;\n this.linkifier = this.linkifier || new Linkifier_1.Linkifier();\n this.writeBuffer = [];\n this.writeInProgress = false;\n this.xoffSentToCatchUp = false;\n this.writeStopped = false;\n this.surrogate_high = '';\n this.lines = new CircularList_1.CircularList(this.scrollback);\n var i = this.rows;\n while (i--) {\n this.lines.push(this.blankLine());\n }\n if (this.selectionManager) {\n this.selectionManager.setBuffer(this.lines);\n }\n this.tabs;\n this.setupStops();\n this.userScrolling = false;\n}\ninherits(Terminal, EventEmitter_1.EventEmitter);\nTerminal.prototype.eraseAttr = function () {\n return (this.defAttr & ~0x1ff) | (this.curAttr & 0x1ff);\n};\nTerminal.tangoColors = [\n '#2e3436',\n '#cc0000',\n '#4e9a06',\n '#c4a000',\n '#3465a4',\n '#75507b',\n '#06989a',\n '#d3d7cf',\n '#555753',\n '#ef2929',\n '#8ae234',\n '#fce94f',\n '#729fcf',\n '#ad7fa8',\n '#34e2e2',\n '#eeeeec'\n];\nTerminal.colors = (function () {\n var colors = Terminal.tangoColors.slice(), r = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff], i;\n i = 0;\n for (; i < 216; i++) {\n out(r[(i / 36) % 6 | 0], r[(i / 6) % 6 | 0], r[i % 6]);\n }\n i = 0;\n for (; i < 24; i++) {\n r = 8 + i * 10;\n out(r, r, r);\n }\n function out(r, g, b) {\n colors.push('#' + hex(r) + hex(g) + hex(b));\n }\n function hex(c) {\n c = c.toString(16);\n return c.length < 2 ? '0' + c : c;\n }\n return colors;\n})();\nTerminal._colors = Terminal.colors.slice();\nTerminal.vcolors = (function () {\n var out = [], colors = Terminal.colors, i = 0, color;\n for (; i < 256; i++) {\n color = parseInt(colors[i].substring(1), 16);\n out.push([\n (color >> 16) & 0xff,\n (color >> 8) & 0xff,\n color & 0xff\n ]);\n }\n return out;\n})();\nTerminal.defaults = {\n colors: Terminal.colors,\n theme: 'default',\n convertEol: false,\n termName: 'xterm',\n geometry: [80, 24],\n cursorBlink: false,\n cursorStyle: 'block',\n visualBell: false,\n popOnBell: false,\n scrollback: 1000,\n screenKeys: false,\n debug: false,\n cancelEvents: false,\n disableStdin: false,\n useFlowControl: false,\n tabStopWidth: 8\n};\nTerminal.options = {};\nTerminal.focus = null;\neach(keys(Terminal.defaults), function (key) {\n Terminal[key] = Terminal.defaults[key];\n Terminal.options[key] = Terminal.defaults[key];\n});\nTerminal.prototype.focus = function () {\n return this.textarea.focus();\n};\nTerminal.prototype.getOption = function (key, value) {\n if (!(key in Terminal.defaults)) {\n throw new Error('No option with key \"' + key + '\"');\n }\n if (typeof this.options[key] !== 'undefined') {\n return this.options[key];\n }\n return this[key];\n};\nTerminal.prototype.setOption = function (key, value) {\n if (!(key in Terminal.defaults)) {\n throw new Error('No option with key \"' + key + '\"');\n }\n switch (key) {\n case 'scrollback':\n if (value < this.rows) {\n var msg = 'Setting the scrollback value less than the number of rows ';\n msg += \"(\" + this.rows + \") is not allowed.\";\n console.warn(msg);\n return false;\n }\n if (this.options[key] !== value) {\n if (this.lines.length > value) {\n var amountToTrim = this.lines.length - value;\n var needsRefresh = (this.ydisp - 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 if (needsRefresh) {\n this.refresh(0, this.rows - 1);\n }\n }\n this.lines.maxLength = value;\n this.viewport.syncScrollArea();\n }\n break;\n }\n this[key] = value;\n this.options[key] = value;\n switch (key) {\n case 'cursorBlink':\n this.setCursorBlinking(value);\n break;\n case 'cursorStyle':\n this.element.classList.toggle(\"xterm-cursor-style-underline\", value === 'underline');\n this.element.classList.toggle(\"xterm-cursor-style-bar\", value === 'bar');\n break;\n case 'tabStopWidth':\n this.setupStops();\n break;\n }\n};\nTerminal.prototype.restartCursorBlinking = function () {\n this.setCursorBlinking(this.options.cursorBlink);\n};\nTerminal.prototype.setCursorBlinking = function (enabled) {\n this.element.classList.toggle('xterm-cursor-blink', enabled);\n this.clearCursorBlinkingInterval();\n if (enabled) {\n var self = this;\n this.cursorBlinkInterval = setInterval(function () {\n self.element.classList.toggle('xterm-cursor-blink-on');\n }, CURSOR_BLINK_INTERVAL);\n }\n};\nTerminal.prototype.clearCursorBlinkingInterval = function () {\n this.element.classList.remove('xterm-cursor-blink-on');\n if (this.cursorBlinkInterval) {\n clearInterval(this.cursorBlinkInterval);\n this.cursorBlinkInterval = null;\n }\n};\nTerminal.bindFocus = function (term) {\n on(term.textarea, 'focus', function (ev) {\n if (term.sendFocus) {\n term.send(EscapeSequences_1.C0.ESC + '[I');\n }\n term.element.classList.add('focus');\n term.showCursor();\n term.restartCursorBlinking.apply(term);\n Terminal.focus = term;\n term.emit('focus', { terminal: term });\n });\n};\nTerminal.prototype.blur = function () {\n return this.textarea.blur();\n};\nTerminal.bindBlur = function (term) {\n on(term.textarea, 'blur', function (ev) {\n term.refresh(term.y, term.y);\n if (term.sendFocus) {\n term.send(EscapeSequences_1.C0.ESC + '[O');\n }\n term.element.classList.remove('focus');\n term.clearCursorBlinkingInterval.apply(term);\n Terminal.focus = null;\n term.emit('blur', { terminal: term });\n });\n};\nTerminal.prototype.initGlobal = function () {\n var _this = this;\n var term = this;\n Terminal.bindKeys(this);\n Terminal.bindFocus(this);\n Terminal.bindBlur(this);\n on(this.element, 'copy', function (event) {\n if (_this.mouseEvents) {\n return;\n }\n Clipboard_1.copyHandler(event, term, _this.selectionManager);\n });\n var pasteHandlerWrapper = function (event) { return Clipboard_1.pasteHandler(event, term); };\n on(this.textarea, 'paste', pasteHandlerWrapper);\n on(this.element, 'paste', pasteHandlerWrapper);\n if (term.browser.isFirefox) {\n on(this.element, 'mousedown', function (event) {\n if (event.button == 2) {\n Clipboard_1.rightClickHandler(event, _this.textarea, _this.selectionManager);\n }\n });\n }\n else {\n on(this.element, 'contextmenu', function (event) {\n Clipboard_1.rightClickHandler(event, _this.textarea, _this.selectionManager);\n });\n }\n if (term.browser.isLinux) {\n on(this.element, 'auxclick', function (event) {\n if (event.button === 1) {\n Clipboard_1.moveTextAreaUnderMouseCursor(event, _this.textarea, _this.selectionManager);\n }\n });\n }\n};\nTerminal.bindKeys = function (term) {\n on(term.element, 'keydown', function (ev) {\n if (document.activeElement != this) {\n return;\n }\n term.keyDown(ev);\n }, true);\n on(term.element, 'keypress', function (ev) {\n if (document.activeElement != this) {\n return;\n }\n term.keyPress(ev);\n }, true);\n on(term.element, 'keyup', function (ev) {\n if (!wasMondifierKeyOnlyEvent(ev)) {\n term.focus(term);\n }\n }, true);\n on(term.textarea, 'keydown', function (ev) {\n term.keyDown(ev);\n }, true);\n on(term.textarea, 'keypress', function (ev) {\n term.keyPress(ev);\n this.value = '';\n }, true);\n on(term.textarea, 'compositionstart', term.compositionHelper.compositionstart.bind(term.compositionHelper));\n on(term.textarea, 'compositionupdate', term.compositionHelper.compositionupdate.bind(term.compositionHelper));\n on(term.textarea, 'compositionend', term.compositionHelper.compositionend.bind(term.compositionHelper));\n term.on('refresh', term.compositionHelper.updateCompositionElements.bind(term.compositionHelper));\n term.on('refresh', function (data) {\n term.queueLinkification(data.start, data.end);\n });\n};\nTerminal.prototype.insertRow = function (row) {\n if (typeof row != 'object') {\n row = document.createElement('div');\n }\n this.rowContainer.appendChild(row);\n this.children.push(row);\n return row;\n};\nTerminal.prototype.open = function (parent, focus) {\n var _this = this;\n var self = this, i = 0, div;\n this.parent = parent || this.parent;\n if (!this.parent) {\n throw new Error('Terminal requires a parent element.');\n }\n this.context = this.parent.ownerDocument.defaultView;\n this.document = this.parent.ownerDocument;\n this.body = this.document.getElementsByTagName('body')[0];\n this.element = this.document.createElement('div');\n this.element.classList.add('terminal');\n this.element.classList.add('xterm');\n this.element.classList.add('xterm-theme-' + this.theme);\n this.setCursorBlinking(this.options.cursorBlink);\n this.element.setAttribute('tabindex', 0);\n this.viewportElement = document.createElement('div');\n this.viewportElement.classList.add('xterm-viewport');\n this.element.appendChild(this.viewportElement);\n this.viewportScrollArea = document.createElement('div');\n this.viewportScrollArea.classList.add('xterm-scroll-area');\n this.viewportElement.appendChild(this.viewportScrollArea);\n this.selectionContainer = document.createElement('div');\n this.selectionContainer.classList.add('xterm-selection');\n this.element.appendChild(this.selectionContainer);\n this.rowContainer = document.createElement('div');\n this.rowContainer.classList.add('xterm-rows');\n this.element.appendChild(this.rowContainer);\n this.children = [];\n this.linkifier.attachToDom(document, this.children);\n this.helperContainer = document.createElement('div');\n this.helperContainer.classList.add('xterm-helpers');\n this.element.appendChild(this.helperContainer);\n this.textarea = document.createElement('textarea');\n this.textarea.classList.add('xterm-helper-textarea');\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.textarea.addEventListener('focus', function () {\n self.emit('focus', { terminal: self });\n });\n this.textarea.addEventListener('blur', function () {\n self.emit('blur', { terminal: self });\n });\n this.helperContainer.appendChild(this.textarea);\n this.compositionView = document.createElement('div');\n this.compositionView.classList.add('composition-view');\n this.compositionHelper = new CompositionHelper_1.CompositionHelper(this.textarea, this.compositionView, this);\n this.helperContainer.appendChild(this.compositionView);\n this.charSizeStyleElement = document.createElement('style');\n this.helperContainer.appendChild(this.charSizeStyleElement);\n for (; i < this.rows; i++) {\n this.insertRow();\n }\n this.parent.appendChild(this.element);\n this.charMeasure = new CharMeasure_1.CharMeasure(document, this.helperContainer);\n this.charMeasure.on('charsizechanged', function () {\n self.updateCharSizeStyles();\n });\n this.charMeasure.measure();\n this.viewport = new Viewport_1.Viewport(this, this.viewportElement, this.viewportScrollArea, this.charMeasure);\n this.renderer = new Renderer_1.Renderer(this);\n this.selectionManager = new SelectionManager_1.SelectionManager(this, this.lines, this.rowContainer, this.charMeasure);\n this.selectionManager.on('refresh', function (data) {\n _this.renderer.refreshSelection(data.start, data.end);\n });\n this.selectionManager.on('newselection', function (text) {\n _this.textarea.value = text;\n _this.textarea.focus();\n _this.textarea.select();\n });\n this.on('scroll', function () { return _this.selectionManager.refresh(); });\n this.viewportElement.addEventListener('scroll', function () { return _this.selectionManager.refresh(); });\n this.refresh(0, this.rows - 1);\n this.initGlobal();\n if (typeof focus == 'undefined') {\n var message = 'You did not pass the `focus` argument in `Terminal.prototype.open()`.\\n';\n message += 'The `focus` argument now defaults to `true` but starting with xterm.js 3.0 ';\n message += 'it will default to `false`.';\n console.warn(message);\n focus = true;\n }\n if (focus) {\n this.focus();\n }\n on(this.element, 'click', function () {\n var selection = document.getSelection(), collapsed = selection.isCollapsed, isRange = typeof collapsed == 'boolean' ? !collapsed : selection.type == 'Range';\n if (!isRange) {\n self.focus();\n }\n });\n this.bindMouse();\n this.emit('open');\n};\nTerminal.loadAddon = function (addon, callback) {\n if (typeof exports === 'object' && typeof module === 'object') {\n return require('./addons/' + addon + '/' + addon);\n }\n else if (typeof define == 'function') {\n return require(['./addons/' + addon + '/' + addon], callback);\n }\n else {\n console.error('Cannot load a module without a CommonJS or RequireJS environment.');\n return false;\n }\n};\nTerminal.prototype.updateCharSizeStyles = function () {\n this.charSizeStyleElement.textContent =\n \".xterm-wide-char{width:\" + this.charMeasure.width * 2 + \"px;}\" +\n (\".xterm-normal-char{width:\" + this.charMeasure.width + \"px;}\") +\n (\".xterm-rows > div{height:\" + this.charMeasure.height + \"px;}\");\n};\nTerminal.prototype.bindMouse = function () {\n var el = this.element, self = this, pressed = 32;\n function sendButton(ev) {\n var button, pos;\n button = getButton(ev);\n pos = Mouse_1.getRawByteCoords(ev, self.rowContainer, self.charMeasure, self.cols, self.rows);\n if (!pos)\n return;\n sendEvent(button, pos);\n switch (ev.overrideType || ev.type) {\n case 'mousedown':\n pressed = button;\n break;\n case 'mouseup':\n pressed = 32;\n break;\n case 'wheel':\n break;\n }\n }\n function sendMove(ev) {\n var button = pressed, pos;\n pos = Mouse_1.getRawByteCoords(ev, self.rowContainer, self.charMeasure, self.cols, self.rows);\n if (!pos)\n return;\n button += 32;\n sendEvent(button, pos);\n }\n function encode(data, ch) {\n if (!self.utfMouse) {\n if (ch === 255)\n return data.push(0);\n if (ch > 127)\n ch = 127;\n data.push(ch);\n }\n else {\n if (ch === 2047)\n return data.push(0);\n if (ch < 127) {\n data.push(ch);\n }\n else {\n if (ch > 2047)\n ch = 2047;\n data.push(0xC0 | (ch >> 6));\n data.push(0x80 | (ch & 0x3F));\n }\n }\n }\n function sendEvent(button, pos) {\n if (self.vt300Mouse) {\n button &= 3;\n pos.x -= 32;\n pos.y -= 32;\n var data = EscapeSequences_1.C0.ESC + '[24';\n if (button === 0)\n data += '1';\n else if (button === 1)\n data += '3';\n else if (button === 2)\n data += '5';\n else if (button === 3)\n return;\n else\n data += '0';\n data += '~[' + pos.x + ',' + pos.y + ']\\r';\n self.send(data);\n return;\n }\n if (self.decLocator) {\n button &= 3;\n pos.x -= 32;\n pos.y -= 32;\n if (button === 0)\n button = 2;\n else if (button === 1)\n button = 4;\n else if (button === 2)\n button = 6;\n else if (button === 3)\n button = 3;\n self.send(EscapeSequences_1.C0.ESC + '['\n + button\n + ';'\n + (button === 3 ? 4 : 0)\n + ';'\n + pos.y\n + ';'\n + pos.x\n + ';'\n + (pos.page || 0)\n + '&w');\n return;\n }\n if (self.urxvtMouse) {\n pos.x -= 32;\n pos.y -= 32;\n pos.x++;\n pos.y++;\n self.send(EscapeSequences_1.C0.ESC + '[' + button + ';' + pos.x + ';' + pos.y + 'M');\n return;\n }\n if (self.sgrMouse) {\n pos.x -= 32;\n pos.y -= 32;\n self.send(EscapeSequences_1.C0.ESC + '[<'\n + (((button & 3) === 3 ? button & ~3 : button) - 32)\n + ';'\n + pos.x\n + ';'\n + pos.y\n + ((button & 3) === 3 ? 'm' : 'M'));\n return;\n }\n var data = [];\n encode(data, button);\n encode(data, pos.x);\n encode(data, pos.y);\n self.send(EscapeSequences_1.C0.ESC + '[M' + String.fromCharCode.apply(String, data));\n }\n function getButton(ev) {\n var button, shift, meta, ctrl, mod;\n switch (ev.overrideType || ev.type) {\n case 'mousedown':\n button = ev.button != null\n ? +ev.button\n : ev.which != null\n ? ev.which - 1\n : null;\n if (self.browser.isMSIE) {\n button = button === 1 ? 0 : button === 4 ? 1 : button;\n }\n break;\n case 'mouseup':\n button = 3;\n break;\n case 'DOMMouseScroll':\n button = ev.detail < 0\n ? 64\n : 65;\n break;\n case 'wheel':\n button = ev.wheelDeltaY > 0\n ? 64\n : 65;\n break;\n }\n shift = ev.shiftKey ? 4 : 0;\n meta = ev.metaKey ? 8 : 0;\n ctrl = ev.ctrlKey ? 16 : 0;\n mod = shift | meta | ctrl;\n if (self.vt200Mouse) {\n mod &= ctrl;\n }\n else if (!self.normalMouse) {\n mod = 0;\n }\n button = (32 + (mod << 2)) + button;\n return button;\n }\n on(el, 'mousedown', function (ev) {\n if (!self.mouseEvents)\n return;\n sendButton(ev);\n self.focus();\n if (self.vt200Mouse) {\n ev.overrideType = 'mouseup';\n sendButton(ev);\n return self.cancel(ev);\n }\n if (self.normalMouse)\n on(self.document, 'mousemove', sendMove);\n if (!self.x10Mouse) {\n on(self.document, 'mouseup', function up(ev) {\n sendButton(ev);\n if (self.normalMouse)\n off(self.document, 'mousemove', sendMove);\n off(self.document, 'mouseup', up);\n return self.cancel(ev);\n });\n }\n return self.cancel(ev);\n });\n on(el, 'wheel', function (ev) {\n if (!self.mouseEvents)\n return;\n if (self.x10Mouse\n || self.vt300Mouse\n || self.decLocator)\n return;\n sendButton(ev);\n return self.cancel(ev);\n });\n on(el, 'wheel', function (ev) {\n if (self.mouseEvents)\n return;\n self.viewport.onWheel(ev);\n return self.cancel(ev);\n });\n on(el, 'touchstart', function (ev) {\n if (self.mouseEvents)\n return;\n self.viewport.onTouchStart(ev);\n return self.cancel(ev);\n });\n on(el, 'touchmove', function (ev) {\n if (self.mouseEvents)\n return;\n self.viewport.onTouchMove(ev);\n return self.cancel(ev);\n });\n};\nTerminal.prototype.destroy = function () {\n this.readable = false;\n this.writable = false;\n this._events = {};\n this.handler = function () { };\n this.write = function () { };\n if (this.element && this.element.parentNode) {\n this.element.parentNode.removeChild(this.element);\n }\n};\nTerminal.prototype.refresh = function (start, end) {\n if (this.renderer) {\n this.renderer.queueRefresh(start, end);\n }\n};\nTerminal.prototype.queueLinkification = function (start, end) {\n if (this.linkifier) {\n for (var i = start; i <= end; i++) {\n this.linkifier.linkifyRow(i);\n }\n }\n};\nTerminal.prototype.showCursor = function () {\n if (!this.cursorState) {\n this.cursorState = 1;\n this.refresh(this.y, this.y);\n }\n};\nTerminal.prototype.scroll = function (isWrapped) {\n var row;\n if (this.lines.length === this.lines.maxLength) {\n this.lines.trimStart(1);\n this.ybase--;\n if (this.ydisp !== 0) {\n this.ydisp--;\n }\n }\n this.ybase++;\n if (!this.userScrolling) {\n this.ydisp = this.ybase;\n }\n row = this.ybase + this.rows - 1;\n row -= this.rows - 1 - this.scrollBottom;\n if (row === this.lines.length) {\n this.lines.push(this.blankLine(undefined, isWrapped));\n }\n else {\n this.lines.splice(row, 0, this.blankLine(undefined, isWrapped));\n }\n if (this.scrollTop !== 0) {\n if (this.ybase !== 0) {\n this.ybase--;\n if (!this.userScrolling) {\n this.ydisp = this.ybase;\n }\n }\n this.lines.splice(this.ybase + this.scrollTop, 1);\n }\n this.updateRange(this.scrollTop);\n this.updateRange(this.scrollBottom);\n this.emit('scroll', this.ydisp);\n};\nTerminal.prototype.scrollDisp = function (disp, suppressScrollEvent) {\n if (disp < 0) {\n if (this.ydisp === 0) {\n return;\n }\n this.userScrolling = true;\n }\n else if (disp + this.ydisp >= this.ybase) {\n this.userScrolling = false;\n }\n this.ydisp += disp;\n if (this.ydisp > this.ybase) {\n this.ydisp = this.ybase;\n }\n else if (this.ydisp < 0) {\n this.ydisp = 0;\n }\n if (!suppressScrollEvent) {\n this.emit('scroll', this.ydisp);\n }\n this.refresh(0, this.rows - 1);\n};\nTerminal.prototype.scrollPages = function (pageCount) {\n this.scrollDisp(pageCount * (this.rows - 1));\n};\nTerminal.prototype.scrollToTop = function () {\n this.scrollDisp(-this.ydisp);\n};\nTerminal.prototype.scrollToBottom = function () {\n this.scrollDisp(this.ybase - this.ydisp);\n};\nTerminal.prototype.write = function (data) {\n this.writeBuffer.push(data);\n if (this.options.useFlowControl && !this.xoffSentToCatchUp && this.writeBuffer.length >= WRITE_BUFFER_PAUSE_THRESHOLD) {\n this.send(EscapeSequences_1.C0.DC3);\n this.xoffSentToCatchUp = true;\n }\n if (!this.writeInProgress && this.writeBuffer.length > 0) {\n this.writeInProgress = true;\n var self = this;\n setTimeout(function () {\n self.innerWrite();\n });\n }\n};\nTerminal.prototype.innerWrite = function () {\n var writeBatch = this.writeBuffer.splice(0, WRITE_BATCH_SIZE);\n while (writeBatch.length > 0) {\n var data = writeBatch.shift();\n var l = data.length, i = 0, j, cs, ch, code, low, ch_width, row;\n if (this.xoffSentToCatchUp && writeBatch.length === 0 && this.writeBuffer.length === 0) {\n this.send(EscapeSequences_1.C0.DC1);\n this.xoffSentToCatchUp = false;\n }\n this.refreshStart = this.y;\n this.refreshEnd = this.y;\n var state = this.parser.parse(data);\n this.parser.setState(state);\n this.updateRange(this.y);\n this.refresh(this.refreshStart, this.refreshEnd);\n }\n if (this.writeBuffer.length > 0) {\n var self = this;\n setTimeout(function () {\n self.innerWrite();\n }, 0);\n }\n else {\n this.writeInProgress = false;\n }\n};\nTerminal.prototype.writeln = function (data) {\n this.write(data + '\\r\\n');\n};\nTerminal.prototype.attachCustomKeydownHandler = function (customKeydownHandler) {\n var message = 'attachCustomKeydownHandler() is DEPRECATED and will be removed soon. Please use attachCustomKeyEventHandler() instead.';\n console.warn(message);\n this.attachCustomKeyEventHandler(customKeydownHandler);\n};\nTerminal.prototype.attachCustomKeyEventHandler = function (customKeyEventHandler) {\n this.customKeyEventHandler = customKeyEventHandler;\n};\nTerminal.prototype.setHypertextLinkHandler = function (handler) {\n if (!this.linkifier) {\n throw new Error('Cannot attach a hypertext link handler before Terminal.open is called');\n }\n this.linkifier.setHypertextLinkHandler(handler);\n this.refresh(0, this.rows - 1);\n};\nTerminal.prototype.setHypertextValidationCallback = function (callback) {\n if (!this.linkifier) {\n throw new Error('Cannot attach a hypertext validation callback before Terminal.open is called');\n }\n this.linkifier.setHypertextValidationCallback(callback);\n this.refresh(0, this.rows - 1);\n};\nTerminal.prototype.registerLinkMatcher = function (regex, handler, options) {\n if (this.linkifier) {\n var matcherId = this.linkifier.registerLinkMatcher(regex, handler, options);\n this.refresh(0, this.rows - 1);\n return matcherId;\n }\n};\nTerminal.prototype.deregisterLinkMatcher = function (matcherId) {\n if (this.linkifier) {\n if (this.linkifier.deregisterLinkMatcher(matcherId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n};\nTerminal.prototype.hasSelection = function () {\n return this.selectionManager.hasSelection;\n};\nTerminal.prototype.getSelection = function () {\n return this.selectionManager.selectionText;\n};\nTerminal.prototype.clearSelection = function () {\n this.selectionManager.clearSelection();\n};\nTerminal.prototype.selectAll = function () {\n this.selectionManager.selectAll();\n};\nTerminal.prototype.keyDown = function (ev) {\n if (this.customKeyEventHandler && this.customKeyEventHandler(ev) === false) {\n return false;\n }\n this.restartCursorBlinking();\n if (!this.compositionHelper.keydown.bind(this.compositionHelper)(ev)) {\n if (this.ybase !== this.ydisp) {\n this.scrollToBottom();\n }\n return false;\n }\n var self = this;\n var result = this.evaluateKeyEscapeSequence(ev);\n if (result.key === EscapeSequences_1.C0.DC3) {\n this.writeStopped = true;\n }\n else if (result.key === EscapeSequences_1.C0.DC1) {\n this.writeStopped = false;\n }\n if (result.scrollDisp) {\n this.scrollDisp(result.scrollDisp);\n return this.cancel(ev, true);\n }\n if (isThirdLevelShift(this, ev)) {\n return true;\n }\n if (result.cancel) {\n this.cancel(ev, true);\n }\n if (!result.key) {\n return true;\n }\n this.emit('keydown', ev);\n this.emit('key', result.key, ev);\n this.showCursor();\n this.handler(result.key);\n return this.cancel(ev, true);\n};\nTerminal.prototype.evaluateKeyEscapeSequence = function (ev) {\n var result = {\n cancel: false,\n key: undefined,\n scrollDisp: undefined\n };\n var modifiers = ev.shiftKey << 0 | ev.altKey << 1 | ev.ctrlKey << 2 | ev.metaKey << 3;\n switch (ev.keyCode) {\n case 8:\n if (ev.shiftKey) {\n result.key = EscapeSequences_1.C0.BS;\n break;\n }\n result.key = EscapeSequences_1.C0.DEL;\n break;\n case 9:\n if (ev.shiftKey) {\n result.key = EscapeSequences_1.C0.ESC + '[Z';\n break;\n }\n result.key = EscapeSequences_1.C0.HT;\n result.cancel = true;\n break;\n case 13:\n result.key = EscapeSequences_1.C0.CR;\n result.cancel = true;\n break;\n case 27:\n result.key = EscapeSequences_1.C0.ESC;\n result.cancel = true;\n break;\n case 37:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'D';\n if (result.key == EscapeSequences_1.C0.ESC + '[1;3D') {\n result.key = (this.browser.isMac) ? EscapeSequences_1.C0.ESC + 'b' : EscapeSequences_1.C0.ESC + '[1;5D';\n }\n }\n else if (this.applicationCursor) {\n result.key = EscapeSequences_1.C0.ESC + 'OD';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[D';\n }\n break;\n case 39:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'C';\n if (result.key == EscapeSequences_1.C0.ESC + '[1;3C') {\n result.key = (this.browser.isMac) ? EscapeSequences_1.C0.ESC + 'f' : EscapeSequences_1.C0.ESC + '[1;5C';\n }\n }\n else if (this.applicationCursor) {\n result.key = EscapeSequences_1.C0.ESC + 'OC';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[C';\n }\n break;\n case 38:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'A';\n if (result.key == EscapeSequences_1.C0.ESC + '[1;3A') {\n result.key = EscapeSequences_1.C0.ESC + '[1;5A';\n }\n }\n else if (this.applicationCursor) {\n result.key = EscapeSequences_1.C0.ESC + 'OA';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[A';\n }\n break;\n case 40:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'B';\n if (result.key == EscapeSequences_1.C0.ESC + '[1;3B') {\n result.key = EscapeSequences_1.C0.ESC + '[1;5B';\n }\n }\n else if (this.applicationCursor) {\n result.key = EscapeSequences_1.C0.ESC + 'OB';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[B';\n }\n break;\n case 45:\n if (!ev.shiftKey && !ev.ctrlKey) {\n result.key = EscapeSequences_1.C0.ESC + '[2~';\n }\n break;\n case 46:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[3;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[3~';\n }\n break;\n case 36:\n if (modifiers)\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'H';\n else if (this.applicationCursor)\n result.key = EscapeSequences_1.C0.ESC + 'OH';\n else\n result.key = EscapeSequences_1.C0.ESC + '[H';\n break;\n case 35:\n if (modifiers)\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'F';\n else if (this.applicationCursor)\n result.key = EscapeSequences_1.C0.ESC + 'OF';\n else\n result.key = EscapeSequences_1.C0.ESC + '[F';\n break;\n case 33:\n if (ev.shiftKey) {\n result.scrollDisp = -(this.rows - 1);\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[5~';\n }\n break;\n case 34:\n if (ev.shiftKey) {\n result.scrollDisp = this.rows - 1;\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[6~';\n }\n break;\n case 112:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'P';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + 'OP';\n }\n break;\n case 113:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'Q';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + 'OQ';\n }\n break;\n case 114:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'R';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + 'OR';\n }\n break;\n case 115:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[1;' + (modifiers + 1) + 'S';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + 'OS';\n }\n break;\n case 116:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[15;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[15~';\n }\n break;\n case 117:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[17;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[17~';\n }\n break;\n case 118:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[18;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[18~';\n }\n break;\n case 119:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[19;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[19~';\n }\n break;\n case 120:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[20;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[20~';\n }\n break;\n case 121:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[21;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[21~';\n }\n break;\n case 122:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[23;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[23~';\n }\n break;\n case 123:\n if (modifiers) {\n result.key = EscapeSequences_1.C0.ESC + '[24;' + (modifiers + 1) + '~';\n }\n else {\n result.key = EscapeSequences_1.C0.ESC + '[24~';\n }\n break;\n default:\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 }\n else if (ev.keyCode === 32) {\n result.key = String.fromCharCode(0);\n }\n else if (ev.keyCode >= 51 && ev.keyCode <= 55) {\n result.key = String.fromCharCode(ev.keyCode - 51 + 27);\n }\n else if (ev.keyCode === 56) {\n result.key = String.fromCharCode(127);\n }\n else if (ev.keyCode === 219) {\n result.key = String.fromCharCode(27);\n }\n else if (ev.keyCode === 220) {\n result.key = String.fromCharCode(28);\n }\n else if (ev.keyCode === 221) {\n result.key = String.fromCharCode(29);\n }\n }\n else if (!this.browser.isMac && ev.altKey && !ev.ctrlKey && !ev.metaKey) {\n if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n result.key = EscapeSequences_1.C0.ESC + String.fromCharCode(ev.keyCode + 32);\n }\n else if (ev.keyCode === 192) {\n result.key = EscapeSequences_1.C0.ESC + '`';\n }\n else if (ev.keyCode >= 48 && ev.keyCode <= 57) {\n result.key = EscapeSequences_1.C0.ESC + (ev.keyCode - 48);\n }\n }\n else if (this.browser.isMac && !ev.altKey && !ev.ctrlKey && ev.metaKey) {\n if (ev.keyCode === 65) {\n this.selectAll();\n }\n }\n break;\n }\n return result;\n};\nTerminal.prototype.setgLevel = function (g) {\n this.glevel = g;\n this.charset = this.charsets[g];\n};\nTerminal.prototype.setgCharset = function (g, charset) {\n this.charsets[g] = charset;\n if (this.glevel === g) {\n this.charset = charset;\n }\n};\nTerminal.prototype.keyPress = function (ev) {\n var key;\n if (this.customKeyEventHandler && this.customKeyEventHandler(ev) === false) {\n return false;\n }\n this.cancel(ev);\n if (ev.charCode) {\n key = ev.charCode;\n }\n else if (ev.which == null) {\n key = ev.keyCode;\n }\n else if (ev.which !== 0 && ev.charCode !== 0) {\n key = ev.which;\n }\n else {\n return false;\n }\n if (!key || ((ev.altKey || ev.ctrlKey || ev.metaKey) && !isThirdLevelShift(this, ev))) {\n return false;\n }\n key = String.fromCharCode(key);\n this.emit('keypress', key, ev);\n this.emit('key', key, ev);\n this.showCursor();\n this.handler(key);\n return true;\n};\nTerminal.prototype.send = function (data) {\n var self = this;\n if (!this.queue) {\n setTimeout(function () {\n self.handler(self.queue);\n self.queue = '';\n }, 1);\n }\n this.queue += data;\n};\nTerminal.prototype.bell = function () {\n if (!this.visualBell)\n return;\n var self = this;\n this.element.style.borderColor = 'white';\n setTimeout(function () {\n self.element.style.borderColor = '';\n }, 10);\n if (this.popOnBell)\n this.focus();\n};\nTerminal.prototype.log = function () {\n if (!this.debug)\n return;\n if (!this.context.console || !this.context.console.log)\n return;\n var args = Array.prototype.slice.call(arguments);\n this.context.console.log.apply(this.context.console, args);\n};\nTerminal.prototype.error = function () {\n if (!this.debug)\n return;\n if (!this.context.console || !this.context.console.error)\n return;\n var args = Array.prototype.slice.call(arguments);\n this.context.console.error.apply(this.context.console, args);\n};\nTerminal.prototype.resize = function (x, y) {\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n if (y > this.getOption('scrollback')) {\n this.setOption('scrollback', y);\n }\n var line, el, i, j, ch, addToY;\n if (x === this.cols && y === this.rows) {\n return;\n }\n if (x < 1)\n x = 1;\n if (y < 1)\n y = 1;\n j = this.cols;\n if (j < x) {\n ch = [this.defAttr, ' ', 1];\n i = this.lines.length;\n while (i--) {\n while (this.lines.get(i).length < x) {\n this.lines.get(i).push(ch);\n }\n }\n }\n this.cols = x;\n this.setupStops(this.cols);\n j = this.rows;\n addToY = 0;\n if (j < y) {\n el = this.element;\n while (j++ < y) {\n if (this.lines.length < y + this.ybase) {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n this.ydisp--;\n }\n }\n else {\n this.lines.push(this.blankLine());\n }\n }\n if (this.children.length < y) {\n this.insertRow();\n }\n }\n }\n else {\n while (j-- > y) {\n if (this.lines.length > y + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n this.lines.pop();\n }\n else {\n this.ybase++;\n this.ydisp++;\n }\n }\n if (this.children.length > y) {\n el = this.children.shift();\n if (!el)\n continue;\n el.parentNode.removeChild(el);\n }\n }\n }\n this.rows = y;\n if (this.y >= y) {\n this.y = y - 1;\n }\n if (addToY) {\n this.y += addToY;\n }\n if (this.x >= x) {\n this.x = x - 1;\n }\n this.scrollTop = 0;\n this.scrollBottom = y - 1;\n this.charMeasure.measure();\n this.refresh(0, this.rows - 1);\n this.normal = null;\n this.geometry = [this.cols, this.rows];\n this.emit('resize', { terminal: this, cols: x, rows: y });\n};\nTerminal.prototype.updateRange = function (y) {\n if (y < this.refreshStart)\n this.refreshStart = y;\n if (y > this.refreshEnd)\n this.refreshEnd = y;\n};\nTerminal.prototype.maxRange = function () {\n this.refreshStart = 0;\n this.refreshEnd = this.rows - 1;\n};\nTerminal.prototype.setupStops = function (i) {\n if (i != null) {\n if (!this.tabs[i]) {\n i = this.prevStop(i);\n }\n }\n else {\n this.tabs = {};\n i = 0;\n }\n for (; i < this.cols; i += this.getOption('tabStopWidth')) {\n this.tabs[i] = true;\n }\n};\nTerminal.prototype.prevStop = function (x) {\n if (x == null)\n x = this.x;\n while (!this.tabs[--x] && x > 0)\n ;\n return x >= this.cols\n ? this.cols - 1\n : x < 0 ? 0 : x;\n};\nTerminal.prototype.nextStop = function (x) {\n if (x == null)\n x = this.x;\n while (!this.tabs[++x] && x < this.cols)\n ;\n return x >= this.cols\n ? this.cols - 1\n : x < 0 ? 0 : x;\n};\nTerminal.prototype.eraseRight = function (x, y) {\n var line = this.lines.get(this.ybase + y);\n if (!line) {\n return;\n }\n var ch = [this.eraseAttr(), ' ', 1];\n for (; x < this.cols; x++) {\n line[x] = ch;\n }\n this.updateRange(y);\n};\nTerminal.prototype.eraseLeft = function (x, y) {\n var line = this.lines.get(this.ybase + y);\n if (!line) {\n return;\n }\n var ch = [this.eraseAttr(), ' ', 1];\n x++;\n while (x--) {\n line[x] = ch;\n }\n this.updateRange(y);\n};\nTerminal.prototype.clear = function () {\n if (this.ybase === 0 && this.y === 0) {\n return;\n }\n this.lines.set(0, this.lines.get(this.ybase + this.y));\n this.lines.length = 1;\n this.ydisp = 0;\n this.ybase = 0;\n this.y = 0;\n for (var i = 1; i < this.rows; i++) {\n this.lines.push(this.blankLine());\n }\n this.refresh(0, this.rows - 1);\n this.emit('scroll', this.ydisp);\n};\nTerminal.prototype.eraseLine = function (y) {\n this.eraseRight(0, y);\n};\nTerminal.prototype.blankLine = function (cur, isWrapped) {\n var attr = cur\n ? this.eraseAttr()\n : this.defAttr;\n var ch = [attr, ' ', 1], line = [], i = 0;\n if (isWrapped) {\n line.isWrapped = isWrapped;\n }\n for (; i < this.cols; i++) {\n line[i] = ch;\n }\n return line;\n};\nTerminal.prototype.ch = function (cur) {\n return cur\n ? [this.eraseAttr(), ' ', 1]\n : [this.defAttr, ' ', 1];\n};\nTerminal.prototype.is = function (term) {\n var name = this.termName;\n return (name + '').indexOf(term) === 0;\n};\nTerminal.prototype.handler = function (data) {\n if (this.options.disableStdin) {\n return;\n }\n if (this.ybase !== this.ydisp) {\n this.scrollToBottom();\n }\n this.emit('data', data);\n};\nTerminal.prototype.handleTitle = function (title) {\n this.emit('title', title);\n};\nTerminal.prototype.index = function () {\n this.y++;\n if (this.y > this.scrollBottom) {\n this.y--;\n this.scroll();\n }\n if (this.x >= this.cols) {\n this.x--;\n }\n};\nTerminal.prototype.reverseIndex = function () {\n var j;\n if (this.y === this.scrollTop) {\n this.lines.shiftElements(this.y + this.ybase, this.rows - 1, 1);\n this.lines.set(this.y + this.ybase, this.blankLine(true));\n this.updateRange(this.scrollTop);\n this.updateRange(this.scrollBottom);\n }\n else {\n this.y--;\n }\n};\nTerminal.prototype.reset = function () {\n this.options.rows = this.rows;\n this.options.cols = this.cols;\n var customKeyEventHandler = this.customKeyEventHandler;\n var cursorBlinkInterval = this.cursorBlinkInterval;\n Terminal.call(this, this.options);\n this.customKeyEventHandler = customKeyEventHandler;\n this.cursorBlinkInterval = cursorBlinkInterval;\n this.refresh(0, this.rows - 1);\n this.viewport.syncScrollArea();\n};\nTerminal.prototype.tabSet = function () {\n this.tabs[this.x] = true;\n};\nfunction on(el, type, handler, capture) {\n if (!Array.isArray(el)) {\n el = [el];\n }\n el.forEach(function (element) {\n element.addEventListener(type, handler, capture || false);\n });\n}\nfunction off(el, type, handler, capture) {\n el.removeEventListener(type, handler, capture || false);\n}\nfunction cancel(ev, force) {\n if (!this.cancelEvents && !force) {\n return;\n }\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n}\nfunction inherits(child, parent) {\n function f() {\n this.constructor = child;\n }\n f.prototype = parent.prototype;\n child.prototype = new f;\n}\nfunction indexOf(obj, el) {\n var i = obj.length;\n while (i--) {\n if (obj[i] === el)\n return i;\n }\n return -1;\n}\nfunction isThirdLevelShift(term, ev) {\n var thirdLevelKey = (term.browser.isMac && ev.altKey && !ev.ctrlKey && !ev.metaKey) ||\n (term.browser.isMSWindows && ev.altKey && ev.ctrlKey && !ev.metaKey);\n if (ev.type == 'keypress') {\n return thirdLevelKey;\n }\n return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);\n}\nTerminal.prototype.matchColor = matchColor;\nfunction matchColor(r1, g1, b1) {\n var hash = (r1 << 16) | (g1 << 8) | b1;\n if (matchColor._cache[hash] != null) {\n return matchColor._cache[hash];\n }\n var ldiff = Infinity, li = -1, i = 0, c, r2, g2, b2, diff;\n for (; i < Terminal.vcolors.length; i++) {\n c = Terminal.vcolors[i];\n r2 = c[0];\n g2 = c[1];\n b2 = c[2];\n diff = matchColor.distance(r1, g1, b1, r2, g2, b2);\n if (diff === 0) {\n li = i;\n break;\n }\n if (diff < ldiff) {\n ldiff = diff;\n li = i;\n }\n }\n return matchColor._cache[hash] = li;\n}\nmatchColor._cache = {};\nmatchColor.distance = function (r1, g1, b1, r2, g2, b2) {\n return Math.pow(30 * (r1 - r2), 2)\n + Math.pow(59 * (g1 - g2), 2)\n + Math.pow(11 * (b1 - b2), 2);\n};\nfunction each(obj, iter, con) {\n if (obj.forEach)\n return obj.forEach(iter, con);\n for (var i = 0; i < obj.length; i++) {\n iter.call(con, obj[i], i, obj);\n }\n}\nfunction wasMondifierKeyOnlyEvent(ev) {\n return ev.keyCode === 16 ||\n ev.keyCode === 17 ||\n ev.keyCode === 18;\n}\nfunction keys(obj) {\n if (Object.keys)\n return Object.keys(obj);\n var key, keys = [];\n for (key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n keys.push(key);\n }\n }\n return keys;\n}\nTerminal.EventEmitter = EventEmitter_1.EventEmitter;\nTerminal.inherits = inherits;\nTerminal.on = on;\nTerminal.off = off;\nTerminal.cancel = cancel;\nmodule.exports = Terminal;\n\n//# sourceMappingURL=xterm.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/xterm.js\n// module id = 0\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n;\nvar EventEmitter = (function () {\n function EventEmitter() {\n this._events = this._events || {};\n }\n EventEmitter.prototype.on = function (type, listener) {\n this._events[type] = this._events[type] || [];\n this._events[type].push(listener);\n };\n EventEmitter.prototype.off = function (type, listener) {\n if (!this._events[type]) {\n return;\n }\n var obj = this._events[type];\n var i = obj.length;\n while (i--) {\n if (obj[i] === listener || obj[i].listener === listener) {\n obj.splice(i, 1);\n return;\n }\n }\n };\n EventEmitter.prototype.removeAllListeners = function (type) {\n if (this._events[type]) {\n delete this._events[type];\n }\n };\n EventEmitter.prototype.once = function (type, listener) {\n function on() {\n var args = Array.prototype.slice.call(arguments);\n this.off(type, on);\n return listener.apply(this, args);\n }\n on.listener = listener;\n return this.on(type, on);\n };\n EventEmitter.prototype.emit = function (type) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (!this._events[type]) {\n return;\n }\n var obj = this._events[type];\n for (var i = 0; i < obj.length; i++) {\n obj[i].apply(this, args);\n }\n };\n EventEmitter.prototype.listeners = function (type) {\n return this._events[type] || [];\n };\n return EventEmitter;\n}());\nexports.EventEmitter = EventEmitter;\n\n//# sourceMappingURL=EventEmitter.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/EventEmitter.js\n// module id = 1\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar C0;\n(function (C0) {\n C0.NUL = '\\x00';\n C0.SOH = '\\x01';\n C0.STX = '\\x02';\n C0.ETX = '\\x03';\n C0.EOT = '\\x04';\n C0.ENQ = '\\x05';\n C0.ACK = '\\x06';\n C0.BEL = '\\x07';\n C0.BS = '\\x08';\n C0.HT = '\\x09';\n C0.LF = '\\x0a';\n C0.VT = '\\x0b';\n C0.FF = '\\x0c';\n C0.CR = '\\x0d';\n C0.SO = '\\x0e';\n C0.SI = '\\x0f';\n C0.DLE = '\\x10';\n C0.DC1 = '\\x11';\n C0.DC2 = '\\x12';\n C0.DC3 = '\\x13';\n C0.DC4 = '\\x14';\n C0.NAK = '\\x15';\n C0.SYN = '\\x16';\n C0.ETB = '\\x17';\n C0.CAN = '\\x18';\n C0.EM = '\\x19';\n C0.SUB = '\\x1a';\n C0.ESC = '\\x1b';\n C0.FS = '\\x1c';\n C0.GS = '\\x1d';\n C0.RS = '\\x1e';\n C0.US = '\\x1f';\n C0.SP = '\\x20';\n C0.DEL = '\\x7f';\n})(C0 = exports.C0 || (exports.C0 = {}));\n;\n\n//# sourceMappingURL=EscapeSequences.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/EscapeSequences.js\n// module id = 2\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CHARSETS = {};\nexports.DEFAULT_CHARSET = exports.CHARSETS['B'];\nexports.CHARSETS['0'] = {\n '`': '\\u25c6',\n 'a': '\\u2592',\n 'b': '\\u0009',\n 'c': '\\u000c',\n 'd': '\\u000d',\n 'e': '\\u000a',\n 'f': '\\u00b0',\n 'g': '\\u00b1',\n 'h': '\\u2424',\n 'i': '\\u000b',\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};\nexports.CHARSETS['A'] = {\n '#': '£'\n};\nexports.CHARSETS['B'] = null;\nexports.CHARSETS['4'] = {\n '#': '£',\n '@': '¾',\n '[': 'ij',\n '\\\\': '½',\n ']': '|',\n '{': '¨',\n '|': 'f',\n '}': '¼',\n '~': '´'\n};\nexports.CHARSETS['C'] =\n exports.CHARSETS['5'] = {\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Ã…',\n '^': 'Ãœ',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'Ã¥',\n '~': 'ü'\n };\nexports.CHARSETS['R'] = {\n '#': '£',\n '@': 'à',\n '[': '°',\n '\\\\': 'ç',\n ']': '§',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': '¨'\n};\nexports.CHARSETS['Q'] = {\n '@': 'à',\n '[': 'â',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n '`': 'ô',\n '{': 'é',\n '|': 'ù',\n '}': 'è',\n '~': 'û'\n};\nexports.CHARSETS['K'] = {\n '@': '§',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Ãœ',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'ß'\n};\nexports.CHARSETS['Y'] = {\n '#': '£',\n '@': '§',\n '[': '°',\n '\\\\': 'ç',\n ']': 'é',\n '`': 'ù',\n '{': 'à',\n '|': 'ò',\n '}': 'è',\n '~': 'ì'\n};\nexports.CHARSETS['E'] =\n exports.CHARSETS['6'] = {\n '@': 'Ä',\n '[': 'Æ',\n '\\\\': 'Ø',\n ']': 'Ã…',\n '^': 'Ãœ',\n '`': 'ä',\n '{': 'æ',\n '|': 'ø',\n '}': 'Ã¥',\n '~': 'ü'\n };\nexports.CHARSETS['Z'] = {\n '#': '£',\n '@': '§',\n '[': '¡',\n '\\\\': 'Ñ',\n ']': '¿',\n '{': '°',\n '|': 'ñ',\n '}': 'ç'\n};\nexports.CHARSETS['H'] =\n exports.CHARSETS['7'] = {\n '@': 'É',\n '[': 'Ä',\n '\\\\': 'Ö',\n ']': 'Ã…',\n '^': 'Ãœ',\n '`': 'é',\n '{': 'ä',\n '|': 'ö',\n '}': 'Ã¥',\n '~': 'ü'\n };\nexports.CHARSETS['='] = {\n '#': 'ù',\n '@': 'à',\n '[': 'é',\n '\\\\': 'ç',\n ']': 'ê',\n '^': 'î',\n '_': 'è',\n '`': 'ô',\n '{': 'ä',\n '|': 'ö',\n '}': 'ü',\n '~': 'û'\n};\n\n//# sourceMappingURL=Charsets.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Charsets.js\n// module id = 3\n// module chunks = 0","/**\n * Implements the attach method, that attaches the terminal to a WebSocket stream.\n * @module xterm/addons/attach/attach\n * @license MIT\n */\n\n(function (attach) {\n if (typeof exports === 'object' && typeof module === 'object') {\n /*\n * CommonJS environment\n */\n module.exports = attach(require('../../xterm'));\n } else if (typeof define == 'function') {\n /*\n * Require.js is available\n */\n define(['../../xterm'], attach);\n } else {\n /*\n * Plain browser environment\n */\n attach(window.Terminal);\n }\n})(function (Xterm) {\n 'use strict';\n\n var exports = {};\n\n /**\n * Attaches the given terminal to the given socket.\n *\n * @param {Xterm} term - The terminal to be attached to the given socket.\n * @param {WebSocket} socket - The socket to attach the current terminal.\n * @param {boolean} bidirectional - Whether the terminal should send data\n * to the socket as well.\n * @param {boolean} buffered - Whether the rendering of incoming data\n * should happen instantly or at a maximum\n * frequency of 1 rendering per 10ms.\n */\n exports.attach = function (term, socket, bidirectional, buffered) {\n bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;\n term.socket = socket;\n\n term._flushBuffer = function () {\n term.write(term._attachSocketBuffer);\n term._attachSocketBuffer = null;\n clearTimeout(term._attachSocketBufferTimer);\n term._attachSocketBufferTimer = null;\n };\n\n term._pushToBuffer = function (data) {\n if (term._attachSocketBuffer) {\n term._attachSocketBuffer += data;\n } else {\n term._attachSocketBuffer = data;\n setTimeout(term._flushBuffer, 10);\n }\n };\n\n term._getMessage = function (ev) {\n if (buffered) {\n term._pushToBuffer(ev.data);\n } else {\n term.write(ev.data);\n }\n };\n\n term._sendData = function (data) {\n socket.send(data);\n };\n\n socket.addEventListener('message', term._getMessage);\n\n if (bidirectional) {\n term.on('data', term._sendData);\n }\n\n socket.addEventListener('close', term.detach.bind(term, socket));\n socket.addEventListener('error', term.detach.bind(term, socket));\n };\n\n /**\n * Detaches the given terminal from the given socket\n *\n * @param {Xterm} term - The terminal to be detached from the given socket.\n * @param {WebSocket} socket - The socket from which to detach the current\n * terminal.\n */\n exports.detach = function (term, socket) {\n term.off('data', term._sendData);\n\n socket = (typeof socket == 'undefined') ? term.socket : socket;\n\n if (socket) {\n socket.removeEventListener('message', term._getMessage);\n }\n\n delete term.socket;\n };\n\n /**\n * Attaches the current terminal to the given socket\n *\n * @param {WebSocket} socket - The socket to attach the current terminal.\n * @param {boolean} bidirectional - Whether the terminal should send data\n * to the socket as well.\n * @param {boolean} buffered - Whether the rendering of incoming data\n * should happen instantly or at a maximum\n * frequency of 1 rendering per 10ms.\n */\n Xterm.prototype.attach = function (socket, bidirectional, buffered) {\n return exports.attach(this, socket, bidirectional, buffered);\n };\n\n /**\n * Detaches the current terminal from the given socket.\n *\n * @param {WebSocket} socket - The socket from which to detach the current\n * terminal.\n */\n Xterm.prototype.detach = function (socket) {\n return exports.detach(this, socket);\n };\n\n return exports;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/attach/attach.js\n// module id = 4\n// module chunks = 0","/**\n * Fit terminal columns and rows to the dimensions of its DOM element.\n *\n * ## Approach\n * - Rows: Truncate the division of the terminal parent element height by the terminal row height.\n *\n * - Columns: Truncate the division of the terminal parent element width by the terminal character\n * width (apply display: inline at the terminal row and truncate its width with the current\n * number of columns).\n * @module xterm/addons/fit/fit\n * @license MIT\n */\n\n(function (fit) {\n if (typeof exports === 'object' && typeof module === 'object') {\n /*\n * CommonJS environment\n */\n module.exports = fit(require('../../xterm'));\n } else if (typeof define == 'function') {\n /*\n * Require.js is available\n */\n define(['../../xterm'], fit);\n } else {\n /*\n * Plain browser environment\n */\n fit(window.Terminal);\n }\n})(function (Xterm) {\n var exports = {};\n\n exports.proposeGeometry = function (term) {\n if (!term.element.parentElement) {\n return null;\n }\n var parentElementStyle = window.getComputedStyle(term.element.parentElement),\n parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),\n parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')) - 17),\n elementStyle = window.getComputedStyle(term.element),\n elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')),\n elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')),\n availableHeight = parentElementHeight - elementPaddingVer,\n availableWidth = parentElementWidth - elementPaddingHor,\n container = term.rowContainer,\n subjectRow = term.rowContainer.firstElementChild,\n contentBuffer = subjectRow.innerHTML,\n characterHeight,\n rows,\n characterWidth,\n cols,\n geometry;\n\n subjectRow.style.display = 'inline';\n subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace\n characterWidth = subjectRow.getBoundingClientRect().width;\n subjectRow.style.display = ''; // Revert style before calculating height, since they differ.\n characterHeight = subjectRow.getBoundingClientRect().height;\n subjectRow.innerHTML = contentBuffer;\n\n rows = parseInt(availableHeight / characterHeight);\n cols = parseInt(availableWidth / characterWidth);\n\n geometry = {cols: cols, rows: rows};\n return geometry;\n };\n\n exports.fit = function (term) {\n var geometry = exports.proposeGeometry(term);\n\n if (geometry) {\n term.resize(geometry.cols, geometry.rows);\n }\n };\n\n Xterm.prototype.proposeGeometry = function () {\n return exports.proposeGeometry(this);\n };\n\n Xterm.prototype.fit = function () {\n return exports.fit(this);\n };\n\n return exports;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/fit/fit.js\n// module id = 5\n// module chunks = 0","/**\n * Fullscreen addon for xterm.js\n * @module xterm/addons/fullscreen/fullscreen\n * @license MIT\n */\n(function (fullscreen) {\n if (typeof exports === 'object' && typeof module === 'object') {\n /*\n * CommonJS environment\n */\n module.exports = fullscreen(require('../../xterm'));\n } else if (typeof define == 'function') {\n /*\n * Require.js is available\n */\n define(['../../xterm'], fullscreen);\n } else {\n /*\n * Plain browser environment\n */\n fullscreen(window.Terminal);\n }\n})(function (Xterm) {\n var exports = {};\n\n /**\n * Toggle the given terminal's fullscreen mode.\n * @param {Xterm} term - The terminal to toggle full screen mode\n * @param {boolean} fullscreen - Toggle fullscreen on (true) or off (false)\n */\n exports.toggleFullScreen = function (term, fullscreen) {\n var fn;\n\n if (typeof fullscreen == 'undefined') {\n fn = (term.element.classList.contains('fullscreen')) ? 'remove' : 'add';\n } else if (!fullscreen) {\n fn = 'remove';\n } else {\n fn = 'add';\n }\n\n term.element.classList[fn]('fullscreen');\n };\n\n Xterm.prototype.toggleFullscreen = function (fullscreen) {\n exports.toggleFullScreen(this, fullscreen);\n };\n\n return exports;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/fullscreen/fullscreen.js\n// module id = 6\n// module chunks = 0","/**\n * This module provides methods for attaching a terminal to a terminado WebSocket stream.\n *\n * @module xterm/addons/terminado/terminado\n * @license MIT\n */\n\n(function (attach) {\n if (typeof exports === 'object' && typeof module === 'object') {\n /*\n * CommonJS environment\n */\n module.exports = attach(require('../../xterm'));\n } else if (typeof define == 'function') {\n /*\n * Require.js is available\n */\n define(['../../xterm'], attach);\n } else {\n /*\n * Plain browser environment\n */\n attach(window.Terminal);\n }\n})(function (Xterm) {\n 'use strict';\n\n var exports = {};\n\n /**\n * Attaches the given terminal to the given socket.\n *\n * @param {Xterm} term - The terminal to be attached to the given socket.\n * @param {WebSocket} socket - The socket to attach the current terminal.\n * @param {boolean} bidirectional - Whether the terminal should send data\n * to the socket as well.\n * @param {boolean} buffered - Whether the rendering of incoming data\n * should happen instantly or at a maximum\n * frequency of 1 rendering per 10ms.\n */\n exports.terminadoAttach = function (term, socket, bidirectional, buffered) {\n bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;\n term.socket = socket;\n\n term._flushBuffer = function () {\n term.write(term._attachSocketBuffer);\n term._attachSocketBuffer = null;\n clearTimeout(term._attachSocketBufferTimer);\n term._attachSocketBufferTimer = null;\n };\n\n term._pushToBuffer = function (data) {\n if (term._attachSocketBuffer) {\n term._attachSocketBuffer += data;\n } else {\n term._attachSocketBuffer = data;\n setTimeout(term._flushBuffer, 10);\n }\n };\n\n term._getMessage = function (ev) {\n var data = JSON.parse(ev.data)\n if( data[0] == \"stdout\" ) {\n if (buffered) {\n term._pushToBuffer(data[1]);\n } else {\n term.write(data[1]);\n }\n }\n };\n\n term._sendData = function (data) {\n socket.send(JSON.stringify(['stdin', data]));\n };\n\n term._setSize = function (size) {\n socket.send(JSON.stringify(['set_size', size.rows, size.cols]));\n };\n\n socket.addEventListener('message', term._getMessage);\n\n if (bidirectional) {\n term.on('data', term._sendData);\n }\n term.on('resize', term._setSize);\n\n socket.addEventListener('close', term.terminadoDetach.bind(term, socket));\n socket.addEventListener('error', term.terminadoDetach.bind(term, socket));\n };\n\n /**\n * Detaches the given terminal from the given socket\n *\n * @param {Xterm} term - The terminal to be detached from the given socket.\n * @param {WebSocket} socket - The socket from which to detach the current\n * terminal.\n */\n exports.terminadoDetach = function (term, socket) {\n term.off('data', term._sendData);\n\n socket = (typeof socket == 'undefined') ? term.socket : socket;\n\n if (socket) {\n socket.removeEventListener('message', term._getMessage);\n }\n\n delete term.socket;\n };\n\n /**\n * Attaches the current terminal to the given socket\n *\n * @param {WebSocket} socket - The socket to attach the current terminal.\n * @param {boolean} bidirectional - Whether the terminal should send data\n * to the socket as well.\n * @param {boolean} buffered - Whether the rendering of incoming data\n * should happen instantly or at a maximum\n * frequency of 1 rendering per 10ms.\n */\n Xterm.prototype.terminadoAttach = function (socket, bidirectional, buffered) {\n return exports.terminadoAttach(this, socket, bidirectional, buffered);\n };\n\n /**\n * Detaches the current terminal from the given socket.\n *\n * @param {WebSocket} socket - The socket from which to detach the current\n * terminal.\n */\n Xterm.prototype.terminadoDetach = function (socket) {\n return exports.terminadoDetach(this, socket);\n };\n\n return exports;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/terminado/terminado.js\n// module id = 7\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Generic_1 = require(\"./Generic\");\nvar isNode = (typeof navigator === 'undefined') ? true : false;\nvar userAgent = (isNode) ? 'node' : navigator.userAgent;\nvar platform = (isNode) ? 'node' : navigator.platform;\nexports.isFirefox = !!~userAgent.indexOf('Firefox');\nexports.isMSIE = !!~userAgent.indexOf('MSIE') || !!~userAgent.indexOf('Trident');\nexports.isMac = Generic_1.contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform);\nexports.isIpad = platform === 'iPad';\nexports.isIphone = platform === 'iPhone';\nexports.isMSWindows = Generic_1.contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform);\nexports.isLinux = platform.indexOf('Linux') >= 0;\n\n//# sourceMappingURL=Browser.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/Browser.js\n// module id = 8\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction getCoordsRelativeToElement(event, element) {\n if (event.pageX == null) {\n return null;\n }\n var x = event.pageX;\n var y = event.pageY;\n while (element && element !== self.document.documentElement) {\n x -= element.offsetLeft;\n y -= element.offsetTop;\n element = 'offsetParent' in element ? element.offsetParent : element.parentElement;\n }\n return [x, y];\n}\nexports.getCoordsRelativeToElement = getCoordsRelativeToElement;\nfunction getCoords(event, rowContainer, charMeasure, colCount, rowCount, isSelection) {\n var coords = getCoordsRelativeToElement(event, rowContainer);\n coords[0] = Math.ceil((coords[0] + (isSelection ? charMeasure.width / 2 : 0)) / charMeasure.width);\n coords[1] = Math.ceil(coords[1] / charMeasure.height);\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + 1);\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount + 1);\n return coords;\n}\nexports.getCoords = getCoords;\nfunction getRawByteCoords(event, rowContainer, charMeasure, colCount, rowCount) {\n var coords = getCoords(event, rowContainer, charMeasure, colCount, rowCount);\n var x = coords[0];\n var y = coords[1];\n x += 32;\n y += 32;\n return { x: x, y: y };\n}\nexports.getRawByteCoords = getRawByteCoords;\n\n//# sourceMappingURL=Mouse.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/Mouse.js\n// module id = 9\n// module chunks = 0","import * as bare from \"libapps\";\n\nexport class Hterm {\n elem: HTMLElement;\n\n term: bare.Terminal;\n io: bare.IO;\n\n columns: number;\n rows: number;\n\n // to \"show\" the current message when removeMessage() is called\n message: string;\n\n constructor(elem: HTMLElement) {\n this.elem = elem;\n bare.hterm.defaultStorage = new bare.lib.Storage.Memory();\n this.term = new bare.hterm.Terminal();\n this.term.getPrefs().set(\"send-encoding\", \"raw\");\n this.term.decorate(this.elem);\n\n this.io = this.term.io.push();\n this.term.installKeyboard();\n };\n\n info(): { columns: number, rows: number } {\n return { columns: this.columns, rows: this.rows };\n };\n\n output(data: string) {\n if (this.term.io != null) {\n this.term.io.writeUTF16(data);\n }\n };\n\n showMessage(message: string, timeout: number) {\n this.message = message;\n if (timeout > 0) {\n this.term.io.showOverlay(message, timeout);\n } else {\n this.term.io.showOverlay(message, null);\n }\n };\n\n removeMessage(): void {\n // there is no hideOverlay(), so show the same message with 0 sec\n this.term.io.showOverlay(this.message, 0);\n }\n\n setWindowTitle(title: string) {\n this.term.setWindowTitle(title);\n };\n\n setPreferences(value: object) {\n Object.keys(value).forEach((key) => {\n this.term.getPrefs().set(key, value[key]);\n });\n };\n\n onInput(callback: (input: string) => void) {\n this.io.onVTKeystroke = (data) => {\n callback(data);\n };\n this.io.sendString = (data) => {\n callback(data);\n };\n };\n\n onResize(callback: (colmuns: number, rows: number) => void) {\n this.io.onTerminalResize = (columns: number, rows: number) => {\n this.columns = columns;\n this.rows = rows;\n callback(columns, rows);\n };\n };\n\n deactivate(): void {\n this.io.onVTKeystroke = null;\n this.io.sendString = null\n this.io.onTerminalResize = null;\n this.term.uninstallKeyboard();\n }\n\n reset(): void {\n this.removeMessage();\n this.term.installKeyboard();\n }\n\n close(): void {\n this.term.uninstallKeyboard();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/hterm.ts","export class ConnectionFactory {\n url: string;\n protocols: string[];\n\n constructor(url: string, protocols: string[]) {\n this.url = url;\n this.protocols = protocols;\n };\n\n create(): Connection {\n return new Connection(this.url, this.protocols);\n };\n}\n\nexport class Connection {\n bare: WebSocket;\n\n\n constructor(url: string, protocols: string[]) {\n this.bare = new WebSocket(url, protocols);\n }\n\n open() {\n // nothing todo for websocket\n };\n\n close() {\n this.bare.close();\n };\n\n send(data: string) {\n this.bare.send(data);\n };\n\n isOpen(): boolean {\n if (this.bare.readyState == WebSocket.CONNECTING ||\n this.bare.readyState == WebSocket.OPEN) {\n return true\n }\n return false\n }\n\n onOpen(callback: () => void) {\n this.bare.onopen = (event) => {\n callback();\n }\n };\n\n onReceive(callback: (data: string) => void) {\n this.bare.onmessage = (event) => {\n callback(event.data);\n }\n };\n\n onClose(callback: () => void) {\n this.bare.onclose = (event) => {\n callback();\n };\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/websocket.ts","export const protocols = [\"webtty\"];\n\nexport const msgInputUnknown = '0';\nexport const msgInput = '1';\nexport const msgPing = '2';\nexport const msgResizeTerminal = '3';\n\nexport const msgUnknownOutput = '0';\nexport const msgOutput = '1';\nexport const msgPong = '2';\nexport const msgSetWindowTitle = '3';\nexport const msgSetPreferences = '4';\nexport const msgSetReconnect = '5';\n\n\nexport interface Terminal {\n info(): { columns: number, rows: number };\n output(data: string): void;\n showMessage(message: string, timeout: number): void;\n removeMessage(): void;\n setWindowTitle(title: string): void;\n setPreferences(value: object): void;\n onInput(callback: (input: string) => void): void;\n onResize(callback: (colmuns: number, rows: number) => void): void;\n reset(): void;\n deactivate(): void;\n close(): void;\n}\n\nexport interface Connection {\n open(): void;\n close(): void;\n send(data: string): void;\n isOpen(): boolean;\n onOpen(callback: () => void): void;\n onReceive(callback: (data: string) => void): void;\n onClose(callback: () => void): void;\n}\n\nexport interface ConnectionFactory {\n create(): Connection;\n}\n\n\nexport class WebTTY {\n term: Terminal;\n connectionFactory: ConnectionFactory;\n args: string;\n authToken: string;\n reconnect: number;\n\n constructor(term: Terminal, connectionFactory: ConnectionFactory, args: string, authToken: string) {\n this.term = term;\n this.connectionFactory = connectionFactory;\n this.args = args;\n this.authToken = authToken;\n this.reconnect = -1;\n };\n\n open() {\n let connection = this.connectionFactory.create();\n let pingTimer: number;\n let reconnectTimeout: number;\n\n const setup = () => {\n connection.onOpen(() => {\n const termInfo = this.term.info();\n\n connection.send(JSON.stringify(\n {\n Arguments: this.args,\n AuthToken: this.authToken,\n }\n ));\n\n\n const resizeHandler = (colmuns: number, rows: number) => {\n connection.send(\n msgResizeTerminal + JSON.stringify(\n {\n columns: colmuns,\n rows: rows\n }\n )\n );\n };\n\n this.term.onResize(resizeHandler);\n resizeHandler(termInfo.columns, termInfo.rows);\n\n this.term.onInput(\n (input: string) => {\n connection.send(msgInput + input);\n }\n );\n\n pingTimer = setInterval(() => {\n connection.send(msgPing)\n }, 30 * 1000);\n\n });\n\n connection.onReceive((data) => {\n const payload = data.slice(1);\n switch (data[0]) {\n case msgOutput:\n this.term.output(\n decodeURIComponent(Array.prototype.map.call(atob(payload), function(c) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''))\n );\n break;\n case msgPong:\n break;\n case msgSetWindowTitle:\n this.term.setWindowTitle(payload);\n break;\n case msgSetPreferences:\n const preferences = JSON.parse(payload);\n this.term.setPreferences(preferences);\n break;\n case msgSetReconnect:\n const autoReconnect = JSON.parse(payload);\n console.log(\"Enabling reconnect: \" + autoReconnect + \" seconds\")\n this.reconnect = autoReconnect;\n break;\n }\n });\n\n connection.onClose(() => {\n clearInterval(pingTimer);\n this.term.deactivate();\n this.term.showMessage(\"Connection Closed\", 0);\n if (this.reconnect > 0) {\n reconnectTimeout = setTimeout(() => {\n connection = this.connectionFactory.create();\n this.term.reset();\n setup();\n }, this.reconnect * 1000);\n }\n });\n\n connection.open();\n }\n\n setup();\n return () => {\n clearTimeout(reconnectTimeout);\n connection.close();\n }\n };\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/webtty.ts","import * as bare from \"xterm\";\n\nbare.loadAddon(\"fit\");\n\nexport class Xterm {\n elem: HTMLElement;\n\n message: HTMLElement;\n messageTimeout: number;\n messageTimer: number;\n\n term: bare;\n resizeListener: () => void;\n\n constructor(elem: HTMLElement) {\n this.elem = elem;\n this.term = new bare();\n\n this.message = elem.ownerDocument.createElement(\"div\");\n this.message.className = \"xterm-overlay\";\n this.messageTimeout = 2000;\n\n\n this.resizeListener = () => {\n this.term.fit();\n this.term.scrollToBottom();\n this.showMessage(String(this.term.cols) + \"x\" + String(this.term.rows), this.messageTimeout);\n };\n\n this.term.on(\"open\", () => {\n this.resizeListener();\n window.addEventListener(\"resize\", () => { this.resizeListener(); });\n });\n\n this.term.open(elem, true);\n };\n\n info(): { columns: number, rows: number } {\n return { columns: this.term.cols, rows: this.term.rows };\n };\n\n output(data: string) {\n this.term.write(data);\n };\n\n showMessage(message: string, timeout: number) {\n this.message.textContent = message;\n this.elem.appendChild(this.message);\n\n if (this.messageTimer) {\n clearTimeout(this.messageTimer);\n }\n if (timeout > 0) {\n this.messageTimer = setTimeout(() => {\n this.elem.removeChild(this.message);\n }, timeout);\n }\n };\n\n removeMessage(): void {\n if (this.message.parentNode == this.elem) {\n this.elem.removeChild(this.message);\n }\n }\n\n setWindowTitle(title: string) {\n document.title = title;\n };\n\n setPreferences(value: object) {\n };\n\n onInput(callback: (input: string) => void) {\n this.term.on(\"data\", (data) => {\n callback(data);\n });\n\n };\n\n onResize(callback: (colmuns: number, rows: number) => void) {\n this.term.on(\"resize\", (data) => {\n callback(data.cols, data.rows);\n });\n };\n\n deactivate(): void {\n this.term.off(\"data\");\n this.term.off(\"resize\");\n this.term.blur();\n }\n\n reset(): void {\n this.removeMessage();\n this.term.clear();\n }\n\n close(): void {\n window.removeEventListener(\"resize\", this.resizeListener);\n this.term.destroy();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/xterm.ts","// This file was generated by libdot/bin/concat.sh.\n// It has been marked read-only for your safety. Rather\n// than edit it directly, please modify one of these source\n// files...\n//\n// libdot/js/lib.js\n// libdot/js/lib_polyfill.js\n// libdot/js/lib_colors.js\n// libdot/js/lib_f.js\n// libdot/js/lib_message_manager.js\n// libdot/js/lib_preference_manager.js\n// libdot/js/lib_resource.js\n// libdot/js/lib_storage.js\n// libdot/js/lib_storage_chrome.js\n// libdot/js/lib_storage_local.js\n// libdot/js/lib_storage_memory.js\n// libdot/js/lib_test_manager.js\n// libdot/js/lib_utf8.js\n// libdot/third_party/wcwidth/lib_wc.js\n// hterm/js/hterm.js\n// hterm/js/hterm_frame.js\n// hterm/js/hterm_keyboard.js\n// hterm/js/hterm_keyboard_bindings.js\n// hterm/js/hterm_keyboard_keymap.js\n// hterm/js/hterm_keyboard_keypattern.js\n// hterm/js/hterm_options.js\n// hterm/js/hterm_parser.js\n// hterm/js/hterm_parser_identifiers.js\n// hterm/js/hterm_preference_manager.js\n// hterm/js/hterm_pubsub.js\n// hterm/js/hterm_screen.js\n// hterm/js/hterm_scrollport.js\n// hterm/js/hterm_terminal.js\n// hterm/js/hterm_terminal_io.js\n// hterm/js/hterm_text_attributes.js\n// hterm/js/hterm_vt.js\n// hterm/js/hterm_vt_character_map.js\n// hterm/js/hterm_export.js\n//\n\n// SOURCE FILE: libdot/js/lib.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nif (typeof lib != 'undefined')\n throw new Error('Global \"lib\" object already exists.');\n\nvar lib = {};\n\n/**\n * Map of \"dependency\" to [\"source\", ...].\n *\n * Each dependency is a object name, like \"lib.fs\", \"source\" is the url that\n * depends on the object.\n */\nlib.runtimeDependencies_ = {};\n\n/**\n * List of functions that need to be invoked during library initialization.\n *\n * Each element in the initCallbacks_ array is itself a two-element array.\n * Element 0 is a short string describing the owner of the init routine, useful\n * for debugging. Element 1 is the callback function.\n */\nlib.initCallbacks_ = [];\n\n/**\n * Records a runtime dependency.\n *\n * This can be useful when you want to express a run-time dependency at\n * compile time. It is not intended to be a full-fledged library system or\n * dependency tracker. It's just there to make it possible to debug the\n * deps without running all the code.\n *\n * Object names are specified as strings. For example...\n *\n * lib.rtdep('lib.colors', 'lib.PreferenceManager');\n *\n * Object names need not be rooted by 'lib'. You may use this to declare a\n * dependency on any object.\n *\n * The client program may call lib.ensureRuntimeDependencies() at startup in\n * order to ensure that all runtime dependencies have been met.\n *\n * @param {string} var_args One or more objects specified as strings.\n */\nlib.rtdep = function(var_args) {\n var source;\n\n try {\n throw new Error();\n } catch (ex) {\n var stackArray = ex.stack.split('\\n');\n // In Safari, the resulting stackArray will only have 2 elements and the\n // individual strings are formatted differently.\n if (stackArray.length >= 3) {\n source = stackArray[2].replace(/^\\s*at\\s+/, '');\n } else {\n source = stackArray[1].replace(/^\\s*global code@/, '');\n }\n }\n\n for (var i = 0; i < arguments.length; i++) {\n var path = arguments[i];\n if (path instanceof Array) {\n lib.rtdep.apply(lib, path);\n } else {\n var ary = this.runtimeDependencies_[path];\n if (!ary)\n ary = this.runtimeDependencies_[path] = [];\n ary.push(source);\n }\n }\n};\n\n/**\n * Ensures that all runtime dependencies are met, or an exception is thrown.\n *\n * Every unmet runtime dependency will be logged to the JS console. If at\n * least one dependency is unmet this will raise an exception.\n */\nlib.ensureRuntimeDependencies_ = function() {\n var passed = true;\n\n for (var path in lib.runtimeDependencies_) {\n var sourceList = lib.runtimeDependencies_[path];\n var names = path.split('.');\n\n // In a document context 'window' is the global object. In a worker it's\n // called 'self'.\n var obj = (window || self);\n for (var i = 0; i < names.length; i++) {\n if (!(names[i] in obj)) {\n console.warn('Missing \"' + path + '\" is needed by', sourceList);\n passed = false;\n break;\n }\n\n obj = obj[names[i]];\n }\n }\n\n if (!passed)\n throw new Error('Failed runtime dependency check');\n};\n\n/**\n * Register an initialization function.\n *\n * The initialization functions are invoked in registration order when\n * lib.init() is invoked. Each function will receive a single parameter, which\n * is a function to be invoked when it completes its part of the initialization.\n *\n * @param {string} name A short descriptive name of the init routine useful for\n * debugging.\n * @param {function(function)} callback The initialization function to register.\n * @return {function} The callback parameter.\n */\nlib.registerInit = function(name, callback) {\n lib.initCallbacks_.push([name, callback]);\n return callback;\n};\n\n/**\n * Initialize the library.\n *\n * This will ensure that all registered runtime dependencies are met, and\n * invoke any registered initialization functions.\n *\n * Initialization is asynchronous. The library is not ready for use until\n * the onInit function is invoked.\n *\n * @param {function()} onInit The function to invoke when initialization is\n * complete.\n * @param {function(*)} opt_logFunction An optional function to send\n * initialization related log messages to.\n */\nlib.init = function(onInit, opt_logFunction) {\n var ary = lib.initCallbacks_;\n\n var initNext = function() {\n if (ary.length) {\n var rec = ary.shift();\n if (opt_logFunction)\n opt_logFunction('init: ' + rec[0]);\n rec[1](lib.f.alarm(initNext));\n } else {\n onInit();\n }\n };\n\n if (typeof onInit != 'function')\n throw new Error('Missing or invalid argument: onInit');\n\n lib.ensureRuntimeDependencies_();\n\n setTimeout(initNext, 0);\n};\n// SOURCE FILE: libdot/js/lib_polyfill.js\n// Copyright 2017 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * @fileoverview Polyfills for ES2016+ features we want to use.\n */\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart\nif (!String.prototype.padStart) {\n String.prototype.padStart = function(targetLength, padString) {\n // If the string is already long enough, nothing to do!\n targetLength -= this.length;\n if (targetLength <= 0)\n return String(this);\n\n if (padString === undefined)\n padString = ' ';\n\n // In case the pad is multiple chars long.\n if (targetLength > padString.length)\n padString = padString.repeat((targetLength / padString.length) + 1);\n\n return padString.slice(0, targetLength) + String(this);\n };\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd\nif (!String.prototype.padEnd) {\n String.prototype.padEnd = function(targetLength, padString) {\n // If the string is already long enough, nothing to do!\n targetLength -= this.length;\n if (targetLength <= 0)\n return String(this);\n\n if (padString === undefined)\n padString = ' ';\n\n // In case the pad is multiple chars long.\n if (targetLength > padString.length)\n padString = padString.repeat((targetLength / padString.length) + 1);\n\n return String(this) + padString.slice(0, targetLength);\n };\n}\n// SOURCE FILE: libdot/js/lib_colors.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Namespace for color utilities.\n */\nlib.colors = {};\n\n/**\n * First, some canned regular expressions we're going to use in this file.\n *\n *\n * BRACE YOURSELF\n *\n * ,~~~~.\n * |>_< ~~\n * 3`---'-/.\n * 3:::::\\v\\\n * =o=:::::\\,\\\n * | :::::\\,,\\\n *\n * THE REGULAR EXPRESSIONS\n * ARE COMING.\n *\n * There's no way to break long RE literals in JavaScript. Fix that why don't\n * you? Oh, and also there's no way to write a string that doesn't interpret\n * escapes.\n *\n * Instead, we stoop to this .replace() trick.\n */\nlib.colors.re_ = {\n // CSS hex color, #RGB.\n hex16: /#([a-f0-9])([a-f0-9])([a-f0-9])/i,\n\n // CSS hex color, #RRGGBB.\n hex24: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/i,\n\n // CSS rgb color, rgb(rrr,ggg,bbb).\n rgb: new RegExp(\n ('^/s*rgb/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,' +\n '/s*(/d{1,3})/s*/)/s*$'\n ).replace(/\\//g, '\\\\'), 'i'),\n\n // CSS rgb color, rgb(rrr,ggg,bbb,aaa).\n rgba: new RegExp(\n ('^/s*rgba/s*' +\n '/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*' +\n '(?:,/s*(/d+(?:/./d+)?)/s*)/)/s*$'\n ).replace(/\\//g, '\\\\'), 'i'),\n\n // Either RGB or RGBA.\n rgbx: new RegExp(\n ('^/s*rgba?/s*' +\n '/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*' +\n '(?:,/s*(/d+(?:/./d+)?)/s*)?/)/s*$'\n ).replace(/\\//g, '\\\\'), 'i'),\n\n // An X11 \"rgb:dddd/dddd/dddd\" value.\n x11rgb: /^\\s*rgb:([a-f0-9]{1,4})\\/([a-f0-9]{1,4})\\/([a-f0-9]{1,4})\\s*$/i,\n\n // English color name.\n name: /[a-z][a-z0-9\\s]+/,\n};\n\n/**\n * Convert a CSS rgb(ddd,ddd,ddd) color value into an X11 color value.\n *\n * Other CSS color values are ignored to ensure sanitary data handling.\n *\n * Each 'ddd' component is a one byte value specified in decimal.\n *\n * @param {string} value The CSS color value to convert.\n * @return {string} The X11 color value or null if the value could not be\n * converted.\n */\nlib.colors.rgbToX11 = function(value) {\n function scale(v) {\n v = (Math.min(v, 255) * 257).toString(16);\n return lib.f.zpad(v, 4);\n }\n\n var ary = value.match(lib.colors.re_.rgbx);\n if (!ary)\n return null;\n\n return 'rgb:' + scale(ary[1]) + '/' + scale(ary[2]) + '/' + scale(ary[3]);\n};\n\n/**\n * Convert a legacy X11 colover value into an CSS rgb(...) color value.\n *\n * They take the form:\n * 12 bit: #RGB -> #R000G000B000\n * 24 bit: #RRGGBB -> #RR00GG00BB00\n * 36 bit: #RRRGGGBBB -> #RRR0GGG0BBB0\n * 48 bit: #RRRRGGGGBBBB\n * These are the most significant bits.\n *\n * Truncate values back down to 24 bit since that's all CSS supports.\n */\nlib.colors.x11HexToCSS = function(v) {\n if (!v.startsWith('#'))\n return null;\n // Strip the leading # off.\n v = v.substr(1);\n\n // Reject unknown sizes.\n if ([3, 6, 9, 12].indexOf(v.length) == -1)\n return null;\n\n // Reject non-hex values.\n if (v.match(/[^a-f0-9]/i))\n return null;\n\n // Split the colors out.\n var size = v.length / 3;\n var r = v.substr(0, size);\n var g = v.substr(size, size);\n var b = v.substr(size + size, size);\n\n // Normalize to 16 bits.\n function norm16(v) {\n v = parseInt(v, 16);\n return size == 2 ? v : // 16 bit\n size == 1 ? v << 4 : // 8 bit\n v >> (4 * (size - 2)); // 24 or 32 bit\n }\n return lib.colors.arrayToRGBA([r, g, b].map(norm16));\n};\n\n/**\n * Convert an X11 color value into an CSS rgb(...) color value.\n *\n * The X11 value may be an X11 color name, or an RGB value of the form\n * rgb:hhhh/hhhh/hhhh. If a component value is less than 4 digits it is\n * padded out to 4, then scaled down to fit in a single byte.\n *\n * @param {string} value The X11 color value to convert.\n * @return {string} The CSS color value or null if the value could not be\n * converted.\n */\nlib.colors.x11ToCSS = function(v) {\n function scale(v) {\n // Pad out values with less than four digits. This padding (probably)\n // matches xterm. It's difficult to say for sure since xterm seems to\n // arrive at a padded value and then perform some combination of\n // gamma correction, color space transformation, and quantization.\n\n if (v.length == 1) {\n // Single digits pad out to four by repeating the character. \"f\" becomes\n // \"ffff\". Scaling down a hex value of this pattern by 257 is the same\n // as cutting off one byte. We skip the middle step and just double\n // the character.\n return parseInt(v + v, 16);\n }\n\n if (v.length == 2) {\n // Similar deal here. X11 pads two digit values by repeating the\n // byte (or scale up by 257). Since we're going to scale it back\n // down anyway, we can just return the original value.\n return parseInt(v, 16);\n }\n\n if (v.length == 3) {\n // Three digit values seem to be padded by repeating the final digit.\n // e.g. 10f becomes 10ff.\n v = v + v.substr(2);\n }\n\n // Scale down the 2 byte value.\n return Math.round(parseInt(v, 16) / 257);\n }\n\n var ary = v.match(lib.colors.re_.x11rgb);\n if (!ary) {\n // Handle the legacy format.\n if (v.startsWith('#'))\n return lib.colors.x11HexToCSS(v);\n else\n return lib.colors.nameToRGB(v);\n }\n\n ary.splice(0, 1);\n return lib.colors.arrayToRGBA(ary.map(scale));\n};\n\n/**\n * Converts one or more CSS '#RRGGBB' color values into their rgb(...)\n * form.\n *\n * Arrays are converted in place. If a value cannot be converted, it is\n * replaced with null.\n *\n * @param {string|Array.} A single RGB value or array of RGB values to\n * convert.\n * @return {string|Array.} The converted value or values.\n */\nlib.colors.hexToRGB = function(arg) {\n var hex16 = lib.colors.re_.hex16;\n var hex24 = lib.colors.re_.hex24;\n\n function convert(hex) {\n if (hex.length == 4) {\n hex = hex.replace(hex16, function(h, r, g, b) {\n return \"#\" + r + r + g + g + b + b;\n });\n }\n var ary = hex.match(hex24);\n if (!ary)\n return null;\n\n return 'rgb(' + parseInt(ary[1], 16) + ', ' +\n parseInt(ary[2], 16) + ', ' +\n parseInt(ary[3], 16) + ')';\n }\n\n if (arg instanceof Array) {\n for (var i = 0; i < arg.length; i++) {\n arg[i] = convert(arg[i]);\n }\n } else {\n arg = convert(arg);\n }\n\n return arg;\n};\n\n/**\n * Converts one or more CSS rgb(...) forms into their '#RRGGBB' color values.\n *\n * If given an rgba(...) form, the alpha field is thrown away.\n *\n * Arrays are converted in place. If a value cannot be converted, it is\n * replaced with null.\n *\n * @param {string|Array.} A single rgb(...) value or array of rgb(...)\n * values to convert.\n * @return {string|Array.} The converted value or values.\n */\nlib.colors.rgbToHex = function(arg) {\n function convert(rgb) {\n var ary = lib.colors.crackRGB(rgb);\n if (!ary)\n return null;\n return '#' + lib.f.zpad(((parseInt(ary[0]) << 16) |\n (parseInt(ary[1]) << 8) |\n (parseInt(ary[2]) << 0)).toString(16), 6);\n }\n\n if (arg instanceof Array) {\n for (var i = 0; i < arg.length; i++) {\n arg[i] = convert(arg[i]);\n }\n } else {\n arg = convert(arg);\n }\n\n return arg;\n};\n\n/**\n * Take any valid css color definition and turn it into an rgb or rgba value.\n *\n * Returns null if the value could not be normalized.\n */\nlib.colors.normalizeCSS = function(def) {\n if (def.startsWith('#'))\n return lib.colors.hexToRGB(def);\n\n if (lib.colors.re_.rgbx.test(def))\n return def;\n\n return lib.colors.nameToRGB(def);\n};\n\n/**\n * Convert a 3 or 4 element array into an rgba(...) string.\n */\nlib.colors.arrayToRGBA = function(ary) {\n var alpha = (ary.length > 3) ? ary[3] : 1;\n return 'rgba(' + ary[0] + ', ' + ary[1] + ', ' + ary[2] + ', ' + alpha + ')';\n};\n\n/**\n * Overwrite the alpha channel of an rgb/rgba color.\n */\nlib.colors.setAlpha = function(rgb, alpha) {\n var ary = lib.colors.crackRGB(rgb);\n ary[3] = alpha;\n return lib.colors.arrayToRGBA(ary);\n};\n\n/**\n * Mix a percentage of a tint color into a base color.\n */\nlib.colors.mix = function(base, tint, percent) {\n var ary1 = lib.colors.crackRGB(base);\n var ary2 = lib.colors.crackRGB(tint);\n\n for (var i = 0; i < 4; ++i) {\n var diff = ary2[i] - ary1[i];\n ary1[i] = Math.round(parseInt(ary1[i]) + diff * percent);\n }\n\n return lib.colors.arrayToRGBA(ary1);\n};\n\n/**\n * Split an rgb/rgba color into an array of its components.\n *\n * On success, a 4 element array will be returned. For rgb values, the alpha\n * will be set to 1.\n */\nlib.colors.crackRGB = function(color) {\n if (color.startsWith('rgba')) {\n var ary = color.match(lib.colors.re_.rgba);\n if (ary) {\n ary.shift();\n return ary;\n }\n } else {\n var ary = color.match(lib.colors.re_.rgb);\n if (ary) {\n ary.shift();\n ary.push(1);\n return ary;\n }\n }\n\n console.error('Couldn\\'t crack: ' + color);\n return null;\n};\n\n/**\n * Convert an X11 color name into a CSS rgb(...) value.\n *\n * Names are stripped of spaces and converted to lowercase. If the name is\n * unknown, null is returned.\n *\n * This list of color name to RGB mapping is derived from the stock X11\n * rgb.txt file.\n *\n * @param {string} name The color name to convert.\n * @return {string} The corresponding CSS rgb(...) value.\n */\nlib.colors.nameToRGB = function(name) {\n if (name in lib.colors.colorNames)\n return lib.colors.colorNames[name];\n\n name = name.toLowerCase();\n if (name in lib.colors.colorNames)\n return lib.colors.colorNames[name];\n\n name = name.replace(/\\s+/g, '');\n if (name in lib.colors.colorNames)\n return lib.colors.colorNames[name];\n\n return null;\n};\n\n/**\n * The stock color palette.\n */\nlib.colors.stockColorPalette = lib.colors.hexToRGB\n ([// The \"ANSI 16\"...\n '#000000', '#CC0000', '#4E9A06', '#C4A000',\n '#3465A4', '#75507B', '#06989A', '#D3D7CF',\n '#555753', '#EF2929', '#00BA13', '#FCE94F',\n '#729FCF', '#F200CB', '#00B5BD', '#EEEEEC',\n\n // The 6x6 color cubes...\n '#000000', '#00005F', '#000087', '#0000AF', '#0000D7', '#0000FF',\n '#005F00', '#005F5F', '#005F87', '#005FAF', '#005FD7', '#005FFF',\n '#008700', '#00875F', '#008787', '#0087AF', '#0087D7', '#0087FF',\n '#00AF00', '#00AF5F', '#00AF87', '#00AFAF', '#00AFD7', '#00AFFF',\n '#00D700', '#00D75F', '#00D787', '#00D7AF', '#00D7D7', '#00D7FF',\n '#00FF00', '#00FF5F', '#00FF87', '#00FFAF', '#00FFD7', '#00FFFF',\n\n '#5F0000', '#5F005F', '#5F0087', '#5F00AF', '#5F00D7', '#5F00FF',\n '#5F5F00', '#5F5F5F', '#5F5F87', '#5F5FAF', '#5F5FD7', '#5F5FFF',\n '#5F8700', '#5F875F', '#5F8787', '#5F87AF', '#5F87D7', '#5F87FF',\n '#5FAF00', '#5FAF5F', '#5FAF87', '#5FAFAF', '#5FAFD7', '#5FAFFF',\n '#5FD700', '#5FD75F', '#5FD787', '#5FD7AF', '#5FD7D7', '#5FD7FF',\n '#5FFF00', '#5FFF5F', '#5FFF87', '#5FFFAF', '#5FFFD7', '#5FFFFF',\n\n '#870000', '#87005F', '#870087', '#8700AF', '#8700D7', '#8700FF',\n '#875F00', '#875F5F', '#875F87', '#875FAF', '#875FD7', '#875FFF',\n '#878700', '#87875F', '#878787', '#8787AF', '#8787D7', '#8787FF',\n '#87AF00', '#87AF5F', '#87AF87', '#87AFAF', '#87AFD7', '#87AFFF',\n '#87D700', '#87D75F', '#87D787', '#87D7AF', '#87D7D7', '#87D7FF',\n '#87FF00', '#87FF5F', '#87FF87', '#87FFAF', '#87FFD7', '#87FFFF',\n\n '#AF0000', '#AF005F', '#AF0087', '#AF00AF', '#AF00D7', '#AF00FF',\n '#AF5F00', '#AF5F5F', '#AF5F87', '#AF5FAF', '#AF5FD7', '#AF5FFF',\n '#AF8700', '#AF875F', '#AF8787', '#AF87AF', '#AF87D7', '#AF87FF',\n '#AFAF00', '#AFAF5F', '#AFAF87', '#AFAFAF', '#AFAFD7', '#AFAFFF',\n '#AFD700', '#AFD75F', '#AFD787', '#AFD7AF', '#AFD7D7', '#AFD7FF',\n '#AFFF00', '#AFFF5F', '#AFFF87', '#AFFFAF', '#AFFFD7', '#AFFFFF',\n\n '#D70000', '#D7005F', '#D70087', '#D700AF', '#D700D7', '#D700FF',\n '#D75F00', '#D75F5F', '#D75F87', '#D75FAF', '#D75FD7', '#D75FFF',\n '#D78700', '#D7875F', '#D78787', '#D787AF', '#D787D7', '#D787FF',\n '#D7AF00', '#D7AF5F', '#D7AF87', '#D7AFAF', '#D7AFD7', '#D7AFFF',\n '#D7D700', '#D7D75F', '#D7D787', '#D7D7AF', '#D7D7D7', '#D7D7FF',\n '#D7FF00', '#D7FF5F', '#D7FF87', '#D7FFAF', '#D7FFD7', '#D7FFFF',\n\n '#FF0000', '#FF005F', '#FF0087', '#FF00AF', '#FF00D7', '#FF00FF',\n '#FF5F00', '#FF5F5F', '#FF5F87', '#FF5FAF', '#FF5FD7', '#FF5FFF',\n '#FF8700', '#FF875F', '#FF8787', '#FF87AF', '#FF87D7', '#FF87FF',\n '#FFAF00', '#FFAF5F', '#FFAF87', '#FFAFAF', '#FFAFD7', '#FFAFFF',\n '#FFD700', '#FFD75F', '#FFD787', '#FFD7AF', '#FFD7D7', '#FFD7FF',\n '#FFFF00', '#FFFF5F', '#FFFF87', '#FFFFAF', '#FFFFD7', '#FFFFFF',\n\n // The greyscale ramp...\n '#080808', '#121212', '#1C1C1C', '#262626', '#303030', '#3A3A3A',\n '#444444', '#4E4E4E', '#585858', '#626262', '#6C6C6C', '#767676',\n '#808080', '#8A8A8A', '#949494', '#9E9E9E', '#A8A8A8', '#B2B2B2',\n '#BCBCBC', '#C6C6C6', '#D0D0D0', '#DADADA', '#E4E4E4', '#EEEEEE'\n ]);\n\n/**\n * The current color palette, possibly with user changes.\n */\nlib.colors.colorPalette = lib.colors.stockColorPalette;\n\n/**\n * Named colors according to the stock X11 rgb.txt file.\n */\nlib.colors.colorNames = {\n \"aliceblue\": \"rgb(240, 248, 255)\",\n \"antiquewhite\": \"rgb(250, 235, 215)\",\n \"antiquewhite1\": \"rgb(255, 239, 219)\",\n \"antiquewhite2\": \"rgb(238, 223, 204)\",\n \"antiquewhite3\": \"rgb(205, 192, 176)\",\n \"antiquewhite4\": \"rgb(139, 131, 120)\",\n \"aquamarine\": \"rgb(127, 255, 212)\",\n \"aquamarine1\": \"rgb(127, 255, 212)\",\n \"aquamarine2\": \"rgb(118, 238, 198)\",\n \"aquamarine3\": \"rgb(102, 205, 170)\",\n \"aquamarine4\": \"rgb(69, 139, 116)\",\n \"azure\": \"rgb(240, 255, 255)\",\n \"azure1\": \"rgb(240, 255, 255)\",\n \"azure2\": \"rgb(224, 238, 238)\",\n \"azure3\": \"rgb(193, 205, 205)\",\n \"azure4\": \"rgb(131, 139, 139)\",\n \"beige\": \"rgb(245, 245, 220)\",\n \"bisque\": \"rgb(255, 228, 196)\",\n \"bisque1\": \"rgb(255, 228, 196)\",\n \"bisque2\": \"rgb(238, 213, 183)\",\n \"bisque3\": \"rgb(205, 183, 158)\",\n \"bisque4\": \"rgb(139, 125, 107)\",\n \"black\": \"rgb(0, 0, 0)\",\n \"blanchedalmond\": \"rgb(255, 235, 205)\",\n \"blue\": \"rgb(0, 0, 255)\",\n \"blue1\": \"rgb(0, 0, 255)\",\n \"blue2\": \"rgb(0, 0, 238)\",\n \"blue3\": \"rgb(0, 0, 205)\",\n \"blue4\": \"rgb(0, 0, 139)\",\n \"blueviolet\": \"rgb(138, 43, 226)\",\n \"brown\": \"rgb(165, 42, 42)\",\n \"brown1\": \"rgb(255, 64, 64)\",\n \"brown2\": \"rgb(238, 59, 59)\",\n \"brown3\": \"rgb(205, 51, 51)\",\n \"brown4\": \"rgb(139, 35, 35)\",\n \"burlywood\": \"rgb(222, 184, 135)\",\n \"burlywood1\": \"rgb(255, 211, 155)\",\n \"burlywood2\": \"rgb(238, 197, 145)\",\n \"burlywood3\": \"rgb(205, 170, 125)\",\n \"burlywood4\": \"rgb(139, 115, 85)\",\n \"cadetblue\": \"rgb(95, 158, 160)\",\n \"cadetblue1\": \"rgb(152, 245, 255)\",\n \"cadetblue2\": \"rgb(142, 229, 238)\",\n \"cadetblue3\": \"rgb(122, 197, 205)\",\n \"cadetblue4\": \"rgb(83, 134, 139)\",\n \"chartreuse\": \"rgb(127, 255, 0)\",\n \"chartreuse1\": \"rgb(127, 255, 0)\",\n \"chartreuse2\": \"rgb(118, 238, 0)\",\n \"chartreuse3\": \"rgb(102, 205, 0)\",\n \"chartreuse4\": \"rgb(69, 139, 0)\",\n \"chocolate\": \"rgb(210, 105, 30)\",\n \"chocolate1\": \"rgb(255, 127, 36)\",\n \"chocolate2\": \"rgb(238, 118, 33)\",\n \"chocolate3\": \"rgb(205, 102, 29)\",\n \"chocolate4\": \"rgb(139, 69, 19)\",\n \"coral\": \"rgb(255, 127, 80)\",\n \"coral1\": \"rgb(255, 114, 86)\",\n \"coral2\": \"rgb(238, 106, 80)\",\n \"coral3\": \"rgb(205, 91, 69)\",\n \"coral4\": \"rgb(139, 62, 47)\",\n \"cornflowerblue\": \"rgb(100, 149, 237)\",\n \"cornsilk\": \"rgb(255, 248, 220)\",\n \"cornsilk1\": \"rgb(255, 248, 220)\",\n \"cornsilk2\": \"rgb(238, 232, 205)\",\n \"cornsilk3\": \"rgb(205, 200, 177)\",\n \"cornsilk4\": \"rgb(139, 136, 120)\",\n \"cyan\": \"rgb(0, 255, 255)\",\n \"cyan1\": \"rgb(0, 255, 255)\",\n \"cyan2\": \"rgb(0, 238, 238)\",\n \"cyan3\": \"rgb(0, 205, 205)\",\n \"cyan4\": \"rgb(0, 139, 139)\",\n \"darkblue\": \"rgb(0, 0, 139)\",\n \"darkcyan\": \"rgb(0, 139, 139)\",\n \"darkgoldenrod\": \"rgb(184, 134, 11)\",\n \"darkgoldenrod1\": \"rgb(255, 185, 15)\",\n \"darkgoldenrod2\": \"rgb(238, 173, 14)\",\n \"darkgoldenrod3\": \"rgb(205, 149, 12)\",\n \"darkgoldenrod4\": \"rgb(139, 101, 8)\",\n \"darkgray\": \"rgb(169, 169, 169)\",\n \"darkgreen\": \"rgb(0, 100, 0)\",\n \"darkgrey\": \"rgb(169, 169, 169)\",\n \"darkkhaki\": \"rgb(189, 183, 107)\",\n \"darkmagenta\": \"rgb(139, 0, 139)\",\n \"darkolivegreen\": \"rgb(85, 107, 47)\",\n \"darkolivegreen1\": \"rgb(202, 255, 112)\",\n \"darkolivegreen2\": \"rgb(188, 238, 104)\",\n \"darkolivegreen3\": \"rgb(162, 205, 90)\",\n \"darkolivegreen4\": \"rgb(110, 139, 61)\",\n \"darkorange\": \"rgb(255, 140, 0)\",\n \"darkorange1\": \"rgb(255, 127, 0)\",\n \"darkorange2\": \"rgb(238, 118, 0)\",\n \"darkorange3\": \"rgb(205, 102, 0)\",\n \"darkorange4\": \"rgb(139, 69, 0)\",\n \"darkorchid\": \"rgb(153, 50, 204)\",\n \"darkorchid1\": \"rgb(191, 62, 255)\",\n \"darkorchid2\": \"rgb(178, 58, 238)\",\n \"darkorchid3\": \"rgb(154, 50, 205)\",\n \"darkorchid4\": \"rgb(104, 34, 139)\",\n \"darkred\": \"rgb(139, 0, 0)\",\n \"darksalmon\": \"rgb(233, 150, 122)\",\n \"darkseagreen\": \"rgb(143, 188, 143)\",\n \"darkseagreen1\": \"rgb(193, 255, 193)\",\n \"darkseagreen2\": \"rgb(180, 238, 180)\",\n \"darkseagreen3\": \"rgb(155, 205, 155)\",\n \"darkseagreen4\": \"rgb(105, 139, 105)\",\n \"darkslateblue\": \"rgb(72, 61, 139)\",\n \"darkslategray\": \"rgb(47, 79, 79)\",\n \"darkslategray1\": \"rgb(151, 255, 255)\",\n \"darkslategray2\": \"rgb(141, 238, 238)\",\n \"darkslategray3\": \"rgb(121, 205, 205)\",\n \"darkslategray4\": \"rgb(82, 139, 139)\",\n \"darkslategrey\": \"rgb(47, 79, 79)\",\n \"darkturquoise\": \"rgb(0, 206, 209)\",\n \"darkviolet\": \"rgb(148, 0, 211)\",\n \"debianred\": \"rgb(215, 7, 81)\",\n \"deeppink\": \"rgb(255, 20, 147)\",\n \"deeppink1\": \"rgb(255, 20, 147)\",\n \"deeppink2\": \"rgb(238, 18, 137)\",\n \"deeppink3\": \"rgb(205, 16, 118)\",\n \"deeppink4\": \"rgb(139, 10, 80)\",\n \"deepskyblue\": \"rgb(0, 191, 255)\",\n \"deepskyblue1\": \"rgb(0, 191, 255)\",\n \"deepskyblue2\": \"rgb(0, 178, 238)\",\n \"deepskyblue3\": \"rgb(0, 154, 205)\",\n \"deepskyblue4\": \"rgb(0, 104, 139)\",\n \"dimgray\": \"rgb(105, 105, 105)\",\n \"dimgrey\": \"rgb(105, 105, 105)\",\n \"dodgerblue\": \"rgb(30, 144, 255)\",\n \"dodgerblue1\": \"rgb(30, 144, 255)\",\n \"dodgerblue2\": \"rgb(28, 134, 238)\",\n \"dodgerblue3\": \"rgb(24, 116, 205)\",\n \"dodgerblue4\": \"rgb(16, 78, 139)\",\n \"firebrick\": \"rgb(178, 34, 34)\",\n \"firebrick1\": \"rgb(255, 48, 48)\",\n \"firebrick2\": \"rgb(238, 44, 44)\",\n \"firebrick3\": \"rgb(205, 38, 38)\",\n \"firebrick4\": \"rgb(139, 26, 26)\",\n \"floralwhite\": \"rgb(255, 250, 240)\",\n \"forestgreen\": \"rgb(34, 139, 34)\",\n \"gainsboro\": \"rgb(220, 220, 220)\",\n \"ghostwhite\": \"rgb(248, 248, 255)\",\n \"gold\": \"rgb(255, 215, 0)\",\n \"gold1\": \"rgb(255, 215, 0)\",\n \"gold2\": \"rgb(238, 201, 0)\",\n \"gold3\": \"rgb(205, 173, 0)\",\n \"gold4\": \"rgb(139, 117, 0)\",\n \"goldenrod\": \"rgb(218, 165, 32)\",\n \"goldenrod1\": \"rgb(255, 193, 37)\",\n \"goldenrod2\": \"rgb(238, 180, 34)\",\n \"goldenrod3\": \"rgb(205, 155, 29)\",\n \"goldenrod4\": \"rgb(139, 105, 20)\",\n \"gray\": \"rgb(190, 190, 190)\",\n \"gray0\": \"rgb(0, 0, 0)\",\n \"gray1\": \"rgb(3, 3, 3)\",\n \"gray10\": \"rgb(26, 26, 26)\",\n \"gray100\": \"rgb(255, 255, 255)\",\n \"gray11\": \"rgb(28, 28, 28)\",\n \"gray12\": \"rgb(31, 31, 31)\",\n \"gray13\": \"rgb(33, 33, 33)\",\n \"gray14\": \"rgb(36, 36, 36)\",\n \"gray15\": \"rgb(38, 38, 38)\",\n \"gray16\": \"rgb(41, 41, 41)\",\n \"gray17\": \"rgb(43, 43, 43)\",\n \"gray18\": \"rgb(46, 46, 46)\",\n \"gray19\": \"rgb(48, 48, 48)\",\n \"gray2\": \"rgb(5, 5, 5)\",\n \"gray20\": \"rgb(51, 51, 51)\",\n \"gray21\": \"rgb(54, 54, 54)\",\n \"gray22\": \"rgb(56, 56, 56)\",\n \"gray23\": \"rgb(59, 59, 59)\",\n \"gray24\": \"rgb(61, 61, 61)\",\n \"gray25\": \"rgb(64, 64, 64)\",\n \"gray26\": \"rgb(66, 66, 66)\",\n \"gray27\": \"rgb(69, 69, 69)\",\n \"gray28\": \"rgb(71, 71, 71)\",\n \"gray29\": \"rgb(74, 74, 74)\",\n \"gray3\": \"rgb(8, 8, 8)\",\n \"gray30\": \"rgb(77, 77, 77)\",\n \"gray31\": \"rgb(79, 79, 79)\",\n \"gray32\": \"rgb(82, 82, 82)\",\n \"gray33\": \"rgb(84, 84, 84)\",\n \"gray34\": \"rgb(87, 87, 87)\",\n \"gray35\": \"rgb(89, 89, 89)\",\n \"gray36\": \"rgb(92, 92, 92)\",\n \"gray37\": \"rgb(94, 94, 94)\",\n \"gray38\": \"rgb(97, 97, 97)\",\n \"gray39\": \"rgb(99, 99, 99)\",\n \"gray4\": \"rgb(10, 10, 10)\",\n \"gray40\": \"rgb(102, 102, 102)\",\n \"gray41\": \"rgb(105, 105, 105)\",\n \"gray42\": \"rgb(107, 107, 107)\",\n \"gray43\": \"rgb(110, 110, 110)\",\n \"gray44\": \"rgb(112, 112, 112)\",\n \"gray45\": \"rgb(115, 115, 115)\",\n \"gray46\": \"rgb(117, 117, 117)\",\n \"gray47\": \"rgb(120, 120, 120)\",\n \"gray48\": \"rgb(122, 122, 122)\",\n \"gray49\": \"rgb(125, 125, 125)\",\n \"gray5\": \"rgb(13, 13, 13)\",\n \"gray50\": \"rgb(127, 127, 127)\",\n \"gray51\": \"rgb(130, 130, 130)\",\n \"gray52\": \"rgb(133, 133, 133)\",\n \"gray53\": \"rgb(135, 135, 135)\",\n \"gray54\": \"rgb(138, 138, 138)\",\n \"gray55\": \"rgb(140, 140, 140)\",\n \"gray56\": \"rgb(143, 143, 143)\",\n \"gray57\": \"rgb(145, 145, 145)\",\n \"gray58\": \"rgb(148, 148, 148)\",\n \"gray59\": \"rgb(150, 150, 150)\",\n \"gray6\": \"rgb(15, 15, 15)\",\n \"gray60\": \"rgb(153, 153, 153)\",\n \"gray61\": \"rgb(156, 156, 156)\",\n \"gray62\": \"rgb(158, 158, 158)\",\n \"gray63\": \"rgb(161, 161, 161)\",\n \"gray64\": \"rgb(163, 163, 163)\",\n \"gray65\": \"rgb(166, 166, 166)\",\n \"gray66\": \"rgb(168, 168, 168)\",\n \"gray67\": \"rgb(171, 171, 171)\",\n \"gray68\": \"rgb(173, 173, 173)\",\n \"gray69\": \"rgb(176, 176, 176)\",\n \"gray7\": \"rgb(18, 18, 18)\",\n \"gray70\": \"rgb(179, 179, 179)\",\n \"gray71\": \"rgb(181, 181, 181)\",\n \"gray72\": \"rgb(184, 184, 184)\",\n \"gray73\": \"rgb(186, 186, 186)\",\n \"gray74\": \"rgb(189, 189, 189)\",\n \"gray75\": \"rgb(191, 191, 191)\",\n \"gray76\": \"rgb(194, 194, 194)\",\n \"gray77\": \"rgb(196, 196, 196)\",\n \"gray78\": \"rgb(199, 199, 199)\",\n \"gray79\": \"rgb(201, 201, 201)\",\n \"gray8\": \"rgb(20, 20, 20)\",\n \"gray80\": \"rgb(204, 204, 204)\",\n \"gray81\": \"rgb(207, 207, 207)\",\n \"gray82\": \"rgb(209, 209, 209)\",\n \"gray83\": \"rgb(212, 212, 212)\",\n \"gray84\": \"rgb(214, 214, 214)\",\n \"gray85\": \"rgb(217, 217, 217)\",\n \"gray86\": \"rgb(219, 219, 219)\",\n \"gray87\": \"rgb(222, 222, 222)\",\n \"gray88\": \"rgb(224, 224, 224)\",\n \"gray89\": \"rgb(227, 227, 227)\",\n \"gray9\": \"rgb(23, 23, 23)\",\n \"gray90\": \"rgb(229, 229, 229)\",\n \"gray91\": \"rgb(232, 232, 232)\",\n \"gray92\": \"rgb(235, 235, 235)\",\n \"gray93\": \"rgb(237, 237, 237)\",\n \"gray94\": \"rgb(240, 240, 240)\",\n \"gray95\": \"rgb(242, 242, 242)\",\n \"gray96\": \"rgb(245, 245, 245)\",\n \"gray97\": \"rgb(247, 247, 247)\",\n \"gray98\": \"rgb(250, 250, 250)\",\n \"gray99\": \"rgb(252, 252, 252)\",\n \"green\": \"rgb(0, 255, 0)\",\n \"green1\": \"rgb(0, 255, 0)\",\n \"green2\": \"rgb(0, 238, 0)\",\n \"green3\": \"rgb(0, 205, 0)\",\n \"green4\": \"rgb(0, 139, 0)\",\n \"greenyellow\": \"rgb(173, 255, 47)\",\n \"grey\": \"rgb(190, 190, 190)\",\n \"grey0\": \"rgb(0, 0, 0)\",\n \"grey1\": \"rgb(3, 3, 3)\",\n \"grey10\": \"rgb(26, 26, 26)\",\n \"grey100\": \"rgb(255, 255, 255)\",\n \"grey11\": \"rgb(28, 28, 28)\",\n \"grey12\": \"rgb(31, 31, 31)\",\n \"grey13\": \"rgb(33, 33, 33)\",\n \"grey14\": \"rgb(36, 36, 36)\",\n \"grey15\": \"rgb(38, 38, 38)\",\n \"grey16\": \"rgb(41, 41, 41)\",\n \"grey17\": \"rgb(43, 43, 43)\",\n \"grey18\": \"rgb(46, 46, 46)\",\n \"grey19\": \"rgb(48, 48, 48)\",\n \"grey2\": \"rgb(5, 5, 5)\",\n \"grey20\": \"rgb(51, 51, 51)\",\n \"grey21\": \"rgb(54, 54, 54)\",\n \"grey22\": \"rgb(56, 56, 56)\",\n \"grey23\": \"rgb(59, 59, 59)\",\n \"grey24\": \"rgb(61, 61, 61)\",\n \"grey25\": \"rgb(64, 64, 64)\",\n \"grey26\": \"rgb(66, 66, 66)\",\n \"grey27\": \"rgb(69, 69, 69)\",\n \"grey28\": \"rgb(71, 71, 71)\",\n \"grey29\": \"rgb(74, 74, 74)\",\n \"grey3\": \"rgb(8, 8, 8)\",\n \"grey30\": \"rgb(77, 77, 77)\",\n \"grey31\": \"rgb(79, 79, 79)\",\n \"grey32\": \"rgb(82, 82, 82)\",\n \"grey33\": \"rgb(84, 84, 84)\",\n \"grey34\": \"rgb(87, 87, 87)\",\n \"grey35\": \"rgb(89, 89, 89)\",\n \"grey36\": \"rgb(92, 92, 92)\",\n \"grey37\": \"rgb(94, 94, 94)\",\n \"grey38\": \"rgb(97, 97, 97)\",\n \"grey39\": \"rgb(99, 99, 99)\",\n \"grey4\": \"rgb(10, 10, 10)\",\n \"grey40\": \"rgb(102, 102, 102)\",\n \"grey41\": \"rgb(105, 105, 105)\",\n \"grey42\": \"rgb(107, 107, 107)\",\n \"grey43\": \"rgb(110, 110, 110)\",\n \"grey44\": \"rgb(112, 112, 112)\",\n \"grey45\": \"rgb(115, 115, 115)\",\n \"grey46\": \"rgb(117, 117, 117)\",\n \"grey47\": \"rgb(120, 120, 120)\",\n \"grey48\": \"rgb(122, 122, 122)\",\n \"grey49\": \"rgb(125, 125, 125)\",\n \"grey5\": \"rgb(13, 13, 13)\",\n \"grey50\": \"rgb(127, 127, 127)\",\n \"grey51\": \"rgb(130, 130, 130)\",\n \"grey52\": \"rgb(133, 133, 133)\",\n \"grey53\": \"rgb(135, 135, 135)\",\n \"grey54\": \"rgb(138, 138, 138)\",\n \"grey55\": \"rgb(140, 140, 140)\",\n \"grey56\": \"rgb(143, 143, 143)\",\n \"grey57\": \"rgb(145, 145, 145)\",\n \"grey58\": \"rgb(148, 148, 148)\",\n \"grey59\": \"rgb(150, 150, 150)\",\n \"grey6\": \"rgb(15, 15, 15)\",\n \"grey60\": \"rgb(153, 153, 153)\",\n \"grey61\": \"rgb(156, 156, 156)\",\n \"grey62\": \"rgb(158, 158, 158)\",\n \"grey63\": \"rgb(161, 161, 161)\",\n \"grey64\": \"rgb(163, 163, 163)\",\n \"grey65\": \"rgb(166, 166, 166)\",\n \"grey66\": \"rgb(168, 168, 168)\",\n \"grey67\": \"rgb(171, 171, 171)\",\n \"grey68\": \"rgb(173, 173, 173)\",\n \"grey69\": \"rgb(176, 176, 176)\",\n \"grey7\": \"rgb(18, 18, 18)\",\n \"grey70\": \"rgb(179, 179, 179)\",\n \"grey71\": \"rgb(181, 181, 181)\",\n \"grey72\": \"rgb(184, 184, 184)\",\n \"grey73\": \"rgb(186, 186, 186)\",\n \"grey74\": \"rgb(189, 189, 189)\",\n \"grey75\": \"rgb(191, 191, 191)\",\n \"grey76\": \"rgb(194, 194, 194)\",\n \"grey77\": \"rgb(196, 196, 196)\",\n \"grey78\": \"rgb(199, 199, 199)\",\n \"grey79\": \"rgb(201, 201, 201)\",\n \"grey8\": \"rgb(20, 20, 20)\",\n \"grey80\": \"rgb(204, 204, 204)\",\n \"grey81\": \"rgb(207, 207, 207)\",\n \"grey82\": \"rgb(209, 209, 209)\",\n \"grey83\": \"rgb(212, 212, 212)\",\n \"grey84\": \"rgb(214, 214, 214)\",\n \"grey85\": \"rgb(217, 217, 217)\",\n \"grey86\": \"rgb(219, 219, 219)\",\n \"grey87\": \"rgb(222, 222, 222)\",\n \"grey88\": \"rgb(224, 224, 224)\",\n \"grey89\": \"rgb(227, 227, 227)\",\n \"grey9\": \"rgb(23, 23, 23)\",\n \"grey90\": \"rgb(229, 229, 229)\",\n \"grey91\": \"rgb(232, 232, 232)\",\n \"grey92\": \"rgb(235, 235, 235)\",\n \"grey93\": \"rgb(237, 237, 237)\",\n \"grey94\": \"rgb(240, 240, 240)\",\n \"grey95\": \"rgb(242, 242, 242)\",\n \"grey96\": \"rgb(245, 245, 245)\",\n \"grey97\": \"rgb(247, 247, 247)\",\n \"grey98\": \"rgb(250, 250, 250)\",\n \"grey99\": \"rgb(252, 252, 252)\",\n \"honeydew\": \"rgb(240, 255, 240)\",\n \"honeydew1\": \"rgb(240, 255, 240)\",\n \"honeydew2\": \"rgb(224, 238, 224)\",\n \"honeydew3\": \"rgb(193, 205, 193)\",\n \"honeydew4\": \"rgb(131, 139, 131)\",\n \"hotpink\": \"rgb(255, 105, 180)\",\n \"hotpink1\": \"rgb(255, 110, 180)\",\n \"hotpink2\": \"rgb(238, 106, 167)\",\n \"hotpink3\": \"rgb(205, 96, 144)\",\n \"hotpink4\": \"rgb(139, 58, 98)\",\n \"indianred\": \"rgb(205, 92, 92)\",\n \"indianred1\": \"rgb(255, 106, 106)\",\n \"indianred2\": \"rgb(238, 99, 99)\",\n \"indianred3\": \"rgb(205, 85, 85)\",\n \"indianred4\": \"rgb(139, 58, 58)\",\n \"ivory\": \"rgb(255, 255, 240)\",\n \"ivory1\": \"rgb(255, 255, 240)\",\n \"ivory2\": \"rgb(238, 238, 224)\",\n \"ivory3\": \"rgb(205, 205, 193)\",\n \"ivory4\": \"rgb(139, 139, 131)\",\n \"khaki\": \"rgb(240, 230, 140)\",\n \"khaki1\": \"rgb(255, 246, 143)\",\n \"khaki2\": \"rgb(238, 230, 133)\",\n \"khaki3\": \"rgb(205, 198, 115)\",\n \"khaki4\": \"rgb(139, 134, 78)\",\n \"lavender\": \"rgb(230, 230, 250)\",\n \"lavenderblush\": \"rgb(255, 240, 245)\",\n \"lavenderblush1\": \"rgb(255, 240, 245)\",\n \"lavenderblush2\": \"rgb(238, 224, 229)\",\n \"lavenderblush3\": \"rgb(205, 193, 197)\",\n \"lavenderblush4\": \"rgb(139, 131, 134)\",\n \"lawngreen\": \"rgb(124, 252, 0)\",\n \"lemonchiffon\": \"rgb(255, 250, 205)\",\n \"lemonchiffon1\": \"rgb(255, 250, 205)\",\n \"lemonchiffon2\": \"rgb(238, 233, 191)\",\n \"lemonchiffon3\": \"rgb(205, 201, 165)\",\n \"lemonchiffon4\": \"rgb(139, 137, 112)\",\n \"lightblue\": \"rgb(173, 216, 230)\",\n \"lightblue1\": \"rgb(191, 239, 255)\",\n \"lightblue2\": \"rgb(178, 223, 238)\",\n \"lightblue3\": \"rgb(154, 192, 205)\",\n \"lightblue4\": \"rgb(104, 131, 139)\",\n \"lightcoral\": \"rgb(240, 128, 128)\",\n \"lightcyan\": \"rgb(224, 255, 255)\",\n \"lightcyan1\": \"rgb(224, 255, 255)\",\n \"lightcyan2\": \"rgb(209, 238, 238)\",\n \"lightcyan3\": \"rgb(180, 205, 205)\",\n \"lightcyan4\": \"rgb(122, 139, 139)\",\n \"lightgoldenrod\": \"rgb(238, 221, 130)\",\n \"lightgoldenrod1\": \"rgb(255, 236, 139)\",\n \"lightgoldenrod2\": \"rgb(238, 220, 130)\",\n \"lightgoldenrod3\": \"rgb(205, 190, 112)\",\n \"lightgoldenrod4\": \"rgb(139, 129, 76)\",\n \"lightgoldenrodyellow\": \"rgb(250, 250, 210)\",\n \"lightgray\": \"rgb(211, 211, 211)\",\n \"lightgreen\": \"rgb(144, 238, 144)\",\n \"lightgrey\": \"rgb(211, 211, 211)\",\n \"lightpink\": \"rgb(255, 182, 193)\",\n \"lightpink1\": \"rgb(255, 174, 185)\",\n \"lightpink2\": \"rgb(238, 162, 173)\",\n \"lightpink3\": \"rgb(205, 140, 149)\",\n \"lightpink4\": \"rgb(139, 95, 101)\",\n \"lightsalmon\": \"rgb(255, 160, 122)\",\n \"lightsalmon1\": \"rgb(255, 160, 122)\",\n \"lightsalmon2\": \"rgb(238, 149, 114)\",\n \"lightsalmon3\": \"rgb(205, 129, 98)\",\n \"lightsalmon4\": \"rgb(139, 87, 66)\",\n \"lightseagreen\": \"rgb(32, 178, 170)\",\n \"lightskyblue\": \"rgb(135, 206, 250)\",\n \"lightskyblue1\": \"rgb(176, 226, 255)\",\n \"lightskyblue2\": \"rgb(164, 211, 238)\",\n \"lightskyblue3\": \"rgb(141, 182, 205)\",\n \"lightskyblue4\": \"rgb(96, 123, 139)\",\n \"lightslateblue\": \"rgb(132, 112, 255)\",\n \"lightslategray\": \"rgb(119, 136, 153)\",\n \"lightslategrey\": \"rgb(119, 136, 153)\",\n \"lightsteelblue\": \"rgb(176, 196, 222)\",\n \"lightsteelblue1\": \"rgb(202, 225, 255)\",\n \"lightsteelblue2\": \"rgb(188, 210, 238)\",\n \"lightsteelblue3\": \"rgb(162, 181, 205)\",\n \"lightsteelblue4\": \"rgb(110, 123, 139)\",\n \"lightyellow\": \"rgb(255, 255, 224)\",\n \"lightyellow1\": \"rgb(255, 255, 224)\",\n \"lightyellow2\": \"rgb(238, 238, 209)\",\n \"lightyellow3\": \"rgb(205, 205, 180)\",\n \"lightyellow4\": \"rgb(139, 139, 122)\",\n \"limegreen\": \"rgb(50, 205, 50)\",\n \"linen\": \"rgb(250, 240, 230)\",\n \"magenta\": \"rgb(255, 0, 255)\",\n \"magenta1\": \"rgb(255, 0, 255)\",\n \"magenta2\": \"rgb(238, 0, 238)\",\n \"magenta3\": \"rgb(205, 0, 205)\",\n \"magenta4\": \"rgb(139, 0, 139)\",\n \"maroon\": \"rgb(176, 48, 96)\",\n \"maroon1\": \"rgb(255, 52, 179)\",\n \"maroon2\": \"rgb(238, 48, 167)\",\n \"maroon3\": \"rgb(205, 41, 144)\",\n \"maroon4\": \"rgb(139, 28, 98)\",\n \"mediumaquamarine\": \"rgb(102, 205, 170)\",\n \"mediumblue\": \"rgb(0, 0, 205)\",\n \"mediumorchid\": \"rgb(186, 85, 211)\",\n \"mediumorchid1\": \"rgb(224, 102, 255)\",\n \"mediumorchid2\": \"rgb(209, 95, 238)\",\n \"mediumorchid3\": \"rgb(180, 82, 205)\",\n \"mediumorchid4\": \"rgb(122, 55, 139)\",\n \"mediumpurple\": \"rgb(147, 112, 219)\",\n \"mediumpurple1\": \"rgb(171, 130, 255)\",\n \"mediumpurple2\": \"rgb(159, 121, 238)\",\n \"mediumpurple3\": \"rgb(137, 104, 205)\",\n \"mediumpurple4\": \"rgb(93, 71, 139)\",\n \"mediumseagreen\": \"rgb(60, 179, 113)\",\n \"mediumslateblue\": \"rgb(123, 104, 238)\",\n \"mediumspringgreen\": \"rgb(0, 250, 154)\",\n \"mediumturquoise\": \"rgb(72, 209, 204)\",\n \"mediumvioletred\": \"rgb(199, 21, 133)\",\n \"midnightblue\": \"rgb(25, 25, 112)\",\n \"mintcream\": \"rgb(245, 255, 250)\",\n \"mistyrose\": \"rgb(255, 228, 225)\",\n \"mistyrose1\": \"rgb(255, 228, 225)\",\n \"mistyrose2\": \"rgb(238, 213, 210)\",\n \"mistyrose3\": \"rgb(205, 183, 181)\",\n \"mistyrose4\": \"rgb(139, 125, 123)\",\n \"moccasin\": \"rgb(255, 228, 181)\",\n \"navajowhite\": \"rgb(255, 222, 173)\",\n \"navajowhite1\": \"rgb(255, 222, 173)\",\n \"navajowhite2\": \"rgb(238, 207, 161)\",\n \"navajowhite3\": \"rgb(205, 179, 139)\",\n \"navajowhite4\": \"rgb(139, 121, 94)\",\n \"navy\": \"rgb(0, 0, 128)\",\n \"navyblue\": \"rgb(0, 0, 128)\",\n \"oldlace\": \"rgb(253, 245, 230)\",\n \"olivedrab\": \"rgb(107, 142, 35)\",\n \"olivedrab1\": \"rgb(192, 255, 62)\",\n \"olivedrab2\": \"rgb(179, 238, 58)\",\n \"olivedrab3\": \"rgb(154, 205, 50)\",\n \"olivedrab4\": \"rgb(105, 139, 34)\",\n \"orange\": \"rgb(255, 165, 0)\",\n \"orange1\": \"rgb(255, 165, 0)\",\n \"orange2\": \"rgb(238, 154, 0)\",\n \"orange3\": \"rgb(205, 133, 0)\",\n \"orange4\": \"rgb(139, 90, 0)\",\n \"orangered\": \"rgb(255, 69, 0)\",\n \"orangered1\": \"rgb(255, 69, 0)\",\n \"orangered2\": \"rgb(238, 64, 0)\",\n \"orangered3\": \"rgb(205, 55, 0)\",\n \"orangered4\": \"rgb(139, 37, 0)\",\n \"orchid\": \"rgb(218, 112, 214)\",\n \"orchid1\": \"rgb(255, 131, 250)\",\n \"orchid2\": \"rgb(238, 122, 233)\",\n \"orchid3\": \"rgb(205, 105, 201)\",\n \"orchid4\": \"rgb(139, 71, 137)\",\n \"palegoldenrod\": \"rgb(238, 232, 170)\",\n \"palegreen\": \"rgb(152, 251, 152)\",\n \"palegreen1\": \"rgb(154, 255, 154)\",\n \"palegreen2\": \"rgb(144, 238, 144)\",\n \"palegreen3\": \"rgb(124, 205, 124)\",\n \"palegreen4\": \"rgb(84, 139, 84)\",\n \"paleturquoise\": \"rgb(175, 238, 238)\",\n \"paleturquoise1\": \"rgb(187, 255, 255)\",\n \"paleturquoise2\": \"rgb(174, 238, 238)\",\n \"paleturquoise3\": \"rgb(150, 205, 205)\",\n \"paleturquoise4\": \"rgb(102, 139, 139)\",\n \"palevioletred\": \"rgb(219, 112, 147)\",\n \"palevioletred1\": \"rgb(255, 130, 171)\",\n \"palevioletred2\": \"rgb(238, 121, 159)\",\n \"palevioletred3\": \"rgb(205, 104, 137)\",\n \"palevioletred4\": \"rgb(139, 71, 93)\",\n \"papayawhip\": \"rgb(255, 239, 213)\",\n \"peachpuff\": \"rgb(255, 218, 185)\",\n \"peachpuff1\": \"rgb(255, 218, 185)\",\n \"peachpuff2\": \"rgb(238, 203, 173)\",\n \"peachpuff3\": \"rgb(205, 175, 149)\",\n \"peachpuff4\": \"rgb(139, 119, 101)\",\n \"peru\": \"rgb(205, 133, 63)\",\n \"pink\": \"rgb(255, 192, 203)\",\n \"pink1\": \"rgb(255, 181, 197)\",\n \"pink2\": \"rgb(238, 169, 184)\",\n \"pink3\": \"rgb(205, 145, 158)\",\n \"pink4\": \"rgb(139, 99, 108)\",\n \"plum\": \"rgb(221, 160, 221)\",\n \"plum1\": \"rgb(255, 187, 255)\",\n \"plum2\": \"rgb(238, 174, 238)\",\n \"plum3\": \"rgb(205, 150, 205)\",\n \"plum4\": \"rgb(139, 102, 139)\",\n \"powderblue\": \"rgb(176, 224, 230)\",\n \"purple\": \"rgb(160, 32, 240)\",\n \"purple1\": \"rgb(155, 48, 255)\",\n \"purple2\": \"rgb(145, 44, 238)\",\n \"purple3\": \"rgb(125, 38, 205)\",\n \"purple4\": \"rgb(85, 26, 139)\",\n \"red\": \"rgb(255, 0, 0)\",\n \"red1\": \"rgb(255, 0, 0)\",\n \"red2\": \"rgb(238, 0, 0)\",\n \"red3\": \"rgb(205, 0, 0)\",\n \"red4\": \"rgb(139, 0, 0)\",\n \"rosybrown\": \"rgb(188, 143, 143)\",\n \"rosybrown1\": \"rgb(255, 193, 193)\",\n \"rosybrown2\": \"rgb(238, 180, 180)\",\n \"rosybrown3\": \"rgb(205, 155, 155)\",\n \"rosybrown4\": \"rgb(139, 105, 105)\",\n \"royalblue\": \"rgb(65, 105, 225)\",\n \"royalblue1\": \"rgb(72, 118, 255)\",\n \"royalblue2\": \"rgb(67, 110, 238)\",\n \"royalblue3\": \"rgb(58, 95, 205)\",\n \"royalblue4\": \"rgb(39, 64, 139)\",\n \"saddlebrown\": \"rgb(139, 69, 19)\",\n \"salmon\": \"rgb(250, 128, 114)\",\n \"salmon1\": \"rgb(255, 140, 105)\",\n \"salmon2\": \"rgb(238, 130, 98)\",\n \"salmon3\": \"rgb(205, 112, 84)\",\n \"salmon4\": \"rgb(139, 76, 57)\",\n \"sandybrown\": \"rgb(244, 164, 96)\",\n \"seagreen\": \"rgb(46, 139, 87)\",\n \"seagreen1\": \"rgb(84, 255, 159)\",\n \"seagreen2\": \"rgb(78, 238, 148)\",\n \"seagreen3\": \"rgb(67, 205, 128)\",\n \"seagreen4\": \"rgb(46, 139, 87)\",\n \"seashell\": \"rgb(255, 245, 238)\",\n \"seashell1\": \"rgb(255, 245, 238)\",\n \"seashell2\": \"rgb(238, 229, 222)\",\n \"seashell3\": \"rgb(205, 197, 191)\",\n \"seashell4\": \"rgb(139, 134, 130)\",\n \"sienna\": \"rgb(160, 82, 45)\",\n \"sienna1\": \"rgb(255, 130, 71)\",\n \"sienna2\": \"rgb(238, 121, 66)\",\n \"sienna3\": \"rgb(205, 104, 57)\",\n \"sienna4\": \"rgb(139, 71, 38)\",\n \"skyblue\": \"rgb(135, 206, 235)\",\n \"skyblue1\": \"rgb(135, 206, 255)\",\n \"skyblue2\": \"rgb(126, 192, 238)\",\n \"skyblue3\": \"rgb(108, 166, 205)\",\n \"skyblue4\": \"rgb(74, 112, 139)\",\n \"slateblue\": \"rgb(106, 90, 205)\",\n \"slateblue1\": \"rgb(131, 111, 255)\",\n \"slateblue2\": \"rgb(122, 103, 238)\",\n \"slateblue3\": \"rgb(105, 89, 205)\",\n \"slateblue4\": \"rgb(71, 60, 139)\",\n \"slategray\": \"rgb(112, 128, 144)\",\n \"slategray1\": \"rgb(198, 226, 255)\",\n \"slategray2\": \"rgb(185, 211, 238)\",\n \"slategray3\": \"rgb(159, 182, 205)\",\n \"slategray4\": \"rgb(108, 123, 139)\",\n \"slategrey\": \"rgb(112, 128, 144)\",\n \"snow\": \"rgb(255, 250, 250)\",\n \"snow1\": \"rgb(255, 250, 250)\",\n \"snow2\": \"rgb(238, 233, 233)\",\n \"snow3\": \"rgb(205, 201, 201)\",\n \"snow4\": \"rgb(139, 137, 137)\",\n \"springgreen\": \"rgb(0, 255, 127)\",\n \"springgreen1\": \"rgb(0, 255, 127)\",\n \"springgreen2\": \"rgb(0, 238, 118)\",\n \"springgreen3\": \"rgb(0, 205, 102)\",\n \"springgreen4\": \"rgb(0, 139, 69)\",\n \"steelblue\": \"rgb(70, 130, 180)\",\n \"steelblue1\": \"rgb(99, 184, 255)\",\n \"steelblue2\": \"rgb(92, 172, 238)\",\n \"steelblue3\": \"rgb(79, 148, 205)\",\n \"steelblue4\": \"rgb(54, 100, 139)\",\n \"tan\": \"rgb(210, 180, 140)\",\n \"tan1\": \"rgb(255, 165, 79)\",\n \"tan2\": \"rgb(238, 154, 73)\",\n \"tan3\": \"rgb(205, 133, 63)\",\n \"tan4\": \"rgb(139, 90, 43)\",\n \"thistle\": \"rgb(216, 191, 216)\",\n \"thistle1\": \"rgb(255, 225, 255)\",\n \"thistle2\": \"rgb(238, 210, 238)\",\n \"thistle3\": \"rgb(205, 181, 205)\",\n \"thistle4\": \"rgb(139, 123, 139)\",\n \"tomato\": \"rgb(255, 99, 71)\",\n \"tomato1\": \"rgb(255, 99, 71)\",\n \"tomato2\": \"rgb(238, 92, 66)\",\n \"tomato3\": \"rgb(205, 79, 57)\",\n \"tomato4\": \"rgb(139, 54, 38)\",\n \"turquoise\": \"rgb(64, 224, 208)\",\n \"turquoise1\": \"rgb(0, 245, 255)\",\n \"turquoise2\": \"rgb(0, 229, 238)\",\n \"turquoise3\": \"rgb(0, 197, 205)\",\n \"turquoise4\": \"rgb(0, 134, 139)\",\n \"violet\": \"rgb(238, 130, 238)\",\n \"violetred\": \"rgb(208, 32, 144)\",\n \"violetred1\": \"rgb(255, 62, 150)\",\n \"violetred2\": \"rgb(238, 58, 140)\",\n \"violetred3\": \"rgb(205, 50, 120)\",\n \"violetred4\": \"rgb(139, 34, 82)\",\n \"wheat\": \"rgb(245, 222, 179)\",\n \"wheat1\": \"rgb(255, 231, 186)\",\n \"wheat2\": \"rgb(238, 216, 174)\",\n \"wheat3\": \"rgb(205, 186, 150)\",\n \"wheat4\": \"rgb(139, 126, 102)\",\n \"white\": \"rgb(255, 255, 255)\",\n \"whitesmoke\": \"rgb(245, 245, 245)\",\n \"yellow\": \"rgb(255, 255, 0)\",\n \"yellow1\": \"rgb(255, 255, 0)\",\n \"yellow2\": \"rgb(238, 238, 0)\",\n \"yellow3\": \"rgb(205, 205, 0)\",\n \"yellow4\": \"rgb(139, 139, 0)\",\n \"yellowgreen\": \"rgb(154, 205, 50)\"\n};\n// SOURCE FILE: libdot/js/lib_f.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Grab bag of utility functions.\n */\nlib.f = {};\n\n/**\n * Create a unique enum value.\n *\n * @suppress {lintChecks}\n * @param {string} name A human friendly name for debugging.\n * @return {Object} A unique enum that won't compare equal to anything else.\n */\nlib.f.createEnum = function(name) {\n // We use a String object as nothing else should be using them -- we want to\n // use string primitives normally. But debuggers will include our name.\n return new String(name);\n};\n\n/**\n * Replace variable references in a string.\n *\n * Variables are of the form %FUNCTION(VARNAME). FUNCTION is an optional\n * escape function to apply to the value.\n *\n * For example\n * lib.f.replaceVars(\"%(greeting), %encodeURIComponent(name)\",\n * { greeting: \"Hello\",\n * name: \"Google+\" });\n *\n * Will result in \"Hello, Google%2B\".\n */\nlib.f.replaceVars = function(str, vars) {\n return str.replace(/%([a-z]*)\\(([^\\)]+)\\)/gi, function(match, fn, varname) {\n if (typeof vars[varname] == 'undefined')\n throw 'Unknown variable: ' + varname;\n\n var rv = vars[varname];\n\n if (fn in lib.f.replaceVars.functions) {\n rv = lib.f.replaceVars.functions[fn](rv);\n } else if (fn) {\n throw 'Unknown escape function: ' + fn;\n }\n\n return rv;\n });\n};\n\n/**\n * Functions that can be used with replaceVars.\n *\n * Clients can add to this list to extend lib.f.replaceVars().\n */\nlib.f.replaceVars.functions = {\n encodeURI: encodeURI,\n encodeURIComponent: encodeURIComponent,\n escapeHTML: function(str) {\n var map = {\n '<': '<',\n '>': '>',\n '&': '&',\n '\"': '"',\n \"'\": '''\n };\n\n return str.replace(/[<>&\\\"\\']/g, function(m) { return map[m] });\n }\n};\n\n/**\n * Get the list of accepted UI languages.\n *\n * @param {function(Array)} callback Function to invoke with the results. The\n * parameter is a list of locale names.\n */\nlib.f.getAcceptLanguages = function(callback) {\n if (lib.f.getAcceptLanguages.chromeSupported()) {\n chrome.i18n.getAcceptLanguages(callback);\n } else {\n setTimeout(function() {\n callback([navigator.language.replace(/-/g, '_')]);\n }, 0);\n }\n};\n\nlib.f.getAcceptLanguages.chromeSupported = function() {\n return window.chrome && chrome.i18n;\n};\n\n/**\n * Parse a query string into a hash.\n *\n * This takes a url query string in the form 'name1=value&name2=value' and\n * converts it into an object of the form { name1: 'value', name2: 'value' }.\n * If a given name appears multiple times in the query string, only the\n * last value will appear in the result.\n *\n * Names and values are passed through decodeURIComponent before being added\n * to the result object.\n *\n * @param {string} queryString The string to parse. If it starts with a\n * leading '?', the '?' will be ignored.\n */\nlib.f.parseQuery = function(queryString) {\n if (queryString.startsWith('?'))\n queryString = queryString.substr(1);\n\n var rv = {};\n\n var pairs = queryString.split('&');\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split('=');\n rv[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\n }\n\n return rv;\n};\n\nlib.f.getURL = function(path) {\n if (lib.f.getURL.chromeSupported())\n return chrome.runtime.getURL(path);\n\n return path;\n};\n\nlib.f.getURL.chromeSupported = function() {\n return window.chrome && chrome.runtime && chrome.runtime.getURL;\n};\n\n/**\n * Clamp a given integer to a specified range.\n *\n * @param {integer} v The value to be clamped.\n * @param {integer} min The minimum acceptable value.\n * @param {integer} max The maximum acceptable value.\n */\nlib.f.clamp = function(v, min, max) {\n if (v < min)\n return min;\n if (v > max)\n return max;\n return v;\n};\n\n/**\n * Left pad a number to a given length with leading zeros.\n *\n * @param {string|integer} number The number to pad.\n * @param {integer} length The desired length.\n * @return {string} The padded number as a string.\n */\nlib.f.zpad = function(number, length) {\n return String(number).padStart(length, '0');\n};\n\n/**\n * Return a string containing a given number of space characters.\n *\n * This method maintains a static cache of the largest amount of whitespace\n * ever requested. It shouldn't be used to generate an insanely huge amount of\n * whitespace.\n *\n * @param {integer} length The desired amount of whitespace.\n * @param {string} A string of spaces of the requested length.\n */\nlib.f.getWhitespace = function(length) {\n if (length <= 0)\n return '';\n\n var f = this.getWhitespace;\n if (!f.whitespace)\n f.whitespace = ' ';\n\n while (length > f.whitespace.length) {\n f.whitespace += f.whitespace;\n }\n\n return f.whitespace.substr(0, length);\n};\n\n /**\n * Ensure that a function is called within a certain time limit.\n *\n * Simple usage looks like this...\n *\n * lib.registerInit(lib.f.alarm(onInit));\n *\n * This will log a warning to the console if onInit() is not invoked within\n * 5 seconds.\n *\n * If you're performing some operation that may take longer than 5 seconds you\n * can pass a duration in milliseconds as the optional second parameter.\n *\n * If you pass a string identifier instead of a callback function, you'll get a\n * wrapper generator rather than a single wrapper. Each call to the\n * generator will return a wrapped version of the callback wired to\n * a shared timeout. This is for cases where you want to ensure that at least\n * one of a set of callbacks is invoked before a timeout expires.\n *\n * var alarm = lib.f.alarm('fetch object');\n * lib.foo.fetchObject(alarm(onSuccess), alarm(onFailure));\n *\n * @param {function(*)} callback The function to wrap in an alarm.\n * @param {int} opt_ms Optional number of milliseconds to wait before raising\n * an alarm. Default is 5000 (5 seconds).\n * @return {function} If callback is a function then the return value will be\n * the wrapped callback. If callback is a string then the return value will\n * be a function that generates new wrapped callbacks.\n */\nlib.f.alarm = function(callback, opt_ms) {\n var ms = opt_ms || 5 * 1000;\n var stack = lib.f.getStack(1);\n\n return (function() {\n // This outer function is called immediately. It's here to capture a new\n // scope for the timeout variable.\n\n // The 'timeout' variable is shared by this timeout function, and the\n // callback wrapper.\n var timeout = setTimeout(function() {\n var name = (typeof callback == 'string') ? name : callback.name;\n name = name ? (': ' + name) : '';\n console.warn('lib.f.alarm: timeout expired: ' + (ms / 1000) + 's' + name);\n console.log(stack);\n timeout = null;\n }, ms);\n\n var wrapperGenerator = function(callback) {\n return function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n\n return callback.apply(null, arguments);\n }\n };\n\n if (typeof callback == 'string')\n return wrapperGenerator;\n\n return wrapperGenerator(callback);\n })();\n};\n\n/**\n * Return the current call stack after skipping a given number of frames.\n *\n * This method is intended to be used for debugging only. It returns an\n * Object instead of an Array, because the console stringifies arrays by\n * default and that's not what we want.\n *\n * A typical call might look like...\n *\n * console.log('Something wicked this way came', lib.f.getStack());\n * // Notice the comma ^\n *\n * This would print the message to the js console, followed by an object\n * which can be clicked to reveal the stack.\n *\n * @param {number} opt_ignoreFrames The optional number of stack frames to\n * ignore. The actual 'getStack' call is always ignored.\n */\nlib.f.getStack = function(opt_ignoreFrames) {\n var ignoreFrames = opt_ignoreFrames ? opt_ignoreFrames + 2 : 2;\n\n var stackArray;\n\n try {\n throw new Error();\n } catch (ex) {\n stackArray = ex.stack.split('\\n');\n }\n\n var stackObject = {};\n for (var i = ignoreFrames; i < stackArray.length; i++) {\n stackObject[i - ignoreFrames] = stackArray[i].replace(/^\\s*at\\s+/, '');\n }\n\n return stackObject;\n};\n\n/**\n * Divides the two numbers and floors the results, unless the remainder is less\n * than an incredibly small value, in which case it returns the ceiling.\n * This is useful when the number are truncated approximations of longer\n * values, and so doing division with these numbers yields a result incredibly\n * close to a whole number.\n *\n * @param {number} numerator\n * @param {number} denominator\n * @return {number}\n */\nlib.f.smartFloorDivide = function(numerator, denominator) {\n var val = numerator / denominator;\n var ceiling = Math.ceil(val);\n if (ceiling - val < .0001) {\n return ceiling;\n } else {\n return Math.floor(val);\n }\n};\n\n/**\n * Get a random integer in a range (inclusive).\n *\n * @param {number} min The lowest integer in the range.\n * @param {number} max The highest integer in the range.\n * @return {number} A random number between min & max.\n */\nlib.f.randomInt = function(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n};\n// SOURCE FILE: libdot/js/lib_message_manager.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * MessageManager class handles internationalized strings.\n *\n * Note: chrome.i18n isn't sufficient because...\n * 1. There's a bug in chrome that makes it unavailable in iframes:\n * https://crbug.com/130200\n * 2. The client code may not be packaged in a Chrome extension.\n * 3. The client code may be part of a library packaged in a third-party\n * Chrome extension.\n *\n * @param {Array} languages List of languages to load, in the order they\n * should be loaded. Newer messages replace older ones. 'en' is\n * automatically added as the first language if it is not already present.\n */\nlib.MessageManager = function(languages) {\n this.languages_ = languages.map(\n function(el) { return el.replace(/-/g, '_') });\n\n if (this.languages_.indexOf('en') == -1)\n this.languages_.unshift('en');\n\n this.messages = {};\n};\n\n/**\n * Add message definitions to the message manager.\n *\n * This takes an object of the same format of a Chrome messages.json file. See\n * .\n */\nlib.MessageManager.prototype.addMessages = function(defs) {\n for (var key in defs) {\n var def = defs[key];\n\n if (!def.placeholders) {\n this.messages[key] = def.message;\n } else {\n // Replace \"$NAME$\" placeholders with \"$1\", etc.\n this.messages[key] = def.message.replace(\n /\\$([a-z][^\\s\\$]+)\\$/ig,\n function(m, name) {\n return defs[key].placeholders[name.toLowerCase()].content;\n });\n }\n }\n};\n\n/**\n * Load the first available language message bundle.\n *\n * @param {string} pattern A url pattern containing a \"$1\" where the locale\n * name should go.\n * @param {function(Array,Array)} onComplete Function to be called when loading\n * is complete. The two arrays are the list of successful and failed\n * locale names. If the first parameter is length 0, no locales were\n * loaded.\n */\nlib.MessageManager.prototype.findAndLoadMessages = function(\n pattern, onComplete) {\n var languages = this.languages_.concat();\n var loaded = [];\n var failed = [];\n\n function onLanguageComplete(state) {\n if (state) {\n loaded = languages.shift();\n } else {\n failed = languages.shift();\n }\n\n if (languages.length) {\n tryNextLanguage();\n } else {\n onComplete(loaded, failed);\n }\n }\n\n var tryNextLanguage = function() {\n this.loadMessages(this.replaceReferences(pattern, languages),\n onLanguageComplete.bind(this, true),\n onLanguageComplete.bind(this, false));\n }.bind(this);\n\n tryNextLanguage();\n};\n\n/**\n * Load messages from a messages.json file.\n */\nlib.MessageManager.prototype.loadMessages = function(\n url, onSuccess, opt_onError) {\n var xhr = new XMLHttpRequest();\n\n xhr.onloadend = function() {\n if (xhr.status != 200) {\n if (opt_onError)\n opt_onError(xhr.status);\n\n return;\n }\n\n this.addMessages(JSON.parse(xhr.responseText));\n onSuccess();\n }.bind(this);\n\n xhr.open('GET', url);\n xhr.send();\n};\n\n/**\n * Replace $1...$n references with the elements of the args array.\n *\n * @param {string} msg String containing the message and argument references.\n * @param {Array} args Array containing the argument values.\n */\nlib.MessageManager.replaceReferences = function(msg, args) {\n return msg.replace(/\\$(\\d+)/g, function (m, index) {\n return args[index - 1];\n });\n};\n\n/**\n * Per-instance copy of replaceReferences.\n */\nlib.MessageManager.prototype.replaceReferences =\n lib.MessageManager.replaceReferences;\n\n/**\n * Get a message by name, optionally replacing arguments too.\n *\n * @param {string} msgname String containing the name of the message to get.\n * @param {Array} opt_args Optional array containing the argument values.\n * @param {string} opt_default Optional value to return if the msgname is not\n * found. Returns the message name by default.\n */\nlib.MessageManager.prototype.get = function(msgname, opt_args, opt_default) {\n var message;\n\n if (msgname in this.messages) {\n message = this.messages[msgname];\n\n } else {\n if (window.chrome.i18n)\n message = chrome.i18n.getMessage(msgname);\n\n if (!message) {\n console.warn('Unknown message: ' + msgname);\n return (typeof opt_default == 'undefined') ? msgname : opt_default;\n }\n }\n\n if (!opt_args)\n return message;\n\n if (!(opt_args instanceof Array))\n opt_args = [opt_args];\n\n return this.replaceReferences(message, opt_args);\n};\n\n/**\n * Process all of the \"i18n\" html attributes found in a given dom fragment.\n *\n * The real work happens in processI18nAttribute.\n */\nlib.MessageManager.prototype.processI18nAttributes = function(dom) {\n var nodes = dom.querySelectorAll('[i18n]');\n\n for (var i = 0; i < nodes.length; i++)\n this.processI18nAttribute(nodes[i]);\n};\n\n/**\n * Process the \"i18n\" attribute in the specified node.\n *\n * The i18n attribute should contain a JSON object. The keys are taken to\n * be attribute names, and the values are message names.\n *\n * If the JSON object has a \"_\" (underscore) key, its value is used as the\n * textContent of the element.\n *\n * Message names can refer to other attributes on the same element with by\n * prefixing with a dollar sign. For example...\n *\n * \n *\n * The aria-label message name will be computed as \"SEND_BUTTON_ARIA_LABEL\".\n * Notice that the \"id\" attribute was appended to the target attribute, and\n * the result converted to UPPER_AND_UNDER style.\n */\nlib.MessageManager.prototype.processI18nAttribute = function(node) {\n // Convert the \"lower-and-dashes\" attribute names into\n // \"UPPER_AND_UNDER\" style.\n function thunk(str) { return str.replace(/-/g, '_').toUpperCase() }\n\n var i18n = node.getAttribute('i18n');\n if (!i18n)\n return;\n\n try {\n i18n = JSON.parse(i18n);\n } catch (ex) {\n console.error('Can\\'t parse ' + node.tagName + '#' + node.id + ': ' + i18n);\n throw ex;\n }\n\n // Load all the messages specified in the i18n attributes.\n for (var key in i18n) {\n // The node attribute we'll be setting.\n var attr = key;\n\n var msgname = i18n[key];\n // For \"=foo\", re-use the referenced message name.\n if (msgname.startsWith('=')) {\n key = msgname.substr(1);\n msgname = i18n[key];\n }\n\n // For \"$foo\", calculate the message name.\n if (msgname.startsWith('$'))\n msgname = thunk(node.getAttribute(msgname.substr(1)) + '_' + key);\n\n // Finally load the message.\n var msg = this.get(msgname);\n if (attr == '_')\n node.textContent = msg;\n else\n node.setAttribute(attr, msg);\n }\n};\n// SOURCE FILE: libdot/js/lib_preference_manager.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Constructor for lib.PreferenceManager objects.\n *\n * These objects deal with persisting changes to stable storage and notifying\n * consumers when preferences change.\n *\n * It is intended that the backing store could be something other than HTML5\n * storage, but there aren't any use cases at the moment. In the future there\n * may be a chrome api to store sync-able name/value pairs, and we'd want\n * that.\n *\n * @param {lib.Storage.*} storage The storage object to use as a backing\n * store.\n * @param {string} opt_prefix The optional prefix to be used for all preference\n * names. The '/' character should be used to separate levels of hierarchy,\n * if you're going to have that kind of thing. If provided, the prefix\n * should start with a '/'. If not provided, it defaults to '/'.\n */\nlib.PreferenceManager = function(storage, opt_prefix) {\n this.storage = storage;\n this.storageObserver_ = this.onStorageChange_.bind(this);\n\n this.isActive_ = false;\n this.activate();\n\n this.trace = false;\n\n var prefix = opt_prefix || '/';\n if (!prefix.endsWith('/'))\n prefix += '/';\n\n this.prefix = prefix;\n\n this.prefRecords_ = {};\n this.globalObservers_ = [];\n\n this.childFactories_ = {};\n\n // Map of list-name to {map of child pref managers}\n // As in...\n //\n // this.childLists_ = {\n // 'profile-ids': {\n // 'one': PreferenceManager,\n // 'two': PreferenceManager,\n // ...\n // },\n //\n // 'frob-ids': {\n // ...\n // }\n // }\n this.childLists_ = {};\n};\n\n/**\n * Used internally to indicate that the current value of the preference should\n * be taken from the default value defined with the preference.\n *\n * Equality tests against this value MUST use '===' or '!==' to be accurate.\n */\nlib.PreferenceManager.prototype.DEFAULT_VALUE = lib.f.createEnum('DEFAULT');\n\n/**\n * An individual preference.\n *\n * These objects are managed by the PreferenceManager, you shouldn't need to\n * handle them directly.\n */\nlib.PreferenceManager.Record = function(name, defaultValue) {\n this.name = name;\n this.defaultValue = defaultValue;\n this.currentValue = this.DEFAULT_VALUE;\n this.observers = [];\n};\n\n/**\n * A local copy of the DEFAULT_VALUE constant to make it less verbose.\n */\nlib.PreferenceManager.Record.prototype.DEFAULT_VALUE =\n lib.PreferenceManager.prototype.DEFAULT_VALUE;\n\n/**\n * Register a callback to be invoked when this preference changes.\n *\n * @param {function(value, string, lib.PreferenceManager} observer The function\n * to invoke. It will receive the new value, the name of the preference,\n * and a reference to the PreferenceManager as parameters.\n */\nlib.PreferenceManager.Record.prototype.addObserver = function(observer) {\n this.observers.push(observer);\n};\n\n/**\n * Unregister an observer callback.\n *\n * @param {function} observer A previously registered callback.\n */\nlib.PreferenceManager.Record.prototype.removeObserver = function(observer) {\n var i = this.observers.indexOf(observer);\n if (i >= 0)\n this.observers.splice(i, 1);\n};\n\n/**\n * Fetch the value of this preference.\n */\nlib.PreferenceManager.Record.prototype.get = function() {\n if (this.currentValue === this.DEFAULT_VALUE) {\n if (/^(string|number)$/.test(typeof this.defaultValue))\n return this.defaultValue;\n\n if (typeof this.defaultValue == 'object') {\n // We want to return a COPY of the default value so that users can\n // modify the array or object without changing the default value.\n return JSON.parse(JSON.stringify(this.defaultValue));\n }\n\n return this.defaultValue;\n }\n\n return this.currentValue;\n};\n\n/**\n * Stop this preference manager from tracking storage changes.\n *\n * Call this if you're going to swap out one preference manager for another so\n * that you don't get notified about irrelevant changes.\n */\nlib.PreferenceManager.prototype.deactivate = function() {\n if (!this.isActive_)\n throw new Error('Not activated');\n\n this.isActive_ = false;\n this.storage.removeObserver(this.storageObserver_);\n};\n\n/**\n * Start tracking storage changes.\n *\n * If you previously deactivated this preference manager, you can reactivate it\n * with this method. You don't need to call this at initialization time, as\n * it's automatically called as part of the constructor.\n */\nlib.PreferenceManager.prototype.activate = function() {\n if (this.isActive_)\n throw new Error('Already activated');\n\n this.isActive_ = true;\n this.storage.addObserver(this.storageObserver_);\n};\n\n/**\n * Read the backing storage for these preferences.\n *\n * You should do this once at initialization time to prime the local cache\n * of preference values. The preference manager will monitor the backing\n * storage for changes, so you should not need to call this more than once.\n *\n * This function recursively reads storage for all child preference managers as\n * well.\n *\n * This function is asynchronous, if you need to read preference values, you\n * *must* wait for the callback.\n *\n * @param {function()} opt_callback Optional function to invoke when the read\n * has completed.\n */\nlib.PreferenceManager.prototype.readStorage = function(opt_callback) {\n var pendingChildren = 0;\n\n function onChildComplete() {\n if (--pendingChildren == 0 && opt_callback)\n opt_callback();\n }\n\n var keys = Object.keys(this.prefRecords_).map(\n function(el) { return this.prefix + el }.bind(this));\n\n if (this.trace)\n console.log('Preferences read: ' + this.prefix);\n\n this.storage.getItems(keys, function(items) {\n var prefixLength = this.prefix.length;\n\n for (var key in items) {\n var value = items[key];\n var name = key.substr(prefixLength);\n var needSync = (name in this.childLists_ &&\n (JSON.stringify(value) !=\n JSON.stringify(this.prefRecords_[name].currentValue)));\n\n this.prefRecords_[name].currentValue = value;\n\n if (needSync) {\n pendingChildren++;\n this.syncChildList(name, onChildComplete);\n }\n }\n\n if (pendingChildren == 0 && opt_callback)\n setTimeout(opt_callback);\n }.bind(this));\n};\n\n/**\n * Define a preference.\n *\n * This registers a name, default value, and onChange handler for a preference.\n *\n * @param {string} name The name of the preference. This will be prefixed by\n * the prefix of this PreferenceManager before written to local storage.\n * @param {string|number|boolean|Object|Array|null} value The default value of\n * this preference. Anything that can be represented in JSON is a valid\n * default value.\n * @param {function(value, string, lib.PreferenceManager} opt_observer A\n * function to invoke when the preference changes. It will receive the new\n * value, the name of the preference, and a reference to the\n * PreferenceManager as parameters.\n */\nlib.PreferenceManager.prototype.definePreference = function(\n name, value, opt_onChange) {\n\n var record = this.prefRecords_[name];\n if (record) {\n this.changeDefault(name, value);\n } else {\n record = this.prefRecords_[name] =\n new lib.PreferenceManager.Record(name, value);\n }\n\n if (opt_onChange)\n record.addObserver(opt_onChange);\n};\n\n/**\n * Define multiple preferences with a single function call.\n *\n * @param {Array} defaults An array of 3-element arrays. Each three element\n * array should contain the [key, value, onChange] parameters for a\n * preference.\n */\nlib.PreferenceManager.prototype.definePreferences = function(defaults) {\n for (var i = 0; i < defaults.length; i++) {\n this.definePreference(defaults[i][0], defaults[i][1], defaults[i][2]);\n }\n};\n\n/**\n * Define an ordered list of child preferences.\n *\n * Child preferences are different from just storing an array of JSON objects\n * in that each child is an instance of a preference manager. This means you\n * can observe changes to individual child preferences, and get some validation\n * that you're not reading or writing to an undefined child preference value.\n *\n * @param {string} listName A name for the list of children. This must be\n * unique in this preference manager. The listName will become a\n * preference on this PreferenceManager used to store the ordered list of\n * child ids. It is also used in get/add/remove operations to identify the\n * list of children to operate on.\n * @param {function} childFactory A function that will be used to generate\n * instances of these children. The factory function will receive the\n * parent lib.PreferenceManager object and a unique id for the new child\n * preferences.\n */\nlib.PreferenceManager.prototype.defineChildren = function(\n listName, childFactory) {\n\n // Define a preference to hold the ordered list of child ids.\n this.definePreference(listName, [],\n this.onChildListChange_.bind(this, listName));\n this.childFactories_[listName] = childFactory;\n this.childLists_[listName] = {};\n};\n\n/**\n * Register to observe preference changes.\n *\n * @param {Function} global A callback that will happen for every preference.\n * Pass null if you don't need one.\n * @param {Object} map A map of preference specific callbacks. Pass null if\n * you don't need any.\n */\nlib.PreferenceManager.prototype.addObservers = function(global, map) {\n if (global && typeof global != 'function')\n throw new Error('Invalid param: globals');\n\n if (global)\n this.globalObservers_.push(global);\n\n if (!map)\n return;\n\n for (var name in map) {\n if (!(name in this.prefRecords_))\n throw new Error('Unknown preference: ' + name);\n\n this.prefRecords_[name].addObserver(map[name]);\n }\n};\n\n/**\n * Dispatch the change observers for all known preferences.\n *\n * It may be useful to call this after readStorage completes, in order to\n * get application state in sync with user preferences.\n *\n * This can be used if you've changed a preference manager out from under\n * a live object, for example when switching to a different prefix.\n */\nlib.PreferenceManager.prototype.notifyAll = function() {\n for (var name in this.prefRecords_) {\n this.notifyChange_(name);\n }\n};\n\n/**\n * Notify the change observers for a given preference.\n *\n * @param {string} name The name of the preference that changed.\n */\nlib.PreferenceManager.prototype.notifyChange_ = function(name) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n var currentValue = record.get();\n\n for (var i = 0; i < this.globalObservers_.length; i++)\n this.globalObservers_[i](name, currentValue);\n\n for (var i = 0; i < record.observers.length; i++) {\n record.observers[i](currentValue, name, this);\n }\n};\n\n/**\n * Create a new child PreferenceManager for the given child list.\n *\n * The optional hint parameter is an opaque prefix added to the auto-generated\n * unique id for this child. Your child factory can parse out the prefix\n * and use it.\n *\n * @param {string} listName The child list to create the new instance from.\n * @param {string} opt_hint Optional hint to include in the child id.\n * @param {string} opt_id Optional id to override the generated id.\n */\nlib.PreferenceManager.prototype.createChild = function(listName, opt_hint,\n opt_id) {\n var ids = this.get(listName);\n var id;\n\n if (opt_id) {\n id = opt_id;\n if (ids.indexOf(id) != -1)\n throw new Error('Duplicate child: ' + listName + ': ' + id);\n\n } else {\n // Pick a random, unique 4-digit hex identifier for the new profile.\n while (!id || ids.indexOf(id) != -1) {\n id = lib.f.randomInt(1, 0xffff).toString(16);\n id = lib.f.zpad(id, 4);\n if (opt_hint)\n id = opt_hint + ':' + id;\n }\n }\n\n var childManager = this.childFactories_[listName](this, id);\n childManager.trace = this.trace;\n childManager.resetAll();\n\n this.childLists_[listName][id] = childManager;\n\n ids.push(id);\n this.set(listName, ids);\n\n return childManager;\n};\n\n/**\n * Remove a child preferences instance.\n *\n * Removes a child preference manager and clears any preferences stored in it.\n *\n * @param {string} listName The name of the child list containing the child to\n * remove.\n * @param {string} id The child ID.\n */\nlib.PreferenceManager.prototype.removeChild = function(listName, id) {\n var prefs = this.getChild(listName, id);\n prefs.resetAll();\n\n var ids = this.get(listName);\n var i = ids.indexOf(id);\n if (i != -1) {\n ids.splice(i, 1);\n this.set(listName, ids);\n }\n\n delete this.childLists_[listName][id];\n};\n\n/**\n * Return a child PreferenceManager instance for a given id.\n *\n * If the child list or child id is not known this will return the specified\n * default value or throw an exception if no default value is provided.\n *\n * @param {string} listName The child list to look in.\n * @param {string} id The child ID.\n * @param {*} opt_default The optional default value to return if the child\n * is not found.\n */\nlib.PreferenceManager.prototype.getChild = function(listName, id, opt_default) {\n if (!(listName in this.childLists_))\n throw new Error('Unknown child list: ' + listName);\n\n var childList = this.childLists_[listName];\n if (!(id in childList)) {\n if (typeof opt_default == 'undefined')\n throw new Error('Unknown \"' + listName + '\" child: ' + id);\n\n return opt_default;\n }\n\n return childList[id];\n};\n\n/**\n * Calculate the difference between two lists of child ids.\n *\n * Given two arrays of child ids, this function will return an object\n * with \"added\", \"removed\", and \"common\" properties. Each property is\n * a map of child-id to `true`. For example, given...\n *\n * a = ['child-x', 'child-y']\n * b = ['child-y']\n *\n * diffChildLists(a, b) =>\n * { added: { 'child-x': true }, removed: {}, common: { 'child-y': true } }\n *\n * The added/removed properties assume that `a` is the current list.\n *\n * @param {Array[string]} a The most recent list of child ids.\n * @param {Array[string]} b An older list of child ids.\n * @return {Object} An object with added/removed/common properties.\n */\nlib.PreferenceManager.diffChildLists = function(a, b) {\n var rv = {\n added: {},\n removed: {},\n common: {},\n };\n\n for (var i = 0; i < a.length; i++) {\n if (b.indexOf(a[i]) != -1) {\n rv.common[a[i]] = true;\n } else {\n rv.added[a[i]] = true;\n }\n }\n\n for (var i = 0; i < b.length; i++) {\n if ((b[i] in rv.added) || (b[i] in rv.common))\n continue;\n\n rv.removed[b[i]] = true;\n }\n\n return rv;\n};\n\n/**\n * Synchronize a list of child PreferenceManagers instances with the current\n * list stored in prefs.\n *\n * This will instantiate any missing managers and read current preference values\n * from storage. Any active managers that no longer appear in preferences will\n * be deleted.\n *\n * @param {string} listName The child list to synchronize.\n * @param {function()} opt_callback Optional function to invoke when the sync\n * is complete.\n */\nlib.PreferenceManager.prototype.syncChildList = function(\n listName, opt_callback) {\n\n var pendingChildren = 0;\n function onChildStorage() {\n if (--pendingChildren == 0 && opt_callback)\n opt_callback();\n }\n\n // The list of child ids that we *should* have a manager for.\n var currentIds = this.get(listName);\n\n // The known managers at the start of the sync. Any manager still in this\n // list at the end should be discarded.\n var oldIds = Object.keys(this.childLists_[listName]);\n\n var rv = lib.PreferenceManager.diffChildLists(currentIds, oldIds);\n\n for (var i = 0; i < currentIds.length; i++) {\n var id = currentIds[i];\n\n var managerIndex = oldIds.indexOf(id);\n if (managerIndex >= 0)\n oldIds.splice(managerIndex, 1);\n\n if (!this.childLists_[listName][id]) {\n var childManager = this.childFactories_[listName](this, id);\n if (!childManager) {\n console.warn('Unable to restore child: ' + listName + ': ' + id);\n continue;\n }\n\n childManager.trace = this.trace;\n this.childLists_[listName][id] = childManager;\n pendingChildren++;\n childManager.readStorage(onChildStorage);\n }\n }\n\n for (var i = 0; i < oldIds.length; i++) {\n delete this.childLists_[listName][oldIds[i]];\n }\n\n if (!pendingChildren && opt_callback)\n setTimeout(opt_callback);\n};\n\n/**\n * Reset a preference to its default state.\n *\n * This will dispatch the onChange handler if the preference value actually\n * changes.\n *\n * @param {string} name The preference to reset.\n */\nlib.PreferenceManager.prototype.reset = function(name) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n this.storage.removeItem(this.prefix + name);\n\n if (record.currentValue !== this.DEFAULT_VALUE) {\n record.currentValue = this.DEFAULT_VALUE;\n this.notifyChange_(name);\n }\n};\n\n/**\n * Reset all preferences back to their default state.\n */\nlib.PreferenceManager.prototype.resetAll = function() {\n var changed = [];\n\n for (var listName in this.childLists_) {\n var childList = this.childLists_[listName];\n for (var id in childList) {\n childList[id].resetAll();\n }\n }\n\n for (var name in this.prefRecords_) {\n if (this.prefRecords_[name].currentValue !== this.DEFAULT_VALUE) {\n this.prefRecords_[name].currentValue = this.DEFAULT_VALUE;\n changed.push(name);\n }\n }\n\n var keys = Object.keys(this.prefRecords_).map(function(el) {\n return this.prefix + el;\n }.bind(this));\n\n this.storage.removeItems(keys);\n\n changed.forEach(this.notifyChange_.bind(this));\n};\n\n/**\n * Return true if two values should be considered not-equal.\n *\n * If both values are the same scalar type and compare equal this function\n * returns false (no difference), otherwise return true.\n *\n * This is used in places where we want to check if a preference has changed.\n * Rather than take the time to compare complex values we just consider them\n * to always be different.\n *\n * @param {*} a A value to compare.\n * @param {*} b A value to compare.\n */\nlib.PreferenceManager.prototype.diff = function(a, b) {\n // If the types are different, or the type is not a simple primitive one.\n if ((typeof a) !== (typeof b) ||\n !(/^(undefined|boolean|number|string)$/.test(typeof a))) {\n return true;\n }\n\n return a !== b;\n};\n\n/**\n * Change the default value of a preference.\n *\n * This is useful when subclassing preference managers.\n *\n * The function does not alter the current value of the preference, unless\n * it has the old default value. When that happens, the change observers\n * will be notified.\n *\n * @param {string} name The name of the parameter to change.\n * @param {*} newValue The new default value for the preference.\n */\nlib.PreferenceManager.prototype.changeDefault = function(name, newValue) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n if (!this.diff(record.defaultValue, newValue)) {\n // Default value hasn't changed.\n return;\n }\n\n if (record.currentValue !== this.DEFAULT_VALUE) {\n // This pref has a specific value, just change the default and we're done.\n record.defaultValue = newValue;\n return;\n }\n\n record.defaultValue = newValue;\n\n this.notifyChange_(name);\n};\n\n/**\n * Change the default value of multiple preferences.\n *\n * @param {Object} map A map of name -> value pairs specifying the new default\n * values.\n */\nlib.PreferenceManager.prototype.changeDefaults = function(map) {\n for (var key in map) {\n this.changeDefault(key, map[key]);\n }\n};\n\n/**\n * Set a preference to a specific value.\n *\n * This will dispatch the onChange handler if the preference value actually\n * changes.\n *\n * @param {string} key The preference to set.\n * @param {*} value The value to set. Anything that can be represented in\n * JSON is a valid value.\n */\nlib.PreferenceManager.prototype.set = function(name, newValue) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n var oldValue = record.get();\n\n if (!this.diff(oldValue, newValue))\n return;\n\n if (this.diff(record.defaultValue, newValue)) {\n record.currentValue = newValue;\n this.storage.setItem(this.prefix + name, newValue);\n } else {\n record.currentValue = this.DEFAULT_VALUE;\n this.storage.removeItem(this.prefix + name);\n }\n\n // We need to manually send out the notification on this instance. If we\n // The storage event won't fire a notification because we've already changed\n // the currentValue, so it won't see a difference. If we delayed changing\n // currentValue until the storage event, a pref read immediately after a write\n // would return the previous value.\n //\n // The notification is in a timeout so clients don't accidentally depend on\n // a synchronous notification.\n setTimeout(this.notifyChange_.bind(this, name), 0);\n};\n\n/**\n * Get the value of a preference.\n *\n * @param {string} key The preference to get.\n */\nlib.PreferenceManager.prototype.get = function(name) {\n var record = this.prefRecords_[name];\n if (!record)\n throw new Error('Unknown preference: ' + name);\n\n return record.get();\n};\n\n/**\n * Return all non-default preferences as a JSON object.\n *\n * This includes any nested preference managers as well.\n */\nlib.PreferenceManager.prototype.exportAsJson = function() {\n var rv = {};\n\n for (var name in this.prefRecords_) {\n if (name in this.childLists_) {\n rv[name] = [];\n var childIds = this.get(name);\n for (var i = 0; i < childIds.length; i++) {\n var id = childIds[i];\n rv[name].push({id: id, json: this.getChild(name, id).exportAsJson()});\n }\n\n } else {\n var record = this.prefRecords_[name];\n if (record.currentValue != this.DEFAULT_VALUE)\n rv[name] = record.currentValue;\n }\n }\n\n return rv;\n};\n\n/**\n * Import a JSON blob of preferences previously generated with exportAsJson.\n *\n * This will create nested preference managers as well.\n */\nlib.PreferenceManager.prototype.importFromJson = function(json) {\n for (var name in json) {\n if (name in this.childLists_) {\n var childList = json[name];\n for (var i = 0; i < childList.length; i++) {\n var id = childList[i].id;\n\n var childPrefManager = this.childLists_[name][id];\n if (!childPrefManager)\n childPrefManager = this.createChild(name, null, id);\n\n childPrefManager.importFromJson(childList[i].json);\n }\n\n } else {\n this.set(name, json[name]);\n }\n }\n};\n\n/**\n * Called when one of the child list preferences changes.\n */\nlib.PreferenceManager.prototype.onChildListChange_ = function(listName) {\n this.syncChildList(listName);\n};\n\n/**\n * Called when a key in the storage changes.\n */\nlib.PreferenceManager.prototype.onStorageChange_ = function(map) {\n for (var key in map) {\n if (this.prefix) {\n if (key.lastIndexOf(this.prefix, 0) != 0)\n continue;\n }\n\n var name = key.substr(this.prefix.length);\n\n if (!(name in this.prefRecords_)) {\n // Sometimes we'll get notified about prefs that are no longer defined.\n continue;\n }\n\n var record = this.prefRecords_[name];\n\n var newValue = map[key].newValue;\n var currentValue = record.currentValue;\n if (currentValue === record.DEFAULT_VALUE)\n currentValue = (void 0);\n\n if (this.diff(currentValue, newValue)) {\n if (typeof newValue == 'undefined' || newValue === null) {\n record.currentValue = record.DEFAULT_VALUE;\n } else {\n record.currentValue = newValue;\n }\n\n this.notifyChange_(name);\n }\n }\n};\n// SOURCE FILE: libdot/js/lib_resource.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Storage for canned resources.\n *\n * These are usually non-JavaScript things that are collected during a build\n * step and converted into a series of 'lib.resource.add(...)' calls. See\n * the \"@resource\" directive from libdot/bin/concat.sh for the canonical use\n * case.\n *\n * This is global storage, so you should prefix your resource names to avoid\n * collisions.\n */\nlib.resource = {\n resources_: {}\n};\n\n/**\n * Add a resource.\n *\n * @param {string} name A name for the resource. You should prefix this to\n * avoid collisions with resources from a shared library.\n * @param {string} type A mime type for the resource, or \"raw\" if not\n * applicable.\n * @param {*} data The value of the resource.\n */\nlib.resource.add = function(name, type, data) {\n lib.resource.resources_[name] = {\n type: type,\n name: name,\n data: data\n };\n};\n\n/**\n * Retrieve a resource record.\n *\n * The resource data is stored on the \"data\" property of the returned object.\n *\n * @param {string} name The name of the resource to get.\n * @param {*} opt_defaultValue The optional value to return if the resource is\n * not defined.\n * @return {object} An object with \"type\", \"name\", and \"data\" properties.\n */\nlib.resource.get = function(name, opt_defaultValue) {\n if (!(name in lib.resource.resources_)) {\n if (typeof opt_defaultValue == 'undefined')\n throw 'Unknown resource: ' + name;\n\n return opt_defaultValue;\n }\n\n return lib.resource.resources_[name];\n};\n\n/**\n * Retrieve resource data.\n *\n * @param {string} name The name of the resource to get.\n * @param {*} opt_defaultValue The optional value to return if the resource is\n * not defined.\n * @return {*} The resource data.\n */\nlib.resource.getData = function(name, opt_defaultValue) {\n if (!(name in lib.resource.resources_)) {\n if (typeof opt_defaultValue == 'undefined')\n throw 'Unknown resource: ' + name;\n\n return opt_defaultValue;\n }\n\n return lib.resource.resources_[name].data;\n};\n\n/**\n * Retrieve resource as a data: url.\n *\n * @param {string} name The name of the resource to get.\n * @param {*} opt_defaultValue The optional value to return if the resource is\n * not defined.\n * @return {*} A data: url encoded version of the resource.\n */\nlib.resource.getDataUrl = function(name, opt_defaultValue) {\n var resource = lib.resource.get(name, opt_defaultValue);\n return 'data:' + resource.type + ',' + resource.data;\n};\n// SOURCE FILE: libdot/js/lib_storage.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Namespace for implementations of persistent, possibly cloud-backed\n * storage.\n */\nlib.Storage = new Object();\n// SOURCE FILE: libdot/js/lib_storage_chrome.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * chrome.storage based class with an async interface that is interchangeable\n * with other lib.Storage.* implementations.\n */\nlib.Storage.Chrome = function(storage) {\n this.storage_ = storage;\n this.observers_ = [];\n\n chrome.storage.onChanged.addListener(this.onChanged_.bind(this));\n};\n\n/**\n * Called by the storage implementation when the storage is modified.\n */\nlib.Storage.Chrome.prototype.onChanged_ = function(changes, areaname) {\n if (chrome.storage[areaname] != this.storage_)\n return;\n\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](changes);\n }\n};\n\n/**\n * Register a function to observe storage changes.\n *\n * @param {function(map)} callback The function to invoke when the storage\n * changes.\n */\nlib.Storage.Chrome.prototype.addObserver = function(callback) {\n this.observers_.push(callback);\n};\n\n/**\n * Unregister a change observer.\n *\n * @param {function} observer A previously registered callback.\n */\nlib.Storage.Chrome.prototype.removeObserver = function(callback) {\n var i = this.observers_.indexOf(callback);\n if (i != -1)\n this.observers_.splice(i, 1);\n};\n\n/**\n * Delete everything in this storage.\n *\n * @param {function(map)} callback The function to invoke when the delete\n * has completed.\n */\nlib.Storage.Chrome.prototype.clear = function(opt_callback) {\n this.storage_.clear();\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Return the current value of a storage item.\n *\n * @param {string} key The key to look up.\n * @param {function(value) callback The function to invoke when the value has\n * been retrieved.\n */\nlib.Storage.Chrome.prototype.getItem = function(key, callback) {\n this.storage_.get(key, callback);\n};\n/**\n * Fetch the values of multiple storage items.\n *\n * @param {Array} keys The keys to look up.\n * @param {function(map) callback The function to invoke when the values have\n * been retrieved.\n */\n\nlib.Storage.Chrome.prototype.getItems = function(keys, callback) {\n this.storage_.get(keys, callback);\n};\n\n/**\n * Set a value in storage.\n *\n * @param {string} key The key for the value to be stored.\n * @param {*} value The value to be stored. Anything that can be serialized\n * with JSON is acceptable.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Chrome.prototype.setItem = function(key, value, opt_callback) {\n var obj = {};\n obj[key] = value;\n this.storage_.set(obj, opt_callback);\n};\n\n/**\n * Set multiple values in storage.\n *\n * @param {Object} map A map of key/values to set in storage.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Chrome.prototype.setItems = function(obj, opt_callback) {\n this.storage_.set(obj, opt_callback);\n};\n\n/**\n * Remove an item from storage.\n *\n * @param {string} key The key to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Chrome.prototype.removeItem = function(key, opt_callback) {\n this.storage_.remove(key, opt_callback);\n};\n\n/**\n * Remove multiple items from storage.\n *\n * @param {Array} keys The keys to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Chrome.prototype.removeItems = function(keys, opt_callback) {\n this.storage_.remove(keys, opt_callback);\n};\n// SOURCE FILE: libdot/js/lib_storage_local.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * window.localStorage based class with an async interface that is\n * interchangeable with other lib.Storage.* implementations.\n */\nlib.Storage.Local = function() {\n this.observers_ = [];\n this.storage_ = window.localStorage;\n window.addEventListener('storage', this.onStorage_.bind(this));\n};\n\n/**\n * Called by the storage implementation when the storage is modified.\n */\nlib.Storage.Local.prototype.onStorage_ = function(e) {\n if (e.storageArea != this.storage_)\n return;\n\n // JS throws an exception if JSON.parse is given an empty string. So here we\n // only parse if the value is truthy. This mean the empty string, undefined\n // and null will not be parsed.\n var prevValue = e.oldValue ? JSON.parse(e.oldValue) : e.oldValue;\n var curValue = e.newValue ? JSON.parse(e.newValue) : e.newValue;\n var o = {};\n o[e.key] = {\n oldValue: prevValue,\n newValue: curValue\n };\n\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](o);\n }\n};\n\n/**\n * Register a function to observe storage changes.\n *\n * @param {function(map)} callback The function to invoke when the storage\n * changes.\n */\nlib.Storage.Local.prototype.addObserver = function(callback) {\n this.observers_.push(callback);\n};\n\n/**\n * Unregister a change observer.\n *\n * @param {function} observer A previously registered callback.\n */\nlib.Storage.Local.prototype.removeObserver = function(callback) {\n var i = this.observers_.indexOf(callback);\n if (i != -1)\n this.observers_.splice(i, 1);\n};\n\n/**\n * Delete everything in this storage.\n *\n * @param {function(map)} callback The function to invoke when the delete\n * has completed.\n */\nlib.Storage.Local.prototype.clear = function(opt_callback) {\n this.storage_.clear();\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Return the current value of a storage item.\n *\n * @param {string} key The key to look up.\n * @param {function(value) callback The function to invoke when the value has\n * been retrieved.\n */\nlib.Storage.Local.prototype.getItem = function(key, callback) {\n var value = this.storage_.getItem(key);\n\n if (typeof value == 'string') {\n try {\n value = JSON.parse(value);\n } catch (e) {\n // If we can't parse the value, just return it unparsed.\n }\n }\n\n setTimeout(callback.bind(null, value), 0);\n};\n\n/**\n * Fetch the values of multiple storage items.\n *\n * @param {Array} keys The keys to look up.\n * @param {function(map) callback The function to invoke when the values have\n * been retrieved.\n */\nlib.Storage.Local.prototype.getItems = function(keys, callback) {\n var rv = {};\n\n for (var i = keys.length - 1; i >= 0; i--) {\n var key = keys[i];\n var value = this.storage_.getItem(key);\n if (typeof value == 'string') {\n try {\n rv[key] = JSON.parse(value);\n } catch (e) {\n // If we can't parse the value, just return it unparsed.\n rv[key] = value;\n }\n } else {\n keys.splice(i, 1);\n }\n }\n\n setTimeout(callback.bind(null, rv), 0);\n};\n\n/**\n * Set a value in storage.\n *\n * @param {string} key The key for the value to be stored.\n * @param {*} value The value to be stored. Anything that can be serialized\n * with JSON is acceptable.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Local.prototype.setItem = function(key, value, opt_callback) {\n this.storage_.setItem(key, JSON.stringify(value));\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Set multiple values in storage.\n *\n * @param {Object} map A map of key/values to set in storage.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Local.prototype.setItems = function(obj, opt_callback) {\n for (var key in obj) {\n this.storage_.setItem(key, JSON.stringify(obj[key]));\n }\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Remove an item from storage.\n *\n * @param {string} key The key to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Local.prototype.removeItem = function(key, opt_callback) {\n this.storage_.removeItem(key);\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Remove multiple items from storage.\n *\n * @param {Array} keys The keys to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Local.prototype.removeItems = function(ary, opt_callback) {\n for (var i = 0; i < ary.length; i++) {\n this.storage_.removeItem(ary[i]);\n }\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n// SOURCE FILE: libdot/js/lib_storage_memory.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * In-memory storage class with an async interface that is interchangeable with\n * other lib.Storage.* implementations.\n */\nlib.Storage.Memory = function() {\n this.observers_ = [];\n this.storage_ = {};\n};\n\n/**\n * Register a function to observe storage changes.\n *\n * @param {function(map)} callback The function to invoke when the storage\n * changes.\n */\nlib.Storage.Memory.prototype.addObserver = function(callback) {\n this.observers_.push(callback);\n};\n\n/**\n * Unregister a change observer.\n *\n * @param {function} observer A previously registered callback.\n */\nlib.Storage.Memory.prototype.removeObserver = function(callback) {\n var i = this.observers_.indexOf(callback);\n if (i != -1)\n this.observers_.splice(i, 1);\n};\n\n/**\n * Delete everything in this storage.\n *\n * @param {function(map)} callback The function to invoke when the delete\n * has completed.\n */\nlib.Storage.Memory.prototype.clear = function(opt_callback) {\n var e = {};\n for (var key in this.storage_) {\n e[key] = {oldValue: this.storage_[key], newValue: (void 0)};\n }\n\n this.storage_ = {};\n\n setTimeout(function() {\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](e);\n }\n }.bind(this), 0);\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Return the current value of a storage item.\n *\n * @param {string} key The key to look up.\n * @param {function(value) callback The function to invoke when the value has\n * been retrieved.\n */\nlib.Storage.Memory.prototype.getItem = function(key, callback) {\n var value = this.storage_[key];\n\n if (typeof value == 'string') {\n try {\n value = JSON.parse(value);\n } catch (e) {\n // If we can't parse the value, just return it unparsed.\n }\n }\n\n setTimeout(callback.bind(null, value), 0);\n};\n\n/**\n * Fetch the values of multiple storage items.\n *\n * @param {Array} keys The keys to look up.\n * @param {function(map) callback The function to invoke when the values have\n * been retrieved.\n */\nlib.Storage.Memory.prototype.getItems = function(keys, callback) {\n var rv = {};\n\n for (var i = keys.length - 1; i >= 0; i--) {\n var key = keys[i];\n var value = this.storage_[key];\n if (typeof value == 'string') {\n try {\n rv[key] = JSON.parse(value);\n } catch (e) {\n // If we can't parse the value, just return it unparsed.\n rv[key] = value;\n }\n } else {\n keys.splice(i, 1);\n }\n }\n\n setTimeout(callback.bind(null, rv), 0);\n};\n\n/**\n * Set a value in storage.\n *\n * @param {string} key The key for the value to be stored.\n * @param {*} value The value to be stored. Anything that can be serialized\n * with JSON is acceptable.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Memory.prototype.setItem = function(key, value, opt_callback) {\n var oldValue = this.storage_[key];\n this.storage_[key] = JSON.stringify(value);\n\n var e = {};\n e[key] = {oldValue: oldValue, newValue: value};\n\n setTimeout(function() {\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](e);\n }\n }.bind(this), 0);\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Set multiple values in storage.\n *\n * @param {Object} map A map of key/values to set in storage.\n * @param {function()} opt_callback Optional function to invoke when the\n * set is complete. You don't have to wait for the set to complete in order\n * to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Memory.prototype.setItems = function(obj, opt_callback) {\n var e = {};\n\n for (var key in obj) {\n e[key] = {oldValue: this.storage_[key], newValue: obj[key]};\n this.storage_[key] = JSON.stringify(obj[key]);\n }\n\n setTimeout(function() {\n for (var i = 0; i < this.observers_.length; i++) {\n this.observers_[i](e);\n }\n }.bind(this));\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Remove an item from storage.\n *\n * @param {string} key The key to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Memory.prototype.removeItem = function(key, opt_callback) {\n delete this.storage_[key];\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n\n/**\n * Remove multiple items from storage.\n *\n * @param {Array} keys The keys to be removed.\n * @param {function()} opt_callback Optional function to invoke when the\n * remove is complete. You don't have to wait for the set to complete in\n * order to read the value, since the local cache is updated synchronously.\n */\nlib.Storage.Memory.prototype.removeItems = function(ary, opt_callback) {\n for (var i = 0; i < ary.length; i++) {\n delete this.storage_[ary[i]];\n }\n\n if (opt_callback)\n setTimeout(opt_callback, 0);\n};\n// SOURCE FILE: libdot/js/lib_test_manager.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * @fileoverview JavaScript unit testing framework for synchronous and\n * asynchronous tests.\n *\n * This file contains the lib.TestManager and related classes. At the moment\n * it's all collected in a single file since it's reasonably small\n * (=~1k lines), and it's a lot easier to include one file into your test\n * harness than it is to include seven.\n *\n * The following classes are defined...\n *\n * lib.TestManager - The root class and entrypoint for creating test runs.\n * lib.TestManager.Log - Logging service.\n * lib.TestManager.Suite - A collection of tests.\n * lib.TestManager.Test - A single test.\n * lib.TestManager.TestRun - Manages the execution of a set of tests.\n * lib.TestManager.Result - A single test result.\n */\n\n/**\n * Root object in the unit test hierarchy, and keeper of the log object.\n *\n * @param {lib.TestManager.Log} opt_log Optional lib.TestManager.Log object.\n * Logs to the JavaScript console if omitted.\n */\nlib.TestManager = function(opt_log) {\n this.log = opt_log || new lib.TestManager.Log();\n}\n\n/**\n * Create a new test run object for this test manager.\n *\n * @param {Object} opt_cx An object to be passed to test suite setup(),\n * preamble(), and test cases during this test run. This object is opaque\n * to lib.TestManager.* code. It's entirely up to the test suite what it's\n * used for.\n */\nlib.TestManager.prototype.createTestRun = function(opt_cx) {\n return new lib.TestManager.TestRun(this, opt_cx);\n};\n\n/**\n * Called when a test run associated with this test manager completes.\n *\n * Clients may override this to call an appropriate function.\n */\nlib.TestManager.prototype.onTestRunComplete = function(testRun) {};\n\n/**\n * Called before a test associated with this test manager is run.\n *\n * @param {lib.TestManager.Result} result The result object for the upcoming\n * test.\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.prototype.testPreamble = function(result, cx) {};\n\n/**\n * Called after a test associated with this test manager finishes.\n *\n * @param {lib.TestManager.Result} result The result object for the finished\n * test.\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.prototype.testPostamble = function(result, cx) {};\n\n/**\n * Destination for test case output.\n *\n * Thw API will be the same as the console object. e.g. We support info(),\n * warn(), error(), etc... just like console.info(), etc...\n *\n * @param {Object} opt_console The console object to route all logging through.\n * Should provide saome API as the standard console API.\n */\nlib.TestManager.Log = function(opt_console=console) {\n this.save = false;\n this.data = '';\n this.prefix_ = '';\n this.prefixStack_ = 0;\n\n // Capture all the console entry points in case code at runtime calls these\n // directly. We want to be able to still see things.\n // We also expose the direct API to our callers (e.g. we provide warn()).\n this.console_ = opt_console;\n ['log', 'debug', 'info', 'warn', 'error'].forEach((level) => {\n let msgPrefix = '';\n switch (level) {\n case 'debug':\n case 'warn':\n case 'error':\n msgPrefix = level.toUpperCase() + ': ';\n break;\n }\n\n const oLog = this.console_[level];\n this[level] = this.console_[level] = (...args) => {\n if (this.save)\n this.data += this.prefix_ + msgPrefix + args.join(' ') + '\\n';\n oLog.apply(this.console_, args);\n };\n });\n\n // Wrap/bind the group functions.\n ['group', 'groupCollapsed'].forEach((group) => {\n const oGroup = this.console_[group];\n this[group] = this.console_[group] = (label='') => {\n oGroup(label);\n if (this.save)\n this.data += this.prefix_ + label + '\\n';\n this.prefix_ = ' '.repeat(++this.prefixStack_);\n };\n });\n\n const oGroupEnd = this.console_.groupEnd;\n this.groupEnd = this.console_.groupEnd = () => {\n oGroupEnd();\n this.prefix_ = ' '.repeat(--this.prefixStack_);\n };\n};\n\n/**\n * Returns a new constructor function that will inherit from\n * lib.TestManager.Suite.\n *\n * Use this function to create a new test suite subclass. It will return a\n * properly initialized constructor function for the subclass. You can then\n * override the setup() and preamble() methods if necessary and add test cases\n * to the subclass.\n *\n * var MyTests = new lib.TestManager.Suite('MyTests');\n *\n * MyTests.prototype.setup = function(cx) {\n * // Sets this.size to cx.size if it exists, or the default value of 10\n * // if not.\n * this.setDefault(cx, {size: 10});\n * };\n *\n * MyTests.prototype.preamble = function(result, cx) {\n * // Some tests (even successful ones) may side-effect this list, so\n * // recreate it before every test.\n * this.list = [];\n * for (var i = 0; i < this.size; i++) {\n * this.list[i] = i;\n * }\n * };\n *\n * // Basic synchronous test case.\n * MyTests.addTest('pop-length', function(result, cx) {\n * this.list.pop();\n *\n * // If this assertion fails, the testcase will stop here.\n * result.assertEQ(this.list.length, this.size - 1);\n *\n * // A test must indicate it has passed by calling this method.\n * result.pass();\n * });\n *\n * // Sample asynchronous test case.\n * MyTests.addTest('async-pop-length', function(result, cx) {\n * var self = this;\n *\n * var callback = function() {\n * result.assertEQ(self.list.length, self.size - 1);\n * result.pass();\n * };\n *\n * // Wait 100ms to check the array length for the sake of this example.\n * setTimeout(callback, 100);\n *\n * this.list.pop();\n *\n * // Indicate that this test needs another 200ms to complete.\n * // If the test does not report pass/fail by then, it is considered to\n * // have timed out.\n * result.requestTime(200);\n * });\n *\n * ...\n *\n * @param {string} suiteName The name of the test suite.\n */\nlib.TestManager.Suite = function(suiteName) {\n function ctor(testManager, cx) {\n this.testManager_ = testManager;\n this.suiteName = suiteName;\n\n this.setup(cx);\n }\n\n ctor.suiteName = suiteName;\n ctor.addTest = lib.TestManager.Suite.addTest;\n ctor.disableTest = lib.TestManager.Suite.disableTest;\n ctor.getTest = lib.TestManager.Suite.getTest;\n ctor.getTestList = lib.TestManager.Suite.getTestList;\n ctor.testList_ = [];\n ctor.testMap_ = {};\n ctor.prototype = Object.create(lib.TestManager.Suite.prototype);\n ctor.constructor = lib.TestManager.Suite;\n\n lib.TestManager.Suite.subclasses.push(ctor);\n\n return ctor;\n};\n\n/**\n * List of lib.TestManager.Suite subclasses, in the order they were defined.\n */\nlib.TestManager.Suite.subclasses = [];\n\n/**\n * Add a test to a lib.TestManager.Suite.\n *\n * This method is copied to new subclasses when they are created.\n */\nlib.TestManager.Suite.addTest = function(testName, testFunction) {\n if (testName in this.testMap_)\n throw 'Duplicate test name: ' + testName;\n\n var test = new lib.TestManager.Test(this, testName, testFunction);\n this.testMap_[testName] = test;\n this.testList_.push(test);\n};\n\n/**\n * Defines a disabled test.\n */\nlib.TestManager.Suite.disableTest = function(testName, testFunction) {\n if (testName in this.testMap_)\n throw 'Duplicate test name: ' + testName;\n\n var test = new lib.TestManager.Test(this, testName, testFunction);\n console.log('Disabled test: ' + test.fullName);\n};\n\n/**\n * Get a lib.TestManager.Test instance by name.\n *\n * This method is copied to new subclasses when they are created.\n *\n * @param {string} testName The name of the desired test.\n * @return {lib.TestManager.Test} The requested test, or undefined if it was not\n * found.\n */\nlib.TestManager.Suite.getTest = function(testName) {\n return this.testMap_[testName];\n};\n\n/**\n * Get an array of lib.TestManager.Tests associated with this Suite.\n *\n * This method is copied to new subclasses when they are created.\n */\nlib.TestManager.Suite.getTestList = function() {\n return this.testList_;\n};\n\n/**\n * Set properties on a test suite instance, pulling the property value from\n * the context if it exists and from the defaults dictionary if not.\n *\n * This is intended to be used in your test suite's setup() method to\n * define parameters for the test suite which may be overridden through the\n * context object. For example...\n *\n * MySuite.prototype.setup = function(cx) {\n * this.setDefaults(cx, {size: 10});\n * };\n *\n * If the context object has a 'size' property then this.size will be set to\n * the value of cx.size, otherwise this.size will get a default value of 10.\n *\n * @param {Object} cx The context object for a test run.\n * @param {Object} defaults An object containing name/value pairs to set on\n * this test suite instance. The value listed here will be used if the\n * name is not defined on the context object.\n */\nlib.TestManager.Suite.prototype.setDefaults = function(cx, defaults) {\n for (var k in defaults) {\n this[k] = (k in cx) ? cx[k] : defaults[k];\n }\n};\n\n/**\n * Subclassable method called to set up the test suite.\n *\n * The default implementation of this method is a no-op. If your test suite\n * requires some kind of suite-wide setup, this is the place to do it.\n *\n * It's fine to store state on the test suite instance, that state will be\n * accessible to all tests in the suite. If any test case fails, the entire\n * test suite object will be discarded and a new one will be created for\n * the remaining tests.\n *\n * Any side effects outside of this test suite instance must be idempotent.\n * For example, if you're adding DOM nodes to a document, make sure to first\n * test that they're not already there. If they are, remove them rather than\n * reuse them. You should not count on their state, since they were probably\n * left behind by a failed testcase.\n *\n * Any exception here will abort the remainder of the test run.\n *\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.Suite.prototype.setup = function(cx) {};\n\n/**\n * Subclassable method called to do pre-test set up.\n *\n * The default implementation of this method is a no-op. If your test suite\n * requires some kind of pre-test setup, this is the place to do it.\n *\n * This can be used to avoid a bunch of boilerplate setup/teardown code in\n * this suite's testcases.\n *\n * Any exception here will abort the remainder of the test run.\n *\n * @param {lib.TestManager.Result} result The result object for the upcoming\n * test.\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.Suite.prototype.preamble = function(result, cx) {};\n\n/**\n * Subclassable method called to do post-test tear-down.\n *\n * The default implementation of this method is a no-op. If your test suite\n * requires some kind of pre-test setup, this is the place to do it.\n *\n * This can be used to avoid a bunch of boilerplate setup/teardown code in\n * this suite's testcases.\n *\n * Any exception here will abort the remainder of the test run.\n *\n * @param {lib.TestManager.Result} result The result object for the finished\n * test.\n * @param {Object} cx The context object for a test run.\n */\nlib.TestManager.Suite.prototype.postamble = function(result, cx) {};\n\n/**\n * Object representing a single test in a test suite.\n *\n * These are created as part of the lib.TestManager.Suite.addTest() method.\n * You should never have to construct one by hand.\n *\n * @param {lib.TestManager.Suite} suiteClass The test suite class containing\n * this test.\n * @param {string} testName The local name of this test case, not including the\n * test suite name.\n * @param {function(lib.TestManager.Result, Object)} testFunction The function\n * to invoke for this test case. This is passed a Result instance and the\n * context object associated with the test run.\n *\n */\nlib.TestManager.Test = function(suiteClass, testName, testFunction) {\n /**\n * The test suite class containing this function.\n */\n this.suiteClass = suiteClass;\n\n /**\n * The local name of this test, not including the test suite name.\n */\n this.testName = testName;\n\n /**\n * The global name of this test, including the test suite name.\n */\n this.fullName = suiteClass.suiteName + '[' + testName + ']';\n\n // The function to call for this test.\n this.testFunction_ = testFunction;\n};\n\n/**\n * Execute this test.\n *\n * This is called by a lib.TestManager.Result instance, as part of a\n * lib.TestManager.TestRun. You should not call it by hand.\n *\n * @param {lib.TestManager.Result} result The result object for the test.\n */\nlib.TestManager.Test.prototype.run = function(result) {\n try {\n // Tests are applied to the parent lib.TestManager.Suite subclass.\n this.testFunction_.apply(result.suite,\n [result, result.testRun.cx]);\n } catch (ex) {\n if (ex instanceof lib.TestManager.Result.TestComplete)\n return;\n\n result.println('Test raised an exception: ' + ex);\n\n if (ex.stack) {\n if (ex.stack instanceof Array) {\n result.println(ex.stack.join('\\n'));\n } else {\n result.println(ex.stack);\n }\n }\n\n result.completeTest_(result.FAILED, false);\n }\n};\n\n/**\n * Used to choose a set of tests and run them.\n *\n * It's slightly more convenient to construct one of these from\n * lib.TestManager.prototype.createTestRun().\n *\n * @param {lib.TestManager} testManager The testManager associated with this\n * TestRun.\n * @param {Object} cx A context to be passed into the tests. This can be used\n * to set parameters for the test suite or individual test cases.\n */\nlib.TestManager.TestRun = function(testManager, cx) {\n /**\n * The associated lib.TestManager instance.\n */\n this.testManager = testManager;\n\n /**\n * Shortcut to the lib.TestManager's log.\n */\n this.log = testManager.log;\n\n /**\n * The test run context. It's entirely up to the test suite and test cases\n * how this is used. It is opaque to lib.TestManager.* classes.\n */\n this.cx = cx || {};\n\n /**\n * The list of test cases that encountered failures.\n */\n this.failures = [];\n\n /**\n * The list of test cases that passed.\n */\n this.passes = [];\n\n /**\n * The time the test run started, or null if it hasn't been started yet.\n */\n this.startDate = null;\n\n /**\n * The time in milliseconds that the test run took to complete, or null if\n * it hasn't completed yet.\n */\n this.duration = null;\n\n /**\n * The most recent result object, or null if the test run hasn't started\n * yet. In order to detect late failures, this is not cleared when the test\n * completes.\n */\n this.currentResult = null;\n\n /**\n * Number of maximum failures. The test run will stop when this number is\n * reached. If 0 or omitted, the entire set of selected tests is run, even\n * if some fail.\n */\n this.maxFailures = 0;\n\n /**\n * True if this test run ended early because of an unexpected condition.\n */\n this.panic = false;\n\n // List of pending test cases.\n this.testQueue_ = [];\n\n};\n\n/**\n * This value can be passed to select() to indicate that all tests should\n * be selected.\n */\nlib.TestManager.TestRun.prototype.ALL_TESTS = lib.f.createEnum('');\n\n/**\n * Add a single test to the test run.\n */\nlib.TestManager.TestRun.prototype.selectTest = function(test) {\n this.testQueue_.push(test);\n};\n\nlib.TestManager.TestRun.prototype.selectSuite = function(\n suiteClass, opt_pattern) {\n var pattern = opt_pattern || this.ALL_TESTS;\n var selectCount = 0;\n var testList = suiteClass.getTestList();\n\n for (var j = 0; j < testList.length; j++) {\n var test = testList[j];\n // Note that we're using \"!==\" rather than \"!=\" so that we're matching\n // the ALL_TESTS String object, rather than the contents of the string.\n if (pattern !== this.ALL_TESTS) {\n if (pattern instanceof RegExp) {\n if (!pattern.test(test.testName))\n continue;\n } else if (test.testName != pattern) {\n continue;\n }\n }\n\n this.selectTest(test);\n selectCount++;\n }\n\n return selectCount;\n};\n\n/**\n * Selects one or more tests to gather results for.\n *\n * Selecting the same test more than once is allowed.\n *\n * @param {string|RegExp} pattern Pattern used to select tests.\n * If TestRun.prototype.ALL_TESTS, all tests are selected.\n * If a string, only the test that exactly matches is selected.\n * If a RegExp, only tests matching the RegExp are added.\n *\n * @return {int} The number of additional tests that have been selected into\n * this TestRun.\n */\nlib.TestManager.TestRun.prototype.selectPattern = function(pattern) {\n var selectCount = 0;\n\n for (var i = 0; i < lib.TestManager.Suite.subclasses.length; i++) {\n selectCount += this.selectSuite(lib.TestManager.Suite.subclasses[i],\n pattern);\n }\n\n if (!selectCount) {\n this.log.warn('No tests matched selection criteria: ' + pattern);\n }\n\n return selectCount;\n};\n\n/**\n * Hooked up to window.onerror during a test run in order to catch exceptions\n * that would otherwise go uncaught.\n */\nlib.TestManager.TestRun.prototype.onUncaughtException_ = function(\n message, file, line) {\n\n if (message.indexOf('Uncaught lib.TestManager.Result.TestComplete') == 0 ||\n message.indexOf('status: passed') != -1) {\n // This is a result.pass() or result.fail() call from a callback. We're\n // already going to deal with it as part of the completeTest_() call\n // that raised it. We can safely squelch this error message.\n return true;\n }\n\n if (!this.currentResult)\n return;\n\n if (message == 'Uncaught ' + this.currentResult.expectedErrorMessage_) {\n // Test cases may need to raise an unhandled exception as part of the test.\n return;\n }\n\n var when = 'during';\n\n if (this.currentResult.status != this.currentResult.PENDING)\n when = 'after';\n\n this.log.error('Uncaught exception ' + when + ' test case: ' +\n this.currentResult.test.fullName);\n this.log.error(message + ', ' + file + ':' + line);\n\n this.currentResult.completeTest_(this.currentResult.FAILED, false);\n\n return false;\n};\n\n/**\n * Called to when this test run has completed.\n *\n * This method typically re-runs itself asynchronously, in order to let the\n * DOM stabilize and short-term timeouts to complete before declaring the\n * test run complete.\n *\n * @param {boolean} opt_skipTimeout If true, the timeout is skipped and the\n * test run is completed immediately. This should only be used from within\n * this function.\n */\nlib.TestManager.TestRun.prototype.onTestRunComplete_ = function(\n opt_skipTimeout) {\n if (!opt_skipTimeout) {\n // The final test may have left a lingering setTimeout(..., 0), or maybe\n // poked at the DOM in a way that will trigger a event to fire at the end\n // of this stack, so we give things a chance to settle down before our\n // final cleanup...\n setTimeout(this.onTestRunComplete_.bind(this), 0, true);\n return;\n }\n\n this.duration = (new Date()) - this.startDate;\n\n this.log.groupEnd();\n this.log.info(this.passes.length + ' passed, ' +\n this.failures.length + ' failed, ' +\n this.msToSeconds_(this.duration));\n\n this.summarize();\n\n window.onerror = null;\n\n this.testManager.onTestRunComplete(this);\n};\n\n/**\n * Called by the lib.TestManager.Result object when a test completes.\n *\n * @param {lib.TestManager.Result} result The result object which has just\n * completed.\n */\nlib.TestManager.TestRun.prototype.onResultComplete = function(result) {\n try {\n this.testManager.testPostamble(result, this.cx);\n result.suite.postamble(result, this.ctx);\n } catch (ex) {\n this.log.error('Unexpected exception in postamble: ' +\n (ex.stack ? ex.stack : ex));\n this.panic = true;\n }\n\n if (result.status != result.PASSED)\n this.log.error(result.status);\n else if (result.duration > 500)\n this.log.warn('Slow test took ' + this.msToSeconds_(result.duration));\n this.log.groupEnd();\n\n if (result.status == result.FAILED) {\n this.failures.push(result);\n this.currentSuite = null;\n } else if (result.status == result.PASSED) {\n this.passes.push(result);\n } else {\n this.log.error('Unknown result status: ' + result.test.fullName + ': ' +\n result.status);\n return this.panic = true;\n }\n\n this.runNextTest_();\n};\n\n/**\n * Called by the lib.TestManager.Result object when a test which has already\n * completed reports another completion.\n *\n * This is usually indicative of a buggy testcase. It is probably reporting a\n * result on exit and then again from an asynchronous callback.\n *\n * It may also be the case that the last act of the testcase causes a DOM change\n * which triggers some event to run after the test returns. If the event\n * handler reports a failure or raises an uncaught exception, the test will\n * fail even though it has already completed.\n *\n * In any case, re-completing a test ALWAYS moves it into the failure pile.\n *\n * @param {lib.TestManager.Result} result The result object which has just\n * completed.\n * @param {string} lateStatus The status that the test attempted to record this\n * time around.\n */\nlib.TestManager.TestRun.prototype.onResultReComplete = function(\n result, lateStatus) {\n this.log.error('Late complete for test: ' + result.test.fullName + ': ' +\n lateStatus);\n\n // Consider any late completion a failure, even if it's a double-pass, since\n // it's a misuse of the testing API.\n var index = this.passes.indexOf(result);\n if (index >= 0) {\n this.passes.splice(index, 1);\n this.failures.push(result);\n }\n};\n\n/**\n * Run the next test in the queue.\n */\nlib.TestManager.TestRun.prototype.runNextTest_ = function() {\n if (this.panic || !this.testQueue_.length)\n return this.onTestRunComplete_();\n\n if (this.maxFailures && this.failures.length >= this.maxFailures) {\n this.log.error('Maximum failure count reached, aborting test run.');\n return this.onTestRunComplete_();\n }\n\n // Peek at the top test first. We remove it later just before it's about\n // to run, so that we don't disturb the incomplete test count in the\n // event that we fail before running it.\n var test = this.testQueue_[0];\n var suite = this.currentResult ? this.currentResult.suite : null;\n\n try {\n if (!suite || !(suite instanceof test.suiteClass)) {\n if (suite)\n this.log.groupEnd();\n this.log.group(test.suiteClass.suiteName);\n suite = new test.suiteClass(this.testManager, this.cx);\n }\n } catch (ex) {\n // If test suite setup fails we're not even going to try to run the tests.\n this.log.error('Exception during setup: ' + (ex.stack ? ex.stack : ex));\n this.panic = true;\n this.onTestRunComplete_();\n return;\n }\n\n try {\n this.log.group(test.testName);\n\n this.currentResult = new lib.TestManager.Result(this, suite, test);\n this.testManager.testPreamble(this.currentResult, this.cx);\n suite.preamble(this.currentResult, this.cx);\n\n this.testQueue_.shift();\n } catch (ex) {\n this.log.error('Unexpected exception during test preamble: ' +\n (ex.stack ? ex.stack : ex));\n this.log.groupEnd();\n\n this.panic = true;\n this.onTestRunComplete_();\n return;\n }\n\n try {\n this.currentResult.run();\n } catch (ex) {\n // Result.run() should catch test exceptions and turn them into failures.\n // If we got here, it means there is trouble in the testing framework.\n this.log.error('Unexpected exception during test run: ' +\n (ex.stack ? ex.stack : ex));\n this.panic = true;\n }\n};\n\n/**\n * Run the selected list of tests.\n *\n * Some tests may need to run asynchronously, so you cannot assume the run is\n * complete when this function returns. Instead, pass in a function to be\n * called back when the run has completed.\n *\n * This function will log the results of the test run as they happen into the\n * log defined by the associated lib.TestManager. By default this is\n * console.log, which can be viewed in the JavaScript console of most browsers.\n *\n * The browser state is determined by the last test to run. We intentionally\n * don't do any cleanup so that you can inspect the state of a failed test, or\n * leave the browser ready for manual testing.\n *\n * Any failures in lib.TestManager.* code or test suite setup or test case\n * preamble will cause the test run to abort.\n */\nlib.TestManager.TestRun.prototype.run = function() {\n this.log.info('Running ' + this.testQueue_.length + ' test(s)');\n\n window.onerror = this.onUncaughtException_.bind(this);\n this.startDate = new Date();\n this.runNextTest_();\n};\n\n/**\n * Format milliseconds as fractional seconds.\n */\nlib.TestManager.TestRun.prototype.msToSeconds_ = function(ms) {\n var secs = (ms / 1000).toFixed(2);\n return secs + 's';\n};\n\n/**\n * Log the current result summary.\n */\nlib.TestManager.TestRun.prototype.summarize = function() {\n if (this.failures.length) {\n for (var i = 0; i < this.failures.length; i++) {\n this.log.error('FAILED: ' + this.failures[i].test.fullName);\n }\n }\n\n if (this.testQueue_.length) {\n this.log.warn('Test run incomplete: ' + this.testQueue_.length +\n ' test(s) were not run.');\n }\n};\n\n/**\n * Record of the result of a single test.\n *\n * These are constructed during a test run, you shouldn't have to make one\n * on your own.\n *\n * An instance of this class is passed in to each test function. It can be\n * used to add messages to the test log, to record a test pass/fail state, to\n * test assertions, or to create exception-proof wrappers for callback\n * functions.\n *\n * @param {lib.TestManager.TestRun} testRun The TestRun instance associated with\n * this result.\n * @param {lib.TestManager.Suit} suite The Suite containing the test we're\n * collecting this result for.\n * @param {lib.TestManager.Test} test The test we're collecting this result for.\n */\nlib.TestManager.Result = function(testRun, suite, test) {\n /**\n * The TestRun instance associated with this result.\n */\n this.testRun = testRun;\n\n /**\n * The Suite containing the test we're collecting this result for.\n */\n this.suite = suite;\n\n /**\n * The test we're collecting this result for.\n */\n this.test = test;\n\n /**\n * The time we started to collect this result, or null if we haven't started.\n */\n this.startDate = null;\n\n /**\n * The time in milliseconds that the test took to complete, or null if\n * it hasn't completed yet.\n */\n this.duration = null;\n\n /**\n * The current status of this test result.\n */\n this.status = this.PENDING;\n\n // An error message that the test case is expected to generate.\n this.expectedErrorMessage_ = null;\n};\n\n/**\n * Possible values for this.status.\n */\nlib.TestManager.Result.prototype.PENDING = 'pending';\nlib.TestManager.Result.prototype.FAILED = 'FAILED';\nlib.TestManager.Result.prototype.PASSED = 'passed';\n\n/**\n * Exception thrown when a test completes (pass or fail), to ensure no more of\n * the test is run.\n */\nlib.TestManager.Result.TestComplete = function(result) {\n this.result = result;\n};\n\nlib.TestManager.Result.TestComplete.prototype.toString = function() {\n return 'lib.TestManager.Result.TestComplete: ' + this.result.test.fullName +\n ', status: ' + this.result.status;\n}\n\n/**\n * Start the test associated with this result.\n */\nlib.TestManager.Result.prototype.run = function() {\n var self = this;\n\n this.startDate = new Date();\n this.test.run(this);\n\n if (this.status == this.PENDING && !this.timeout_) {\n this.println('Test did not return a value and did not request more time.');\n this.completeTest_(this.FAILED, false);\n }\n};\n\n/**\n * Unhandled error message this test expects to generate.\n *\n * This must be the exact string that would appear in the JavaScript console,\n * minus the 'Uncaught ' prefix.\n *\n * The test case does *not* automatically fail if the error message is not\n * encountered.\n */\nlib.TestManager.Result.prototype.expectErrorMessage = function(str) {\n this.expectedErrorMessage_ = str;\n};\n\n/**\n * Function called when a test times out.\n */\nlib.TestManager.Result.prototype.onTimeout_ = function() {\n this.timeout_ = null;\n\n if (this.status != this.PENDING)\n return;\n\n this.println('Test timed out.');\n this.completeTest_(this.FAILED, false);\n};\n\n/**\n * Indicate that a test case needs more time to complete.\n *\n * Before a test case returns it must report a pass/fail result, or request more\n * time to do so.\n *\n * If a test does not report pass/fail before the time expires it will\n * be reported as a timeout failure. Any late pass/fails will be noted in the\n * test log, but will not affect the final result of the test.\n *\n * Test cases may call requestTime more than once. If you have a few layers\n * of asynchronous API to go through, you should call this once per layer with\n * an estimate of how long each callback will take to complete.\n *\n * @param {int} ms Number of milliseconds requested.\n */\nlib.TestManager.Result.prototype.requestTime = function(ms) {\n if (this.timeout_)\n clearTimeout(this.timeout_);\n\n this.timeout_ = setTimeout(this.onTimeout_.bind(this), ms);\n};\n\n/**\n * Report the completion of a test.\n *\n * @param {string} status The status of the test case.\n * @param {boolean} opt_throw Optional boolean indicating whether or not\n * to throw the TestComplete exception.\n */\nlib.TestManager.Result.prototype.completeTest_ = function(status, opt_throw) {\n if (this.status == this.PENDING) {\n this.duration = (new Date()) - this.startDate;\n this.status = status;\n\n this.testRun.onResultComplete(this);\n } else {\n this.testRun.onResultReComplete(this, status);\n }\n\n if (arguments.length < 2 || opt_throw)\n throw new lib.TestManager.Result.TestComplete(this);\n};\n\n/**\n * Check that two arrays are equal.\n */\nlib.TestManager.Result.prototype.arrayEQ_ = function(actual, expected) {\n if (!actual || !expected)\n return (!actual && !expected);\n\n if (actual.length != expected.length)\n return false;\n\n for (var i = 0; i < actual.length; ++i)\n if (actual[i] != expected[i])\n return false;\n\n return true;\n};\n\n/**\n * Assert that an actual value is exactly equal to the expected value.\n *\n * This uses the JavaScript '===' operator in order to avoid type coercion.\n *\n * If the assertion fails, the test is marked as a failure and a TestCompleted\n * exception is thrown.\n *\n * @param {*} actual The actual measured value.\n * @param {*} expected The value expected.\n * @param {string} opt_name An optional name used to identify this\n * assertion in the test log. If omitted it will be the file:line\n * of the caller.\n */\nlib.TestManager.Result.prototype.assertEQ = function(\n actual, expected, opt_name) {\n // Utility function to pretty up the log.\n function format(value) {\n if (typeof value == 'number')\n return value;\n\n var str = String(value);\n var ary = str.split('\\n').map(function (e) { return JSON.stringify(e) });\n if (ary.length > 1) {\n // If the string has newlines, start it off on its own line so that\n // it's easier to compare against another string with newlines.\n return '\\n' + ary.join('\\n');\n } else {\n return ary.join('\\n');\n }\n }\n\n if (actual === expected)\n return;\n\n // Deal with common object types since JavaScript can't.\n if (expected instanceof Array)\n if (this.arrayEQ_(actual, expected))\n return;\n\n var name = opt_name ? '[' + opt_name + ']' : '';\n\n this.fail('assertEQ' + name + ': ' + this.getCallerLocation_(1) + ': ' +\n format(actual) + ' !== ' + format(expected));\n};\n\n/**\n * Assert that a value is true.\n *\n * This uses the JavaScript '===' operator in order to avoid type coercion.\n * The must be the boolean value `true`, not just some \"truish\" value.\n *\n * If the assertion fails, the test is marked as a failure and a TestCompleted\n * exception is thrown.\n *\n * @param {boolean} actual The actual measured value.\n * @param {string} opt_name An optional name used to identify this\n * assertion in the test log. If omitted it will be the file:line\n * of the caller.\n */\nlib.TestManager.Result.prototype.assert = function(actual, opt_name) {\n if (actual === true)\n return;\n\n var name = opt_name ? '[' + opt_name + ']' : '';\n\n this.fail('assert' + name + ': ' + this.getCallerLocation_(1) + ': ' +\n String(actual));\n};\n\n/**\n * Return the filename:line of a calling stack frame.\n *\n * This uses a dirty hack. It throws an exception, catches it, and examines\n * the stack property of the caught exception.\n *\n * @param {int} frameIndex The stack frame to return. 0 is the frame that\n * called this method, 1 is its caller, and so on.\n * @return {string} A string of the format \"filename:linenumber\".\n */\nlib.TestManager.Result.prototype.getCallerLocation_ = function(frameIndex) {\n try {\n throw new Error();\n } catch (ex) {\n var frame = ex.stack.split('\\n')[frameIndex + 2];\n var ary = frame.match(/([^/]+:\\d+):\\d+\\)?$/);\n return ary ? ary[1] : '???';\n }\n};\n\n/**\n * Write a message to the result log.\n */\nlib.TestManager.Result.prototype.println = function(message) {\n this.testRun.log.info(message);\n};\n\n/**\n * Mark a failed test and exit out of the rest of the test.\n *\n * This will throw a TestCompleted exception, causing the current test to stop.\n *\n * @param {string} opt_message Optional message to add to the log.\n */\nlib.TestManager.Result.prototype.fail = function(opt_message) {\n if (arguments.length)\n this.println(opt_message);\n\n this.completeTest_(this.FAILED, true);\n};\n\n/**\n * Mark a passed test and exit out of the rest of the test.\n *\n * This will throw a TestCompleted exception, causing the current test to stop.\n */\nlib.TestManager.Result.prototype.pass = function() {\n this.completeTest_(this.PASSED, true);\n};\n// SOURCE FILE: libdot/js/lib_utf8.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n// TODO(davidben): When the string encoding API is implemented,\n// replace this with the native in-browser implementation.\n//\n// https://wiki.whatwg.org/wiki/StringEncoding\n// https://encoding.spec.whatwg.org/\n\n/**\n * A stateful UTF-8 decoder.\n */\nlib.UTF8Decoder = function() {\n // The number of bytes left in the current sequence.\n this.bytesLeft = 0;\n // The in-progress code point being decoded, if bytesLeft > 0.\n this.codePoint = 0;\n // The lower bound on the final code point, if bytesLeft > 0.\n this.lowerBound = 0;\n};\n\n/**\n * Decodes a some UTF-8 data, taking into account state from previous\n * data streamed through the encoder.\n *\n * @param {String} str data to decode, represented as a JavaScript\n * String with each code unit representing a byte between 0x00 to\n * 0xFF.\n * @return {String} The data decoded into a JavaScript UTF-16 string.\n */\nlib.UTF8Decoder.prototype.decode = function(str) {\n var ret = '';\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (this.bytesLeft == 0) {\n if (c <= 0x7F) {\n ret += str.charAt(i);\n } else if (0xC0 <= c && c <= 0xDF) {\n this.codePoint = c - 0xC0;\n this.bytesLeft = 1;\n this.lowerBound = 0x80;\n } else if (0xE0 <= c && c <= 0xEF) {\n this.codePoint = c - 0xE0;\n this.bytesLeft = 2;\n this.lowerBound = 0x800;\n } else if (0xF0 <= c && c <= 0xF7) {\n this.codePoint = c - 0xF0;\n this.bytesLeft = 3;\n this.lowerBound = 0x10000;\n } else if (0xF8 <= c && c <= 0xFB) {\n this.codePoint = c - 0xF8;\n this.bytesLeft = 4;\n this.lowerBound = 0x200000;\n } else if (0xFC <= c && c <= 0xFD) {\n this.codePoint = c - 0xFC;\n this.bytesLeft = 5;\n this.lowerBound = 0x4000000;\n } else {\n ret += '\\ufffd';\n }\n } else {\n if (0x80 <= c && c <= 0xBF) {\n this.bytesLeft--;\n this.codePoint = (this.codePoint << 6) + (c - 0x80);\n if (this.bytesLeft == 0) {\n // Got a full sequence. Check if it's within bounds and\n // filter out surrogate pairs.\n var codePoint = this.codePoint;\n if (codePoint < this.lowerBound\n || (0xD800 <= codePoint && codePoint <= 0xDFFF)\n || codePoint > 0x10FFFF) {\n ret += '\\ufffd';\n } else {\n // Encode as UTF-16 in the output.\n if (codePoint < 0x10000) {\n ret += String.fromCharCode(codePoint);\n } else {\n // Surrogate pair.\n codePoint -= 0x10000;\n ret += String.fromCharCode(\n 0xD800 + ((codePoint >>> 10) & 0x3FF),\n 0xDC00 + (codePoint & 0x3FF));\n }\n }\n }\n } else {\n // Too few bytes in multi-byte sequence. Rewind stream so we\n // don't lose the next byte.\n ret += '\\ufffd';\n this.bytesLeft = 0;\n i--;\n }\n }\n }\n return ret;\n};\n\n/**\n * Decodes UTF-8 data. This is a convenience function for when all the\n * data is already known.\n *\n * @param {String} str data to decode, represented as a JavaScript\n * String with each code unit representing a byte between 0x00 to\n * 0xFF.\n * @return {String} The data decoded into a JavaScript UTF-16 string.\n */\nlib.decodeUTF8 = function(utf8) {\n return (new lib.UTF8Decoder()).decode(utf8);\n};\n\n/**\n * Encodes a UTF-16 string into UTF-8.\n *\n * TODO(davidben): Do we need a stateful version of this that can\n * handle a surrogate pair split in two calls? What happens if a\n * keypress event would have contained a character outside the BMP?\n *\n * @param {String} str The string to encode.\n * @return {String} The string encoded as UTF-8, as a JavaScript\n * string with bytes represented as code units from 0x00 to 0xFF.\n */\nlib.encodeUTF8 = function(str) {\n var ret = '';\n for (var i = 0; i < str.length; i++) {\n // Get a unicode code point out of str.\n var c = str.charCodeAt(i);\n if (0xDC00 <= c && c <= 0xDFFF) {\n c = 0xFFFD;\n } else if (0xD800 <= c && c <= 0xDBFF) {\n if (i+1 < str.length) {\n var d = str.charCodeAt(i+1);\n if (0xDC00 <= d && d <= 0xDFFF) {\n // Swallow a surrogate pair.\n c = 0x10000 + ((c & 0x3FF) << 10) + (d & 0x3FF);\n i++;\n } else {\n c = 0xFFFD;\n }\n } else {\n c = 0xFFFD;\n }\n }\n\n // Encode c in UTF-8.\n var bytesLeft;\n if (c <= 0x7F) {\n ret += str.charAt(i);\n continue;\n } else if (c <= 0x7FF) {\n ret += String.fromCharCode(0xC0 | (c >>> 6));\n bytesLeft = 1;\n } else if (c <= 0xFFFF) {\n ret += String.fromCharCode(0xE0 | (c >>> 12));\n bytesLeft = 2;\n } else /* if (c <= 0x10FFFF) */ {\n ret += String.fromCharCode(0xF0 | (c >>> 18));\n bytesLeft = 3;\n }\n\n while (bytesLeft > 0) {\n bytesLeft--;\n ret += String.fromCharCode(0x80 | ((c >>> (6 * bytesLeft)) & 0x3F));\n }\n }\n return ret;\n};\n// SOURCE FILE: libdot/third_party/wcwidth/lib_wc.js\n// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.\n// Use of lib.wc source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * This JavaScript library is ported from the wcwidth.js module of node.js.\n * The original implementation can be found at:\n * https://npmjs.org/package/wcwidth.js\n */\n\n/**\n * JavaScript porting of Markus Kuhn's wcwidth() implementation\n *\n * The following explanation comes from the original C implementation:\n *\n * This is an implementation of wcwidth() and wcswidth() (defined in\n * IEEE Std 1002.1-2001) for Unicode.\n *\n * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html\n * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html\n *\n * In fixed-width output devices, Latin characters all occupy a single\n * \"cell\" position of equal width, whereas ideographic CJK characters\n * occupy two such cells. Interoperability between terminal-line\n * applications and (teletype-style) character terminals using the\n * UTF-8 encoding requires agreement on which character should advance\n * the cursor by how many cell positions. No established formal\n * standards exist at present on which Unicode character shall occupy\n * how many cell positions on character terminals. These routines are\n * a first attempt of defining such behavior based on simple rules\n * applied to data provided by the Unicode Consortium.\n *\n * For some graphical characters, the Unicode standard explicitly\n * defines a character-cell width via the definition of the East Asian\n * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.\n * In all these cases, there is no ambiguity about which width a\n * terminal shall use. For characters in the East Asian Ambiguous (A)\n * class, the width choice depends purely on a preference of backward\n * compatibility with either historic CJK or Western practice.\n * Choosing single-width for these characters is easy to justify as\n * the appropriate long-term solution, as the CJK practice of\n * displaying these characters as double-width comes from historic\n * implementation simplicity (8-bit encoded characters were displayed\n * single-width and 16-bit ones double-width, even for Greek,\n * Cyrillic, etc.) and not any typographic considerations.\n *\n * Much less clear is the choice of width for the Not East Asian\n * (Neutral) class. Existing practice does not dictate a width for any\n * of these characters. It would nevertheless make sense\n * typographically to allocate two character cells to characters such\n * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be\n * represented adequately with a single-width glyph. The following\n * routines at present merely assign a single-cell width to all\n * neutral characters, in the interest of simplicity. This is not\n * entirely satisfactory and should be reconsidered before\n * establishing a formal standard in lib.wc area. At the moment, the\n * decision which Not East Asian (Neutral) characters should be\n * represented by double-width glyphs cannot yet be answered by\n * applying a simple rule from the Unicode database content. Setting\n * up a proper standard for the behavior of UTF-8 character terminals\n * will require a careful analysis not only of each Unicode character,\n * but also of each presentation form, something the author of these\n * routines has avoided to do so far.\n *\n * http://www.unicode.org/unicode/reports/tr11/\n *\n * Markus Kuhn -- 2007-05-26 (Unicode 5.0)\n *\n * Permission to use, copy, modify, and distribute lib.wc software\n * for any purpose and without fee is hereby granted. The author\n * disclaims all warranties with regard to lib.wc software.\n *\n * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c\n */\n\n/**\n * The following function defines the column width of an ISO 10646 character\n * as follows:\n *\n * - The null character (U+0000) has a column width of 0.\n * - Other C0/C1 control characters and DEL will lead to a return value of -1.\n * - Non-spacing and enclosing combining characters (general category code Mn\n * or Me in the Unicode database) have a column width of 0.\n * - SOFT HYPHEN (U+00AD) has a column width of 1.\n * - Other format characters (general category code Cf in the Unicode database)\n * and ZERO WIDTH SPACE (U+200B) have a column width of 0.\n * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) have a\n * column width of 0.\n * - Spacing characters in the East Asian Wide (W) or East Asian Full-width (F)\n * category as defined in Unicode Technical Report #11 have a column width of\n * 2.\n * - East Asian Ambiguous characters are taken into account if\n * regardCjkAmbiguous flag is enabled. They have a column width of 2.\n * - All remaining characters (including all printable ISO 8859-1 and WGL4\n * characters, Unicode control characters, etc.) have a column width of 1.\n *\n * This implementation assumes that characters are encoded in ISO 10646.\n */\n\nlib.wc = {};\n\n// Width of a nul character.\nlib.wc.nulWidth = 0;\n\n// Width of a control character.\nlib.wc.controlWidth = 0;\n\n// Flag whether to consider East Asian Ambiguous characters.\nlib.wc.regardCjkAmbiguous = false;\n\n// Width of an East Asian Ambiguous character.\nlib.wc.cjkAmbiguousWidth = 2;\n\n// Sorted list of non-overlapping intervals of non-spacing characters\n// generated by \"uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c\"\nlib.wc.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 [ 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// Sorted list of non-overlapping intervals of East Asian Ambiguous characters\n// generated by \"uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c\"\nlib.wc.ambiguous = [\n [ 0x00A1, 0x00A1 ], [ 0x00A4, 0x00A4 ], [ 0x00A7, 0x00A8 ],\n [ 0x00AA, 0x00AA ], [ 0x00AE, 0x00AE ], [ 0x00B0, 0x00B4 ],\n [ 0x00B6, 0x00BA ], [ 0x00BC, 0x00BF ], [ 0x00C6, 0x00C6 ],\n [ 0x00D0, 0x00D0 ], [ 0x00D7, 0x00D8 ], [ 0x00DE, 0x00E1 ],\n [ 0x00E6, 0x00E6 ], [ 0x00E8, 0x00EA ], [ 0x00EC, 0x00ED ],\n [ 0x00F0, 0x00F0 ], [ 0x00F2, 0x00F3 ], [ 0x00F7, 0x00FA ],\n [ 0x00FC, 0x00FC ], [ 0x00FE, 0x00FE ], [ 0x0101, 0x0101 ],\n [ 0x0111, 0x0111 ], [ 0x0113, 0x0113 ], [ 0x011B, 0x011B ],\n [ 0x0126, 0x0127 ], [ 0x012B, 0x012B ], [ 0x0131, 0x0133 ],\n [ 0x0138, 0x0138 ], [ 0x013F, 0x0142 ], [ 0x0144, 0x0144 ],\n [ 0x0148, 0x014B ], [ 0x014D, 0x014D ], [ 0x0152, 0x0153 ],\n [ 0x0166, 0x0167 ], [ 0x016B, 0x016B ], [ 0x01CE, 0x01CE ],\n [ 0x01D0, 0x01D0 ], [ 0x01D2, 0x01D2 ], [ 0x01D4, 0x01D4 ],\n [ 0x01D6, 0x01D6 ], [ 0x01D8, 0x01D8 ], [ 0x01DA, 0x01DA ],\n [ 0x01DC, 0x01DC ], [ 0x0251, 0x0251 ], [ 0x0261, 0x0261 ],\n [ 0x02C4, 0x02C4 ], [ 0x02C7, 0x02C7 ], [ 0x02C9, 0x02CB ],\n [ 0x02CD, 0x02CD ], [ 0x02D0, 0x02D0 ], [ 0x02D8, 0x02DB ],\n [ 0x02DD, 0x02DD ], [ 0x02DF, 0x02DF ], [ 0x0391, 0x03A1 ],\n [ 0x03A3, 0x03A9 ], [ 0x03B1, 0x03C1 ], [ 0x03C3, 0x03C9 ],\n [ 0x0401, 0x0401 ], [ 0x0410, 0x044F ], [ 0x0451, 0x0451 ],\n [ 0x2010, 0x2010 ], [ 0x2013, 0x2016 ], [ 0x2018, 0x2019 ],\n [ 0x201C, 0x201D ], [ 0x2020, 0x2022 ], [ 0x2024, 0x2027 ],\n [ 0x2030, 0x2030 ], [ 0x2032, 0x2033 ], [ 0x2035, 0x2035 ],\n [ 0x203B, 0x203B ], [ 0x203E, 0x203E ], [ 0x2074, 0x2074 ],\n [ 0x207F, 0x207F ], [ 0x2081, 0x2084 ], [ 0x20AC, 0x20AC ],\n [ 0x2103, 0x2103 ], [ 0x2105, 0x2105 ], [ 0x2109, 0x2109 ],\n [ 0x2113, 0x2113 ], [ 0x2116, 0x2116 ], [ 0x2121, 0x2122 ],\n [ 0x2126, 0x2126 ], [ 0x212B, 0x212B ], [ 0x2153, 0x2154 ],\n [ 0x215B, 0x215E ], [ 0x2160, 0x216B ], [ 0x2170, 0x2179 ],\n [ 0x2190, 0x2199 ], [ 0x21B8, 0x21B9 ], [ 0x21D2, 0x21D2 ],\n [ 0x21D4, 0x21D4 ], [ 0x21E7, 0x21E7 ], [ 0x2200, 0x2200 ],\n [ 0x2202, 0x2203 ], [ 0x2207, 0x2208 ], [ 0x220B, 0x220B ],\n [ 0x220F, 0x220F ], [ 0x2211, 0x2211 ], [ 0x2215, 0x2215 ],\n [ 0x221A, 0x221A ], [ 0x221D, 0x2220 ], [ 0x2223, 0x2223 ],\n [ 0x2225, 0x2225 ], [ 0x2227, 0x222C ], [ 0x222E, 0x222E ],\n [ 0x2234, 0x2237 ], [ 0x223C, 0x223D ], [ 0x2248, 0x2248 ],\n [ 0x224C, 0x224C ], [ 0x2252, 0x2252 ], [ 0x2260, 0x2261 ],\n [ 0x2264, 0x2267 ], [ 0x226A, 0x226B ], [ 0x226E, 0x226F ],\n [ 0x2282, 0x2283 ], [ 0x2286, 0x2287 ], [ 0x2295, 0x2295 ],\n [ 0x2299, 0x2299 ], [ 0x22A5, 0x22A5 ], [ 0x22BF, 0x22BF ],\n [ 0x2312, 0x2312 ], [ 0x2460, 0x24E9 ], [ 0x24EB, 0x254B ],\n [ 0x2550, 0x2573 ], [ 0x2580, 0x258F ], [ 0x2592, 0x2595 ],\n [ 0x25A0, 0x25A1 ], [ 0x25A3, 0x25A9 ], [ 0x25B2, 0x25B3 ],\n [ 0x25B6, 0x25B7 ], [ 0x25BC, 0x25BD ], [ 0x25C0, 0x25C1 ],\n [ 0x25C6, 0x25C8 ], [ 0x25CB, 0x25CB ], [ 0x25CE, 0x25D1 ],\n [ 0x25E2, 0x25E5 ], [ 0x25EF, 0x25EF ], [ 0x2605, 0x2606 ],\n [ 0x2609, 0x2609 ], [ 0x260E, 0x260F ], [ 0x2614, 0x2615 ],\n [ 0x261C, 0x261C ], [ 0x261E, 0x261E ], [ 0x2640, 0x2640 ],\n [ 0x2642, 0x2642 ], [ 0x2660, 0x2661 ], [ 0x2663, 0x2665 ],\n [ 0x2667, 0x266A ], [ 0x266C, 0x266D ], [ 0x266F, 0x266F ],\n [ 0x273D, 0x273D ], [ 0x2776, 0x277F ], [ 0xE000, 0xF8FF ],\n [ 0xFFFD, 0xFFFD ], [ 0xF0000, 0xFFFFD ], [ 0x100000, 0x10FFFD ]\n];\n\n/**\n * Binary search to check if the given unicode character is a space character.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {boolean} True if the given character is a space character; false\n * otherwise.\n */\nlib.wc.isSpace = function(ucs) {\n // Auxiliary function for binary search in interval table.\n var min = 0, max = lib.wc.combining.length - 1;\n var mid;\n\n if (ucs < lib.wc.combining[0][0] || ucs > lib.wc.combining[max][1])\n return false;\n while (max >= min) {\n mid = Math.floor((min + max) / 2);\n if (ucs > lib.wc.combining[mid][1]) {\n min = mid + 1;\n } else if (ucs < lib.wc.combining[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * Auxiliary function for checking if the given unicode character is a East\n * Asian Ambiguous character.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {boolean} True if the given character is a East Asian Ambiguous\n * character.\n */\nlib.wc.isCjkAmbiguous = function(ucs) {\n var min = 0, max = lib.wc.ambiguous.length - 1;\n var mid;\n\n if (ucs < lib.wc.ambiguous[0][0] || ucs > lib.wc.ambiguous[max][1])\n return false;\n while (max >= min) {\n mid = Math.floor((min + max) / 2);\n if (ucs > lib.wc.ambiguous[mid][1]) {\n min = mid + 1;\n } else if (ucs < lib.wc.ambiguous[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * Determine the column width of the given character.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {integer} The column width of the given character.\n */\nlib.wc.charWidth = function(ucs) {\n if (lib.wc.regardCjkAmbiguous) {\n return lib.wc.charWidthRegardAmbiguous(ucs);\n } else {\n return lib.wc.charWidthDisregardAmbiguous(ucs);\n }\n};\n\n/**\n * Determine the column width of the given character without considering East\n * Asian Ambiguous characters.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {integer} The column width of the given character.\n */\nlib.wc.charWidthDisregardAmbiguous = function(ucs) {\n // Test for 8-bit control characters.\n if (ucs === 0)\n return lib.wc.nulWidth;\n if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))\n return lib.wc.controlWidth;\n\n // Optimize for ASCII characters.\n if (ucs < 0x7f)\n return 1;\n\n // Binary search in table of non-spacing characters.\n if (lib.wc.isSpace(ucs))\n return 0;\n\n // If we arrive here, ucs is not a combining or C0/C1 control character.\n return 1 +\n (ucs >= 0x1100 &&\n (ucs <= 0x115f || // Hangul Jamo init. consonants\n ucs == 0x2329 || ucs == 0x232a ||\n (ucs >= 0x2e80 && ucs <= 0xa4cf &&\n ucs != 0x303f) || // CJK ... Yi\n (ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables\n (ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compatibility Ideographs\n (ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms\n (ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compatibility Forms\n (ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms\n (ucs >= 0xffe0 && ucs <= 0xffe6) ||\n (ucs >= 0x20000 && ucs <= 0x2fffd) ||\n (ucs >= 0x30000 && ucs <= 0x3fffd)));\n // TODO: emoji characters usually require space for wide characters although\n // East Asian width spec says nothing. Should we add special cases for them?\n};\n\n/**\n * Determine the column width of the given character considering East Asian\n * Ambiguous characters.\n *\n * @param {integer} ucs A unicode character code.\n *\n * @return {integer} The column width of the given character.\n */\nlib.wc.charWidthRegardAmbiguous = function(ucs) {\n if (lib.wc.isCjkAmbiguous(ucs))\n return lib.wc.cjkAmbiguousWidth;\n\n return lib.wc.charWidthDisregardAmbiguous(ucs);\n};\n\n/**\n * Determine the column width of the given string.\n *\n * @param {string} str A string.\n *\n * @return {integer} The column width of the given string.\n */\nlib.wc.strWidth = function(str) {\n var width, rv = 0;\n\n for (var i = 0; i < str.length;) {\n var codePoint = str.codePointAt(i);\n width = lib.wc.charWidth(codePoint);\n if (width < 0)\n return -1;\n rv += width;\n i += (codePoint <= 0xffff) ? 1 : 2;\n }\n\n return rv;\n};\n\n/**\n * Get the substring at the given column offset of the given column width.\n *\n * @param {string} str The string to get substring from.\n * @param {integer} start The starting column offset to get substring.\n * @param {integer} opt_width The column width of the substring.\n *\n * @return {string} The substring.\n */\nlib.wc.substr = function(str, start, opt_width) {\n var startIndex, endIndex, width;\n\n for (startIndex = 0, width = 0; startIndex < str.length; startIndex++) {\n width += lib.wc.charWidth(str.charCodeAt(startIndex));\n if (width > start)\n break;\n }\n\n if (opt_width != undefined) {\n for (endIndex = startIndex, width = 0;\n endIndex < str.length && width <= opt_width;\n width += lib.wc.charWidth(str.charCodeAt(endIndex)), endIndex++);\n if (width > opt_width)\n endIndex--;\n return str.substring(startIndex, endIndex);\n }\n\n return str.substr(startIndex);\n};\n\n/**\n * Get substring at the given start and end column offset.\n *\n * @param {string} str The string to get substring from.\n * @param {integer} start The starting column offset.\n * @param {integer} end The ending column offset.\n *\n * @return {string} The substring.\n */\nlib.wc.substring = function(str, start, end) {\n return lib.wc.substr(str, start, end - start);\n};\nlib.resource.add('libdot/changelog/version', 'text/plain',\n'1.16' +\n''\n);\n\nlib.resource.add('libdot/changelog/date', 'text/plain',\n'2017-08-16' +\n''\n);\n\n// SOURCE FILE: hterm/js/hterm.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.Storage');\n\n/**\n * @fileoverview Declares the hterm.* namespace and some basic shared utilities\n * that are too small to deserve dedicated files.\n */\nvar hterm = {};\n\n/**\n * The type of window hosting hterm.\n *\n * This is set as part of hterm.init(). The value is invalid until\n * initialization completes.\n */\nhterm.windowType = null;\n\n/**\n * Warning message to display in the terminal when browser zoom is enabled.\n *\n * You can replace it with your own localized message.\n */\nhterm.zoomWarningMessage = 'ZOOM != 100%';\n\n/**\n * Brief overlay message displayed when text is copied to the clipboard.\n *\n * By default it is the unicode BLACK SCISSORS character, but you can\n * replace it with your own localized message.\n *\n * This is only displayed when the 'enable-clipboard-notice' preference\n * is enabled.\n */\nhterm.notifyCopyMessage = '\\u2702';\n\n\n/**\n * Text shown in a desktop notification for the terminal\n * bell. \\u226a is a unicode EIGHTH NOTE, %(title) will\n * be replaced by the terminal title.\n */\nhterm.desktopNotificationTitle = '\\u266A %(title) \\u266A';\n\n/**\n * List of known hterm test suites.\n *\n * A test harness should ensure that they all exist before running.\n */\nhterm.testDeps = ['hterm.ScrollPort.Tests', 'hterm.Screen.Tests',\n 'hterm.Terminal.Tests', 'hterm.VT.Tests',\n 'hterm.VT.CannedTests'];\n\n/**\n * The hterm init function, registered with lib.registerInit().\n *\n * This is called during lib.init().\n *\n * @param {function} onInit The function lib.init() wants us to invoke when\n * initialization is complete.\n */\nlib.registerInit('hterm', function(onInit) {\n function onWindow(window) {\n hterm.windowType = window.type;\n setTimeout(onInit, 0);\n }\n\n function onTab(tab) {\n if (tab && window.chrome) {\n chrome.windows.get(tab.windowId, null, onWindow);\n } else {\n // TODO(rginda): This is where we end up for a v1 app's background page.\n // Maybe windowType = 'none' would be more appropriate, or something.\n hterm.windowType = 'normal';\n setTimeout(onInit, 0);\n }\n }\n\n if (!hterm.defaultStorage) {\n if (window.chrome && chrome.storage && chrome.storage.sync) {\n hterm.defaultStorage = new lib.Storage.Chrome(chrome.storage.sync);\n } else {\n hterm.defaultStorage = new lib.Storage.Local();\n }\n }\n\n // The chrome.tabs API is not supported in packaged apps, and detecting if\n // you're a packaged app is a little awkward.\n var isPackagedApp = false;\n if (window.chrome && chrome.runtime && chrome.runtime.getManifest) {\n var manifest = chrome.runtime.getManifest();\n isPackagedApp = manifest.app && manifest.app.background;\n }\n\n if (isPackagedApp) {\n // Packaged apps are never displayed in browser tabs.\n setTimeout(onWindow.bind(null, {type: 'popup'}), 0);\n } else {\n if (window.chrome && chrome.tabs) {\n // The getCurrent method gets the tab that is \"currently running\", not the\n // topmost or focused tab.\n chrome.tabs.getCurrent(onTab);\n } else {\n setTimeout(onWindow.bind(null, {type: 'normal'}), 0);\n }\n }\n});\n\n/**\n * Return decimal { width, height } for a given dom node.\n */\nhterm.getClientSize = function(dom) {\n return dom.getBoundingClientRect();\n};\n\n/**\n * Return decimal width for a given dom node.\n */\nhterm.getClientWidth = function(dom) {\n return dom.getBoundingClientRect().width;\n};\n\n/**\n * Return decimal height for a given dom node.\n */\nhterm.getClientHeight = function(dom) {\n return dom.getBoundingClientRect().height;\n};\n\n/**\n * Copy the current selection to the system clipboard.\n *\n * @param {HTMLDocument} The document with the selection to copy.\n */\nhterm.copySelectionToClipboard = function(document) {\n try {\n document.execCommand('copy');\n } catch (firefoxException) {\n // Ignore this. FF throws an exception if there was an error, even though\n // the spec says just return false.\n }\n};\n\n/**\n * Paste the system clipboard into the element with focus.\n *\n * Note: In Chrome/Firefox app/extension environments, you'll need the\n * \"clipboardRead\" permission. In other environments, this might always\n * fail as the browser frequently blocks access for security reasons.\n *\n * @param {HTMLDocument} The document to paste into.\n * @return {boolean} True if the paste succeeded.\n */\nhterm.pasteFromClipboard = function(document) {\n try {\n return document.execCommand('paste');\n } catch (firefoxException) {\n // Ignore this. FF 40 and older would incorrectly throw an exception if\n // there was an error instead of returning false.\n return false;\n }\n};\n\n/**\n * Create a new notification.\n *\n * @param {Object} params Various parameters for the notification.\n * @param {string} params.title The title (defaults to the window's title).\n * @param {string} params.body The message body (main text).\n */\nhterm.notify = function(params) {\n var def = (curr, fallback) => curr !== undefined ? curr : fallback;\n if (params === undefined || params === null)\n params = {};\n\n // Merge the user's choices with the default settings. We don't take it\n // directly in case it was stuffed with excess junk.\n var options = {\n 'body': params.body,\n 'icon': def(params.icon, lib.resource.getDataUrl('hterm/images/icon-96')),\n }\n\n var title = def(params.title, window.document.title);\n if (!title)\n title = 'hterm';\n title = lib.f.replaceVars(hterm.desktopNotificationTitle, {'title': title});\n\n var n = new Notification(title, options);\n n.onclick = function() {\n window.focus();\n this.close();\n };\n return n;\n};\n\n/**\n * Constructor for a hterm.Size record.\n *\n * Instances of this class have public read/write members for width and height.\n *\n * @param {integer} width The width of this record.\n * @param {integer} height The height of this record.\n */\nhterm.Size = function(width, height) {\n this.width = width;\n this.height = height;\n};\n\n/**\n * Adjust the width and height of this record.\n *\n * @param {integer} width The new width of this record.\n * @param {integer} height The new height of this record.\n */\nhterm.Size.prototype.resize = function(width, height) {\n this.width = width;\n this.height = height;\n};\n\n/**\n * Return a copy of this record.\n *\n * @return {hterm.Size} A new hterm.Size instance with the same width and\n * height.\n */\nhterm.Size.prototype.clone = function() {\n return new hterm.Size(this.width, this.height);\n};\n\n/**\n * Set the height and width of this instance based on another hterm.Size.\n *\n * @param {hterm.Size} that The object to copy from.\n */\nhterm.Size.prototype.setTo = function(that) {\n this.width = that.width;\n this.height = that.height;\n};\n\n/**\n * Test if another hterm.Size instance is equal to this one.\n *\n * @param {hterm.Size} that The other hterm.Size instance.\n * @return {boolean} True if both instances have the same width/height, false\n * otherwise.\n */\nhterm.Size.prototype.equals = function(that) {\n return this.width == that.width && this.height == that.height;\n};\n\n/**\n * Return a string representation of this instance.\n *\n * @return {string} A string that identifies the width and height of this\n * instance.\n */\nhterm.Size.prototype.toString = function() {\n return '[hterm.Size: ' + this.width + ', ' + this.height + ']';\n};\n\n/**\n * Constructor for a hterm.RowCol record.\n *\n * Instances of this class have public read/write members for row and column.\n *\n * This class includes an 'overflow' bit which is use to indicate that an\n * attempt has been made to move the cursor column passed the end of the\n * screen. When this happens we leave the cursor column set to the last column\n * of the screen but set the overflow bit. In this state cursor movement\n * happens normally, but any attempt to print new characters causes a cr/lf\n * first.\n *\n * @param {integer} row The row of this record.\n * @param {integer} column The column of this record.\n * @param {boolean} opt_overflow Optional boolean indicating that the RowCol\n * has overflowed.\n */\nhterm.RowCol = function(row, column, opt_overflow) {\n this.row = row;\n this.column = column;\n this.overflow = !!opt_overflow;\n};\n\n/**\n * Adjust the row and column of this record.\n *\n * @param {integer} row The new row of this record.\n * @param {integer} column The new column of this record.\n * @param {boolean} opt_overflow Optional boolean indicating that the RowCol\n * has overflowed.\n */\nhterm.RowCol.prototype.move = function(row, column, opt_overflow) {\n this.row = row;\n this.column = column;\n this.overflow = !!opt_overflow;\n};\n\n/**\n * Return a copy of this record.\n *\n * @return {hterm.RowCol} A new hterm.RowCol instance with the same row and\n * column.\n */\nhterm.RowCol.prototype.clone = function() {\n return new hterm.RowCol(this.row, this.column, this.overflow);\n};\n\n/**\n * Set the row and column of this instance based on another hterm.RowCol.\n *\n * @param {hterm.RowCol} that The object to copy from.\n */\nhterm.RowCol.prototype.setTo = function(that) {\n this.row = that.row;\n this.column = that.column;\n this.overflow = that.overflow;\n};\n\n/**\n * Test if another hterm.RowCol instance is equal to this one.\n *\n * @param {hterm.RowCol} that The other hterm.RowCol instance.\n * @return {boolean} True if both instances have the same row/column, false\n * otherwise.\n */\nhterm.RowCol.prototype.equals = function(that) {\n return (this.row == that.row && this.column == that.column &&\n this.overflow == that.overflow);\n};\n\n/**\n * Return a string representation of this instance.\n *\n * @return {string} A string that identifies the row and column of this\n * instance.\n */\nhterm.RowCol.prototype.toString = function() {\n return ('[hterm.RowCol: ' + this.row + ', ' + this.column + ', ' +\n this.overflow + ']');\n};\n// SOURCE FILE: hterm/js/hterm_frame.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f');\n\n/**\n * First draft of the interface between the terminal and a third party dialog.\n *\n * This is rough. It's just the terminal->dialog layer. To complete things\n * we'll also need a command->terminal layer. That will have to facilitate\n * command->terminal->dialog or direct command->dialog communication.\n *\n * I imagine this class will change significantly when that happens.\n */\n\n/**\n * Construct a new frame for the given terminal.\n *\n * @param terminal {hterm.Terminal} The parent terminal object.\n * @param url {String} The url to load in the frame.\n * @param opt_options {Object} Optional options for the frame. Not implemented.\n */\nhterm.Frame = function(terminal, url, opt_options) {\n this.terminal_ = terminal;\n this.div_ = terminal.div_;\n this.url = url;\n this.options = opt_options || {};\n this.iframe_ = null;\n this.container_ = null;\n this.messageChannel_ = null;\n};\n\n/**\n * Handle messages from the iframe.\n */\nhterm.Frame.prototype.onMessage_ = function(e) {\n switch (e.data.name) {\n case 'ipc-init-ok':\n // We get this response after we send them ipc-init and they finish.\n this.sendTerminalInfo_();\n return;\n case 'terminal-info-ok':\n // We get this response after we send them terminal-info and they finish.\n // Show the finished frame, and then rebind our message handler to the\n // callback below.\n this.container_.style.display = 'flex';\n this.messageChannel_.port1.onmessage = this.onMessage.bind(this);\n this.onLoad();\n return;\n default:\n console.log('Unknown message from frame:', e.data);\n return;\n }\n};\n\n/**\n * Clients could override this, I guess.\n *\n * It doesn't support multiple listeners, but I'm not sure that would make sense\n * here. It's probably better to speak directly to our parents.\n */\nhterm.Frame.prototype.onMessage = function() {};\n\n/**\n * Handle iframe onLoad event.\n */\nhterm.Frame.prototype.onLoad_ = function() {\n this.messageChannel_ = new MessageChannel();\n this.messageChannel_.port1.onmessage = this.onMessage_.bind(this);\n this.messageChannel_.port1.start();\n this.iframe_.contentWindow.postMessage(\n {name: 'ipc-init', argv: [{messagePort: this.messageChannel_.port2}]},\n this.url, [this.messageChannel_.port2]);\n};\n\n/**\n * Clients may override this.\n */\nhterm.Frame.prototype.onLoad = function() {};\n\n/**\n * Sends the terminal-info message to the iframe.\n */\nhterm.Frame.prototype.sendTerminalInfo_ = function() {\n lib.f.getAcceptLanguages(function(languages) {\n this.postMessage('terminal-info', [{\n acceptLanguages: languages,\n foregroundColor: this.terminal_.getForegroundColor(),\n backgroundColor: this.terminal_.getBackgroundColor(),\n cursorColor: this.terminal_.getCursorColor(),\n fontSize: this.terminal_.getFontSize(),\n fontFamily: this.terminal_.getFontFamily(),\n baseURL: lib.f.getURL('/')\n }]\n );\n }.bind(this));\n};\n\n/**\n * User clicked the close button on the frame decoration.\n */\nhterm.Frame.prototype.onCloseClicked_ = function() {\n this.close();\n};\n\n/**\n * Close this frame.\n */\nhterm.Frame.prototype.close = function() {\n if (!this.container_ || !this.container_.parentNode)\n return;\n\n this.container_.parentNode.removeChild(this.container_);\n this.onClose();\n};\n\n\n/**\n * Clients may override this.\n */\nhterm.Frame.prototype.onClose = function() {};\n\n/**\n * Send a message to the iframe.\n */\nhterm.Frame.prototype.postMessage = function(name, argv) {\n if (!this.messageChannel_)\n throw new Error('Message channel is not set up.');\n\n this.messageChannel_.port1.postMessage({name: name, argv: argv});\n};\n\n/**\n * Show the UI for this frame.\n *\n * The iframe src is not loaded until this method is called.\n */\nhterm.Frame.prototype.show = function() {\n var self = this;\n\n function opt(name, defaultValue) {\n if (name in self.options)\n return self.options[name];\n\n return defaultValue;\n }\n\n var self = this;\n\n if (this.container_ && this.container_.parentNode) {\n console.error('Frame already visible');\n return;\n }\n\n var headerHeight = '16px';\n\n var divSize = hterm.getClientSize(this.div_);\n\n var width = opt('width', 640);\n var height = opt('height', 480);\n var left = (divSize.width - width) / 2;\n var top = (divSize.height - height) / 2;\n\n var document = this.terminal_.document_;\n\n var container = this.container_ = document.createElement('div');\n container.style.cssText = (\n 'position: absolute;' +\n 'display: none;' +\n 'flex-direction: column;' +\n 'top: 10%;' +\n 'left: 4%;' +\n 'width: 90%;' +\n 'height: 80%;' +\n 'min-height: 20%;' +\n 'max-height: 80%;' +\n 'box-shadow: 0 0 2px ' + this.terminal_.getForegroundColor() + ';' +\n 'border: 2px ' + this.terminal_.getForegroundColor() + ' solid;');\n\n if (false) {\n // No use for the close button, so no use for the window header either.\n var header = document.createElement('div');\n header.style.cssText = (\n 'display: flex;' +\n 'justify-content: flex-end;' +\n 'height: ' + headerHeight + ';' +\n 'background-color: ' + this.terminal_.getForegroundColor() + ';' +\n 'color: ' + this.terminal_.getBackgroundColor() + ';' +\n 'font-size: 16px;' +\n 'font-family: ' + this.terminal_.getFontFamily());\n container.appendChild(header);\n\n var button = document.createElement('div');\n button.setAttribute('role', 'button');\n button.style.cssText = (\n 'margin-top: -3px;' +\n 'margin-right: 3px;' +\n 'cursor: pointer;');\n button.textContent = '\\u2a2f';\n button.addEventListener('click', this.onCloseClicked_.bind(this));\n header.appendChild(button);\n }\n\n var iframe = this.iframe_ = document.createElement('iframe');\n iframe.onload = this.onLoad_.bind(this);\n iframe.style.cssText = (\n 'display: flex;' +\n 'flex: 1;' +\n 'width: 100%');\n iframe.setAttribute('src', this.url);\n iframe.setAttribute('seamless', true);\n container.appendChild(iframe);\n\n this.div_.appendChild(container);\n};\n// SOURCE FILE: hterm/js/hterm_keyboard.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('hterm.Keyboard.KeyMap');\n\n/**\n * Keyboard handler.\n *\n * Consumes onKey* events and invokes onVTKeystroke on the associated\n * hterm.Terminal object.\n *\n * See also: [XTERM] as referenced in vt.js.\n *\n * @param {hterm.Terminal} The Terminal object associated with this keyboard.\n */\nhterm.Keyboard = function(terminal) {\n // The parent vt interpreter.\n this.terminal = terminal;\n\n // The element we're currently capturing keyboard events for.\n this.keyboardElement_ = null;\n\n // The event handlers we are interested in, and their bound callbacks, saved\n // so they can be uninstalled with removeEventListener, when required.\n this.handlers_ = [\n ['focusout', this.onFocusOut_.bind(this)],\n ['keydown', this.onKeyDown_.bind(this)],\n ['keypress', this.onKeyPress_.bind(this)],\n ['keyup', this.onKeyUp_.bind(this)],\n ['textInput', this.onTextInput_.bind(this)]\n ];\n\n /**\n * The current key map.\n */\n this.keyMap = new hterm.Keyboard.KeyMap(this);\n\n this.bindings = new hterm.Keyboard.Bindings(this);\n\n /**\n * none: Disable any AltGr related munging.\n * ctrl-alt: Assume Ctrl+Alt means AltGr.\n * left-alt: Assume left Alt means AltGr.\n * right-alt: Assume right Alt means AltGr.\n */\n this.altGrMode = 'none';\n\n /**\n * If true, Shift-Insert will fall through to the browser as a paste.\n * If false, the keystroke will be sent to the host.\n */\n this.shiftInsertPaste = true;\n\n /**\n * If true, home/end will control the terminal scrollbar and shift home/end\n * will send the VT keycodes. If false then home/end sends VT codes and\n * shift home/end scrolls.\n */\n this.homeKeysScroll = false;\n\n /**\n * Same as above, except for page up/page down.\n */\n this.pageKeysScroll = false;\n\n /**\n * If true, Ctrl-Plus/Minus/Zero controls zoom.\n * If false, Ctrl-Shift-Plus/Minus/Zero controls zoom, Ctrl-Minus sends ^_,\n * Ctrl-Plus/Zero do nothing.\n */\n this.ctrlPlusMinusZeroZoom = true;\n\n /**\n * Ctrl+C copies if true, sends ^C to host if false.\n * Ctrl+Shift+C sends ^C to host if true, copies if false.\n */\n this.ctrlCCopy = false;\n\n /**\n * Ctrl+V pastes if true, sends ^V to host if false.\n * Ctrl+Shift+V sends ^V to host if true, pastes if false.\n */\n this.ctrlVPaste = false;\n\n /**\n * Enable/disable application keypad.\n *\n * This changes the way numeric keys are sent from the keyboard.\n */\n this.applicationKeypad = false;\n\n /**\n * Enable/disable the application cursor mode.\n *\n * This changes the way cursor keys are sent from the keyboard.\n */\n this.applicationCursor = false;\n\n /**\n * If true, the backspace should send BS ('\\x08', aka ^H). Otherwise\n * the backspace key should send '\\x7f'.\n */\n this.backspaceSendsBackspace = false;\n\n /**\n * The encoding method for data sent to the host.\n */\n this.characterEncoding = 'utf-8';\n\n /**\n * Set whether the meta key sends a leading escape or not.\n */\n this.metaSendsEscape = true;\n\n /**\n * Set whether meta-V gets passed to host.\n */\n this.passMetaV = true;\n\n /**\n * Controls how the alt key is handled.\n *\n * escape....... Send an ESC prefix.\n * 8-bit........ Add 128 to the unshifted character as in xterm.\n * browser-key.. Wait for the keypress event and see what the browser says.\n * (This won't work well on platforms where the browser\n * performs a default action for some alt sequences.)\n *\n * This setting only matters when alt is distinct from meta (altIsMeta is\n * false.)\n */\n this.altSendsWhat = 'escape';\n\n /**\n * Set whether the alt key acts as a meta key, instead of producing 8-bit\n * characters.\n *\n * True to enable, false to disable, null to autodetect based on platform.\n */\n this.altIsMeta = false;\n\n /**\n * If true, tries to detect DEL key events that are from alt-backspace on\n * Chrome OS vs from a true DEL key press.\n *\n * Background: At the time of writing, on Chrome OS, alt-backspace is mapped\n * to DEL. Some users may be happy with this, but others may be frustrated\n * that it's impossible to do meta-backspace. If the user enables this pref,\n * we use a trick to tell a true DEL keypress from alt-backspace: on\n * alt-backspace, we will see the alt key go down, then get a DEL keystroke\n * that indicates that alt is not pressed. See https://crbug.com/174410 .\n */\n this.altBackspaceIsMetaBackspace = false;\n\n /**\n * Used to keep track of the current alt-key state, which is necessary for\n * the altBackspaceIsMetaBackspace preference above and for the altGrMode\n * preference. This is a bitmap with where bit positions correspond to the\n * \"location\" property of the key event.\n */\n this.altKeyPressed = 0;\n\n /**\n * If true, Chrome OS media keys will be mapped to their F-key equivalent.\n * E.g. \"Back\" will be mapped to F1. If false, Chrome will handle the keys.\n */\n this.mediaKeysAreFKeys = false;\n\n /**\n * Holds the previous setting of altSendsWhat when DECSET 1039 is used. When\n * DECRST 1039 is used, altSendsWhat is changed back to this and this is\n * nulled out.\n */\n this.previousAltSendsWhat_ = null;\n};\n\n/**\n * Special handling for keyCodes in a keyboard layout.\n */\nhterm.Keyboard.KeyActions = {\n /**\n * Call preventDefault and stopPropagation for this key event and nothing\n * else.\n */\n CANCEL: lib.f.createEnum('CANCEL'),\n\n /**\n * This performs the default terminal action for the key. If used in the\n * 'normal' action and the the keystroke represents a printable key, the\n * character will be sent to the host. If used in one of the modifier\n * actions, the terminal will perform the normal action after (possibly)\n * altering it.\n *\n * - If the normal sequence starts with CSI, the sequence will be adjusted\n * to include the modifier parameter as described in [XTERM] in the final\n * table of the \"PC-Style Function Keys\" section.\n *\n * - If the control key is down and the key represents a printable character,\n * and the uppercase version of the unshifted keycap is between\n * 64 (ASCII '@') and 95 (ASCII '_'), then the uppercase version of the\n * unshifted keycap minus 64 is sent. This makes '^@' send '\\x00' and\n * '^_' send '\\x1f'. (Note that one higher that 0x1f is 0x20, which is\n * the first printable ASCII value.)\n *\n * - If the alt key is down and the key represents a printable character then\n * the value of the character is shifted up by 128.\n *\n * - If meta is down and configured to send an escape, '\\x1b' will be sent\n * before the normal action is performed.\n */\n DEFAULT: lib.f.createEnum('DEFAULT'),\n\n /**\n * Causes the terminal to opt out of handling the key event, instead letting\n * the browser deal with it.\n */\n PASS: lib.f.createEnum('PASS'),\n\n /**\n * Insert the first or second character of the keyCap, based on e.shiftKey.\n * The key will be handled in onKeyDown, and e.preventDefault() will be\n * called.\n *\n * It is useful for a modified key action, where it essentially strips the\n * modifier while preventing the browser from reacting to the key.\n */\n STRIP: lib.f.createEnum('STRIP')\n};\n\n/**\n * Encode a string according to the 'send-encoding' preference.\n */\nhterm.Keyboard.prototype.encode = function(str) {\n if (this.characterEncoding == 'utf-8')\n return this.terminal.vt.encodeUTF8(str);\n\n return str;\n};\n\n/**\n * Capture keyboard events sent to the associated element.\n *\n * This enables the keyboard. Captured events are consumed by this class\n * and will not perform their default action or bubble to other elements.\n *\n * Passing a null element will uninstall the keyboard handlers.\n *\n * @param {HTMLElement} element The element whose events should be captured, or\n * null to disable the keyboard.\n */\nhterm.Keyboard.prototype.installKeyboard = function(element) {\n if (element == this.keyboardElement_)\n return;\n\n if (element && this.keyboardElement_)\n this.installKeyboard(null);\n\n for (var i = 0; i < this.handlers_.length; i++) {\n var handler = this.handlers_[i];\n if (element) {\n element.addEventListener(handler[0], handler[1]);\n } else {\n this.keyboardElement_.removeEventListener(handler[0], handler[1]);\n }\n }\n\n this.keyboardElement_ = element;\n};\n\n/**\n * Disable keyboard event capture.\n *\n * This will allow the browser to process key events normally.\n */\nhterm.Keyboard.prototype.uninstallKeyboard = function() {\n this.installKeyboard(null);\n};\n\n/**\n * Handle onTextInput events.\n *\n * We're not actually supposed to get these, but we do on the Mac in the case\n * where a third party app sends synthetic keystrokes to Chrome.\n */\nhterm.Keyboard.prototype.onTextInput_ = function(e) {\n if (!e.data)\n return;\n\n e.data.split('').forEach(this.terminal.onVTKeystroke.bind(this.terminal));\n};\n\n/**\n * Handle onKeyPress events.\n */\nhterm.Keyboard.prototype.onKeyPress_ = function(e) {\n var code;\n\n var key = String.fromCharCode(e.which);\n var lowerKey = key.toLowerCase();\n if ((e.ctrlKey || e.metaKey) && (lowerKey == 'c' || lowerKey == 'v')) {\n // On FF the key press (not key down) event gets fired for copy/paste.\n // Let it fall through for the default browser behavior.\n return;\n }\n\n if (e.altKey && this.altSendsWhat == 'browser-key' && e.charCode == 0) {\n // If we got here because we were expecting the browser to handle an\n // alt sequence but it didn't do it, then we might be on an OS without\n // an enabled IME system. In that case we fall back to xterm-like\n // behavior.\n //\n // This happens here only as a fallback. Typically these platforms should\n // set altSendsWhat to either 'escape' or '8-bit'.\n var ch = String.fromCharCode(e.keyCode);\n if (!e.shiftKey)\n ch = ch.toLowerCase();\n code = ch.charCodeAt(0) + 128;\n\n } else if (e.charCode >= 32) {\n ch = e.charCode;\n }\n\n if (ch)\n this.terminal.onVTKeystroke(String.fromCharCode(ch));\n\n e.preventDefault();\n e.stopPropagation();\n};\n\n/**\n * Prevent default handling for non-ctrl-shifted event.\n *\n * When combined with Chrome permission 'app.window.fullscreen.overrideEsc',\n * and called for both key down and key up events,\n * the ESC key remains usable within fullscreen Chrome app windows.\n */\nhterm.Keyboard.prototype.preventChromeAppNonCtrlShiftDefault_ = function(e) {\n if (!window.chrome || !window.chrome.app || !window.chrome.app.window)\n return;\n if (!e.ctrlKey || !e.shiftKey)\n e.preventDefault();\n};\n\nhterm.Keyboard.prototype.onFocusOut_ = function(e) {\n this.altKeyPressed = 0;\n};\n\nhterm.Keyboard.prototype.onKeyUp_ = function(e) {\n if (e.keyCode == 18)\n this.altKeyPressed = this.altKeyPressed & ~(1 << (e.location - 1));\n\n if (e.keyCode == 27)\n this.preventChromeAppNonCtrlShiftDefault_(e);\n};\n\n/**\n * Handle onKeyDown events.\n */\nhterm.Keyboard.prototype.onKeyDown_ = function(e) {\n if (e.keyCode == 18)\n this.altKeyPressed = this.altKeyPressed | (1 << (e.location - 1));\n\n if (e.keyCode == 27)\n this.preventChromeAppNonCtrlShiftDefault_(e);\n\n var keyDef = this.keyMap.keyDefs[e.keyCode];\n if (!keyDef) {\n console.warn('No definition for keyCode: ' + e.keyCode);\n return;\n }\n\n // The type of action we're going to use.\n var resolvedActionType = null;\n\n var self = this;\n function getAction(name) {\n // Get the key action for the given action name. If the action is a\n // function, dispatch it. If the action defers to the normal action,\n // resolve that instead.\n\n resolvedActionType = name;\n\n var action = keyDef[name];\n if (typeof action == 'function')\n action = action.apply(self.keyMap, [e, keyDef]);\n\n if (action === DEFAULT && name != 'normal')\n action = getAction('normal');\n\n return action;\n }\n\n // Note that we use the triple-equals ('===') operator to test equality for\n // these constants, in order to distinguish usage of the constant from usage\n // of a literal string that happens to contain the same bytes.\n var CANCEL = hterm.Keyboard.KeyActions.CANCEL;\n var DEFAULT = hterm.Keyboard.KeyActions.DEFAULT;\n var PASS = hterm.Keyboard.KeyActions.PASS;\n var STRIP = hterm.Keyboard.KeyActions.STRIP;\n\n var control = e.ctrlKey;\n var alt = this.altIsMeta ? false : e.altKey;\n var meta = this.altIsMeta ? (e.altKey || e.metaKey) : e.metaKey;\n\n // In the key-map, we surround the keyCap for non-printables in \"[...]\"\n var isPrintable = !(/^\\[\\w+\\]$/.test(keyDef.keyCap));\n\n switch (this.altGrMode) {\n case 'ctrl-alt':\n if (isPrintable && control && alt) {\n // ctrl-alt-printable means altGr. We clear out the control and\n // alt modifiers and wait to see the charCode in the keydown event.\n control = false;\n alt = false;\n }\n break;\n\n case 'right-alt':\n if (isPrintable && (this.terminal.keyboard.altKeyPressed & 2)) {\n control = false;\n alt = false;\n }\n break;\n\n case 'left-alt':\n if (isPrintable && (this.terminal.keyboard.altKeyPressed & 1)) {\n control = false;\n alt = false;\n }\n break;\n }\n\n var action;\n\n if (control) {\n action = getAction('control');\n } else if (alt) {\n action = getAction('alt');\n } else if (meta) {\n action = getAction('meta');\n } else {\n action = getAction('normal');\n }\n\n // If e.maskShiftKey was set (during getAction) it means the shift key is\n // already accounted for in the action, and we should not act on it any\n // further. This is currently only used for Ctrl-Shift-Tab, which should send\n // \"CSI Z\", not \"CSI 1 ; 2 Z\".\n var shift = !e.maskShiftKey && e.shiftKey;\n\n var keyDown = {\n keyCode: e.keyCode,\n shift: e.shiftKey, // not `var shift` from above.\n ctrl: control,\n alt: alt,\n meta: meta\n };\n\n var binding = this.bindings.getBinding(keyDown);\n\n if (binding) {\n // Clear out the modifier bits so we don't try to munge the sequence\n // further.\n shift = control = alt = meta = false;\n resolvedActionType = 'normal';\n action = binding.action;\n\n if (typeof action == 'function')\n action = action.call(this, this.terminal, keyDown);\n }\n\n if (alt && this.altSendsWhat == 'browser-key' && action == DEFAULT) {\n // When altSendsWhat is 'browser-key', we wait for the keypress event.\n // In keypress, the browser should have set the event.charCode to the\n // appropriate character.\n // TODO(rginda): Character compositions will need some black magic.\n action = PASS;\n }\n\n if (action === PASS || (action === DEFAULT && !(control || alt || meta))) {\n // If this key is supposed to be handled by the browser, or it is an\n // unmodified key with the default action, then exit this event handler.\n // If it's an unmodified key, it'll be handled in onKeyPress where we\n // can tell for sure which ASCII code to insert.\n //\n // This block needs to come before the STRIP test, otherwise we'll strip\n // the modifier and think it's ok to let the browser handle the keypress.\n // The browser won't know we're trying to ignore the modifiers and might\n // perform some default action.\n return;\n }\n\n if (action === STRIP) {\n alt = control = false;\n action = keyDef.normal;\n if (typeof action == 'function')\n action = action.apply(this.keyMap, [e, keyDef]);\n\n if (action == DEFAULT && keyDef.keyCap.length == 2)\n action = keyDef.keyCap.substr((shift ? 1 : 0), 1);\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n if (action === CANCEL)\n return;\n\n if (action !== DEFAULT && typeof action != 'string') {\n console.warn('Invalid action: ' + JSON.stringify(action));\n return;\n }\n\n // Strip the modifier that is associated with the action, since we assume that\n // modifier has already been accounted for in the action.\n if (resolvedActionType == 'control') {\n control = false;\n } else if (resolvedActionType == 'alt') {\n alt = false;\n } else if (resolvedActionType == 'meta') {\n meta = false;\n }\n\n if (action.substr(0, 2) == '\\x1b[' && (alt || control || shift)) {\n // The action is an escape sequence that and it was triggered in the\n // presence of a keyboard modifier, we may need to alter the action to\n // include the modifier before sending it.\n\n var mod;\n\n if (shift && !(alt || control)) {\n mod = ';2';\n } else if (alt && !(shift || control)) {\n mod = ';3';\n } else if (shift && alt && !control) {\n mod = ';4';\n } else if (control && !(shift || alt)) {\n mod = ';5';\n } else if (shift && control && !alt) {\n mod = ';6';\n } else if (alt && control && !shift) {\n mod = ';7';\n } else if (shift && alt && control) {\n mod = ';8';\n }\n\n if (action.length == 3) {\n // Some of the CSI sequences have zero parameters unless modified.\n action = '\\x1b[1' + mod + action.substr(2, 1);\n } else {\n // Others always have at least one parameter.\n action = action.substr(0, action.length - 1) + mod +\n action.substr(action.length - 1);\n }\n\n } else {\n if (action === DEFAULT) {\n action = keyDef.keyCap.substr((shift ? 1 : 0), 1);\n\n if (control) {\n var unshifted = keyDef.keyCap.substr(0, 1);\n var code = unshifted.charCodeAt(0);\n if (code >= 64 && code <= 95) {\n action = String.fromCharCode(code - 64);\n }\n }\n }\n\n if (alt && this.altSendsWhat == '8-bit' && action.length == 1) {\n var code = action.charCodeAt(0) + 128;\n action = String.fromCharCode(code);\n }\n\n // We respect alt/metaSendsEscape even if the keymap action was a literal\n // string. Otherwise, every overridden alt/meta action would have to\n // check alt/metaSendsEscape.\n if ((alt && this.altSendsWhat == 'escape') ||\n (meta && this.metaSendsEscape)) {\n action = '\\x1b' + action;\n }\n }\n\n this.terminal.onVTKeystroke(action);\n};\n// SOURCE FILE: hterm/js/hterm_keyboard_bindings.js\n// Copyright (c) 2015 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * A mapping from hterm.Keyboard.KeyPattern to an action.\n *\n * TODO(rginda): For now this bindings code is only used for user overrides.\n * hterm.Keyboard.KeyMap still handles all of the built-in key mappings.\n * It'd be nice if we migrated that over to be hterm.Keyboard.Bindings based.\n */\nhterm.Keyboard.Bindings = function() {\n this.bindings_ = {};\n};\n\n/**\n * Remove all bindings.\n */\nhterm.Keyboard.Bindings.prototype.clear = function () {\n this.bindings_ = {};\n};\n\n/**\n * Add a new binding.\n *\n * Internal API that assumes parsed objects as inputs.\n * See the public addBinding for more details.\n *\n * @param {hterm.Keyboard.KeyPattern} keyPattern\n * @param {string|function|hterm.Keyboard.KeyAction} action\n */\nhterm.Keyboard.Bindings.prototype.addBinding_ = function(keyPattern, action) {\n var binding = null;\n var list = this.bindings_[keyPattern.keyCode];\n if (list) {\n for (var i = 0; i < list.length; i++) {\n if (list[i].keyPattern.matchKeyPattern(keyPattern)) {\n binding = list[i];\n break;\n }\n }\n }\n\n if (binding) {\n binding.action = action;\n } else {\n binding = {keyPattern: keyPattern, action: action};\n\n if (!list) {\n this.bindings_[keyPattern.keyCode] = [binding];\n } else {\n this.bindings_[keyPattern.keyCode].push(binding);\n\n list.sort(function(a, b) {\n return hterm.Keyboard.KeyPattern.sortCompare(\n a.keyPattern, b.keyPattern);\n });\n }\n }\n};\n\n/**\n * Add a new binding.\n *\n * If a binding for the keyPattern already exists it will be overridden.\n *\n * More specific keyPatterns take precedence over those with wildcards. Given\n * bindings for \"Ctrl-A\" and \"Ctrl-*-A\", and a \"Ctrl-A\" keydown, the \"Ctrl-A\"\n * binding will match even if \"Ctrl-*-A\" was created last.\n *\n * If action is a string, it will be passed through hterm.Parser.parseKeyAction.\n *\n * For example:\n * // Will replace Ctrl-P keystrokes with the string \"hiya!\".\n * addBinding('Ctrl-P', \"'hiya!'\");\n * // Will cancel the keystroke entirely (make it do nothing).\n * addBinding('Alt-D', hterm.Keyboard.KeyActions.CANCEL);\n * // Will execute the code and return the action.\n * addBinding('Ctrl-T', function() {\n * console.log('Got a T!');\n * return hterm.Keyboard.KeyActions.PASS;\n * });\n *\n * @param {string|hterm.Keyboard.KeyPattern} keyPattern\n * @param {string|function|hterm.Keyboard.KeyAction} action\n */\nhterm.Keyboard.Bindings.prototype.addBinding = function(key, action) {\n // If we're given a hterm.Keyboard.KeyPattern object, pass it down.\n if (typeof key != 'string') {\n this.addBinding_(key, action);\n return;\n }\n\n // Here we treat key as a string.\n var p = new hterm.Parser();\n\n p.reset(key);\n var sequence;\n\n try {\n sequence = p.parseKeySequence();\n } catch (ex) {\n console.error(ex);\n return;\n }\n\n if (!p.isComplete()) {\n console.error(p.error('Expected end of sequence: ' + sequence));\n return;\n }\n\n // If action is a string, parse it. Otherwise assume it's callable.\n if (typeof action == 'string') {\n p.reset(action);\n try {\n action = p.parseKeyAction();\n } catch (ex) {\n console.error(ex);\n return;\n }\n }\n\n if (!p.isComplete()) {\n console.error(p.error('Expected end of sequence: ' + sequence));\n return;\n }\n\n this.addBinding_(new hterm.Keyboard.KeyPattern(sequence), action);\n};\n\n/**\n * Add multiple bindings at a time using a map of {string: string, ...}\n *\n * This uses hterm.Parser to parse the maps key into KeyPatterns, and the\n * map values into {string|function|KeyAction}.\n *\n * For example:\n * {\n * // Will replace Ctrl-P keystrokes with the string \"hiya!\".\n * 'Ctrl-P': \"'hiya!'\",\n * // Will cancel the keystroke entirely (make it do nothing).\n * 'Alt-D': hterm.Keyboard.KeyActions.CANCEL,\n * }\n *\n * @param {Object} map\n */\nhterm.Keyboard.Bindings.prototype.addBindings = function(map) {\n for (var key in map) {\n this.addBinding(key, map[key]);\n }\n};\n\n/**\n * Return the binding that is the best match for the given keyDown record,\n * or null if there is no match.\n *\n * @param {Object} keyDown An object with a keyCode property and zero or\n * more boolean properties representing key modifiers. These property names\n * must match those defined in hterm.Keyboard.KeyPattern.modifiers.\n */\nhterm.Keyboard.Bindings.prototype.getBinding = function(keyDown) {\n var list = this.bindings_[keyDown.keyCode];\n if (!list)\n return null;\n\n for (var i = 0; i < list.length; i++) {\n var binding = list[i];\n if (binding.keyPattern.matchKeyDown(keyDown))\n return binding;\n }\n\n return null;\n};\n// SOURCE FILE: hterm/js/hterm_keyboard_keymap.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('hterm.Keyboard.KeyActions');\n\n/**\n * The default key map for hterm.\n *\n * Contains a mapping of keyCodes to keyDefs (aka key definitions). The key\n * definition tells the hterm.Keyboard class how to handle keycodes.\n *\n * This should work for most cases, as the printable characters get handled\n * in the keypress event. In that case, even if the keycap is wrong in the\n * key map, the correct character should be sent.\n *\n * Different layouts, such as Dvorak should work with this keymap, as those\n * layouts typically move keycodes around on the keyboard without disturbing\n * the actual keycaps.\n *\n * There may be issues with control keys on non-US keyboards or with keyboards\n * that very significantly from the expectations here, in which case we may\n * have to invent new key maps.\n *\n * The sequences defined in this key map come from [XTERM] as referenced in\n * vt.js, starting with the section titled \"Alt and Meta Keys\".\n */\nhterm.Keyboard.KeyMap = function(keyboard) {\n this.keyboard = keyboard;\n this.keyDefs = {};\n this.reset();\n};\n\n/**\n * Add a single key definition.\n *\n * The definition is a hash containing the following keys: 'keyCap', 'normal',\n * 'control', and 'alt'.\n *\n * - keyCap is a string identifying the key. For printable\n * keys, the key cap should be exactly two characters, starting with the\n * unshifted version. For example, 'aA', 'bB', '1!' and '=+'. For\n * non-printable the key cap should be surrounded in square braces, as in\n * '[INS]', '[LEFT]'. By convention, non-printable keycaps are in uppercase\n * but this is not a strict requirement.\n *\n * - Normal is the action that should be performed when they key is pressed\n * in the absence of any modifier. See below for the supported actions.\n *\n * - Control is the action that should be performed when they key is pressed\n * along with the control modifier. See below for the supported actions.\n *\n * - Alt is the action that should be performed when they key is pressed\n * along with the alt modifier. See below for the supported actions.\n *\n * - Meta is the action that should be performed when they key is pressed\n * along with the meta modifier. See below for the supported actions.\n *\n * Actions can be one of the hterm.Keyboard.KeyActions as documented below,\n * a literal string, or an array. If the action is a literal string then\n * the string is sent directly to the host. If the action is an array it\n * is taken to be an escape sequence that may be altered by modifier keys.\n * The second-to-last element of the array will be overwritten with the\n * state of the modifier keys, as specified in the final table of \"PC-Style\n * Function Keys\" from [XTERM].\n */\nhterm.Keyboard.KeyMap.prototype.addKeyDef = function(keyCode, def) {\n if (keyCode in this.keyDefs)\n console.warn('Duplicate keyCode: ' + keyCode);\n\n this.keyDefs[keyCode] = def;\n};\n\n/**\n * Add multiple key definitions in a single call.\n *\n * This function takes the key definitions as variable argument list. Each\n * argument is the key definition specified as an array.\n *\n * (If the function took everything as one big hash we couldn't detect\n * duplicates, and there would be a lot more typing involved.)\n *\n * Each key definition should have 6 elements: (keyCode, keyCap, normal action,\n * control action, alt action and meta action). See KeyMap.addKeyDef for the\n * meaning of these elements.\n */\nhterm.Keyboard.KeyMap.prototype.addKeyDefs = function(var_args) {\n for (var i = 0; i < arguments.length; i++) {\n this.addKeyDef(arguments[i][0],\n { keyCap: arguments[i][1],\n normal: arguments[i][2],\n control: arguments[i][3],\n alt: arguments[i][4],\n meta: arguments[i][5]\n });\n }\n};\n\n/**\n * Set up the default state for this keymap.\n */\nhterm.Keyboard.KeyMap.prototype.reset = function() {\n this.keyDefs = {};\n\n var self = this;\n\n // This function is used by the \"macro\" functions below. It makes it\n // possible to use the call() macro as an argument to any other macro.\n function resolve(action, e, k) {\n if (typeof action == 'function')\n return action.apply(self, [e, k]);\n\n return action;\n }\n\n // If not application keypad a, else b. The keys that care about\n // application keypad ignore it when the key is modified.\n function ak(a, b) {\n return function(e, k) {\n var action = (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey ||\n !self.keyboard.applicationKeypad) ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // If mod or not application cursor a, else b. The keys that care about\n // application cursor ignore it when the key is modified.\n function ac(a, b) {\n return function(e, k) {\n var action = (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey ||\n !self.keyboard.applicationCursor) ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // If not backspace-sends-backspace keypad a, else b.\n function bs(a, b) {\n return function(e, k) {\n var action = !self.keyboard.backspaceSendsBackspace ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // If not e.shiftKey a, else b.\n function sh(a, b) {\n return function(e, k) {\n var action = !e.shiftKey ? a : b;\n e.maskShiftKey = true;\n return resolve(action, e, k);\n };\n }\n\n // If not e.altKey a, else b.\n function alt(a, b) {\n return function(e, k) {\n var action = !e.altKey ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // If no modifiers a, else b.\n function mod(a, b) {\n return function(e, k) {\n var action = !(e.shiftKey || e.ctrlKey || e.altKey || e.metaKey) ? a : b;\n return resolve(action, e, k);\n };\n }\n\n // Compute a control character for a given character.\n function ctl(ch) { return String.fromCharCode(ch.charCodeAt(0) - 64) }\n\n // Call a method on the keymap instance.\n function c(m) { return function (e, k) { return this[m](e, k) } }\n\n // Ignore if not trapping media keys.\n function med(fn) {\n return function(e, k) {\n if (!self.keyboard.mediaKeysAreFKeys) {\n // Block Back, Forward, and Reload keys to avoid navigating away from\n // the current page.\n return (e.keyCode == 166 || e.keyCode == 167 || e.keyCode == 168) ?\n hterm.Keyboard.KeyActions.CANCEL :\n hterm.Keyboard.KeyActions.PASS;\n }\n return resolve(fn, e, k);\n };\n }\n\n var ESC = '\\x1b';\n var CSI = '\\x1b[';\n var SS3 = '\\x1bO';\n\n var CANCEL = hterm.Keyboard.KeyActions.CANCEL;\n var DEFAULT = hterm.Keyboard.KeyActions.DEFAULT;\n var PASS = hterm.Keyboard.KeyActions.PASS;\n var STRIP = hterm.Keyboard.KeyActions.STRIP;\n\n this.addKeyDefs(\n // These fields are: [keycode, keycap, normal, control, alt, meta]\n\n // The browser sends the keycode 0 for some keys. We'll just assume it's\n // going to do the right thing by default for those keys.\n [0, '[UNKNOWN]', PASS, PASS, PASS, PASS],\n\n // First row.\n [27, '[ESC]', ESC, DEFAULT, DEFAULT, DEFAULT],\n [112, '[F1]', mod(SS3 + 'P', CSI + 'P'), DEFAULT, CSI + \"23~\", DEFAULT],\n [113, '[F2]', mod(SS3 + 'Q', CSI + 'Q'), DEFAULT, CSI + \"24~\", DEFAULT],\n [114, '[F3]', mod(SS3 + 'R', CSI + 'R'), DEFAULT, CSI + \"25~\", DEFAULT],\n [115, '[F4]', mod(SS3 + 'S', CSI + 'S'), DEFAULT, CSI + \"26~\", DEFAULT],\n [116, '[F5]', CSI + '15~', DEFAULT, CSI + \"28~\", DEFAULT],\n [117, '[F6]', CSI + '17~', DEFAULT, CSI + \"29~\", DEFAULT],\n [118, '[F7]', CSI + '18~', DEFAULT, CSI + \"31~\", DEFAULT],\n [119, '[F8]', CSI + '19~', DEFAULT, CSI + \"32~\", DEFAULT],\n [120, '[F9]', CSI + '20~', DEFAULT, CSI + \"33~\", DEFAULT],\n [121, '[F10]', CSI + '21~', DEFAULT, CSI + \"34~\", DEFAULT],\n [122, '[F11]', CSI + '23~', DEFAULT, CSI + \"42~\", DEFAULT],\n [123, '[F12]', CSI + '24~', DEFAULT, CSI + \"43~\", DEFAULT],\n\n // Second row.\n [192, '`~', DEFAULT, sh(ctl('@'), ctl('^')), DEFAULT, PASS],\n [49, '1!', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [50, '2@', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [51, '3#', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [52, '4$', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [53, '5%', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [54, '6^', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [55, '7&', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [56, '8*', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [57, '9(', DEFAULT, c('onCtrlNum_'), c('onAltNum_'), c('onMetaNum_')],\n [48, '0)', DEFAULT, c('onPlusMinusZero_'),c('onAltNum_'),c('onPlusMinusZero_')],\n [189, '-_', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n [187, '=+', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n // Firefox -_ and =+\n [173, '-_', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n [61, '=+', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n // Firefox Italian +*\n [171, '+*', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n\n [8, '[BKSP]', bs('\\x7f', '\\b'), bs('\\b', '\\x7f'), DEFAULT, DEFAULT],\n\n // Third row.\n [9, '[TAB]', sh('\\t', CSI + 'Z'), STRIP, PASS, DEFAULT],\n [81, 'qQ', DEFAULT, ctl('Q'), DEFAULT, DEFAULT],\n [87, 'wW', DEFAULT, ctl('W'), DEFAULT, DEFAULT],\n [69, 'eE', DEFAULT, ctl('E'), DEFAULT, DEFAULT],\n [82, 'rR', DEFAULT, ctl('R'), DEFAULT, DEFAULT],\n [84, 'tT', DEFAULT, ctl('T'), DEFAULT, DEFAULT],\n [89, 'yY', DEFAULT, ctl('Y'), DEFAULT, DEFAULT],\n [85, 'uU', DEFAULT, ctl('U'), DEFAULT, DEFAULT],\n [73, 'iI', DEFAULT, ctl('I'), DEFAULT, DEFAULT],\n [79, 'oO', DEFAULT, ctl('O'), DEFAULT, DEFAULT],\n [80, 'pP', DEFAULT, ctl('P'), DEFAULT, DEFAULT],\n [219, '[{', DEFAULT, ctl('['), DEFAULT, DEFAULT],\n [221, ']}', DEFAULT, ctl(']'), DEFAULT, DEFAULT],\n [220, '\\\\|', DEFAULT, ctl('\\\\'), DEFAULT, DEFAULT],\n\n // Fourth row. (We let Ctrl-Shift-J pass for Chrome DevTools.)\n [20, '[CAPS]', PASS, PASS, PASS, DEFAULT],\n [65, 'aA', DEFAULT, ctl('A'), DEFAULT, DEFAULT],\n [83, 'sS', DEFAULT, ctl('S'), DEFAULT, DEFAULT],\n [68, 'dD', DEFAULT, ctl('D'), DEFAULT, DEFAULT],\n [70, 'fF', DEFAULT, ctl('F'), DEFAULT, DEFAULT],\n [71, 'gG', DEFAULT, ctl('G'), DEFAULT, DEFAULT],\n [72, 'hH', DEFAULT, ctl('H'), DEFAULT, DEFAULT],\n [74, 'jJ', DEFAULT, sh(ctl('J'), PASS), DEFAULT, DEFAULT],\n [75, 'kK', DEFAULT, sh(ctl('K'), c('onClear_')), DEFAULT, DEFAULT],\n [76, 'lL', DEFAULT, sh(ctl('L'), PASS), DEFAULT, DEFAULT],\n [186, ';:', DEFAULT, STRIP, DEFAULT, DEFAULT],\n [222, '\\'\"', DEFAULT, STRIP, DEFAULT, DEFAULT],\n [13, '[ENTER]', '\\r', CANCEL, CANCEL, DEFAULT],\n\n // Fifth row. This includes the copy/paste shortcuts. On some\n // platforms it's Ctrl-C/V, on others it's Meta-C/V. We assume either\n // Ctrl-C/Meta-C should pass to the browser when there is a selection,\n // and Ctrl-Shift-V/Meta-*-V should always pass to the browser (since\n // these seem to be recognized as paste too).\n [16, '[SHIFT]', PASS, PASS, PASS, DEFAULT],\n [90, 'zZ', DEFAULT, ctl('Z'), DEFAULT, DEFAULT],\n [88, 'xX', DEFAULT, ctl('X'), DEFAULT, DEFAULT],\n [67, 'cC', DEFAULT, c('onCtrlC_'), DEFAULT, c('onMetaC_')],\n [86, 'vV', DEFAULT, c('onCtrlV_'), DEFAULT, c('onMetaV_')],\n [66, 'bB', DEFAULT, sh(ctl('B'), PASS), DEFAULT, sh(DEFAULT, PASS)],\n [78, 'nN', DEFAULT, c('onCtrlN_'), DEFAULT, c('onMetaN_')],\n [77, 'mM', DEFAULT, ctl('M'), DEFAULT, DEFAULT],\n [188, ',<', DEFAULT, alt(STRIP, PASS), DEFAULT, DEFAULT],\n [190, '.>', DEFAULT, alt(STRIP, PASS), DEFAULT, DEFAULT],\n [191, '/?', DEFAULT, sh(ctl('_'), ctl('?')), DEFAULT, DEFAULT],\n\n // Sixth and final row.\n [17, '[CTRL]', PASS, PASS, PASS, PASS],\n [18, '[ALT]', PASS, PASS, PASS, PASS],\n [91, '[LAPL]', PASS, PASS, PASS, PASS],\n [32, ' ', DEFAULT, ctl('@'), DEFAULT, DEFAULT],\n [92, '[RAPL]', PASS, PASS, PASS, PASS],\n [93, '[RMENU]', PASS, PASS, PASS, PASS],\n\n // These things.\n [42, '[PRTSCR]', PASS, PASS, PASS, PASS],\n [145, '[SCRLK]', PASS, PASS, PASS, PASS],\n [19, '[BREAK]', PASS, PASS, PASS, PASS],\n\n // The block of six keys above the arrows.\n [45, '[INSERT]', c('onKeyInsert_'), DEFAULT, DEFAULT, DEFAULT],\n [36, '[HOME]', c('onKeyHome_'), DEFAULT, DEFAULT, DEFAULT],\n [33, '[PGUP]', c('onKeyPageUp_'), DEFAULT, DEFAULT, DEFAULT],\n [46, '[DEL]', c('onKeyDel_'), DEFAULT, DEFAULT, DEFAULT],\n [35, '[END]', c('onKeyEnd_'), DEFAULT, DEFAULT, DEFAULT],\n [34, '[PGDOWN]', c('onKeyPageDown_'), DEFAULT, DEFAULT, DEFAULT],\n\n // Arrow keys. When unmodified they respect the application cursor state,\n // otherwise they always send the CSI codes.\n [38, '[UP]', c('onKeyArrowUp_'), DEFAULT, DEFAULT, DEFAULT],\n [40, '[DOWN]', c('onKeyArrowDown_'), DEFAULT, DEFAULT, DEFAULT],\n [39, '[RIGHT]', ac(CSI + 'C', SS3 + 'C'), DEFAULT, DEFAULT, DEFAULT],\n [37, '[LEFT]', ac(CSI + 'D', SS3 + 'D'), DEFAULT, DEFAULT, DEFAULT],\n\n [144, '[NUMLOCK]', PASS, PASS, PASS, PASS],\n\n // With numlock off, the keypad generates the same key codes as the arrows\n // and 'block of six' for some keys, and null key codes for the rest.\n\n // Keypad with numlock on generates unique key codes...\n [96, '[KP0]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [97, '[KP1]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [98, '[KP2]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [99, '[KP3]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [100, '[KP4]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [101, '[KP5]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [102, '[KP6]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [103, '[KP7]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [104, '[KP8]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [105, '[KP9]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [107, '[KP+]', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n [109, '[KP-]', DEFAULT, c('onPlusMinusZero_'), DEFAULT, c('onPlusMinusZero_')],\n [106, '[KP*]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [111, '[KP/]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n [110, '[KP.]', DEFAULT, DEFAULT, DEFAULT, DEFAULT],\n\n // Chrome OS keyboard top row.\n [166, '[BACK]', med(mod(SS3+'P', CSI+'P')), DEFAULT, CSI+\"23~\", DEFAULT],\n [167, '[FWD]', med(mod(SS3+'Q', CSI+'Q')), DEFAULT, CSI+\"24~\", DEFAULT],\n [168, '[RELOAD]', med(mod(SS3+'R', CSI+'R')), DEFAULT, CSI+\"25~\", DEFAULT],\n [183, '[FSCR]', med(mod(SS3+'S', CSI+'S')), DEFAULT, CSI+\"26~\", DEFAULT],\n [182, '[WINS]', med(CSI + '15~'), DEFAULT, CSI+\"28~\", DEFAULT],\n [216, '[BRIT-]', med(CSI + '17~'), DEFAULT, CSI+\"29~\", DEFAULT],\n [217, '[BRIT+]', med(CSI + '18~'), DEFAULT, CSI+\"31~\", DEFAULT]\n\n // 173 [MUTE], 174 [VOL-] and 175 [VOL+] are trapped by the Chrome OS\n // window manager, so we'll never see them. Note that 173 is also\n // Firefox's -_ keycode.\n );\n};\n\n/**\n * Either allow the paste or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyInsert_ = function(e) {\n if (this.keyboard.shiftInsertPaste && e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n return '\\x1b[2~';\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyHome_ = function(e) {\n if (!this.keyboard.homeKeysScroll ^ e.shiftKey) {\n if ((e.altey || e.ctrlKey || e.shiftKey) ||\n !this.keyboard.applicationCursor) {\n return '\\x1b[H';\n }\n\n return '\\x1bOH';\n }\n\n this.keyboard.terminal.scrollHome();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyEnd_ = function(e) {\n if (!this.keyboard.homeKeysScroll ^ e.shiftKey) {\n if ((e.altKey || e.ctrlKey || e.shiftKey) ||\n !this.keyboard.applicationCursor) {\n return '\\x1b[F';\n }\n\n return '\\x1bOF';\n }\n\n this.keyboard.terminal.scrollEnd();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyPageUp_ = function(e) {\n if (!this.keyboard.pageKeysScroll ^ e.shiftKey)\n return '\\x1b[5~';\n\n this.keyboard.terminal.scrollPageUp();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either send a true DEL, or sub in meta-backspace.\n *\n * On Chrome OS, if we know the alt key is down, but we get a DEL event that\n * claims that the alt key is not pressed, we know the DEL was a synthetic\n * one from a user that hit alt-backspace. Based on a user pref, we can sub\n * in meta-backspace in this case.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyDel_ = function(e) {\n if (this.keyboard.altBackspaceIsMetaBackspace &&\n this.keyboard.altKeyPressed && !e.altKey)\n return '\\x1b\\x7f';\n return '\\x1b[3~';\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyPageDown_ = function(e) {\n if (!this.keyboard.pageKeysScroll ^ e.shiftKey)\n return '\\x1b[6~';\n\n this.keyboard.terminal.scrollPageDown();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyArrowUp_ = function(e) {\n if (!this.keyboard.applicationCursor && e.shiftKey) {\n this.keyboard.terminal.scrollLineUp();\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n return (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey ||\n !this.keyboard.applicationCursor) ? '\\x1b[A' : '\\x1bOA';\n};\n\n/**\n * Either scroll the scrollback buffer or send a key sequence.\n */\nhterm.Keyboard.KeyMap.prototype.onKeyArrowDown_ = function(e) {\n if (!this.keyboard.applicationCursor && e.shiftKey) {\n this.keyboard.terminal.scrollLineDown();\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n return (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey ||\n !this.keyboard.applicationCursor) ? '\\x1b[B' : '\\x1bOB';\n};\n\n/**\n * Clear the primary/alternate screens and the scrollback buffer.\n */\nhterm.Keyboard.KeyMap.prototype.onClear_ = function(e, keyDef) {\n this.keyboard.terminal.wipeContents();\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n\n/**\n * Either pass Ctrl-1..9 to the browser or send them to the host.\n *\n * Note that Ctrl-1 and Ctrl-9 don't actually have special sequences mapped\n * to them in xterm or gnome-terminal. The range is really Ctrl-2..8, but\n * we handle 1..9 since Chrome treats the whole range special.\n */\nhterm.Keyboard.KeyMap.prototype.onCtrlNum_ = function(e, keyDef) {\n // Compute a control character for a given character.\n function ctl(ch) { return String.fromCharCode(ch.charCodeAt(0) - 64) }\n\n if (this.keyboard.terminal.passCtrlNumber && !e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n switch (keyDef.keyCap.substr(0, 1)) {\n case '1': return '1';\n case '2': return ctl('@');\n case '3': return ctl('[');\n case '4': return ctl('\\\\');\n case '5': return ctl(']');\n case '6': return ctl('^');\n case '7': return ctl('_');\n case '8': return '\\x7f';\n case '9': return '9';\n }\n};\n\n/**\n * Either pass Alt-1..9 to the browser or send them to the host.\n */\nhterm.Keyboard.KeyMap.prototype.onAltNum_ = function(e, keyDef) {\n if (this.keyboard.terminal.passAltNumber && !e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n return hterm.Keyboard.KeyActions.DEFAULT;\n};\n\n/**\n * Either pass Meta-1..9 to the browser or send them to the host.\n */\nhterm.Keyboard.KeyMap.prototype.onMetaNum_ = function(e, keyDef) {\n if (this.keyboard.terminal.passMetaNumber && !e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n return hterm.Keyboard.KeyActions.DEFAULT;\n};\n\n/**\n * Either send a ^C or interpret the keystroke as a copy command.\n */\nhterm.Keyboard.KeyMap.prototype.onCtrlC_ = function(e, keyDef) {\n var selection = this.keyboard.terminal.getDocument().getSelection();\n\n if (!selection.isCollapsed) {\n if (this.keyboard.ctrlCCopy && !e.shiftKey) {\n // Ctrl-C should copy if there is a selection, send ^C otherwise.\n // Perform the copy by letting the browser handle Ctrl-C. On most\n // browsers, this is the *only* way to place text on the clipboard from\n // the 'drive-by' web.\n if (this.keyboard.terminal.clearSelectionAfterCopy) {\n setTimeout(selection.collapseToEnd.bind(selection), 50);\n }\n return hterm.Keyboard.KeyActions.PASS;\n }\n\n if (!this.keyboard.ctrlCCopy && e.shiftKey) {\n // Ctrl-Shift-C should copy if there is a selection, send ^C otherwise.\n // Perform the copy manually. This only works in situations where\n // document.execCommand('copy') is allowed.\n if (this.keyboard.terminal.clearSelectionAfterCopy) {\n setTimeout(selection.collapseToEnd.bind(selection), 50);\n }\n this.keyboard.terminal.copySelectionToClipboard();\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n }\n\n return '\\x03';\n};\n\n/**\n * Either send a ^N or open a new window to the same location.\n */\nhterm.Keyboard.KeyMap.prototype.onCtrlN_ = function(e, keyDef) {\n if (e.shiftKey) {\n window.open(document.location.href, '',\n 'chrome=no,close=yes,resize=yes,scrollbars=yes,' +\n 'minimizable=yes,width=' + window.innerWidth +\n ',height=' + window.innerHeight);\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n return '\\x0e';\n};\n\n/**\n * Either send a ^V or issue a paste command.\n *\n * The default behavior is to paste if the user presses Ctrl-Shift-V, and send\n * a ^V if the user presses Ctrl-V. This can be flipped with the\n * 'ctrl-v-paste' preference.\n *\n */\nhterm.Keyboard.KeyMap.prototype.onCtrlV_ = function(e, keyDef) {\n if ((!e.shiftKey && this.keyboard.ctrlVPaste) ||\n (e.shiftKey && !this.keyboard.ctrlVPaste)) {\n // We try to do the pasting ourselves as not all browsers/OSs bind Ctrl-V to\n // pasting. Notably, on macOS, Ctrl-V/Ctrl-Shift-V do nothing.\n // However, this might run into web restrictions, so if it fails, we still\n // fallback to the letting the native behavior (hopefully) save us.\n if (this.keyboard.terminal.paste())\n return hterm.Keyboard.KeyActions.CANCEL;\n else\n return hterm.Keyboard.KeyActions.PASS;\n }\n\n return '\\x16';\n};\n\n/**\n * Either the default action or open a new window to the same location.\n */\nhterm.Keyboard.KeyMap.prototype.onMetaN_ = function(e, keyDef) {\n if (e.shiftKey) {\n window.open(document.location.href, '',\n 'chrome=no,close=yes,resize=yes,scrollbars=yes,' +\n 'minimizable=yes,width=' + window.outerWidth +\n ',height=' + window.outerHeight);\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n return hterm.Keyboard.KeyActions.DEFAULT;\n};\n\n/**\n * Either send a Meta-C or allow the browser to interpret the keystroke as a\n * copy command.\n *\n * If there is no selection, or if the user presses Meta-Shift-C, then we'll\n * transmit an '\\x1b' (if metaSendsEscape is on) followed by 'c' or 'C'.\n *\n * If there is a selection, we defer to the browser. In this case we clear out\n * the selection so the user knows we heard them, and also to give them a\n * chance to send a Meta-C by just hitting the key again.\n */\nhterm.Keyboard.KeyMap.prototype.onMetaC_ = function(e, keyDef) {\n var document = this.keyboard.terminal.getDocument();\n if (e.shiftKey || document.getSelection().isCollapsed) {\n // If the shift key is being held, or there is no document selection, send\n // a Meta-C. The keyboard code will add the ESC if metaSendsEscape is true,\n // we just have to decide between 'c' and 'C'.\n return keyDef.keyCap.substr(e.shiftKey ? 1 : 0, 1);\n }\n\n // Otherwise let the browser handle it as a copy command.\n if (this.keyboard.terminal.clearSelectionAfterCopy) {\n setTimeout(function() { document.getSelection().collapseToEnd() }, 50);\n }\n return hterm.Keyboard.KeyActions.PASS;\n};\n\n/**\n * Either PASS or DEFAULT Meta-V, depending on preference.\n *\n * Always PASS Meta-Shift-V to allow browser to interpret the keystroke as\n * a paste command.\n */\nhterm.Keyboard.KeyMap.prototype.onMetaV_ = function(e, keyDef) {\n if (e.shiftKey)\n return hterm.Keyboard.KeyActions.PASS;\n\n return this.keyboard.passMetaV ?\n hterm.Keyboard.KeyActions.PASS :\n hterm.Keyboard.KeyActions.DEFAULT;\n};\n\n/**\n * Handle font zooming.\n *\n * The browser's built-in zoom has a bit of an issue at certain zoom levels.\n * At some magnifications, the measured height of a row of text differs from\n * the height that was explicitly set.\n *\n * We override the browser zoom keys to change the ScrollPort's font size to\n * avoid the issue.\n */\nhterm.Keyboard.KeyMap.prototype.onPlusMinusZero_ = function(e, keyDef) {\n if (!(this.keyboard.ctrlPlusMinusZeroZoom ^ e.shiftKey)) {\n // If ctrl-PMZ controls zoom and the shift key is pressed, or\n // ctrl-shift-PMZ controls zoom and this shift key is not pressed,\n // then we want to send the control code instead of affecting zoom.\n if (keyDef.keyCap == '-_')\n return '\\x1f'; // ^_\n\n // Only ^_ is valid, the other sequences have no meaning.\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n\n if (this.keyboard.terminal.getZoomFactor() != 1) {\n // If we're not at 1:1 zoom factor, let the Ctrl +/-/0 keys control the\n // browser zoom, so it's easier to for the user to get back to 100%.\n return hterm.Keyboard.KeyActions.PASS;\n }\n\n var cap = keyDef.keyCap.substr(0, 1);\n if (cap == '0') {\n this.keyboard.terminal.setFontSize(0);\n } else {\n var size = this.keyboard.terminal.getFontSize();\n\n if (cap == '-' || keyDef.keyCap == '[KP-]') {\n size -= 1;\n } else {\n size += 1;\n }\n\n this.keyboard.terminal.setFontSize(size);\n }\n\n return hterm.Keyboard.KeyActions.CANCEL;\n};\n// SOURCE FILE: hterm/js/hterm_keyboard_keypattern.js\n// Copyright (c) 2015 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * A record of modifier bits and keycode used to define a key binding.\n *\n * The modifier names are enumerated in the static KeyPattern.modifiers\n * property below. Each modifier can be true, false, or \"*\". True means\n * the modifier key must be present, false means it must not, and \"*\" means\n * it doesn't matter.\n */\nhterm.Keyboard.KeyPattern = function(spec) {\n this.wildcardCount = 0;\n this.keyCode = spec.keyCode;\n\n hterm.Keyboard.KeyPattern.modifiers.forEach(function(mod) {\n this[mod] = spec[mod] || false;\n if (this[mod] == '*')\n this.wildcardCount++;\n }.bind(this));\n};\n\n/**\n * Valid modifier names.\n */\nhterm.Keyboard.KeyPattern.modifiers = [\n 'shift', 'ctrl', 'alt', 'meta'\n];\n\n/**\n * A compare callback for Array.prototype.sort().\n *\n * The bindings code wants to be sure to search through the strictest key\n * patterns first, so that loosely defined patterns have a lower priority than\n * exact patterns.\n *\n * @param {hterm.Keyboard.KeyPattern} a\n * @param {hterm.Keyboard.KeyPattern} b\n */\nhterm.Keyboard.KeyPattern.sortCompare = function(a, b) {\n if (a.wildcardCount < b.wildcardCount)\n return -1;\n\n if (a.wildcardCount > b.wildcardCount)\n return 1;\n\n return 0;\n};\n\n/**\n * Private method used to match this key pattern against other key patterns\n * or key down events.\n *\n * @param {Object} The object to match.\n * @param {boolean} True if we should ignore wildcards. Useful when you want\n * to perform and exact match against another key pattern.\n */\nhterm.Keyboard.KeyPattern.prototype.match_ = function(obj, exactMatch) {\n if (this.keyCode != obj.keyCode)\n return false;\n\n var rv = true;\n\n hterm.Keyboard.KeyPattern.modifiers.forEach(function(mod) {\n var modValue = (mod in obj) ? obj[mod] : false;\n if (!rv || (!exactMatch && this[mod] == '*') || this[mod] == modValue)\n return;\n\n rv = false;\n }.bind(this));\n\n return rv;\n};\n\n/**\n * Return true if the given keyDown object is a match for this key pattern.\n *\n * @param {Object} keyDown An object with a keyCode property and zero or\n * more boolean properties representing key modifiers. These property names\n * must match those defined in hterm.Keyboard.KeyPattern.modifiers.\n */\nhterm.Keyboard.KeyPattern.prototype.matchKeyDown = function(keyDown) {\n return this.match_(keyDown, false);\n};\n\n/**\n * Return true if the given hterm.Keyboard.KeyPattern is exactly the same as\n * this one.\n *\n * @param {hterm.Keyboard.KeyPattern}\n */\nhterm.Keyboard.KeyPattern.prototype.matchKeyPattern = function(keyPattern) {\n return this.match_(keyPattern, true);\n};\n// SOURCE FILE: hterm/js/hterm_options.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * @fileoverview This file implements the hterm.Options class,\n * which stores current operating conditions for the terminal. This object is\n * used instead of a series of parameters to allow saving/restoring of cursor\n * conditions easily, and to provide an easy place for common configuration\n * options.\n *\n * Original code by Cory Maccarrone.\n */\n\n/**\n * Constructor for the hterm.Options class, optionally acting as a copy\n * constructor.\n *\n * The defaults are as defined in http://www.vt100.net/docs/vt510-rm/DECSTR\n * except that we enable autowrap (wraparound) by default since that seems to\n * be what xterm does.\n *\n * @param {hterm.Options=} opt_copy Optional instance to copy.\n * @constructor\n */\nhterm.Options = function(opt_copy) {\n // All attributes in this class are public to allow easy access by the\n // terminal.\n\n this.wraparound = opt_copy ? opt_copy.wraparound : true;\n this.reverseWraparound = opt_copy ? opt_copy.reverseWraparound : false;\n this.originMode = opt_copy ? opt_copy.originMode : false;\n this.autoCarriageReturn = opt_copy ? opt_copy.autoCarriageReturn : false;\n this.cursorVisible = opt_copy ? opt_copy.cursorVisible : false;\n this.cursorBlink = opt_copy ? opt_copy.cursorBlink : false;\n this.insertMode = opt_copy ? opt_copy.insertMode : false;\n this.reverseVideo = opt_copy ? opt_copy.reverseVideo : false;\n this.bracketedPaste = opt_copy ? opt_copy.bracketedPaste : false;\n};\n// SOURCE FILE: hterm/js/hterm_parser.js\n// Copyright (c) 2015 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('hterm.Keyboard.KeyActions');\n\n/**\n * @constructor\n * Parses the key definition syntax used for user keyboard customizations.\n */\nhterm.Parser = function() {\n /**\n * @type {string} The source string.\n */\n this.source = '';\n\n /**\n * @type {number} The current position.\n */\n this.pos = 0;\n\n /**\n * @type {string?} The character at the current position.\n */\n this.ch = null;\n};\n\nhterm.Parser.prototype.error = function(message) {\n return new Error('Parse error at ' + this.pos + ': ' + message);\n};\n\nhterm.Parser.prototype.isComplete = function() {\n return this.pos == this.source.length;\n};\n\nhterm.Parser.prototype.reset = function(source, opt_pos) {\n this.source = source;\n this.pos = opt_pos || 0;\n this.ch = source.substr(0, 1);\n};\n\n/**\n * Parse a key sequence.\n *\n * A key sequence is zero or more of the key modifiers defined in\n * hterm.Parser.identifiers.modifierKeys followed by a key code. Key\n * codes can be an integer or an identifier from\n * hterm.Parser.identifiers.keyCodes. Modifiers and keyCodes should be joined\n * by the dash character.\n *\n * An asterisk \"*\" can be used to indicate that the unspecified modifiers\n * are optional.\n *\n * For example:\n * A: Matches only an unmodified \"A\" character.\n * 65: Same as above.\n * 0x41: Same as above.\n * Ctrl-A: Matches only Ctrl-A.\n * Ctrl-65: Same as above.\n * Ctrl-0x41: Same as above.\n * Ctrl-Shift-A: Matches only Ctrl-Shift-A.\n * Ctrl-*-A: Matches Ctrl-A, as well as any other key sequence that includes\n * at least the Ctrl and A keys.\n *\n * @return {Object} An object with shift, ctrl, alt, meta, keyCode\n * properties.\n */\nhterm.Parser.prototype.parseKeySequence = function() {\n var rv = {\n keyCode: null\n };\n\n for (var k in hterm.Parser.identifiers.modifierKeys) {\n rv[hterm.Parser.identifiers.modifierKeys[k]] = false;\n }\n\n while (this.pos < this.source.length) {\n this.skipSpace();\n\n var token = this.parseToken();\n if (token.type == 'integer') {\n rv.keyCode = token.value;\n\n } else if (token.type == 'identifier') {\n var ucValue = token.value.toUpperCase();\n if (ucValue in hterm.Parser.identifiers.modifierKeys &&\n hterm.Parser.identifiers.modifierKeys.hasOwnProperty(ucValue)) {\n var mod = hterm.Parser.identifiers.modifierKeys[ucValue];\n if (rv[mod] && rv[mod] != '*')\n throw this.error('Duplicate modifier: ' + token.value);\n rv[mod] = true;\n\n } else if (ucValue in hterm.Parser.identifiers.keyCodes &&\n hterm.Parser.identifiers.keyCodes.hasOwnProperty(ucValue)) {\n rv.keyCode = hterm.Parser.identifiers.keyCodes[ucValue];\n\n } else {\n throw this.error('Unknown key: ' + token.value);\n }\n\n } else if (token.type == 'symbol') {\n if (token.value == '*') {\n for (var id in hterm.Parser.identifiers.modifierKeys) {\n var p = hterm.Parser.identifiers.modifierKeys[id];\n if (!rv[p])\n rv[p] = '*';\n }\n } else {\n throw this.error('Unexpected symbol: ' + token.value);\n }\n } else {\n throw this.error('Expected integer or identifier');\n }\n\n this.skipSpace();\n\n if (this.ch != '-')\n break;\n\n if (rv.keyCode != null)\n throw this.error('Extra definition after target key');\n\n this.advance(1);\n }\n\n if (rv.keyCode == null)\n throw this.error('Missing target key');\n\n return rv;\n};\n\nhterm.Parser.prototype.parseKeyAction = function() {\n this.skipSpace();\n\n var token = this.parseToken();\n\n if (token.type == 'string')\n return token.value;\n\n if (token.type == 'identifier') {\n if (token.value in hterm.Parser.identifiers.actions &&\n hterm.Parser.identifiers.actions.hasOwnProperty(token.value))\n return hterm.Parser.identifiers.actions[token.value];\n\n throw this.error('Unknown key action: ' + token.value);\n }\n\n throw this.error('Expected string or identifier');\n\n};\n\nhterm.Parser.prototype.peekString = function() {\n return this.ch == '\\'' || this.ch == '\"';\n};\n\nhterm.Parser.prototype.peekIdentifier = function() {\n return this.ch.match(/[a-z_]/i);\n};\n\nhterm.Parser.prototype.peekInteger = function() {\n return this.ch.match(/[0-9]/);\n};\n\nhterm.Parser.prototype.parseToken = function() {\n if (this.ch == '*') {\n var rv = {type: 'symbol', value: this.ch};\n this.advance(1);\n return rv;\n }\n\n if (this.peekIdentifier())\n return {type: 'identifier', value: this.parseIdentifier()};\n\n if (this.peekString())\n return {type: 'string', value: this.parseString()};\n\n if (this.peekInteger())\n return {type: 'integer', value: this.parseInteger()};\n\n\n throw this.error('Unexpected token');\n};\n\nhterm.Parser.prototype.parseIdentifier = function() {\n if (!this.peekIdentifier())\n throw this.error('Expected identifier');\n\n return this.parsePattern(/[a-z0-9_]+/ig);\n};\n\nhterm.Parser.prototype.parseInteger = function() {\n var base = 10;\n\n if (this.ch == '0' && this.pos < this.source.length - 1 &&\n this.source.substr(this.pos + 1, 1) == 'x') {\n return parseInt(this.parsePattern(/0x[0-9a-f]+/gi));\n }\n\n return parseInt(this.parsePattern(/\\d+/g));\n};\n\n/**\n * Parse a single or double quoted string.\n *\n * The current position should point at the initial quote character. Single\n * quoted strings will be treated literally, double quoted will process escapes.\n *\n * TODO(rginda): Variable interpolation.\n *\n * @param {ParseState} parseState\n * @param {string} quote A single or double-quote character.\n * @return {string}\n */\nhterm.Parser.prototype.parseString = function() {\n var result = '';\n\n var quote = this.ch;\n if (quote != '\"' && quote != '\\'')\n throw this.error('String expected');\n\n this.advance(1);\n\n var re = new RegExp('[\\\\\\\\' + quote + ']', 'g');\n\n while (this.pos < this.source.length) {\n re.lastIndex = this.pos;\n if (!re.exec(this.source))\n throw this.error('Unterminated string literal');\n\n result += this.source.substring(this.pos, re.lastIndex - 1);\n\n this.advance(re.lastIndex - this.pos - 1);\n\n if (quote == '\"' && this.ch == '\\\\') {\n this.advance(1);\n result += this.parseEscape();\n continue;\n }\n\n if (quote == '\\'' && this.ch == '\\\\') {\n result += this.ch;\n this.advance(1);\n continue;\n }\n\n if (this.ch == quote) {\n this.advance(1);\n return result;\n }\n }\n\n throw this.error('Unterminated string literal');\n};\n\n\n/**\n * Parse an escape code from the current position (which should point to\n * the first character AFTER the leading backslash.)\n *\n * @return {string}\n */\nhterm.Parser.prototype.parseEscape = function() {\n var map = {\n '\"': '\"',\n '\\'': '\\'',\n '\\\\': '\\\\',\n 'a': '\\x07',\n 'b': '\\x08',\n 'e': '\\x1b',\n 'f': '\\x0c',\n 'n': '\\x0a',\n 'r': '\\x0d',\n 't': '\\x09',\n 'v': '\\x0b',\n 'x': function() {\n var value = this.parsePattern(/[a-z0-9]{2}/ig);\n return String.fromCharCode(parseInt(value, 16));\n },\n 'u': function() {\n var value = this.parsePattern(/[a-z0-9]{4}/ig);\n return String.fromCharCode(parseInt(value, 16));\n }\n };\n\n if (!(this.ch in map && map.hasOwnProperty(this.ch)))\n throw this.error('Unknown escape: ' + this.ch);\n\n var value = map[this.ch];\n this.advance(1);\n\n if (typeof value == 'function')\n value = value.call(this);\n\n return value;\n};\n\n/**\n * Parse the given pattern starting from the current position.\n *\n * @param {RegExp} pattern A pattern representing the characters to span. MUST\n * include the \"global\" RegExp flag.\n * @return {string}\n */\nhterm.Parser.prototype.parsePattern = function(pattern) {\n if (!pattern.global)\n throw this.error('Internal error: Span patterns must be global');\n\n pattern.lastIndex = this.pos;\n var ary = pattern.exec(this.source);\n\n if (!ary || pattern.lastIndex - ary[0].length != this.pos)\n throw this.error('Expected match for: ' + pattern);\n\n this.pos = pattern.lastIndex - 1;\n this.advance(1);\n\n return ary[0];\n};\n\n\n/**\n * Advance the current position.\n *\n * @param {number} count\n */\nhterm.Parser.prototype.advance = function(count) {\n this.pos += count;\n this.ch = this.source.substr(this.pos, 1);\n};\n\n/**\n * @param {string=} opt_expect A list of valid non-whitespace characters to\n * terminate on.\n * @return {void}\n */\nhterm.Parser.prototype.skipSpace = function(opt_expect) {\n if (!/\\s/.test(this.ch))\n return;\n\n var re = /\\s+/gm;\n re.lastIndex = this.pos;\n\n var source = this.source;\n if (re.exec(source))\n this.pos = re.lastIndex;\n\n this.ch = this.source.substr(this.pos, 1);\n\n if (opt_expect) {\n if (this.ch.indexOf(opt_expect) == -1) {\n throw this.error('Expected one of ' + opt_expect + ', found: ' +\n this.ch);\n }\n }\n};\n// SOURCE FILE: hterm/js/hterm_parser_identifiers.js\n// Copyright (c) 2015 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Collections of identifier for hterm.Parser.\n */\nhterm.Parser.identifiers = {};\n\n/**\n * Modifier key names used when defining key sequences.\n *\n * These are upper case so we can normalize the user input and be forgiving.\n * \"CTRL-A\" and \"Ctrl-A\" and \"ctrl-a\" are all accepted.\n *\n * Note: Names here cannot overlap with hterm.Parser.identifiers.keyCodes.\n */\nhterm.Parser.identifiers.modifierKeys = {\n SHIFT: 'shift',\n CTRL: 'ctrl',\n // Common alias.\n CONTROL: 'ctrl',\n ALT: 'alt',\n META: 'meta'\n};\n\n/**\n * Key codes useful when defining key sequences.\n *\n * Punctuation is mostly left out of this list because they can move around\n * based on keyboard locale and browser.\n *\n * In a key sequence like \"Ctrl-ESC\", the ESC comes from this list of\n * identifiers. It is equivalent to \"Ctrl-27\" and \"Ctrl-0x1b\".\n *\n * These are upper case so we can normalize the user input and be forgiving.\n * \"Ctrl-ESC\" and \"Ctrl-Esc\" an \"Ctrl-esc\" are all accepted.\n *\n * We also include common aliases for the same key. \"Esc\" and \"Escape\" are the\n * same key.\n *\n * Note: Names here cannot overlap with hterm.Parser.identifiers.modifierKeys.\n */\nhterm.Parser.identifiers.keyCodes = {\n // Top row.\n ESCAPE: 27,\n ESC: 27,\n F1: 112,\n F2: 113,\n F3: 114,\n F4: 115,\n F5: 116,\n F6: 117,\n F7: 118,\n F8: 119,\n F9: 120,\n F10: 121,\n F11: 122,\n F12: 123,\n\n // Row two.\n ONE: 49,\n TWO: 50,\n THREE: 51,\n FOUR: 52,\n FIVE: 53,\n SIX: 54,\n SEVEN: 55,\n EIGHT: 56,\n NINE: 57,\n ZERO: 48,\n BACKSPACE: 8,\n BKSP: 8,\n BS: 8,\n\n // Row three.\n TAB: 9,\n Q: 81,\n W: 87,\n E: 69,\n R: 82,\n T: 84,\n Y: 89,\n U: 85,\n I: 73,\n O: 79,\n P: 80,\n\n // Row four.\n CAPS_LOCK: 20,\n CAPSLOCK: 20,\n CAPS: 20,\n A: 65,\n S: 83,\n D: 68,\n F: 70,\n G: 71,\n H: 72,\n J: 74,\n K: 75,\n L: 76,\n // We map enter and return together even though enter should really be 10\n // because most people don't know or care about the history here. Plus,\n // most keyboards/programs map them together already. If they really want\n // to bind them differently, they can also use the numeric value.\n ENTER: 13,\n ENT: 13,\n RETURN: 13,\n RET: 13,\n\n // Row five.\n Z: 90,\n X: 88,\n C: 67,\n V: 86,\n B: 66,\n N: 78,\n M: 77,\n\n // Etc.\n SPACE: 32,\n SP: 32,\n PRINT_SCREEN: 42,\n PRTSC: 42,\n SCROLL_LOCK: 145,\n SCRLK: 145,\n BREAK: 19,\n BRK: 19,\n INSERT: 45,\n INS: 45,\n HOME: 36,\n PAGE_UP: 33,\n PGUP: 33,\n DELETE: 46,\n DEL: 46,\n END: 35,\n PAGE_DOWN: 34,\n PGDOWN: 34,\n PGDN: 34,\n UP: 38,\n DOWN: 40,\n RIGHT: 39,\n LEFT: 37,\n NUMLOCK: 144,\n\n // Keypad\n KP0: 96,\n KP1: 97,\n KP2: 98,\n KP3: 99,\n KP4: 100,\n KP5: 101,\n KP6: 102,\n KP7: 103,\n KP8: 104,\n KP9: 105,\n KP_PLUS: 107,\n KP_ADD: 107,\n KP_MINUS: 109,\n KP_SUBTRACT: 109,\n KP_STAR: 106,\n KP_MULTIPLY: 106,\n KP_DIVIDE: 111,\n KP_DECIMAL: 110,\n KP_PERIOD: 110,\n\n // Chrome OS media keys\n NAVIGATE_BACK: 166,\n NAVIGATE_FORWARD: 167,\n RELOAD: 168,\n FULL_SCREEN: 183,\n WINDOW_OVERVIEW: 182,\n BRIGHTNESS_UP: 216,\n BRIGHTNESS_DOWN: 217\n};\n\n/**\n * Identifiers for use in key actions.\n */\nhterm.Parser.identifiers.actions = {\n /**\n * Prevent the browser and operating system from handling the event.\n */\n CANCEL: hterm.Keyboard.KeyActions.CANCEL,\n\n /**\n * Wait for a \"keypress\" event, send the keypress charCode to the host.\n */\n DEFAULT: hterm.Keyboard.KeyActions.DEFAULT,\n\n /**\n * Let the browser or operating system handle the key.\n */\n PASS: hterm.Keyboard.KeyActions.PASS,\n\n /**\n * Scroll the terminal one page up.\n */\n scrollPageUp: function(terminal) {\n terminal.scrollPageUp();\n return hterm.Keyboard.KeyActions.CANCEL;\n },\n\n /**\n * Scroll the terminal one page down.\n */\n scrollPageDown: function(terminal) {\n terminal.scrollPageDown();\n return hterm.Keyboard.KeyActions.CANCEL;\n },\n\n /**\n * Scroll the terminal to the top.\n */\n scrollToTop: function(terminal) {\n terminal.scrollEnd();\n return hterm.Keyboard.KeyActions.CANCEL;\n },\n\n /**\n * Scroll the terminal to the bottom.\n */\n scrollToBottom: function(terminal) {\n terminal.scrollEnd();\n return hterm.Keyboard.KeyActions.CANCEL;\n },\n\n /**\n * Clear the terminal and scrollback buffer.\n */\n clearScrollback: function(terminal) {\n terminal.wipeContents();\n return hterm.Keyboard.KeyActions.CANCEL;\n }\n};\n// SOURCE FILE: hterm/js/hterm_preference_manager.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f', 'lib.Storage');\n\n/**\n * PreferenceManager subclass managing global NaSSH preferences.\n *\n * This is currently just an ordered list of known connection profiles.\n */\nhterm.PreferenceManager = function(profileId) {\n lib.PreferenceManager.call(this, hterm.defaultStorage,\n '/hterm/profiles/' + profileId);\n var defs = hterm.PreferenceManager.defaultPreferences;\n Object.keys(defs).forEach(function(key) {\n this.definePreference(key, defs[key][1]);\n }.bind(this));\n};\n\nhterm.PreferenceManager.categories = {};\nhterm.PreferenceManager.categories.Keyboard = 'Keyboard';\nhterm.PreferenceManager.categories.Appearance = 'Appearance';\nhterm.PreferenceManager.categories.CopyPaste = 'CopyPaste';\nhterm.PreferenceManager.categories.Sounds = 'Sounds';\nhterm.PreferenceManager.categories.Scrolling = 'Scrolling';\nhterm.PreferenceManager.categories.Encoding = 'Encoding';\nhterm.PreferenceManager.categories.Miscellaneous = 'Miscellaneous';\n\n/**\n * List of categories, ordered by display order (top to bottom)\n */\nhterm.PreferenceManager.categoryDefinitions = [\n { id: hterm.PreferenceManager.categories.Appearance,\n text: 'Appearance (fonts, colors, images)'},\n { id: hterm.PreferenceManager.categories.CopyPaste,\n text: 'Copy & Paste'},\n { id: hterm.PreferenceManager.categories.Encoding,\n text: 'Encoding'},\n { id: hterm.PreferenceManager.categories.Keyboard,\n text: 'Keyboard'},\n { id: hterm.PreferenceManager.categories.Scrolling,\n text: 'Scrolling'},\n { id: hterm.PreferenceManager.categories.Sounds,\n text: 'Sounds'},\n { id: hterm.PreferenceManager.categories.Miscellaneous,\n text: 'Misc.'}\n];\n\n\nhterm.PreferenceManager.defaultPreferences = {\n 'alt-gr-mode':\n [hterm.PreferenceManager.categories.Keyboard, null,\n [null, 'none', 'ctrl-alt', 'left-alt', 'right-alt'],\n 'Select an AltGr detection hack^Wheuristic.\\n' +\n '\\n' +\n '\\'null\\': Autodetect based on navigator.language:\\n' +\n ' \\'en-us\\' => \\'none\\', else => \\'right-alt\\'\\n' +\n '\\'none\\': Disable any AltGr related munging.\\n' +\n '\\'ctrl-alt\\': Assume Ctrl+Alt means AltGr.\\n' +\n '\\'left-alt\\': Assume left Alt means AltGr.\\n' +\n '\\'right-alt\\': Assume right Alt means AltGr.\\n'],\n\n 'alt-backspace-is-meta-backspace':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If set, undoes the Chrome OS Alt-Backspace->DEL remap, so that ' +\n 'alt-backspace indeed is alt-backspace.'],\n\n 'alt-is-meta':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'Set whether the alt key acts as a meta key or as a distinct alt key.'],\n\n 'alt-sends-what':\n [hterm.PreferenceManager.categories.Keyboard, 'escape',\n ['escape', '8-bit', 'browser-key'],\n 'Controls how the alt key is handled.\\n' +\n '\\n' +\n ' escape....... Send an ESC prefix.\\n' +\n ' 8-bit........ Add 128 to the unshifted character as in xterm.\\n' +\n ' browser-key.. Wait for the keypress event and see what the browser \\n' +\n ' says. (This won\\'t work well on platforms where the \\n' +\n ' browser performs a default action for some alt sequences.)'\n ],\n\n 'audible-bell-sound':\n [hterm.PreferenceManager.categories.Sounds, 'lib-resource:hterm/audio/bell',\n 'url',\n 'URL of the terminal bell sound. Empty string for no audible bell.'],\n\n 'desktop-notification-bell':\n [hterm.PreferenceManager.categories.Sounds, false, 'bool',\n 'If true, terminal bells in the background will create a Web ' +\n 'Notification. https://www.w3.org/TR/notifications/\\n' +\n '\\n'+\n 'Displaying notifications requires permission from the user. When this ' +\n 'option is set to true, hterm will attempt to ask the user for permission ' +\n 'if necessary. Note browsers may not show this permission request if it ' +\n 'did not originate from a user action.\\n' +\n '\\n' +\n 'Chrome extensions with the \"notifications\" permission have permission to ' +\n 'display notifications.'],\n\n 'background-color':\n [hterm.PreferenceManager.categories.Appearance, 'rgb(16, 16, 16)', 'color',\n 'The background color for text with no other color attributes.'],\n\n 'background-image':\n [hterm.PreferenceManager.categories.Appearance, '', 'string',\n 'CSS value of the background image. Empty string for no image.\\n' +\n '\\n' +\n 'For example:\\n' +\n ' url(https://goo.gl/anedTK)\\n' +\n ' linear-gradient(top bottom, blue, red)'],\n\n 'background-size':\n [hterm.PreferenceManager.categories.Appearance, '', 'string',\n 'CSS value of the background image size. Defaults to none.'],\n\n 'background-position':\n [hterm.PreferenceManager.categories.Appearance, '', 'string',\n 'CSS value of the background image position.\\n' +\n '\\n' +\n 'For example:\\n' +\n ' 10% 10%\\n' +\n ' center'],\n\n 'backspace-sends-backspace':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If true, the backspace should send BS (\\'\\\\x08\\', aka ^H). Otherwise ' +\n 'the backspace key should send \\'\\\\x7f\\'.'],\n\n 'character-map-overrides':\n [hterm.PreferenceManager.categories.Appearance, null, 'value',\n 'This is specified as an object. It is a sparse array, where each ' +\n 'property is the character set code and the value is an object that is ' +\n 'a sparse array itself. In that sparse array, each property is the ' +\n 'received character and the value is the displayed character.\\n' +\n '\\n' +\n 'For example:\\n' +\n ' {\"0\":{\"+\":\"\\\\u2192\",\",\":\"\\\\u2190\",\"-\":\"\\\\u2191\",\".\":\"\\\\u2193\", ' +\n '\"0\":\"\\\\u2588\"}}'\n ],\n\n 'close-on-exit':\n [hterm.PreferenceManager.categories.Miscellaneous, true, 'bool',\n 'Whether or not to close the window when the command exits.'],\n\n 'cursor-blink':\n [hterm.PreferenceManager.categories.Appearance, false, 'bool',\n 'Whether or not to blink the cursor by default.'],\n\n 'cursor-blink-cycle':\n [hterm.PreferenceManager.categories.Appearance, [1000, 500], 'value',\n 'The cursor blink rate in milliseconds.\\n' +\n '\\n' +\n 'A two element array, the first of which is how long the cursor should be ' +\n 'on, second is how long it should be off.'],\n\n 'cursor-color':\n [hterm.PreferenceManager.categories.Appearance, 'rgba(255, 0, 0, 0.5)',\n 'color',\n 'The color of the visible cursor.'],\n\n 'color-palette-overrides':\n [hterm.PreferenceManager.categories.Appearance, null, 'value',\n 'Override colors in the default palette.\\n' +\n '\\n' +\n 'This can be specified as an array or an object. If specified as an ' +\n 'object it is assumed to be a sparse array, where each property ' +\n 'is a numeric index into the color palette.\\n' +\n '\\n' +\n 'Values can be specified as almost any css color value. This ' +\n 'includes #RGB, #RRGGBB, rgb(...), rgba(...), and any color names ' +\n 'that are also part of the stock X11 rgb.txt file.\\n' +\n '\\n' +\n 'You can use \\'null\\' to specify that the default value should be not ' +\n 'be changed. This is useful for skipping a small number of indices ' +\n 'when the value is specified as an array.'],\n\n 'copy-on-select':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Automatically copy mouse selection to the clipboard.'],\n\n 'use-default-window-copy':\n [hterm.PreferenceManager.categories.CopyPaste, false, 'bool',\n 'Whether to use the default window copy behavior'],\n\n 'clear-selection-after-copy':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Whether to clear the selection after copying.'],\n\n 'ctrl-plus-minus-zero-zoom':\n [hterm.PreferenceManager.categories.Keyboard, true, 'bool',\n 'If true, Ctrl-Plus/Minus/Zero controls zoom.\\n' +\n 'If false, Ctrl-Shift-Plus/Minus/Zero controls zoom, Ctrl-Minus sends ^_, ' +\n 'Ctrl-Plus/Zero do nothing.'],\n\n 'ctrl-c-copy':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'Ctrl+C copies if true, send ^C to host if false.\\n' +\n 'Ctrl+Shift+C sends ^C to host if true, copies if false.'],\n\n 'ctrl-v-paste':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'Ctrl+V pastes if true, send ^V to host if false.\\n' +\n 'Ctrl+Shift+V sends ^V to host if true, pastes if false.'],\n\n 'east-asian-ambiguous-as-two-column':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'Set whether East Asian Ambiguous characters have two column width.'],\n\n 'enable-8-bit-control':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'True to enable 8-bit control characters, false to ignore them.\\n' +\n '\\n' +\n 'We\\'ll respect the two-byte versions of these control characters ' +\n 'regardless of this setting.'],\n\n 'enable-bold':\n [hterm.PreferenceManager.categories.Appearance, null, 'tristate',\n 'True if we should use bold weight font for text with the bold/bright ' +\n 'attribute. False to use the normal weight font. Null to autodetect.'],\n\n 'enable-bold-as-bright':\n [hterm.PreferenceManager.categories.Appearance, true, 'bool',\n 'True if we should use bright colors (8-15 on a 16 color palette) ' +\n 'for any text with the bold attribute. False otherwise.'],\n\n 'enable-blink':\n [hterm.PreferenceManager.categories.Appearance, true, 'bool',\n 'True if we should respect the blink attribute. False to ignore it. '],\n\n 'enable-clipboard-notice':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Show a message in the terminal when the host writes to the clipboard.'],\n\n 'enable-clipboard-write':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Allow the host to write directly to the system clipboard.'],\n\n 'enable-dec12':\n [hterm.PreferenceManager.categories.Miscellaneous, false, 'bool',\n 'Respect the host\\'s attempt to change the cursor blink status using ' +\n 'DEC Private Mode 12.'],\n\n 'environment':\n [hterm.PreferenceManager.categories.Miscellaneous, {'TERM': 'xterm-256color'},\n 'value',\n 'The default environment variables, as an object.'],\n\n 'font-family':\n [hterm.PreferenceManager.categories.Appearance,\n '\"DejaVu Sans Mono\", \"Everson Mono\", FreeMono, \"Menlo\", \"Terminal\", ' +\n 'monospace', 'string',\n 'Default font family for the terminal text.'],\n\n 'font-size':\n [hterm.PreferenceManager.categories.Appearance, 15, 'int',\n 'The default font size in pixels.'],\n\n 'font-smoothing':\n [hterm.PreferenceManager.categories.Appearance, 'antialiased', 'string',\n 'CSS font-smoothing property.'],\n\n 'foreground-color':\n [hterm.PreferenceManager.categories.Appearance, 'rgb(240, 240, 240)', 'color',\n 'The foreground color for text with no other color attributes.'],\n\n 'home-keys-scroll':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If true, home/end will control the terminal scrollbar and shift home/end ' +\n 'will send the VT keycodes. If false then home/end sends VT codes and ' +\n 'shift home/end scrolls.'],\n\n 'keybindings':\n [hterm.PreferenceManager.categories.Keyboard, null, 'value',\n 'A map of key sequence to key actions. Key sequences include zero or ' +\n 'more modifier keys followed by a key code. Key codes can be decimal or ' +\n 'hexadecimal numbers, or a key identifier. Key actions can be specified ' +\n 'a string to send to the host, or an action identifier. For a full ' +\n 'explanation of the format, see https://goo.gl/LWRndr.\\n' +\n '\\n' +\n 'Sample keybindings:\\n' +\n '{\\n' +\n ' \"Ctrl-Alt-K\": \"clearScrollback\",\\n' +\n ' \"Ctrl-Shift-L\": \"PASS\",\\n' +\n ' \"Ctrl-H\": \"\\'HELLO\\\\n\\'\"\\n' +\n '}'],\n\n 'max-string-sequence':\n [hterm.PreferenceManager.categories.Encoding, 100000, 'int',\n 'Max length of a DCS, OSC, PM, or APS sequence before we give up and ' +\n 'ignore the code.'],\n\n 'media-keys-are-fkeys':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If true, convert media keys to their Fkey equivalent. If false, let ' +\n 'the browser handle the keys.'],\n\n 'meta-sends-escape':\n [hterm.PreferenceManager.categories.Keyboard, true, 'bool',\n 'Set whether the meta key sends a leading escape or not.'],\n\n 'mouse-right-click-paste':\n [hterm.PreferenceManager.categories.CopyPaste, true, 'bool',\n 'Paste on right mouse button clicks.\\n' +\n '\\n' +\n 'This option is activate independent of the \"mouse-paste-button\" ' +\n 'setting.\\n' +\n '\\n' +\n 'Note: This will handle left & right handed mice correctly.'],\n\n 'mouse-paste-button':\n [hterm.PreferenceManager.categories.CopyPaste, null,\n [null, 0, 1, 2, 3, 4, 5, 6],\n 'Mouse paste button, or null to autodetect.\\n' +\n '\\n' +\n 'For autodetect, we\\'ll use the middle mouse button for non-X11 ' +\n 'platforms (including Chrome OS). On X11, we\\'ll use the right mouse ' +\n 'button (since the native window manager should paste via the middle ' +\n 'mouse button).\\n' +\n '\\n' +\n '0 == left (primary) button.\\n' +\n '1 == middle (auxiliary) button.\\n' +\n '2 == right (secondary) button.\\n' +\n '\\n' +\n 'This option is activate independent of the \"mouse-right-click-paste\" ' +\n 'setting.\\n' +\n '\\n' +\n 'Note: This will handle left & right handed mice correctly.'],\n\n 'word-break-match-left':\n [hterm.PreferenceManager.categories.CopyPaste,\n '[^\\\\s\\\\[\\\\](){}<>\"\\'\\\\^!@#$%&*,;:`]', 'string',\n 'Regular expression to halt matching to the left (start) of a selection.\\n' +\n '\\n' +\n 'Normally this is a character class to reject specific characters.\\n' +\n 'We allow \"~\" and \".\" by default as paths frequently start with those.'],\n\n 'word-break-match-right':\n [hterm.PreferenceManager.categories.CopyPaste,\n '[^\\\\s\\\\[\\\\](){}<>\"\\'\\\\^!@#$%&*,;:~.`]', 'string',\n 'Regular expression to halt matching to the right (end) of a selection.\\n' +\n '\\n' +\n 'Normally this is a character class to reject specific characters.'],\n\n 'word-break-match-middle':\n [hterm.PreferenceManager.categories.CopyPaste,\n '[^\\\\s\\\\[\\\\](){}<>\"\\'\\\\^]*', 'string',\n 'Regular expression to match all the characters in the middle.\\n' +\n '\\n' +\n 'Normally this is a character class to reject specific characters.\\n' +\n '\\n' +\n 'Used to expand the selection surrounding the starting point.'],\n\n 'page-keys-scroll':\n [hterm.PreferenceManager.categories.Keyboard, false, 'bool',\n 'If true, page up/down will control the terminal scrollbar and shift ' +\n 'page up/down will send the VT keycodes. If false then page up/down ' +\n 'sends VT codes and shift page up/down scrolls.'],\n\n 'pass-alt-number':\n [hterm.PreferenceManager.categories.Keyboard, null, 'tristate',\n 'Set whether we should pass Alt-1..9 to the browser.\\n' +\n '\\n' +\n 'This is handy when running hterm in a browser tab, so that you don\\'t ' +\n 'lose Chrome\\'s \"switch to tab\" keyboard accelerators. When not running ' +\n 'in a tab it\\'s better to send these keys to the host so they can be ' +\n 'used in vim or emacs.\\n' +\n '\\n' +\n 'If true, Alt-1..9 will be handled by the browser. If false, Alt-1..9 ' +\n 'will be sent to the host. If null, autodetect based on browser platform ' +\n 'and window type.'],\n\n 'pass-ctrl-number':\n [hterm.PreferenceManager.categories.Keyboard, null, 'tristate',\n 'Set whether we should pass Ctrl-1..9 to the browser.\\n' +\n '\\n' +\n 'This is handy when running hterm in a browser tab, so that you don\\'t ' +\n 'lose Chrome\\'s \"switch to tab\" keyboard accelerators. When not running ' +\n 'in a tab it\\'s better to send these keys to the host so they can be ' +\n 'used in vim or emacs.\\n' +\n '\\n' +\n 'If true, Ctrl-1..9 will be handled by the browser. If false, Ctrl-1..9 ' +\n 'will be sent to the host. If null, autodetect based on browser platform ' +\n 'and window type.'],\n\n 'pass-meta-number':\n [hterm.PreferenceManager.categories.Keyboard, null, 'tristate',\n 'Set whether we should pass Meta-1..9 to the browser.\\n' +\n '\\n' +\n 'This is handy when running hterm in a browser tab, so that you don\\'t ' +\n 'lose Chrome\\'s \"switch to tab\" keyboard accelerators. When not running ' +\n 'in a tab it\\'s better to send these keys to the host so they can be ' +\n 'used in vim or emacs.\\n' +\n '\\n' +\n 'If true, Meta-1..9 will be handled by the browser. If false, Meta-1..9 ' +\n 'will be sent to the host. If null, autodetect based on browser platform ' +\n 'and window type.'],\n\n 'pass-meta-v':\n [hterm.PreferenceManager.categories.Keyboard, true, 'bool',\n 'Set whether meta-V gets passed to host.'],\n\n 'receive-encoding':\n [hterm.PreferenceManager.categories.Encoding, 'utf-8', ['utf-8', 'raw'],\n 'Set the expected encoding for data received from the host.\\n' +\n '\\n' +\n 'Valid values are \\'utf-8\\' and \\'raw\\'.'],\n\n 'scroll-on-keystroke':\n [hterm.PreferenceManager.categories.Scrolling, true, 'bool',\n 'If true, scroll to the bottom on any keystroke.'],\n\n 'scroll-on-output':\n [hterm.PreferenceManager.categories.Scrolling, false, 'bool',\n 'If true, scroll to the bottom on terminal output.'],\n\n 'scrollbar-visible':\n [hterm.PreferenceManager.categories.Scrolling, true, 'bool',\n 'The vertical scrollbar mode.'],\n\n 'scroll-wheel-may-send-arrow-keys':\n [hterm.PreferenceManager.categories.Scrolling, false, 'bool',\n 'When using the alternative screen buffer, and DECCKM (Application Cursor ' +\n 'Keys) is active, mouse wheel scroll events will emulate arrow keys.\\n' +\n '\\n' +\n 'It can be temporarily disabled by holding the shift key.\\n' +\n '\\n' +\n 'This frequently comes up when using pagers (less) or reading man pages ' +\n 'or text editors (vi/nano) or using screen/tmux.'],\n\n 'scroll-wheel-move-multiplier':\n [hterm.PreferenceManager.categories.Scrolling, 1, 'int',\n 'The multiplier for the pixel delta in wheel events caused by the ' +\n 'scroll wheel. Alters how fast the page scrolls.'],\n\n 'send-encoding':\n [hterm.PreferenceManager.categories.Encoding, 'utf-8', ['utf-8', 'raw'],\n 'Set the encoding for data sent to host.'],\n\n 'terminal-encoding':\n [hterm.PreferenceManager.categories.Encoding, 'iso-2022',\n ['iso-2022', 'utf-8', 'utf-8-locked'],\n 'The default terminal encoding (DOCS).\\n' +\n '\\n' +\n 'ISO-2022 enables character map translations (like graphics maps).\\n' +\n 'UTF-8 disables support for those.\\n' +\n '\\n' +\n 'The locked variant means the encoding cannot be changed at runtime ' +\n 'via terminal escape sequences.\\n' +\n '\\n' +\n 'You should stick with UTF-8 unless you notice broken rendering with ' +\n 'legacy applications.'],\n\n 'shift-insert-paste':\n [hterm.PreferenceManager.categories.Keyboard, true, 'bool',\n 'Shift + Insert pastes if true, sent to host if false.'],\n\n 'user-css':\n [hterm.PreferenceManager.categories.Appearance, '', 'url',\n 'URL of user stylesheet to include in the terminal document.'],\n\n 'user-css-text':\n [hterm.PreferenceManager.categories.Appearance, '', 'multiline-string',\n 'Custom CSS text for styling the terminal.'],\n};\n\nhterm.PreferenceManager.prototype =\n Object.create(lib.PreferenceManager.prototype);\nhterm.PreferenceManager.constructor = hterm.PreferenceManager;\n// SOURCE FILE: hterm/js/hterm_pubsub.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\n/**\n * Utility class used to add publish/subscribe/unsubscribe functionality to\n * an existing object.\n */\nhterm.PubSub = function() {\n this.observers_ = {};\n};\n\n/**\n * Add publish, subscribe, and unsubscribe methods to an existing object.\n *\n * No other properties of the object are touched, so there is no need to\n * worry about clashing private properties.\n *\n * @param {Object} obj The object to add this behavior to.\n */\nhterm.PubSub.addBehavior = function(obj) {\n var pubsub = new hterm.PubSub();\n for (var m in hterm.PubSub.prototype) {\n obj[m] = hterm.PubSub.prototype[m].bind(pubsub);\n }\n};\n\n/**\n * Subscribe to be notified of messages about a subject.\n *\n * @param {string} subject The subject to subscribe to.\n * @param {function(Object)} callback The function to invoke for notifications.\n */\nhterm.PubSub.prototype.subscribe = function(subject, callback) {\n if (!(subject in this.observers_))\n this.observers_[subject] = [];\n\n this.observers_[subject].push(callback);\n};\n\n/**\n * Unsubscribe from a subject.\n *\n * @param {string} subject The subject to unsubscribe from.\n * @param {function(Object)} callback A callback previously registered via\n * subscribe().\n */\nhterm.PubSub.prototype.unsubscribe = function(subject, callback) {\n var list = this.observers_[subject];\n if (!list)\n throw 'Invalid subject: ' + subject;\n\n var i = list.indexOf(callback);\n if (i < 0)\n throw 'Not subscribed: ' + subject;\n\n list.splice(i, 1);\n};\n\n/**\n * Publish a message about a subject.\n *\n * Subscribers (and the optional final callback) are invoked asynchronously.\n * This method will return before anyone is actually notified.\n *\n * @param {string} subject The subject to publish about.\n * @param {Object} e An arbitrary object associated with this notification.\n * @param {function(Object)} opt_lastCallback An optional function to call after\n * all subscribers have been notified.\n */\nhterm.PubSub.prototype.publish = function(subject, e, opt_lastCallback) {\n function notifyList(i) {\n // Set this timeout before invoking the callback, so we don't have to\n // concern ourselves with exceptions.\n if (i < list.length - 1)\n setTimeout(notifyList, 0, i + 1);\n\n list[i](e);\n }\n\n var list = this.observers_[subject];\n if (list) {\n // Copy the list, in case it changes while we're notifying.\n list = [].concat(list);\n }\n\n if (opt_lastCallback) {\n if (list) {\n list.push(opt_lastCallback);\n } else {\n list = [opt_lastCallback];\n }\n }\n\n if (list)\n setTimeout(notifyList, 0, 0);\n};\n// SOURCE FILE: hterm/js/hterm_screen.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f', 'lib.wc',\n 'hterm.RowCol', 'hterm.Size', 'hterm.TextAttributes');\n\n/**\n * @fileoverview This class represents a single terminal screen full of text.\n *\n * It maintains the current cursor position and has basic methods for text\n * insert and overwrite, and adding or removing rows from the screen.\n *\n * This class has no knowledge of the scrollback buffer.\n *\n * The number of rows on the screen is determined only by the number of rows\n * that the caller inserts into the screen. If a caller wants to ensure a\n * constant number of rows on the screen, it's their responsibility to remove a\n * row for each row inserted.\n *\n * The screen width, in contrast, is enforced locally.\n *\n *\n * In practice...\n * - The hterm.Terminal class holds two hterm.Screen instances. One for the\n * primary screen and one for the alternate screen.\n *\n * - The html.Screen class only cares that rows are HTMLElements. In the\n * larger context of hterm, however, the rows happen to be displayed by an\n * hterm.ScrollPort and have to follow a few rules as a result. Each\n * row must be rooted by the custom HTML tag 'x-row', and each must have a\n * rowIndex property that corresponds to the index of the row in the context\n * of the scrollback buffer. These invariants are enforced by hterm.Terminal\n * because that is the class using the hterm.Screen in the context of an\n * hterm.ScrollPort.\n */\n\n/**\n * Create a new screen instance.\n *\n * The screen initially has no rows and a maximum column count of 0.\n *\n * @param {integer} opt_columnCount The maximum number of columns for this\n * screen. See insertString() and overwriteString() for information about\n * what happens when too many characters are added too a row. Defaults to\n * 0 if not provided.\n */\nhterm.Screen = function(opt_columnCount) {\n /**\n * Public, read-only access to the rows in this screen.\n */\n this.rowsArray = [];\n\n // The max column width for this screen.\n this.columnCount_ = opt_columnCount || 80;\n\n // The current color, bold, underline and blink attributes.\n this.textAttributes = new hterm.TextAttributes(window.document);\n\n // Current zero-based cursor coordinates.\n this.cursorPosition = new hterm.RowCol(0, 0);\n\n // The node containing the row that the cursor is positioned on.\n this.cursorRowNode_ = null;\n\n // The node containing the span of text that the cursor is positioned on.\n this.cursorNode_ = null;\n\n // The offset in column width into cursorNode_ where the cursor is positioned.\n this.cursorOffset_ = null;\n\n // Regexes for expanding word selections.\n this.wordBreakMatchLeft = null;\n this.wordBreakMatchRight = null;\n this.wordBreakMatchMiddle = null;\n};\n\n/**\n * Return the screen size as an hterm.Size object.\n *\n * @return {hterm.Size} hterm.Size object representing the current number\n * of rows and columns in this screen.\n */\nhterm.Screen.prototype.getSize = function() {\n return new hterm.Size(this.columnCount_, this.rowsArray.length);\n};\n\n/**\n * Return the current number of rows in this screen.\n *\n * @return {integer} The number of rows in this screen.\n */\nhterm.Screen.prototype.getHeight = function() {\n return this.rowsArray.length;\n};\n\n/**\n * Return the current number of columns in this screen.\n *\n * @return {integer} The number of columns in this screen.\n */\nhterm.Screen.prototype.getWidth = function() {\n return this.columnCount_;\n};\n\n/**\n * Set the maximum number of columns per row.\n *\n * @param {integer} count The maximum number of columns per row.\n */\nhterm.Screen.prototype.setColumnCount = function(count) {\n this.columnCount_ = count;\n\n if (this.cursorPosition.column >= count)\n this.setCursorPosition(this.cursorPosition.row, count - 1);\n};\n\n/**\n * Remove the first row from the screen and return it.\n *\n * @return {HTMLElement} The first row in this screen.\n */\nhterm.Screen.prototype.shiftRow = function() {\n return this.shiftRows(1)[0];\n};\n\n/**\n * Remove rows from the top of the screen and return them as an array.\n *\n * @param {integer} count The number of rows to remove.\n * @return {Array.} The selected rows.\n */\nhterm.Screen.prototype.shiftRows = function(count) {\n return this.rowsArray.splice(0, count);\n};\n\n/**\n * Insert a row at the top of the screen.\n *\n * @param {HTMLElement} row The row to insert.\n */\nhterm.Screen.prototype.unshiftRow = function(row) {\n this.rowsArray.splice(0, 0, row);\n};\n\n/**\n * Insert rows at the top of the screen.\n *\n * @param {Array.} rows The rows to insert.\n */\nhterm.Screen.prototype.unshiftRows = function(rows) {\n this.rowsArray.unshift.apply(this.rowsArray, rows);\n};\n\n/**\n * Remove the last row from the screen and return it.\n *\n * @return {HTMLElement} The last row in this screen.\n */\nhterm.Screen.prototype.popRow = function() {\n return this.popRows(1)[0];\n};\n\n/**\n * Remove rows from the bottom of the screen and return them as an array.\n *\n * @param {integer} count The number of rows to remove.\n * @return {Array.} The selected rows.\n */\nhterm.Screen.prototype.popRows = function(count) {\n return this.rowsArray.splice(this.rowsArray.length - count, count);\n};\n\n/**\n * Insert a row at the bottom of the screen.\n *\n * @param {HTMLElement} row The row to insert.\n */\nhterm.Screen.prototype.pushRow = function(row) {\n this.rowsArray.push(row);\n};\n\n/**\n * Insert rows at the bottom of the screen.\n *\n * @param {Array.} rows The rows to insert.\n */\nhterm.Screen.prototype.pushRows = function(rows) {\n rows.push.apply(this.rowsArray, rows);\n};\n\n/**\n * Insert a row at the specified row of the screen.\n *\n * @param {integer} index The index to insert the row.\n * @param {HTMLElement} row The row to insert.\n */\nhterm.Screen.prototype.insertRow = function(index, row) {\n this.rowsArray.splice(index, 0, row);\n};\n\n/**\n * Insert rows at the specified row of the screen.\n *\n * @param {integer} index The index to insert the rows.\n * @param {Array.} rows The rows to insert.\n */\nhterm.Screen.prototype.insertRows = function(index, rows) {\n for (var i = 0; i < rows.length; i++) {\n this.rowsArray.splice(index + i, 0, rows[i]);\n }\n};\n\n/**\n * Remove a row from the screen and return it.\n *\n * @param {integer} index The index of the row to remove.\n * @return {HTMLElement} The selected row.\n */\nhterm.Screen.prototype.removeRow = function(index) {\n return this.rowsArray.splice(index, 1)[0];\n};\n\n/**\n * Remove rows from the bottom of the screen and return them as an array.\n *\n * @param {integer} index The index to start removing rows.\n * @param {integer} count The number of rows to remove.\n * @return {Array.} The selected rows.\n */\nhterm.Screen.prototype.removeRows = function(index, count) {\n return this.rowsArray.splice(index, count);\n};\n\n/**\n * Invalidate the current cursor position.\n *\n * This sets this.cursorPosition to (0, 0) and clears out some internal\n * data.\n *\n * Attempting to insert or overwrite text while the cursor position is invalid\n * will raise an obscure exception.\n */\nhterm.Screen.prototype.invalidateCursorPosition = function() {\n this.cursorPosition.move(0, 0);\n this.cursorRowNode_ = null;\n this.cursorNode_ = null;\n this.cursorOffset_ = null;\n};\n\n/**\n * Clear the contents of the cursor row.\n */\nhterm.Screen.prototype.clearCursorRow = function() {\n this.cursorRowNode_.innerHTML = '';\n this.cursorRowNode_.removeAttribute('line-overflow');\n this.cursorOffset_ = 0;\n this.cursorPosition.column = 0;\n this.cursorPosition.overflow = false;\n\n var text;\n if (this.textAttributes.isDefault()) {\n text = '';\n } else {\n text = lib.f.getWhitespace(this.columnCount_);\n }\n\n // We shouldn't honor inverse colors when clearing an area, to match\n // xterm's back color erase behavior.\n var inverse = this.textAttributes.inverse;\n this.textAttributes.inverse = false;\n this.textAttributes.syncColors();\n\n var node = this.textAttributes.createContainer(text);\n this.cursorRowNode_.appendChild(node);\n this.cursorNode_ = node;\n\n this.textAttributes.inverse = inverse;\n this.textAttributes.syncColors();\n};\n\n/**\n * Mark the current row as having overflowed to the next line.\n *\n * The line overflow state is used when converting a range of rows into text.\n * It makes it possible to recombine two or more overflow terminal rows into\n * a single line.\n *\n * This is distinct from the cursor being in the overflow state. Cursor\n * overflow indicates that printing at the cursor position will commit a\n * line overflow, unless it is preceded by a repositioning of the cursor\n * to a non-overflow state.\n */\nhterm.Screen.prototype.commitLineOverflow = function() {\n this.cursorRowNode_.setAttribute('line-overflow', true);\n};\n\n/**\n * Relocate the cursor to a give row and column.\n *\n * @param {integer} row The zero based row.\n * @param {integer} column The zero based column.\n */\nhterm.Screen.prototype.setCursorPosition = function(row, column) {\n if (!this.rowsArray.length) {\n console.warn('Attempt to set cursor position on empty screen.');\n return;\n }\n\n if (row >= this.rowsArray.length) {\n console.error('Row out of bounds: ' + row);\n row = this.rowsArray.length - 1;\n } else if (row < 0) {\n console.error('Row out of bounds: ' + row);\n row = 0;\n }\n\n if (column >= this.columnCount_) {\n console.error('Column out of bounds: ' + column);\n column = this.columnCount_ - 1;\n } else if (column < 0) {\n console.error('Column out of bounds: ' + column);\n column = 0;\n }\n\n this.cursorPosition.overflow = false;\n\n var rowNode = this.rowsArray[row];\n var node = rowNode.firstChild;\n\n if (!node) {\n node = rowNode.ownerDocument.createTextNode('');\n rowNode.appendChild(node);\n }\n\n var currentColumn = 0;\n\n if (rowNode == this.cursorRowNode_) {\n if (column >= this.cursorPosition.column - this.cursorOffset_) {\n node = this.cursorNode_;\n currentColumn = this.cursorPosition.column - this.cursorOffset_;\n }\n } else {\n this.cursorRowNode_ = rowNode;\n }\n\n this.cursorPosition.move(row, column);\n\n while (node) {\n var offset = column - currentColumn;\n var width = hterm.TextAttributes.nodeWidth(node);\n if (!node.nextSibling || width > offset) {\n this.cursorNode_ = node;\n this.cursorOffset_ = offset;\n return;\n }\n\n currentColumn += width;\n node = node.nextSibling;\n }\n};\n\n/**\n * Set the provided selection object to be a caret selection at the current\n * cursor position.\n */\nhterm.Screen.prototype.syncSelectionCaret = function(selection) {\n try {\n selection.collapse(this.cursorNode_, this.cursorOffset_);\n } catch (firefoxIgnoredException) {\n // FF can throw an exception if the range is off, rather than just not\n // performing the collapse.\n }\n};\n\n/**\n * Split a single node into two nodes at the given offset.\n *\n * For example:\n * Given the DOM fragment '
Hello World
', call splitNode_\n * passing the span and an offset of 6. This would modify the fragment to\n * become: '
Hello World
'. If the span\n * had any attributes they would have been copied to the new span as well.\n *\n * The to-be-split node must have a container, so that the new node can be\n * placed next to it.\n *\n * @param {HTMLNode} node The node to split.\n * @param {integer} offset The offset into the node where the split should\n * occur.\n */\nhterm.Screen.prototype.splitNode_ = function(node, offset) {\n var afterNode = node.cloneNode(false);\n\n var textContent = node.textContent;\n node.textContent = hterm.TextAttributes.nodeSubstr(node, 0, offset);\n afterNode.textContent = lib.wc.substr(textContent, offset);\n\n if (afterNode.textContent)\n node.parentNode.insertBefore(afterNode, node.nextSibling);\n if (!node.textContent)\n node.parentNode.removeChild(node);\n};\n\n/**\n * Ensure that text is clipped and the cursor is clamped to the column count.\n */\nhterm.Screen.prototype.maybeClipCurrentRow = function() {\n var width = hterm.TextAttributes.nodeWidth(this.cursorRowNode_);\n\n if (width <= this.columnCount_) {\n // Current row does not need clipping, but may need clamping.\n if (this.cursorPosition.column >= this.columnCount_) {\n this.setCursorPosition(this.cursorPosition.row, this.columnCount_ - 1);\n this.cursorPosition.overflow = true;\n }\n\n return;\n }\n\n // Save off the current column so we can maybe restore it later.\n var currentColumn = this.cursorPosition.column;\n\n // Move the cursor to the final column.\n this.setCursorPosition(this.cursorPosition.row, this.columnCount_ - 1);\n\n // Remove any text that partially overflows.\n width = hterm.TextAttributes.nodeWidth(this.cursorNode_);\n\n if (this.cursorOffset_ < width - 1) {\n this.cursorNode_.textContent = hterm.TextAttributes.nodeSubstr(\n this.cursorNode_, 0, this.cursorOffset_ + 1);\n }\n\n // Remove all nodes after the cursor.\n var rowNode = this.cursorRowNode_;\n var node = this.cursorNode_.nextSibling;\n\n while (node) {\n rowNode.removeChild(node);\n node = this.cursorNode_.nextSibling;\n }\n\n if (currentColumn < this.columnCount_) {\n // If the cursor was within the screen before we started then restore its\n // position.\n this.setCursorPosition(this.cursorPosition.row, currentColumn);\n } else {\n // Otherwise leave it at the the last column in the overflow state.\n this.cursorPosition.overflow = true;\n }\n};\n\n/**\n * Insert a string at the current character position using the current\n * text attributes.\n *\n * You must call maybeClipCurrentRow() after in order to clip overflowed\n * text and clamp the cursor.\n *\n * It is also up to the caller to properly maintain the line overflow state\n * using hterm.Screen..commitLineOverflow().\n */\nhterm.Screen.prototype.insertString = function(str) {\n var cursorNode = this.cursorNode_;\n var cursorNodeText = cursorNode.textContent;\n\n this.cursorRowNode_.removeAttribute('line-overflow');\n\n // We may alter the width of the string by prepending some missing\n // whitespaces, so we need to record the string width ahead of time.\n var strWidth = lib.wc.strWidth(str);\n\n // No matter what, before this function exits the cursor column will have\n // moved this much.\n this.cursorPosition.column += strWidth;\n\n // Local cache of the cursor offset.\n var offset = this.cursorOffset_;\n\n // Reverse offset is the offset measured from the end of the string.\n // Zero implies that the cursor is at the end of the cursor node.\n var reverseOffset = hterm.TextAttributes.nodeWidth(cursorNode) - offset;\n\n if (reverseOffset < 0) {\n // A negative reverse offset means the cursor is positioned past the end\n // of the characters on this line. We'll need to insert the missing\n // whitespace.\n var ws = lib.f.getWhitespace(-reverseOffset);\n\n // This whitespace should be completely unstyled. Underline, background\n // color, and strikethrough would be visible on whitespace, so we can't use\n // one of those spans to hold the text.\n if (!(this.textAttributes.underline ||\n this.textAttributes.strikethrough ||\n this.textAttributes.background ||\n this.textAttributes.wcNode ||\n !this.textAttributes.asciiNode ||\n this.textAttributes.tileData != null)) {\n // Best case scenario, we can just pretend the spaces were part of the\n // original string.\n str = ws + str;\n } else if (cursorNode.nodeType == 3 ||\n !(cursorNode.wcNode ||\n !cursorNode.asciiNode ||\n cursorNode.tileNode ||\n cursorNode.style.textDecoration ||\n cursorNode.style.backgroundColor)) {\n // Second best case, the current node is able to hold the whitespace.\n cursorNode.textContent = (cursorNodeText += ws);\n } else {\n // Worst case, we have to create a new node to hold the whitespace.\n var wsNode = cursorNode.ownerDocument.createTextNode(ws);\n this.cursorRowNode_.insertBefore(wsNode, cursorNode.nextSibling);\n this.cursorNode_ = cursorNode = wsNode;\n this.cursorOffset_ = offset = -reverseOffset;\n cursorNodeText = ws;\n }\n\n // We now know for sure that we're at the last character of the cursor node.\n reverseOffset = 0;\n }\n\n if (this.textAttributes.matchesContainer(cursorNode)) {\n // The new text can be placed directly in the cursor node.\n if (reverseOffset == 0) {\n cursorNode.textContent = cursorNodeText + str;\n } else if (offset == 0) {\n cursorNode.textContent = str + cursorNodeText;\n } else {\n cursorNode.textContent =\n hterm.TextAttributes.nodeSubstr(cursorNode, 0, offset) +\n str + hterm.TextAttributes.nodeSubstr(cursorNode, offset);\n }\n\n this.cursorOffset_ += strWidth;\n return;\n }\n\n // The cursor node is the wrong style for the new text. If we're at the\n // beginning or end of the cursor node, then the adjacent node is also a\n // potential candidate.\n\n if (offset == 0) {\n // At the beginning of the cursor node, the check the previous sibling.\n var previousSibling = cursorNode.previousSibling;\n if (previousSibling &&\n this.textAttributes.matchesContainer(previousSibling)) {\n previousSibling.textContent += str;\n this.cursorNode_ = previousSibling;\n this.cursorOffset_ = lib.wc.strWidth(previousSibling.textContent);\n return;\n }\n\n var newNode = this.textAttributes.createContainer(str);\n this.cursorRowNode_.insertBefore(newNode, cursorNode);\n this.cursorNode_ = newNode;\n this.cursorOffset_ = strWidth;\n return;\n }\n\n if (reverseOffset == 0) {\n // At the end of the cursor node, the check the next sibling.\n var nextSibling = cursorNode.nextSibling;\n if (nextSibling &&\n this.textAttributes.matchesContainer(nextSibling)) {\n nextSibling.textContent = str + nextSibling.textContent;\n this.cursorNode_ = nextSibling;\n this.cursorOffset_ = lib.wc.strWidth(str);\n return;\n }\n\n var newNode = this.textAttributes.createContainer(str);\n this.cursorRowNode_.insertBefore(newNode, nextSibling);\n this.cursorNode_ = newNode;\n // We specifically need to include any missing whitespace here, since it's\n // going in a new node.\n this.cursorOffset_ = hterm.TextAttributes.nodeWidth(newNode);\n return;\n }\n\n // Worst case, we're somewhere in the middle of the cursor node. We'll\n // have to split it into two nodes and insert our new container in between.\n this.splitNode_(cursorNode, offset);\n var newNode = this.textAttributes.createContainer(str);\n this.cursorRowNode_.insertBefore(newNode, cursorNode.nextSibling);\n this.cursorNode_ = newNode;\n this.cursorOffset_ = strWidth;\n};\n\n/**\n * Overwrite the text at the current cursor position.\n *\n * You must call maybeClipCurrentRow() after in order to clip overflowed\n * text and clamp the cursor.\n *\n * It is also up to the caller to properly maintain the line overflow state\n * using hterm.Screen..commitLineOverflow().\n */\nhterm.Screen.prototype.overwriteString = function(str) {\n var maxLength = this.columnCount_ - this.cursorPosition.column;\n if (!maxLength)\n return [str];\n\n var width = lib.wc.strWidth(str);\n if (this.textAttributes.matchesContainer(this.cursorNode_) &&\n this.cursorNode_.textContent.substr(this.cursorOffset_) == str) {\n // This overwrite would be a no-op, just move the cursor and return.\n this.cursorOffset_ += width;\n this.cursorPosition.column += width;\n return;\n }\n\n this.deleteChars(Math.min(width, maxLength));\n this.insertString(str);\n};\n\n/**\n * Forward-delete one or more characters at the current cursor position.\n *\n * Text to the right of the deleted characters is shifted left. Only affects\n * characters on the same row as the cursor.\n *\n * @param {integer} count The column width of characters to delete. This is\n * clamped to the column width minus the cursor column.\n * @return {integer} The column width of the characters actually deleted.\n */\nhterm.Screen.prototype.deleteChars = function(count) {\n var node = this.cursorNode_;\n var offset = this.cursorOffset_;\n\n var currentCursorColumn = this.cursorPosition.column;\n count = Math.min(count, this.columnCount_ - currentCursorColumn);\n if (!count)\n return 0;\n\n var rv = count;\n var startLength, endLength;\n\n while (node && count) {\n startLength = hterm.TextAttributes.nodeWidth(node);\n node.textContent = hterm.TextAttributes.nodeSubstr(node, 0, offset) +\n hterm.TextAttributes.nodeSubstr(node, offset + count);\n endLength = hterm.TextAttributes.nodeWidth(node);\n count -= startLength - endLength;\n if (offset < startLength && endLength && startLength == endLength) {\n // No characters were deleted when there should be. We're probably trying\n // to delete one column width from a wide character node. We remove the\n // wide character node here and replace it with a single space.\n var spaceNode = this.textAttributes.createContainer(' ');\n node.parentNode.insertBefore(spaceNode, node.nextSibling);\n node.textContent = '';\n endLength = 0;\n count -= 1;\n }\n\n var nextNode = node.nextSibling;\n if (endLength == 0 && node != this.cursorNode_) {\n node.parentNode.removeChild(node);\n }\n node = nextNode;\n offset = 0;\n }\n\n // Remove this.cursorNode_ if it is an empty non-text node.\n if (this.cursorNode_.nodeType != 3 && !this.cursorNode_.textContent) {\n var cursorNode = this.cursorNode_;\n if (cursorNode.previousSibling) {\n this.cursorNode_ = cursorNode.previousSibling;\n this.cursorOffset_ = hterm.TextAttributes.nodeWidth(\n cursorNode.previousSibling);\n } else if (cursorNode.nextSibling) {\n this.cursorNode_ = cursorNode.nextSibling;\n this.cursorOffset_ = 0;\n } else {\n var emptyNode = this.cursorRowNode_.ownerDocument.createTextNode('');\n this.cursorRowNode_.appendChild(emptyNode);\n this.cursorNode_ = emptyNode;\n this.cursorOffset_ = 0;\n }\n this.cursorRowNode_.removeChild(cursorNode);\n }\n\n return rv;\n};\n\n/**\n * Finds first X-ROW of a line containing specified X-ROW.\n * Used to support line overflow.\n *\n * @param {Node} row X-ROW to begin search for first row of line.\n * @return {Node} The X-ROW that is at the beginning of the line.\n **/\nhterm.Screen.prototype.getLineStartRow_ = function(row) {\n while (row.previousSibling &&\n row.previousSibling.hasAttribute('line-overflow')) {\n row = row.previousSibling;\n }\n return row;\n};\n\n/**\n * Gets text of a line beginning with row.\n * Supports line overflow.\n *\n * @param {Node} row First X-ROW of line.\n * @return {string} Text content of line.\n **/\nhterm.Screen.prototype.getLineText_ = function(row) {\n var rowText = \"\";\n while (row) {\n rowText += row.textContent;\n if (row.hasAttribute('line-overflow')) {\n row = row.nextSibling;\n } else {\n break;\n }\n }\n return rowText;\n};\n\n/**\n * Returns X-ROW that is ancestor of the node.\n *\n * @param {Node} node Node to get X-ROW ancestor for.\n * @return {Node} X-ROW ancestor of node, or null if not found.\n **/\nhterm.Screen.prototype.getXRowAncestor_ = function(node) {\n while (node) {\n if (node.nodeName === 'X-ROW')\n break;\n node = node.parentNode;\n }\n return node;\n};\n\n/**\n * Returns position within line of character at offset within node.\n * Supports line overflow.\n *\n * @param {Node} row X-ROW at beginning of line.\n * @param {Node} node Node to get position of.\n * @param {integer} offset Offset into node.\n *\n * @return {integer} Position within line of character at offset within node.\n **/\nhterm.Screen.prototype.getPositionWithOverflow_ = function(row, node, offset) {\n if (!node)\n return -1;\n var ancestorRow = this.getXRowAncestor_(node);\n if (!ancestorRow)\n return -1;\n var position = 0;\n while (ancestorRow != row) {\n position += hterm.TextAttributes.nodeWidth(row);\n if (row.hasAttribute('line-overflow') && row.nextSibling) {\n row = row.nextSibling;\n } else {\n return -1;\n }\n }\n return position + this.getPositionWithinRow_(row, node, offset);\n};\n\n/**\n * Returns position within row of character at offset within node.\n * Does not support line overflow.\n *\n * @param {Node} row X-ROW to get position within.\n * @param {Node} node Node to get position for.\n * @param {integer} offset Offset within node to get position for.\n * @return {integer} Position within row of character at offset within node.\n **/\nhterm.Screen.prototype.getPositionWithinRow_ = function(row, node, offset) {\n if (node.parentNode != row) {\n // If we traversed to the top node, then there's nothing to find here.\n if (node.parentNode == null)\n return -1;\n\n return this.getPositionWithinRow_(node.parentNode, node, offset) +\n this.getPositionWithinRow_(row, node.parentNode, 0);\n }\n var position = 0;\n for (var i = 0; i < row.childNodes.length; i++) {\n var currentNode = row.childNodes[i];\n if (currentNode == node)\n return position + offset;\n position += hterm.TextAttributes.nodeWidth(currentNode);\n }\n return -1;\n};\n\n/**\n * Returns the node and offset corresponding to position within line.\n * Supports line overflow.\n *\n * @param {Node} row X-ROW at beginning of line.\n * @param {integer} position Position within line to retrieve node and offset.\n * @return {Array} Two element array containing node and offset respectively.\n **/\nhterm.Screen.prototype.getNodeAndOffsetWithOverflow_ = function(row, position) {\n while (row && position > hterm.TextAttributes.nodeWidth(row)) {\n if (row.hasAttribute('line-overflow') && row.nextSibling) {\n position -= hterm.TextAttributes.nodeWidth(row);\n row = row.nextSibling;\n } else {\n return -1;\n }\n }\n return this.getNodeAndOffsetWithinRow_(row, position);\n};\n\n/**\n * Returns the node and offset corresponding to position within row.\n * Does not support line overflow.\n *\n * @param {Node} row X-ROW to get position within.\n * @param {integer} position Position within row to retrieve node and offset.\n * @return {Array} Two element array containing node and offset respectively.\n **/\nhterm.Screen.prototype.getNodeAndOffsetWithinRow_ = function(row, position) {\n for (var i = 0; i < row.childNodes.length; i++) {\n var node = row.childNodes[i];\n var nodeTextWidth = hterm.TextAttributes.nodeWidth(node);\n if (position <= nodeTextWidth) {\n if (node.nodeName === 'SPAN') {\n /** Drill down to node contained by SPAN. **/\n return this.getNodeAndOffsetWithinRow_(node, position);\n } else {\n return [node, position];\n }\n }\n position -= nodeTextWidth;\n }\n return null;\n};\n\n/**\n * Returns the node and offset corresponding to position within line.\n * Supports line overflow.\n *\n * @param {Node} row X-ROW at beginning of line.\n * @param {integer} start Start position of range within line.\n * @param {integer} end End position of range within line.\n * @param {Range} range Range to modify.\n **/\nhterm.Screen.prototype.setRange_ = function(row, start, end, range) {\n var startNodeAndOffset = this.getNodeAndOffsetWithOverflow_(row, start);\n if (startNodeAndOffset == null)\n return;\n var endNodeAndOffset = this.getNodeAndOffsetWithOverflow_(row, end);\n if (endNodeAndOffset == null)\n return;\n range.setStart(startNodeAndOffset[0], startNodeAndOffset[1]);\n range.setEnd(endNodeAndOffset[0], endNodeAndOffset[1]);\n};\n\n/**\n * Expands selection to surround URLs.\n *\n * @param {Selection} selection Selection to expand.\n **/\nhterm.Screen.prototype.expandSelection = function(selection) {\n if (!selection)\n return;\n\n var range = selection.getRangeAt(0);\n if (!range || range.toString().match(/\\s/))\n return;\n\n var row = this.getLineStartRow_(this.getXRowAncestor_(range.startContainer));\n if (!row)\n return;\n\n var startPosition = this.getPositionWithOverflow_(row,\n range.startContainer,\n range.startOffset);\n if (startPosition == -1)\n return;\n var endPosition = this.getPositionWithOverflow_(row,\n range.endContainer,\n range.endOffset);\n if (endPosition == -1)\n return;\n\n // Use the user configurable match settings.\n var leftMatch = this.wordBreakMatchLeft;\n var rightMatch = this.wordBreakMatchRight;\n var insideMatch = this.wordBreakMatchMiddle;\n\n //Move start to the left.\n var rowText = this.getLineText_(row);\n var lineUpToRange = lib.wc.substring(rowText, 0, endPosition);\n var leftRegularExpression = new RegExp(leftMatch + insideMatch + \"$\");\n var expandedStart = lineUpToRange.search(leftRegularExpression);\n if (expandedStart == -1 || expandedStart > startPosition)\n return;\n\n //Move end to the right.\n var lineFromRange = lib.wc.substring(rowText, startPosition,\n lib.wc.strWidth(rowText));\n var rightRegularExpression = new RegExp(\"^\" + insideMatch + rightMatch);\n var found = lineFromRange.match(rightRegularExpression);\n if (!found)\n return;\n var expandedEnd = startPosition + lib.wc.strWidth(found[0]);\n if (expandedEnd == -1 || expandedEnd < endPosition)\n return;\n\n this.setRange_(row, expandedStart, expandedEnd, range);\n selection.addRange(range);\n};\n// SOURCE FILE: hterm/js/hterm_scrollport.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f', 'hterm.PubSub', 'hterm.Size');\n\n/**\n * A 'viewport' view of fixed-height rows with support for selection and\n * copy-to-clipboard.\n *\n * 'Viewport' in this case means that only the visible rows are in the DOM.\n * If the rowProvider has 100,000 rows, but the ScrollPort is only 25 rows\n * tall, then only 25 dom nodes are created. The ScrollPort will ask the\n * RowProvider to create new visible rows on demand as they are scrolled in\n * to the visible area.\n *\n * This viewport is designed so that select and copy-to-clipboard still works,\n * even when all or part of the selection is scrolled off screen.\n *\n * Note that the X11 mouse clipboard does not work properly when all or part\n * of the selection is off screen. It would be difficult to fix this without\n * adding significant overhead to pathologically large selection cases.\n *\n * The RowProvider should return rows rooted by the custom tag name 'x-row'.\n * This ensures that we can quickly assign the correct display height\n * to the rows with css.\n *\n * @param {RowProvider} rowProvider An object capable of providing rows as\n * raw text or row nodes.\n */\nhterm.ScrollPort = function(rowProvider) {\n hterm.PubSub.addBehavior(this);\n\n this.rowProvider_ = rowProvider;\n\n // SWAG the character size until we can measure it.\n this.characterSize = new hterm.Size(10, 10);\n\n // DOM node used for character measurement.\n this.ruler_ = null;\n\n this.selection = new hterm.ScrollPort.Selection(this);\n\n // A map of rowIndex => rowNode for each row that is drawn as part of a\n // pending redraw_() call. Null if there is no pending redraw_ call.\n this.currentRowNodeCache_ = null;\n\n // A map of rowIndex => rowNode for each row that was drawn as part of the\n // previous redraw_() call.\n this.previousRowNodeCache_ = {};\n\n // Used during scroll events to detect when the underlying cause is a resize.\n this.lastScreenWidth_ = null;\n this.lastScreenHeight_ = null;\n\n // True if the user should be allowed to select text in the terminal.\n // This is disabled when the host requests mouse drag events so that we don't\n // end up with two notions of selection.\n this.selectionEnabled_ = true;\n\n // The last row count returned by the row provider, re-populated during\n // syncScrollHeight().\n this.lastRowCount_ = 0;\n\n // The scroll wheel pixel delta multiplier to increase/decrease\n // the scroll speed of mouse wheel events. See: https://goo.gl/sXelnq\n this.scrollWheelMultiplier_ = 1;\n\n // The last touch events we saw to support touch based scrolling. Indexed\n // by touch identifier since we can have more than one touch active.\n this.lastTouch_ = {};\n\n /**\n * True if the last scroll caused the scrollport to show the final row.\n */\n this.isScrolledEnd = true;\n\n /**\n * A guess at the current scrollbar width, fixed in resize().\n */\n this.currentScrollbarWidthPx = 16;\n\n /**\n * Whether the ctrl-v key on the screen should paste.\n */\n this.ctrlVPaste = false;\n\n this.div_ = null;\n this.document_ = null;\n\n // Collection of active timeout handles.\n this.timeouts_ = {};\n\n this.observers_ = {};\n\n this.DEBUG_ = false;\n}\n\n/**\n * Proxy for the native selection object which understands how to walk up the\n * DOM to find the containing row node and sort out which comes first.\n *\n * @param {hterm.ScrollPort} scrollPort The parent hterm.ScrollPort instance.\n */\nhterm.ScrollPort.Selection = function(scrollPort) {\n this.scrollPort_ = scrollPort;\n\n /**\n * The row containing the start of the selection.\n *\n * This may be partially or fully selected. It may be the selection anchor\n * or the focus, but its rowIndex is guaranteed to be less-than-or-equal-to\n * that of the endRow.\n *\n * If only one row is selected then startRow == endRow. If there is no\n * selection or the selection is collapsed then startRow == null.\n */\n this.startRow = null;\n\n /**\n * The row containing the end of the selection.\n *\n * This may be partially or fully selected. It may be the selection anchor\n * or the focus, but its rowIndex is guaranteed to be greater-than-or-equal-to\n * that of the startRow.\n *\n * If only one row is selected then startRow == endRow. If there is no\n * selection or the selection is collapsed then startRow == null.\n */\n this.endRow = null;\n\n /**\n * True if startRow != endRow.\n */\n this.isMultiline = null;\n\n /**\n * True if the selection is just a point rather than a range.\n */\n this.isCollapsed = null;\n};\n\n/**\n * Given a list of DOM nodes and a container, return the DOM node that\n * is first according to a depth-first search.\n *\n * Returns null if none of the children are found.\n */\nhterm.ScrollPort.Selection.prototype.findFirstChild = function(\n parent, childAry) {\n var node = parent.firstChild;\n\n while (node) {\n if (childAry.indexOf(node) != -1)\n return node;\n\n if (node.childNodes.length) {\n var rv = this.findFirstChild(node, childAry);\n if (rv)\n return rv;\n }\n\n node = node.nextSibling;\n }\n\n return null;\n};\n\n/**\n * Synchronize this object with the current DOM selection.\n *\n * This is a one-way synchronization, the DOM selection is copied to this\n * object, not the other way around.\n */\nhterm.ScrollPort.Selection.prototype.sync = function() {\n var self = this;\n\n // The dom selection object has no way to tell which nodes come first in\n // the document, so we have to figure that out.\n //\n // This function is used when we detect that the \"anchor\" node is first.\n function anchorFirst() {\n self.startRow = anchorRow;\n self.startNode = selection.anchorNode;\n self.startOffset = selection.anchorOffset;\n self.endRow = focusRow;\n self.endNode = selection.focusNode;\n self.endOffset = selection.focusOffset;\n }\n\n // This function is used when we detect that the \"focus\" node is first.\n function focusFirst() {\n self.startRow = focusRow;\n self.startNode = selection.focusNode;\n self.startOffset = selection.focusOffset;\n self.endRow = anchorRow;\n self.endNode = selection.anchorNode;\n self.endOffset = selection.anchorOffset;\n }\n\n var selection = this.scrollPort_.getDocument().getSelection();\n\n this.startRow = null;\n this.endRow = null;\n this.isMultiline = null;\n this.isCollapsed = !selection || selection.isCollapsed;\n\n if (this.isCollapsed)\n return;\n\n var anchorRow = selection.anchorNode;\n while (anchorRow && !('rowIndex' in anchorRow)) {\n anchorRow = anchorRow.parentNode;\n }\n\n if (!anchorRow) {\n console.error('Selection anchor is not rooted in a row node: ' +\n selection.anchorNode.nodeName);\n return;\n }\n\n var focusRow = selection.focusNode;\n while (focusRow && !('rowIndex' in focusRow)) {\n focusRow = focusRow.parentNode;\n }\n\n if (!focusRow) {\n console.error('Selection focus is not rooted in a row node: ' +\n selection.focusNode.nodeName);\n return;\n }\n\n if (anchorRow.rowIndex < focusRow.rowIndex) {\n anchorFirst();\n\n } else if (anchorRow.rowIndex > focusRow.rowIndex) {\n focusFirst();\n\n } else if (selection.focusNode == selection.anchorNode) {\n if (selection.anchorOffset < selection.focusOffset) {\n anchorFirst();\n } else {\n focusFirst();\n }\n\n } else {\n // The selection starts and ends in the same row, but isn't contained all\n // in a single node.\n var firstNode = this.findFirstChild(\n anchorRow, [selection.anchorNode, selection.focusNode]);\n\n if (!firstNode)\n throw new Error('Unexpected error syncing selection.');\n\n if (firstNode == selection.anchorNode) {\n anchorFirst();\n } else {\n focusFirst();\n }\n }\n\n this.isMultiline = anchorRow.rowIndex != focusRow.rowIndex;\n};\n\n\n/**\n * Turn a div into this hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.decorate = function(div) {\n this.div_ = div;\n\n this.iframe_ = div.ownerDocument.createElement('iframe');\n this.iframe_.style.cssText = (\n 'border: 0;' +\n 'height: 100%;' +\n 'position: absolute;' +\n 'width: 100%');\n\n // Set the iframe src to # in FF. Otherwise when the frame's\n // load event fires in FF it clears out the content of the iframe.\n if ('mozInnerScreenX' in window) // detect a FF only property\n this.iframe_.src = '#';\n\n div.appendChild(this.iframe_);\n\n this.iframe_.contentWindow.addEventListener('resize',\n this.onResize_.bind(this));\n\n var doc = this.document_ = this.iframe_.contentDocument;\n doc.body.style.cssText = (\n 'margin: 0px;' +\n 'padding: 0px;' +\n 'height: 100%;' +\n 'width: 100%;' +\n 'overflow: hidden;' +\n 'cursor: var(--hterm-mouse-cursor-style);' +\n '-webkit-user-select: none;' +\n '-moz-user-select: none;');\n\n if (this.DEBUG_) {\n // When we're debugging we add padding to the body so that the offscreen\n // elements are visible.\n this.document_.body.style.paddingTop =\n this.document_.body.style.paddingBottom =\n 'calc(var(--hterm-charsize-height) * 3)';\n }\n\n var style = doc.createElement('style');\n style.textContent = (\n 'x-row {' +\n ' display: block;' +\n ' height: var(--hterm-charsize-height);' +\n ' line-height: var(--hterm-charsize-height);' +\n '}');\n doc.head.appendChild(style);\n\n this.userCssLink_ = doc.createElement('link');\n this.userCssLink_.setAttribute('rel', 'stylesheet');\n\n this.userCssText_ = doc.createElement('style');\n doc.head.appendChild(this.userCssText_);\n\n // TODO(rginda): Sorry, this 'screen_' isn't the same thing as hterm.Screen\n // from screen.js. I need to pick a better name for one of them to avoid\n // the collision.\n // We make this field editable even though we don't actually allow anything\n // to be edited here so that Chrome will do the right thing with virtual\n // keyboards and IMEs. But make sure we turn off all the input helper logic\n // that doesn't make sense here, and might inadvertently mung or save input.\n // Some of these attributes are standard while others are browser specific,\n // but should be safely ignored by other browsers.\n this.screen_ = doc.createElement('x-screen');\n this.screen_.setAttribute('contenteditable', 'true');\n this.screen_.setAttribute('spellcheck', 'false');\n this.screen_.setAttribute('autocomplete', 'off');\n this.screen_.setAttribute('autocorrect', 'off');\n this.screen_.setAttribute('autocaptalize', 'none');\n this.screen_.setAttribute('role', 'textbox');\n this.screen_.setAttribute('tabindex', '-1');\n this.screen_.style.cssText = (\n 'caret-color: transparent;' +\n 'display: block;' +\n 'font-family: monospace;' +\n 'font-size: 15px;' +\n 'font-variant-ligatures: none;' +\n 'height: 100%;' +\n 'overflow-y: scroll; overflow-x: hidden;' +\n 'white-space: pre;' +\n 'width: 100%;' +\n 'outline: none !important');\n\n doc.body.appendChild(this.screen_);\n\n this.screen_.addEventListener('scroll', this.onScroll_.bind(this));\n this.screen_.addEventListener('wheel', this.onScrollWheel_.bind(this));\n this.screen_.addEventListener('touchstart', this.onTouch_.bind(this));\n this.screen_.addEventListener('touchmove', this.onTouch_.bind(this));\n this.screen_.addEventListener('touchend', this.onTouch_.bind(this));\n this.screen_.addEventListener('touchcancel', this.onTouch_.bind(this));\n this.screen_.addEventListener('copy', this.onCopy_.bind(this));\n this.screen_.addEventListener('paste', this.onPaste_.bind(this));\n // Disable drag & drop of text/content. We don't handle it at all (yet?),\n // and the default behavior just confuses hterm.\n this.screen_.addEventListener('drop', function(e) {\n e.preventDefault();\n return false;\n });\n\n doc.body.addEventListener('keydown', this.onBodyKeyDown_.bind(this));\n\n // This is the main container for the fixed rows.\n this.rowNodes_ = doc.createElement('div');\n this.rowNodes_.id = 'hterm:row-nodes';\n this.rowNodes_.style.cssText = (\n 'display: block;' +\n 'position: fixed;' +\n 'overflow: hidden;' +\n '-webkit-user-select: text;' +\n '-moz-user-select: text;');\n this.screen_.appendChild(this.rowNodes_);\n\n // Two nodes to hold offscreen text during the copy event.\n this.topSelectBag_ = doc.createElement('x-select-bag');\n this.topSelectBag_.style.cssText = (\n 'display: block;' +\n 'overflow: hidden;' +\n 'height: var(--hterm-charsize-height);' +\n 'white-space: pre;');\n\n this.bottomSelectBag_ = this.topSelectBag_.cloneNode();\n\n // Nodes above the top fold and below the bottom fold are hidden. They are\n // only used to hold rows that are part of the selection but are currently\n // scrolled off the top or bottom of the visible range.\n this.topFold_ = doc.createElement('x-fold');\n this.topFold_.id = 'hterm:top-fold-for-row-selection';\n this.topFold_.style.cssText = 'display: block;';\n this.rowNodes_.appendChild(this.topFold_);\n\n this.bottomFold_ = this.topFold_.cloneNode();\n this.bottomFold_.id = 'hterm:bottom-fold-for-row-selection';\n this.rowNodes_.appendChild(this.bottomFold_);\n\n // This hidden div accounts for the vertical space that would be consumed by\n // all the rows in the buffer if they were visible. It's what causes the\n // scrollbar to appear on the 'x-screen', and it moves within the screen when\n // the scrollbar is moved.\n //\n // It is set 'visibility: hidden' to keep the browser from trying to include\n // it in the selection when a user 'drag selects' upwards (drag the mouse to\n // select and scroll at the same time). Without this, the selection gets\n // out of whack.\n this.scrollArea_ = doc.createElement('div');\n this.scrollArea_.id = 'hterm:scrollarea';\n this.scrollArea_.style.cssText = 'visibility: hidden';\n this.screen_.appendChild(this.scrollArea_);\n\n // This svg element is used to detect when the browser is zoomed. It must be\n // placed in the outermost document for currentScale to be correct.\n // TODO(rginda): This means that hterm nested in an iframe will not correctly\n // detect browser zoom level. We should come up with a better solution.\n // Note: This must be http:// else Chrome cannot create the element correctly.\n var xmlns = 'http://www.w3.org/2000/svg';\n this.svg_ = this.div_.ownerDocument.createElementNS(xmlns, 'svg');\n this.svg_.id = 'hterm:zoom-detector';\n this.svg_.setAttribute('xmlns', xmlns);\n this.svg_.setAttribute('version', '1.1');\n this.svg_.style.cssText = (\n 'position: absolute;' +\n 'top: 0;' +\n 'left: 0;' +\n 'visibility: hidden');\n\n\n // We send focus to this element just before a paste happens, so we can\n // capture the pasted text and forward it on to someone who cares.\n this.pasteTarget_ = doc.createElement('textarea');\n this.pasteTarget_.id = 'hterm:ctrl-v-paste-target';\n this.pasteTarget_.setAttribute('tabindex', '-1');\n this.pasteTarget_.style.cssText = (\n 'position: absolute;' +\n 'height: 1px;' +\n 'width: 1px;' +\n 'left: 0px; ' +\n 'bottom: 0px;' +\n 'opacity: 0');\n this.pasteTarget_.contentEditable = true;\n\n this.screen_.appendChild(this.pasteTarget_);\n this.pasteTarget_.addEventListener(\n 'textInput', this.handlePasteTargetTextInput_.bind(this));\n\n this.resize();\n};\n\n/**\n * Select the font-family and font-smoothing for this scrollport.\n *\n * @param {string} fontFamily Value of the CSS 'font-family' to use for this\n * scrollport. Should be a monospace font.\n * @param {string} opt_smoothing Optional value for '-webkit-font-smoothing'.\n * Defaults to an empty string if not specified.\n */\nhterm.ScrollPort.prototype.setFontFamily = function(fontFamily, opt_smoothing) {\n this.screen_.style.fontFamily = fontFamily;\n if (opt_smoothing) {\n this.screen_.style.webkitFontSmoothing = opt_smoothing;\n } else {\n this.screen_.style.webkitFontSmoothing = '';\n }\n\n this.syncCharacterSize();\n};\n\nhterm.ScrollPort.prototype.getFontFamily = function() {\n return this.screen_.style.fontFamily;\n};\n\n/**\n * Set a custom stylesheet to include in the scrollport.\n *\n * Defaults to null, meaning no custom css is loaded. Set it back to null or\n * the empty string to remove a previously applied custom css.\n */\nhterm.ScrollPort.prototype.setUserCssUrl = function(url) {\n if (url) {\n this.userCssLink_.setAttribute('href', url);\n\n if (!this.userCssLink_.parentNode)\n this.document_.head.appendChild(this.userCssLink_);\n } else if (this.userCssLink_.parentNode) {\n this.document_.head.removeChild(this.userCssLink_);\n }\n};\n\nhterm.ScrollPort.prototype.setUserCssText = function(text) {\n this.userCssText_.textContent = text;\n};\n\nhterm.ScrollPort.prototype.focus = function() {\n this.iframe_.focus();\n this.screen_.focus();\n};\n\nhterm.ScrollPort.prototype.getForegroundColor = function() {\n return this.screen_.style.color;\n};\n\nhterm.ScrollPort.prototype.setForegroundColor = function(color) {\n this.screen_.style.color = color;\n};\n\nhterm.ScrollPort.prototype.getBackgroundColor = function() {\n return this.screen_.style.backgroundColor;\n};\n\nhterm.ScrollPort.prototype.setBackgroundColor = function(color) {\n this.screen_.style.backgroundColor = color;\n};\n\nhterm.ScrollPort.prototype.setBackgroundImage = function(image) {\n this.screen_.style.backgroundImage = image;\n};\n\nhterm.ScrollPort.prototype.setBackgroundSize = function(size) {\n this.screen_.style.backgroundSize = size;\n};\n\nhterm.ScrollPort.prototype.setBackgroundPosition = function(position) {\n this.screen_.style.backgroundPosition = position;\n};\n\nhterm.ScrollPort.prototype.setCtrlVPaste = function(ctrlVPaste) {\n this.ctrlVPaste = ctrlVPaste;\n};\n\n/**\n * Get the usable size of the scrollport screen.\n *\n * The width will not include the scrollbar width.\n */\nhterm.ScrollPort.prototype.getScreenSize = function() {\n var size = hterm.getClientSize(this.screen_);\n return {\n height: size.height,\n width: size.width - this.currentScrollbarWidthPx\n };\n};\n\n/**\n * Get the usable width of the scrollport screen.\n *\n * This the widget width minus scrollbar width.\n */\nhterm.ScrollPort.prototype.getScreenWidth = function() {\n return this.getScreenSize().width ;\n};\n\n/**\n * Get the usable height of the scrollport screen.\n */\nhterm.ScrollPort.prototype.getScreenHeight = function() {\n return this.getScreenSize().height;\n};\n\n/**\n * Return the document that holds the visible rows of this hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.getDocument = function() {\n return this.document_;\n};\n\n/**\n * Returns the x-screen element that holds the rows of this hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.getScreenNode = function() {\n return this.screen_;\n};\n\n/**\n * Clear out any cached rowNodes.\n */\nhterm.ScrollPort.prototype.resetCache = function() {\n this.currentRowNodeCache_ = null;\n this.previousRowNodeCache_ = {};\n};\n\n/**\n * Change the current rowProvider.\n *\n * This will clear the row cache and cause a redraw.\n *\n * @param {Object} rowProvider An object capable of providing the rows\n * in this hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.setRowProvider = function(rowProvider) {\n this.resetCache();\n this.rowProvider_ = rowProvider;\n this.scheduleRedraw();\n};\n\n/**\n * Inform the ScrollPort that the root DOM nodes for some or all of the visible\n * rows are no longer valid.\n *\n * Specifically, this should be called if this.rowProvider_.getRowNode() now\n * returns an entirely different node than it did before. It does not\n * need to be called if the content of a row node is the only thing that\n * changed.\n *\n * This skips some of the overhead of a full redraw, but should not be used\n * in cases where the scrollport has been scrolled, or when the row count has\n * changed.\n */\nhterm.ScrollPort.prototype.invalidate = function() {\n var node = this.topFold_.nextSibling;\n while (node != this.bottomFold_) {\n var nextSibling = node.nextSibling;\n node.parentElement.removeChild(node);\n node = nextSibling;\n }\n\n this.previousRowNodeCache_ = null;\n var topRowIndex = this.getTopRowIndex();\n var bottomRowIndex = this.getBottomRowIndex(topRowIndex);\n\n this.drawVisibleRows_(topRowIndex, bottomRowIndex);\n};\n\nhterm.ScrollPort.prototype.scheduleInvalidate = function() {\n if (this.timeouts_.invalidate)\n return;\n\n var self = this;\n this.timeouts_.invalidate = setTimeout(function () {\n delete self.timeouts_.invalidate;\n self.invalidate();\n }, 0);\n};\n\n/**\n * Set the font size of the ScrollPort.\n */\nhterm.ScrollPort.prototype.setFontSize = function(px) {\n this.screen_.style.fontSize = px + 'px';\n this.syncCharacterSize();\n};\n\n/**\n * Return the current font size of the ScrollPort.\n */\nhterm.ScrollPort.prototype.getFontSize = function() {\n return parseInt(this.screen_.style.fontSize);\n};\n\n/**\n * Measure the size of a single character in pixels.\n *\n * @param {string} opt_weight The font weight to measure, or 'normal' if\n * omitted.\n * @return {hterm.Size} A new hterm.Size object.\n */\nhterm.ScrollPort.prototype.measureCharacterSize = function(opt_weight) {\n // Number of lines used to average the height of a single character.\n var numberOfLines = 100;\n // Number of chars per line used to average the width of a single character.\n var lineLength = 100;\n\n if (!this.ruler_) {\n this.ruler_ = this.document_.createElement('div');\n this.ruler_.id = 'hterm:ruler-character-size';\n this.ruler_.style.cssText = (\n 'position: absolute;' +\n 'top: 0;' +\n 'left: 0;' +\n 'visibility: hidden;' +\n 'height: auto !important;' +\n 'width: auto !important;');\n\n // We need to put the text in a span to make the size calculation\n // work properly in Firefox\n this.rulerSpan_ = this.document_.createElement('span');\n this.rulerSpan_.id = 'hterm:ruler-span-workaround';\n this.rulerSpan_.innerHTML =\n ('X'.repeat(lineLength) + '\\r').repeat(numberOfLines);\n this.ruler_.appendChild(this.rulerSpan_);\n\n this.rulerBaseline_ = this.document_.createElement('span');\n this.rulerSpan_.id = 'hterm:ruler-baseline';\n // We want to collapse it on the baseline\n this.rulerBaseline_.style.fontSize = '0px';\n this.rulerBaseline_.textContent = 'X';\n }\n\n this.rulerSpan_.style.fontWeight = opt_weight || '';\n\n this.rowNodes_.appendChild(this.ruler_);\n var rulerSize = hterm.getClientSize(this.rulerSpan_);\n\n var size = new hterm.Size(rulerSize.width / lineLength,\n rulerSize.height / numberOfLines);\n\n this.ruler_.appendChild(this.rulerBaseline_);\n size.baseline = this.rulerBaseline_.offsetTop;\n this.ruler_.removeChild(this.rulerBaseline_);\n\n this.rowNodes_.removeChild(this.ruler_);\n\n this.div_.ownerDocument.body.appendChild(this.svg_);\n size.zoomFactor = this.svg_.currentScale;\n this.div_.ownerDocument.body.removeChild(this.svg_);\n\n return size;\n};\n\n/**\n * Synchronize the character size.\n *\n * This will re-measure the current character size and adjust the height\n * of an x-row to match.\n */\nhterm.ScrollPort.prototype.syncCharacterSize = function() {\n this.characterSize = this.measureCharacterSize();\n\n this.resize();\n};\n\n/**\n * Reset dimensions and visible row count to account for a change in the\n * dimensions of the 'x-screen'.\n */\nhterm.ScrollPort.prototype.resize = function() {\n this.currentScrollbarWidthPx = hterm.getClientWidth(this.screen_) -\n this.screen_.clientWidth;\n\n this.syncScrollHeight();\n this.syncRowNodesDimensions_();\n\n var self = this;\n this.publish(\n 'resize', { scrollPort: this },\n function() {\n self.scrollRowToBottom(self.rowProvider_.getRowCount());\n self.scheduleRedraw();\n });\n};\n\n/**\n * Set the position and size of the row nodes element.\n */\nhterm.ScrollPort.prototype.syncRowNodesDimensions_ = function() {\n var screenSize = this.getScreenSize();\n\n this.lastScreenWidth_ = screenSize.width;\n this.lastScreenHeight_ = screenSize.height;\n\n // We don't want to show a partial row because it would be distracting\n // in a terminal, so we floor any fractional row count.\n this.visibleRowCount = lib.f.smartFloorDivide(\n screenSize.height, this.characterSize.height);\n\n // Then compute the height of our integral number of rows.\n var visibleRowsHeight = this.visibleRowCount * this.characterSize.height;\n\n // Then the difference between the screen height and total row height needs to\n // be made up for as top margin. We need to record this value so it\n // can be used later to determine the topRowIndex.\n this.visibleRowTopMargin = 0;\n this.visibleRowBottomMargin = screenSize.height - visibleRowsHeight;\n\n this.topFold_.style.marginBottom = this.visibleRowTopMargin + 'px';\n\n\n var topFoldOffset = 0;\n var node = this.topFold_.previousSibling;\n while (node) {\n topFoldOffset += hterm.getClientHeight(node);\n node = node.previousSibling;\n }\n\n // Set the dimensions of the visible rows container.\n this.rowNodes_.style.width = screenSize.width + 'px';\n this.rowNodes_.style.height = visibleRowsHeight + topFoldOffset + 'px';\n this.rowNodes_.style.left = this.screen_.offsetLeft + 'px';\n this.rowNodes_.style.top = this.screen_.offsetTop - topFoldOffset + 'px';\n};\n\nhterm.ScrollPort.prototype.syncScrollHeight = function() {\n // Resize the scroll area to appear as though it contains every row.\n this.lastRowCount_ = this.rowProvider_.getRowCount();\n this.scrollArea_.style.height = (this.characterSize.height *\n this.lastRowCount_ +\n this.visibleRowTopMargin +\n this.visibleRowBottomMargin +\n 'px');\n};\n\n/**\n * Schedule a redraw to happen asynchronously.\n *\n * If this method is called multiple times before the redraw has a chance to\n * run only one redraw occurs.\n */\nhterm.ScrollPort.prototype.scheduleRedraw = function() {\n if (this.timeouts_.redraw)\n return;\n\n var self = this;\n this.timeouts_.redraw = setTimeout(function () {\n delete self.timeouts_.redraw;\n self.redraw_();\n }, 0);\n};\n\n/**\n * Redraw the current hterm.ScrollPort based on the current scrollbar position.\n *\n * When redrawing, we are careful to make sure that the rows that start or end\n * the current selection are not touched in any way. Doing so would disturb\n * the selection, and cleaning up after that would cause flashes at best and\n * incorrect selection at worst. Instead, we modify the DOM around these nodes.\n * We even stash the selection start/end outside of the visible area if\n * they are not supposed to be visible in the hterm.ScrollPort.\n */\nhterm.ScrollPort.prototype.redraw_ = function() {\n this.resetSelectBags_();\n this.selection.sync();\n\n this.syncScrollHeight();\n\n this.currentRowNodeCache_ = {};\n\n var topRowIndex = this.getTopRowIndex();\n var bottomRowIndex = this.getBottomRowIndex(topRowIndex);\n\n this.drawTopFold_(topRowIndex);\n this.drawBottomFold_(bottomRowIndex);\n this.drawVisibleRows_(topRowIndex, bottomRowIndex);\n\n this.syncRowNodesDimensions_();\n\n this.previousRowNodeCache_ = this.currentRowNodeCache_;\n this.currentRowNodeCache_ = null;\n\n this.isScrolledEnd = (\n this.getTopRowIndex() + this.visibleRowCount >= this.lastRowCount_);\n};\n\n/**\n * Ensure that the nodes above the top fold are as they should be.\n *\n * If the selection start and/or end nodes are above the visible range\n * of this hterm.ScrollPort then the dom will be adjusted so that they appear\n * before the top fold (the first x-fold element, aka this.topFold).\n *\n * If not, the top fold will be the first element.\n *\n * It is critical that this method does not move the selection nodes. Doing\n * so would clear the current selection. Instead, the rest of the DOM is\n * adjusted around them.\n */\nhterm.ScrollPort.prototype.drawTopFold_ = function(topRowIndex) {\n if (!this.selection.startRow ||\n this.selection.startRow.rowIndex >= topRowIndex) {\n // Selection is entirely below the top fold, just make sure the fold is\n // the first child.\n if (this.rowNodes_.firstChild != this.topFold_)\n this.rowNodes_.insertBefore(this.topFold_, this.rowNodes_.firstChild);\n\n return;\n }\n\n if (!this.selection.isMultiline ||\n this.selection.endRow.rowIndex >= topRowIndex) {\n // Only the startRow is above the fold.\n if (this.selection.startRow.nextSibling != this.topFold_)\n this.rowNodes_.insertBefore(this.topFold_,\n this.selection.startRow.nextSibling);\n } else {\n // Both rows are above the fold.\n if (this.selection.endRow.nextSibling != this.topFold_) {\n this.rowNodes_.insertBefore(this.topFold_,\n this.selection.endRow.nextSibling);\n }\n\n // Trim any intermediate lines.\n while (this.selection.startRow.nextSibling !=\n this.selection.endRow) {\n this.rowNodes_.removeChild(this.selection.startRow.nextSibling);\n }\n }\n\n while(this.rowNodes_.firstChild != this.selection.startRow) {\n this.rowNodes_.removeChild(this.rowNodes_.firstChild);\n }\n};\n\n/**\n * Ensure that the nodes below the bottom fold are as they should be.\n *\n * If the selection start and/or end nodes are below the visible range\n * of this hterm.ScrollPort then the dom will be adjusted so that they appear\n * after the bottom fold (the second x-fold element, aka this.bottomFold).\n *\n * If not, the bottom fold will be the last element.\n *\n * It is critical that this method does not move the selection nodes. Doing\n * so would clear the current selection. Instead, the rest of the DOM is\n * adjusted around them.\n */\nhterm.ScrollPort.prototype.drawBottomFold_ = function(bottomRowIndex) {\n if (!this.selection.endRow ||\n this.selection.endRow.rowIndex <= bottomRowIndex) {\n // Selection is entirely above the bottom fold, just make sure the fold is\n // the last child.\n if (this.rowNodes_.lastChild != this.bottomFold_)\n this.rowNodes_.appendChild(this.bottomFold_);\n\n return;\n }\n\n if (!this.selection.isMultiline ||\n this.selection.startRow.rowIndex <= bottomRowIndex) {\n // Only the endRow is below the fold.\n if (this.bottomFold_.nextSibling != this.selection.endRow)\n this.rowNodes_.insertBefore(this.bottomFold_,\n this.selection.endRow);\n } else {\n // Both rows are below the fold.\n if (this.bottomFold_.nextSibling != this.selection.startRow) {\n this.rowNodes_.insertBefore(this.bottomFold_,\n this.selection.startRow);\n }\n\n // Trim any intermediate lines.\n while (this.selection.startRow.nextSibling !=\n this.selection.endRow) {\n this.rowNodes_.removeChild(this.selection.startRow.nextSibling);\n }\n }\n\n while(this.rowNodes_.lastChild != this.selection.endRow) {\n this.rowNodes_.removeChild(this.rowNodes_.lastChild);\n }\n};\n\n/**\n * Ensure that the rows between the top and bottom folds are as they should be.\n *\n * This method assumes that drawTopFold_() and drawBottomFold_() have already\n * run, and that they have left any visible selection row (selection start\n * or selection end) between the folds.\n *\n * It recycles DOM nodes from the previous redraw where possible, but will ask\n * the rowSource to make new nodes if necessary.\n *\n * It is critical that this method does not move the selection nodes. Doing\n * so would clear the current selection. Instead, the rest of the DOM is\n * adjusted around them.\n */\nhterm.ScrollPort.prototype.drawVisibleRows_ = function(\n topRowIndex, bottomRowIndex) {\n var self = this;\n\n // Keep removing nodes, starting with currentNode, until we encounter\n // targetNode. Throws on failure.\n function removeUntilNode(currentNode, targetNode) {\n while (currentNode != targetNode) {\n if (!currentNode)\n throw 'Did not encounter target node';\n\n if (currentNode == self.bottomFold_)\n throw 'Encountered bottom fold before target node';\n\n var deadNode = currentNode;\n currentNode = currentNode.nextSibling;\n deadNode.parentNode.removeChild(deadNode);\n }\n }\n\n // Shorthand for things we're going to use a lot.\n var selectionStartRow = this.selection.startRow;\n var selectionEndRow = this.selection.endRow;\n var bottomFold = this.bottomFold_;\n\n // The node we're examining during the current iteration.\n var node = this.topFold_.nextSibling;\n\n var targetDrawCount = Math.min(this.visibleRowCount,\n this.rowProvider_.getRowCount());\n\n for (var drawCount = 0; drawCount < targetDrawCount; drawCount++) {\n var rowIndex = topRowIndex + drawCount;\n\n if (node == bottomFold) {\n // We've hit the bottom fold, we need to insert a new row.\n var newNode = this.fetchRowNode_(rowIndex);\n if (!newNode) {\n console.log(\"Couldn't fetch row index: \" + rowIndex);\n break;\n }\n\n this.rowNodes_.insertBefore(newNode, node);\n continue;\n }\n\n if (node.rowIndex == rowIndex) {\n // This node is in the right place, move along.\n node = node.nextSibling;\n continue;\n }\n\n if (selectionStartRow && selectionStartRow.rowIndex == rowIndex) {\n // The selection start row is supposed to be here, remove nodes until\n // we find it.\n removeUntilNode(node, selectionStartRow);\n node = selectionStartRow.nextSibling;\n continue;\n }\n\n if (selectionEndRow && selectionEndRow.rowIndex == rowIndex) {\n // The selection end row is supposed to be here, remove nodes until\n // we find it.\n removeUntilNode(node, selectionEndRow);\n node = selectionEndRow.nextSibling;\n continue;\n }\n\n if (node == selectionStartRow || node == selectionEndRow) {\n // We encountered the start/end of the selection, but we don't want it\n // yet. Insert a new row instead.\n var newNode = this.fetchRowNode_(rowIndex);\n if (!newNode) {\n console.log(\"Couldn't fetch row index: \" + rowIndex);\n break;\n }\n\n this.rowNodes_.insertBefore(newNode, node);\n continue;\n }\n\n // There is nothing special about this node, but it's in our way. Replace\n // it with the node that should be here.\n var newNode = this.fetchRowNode_(rowIndex);\n if (!newNode) {\n console.log(\"Couldn't fetch row index: \" + rowIndex);\n break;\n }\n\n if (node == newNode) {\n node = node.nextSibling;\n continue;\n }\n\n this.rowNodes_.insertBefore(newNode, node);\n if (!newNode.nextSibling)\n debugger;\n this.rowNodes_.removeChild(node);\n node = newNode.nextSibling;\n }\n\n if (node != this.bottomFold_)\n removeUntilNode(node, bottomFold);\n};\n\n/**\n * Empty out both select bags and remove them from the document.\n *\n * These nodes hold the text between the start and end of the selection\n * when that text is otherwise off screen. They are filled out in the\n * onCopy_ event.\n */\nhterm.ScrollPort.prototype.resetSelectBags_ = function() {\n if (this.topSelectBag_.parentNode) {\n this.topSelectBag_.textContent = '';\n this.topSelectBag_.parentNode.removeChild(this.topSelectBag_);\n }\n\n if (this.bottomSelectBag_.parentNode) {\n this.bottomSelectBag_.textContent = '';\n this.bottomSelectBag_.parentNode.removeChild(this.bottomSelectBag_);\n }\n};\n\n/**\n * Place a row node in the cache of visible nodes.\n *\n * This method may only be used during a redraw_.\n */\nhterm.ScrollPort.prototype.cacheRowNode_ = function(rowNode) {\n this.currentRowNodeCache_[rowNode.rowIndex] = rowNode;\n};\n\n/**\n * Fetch the row node for the given index.\n *\n * This will return a node from the cache if possible, or will request one\n * from the RowProvider if not.\n *\n * If a redraw_ is in progress the row will be added to the current cache.\n */\nhterm.ScrollPort.prototype.fetchRowNode_ = function(rowIndex) {\n var node;\n\n if (this.previousRowNodeCache_ && rowIndex in this.previousRowNodeCache_) {\n node = this.previousRowNodeCache_[rowIndex];\n } else {\n node = this.rowProvider_.getRowNode(rowIndex);\n }\n\n if (this.currentRowNodeCache_)\n this.cacheRowNode_(node);\n\n return node;\n};\n\n/**\n * Select all rows in the viewport.\n */\nhterm.ScrollPort.prototype.selectAll = function() {\n var firstRow;\n\n if (this.topFold_.nextSibling.rowIndex != 0) {\n while (this.topFold_.previousSibling) {\n this.rowNodes_.removeChild(this.topFold_.previousSibling);\n }\n\n firstRow = this.fetchRowNode_(0);\n this.rowNodes_.insertBefore(firstRow, this.topFold_);\n this.syncRowNodesDimensions_();\n } else {\n firstRow = this.topFold_.nextSibling;\n }\n\n var lastRowIndex = this.rowProvider_.getRowCount() - 1;\n var lastRow;\n\n if (this.bottomFold_.previousSibling.rowIndex != lastRowIndex) {\n while (this.bottomFold_.nextSibling) {\n this.rowNodes_.removeChild(this.bottomFold_.nextSibling);\n }\n\n lastRow = this.fetchRowNode_(lastRowIndex);\n this.rowNodes_.appendChild(lastRow);\n } else {\n lastRow = this.bottomFold_.previousSibling.rowIndex;\n }\n\n var selection = this.document_.getSelection();\n selection.collapse(firstRow, 0);\n selection.extend(lastRow, lastRow.childNodes.length);\n\n this.selection.sync();\n};\n\n/**\n * Return the maximum scroll position in pixels.\n */\nhterm.ScrollPort.prototype.getScrollMax_ = function(e) {\n return (hterm.getClientHeight(this.scrollArea_) +\n this.visibleRowTopMargin + this.visibleRowBottomMargin -\n hterm.getClientHeight(this.screen_));\n};\n\n/**\n * Scroll the given rowIndex to the top of the hterm.ScrollPort.\n *\n * @param {integer} rowIndex Index of the target row.\n */\nhterm.ScrollPort.prototype.scrollRowToTop = function(rowIndex) {\n this.syncScrollHeight();\n\n this.isScrolledEnd = (\n rowIndex + this.visibleRowCount >= this.lastRowCount_);\n\n var scrollTop = rowIndex * this.characterSize.height +\n this.visibleRowTopMargin;\n\n var scrollMax = this.getScrollMax_();\n if (scrollTop > scrollMax)\n scrollTop = scrollMax;\n\n if (this.screen_.scrollTop == scrollTop)\n return;\n\n this.screen_.scrollTop = scrollTop;\n this.scheduleRedraw();\n};\n\n/**\n * Scroll the given rowIndex to the bottom of the hterm.ScrollPort.\n *\n * @param {integer} rowIndex Index of the target row.\n */\nhterm.ScrollPort.prototype.scrollRowToBottom = function(rowIndex) {\n this.syncScrollHeight();\n\n this.isScrolledEnd = (\n rowIndex + this.visibleRowCount >= this.lastRowCount_);\n\n var scrollTop = rowIndex * this.characterSize.height +\n this.visibleRowTopMargin + this.visibleRowBottomMargin;\n scrollTop -= this.visibleRowCount * this.characterSize.height;\n\n if (scrollTop < 0)\n scrollTop = 0;\n\n if (this.screen_.scrollTop == scrollTop)\n return;\n\n this.screen_.scrollTop = scrollTop;\n};\n\n/**\n * Return the row index of the first visible row.\n *\n * This is based on the scroll position. If a redraw_ is in progress this\n * returns the row that *should* be at the top.\n */\nhterm.ScrollPort.prototype.getTopRowIndex = function() {\n return Math.round(this.screen_.scrollTop / this.characterSize.height);\n};\n\n/**\n * Return the row index of the last visible row.\n *\n * This is based on the scroll position. If a redraw_ is in progress this\n * returns the row that *should* be at the bottom.\n */\nhterm.ScrollPort.prototype.getBottomRowIndex = function(topRowIndex) {\n return topRowIndex + this.visibleRowCount - 1;\n};\n\n/**\n * Handler for scroll events.\n *\n * The onScroll event fires when scrollArea's scrollTop property changes. This\n * may be due to the user manually move the scrollbar, or a programmatic change.\n */\nhterm.ScrollPort.prototype.onScroll_ = function(e) {\n var screenSize = this.getScreenSize();\n if (screenSize.width != this.lastScreenWidth_ ||\n screenSize.height != this.lastScreenHeight_) {\n // This event may also fire during a resize (but before the resize event!).\n // This happens when the browser moves the scrollbar as part of the resize.\n // In these cases, we want to ignore the scroll event and let onResize\n // handle things. If we don't, then we end up scrolling to the wrong\n // position after a resize.\n this.resize();\n return;\n }\n\n this.redraw_();\n this.publish('scroll', { scrollPort: this });\n};\n\n/**\n * Clients can override this if they want to hear scrollwheel events.\n *\n * Clients may call event.preventDefault() if they want to keep the scrollport\n * from also handling the events.\n */\nhterm.ScrollPort.prototype.onScrollWheel = function(e) {};\n\n/**\n * Handler for scroll-wheel events.\n *\n * The onScrollWheel event fires when the user moves their scrollwheel over this\n * hterm.ScrollPort. Because the frontmost element in the hterm.ScrollPort is\n * a fixed position DIV, the scroll wheel does nothing by default. Instead, we\n * have to handle it manually.\n */\nhterm.ScrollPort.prototype.onScrollWheel_ = function(e) {\n this.onScrollWheel(e);\n\n if (e.defaultPrevented)\n return;\n\n // Figure out how far this event wants us to scroll.\n var delta = this.scrollWheelDelta(e);\n\n var top = this.screen_.scrollTop - delta;\n if (top < 0)\n top = 0;\n\n var scrollMax = this.getScrollMax_();\n if (top > scrollMax)\n top = scrollMax;\n\n if (top != this.screen_.scrollTop) {\n // Moving scrollTop causes a scroll event, which triggers the redraw.\n this.screen_.scrollTop = top;\n\n // Only preventDefault when we've actually scrolled. If there's nothing\n // to scroll we want to pass the event through so Chrome can detect the\n // overscroll.\n e.preventDefault();\n }\n};\n\n/**\n * Calculate how far a wheel event should scroll.\n *\n * @param {WheelEvent} e The mouse wheel event to process.\n * @return {number} How far (in pixels) to scroll.\n */\nhterm.ScrollPort.prototype.scrollWheelDelta = function(e) {\n var delta;\n\n switch (e.deltaMode) {\n case WheelEvent.DOM_DELTA_PIXEL:\n delta = e.deltaY * this.scrollWheelMultiplier_;\n break;\n case WheelEvent.DOM_DELTA_LINE:\n delta = e.deltaY * this.characterSize.height;\n break;\n case WheelEvent.DOM_DELTA_PAGE:\n delta = e.deltaY * this.characterSize.height * this.screen_.getHeight();\n break;\n }\n\n // The sign is inverted from what we would expect.\n return delta * -1;\n};\n\n\n/**\n * Clients can override this if they want to hear touch events.\n *\n * Clients may call event.preventDefault() if they want to keep the scrollport\n * from also handling the events.\n */\nhterm.ScrollPort.prototype.onTouch = function(e) {};\n\n/**\n * Handler for touch events.\n */\nhterm.ScrollPort.prototype.onTouch_ = function(e) {\n this.onTouch(e);\n\n if (e.defaultPrevented)\n return;\n\n // Extract the fields from the Touch event that we need. If we saved the\n // event directly, it has references to other objects (like x-row) that\n // might stick around for a long time. This way we only have small objects\n // in our lastTouch_ state.\n var scrubTouch = function(t) {\n return {\n id: t.identifier,\n y: t.clientY,\n x: t.clientX,\n };\n };\n\n var i, touch;\n switch (e.type) {\n case 'touchstart':\n // Save the current set of touches.\n for (i = 0; i < e.changedTouches.length; ++i) {\n touch = scrubTouch(e.changedTouches[i]);\n this.lastTouch_[touch.id] = touch;\n }\n break;\n\n case 'touchcancel':\n case 'touchend':\n // Throw away existing touches that we're finished with.\n for (i = 0; i < e.changedTouches.length; ++i)\n delete this.lastTouch_[e.changedTouches[i].identifier];\n break;\n\n case 'touchmove':\n // Walk all of the touches in this one event and merge all of their\n // changes into one delta. This lets multiple fingers scroll faster.\n var delta = 0;\n for (i = 0; i < e.changedTouches.length; ++i) {\n touch = scrubTouch(e.changedTouches[i]);\n delta += (this.lastTouch_[touch.id].y - touch.y);\n this.lastTouch_[touch.id] = touch;\n }\n\n // Invert to match the touchscreen scrolling direction of browser windows.\n delta *= -1;\n\n var top = this.screen_.scrollTop - delta;\n if (top < 0)\n top = 0;\n\n var scrollMax = this.getScrollMax_();\n if (top > scrollMax)\n top = scrollMax;\n\n if (top != this.screen_.scrollTop) {\n // Moving scrollTop causes a scroll event, which triggers the redraw.\n this.screen_.scrollTop = top;\n }\n break;\n }\n\n // To disable gestures or anything else interfering with our scrolling.\n e.preventDefault();\n};\n\n/**\n * Handler for resize events.\n *\n * The browser will resize us such that the top row stays at the top, but we\n * prefer to the bottom row to stay at the bottom.\n */\nhterm.ScrollPort.prototype.onResize_ = function(e) {\n // Re-measure, since onResize also happens for browser zoom changes.\n this.syncCharacterSize();\n this.resize();\n};\n\n/**\n * Clients can override this if they want to hear copy events.\n *\n * Clients may call event.preventDefault() if they want to keep the scrollport\n * from also handling the events.\n */\nhterm.ScrollPort.prototype.onCopy = function(e) { };\n\n/**\n * Handler for copy-to-clipboard events.\n *\n * If some or all of the selected rows are off screen we may need to fill in\n * the rows between selection start and selection end. This handler determines\n * if we're missing some of the selected text, and if so populates one or both\n * of the \"select bags\" with the missing text.\n */\nhterm.ScrollPort.prototype.onCopy_ = function(e) {\n this.onCopy(e);\n\n if (e.defaultPrevented)\n return;\n\n this.resetSelectBags_();\n this.selection.sync();\n\n if (!this.selection.startRow ||\n this.selection.endRow.rowIndex - this.selection.startRow.rowIndex < 2) {\n return;\n }\n\n var topRowIndex = this.getTopRowIndex();\n var bottomRowIndex = this.getBottomRowIndex(topRowIndex);\n\n if (this.selection.startRow.rowIndex < topRowIndex) {\n // Start of selection is above the top fold.\n var endBackfillIndex;\n\n if (this.selection.endRow.rowIndex < topRowIndex) {\n // Entire selection is above the top fold.\n endBackfillIndex = this.selection.endRow.rowIndex;\n } else {\n // Selection extends below the top fold.\n endBackfillIndex = this.topFold_.nextSibling.rowIndex;\n }\n\n this.topSelectBag_.textContent = this.rowProvider_.getRowsText(\n this.selection.startRow.rowIndex + 1, endBackfillIndex);\n this.rowNodes_.insertBefore(this.topSelectBag_,\n this.selection.startRow.nextSibling);\n this.syncRowNodesDimensions_();\n }\n\n if (this.selection.endRow.rowIndex > bottomRowIndex) {\n // Selection ends below the bottom fold.\n var startBackfillIndex;\n\n if (this.selection.startRow.rowIndex > bottomRowIndex) {\n // Entire selection is below the bottom fold.\n startBackfillIndex = this.selection.startRow.rowIndex + 1;\n } else {\n // Selection starts above the bottom fold.\n startBackfillIndex = this.bottomFold_.previousSibling.rowIndex + 1;\n }\n\n this.bottomSelectBag_.textContent = this.rowProvider_.getRowsText(\n startBackfillIndex, this.selection.endRow.rowIndex);\n this.rowNodes_.insertBefore(this.bottomSelectBag_, this.selection.endRow);\n }\n};\n\n/**\n * Focuses on the paste target on a ctrl-v keydown event, as in\n * FF a content editable element must be focused before the paste event.\n */\nhterm.ScrollPort.prototype.onBodyKeyDown_ = function(e) {\n if (!this.ctrlVPaste)\n return;\n\n var key = String.fromCharCode(e.which);\n var lowerKey = key.toLowerCase();\n if ((e.ctrlKey || e.metaKey) && lowerKey == \"v\")\n this.pasteTarget_.focus();\n};\n\n/**\n * Handle a paste event on the the ScrollPort's screen element.\n */\nhterm.ScrollPort.prototype.onPaste_ = function(e) {\n this.pasteTarget_.focus();\n\n var self = this;\n setTimeout(function() {\n self.publish('paste', { text: self.pasteTarget_.value });\n self.pasteTarget_.value = '';\n self.screen_.focus();\n }, 0);\n};\n\n/**\n * Handles a textInput event on the paste target. Stops this from\n * propagating as we want this to be handled in the onPaste_ method.\n */\nhterm.ScrollPort.prototype.handlePasteTargetTextInput_ = function(e) {\n e.stopPropagation();\n};\n\n/**\n * Set the vertical scrollbar mode of the ScrollPort.\n */\nhterm.ScrollPort.prototype.setScrollbarVisible = function(state) {\n this.screen_.style.overflowY = state ? 'scroll' : 'hidden';\n};\n\n/**\n * Set scroll wheel multiplier. This alters how much the screen scrolls on\n * mouse wheel events.\n */\nhterm.ScrollPort.prototype.setScrollWheelMoveMultipler = function(multiplier) {\n this.scrollWheelMultiplier_ = multiplier;\n};\n// SOURCE FILE: hterm/js/hterm_terminal.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.colors', 'lib.PreferenceManager', 'lib.resource', 'lib.wc',\n 'lib.f', 'hterm.Keyboard', 'hterm.Options', 'hterm.PreferenceManager',\n 'hterm.Screen', 'hterm.ScrollPort', 'hterm.Size',\n 'hterm.TextAttributes', 'hterm.VT');\n\n/**\n * Constructor for the Terminal class.\n *\n * A Terminal pulls together the hterm.ScrollPort, hterm.Screen and hterm.VT100\n * classes to provide the complete terminal functionality.\n *\n * There are a number of lower-level Terminal methods that can be called\n * directly to manipulate the cursor, text, scroll region, and other terminal\n * attributes. However, the primary method is interpret(), which parses VT\n * escape sequences and invokes the appropriate Terminal methods.\n *\n * This class was heavily influenced by Cory Maccarrone's Framebuffer class.\n *\n * TODO(rginda): Eventually we're going to need to support characters which are\n * displayed twice as wide as standard latin characters. This is to support\n * CJK (and possibly other character sets).\n *\n * @param {string} opt_profileId Optional preference profile name. If not\n * provided, defaults to 'default'.\n */\nhterm.Terminal = function(opt_profileId) {\n this.profileId_ = null;\n\n // Two screen instances.\n this.primaryScreen_ = new hterm.Screen();\n this.alternateScreen_ = new hterm.Screen();\n\n // The \"current\" screen.\n this.screen_ = this.primaryScreen_;\n\n // The local notion of the screen size. ScreenBuffers also have a size which\n // indicates their present size. During size changes, the two may disagree.\n // Also, the inactive screen's size is not altered until it is made the active\n // screen.\n this.screenSize = new hterm.Size(0, 0);\n\n // The scroll port we'll be using to display the visible rows.\n this.scrollPort_ = new hterm.ScrollPort(this);\n this.scrollPort_.subscribe('resize', this.onResize_.bind(this));\n this.scrollPort_.subscribe('scroll', this.onScroll_.bind(this));\n this.scrollPort_.subscribe('paste', this.onPaste_.bind(this));\n this.scrollPort_.onCopy = this.onCopy_.bind(this);\n\n // The div that contains this terminal.\n this.div_ = null;\n\n // The document that contains the scrollPort. Defaulted to the global\n // document here so that the terminal is functional even if it hasn't been\n // inserted into a document yet, but re-set in decorate().\n this.document_ = window.document;\n\n // The rows that have scrolled off screen and are no longer addressable.\n this.scrollbackRows_ = [];\n\n // Saved tab stops.\n this.tabStops_ = [];\n\n // Keep track of whether default tab stops have been erased; after a TBC\n // clears all tab stops, defaults aren't restored on resize until a reset.\n this.defaultTabStops = true;\n\n // The VT's notion of the top and bottom rows. Used during some VT\n // cursor positioning and scrolling commands.\n this.vtScrollTop_ = null;\n this.vtScrollBottom_ = null;\n\n // The DIV element for the visible cursor.\n this.cursorNode_ = null;\n\n // The current cursor shape of the terminal.\n this.cursorShape_ = hterm.Terminal.cursorShape.BLOCK;\n\n // The current color of the cursor.\n this.cursorColor_ = null;\n\n // Cursor blink on/off cycle in ms, overwritten by prefs once they're loaded.\n this.cursorBlinkCycle_ = [100, 100];\n\n // Pre-bound onCursorBlink_ handler, so we don't have to do this for each\n // cursor on/off servicing.\n this.myOnCursorBlink_ = this.onCursorBlink_.bind(this);\n\n // These prefs are cached so we don't have to read from local storage with\n // each output and keystroke. They are initialized by the preference manager.\n this.backgroundColor_ = null;\n this.foregroundColor_ = null;\n this.scrollOnOutput_ = null;\n this.scrollOnKeystroke_ = null;\n this.scrollWheelArrowKeys_ = null;\n\n // True if we should override mouse event reporting to allow local selection.\n this.defeatMouseReports_ = false;\n\n // Terminal bell sound.\n this.bellAudio_ = this.document_.createElement('audio');\n this.bellAudio_.id = 'hterm:bell-audio';\n this.bellAudio_.setAttribute('preload', 'auto');\n\n // All terminal bell notifications that have been generated (not necessarily\n // shown).\n this.bellNotificationList_ = [];\n\n // Whether we have permission to display notifications.\n this.desktopNotificationBell_ = false;\n\n // Cursor position and attributes saved with DECSC.\n this.savedOptions_ = {};\n\n // The current mode bits for the terminal.\n this.options_ = new hterm.Options();\n\n // Timeouts we might need to clear.\n this.timeouts_ = {};\n\n // The VT escape sequence interpreter.\n this.vt = new hterm.VT(this);\n\n // The keyboard handler.\n this.keyboard = new hterm.Keyboard(this);\n\n // General IO interface that can be given to third parties without exposing\n // the entire terminal object.\n this.io = new hterm.Terminal.IO(this);\n\n // True if mouse-click-drag should scroll the terminal.\n this.enableMouseDragScroll = true;\n\n this.copyOnSelect = null;\n this.mouseRightClickPaste = null;\n this.mousePasteButton = null;\n\n // Whether to use the default window copy behavior.\n this.useDefaultWindowCopy = false;\n\n this.clearSelectionAfterCopy = true;\n\n this.realizeSize_(80, 24);\n this.setDefaultTabStops();\n\n this.setProfile(opt_profileId || 'default',\n function() { this.onTerminalReady(); }.bind(this));\n};\n\n/**\n * Possible cursor shapes.\n */\nhterm.Terminal.cursorShape = {\n BLOCK: 'BLOCK',\n BEAM: 'BEAM',\n UNDERLINE: 'UNDERLINE'\n};\n\n/**\n * Clients should override this to be notified when the terminal is ready\n * for use.\n *\n * The terminal initialization is asynchronous, and shouldn't be used before\n * this method is called.\n */\nhterm.Terminal.prototype.onTerminalReady = function() { };\n\n/**\n * Default tab with of 8 to match xterm.\n */\nhterm.Terminal.prototype.tabWidth = 8;\n\n/**\n * Select a preference profile.\n *\n * This will load the terminal preferences for the given profile name and\n * associate subsequent preference changes with the new preference profile.\n *\n * @param {string} profileId The name of the preference profile. Forward slash\n * characters will be removed from the name.\n * @param {function} opt_callback Optional callback to invoke when the profile\n * transition is complete.\n */\nhterm.Terminal.prototype.setProfile = function(profileId, opt_callback) {\n this.profileId_ = profileId.replace(/\\//g, '');\n\n var terminal = this;\n\n if (this.prefs_)\n this.prefs_.deactivate();\n\n this.prefs_ = new hterm.PreferenceManager(this.profileId_);\n this.prefs_.addObservers(null, {\n 'alt-gr-mode': function(v) {\n if (v == null) {\n if (navigator.language.toLowerCase() == 'en-us') {\n v = 'none';\n } else {\n v = 'right-alt';\n }\n } else if (typeof v == 'string') {\n v = v.toLowerCase();\n } else {\n v = 'none';\n }\n\n if (!/^(none|ctrl-alt|left-alt|right-alt)$/.test(v))\n v = 'none';\n\n terminal.keyboard.altGrMode = v;\n },\n\n 'alt-backspace-is-meta-backspace': function(v) {\n terminal.keyboard.altBackspaceIsMetaBackspace = v;\n },\n\n 'alt-is-meta': function(v) {\n terminal.keyboard.altIsMeta = v;\n },\n\n 'alt-sends-what': function(v) {\n if (!/^(escape|8-bit|browser-key)$/.test(v))\n v = 'escape';\n\n terminal.keyboard.altSendsWhat = v;\n },\n\n 'audible-bell-sound': function(v) {\n var ary = v.match(/^lib-resource:(\\S+)/);\n if (ary) {\n terminal.bellAudio_.setAttribute('src',\n lib.resource.getDataUrl(ary[1]));\n } else {\n terminal.bellAudio_.setAttribute('src', v);\n }\n },\n\n 'desktop-notification-bell': function(v) {\n if (v && Notification) {\n terminal.desktopNotificationBell_ =\n Notification.permission === 'granted';\n if (!terminal.desktopNotificationBell_) {\n // Note: We don't call Notification.requestPermission here because\n // Chrome requires the call be the result of a user action (such as an\n // onclick handler), and pref listeners are run asynchronously.\n //\n // A way of working around this would be to display a dialog in the\n // terminal with a \"click-to-request-permission\" button.\n console.warn('desktop-notification-bell is true but we do not have ' +\n 'permission to display notifications.');\n }\n } else {\n terminal.desktopNotificationBell_ = false;\n }\n },\n\n 'background-color': function(v) {\n terminal.setBackgroundColor(v);\n },\n\n 'background-image': function(v) {\n terminal.scrollPort_.setBackgroundImage(v);\n },\n\n 'background-size': function(v) {\n terminal.scrollPort_.setBackgroundSize(v);\n },\n\n 'background-position': function(v) {\n terminal.scrollPort_.setBackgroundPosition(v);\n },\n\n 'backspace-sends-backspace': function(v) {\n terminal.keyboard.backspaceSendsBackspace = v;\n },\n\n 'character-map-overrides': function(v) {\n if (!(v == null || v instanceof Object)) {\n console.warn('Preference character-map-modifications is not an ' +\n 'object: ' + v);\n return;\n }\n\n terminal.vt.characterMaps.reset();\n terminal.vt.characterMaps.setOverrides(v);\n },\n\n 'cursor-blink': function(v) {\n terminal.setCursorBlink(!!v);\n },\n\n 'cursor-blink-cycle': function(v) {\n if (v instanceof Array &&\n typeof v[0] == 'number' &&\n typeof v[1] == 'number') {\n terminal.cursorBlinkCycle_ = v;\n } else if (typeof v == 'number') {\n terminal.cursorBlinkCycle_ = [v, v];\n } else {\n // Fast blink indicates an error.\n terminal.cursorBlinkCycle_ = [100, 100];\n }\n },\n\n 'cursor-color': function(v) {\n terminal.setCursorColor(v);\n },\n\n 'color-palette-overrides': function(v) {\n if (!(v == null || v instanceof Object || v instanceof Array)) {\n console.warn('Preference color-palette-overrides is not an array or ' +\n 'object: ' + v);\n return;\n }\n\n lib.colors.colorPalette = lib.colors.stockColorPalette.concat();\n\n if (v) {\n for (var key in v) {\n var i = parseInt(key);\n if (isNaN(i) || i < 0 || i > 255) {\n console.log('Invalid value in palette: ' + key + ': ' + v[key]);\n continue;\n }\n\n if (v[i]) {\n var rgb = lib.colors.normalizeCSS(v[i]);\n if (rgb)\n lib.colors.colorPalette[i] = rgb;\n }\n }\n }\n\n terminal.primaryScreen_.textAttributes.resetColorPalette();\n terminal.alternateScreen_.textAttributes.resetColorPalette();\n },\n\n 'copy-on-select': function(v) {\n terminal.copyOnSelect = !!v;\n },\n\n 'use-default-window-copy': function(v) {\n terminal.useDefaultWindowCopy = !!v;\n },\n\n 'clear-selection-after-copy': function(v) {\n terminal.clearSelectionAfterCopy = !!v;\n },\n\n 'ctrl-plus-minus-zero-zoom': function(v) {\n terminal.keyboard.ctrlPlusMinusZeroZoom = v;\n },\n\n 'ctrl-c-copy': function(v) {\n terminal.keyboard.ctrlCCopy = v;\n },\n\n 'ctrl-v-paste': function(v) {\n terminal.keyboard.ctrlVPaste = v;\n terminal.scrollPort_.setCtrlVPaste(v);\n },\n\n 'east-asian-ambiguous-as-two-column': function(v) {\n lib.wc.regardCjkAmbiguous = v;\n },\n\n 'enable-8-bit-control': function(v) {\n terminal.vt.enable8BitControl = !!v;\n },\n\n 'enable-bold': function(v) {\n terminal.syncBoldSafeState();\n },\n\n 'enable-bold-as-bright': function(v) {\n terminal.primaryScreen_.textAttributes.enableBoldAsBright = !!v;\n terminal.alternateScreen_.textAttributes.enableBoldAsBright = !!v;\n },\n\n 'enable-blink': function(v) {\n terminal.syncBlinkState();\n },\n\n 'enable-clipboard-write': function(v) {\n terminal.vt.enableClipboardWrite = !!v;\n },\n\n 'enable-dec12': function(v) {\n terminal.vt.enableDec12 = !!v;\n },\n\n 'font-family': function(v) {\n terminal.syncFontFamily();\n },\n\n 'font-size': function(v) {\n terminal.setFontSize(v);\n },\n\n 'font-smoothing': function(v) {\n terminal.syncFontFamily();\n },\n\n 'foreground-color': function(v) {\n terminal.setForegroundColor(v);\n },\n\n 'home-keys-scroll': function(v) {\n terminal.keyboard.homeKeysScroll = v;\n },\n\n 'keybindings': function(v) {\n terminal.keyboard.bindings.clear();\n\n if (!v)\n return;\n\n if (!(v instanceof Object)) {\n console.error('Error in keybindings preference: Expected object');\n return;\n }\n\n try {\n terminal.keyboard.bindings.addBindings(v);\n } catch (ex) {\n console.error('Error in keybindings preference: ' + ex);\n }\n },\n\n 'max-string-sequence': function(v) {\n terminal.vt.maxStringSequence = v;\n },\n\n 'media-keys-are-fkeys': function(v) {\n terminal.keyboard.mediaKeysAreFKeys = v;\n },\n\n 'meta-sends-escape': function(v) {\n terminal.keyboard.metaSendsEscape = v;\n },\n\n 'mouse-right-click-paste': function(v) {\n terminal.mouseRightClickPaste = v;\n },\n\n 'mouse-paste-button': function(v) {\n terminal.syncMousePasteButton();\n },\n\n 'page-keys-scroll': function(v) {\n terminal.keyboard.pageKeysScroll = v;\n },\n\n 'pass-alt-number': function(v) {\n if (v == null) {\n var osx = window.navigator.userAgent.match(/Mac OS X/);\n\n // Let Alt-1..9 pass to the browser (to control tab switching) on\n // non-OS X systems, or if hterm is not opened in an app window.\n v = (!osx && hterm.windowType != 'popup');\n }\n\n terminal.passAltNumber = v;\n },\n\n 'pass-ctrl-number': function(v) {\n if (v == null) {\n var osx = window.navigator.userAgent.match(/Mac OS X/);\n\n // Let Ctrl-1..9 pass to the browser (to control tab switching) on\n // non-OS X systems, or if hterm is not opened in an app window.\n v = (!osx && hterm.windowType != 'popup');\n }\n\n terminal.passCtrlNumber = v;\n },\n\n 'pass-meta-number': function(v) {\n if (v == null) {\n var osx = window.navigator.userAgent.match(/Mac OS X/);\n\n // Let Meta-1..9 pass to the browser (to control tab switching) on\n // OS X systems, or if hterm is not opened in an app window.\n v = (osx && hterm.windowType != 'popup');\n }\n\n terminal.passMetaNumber = v;\n },\n\n 'pass-meta-v': function(v) {\n terminal.keyboard.passMetaV = v;\n },\n\n 'receive-encoding': function(v) {\n if (!(/^(utf-8|raw)$/).test(v)) {\n console.warn('Invalid value for \"receive-encoding\": ' + v);\n v = 'utf-8';\n }\n\n terminal.vt.characterEncoding = v;\n },\n\n 'scroll-on-keystroke': function(v) {\n terminal.scrollOnKeystroke_ = v;\n },\n\n 'scroll-on-output': function(v) {\n terminal.scrollOnOutput_ = v;\n },\n\n 'scrollbar-visible': function(v) {\n terminal.setScrollbarVisible(v);\n },\n\n 'scroll-wheel-may-send-arrow-keys': function(v) {\n terminal.scrollWheelArrowKeys_ = v;\n },\n\n 'scroll-wheel-move-multiplier': function(v) {\n terminal.setScrollWheelMoveMultipler(v);\n },\n\n 'send-encoding': function(v) {\n if (!(/^(utf-8|raw)$/).test(v)) {\n console.warn('Invalid value for \"send-encoding\": ' + v);\n v = 'utf-8';\n }\n\n terminal.keyboard.characterEncoding = v;\n },\n\n 'shift-insert-paste': function(v) {\n terminal.keyboard.shiftInsertPaste = v;\n },\n\n 'terminal-encoding': function(v) {\n terminal.vt.setEncoding(v);\n },\n\n 'user-css': function(v) {\n terminal.scrollPort_.setUserCssUrl(v);\n },\n\n 'user-css-text': function(v) {\n terminal.scrollPort_.setUserCssText(v);\n },\n\n 'word-break-match-left': function(v) {\n terminal.primaryScreen_.wordBreakMatchLeft = v;\n terminal.alternateScreen_.wordBreakMatchLeft = v;\n },\n\n 'word-break-match-right': function(v) {\n terminal.primaryScreen_.wordBreakMatchRight = v;\n terminal.alternateScreen_.wordBreakMatchRight = v;\n },\n\n 'word-break-match-middle': function(v) {\n terminal.primaryScreen_.wordBreakMatchMiddle = v;\n terminal.alternateScreen_.wordBreakMatchMiddle = v;\n },\n });\n\n this.prefs_.readStorage(function() {\n this.prefs_.notifyAll();\n\n if (opt_callback)\n opt_callback();\n }.bind(this));\n};\n\n\n/**\n * Returns the preferences manager used for configuring this terminal.\n *\n * @return {hterm.PreferenceManager}\n */\nhterm.Terminal.prototype.getPrefs = function() {\n return this.prefs_;\n};\n\n/**\n * Enable or disable bracketed paste mode.\n *\n * @param {boolean} state The value to set.\n */\nhterm.Terminal.prototype.setBracketedPaste = function(state) {\n this.options_.bracketedPaste = state;\n};\n\n/**\n * Set the color for the cursor.\n *\n * If you want this setting to persist, set it through prefs_, rather than\n * with this method.\n *\n * @param {string} color The color to set.\n */\nhterm.Terminal.prototype.setCursorColor = function(color) {\n this.cursorColor_ = color;\n this.cursorNode_.style.backgroundColor = color;\n this.cursorNode_.style.borderColor = color;\n};\n\n/**\n * Return the current cursor color as a string.\n * @return {string}\n */\nhterm.Terminal.prototype.getCursorColor = function() {\n return this.cursorColor_;\n};\n\n/**\n * Enable or disable mouse based text selection in the terminal.\n *\n * @param {boolean} state The value to set.\n */\nhterm.Terminal.prototype.setSelectionEnabled = function(state) {\n this.enableMouseDragScroll = state;\n};\n\n/**\n * Set the background color.\n *\n * If you want this setting to persist, set it through prefs_, rather than\n * with this method.\n *\n * @param {string} color The color to set.\n */\nhterm.Terminal.prototype.setBackgroundColor = function(color) {\n this.backgroundColor_ = lib.colors.normalizeCSS(color);\n this.primaryScreen_.textAttributes.setDefaults(\n this.foregroundColor_, this.backgroundColor_);\n this.alternateScreen_.textAttributes.setDefaults(\n this.foregroundColor_, this.backgroundColor_);\n this.scrollPort_.setBackgroundColor(color);\n};\n\n/**\n * Return the current terminal background color.\n *\n * Intended for use by other classes, so we don't have to expose the entire\n * prefs_ object.\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getBackgroundColor = function() {\n return this.backgroundColor_;\n};\n\n/**\n * Set the foreground color.\n *\n * If you want this setting to persist, set it through prefs_, rather than\n * with this method.\n *\n * @param {string} color The color to set.\n */\nhterm.Terminal.prototype.setForegroundColor = function(color) {\n this.foregroundColor_ = lib.colors.normalizeCSS(color);\n this.primaryScreen_.textAttributes.setDefaults(\n this.foregroundColor_, this.backgroundColor_);\n this.alternateScreen_.textAttributes.setDefaults(\n this.foregroundColor_, this.backgroundColor_);\n this.scrollPort_.setForegroundColor(color);\n};\n\n/**\n * Return the current terminal foreground color.\n *\n * Intended for use by other classes, so we don't have to expose the entire\n * prefs_ object.\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getForegroundColor = function() {\n return this.foregroundColor_;\n};\n\n/**\n * Create a new instance of a terminal command and run it with a given\n * argument string.\n *\n * @param {function} commandClass The constructor for a terminal command.\n * @param {string} argString The argument string to pass to the command.\n */\nhterm.Terminal.prototype.runCommandClass = function(commandClass, argString) {\n var environment = this.prefs_.get('environment');\n if (typeof environment != 'object' || environment == null)\n environment = {};\n\n var self = this;\n this.command = new commandClass(\n { argString: argString || '',\n io: this.io.push(),\n environment: environment,\n onExit: function(code) {\n self.io.pop();\n self.uninstallKeyboard();\n if (self.prefs_.get('close-on-exit'))\n window.close();\n }\n });\n\n this.installKeyboard();\n this.command.run();\n};\n\n/**\n * Returns true if the current screen is the primary screen, false otherwise.\n *\n * @return {boolean}\n */\nhterm.Terminal.prototype.isPrimaryScreen = function() {\n return this.screen_ == this.primaryScreen_;\n};\n\n/**\n * Install the keyboard handler for this terminal.\n *\n * This will prevent the browser from seeing any keystrokes sent to the\n * terminal.\n */\nhterm.Terminal.prototype.installKeyboard = function() {\n this.keyboard.installKeyboard(this.scrollPort_.getDocument().body);\n}\n\n/**\n * Uninstall the keyboard handler for this terminal.\n */\nhterm.Terminal.prototype.uninstallKeyboard = function() {\n this.keyboard.installKeyboard(null);\n}\n\n/**\n * Set a CSS variable.\n *\n * Normally this is used to set variables in the hterm namespace.\n *\n * @param {string} name The variable to set.\n * @param {string} value The value to assign to the variable.\n * @param {string?} opt_prefix The variable namespace/prefix to use.\n */\nhterm.Terminal.prototype.setCssVar = function(name, value,\n opt_prefix='--hterm-') {\n this.document_.documentElement.style.setProperty(\n `${opt_prefix}${name}`, value);\n};\n\n/**\n * Set the font size for this terminal.\n *\n * Call setFontSize(0) to reset to the default font size.\n *\n * This function does not modify the font-size preference.\n *\n * @param {number} px The desired font size, in pixels.\n */\nhterm.Terminal.prototype.setFontSize = function(px) {\n if (px === 0)\n px = this.prefs_.get('font-size');\n\n this.scrollPort_.setFontSize(px);\n this.setCssVar('charsize-width', this.scrollPort_.characterSize.width + 'px');\n this.setCssVar('charsize-height',\n this.scrollPort_.characterSize.height + 'px');\n};\n\n/**\n * Get the current font size.\n *\n * @return {number}\n */\nhterm.Terminal.prototype.getFontSize = function() {\n return this.scrollPort_.getFontSize();\n};\n\n/**\n * Get the current font family.\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getFontFamily = function() {\n return this.scrollPort_.getFontFamily();\n};\n\n/**\n * Set the CSS \"font-family\" for this terminal.\n */\nhterm.Terminal.prototype.syncFontFamily = function() {\n this.scrollPort_.setFontFamily(this.prefs_.get('font-family'),\n this.prefs_.get('font-smoothing'));\n this.syncBoldSafeState();\n};\n\n/**\n * Set this.mousePasteButton based on the mouse-paste-button pref,\n * autodetecting if necessary.\n */\nhterm.Terminal.prototype.syncMousePasteButton = function() {\n var button = this.prefs_.get('mouse-paste-button');\n if (typeof button == 'number') {\n this.mousePasteButton = button;\n return;\n }\n\n var ary = navigator.userAgent.match(/\\(X11;\\s+(\\S+)/);\n if (!ary || ary[1] == 'CrOS') {\n this.mousePasteButton = 1; // Middle mouse button.\n } else {\n this.mousePasteButton = 2; // Right mouse button.\n }\n};\n\n/**\n * Enable or disable bold based on the enable-bold pref, autodetecting if\n * necessary.\n */\nhterm.Terminal.prototype.syncBoldSafeState = function() {\n var enableBold = this.prefs_.get('enable-bold');\n if (enableBold !== null) {\n this.primaryScreen_.textAttributes.enableBold = enableBold;\n this.alternateScreen_.textAttributes.enableBold = enableBold;\n return;\n }\n\n var normalSize = this.scrollPort_.measureCharacterSize();\n var boldSize = this.scrollPort_.measureCharacterSize('bold');\n\n var isBoldSafe = normalSize.equals(boldSize);\n if (!isBoldSafe) {\n console.warn('Bold characters disabled: Size of bold weight differs ' +\n 'from normal. Font family is: ' +\n this.scrollPort_.getFontFamily());\n }\n\n this.primaryScreen_.textAttributes.enableBold = isBoldSafe;\n this.alternateScreen_.textAttributes.enableBold = isBoldSafe;\n};\n\n/**\n * Enable or disable blink based on the enable-blink pref.\n */\nhterm.Terminal.prototype.syncBlinkState = function() {\n this.setCssVar('node-duration',\n this.prefs_.get('enable-blink') ? '0.7s' : '0');\n};\n\n/**\n * Set the mouse cursor style based on the current terminal mode.\n */\nhterm.Terminal.prototype.syncMouseStyle = function() {\n this.setCssVar('mouse-cursor-style',\n this.vt.mouseReport == this.vt.MOUSE_REPORT_DISABLED ?\n 'var(--hterm-mouse-cursor-text)' :\n 'var(--hterm-mouse-cursor-pointer)');\n};\n\n/**\n * Return a copy of the current cursor position.\n *\n * @return {hterm.RowCol} The RowCol object representing the current position.\n */\nhterm.Terminal.prototype.saveCursor = function() {\n return this.screen_.cursorPosition.clone();\n};\n\n/**\n * Return the current text attributes.\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getTextAttributes = function() {\n return this.screen_.textAttributes;\n};\n\n/**\n * Set the text attributes.\n *\n * @param {string} textAttributes The attributes to set.\n */\nhterm.Terminal.prototype.setTextAttributes = function(textAttributes) {\n this.screen_.textAttributes = textAttributes;\n};\n\n/**\n * Return the current browser zoom factor applied to the terminal.\n *\n * @return {number} The current browser zoom factor.\n */\nhterm.Terminal.prototype.getZoomFactor = function() {\n return this.scrollPort_.characterSize.zoomFactor;\n};\n\n/**\n * Change the title of this terminal's window.\n *\n * @param {string} title The title to set.\n */\nhterm.Terminal.prototype.setWindowTitle = function(title) {\n window.document.title = title;\n};\n\n/**\n * Restore a previously saved cursor position.\n *\n * @param {hterm.RowCol} cursor The position to restore.\n */\nhterm.Terminal.prototype.restoreCursor = function(cursor) {\n var row = lib.f.clamp(cursor.row, 0, this.screenSize.height - 1);\n var column = lib.f.clamp(cursor.column, 0, this.screenSize.width - 1);\n this.screen_.setCursorPosition(row, column);\n if (cursor.column > column ||\n cursor.column == column && cursor.overflow) {\n this.screen_.cursorPosition.overflow = true;\n }\n};\n\n/**\n * Clear the cursor's overflow flag.\n */\nhterm.Terminal.prototype.clearCursorOverflow = function() {\n this.screen_.cursorPosition.overflow = false;\n};\n\n/**\n * Sets the cursor shape\n *\n * @param {string} shape The shape to set.\n */\nhterm.Terminal.prototype.setCursorShape = function(shape) {\n this.cursorShape_ = shape;\n this.restyleCursor_();\n}\n\n/**\n * Get the cursor shape\n *\n * @return {string}\n */\nhterm.Terminal.prototype.getCursorShape = function() {\n return this.cursorShape_;\n}\n\n/**\n * Set the width of the terminal, resizing the UI to match.\n *\n * @param {number} columnCount\n */\nhterm.Terminal.prototype.setWidth = function(columnCount) {\n if (columnCount == null) {\n this.div_.style.width = '100%';\n return;\n }\n\n this.div_.style.width = Math.ceil(\n this.scrollPort_.characterSize.width *\n columnCount + this.scrollPort_.currentScrollbarWidthPx) + 'px';\n this.realizeSize_(columnCount, this.screenSize.height);\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * Set the height of the terminal, resizing the UI to match.\n *\n * @param {number} rowCount The height in rows.\n */\nhterm.Terminal.prototype.setHeight = function(rowCount) {\n if (rowCount == null) {\n this.div_.style.height = '100%';\n return;\n }\n\n this.div_.style.height =\n this.scrollPort_.characterSize.height * rowCount + 'px';\n this.realizeSize_(this.screenSize.width, rowCount);\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * Deal with terminal size changes.\n *\n * @param {number} columnCount The number of columns.\n * @param {number} rowCount The number of rows.\n */\nhterm.Terminal.prototype.realizeSize_ = function(columnCount, rowCount) {\n if (columnCount != this.screenSize.width)\n this.realizeWidth_(columnCount);\n\n if (rowCount != this.screenSize.height)\n this.realizeHeight_(rowCount);\n\n // Send new terminal size to plugin.\n this.io.onTerminalResize_(columnCount, rowCount);\n};\n\n/**\n * Deal with terminal width changes.\n *\n * This function does what needs to be done when the terminal width changes\n * out from under us. It happens here rather than in onResize_() because this\n * code may need to run synchronously to handle programmatic changes of\n * terminal width.\n *\n * Relying on the browser to send us an async resize event means we may not be\n * in the correct state yet when the next escape sequence hits.\n *\n * @param {number} columnCount The number of columns.\n */\nhterm.Terminal.prototype.realizeWidth_ = function(columnCount) {\n if (columnCount <= 0)\n throw new Error('Attempt to realize bad width: ' + columnCount);\n\n var deltaColumns = columnCount - this.screen_.getWidth();\n\n this.screenSize.width = columnCount;\n this.screen_.setColumnCount(columnCount);\n\n if (deltaColumns > 0) {\n if (this.defaultTabStops)\n this.setDefaultTabStops(this.screenSize.width - deltaColumns);\n } else {\n for (var i = this.tabStops_.length - 1; i >= 0; i--) {\n if (this.tabStops_[i] < columnCount)\n break;\n\n this.tabStops_.pop();\n }\n }\n\n this.screen_.setColumnCount(this.screenSize.width);\n};\n\n/**\n * Deal with terminal height changes.\n *\n * This function does what needs to be done when the terminal height changes\n * out from under us. It happens here rather than in onResize_() because this\n * code may need to run synchronously to handle programmatic changes of\n * terminal height.\n *\n * Relying on the browser to send us an async resize event means we may not be\n * in the correct state yet when the next escape sequence hits.\n *\n * @param {number} rowCount The number of rows.\n */\nhterm.Terminal.prototype.realizeHeight_ = function(rowCount) {\n if (rowCount <= 0)\n throw new Error('Attempt to realize bad height: ' + rowCount);\n\n var deltaRows = rowCount - this.screen_.getHeight();\n\n this.screenSize.height = rowCount;\n\n var cursor = this.saveCursor();\n\n if (deltaRows < 0) {\n // Screen got smaller.\n deltaRows *= -1;\n while (deltaRows) {\n var lastRow = this.getRowCount() - 1;\n if (lastRow - this.scrollbackRows_.length == cursor.row)\n break;\n\n if (this.getRowText(lastRow))\n break;\n\n this.screen_.popRow();\n deltaRows--;\n }\n\n var ary = this.screen_.shiftRows(deltaRows);\n this.scrollbackRows_.push.apply(this.scrollbackRows_, ary);\n\n // We just removed rows from the top of the screen, we need to update\n // the cursor to match.\n cursor.row = Math.max(cursor.row - deltaRows, 0);\n } else if (deltaRows > 0) {\n // Screen got larger.\n\n if (deltaRows <= this.scrollbackRows_.length) {\n var scrollbackCount = Math.min(deltaRows, this.scrollbackRows_.length);\n var rows = this.scrollbackRows_.splice(\n this.scrollbackRows_.length - scrollbackCount, scrollbackCount);\n this.screen_.unshiftRows(rows);\n deltaRows -= scrollbackCount;\n cursor.row += scrollbackCount;\n }\n\n if (deltaRows)\n this.appendRows_(deltaRows);\n }\n\n this.setVTScrollRegion(null, null);\n this.restoreCursor(cursor);\n};\n\n/**\n * Scroll the terminal to the top of the scrollback buffer.\n */\nhterm.Terminal.prototype.scrollHome = function() {\n this.scrollPort_.scrollRowToTop(0);\n};\n\n/**\n * Scroll the terminal to the end.\n */\nhterm.Terminal.prototype.scrollEnd = function() {\n this.scrollPort_.scrollRowToBottom(this.getRowCount());\n};\n\n/**\n * Scroll the terminal one page up (minus one line) relative to the current\n * position.\n */\nhterm.Terminal.prototype.scrollPageUp = function() {\n var i = this.scrollPort_.getTopRowIndex();\n this.scrollPort_.scrollRowToTop(i - this.screenSize.height + 1);\n};\n\n/**\n * Scroll the terminal one page down (minus one line) relative to the current\n * position.\n */\nhterm.Terminal.prototype.scrollPageDown = function() {\n var i = this.scrollPort_.getTopRowIndex();\n this.scrollPort_.scrollRowToTop(i + this.screenSize.height - 1);\n};\n\n/**\n * Scroll the terminal one line up relative to the current position.\n */\nhterm.Terminal.prototype.scrollLineUp = function() {\n var i = this.scrollPort_.getTopRowIndex();\n this.scrollPort_.scrollRowToTop(i - 1);\n};\n\n/**\n * Scroll the terminal one line down relative to the current position.\n */\nhterm.Terminal.prototype.scrollLineDown = function() {\n var i = this.scrollPort_.getTopRowIndex();\n this.scrollPort_.scrollRowToTop(i + 1);\n};\n\n/**\n * Clear primary screen, secondary screen, and the scrollback buffer.\n */\nhterm.Terminal.prototype.wipeContents = function() {\n this.scrollbackRows_.length = 0;\n this.scrollPort_.resetCache();\n\n [this.primaryScreen_, this.alternateScreen_].forEach(function(screen) {\n var bottom = screen.getHeight();\n if (bottom > 0) {\n this.renumberRows_(0, bottom);\n this.clearHome(screen);\n }\n }.bind(this));\n\n this.syncCursorPosition_();\n this.scrollPort_.invalidate();\n};\n\n/**\n * Full terminal reset.\n */\nhterm.Terminal.prototype.reset = function() {\n this.clearAllTabStops();\n this.setDefaultTabStops();\n\n this.clearHome(this.primaryScreen_);\n this.primaryScreen_.textAttributes.reset();\n\n this.clearHome(this.alternateScreen_);\n this.alternateScreen_.textAttributes.reset();\n\n this.setCursorBlink(!!this.prefs_.get('cursor-blink'));\n\n this.vt.reset();\n\n this.softReset();\n};\n\n/**\n * Soft terminal reset.\n *\n * Perform a soft reset to the default values listed in\n * http://www.vt100.net/docs/vt510-rm/DECSTR#T5-9\n */\nhterm.Terminal.prototype.softReset = function() {\n // Reset terminal options to their default values.\n this.options_ = new hterm.Options();\n\n // We show the cursor on soft reset but do not alter the blink state.\n this.options_.cursorBlink = !!this.timeouts_.cursorBlink;\n\n // Xterm also resets the color palette on soft reset, even though it doesn't\n // seem to be documented anywhere.\n this.primaryScreen_.textAttributes.resetColorPalette();\n this.alternateScreen_.textAttributes.resetColorPalette();\n\n // The xterm man page explicitly says this will happen on soft reset.\n this.setVTScrollRegion(null, null);\n\n // Xterm also shows the cursor on soft reset, but does not alter the blink\n // state.\n this.setCursorVisible(true);\n};\n\n/**\n * Move the cursor forward to the next tab stop, or to the last column\n * if no more tab stops are set.\n */\nhterm.Terminal.prototype.forwardTabStop = function() {\n var column = this.screen_.cursorPosition.column;\n\n for (var i = 0; i < this.tabStops_.length; i++) {\n if (this.tabStops_[i] > column) {\n this.setCursorColumn(this.tabStops_[i]);\n return;\n }\n }\n\n // xterm does not clear the overflow flag on HT or CHT.\n var overflow = this.screen_.cursorPosition.overflow;\n this.setCursorColumn(this.screenSize.width - 1);\n this.screen_.cursorPosition.overflow = overflow;\n};\n\n/**\n * Move the cursor backward to the previous tab stop, or to the first column\n * if no previous tab stops are set.\n */\nhterm.Terminal.prototype.backwardTabStop = function() {\n var column = this.screen_.cursorPosition.column;\n\n for (var i = this.tabStops_.length - 1; i >= 0; i--) {\n if (this.tabStops_[i] < column) {\n this.setCursorColumn(this.tabStops_[i]);\n return;\n }\n }\n\n this.setCursorColumn(1);\n};\n\n/**\n * Set a tab stop at the given column.\n *\n * @param {integer} column Zero based column.\n */\nhterm.Terminal.prototype.setTabStop = function(column) {\n for (var i = this.tabStops_.length - 1; i >= 0; i--) {\n if (this.tabStops_[i] == column)\n return;\n\n if (this.tabStops_[i] < column) {\n this.tabStops_.splice(i + 1, 0, column);\n return;\n }\n }\n\n this.tabStops_.splice(0, 0, column);\n};\n\n/**\n * Clear the tab stop at the current cursor position.\n *\n * No effect if there is no tab stop at the current cursor position.\n */\nhterm.Terminal.prototype.clearTabStopAtCursor = function() {\n var column = this.screen_.cursorPosition.column;\n\n var i = this.tabStops_.indexOf(column);\n if (i == -1)\n return;\n\n this.tabStops_.splice(i, 1);\n};\n\n/**\n * Clear all tab stops.\n */\nhterm.Terminal.prototype.clearAllTabStops = function() {\n this.tabStops_.length = 0;\n this.defaultTabStops = false;\n};\n\n/**\n * Set up the default tab stops, starting from a given column.\n *\n * This sets a tabstop every (column % this.tabWidth) column, starting\n * from the specified column, or 0 if no column is provided. It also flags\n * future resizes to set them up.\n *\n * This does not clear the existing tab stops first, use clearAllTabStops\n * for that.\n *\n * @param {integer} opt_start Optional starting zero based starting column, useful\n * for filling out missing tab stops when the terminal is resized.\n */\nhterm.Terminal.prototype.setDefaultTabStops = function(opt_start) {\n var start = opt_start || 0;\n var w = this.tabWidth;\n // Round start up to a default tab stop.\n start = start - 1 - ((start - 1) % w) + w;\n for (var i = start; i < this.screenSize.width; i += w) {\n this.setTabStop(i);\n }\n\n this.defaultTabStops = true;\n};\n\n/**\n * Interpret a sequence of characters.\n *\n * Incomplete escape sequences are buffered until the next call.\n *\n * @param {string} str Sequence of characters to interpret or pass through.\n */\nhterm.Terminal.prototype.interpret = function(str) {\n this.vt.interpret(str);\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * Take over the given DIV for use as the terminal display.\n *\n * @param {HTMLDivElement} div The div to use as the terminal display.\n */\nhterm.Terminal.prototype.decorate = function(div) {\n this.div_ = div;\n\n this.scrollPort_.decorate(div);\n this.scrollPort_.setBackgroundImage(this.prefs_.get('background-image'));\n this.scrollPort_.setBackgroundSize(this.prefs_.get('background-size'));\n this.scrollPort_.setBackgroundPosition(\n this.prefs_.get('background-position'));\n this.scrollPort_.setUserCssUrl(this.prefs_.get('user-css'));\n this.scrollPort_.setUserCssText(this.prefs_.get('user-css-text'));\n\n this.div_.focus = this.focus.bind(this);\n\n this.setFontSize(this.prefs_.get('font-size'));\n this.syncFontFamily();\n\n this.setScrollbarVisible(this.prefs_.get('scrollbar-visible'));\n this.setScrollWheelMoveMultipler(\n this.prefs_.get('scroll-wheel-move-multiplier'));\n\n this.document_ = this.scrollPort_.getDocument();\n\n this.document_.body.oncontextmenu = function() { return false; };\n\n var onMouse = this.onMouse_.bind(this);\n var screenNode = this.scrollPort_.getScreenNode();\n screenNode.addEventListener('mousedown', onMouse);\n screenNode.addEventListener('mouseup', onMouse);\n screenNode.addEventListener('mousemove', onMouse);\n this.scrollPort_.onScrollWheel = onMouse;\n\n screenNode.addEventListener(\n 'focus', this.onFocusChange_.bind(this, true));\n // Listen for mousedown events on the screenNode as in FF the focus\n // events don't bubble.\n screenNode.addEventListener('mousedown', function() {\n setTimeout(this.onFocusChange_.bind(this, true));\n }.bind(this));\n\n screenNode.addEventListener(\n 'blur', this.onFocusChange_.bind(this, false));\n\n var style = this.document_.createElement('style');\n style.textContent =\n ('.cursor-node[focus=\"false\"] {' +\n ' box-sizing: border-box;' +\n ' background-color: transparent !important;' +\n ' border-width: 2px;' +\n ' border-style: solid;' +\n '}' +\n '.wc-node {' +\n ' display: inline-block;' +\n ' text-align: center;' +\n ' width: calc(var(--hterm-charsize-width) * 2);' +\n ' line-height: var(--hterm-charsize-height);' +\n '}' +\n ':root {' +\n ' --hterm-charsize-width: ' + this.scrollPort_.characterSize.width + 'px;' +\n ' --hterm-charsize-height: ' + this.scrollPort_.characterSize.height + 'px;' +\n ' --hterm-cursor-offset-col: 0;' +\n ' --hterm-cursor-offset-row: 0;' +\n ' --hterm-blink-node-duration: 0.7s;' +\n ' --hterm-mouse-cursor-text: text;' +\n ' --hterm-mouse-cursor-pointer: default;' +\n ' --hterm-mouse-cursor-style: var(--hterm-mouse-cursor-text);' +\n '}' +\n '@keyframes blink {' +\n ' from { opacity: 1.0; }' +\n ' to { opacity: 0.0; }' +\n '}' +\n '.blink-node {' +\n ' animation-name: blink;' +\n ' animation-duration: var(--hterm-blink-node-duration);' +\n ' animation-iteration-count: infinite;' +\n ' animation-timing-function: ease-in-out;' +\n ' animation-direction: alternate;' +\n '}');\n this.document_.head.appendChild(style);\n\n this.cursorNode_ = this.document_.createElement('div');\n this.cursorNode_.id = 'hterm:terminal-cursor';\n this.cursorNode_.className = 'cursor-node';\n this.cursorNode_.style.cssText =\n ('position: absolute;' +\n 'left: calc(var(--hterm-charsize-width) * var(--hterm-cursor-offset-col));' +\n 'top: calc(var(--hterm-charsize-height) * var(--hterm-cursor-offset-row));' +\n 'display: block;' +\n 'width: var(--hterm-charsize-width);' +\n 'height: var(--hterm-charsize-height);' +\n '-webkit-transition: opacity, background-color 100ms linear;' +\n '-moz-transition: opacity, background-color 100ms linear;');\n\n this.setCursorColor(this.prefs_.get('cursor-color'));\n this.setCursorBlink(!!this.prefs_.get('cursor-blink'));\n this.restyleCursor_();\n\n this.document_.body.appendChild(this.cursorNode_);\n\n // When 'enableMouseDragScroll' is off we reposition this element directly\n // under the mouse cursor after a click. This makes Chrome associate\n // subsequent mousemove events with the scroll-blocker. Since the\n // scroll-blocker is a peer (not a child) of the scrollport, the mousemove\n // events do not cause the scrollport to scroll.\n //\n // It's a hack, but it's the cleanest way I could find.\n this.scrollBlockerNode_ = this.document_.createElement('div');\n this.scrollBlockerNode_.id = 'hterm:mouse-drag-scroll-blocker';\n this.scrollBlockerNode_.style.cssText =\n ('position: absolute;' +\n 'top: -99px;' +\n 'display: block;' +\n 'width: 10px;' +\n 'height: 10px;');\n this.document_.body.appendChild(this.scrollBlockerNode_);\n\n this.scrollPort_.onScrollWheel = onMouse;\n ['mousedown', 'mouseup', 'mousemove', 'click', 'dblclick',\n ].forEach(function(event) {\n this.scrollBlockerNode_.addEventListener(event, onMouse);\n this.cursorNode_.addEventListener(event, onMouse);\n this.document_.addEventListener(event, onMouse);\n }.bind(this));\n\n this.cursorNode_.addEventListener('mousedown', function() {\n setTimeout(this.focus.bind(this));\n }.bind(this));\n\n this.setReverseVideo(false);\n\n this.scrollPort_.focus();\n this.scrollPort_.scheduleRedraw();\n};\n\n/**\n * Return the HTML document that contains the terminal DOM nodes.\n *\n * @return {HTMLDocument}\n */\nhterm.Terminal.prototype.getDocument = function() {\n return this.document_;\n};\n\n/**\n * Focus the terminal.\n */\nhterm.Terminal.prototype.focus = function() {\n this.scrollPort_.focus();\n};\n\n/**\n * Return the HTML Element for a given row index.\n *\n * This is a method from the RowProvider interface. The ScrollPort uses\n * it to fetch rows on demand as they are scrolled into view.\n *\n * TODO(rginda): Consider saving scrollback rows as (HTML source, text content)\n * pairs to conserve memory.\n *\n * @param {integer} index The zero-based row index, measured relative to the\n * start of the scrollback buffer. On-screen rows will always have the\n * largest indices.\n * @return {HTMLElement} The 'x-row' element containing for the requested row.\n */\nhterm.Terminal.prototype.getRowNode = function(index) {\n if (index < this.scrollbackRows_.length)\n return this.scrollbackRows_[index];\n\n var screenIndex = index - this.scrollbackRows_.length;\n return this.screen_.rowsArray[screenIndex];\n};\n\n/**\n * Return the text content for a given range of rows.\n *\n * This is a method from the RowProvider interface. The ScrollPort uses\n * it to fetch text content on demand when the user attempts to copy their\n * selection to the clipboard.\n *\n * @param {integer} start The zero-based row index to start from, measured\n * relative to the start of the scrollback buffer. On-screen rows will\n * always have the largest indices.\n * @param {integer} end The zero-based row index to end on, measured\n * relative to the start of the scrollback buffer.\n * @return {string} A single string containing the text value of the range of\n * rows. Lines will be newline delimited, with no trailing newline.\n */\nhterm.Terminal.prototype.getRowsText = function(start, end) {\n var ary = [];\n for (var i = start; i < end; i++) {\n var node = this.getRowNode(i);\n ary.push(node.textContent);\n if (i < end - 1 && !node.getAttribute('line-overflow'))\n ary.push('\\n');\n }\n\n return ary.join('');\n};\n\n/**\n * Return the text content for a given row.\n *\n * This is a method from the RowProvider interface. The ScrollPort uses\n * it to fetch text content on demand when the user attempts to copy their\n * selection to the clipboard.\n *\n * @param {integer} index The zero-based row index to return, measured\n * relative to the start of the scrollback buffer. On-screen rows will\n * always have the largest indices.\n * @return {string} A string containing the text value of the selected row.\n */\nhterm.Terminal.prototype.getRowText = function(index) {\n var node = this.getRowNode(index);\n return node.textContent;\n};\n\n/**\n * Return the total number of rows in the addressable screen and in the\n * scrollback buffer of this terminal.\n *\n * This is a method from the RowProvider interface. The ScrollPort uses\n * it to compute the size of the scrollbar.\n *\n * @return {integer} The number of rows in this terminal.\n */\nhterm.Terminal.prototype.getRowCount = function() {\n return this.scrollbackRows_.length + this.screen_.rowsArray.length;\n};\n\n/**\n * Create DOM nodes for new rows and append them to the end of the terminal.\n *\n * This is the only correct way to add a new DOM node for a row. Notice that\n * the new row is appended to the bottom of the list of rows, and does not\n * require renumbering (of the rowIndex property) of previous rows.\n *\n * If you think you want a new blank row somewhere in the middle of the\n * terminal, look into moveRows_().\n *\n * This method does not pay attention to vtScrollTop/Bottom, since you should\n * be using moveRows() in cases where they would matter.\n *\n * The cursor will be positioned at column 0 of the first inserted line.\n *\n * @param {number} count The number of rows to created.\n */\nhterm.Terminal.prototype.appendRows_ = function(count) {\n var cursorRow = this.screen_.rowsArray.length;\n var offset = this.scrollbackRows_.length + cursorRow;\n for (var i = 0; i < count; i++) {\n var row = this.document_.createElement('x-row');\n row.appendChild(this.document_.createTextNode(''));\n row.rowIndex = offset + i;\n this.screen_.pushRow(row);\n }\n\n var extraRows = this.screen_.rowsArray.length - this.screenSize.height;\n if (extraRows > 0) {\n var ary = this.screen_.shiftRows(extraRows);\n Array.prototype.push.apply(this.scrollbackRows_, ary);\n if (this.scrollPort_.isScrolledEnd)\n this.scheduleScrollDown_();\n }\n\n if (cursorRow >= this.screen_.rowsArray.length)\n cursorRow = this.screen_.rowsArray.length - 1;\n\n this.setAbsoluteCursorPosition(cursorRow, 0);\n};\n\n/**\n * Relocate rows from one part of the addressable screen to another.\n *\n * This is used to recycle rows during VT scrolls (those which are driven\n * by VT commands, rather than by the user manipulating the scrollbar.)\n *\n * In this case, the blank lines scrolled into the scroll region are made of\n * the nodes we scrolled off. These have their rowIndex properties carefully\n * renumbered so as not to confuse the ScrollPort.\n *\n * @param {number} fromIndex The start index.\n * @param {number} count The number of rows to move.\n * @param {number} toIndex The destination index.\n */\nhterm.Terminal.prototype.moveRows_ = function(fromIndex, count, toIndex) {\n var ary = this.screen_.removeRows(fromIndex, count);\n this.screen_.insertRows(toIndex, ary);\n\n var start, end;\n if (fromIndex < toIndex) {\n start = fromIndex;\n end = toIndex + count;\n } else {\n start = toIndex;\n end = fromIndex + count;\n }\n\n this.renumberRows_(start, end);\n this.scrollPort_.scheduleInvalidate();\n};\n\n/**\n * Renumber the rowIndex property of the given range of rows.\n *\n * The start and end indices are relative to the screen, not the scrollback.\n * Rows in the scrollback buffer cannot be renumbered. Since they are not\n * addressable (you can't delete them, scroll them, etc), you should have\n * no need to renumber scrollback rows.\n *\n * @param {number} start The start index.\n * @param {number} end The end index.\n * @param {hterm.Screen} opt_screen The screen to renumber.\n */\nhterm.Terminal.prototype.renumberRows_ = function(start, end, opt_screen) {\n var screen = opt_screen || this.screen_;\n\n var offset = this.scrollbackRows_.length;\n for (var i = start; i < end; i++) {\n screen.rowsArray[i].rowIndex = offset + i;\n }\n};\n\n/**\n * Print a string to the terminal.\n *\n * This respects the current insert and wraparound modes. It will add new lines\n * to the end of the terminal, scrolling off the top into the scrollback buffer\n * if necessary.\n *\n * The string is *not* parsed for escape codes. Use the interpret() method if\n * that's what you're after.\n *\n * @param{string} str The string to print.\n */\nhterm.Terminal.prototype.print = function(str) {\n var startOffset = 0;\n\n var strWidth = lib.wc.strWidth(str);\n\n while (startOffset < strWidth) {\n if (this.options_.wraparound && this.screen_.cursorPosition.overflow) {\n this.screen_.commitLineOverflow();\n this.newLine();\n }\n\n var count = strWidth - startOffset;\n var didOverflow = false;\n var substr;\n\n if (this.screen_.cursorPosition.column + count >= this.screenSize.width) {\n didOverflow = true;\n count = this.screenSize.width - this.screen_.cursorPosition.column;\n }\n\n if (didOverflow && !this.options_.wraparound) {\n // If the string overflowed the line but wraparound is off, then the\n // last printed character should be the last of the string.\n // TODO: This will add to our problems with multibyte UTF-16 characters.\n substr = lib.wc.substr(str, startOffset, count - 1) +\n lib.wc.substr(str, strWidth - 1);\n count = strWidth;\n } else {\n substr = lib.wc.substr(str, startOffset, count);\n }\n\n var tokens = hterm.TextAttributes.splitWidecharString(substr);\n for (var i = 0; i < tokens.length; i++) {\n this.screen_.textAttributes.wcNode = tokens[i].wcNode;\n this.screen_.textAttributes.asciiNode = tokens[i].asciiNode;\n\n if (this.options_.insertMode) {\n this.screen_.insertString(tokens[i].str);\n } else {\n this.screen_.overwriteString(tokens[i].str);\n }\n this.screen_.textAttributes.wcNode = false;\n this.screen_.textAttributes.asciiNode = true;\n }\n\n this.screen_.maybeClipCurrentRow();\n startOffset += count;\n }\n\n this.scheduleSyncCursorPosition_();\n\n if (this.scrollOnOutput_)\n this.scrollPort_.scrollRowToBottom(this.getRowCount());\n};\n\n/**\n * Set the VT scroll region.\n *\n * This also resets the cursor position to the absolute (0, 0) position, since\n * that's what xterm appears to do.\n *\n * Setting the scroll region to the full height of the terminal will clear\n * the scroll region. This is *NOT* what most terminals do. We're explicitly\n * going \"off-spec\" here because it makes `screen` and `tmux` overflow into the\n * local scrollback buffer, which means the scrollbars and shift-pgup/pgdn\n * continue to work as most users would expect.\n *\n * @param {integer} scrollTop The zero-based top of the scroll region.\n * @param {integer} scrollBottom The zero-based bottom of the scroll region,\n * inclusive.\n */\nhterm.Terminal.prototype.setVTScrollRegion = function(scrollTop, scrollBottom) {\n if (scrollTop == 0 && scrollBottom == this.screenSize.height - 1) {\n this.vtScrollTop_ = null;\n this.vtScrollBottom_ = null;\n } else {\n this.vtScrollTop_ = scrollTop;\n this.vtScrollBottom_ = scrollBottom;\n }\n};\n\n/**\n * Return the top row index according to the VT.\n *\n * This will return 0 unless the terminal has been told to restrict scrolling\n * to some lower row. It is used for some VT cursor positioning and scrolling\n * commands.\n *\n * @return {integer} The topmost row in the terminal's scroll region.\n */\nhterm.Terminal.prototype.getVTScrollTop = function() {\n if (this.vtScrollTop_ != null)\n return this.vtScrollTop_;\n\n return 0;\n};\n\n/**\n * Return the bottom row index according to the VT.\n *\n * This will return the height of the terminal unless the it has been told to\n * restrict scrolling to some higher row. It is used for some VT cursor\n * positioning and scrolling commands.\n *\n * @return {integer} The bottom most row in the terminal's scroll region.\n */\nhterm.Terminal.prototype.getVTScrollBottom = function() {\n if (this.vtScrollBottom_ != null)\n return this.vtScrollBottom_;\n\n return this.screenSize.height - 1;\n}\n\n/**\n * Process a '\\n' character.\n *\n * If the cursor is on the final row of the terminal this will append a new\n * blank row to the screen and scroll the topmost row into the scrollback\n * buffer.\n *\n * Otherwise, this moves the cursor to column zero of the next row.\n */\nhterm.Terminal.prototype.newLine = function() {\n var cursorAtEndOfScreen = (this.screen_.cursorPosition.row ==\n this.screen_.rowsArray.length - 1);\n\n if (this.vtScrollBottom_ != null) {\n // A VT Scroll region is active, we never append new rows.\n if (this.screen_.cursorPosition.row == this.vtScrollBottom_) {\n // We're at the end of the VT Scroll Region, perform a VT scroll.\n this.vtScrollUp(1);\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, 0);\n } else if (cursorAtEndOfScreen) {\n // We're at the end of the screen, the only thing to do is put the\n // cursor to column 0.\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, 0);\n } else {\n // Anywhere else, advance the cursor row, and reset the column.\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row + 1, 0);\n }\n } else if (cursorAtEndOfScreen) {\n // We're at the end of the screen. Append a new row to the terminal,\n // shifting the top row into the scrollback.\n this.appendRows_(1);\n } else {\n // Anywhere else in the screen just moves the cursor.\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row + 1, 0);\n }\n};\n\n/**\n * Like newLine(), except maintain the cursor column.\n */\nhterm.Terminal.prototype.lineFeed = function() {\n var column = this.screen_.cursorPosition.column;\n this.newLine();\n this.setCursorColumn(column);\n};\n\n/**\n * If autoCarriageReturn is set then newLine(), else lineFeed().\n */\nhterm.Terminal.prototype.formFeed = function() {\n if (this.options_.autoCarriageReturn) {\n this.newLine();\n } else {\n this.lineFeed();\n }\n};\n\n/**\n * Move the cursor up one row, possibly inserting a blank line.\n *\n * The cursor column is not changed.\n */\nhterm.Terminal.prototype.reverseLineFeed = function() {\n var scrollTop = this.getVTScrollTop();\n var currentRow = this.screen_.cursorPosition.row;\n\n if (currentRow == scrollTop) {\n this.insertLines(1);\n } else {\n this.setAbsoluteCursorRow(currentRow - 1);\n }\n};\n\n/**\n * Replace all characters to the left of the current cursor with the space\n * character.\n *\n * TODO(rginda): This should probably *remove* the characters (not just replace\n * with a space) if there are no characters at or beyond the current cursor\n * position.\n */\nhterm.Terminal.prototype.eraseToLeft = function() {\n var cursor = this.saveCursor();\n this.setCursorColumn(0);\n this.screen_.overwriteString(lib.f.getWhitespace(cursor.column + 1));\n this.restoreCursor(cursor);\n};\n\n/**\n * Erase a given number of characters to the right of the cursor.\n *\n * The cursor position is unchanged.\n *\n * If the current background color is not the default background color this\n * will insert spaces rather than delete. This is unfortunate because the\n * trailing space will affect text selection, but it's difficult to come up\n * with a way to style empty space that wouldn't trip up the hterm.Screen\n * code.\n *\n * eraseToRight is ignored in the presence of a cursor overflow. This deviates\n * from xterm, but agrees with gnome-terminal and konsole, xfce4-terminal. See\n * crbug.com/232390 for details.\n *\n * @param {number} opt_count The number of characters to erase.\n */\nhterm.Terminal.prototype.eraseToRight = function(opt_count) {\n if (this.screen_.cursorPosition.overflow)\n return;\n\n var maxCount = this.screenSize.width - this.screen_.cursorPosition.column;\n var count = opt_count ? Math.min(opt_count, maxCount) : maxCount;\n\n if (this.screen_.textAttributes.background ===\n this.screen_.textAttributes.DEFAULT_COLOR) {\n var cursorRow = this.screen_.rowsArray[this.screen_.cursorPosition.row];\n if (hterm.TextAttributes.nodeWidth(cursorRow) <=\n this.screen_.cursorPosition.column + count) {\n this.screen_.deleteChars(count);\n this.clearCursorOverflow();\n return;\n }\n }\n\n var cursor = this.saveCursor();\n this.screen_.overwriteString(lib.f.getWhitespace(count));\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Erase the current line.\n *\n * The cursor position is unchanged.\n */\nhterm.Terminal.prototype.eraseLine = function() {\n var cursor = this.saveCursor();\n this.screen_.clearCursorRow();\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Erase all characters from the start of the screen to the current cursor\n * position, regardless of scroll region.\n *\n * The cursor position is unchanged.\n */\nhterm.Terminal.prototype.eraseAbove = function() {\n var cursor = this.saveCursor();\n\n this.eraseToLeft();\n\n for (var i = 0; i < cursor.row; i++) {\n this.setAbsoluteCursorPosition(i, 0);\n this.screen_.clearCursorRow();\n }\n\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Erase all characters from the current cursor position to the end of the\n * screen, regardless of scroll region.\n *\n * The cursor position is unchanged.\n */\nhterm.Terminal.prototype.eraseBelow = function() {\n var cursor = this.saveCursor();\n\n this.eraseToRight();\n\n var bottom = this.screenSize.height - 1;\n for (var i = cursor.row + 1; i <= bottom; i++) {\n this.setAbsoluteCursorPosition(i, 0);\n this.screen_.clearCursorRow();\n }\n\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Fill the terminal with a given character.\n *\n * This methods does not respect the VT scroll region.\n *\n * @param {string} ch The character to use for the fill.\n */\nhterm.Terminal.prototype.fill = function(ch) {\n var cursor = this.saveCursor();\n\n this.setAbsoluteCursorPosition(0, 0);\n for (var row = 0; row < this.screenSize.height; row++) {\n for (var col = 0; col < this.screenSize.width; col++) {\n this.setAbsoluteCursorPosition(row, col);\n this.screen_.overwriteString(ch);\n }\n }\n\n this.restoreCursor(cursor);\n};\n\n/**\n * Erase the entire display and leave the cursor at (0, 0).\n *\n * This does not respect the scroll region.\n *\n * @param {hterm.Screen} opt_screen Optional screen to operate on. Defaults\n * to the current screen.\n */\nhterm.Terminal.prototype.clearHome = function(opt_screen) {\n var screen = opt_screen || this.screen_;\n var bottom = screen.getHeight();\n\n if (bottom == 0) {\n // Empty screen, nothing to do.\n return;\n }\n\n for (var i = 0; i < bottom; i++) {\n screen.setCursorPosition(i, 0);\n screen.clearCursorRow();\n }\n\n screen.setCursorPosition(0, 0);\n};\n\n/**\n * Erase the entire display without changing the cursor position.\n *\n * The cursor position is unchanged. This does not respect the scroll\n * region.\n *\n * @param {hterm.Screen} opt_screen Optional screen to operate on. Defaults\n * to the current screen.\n */\nhterm.Terminal.prototype.clear = function(opt_screen) {\n var screen = opt_screen || this.screen_;\n var cursor = screen.cursorPosition.clone();\n this.clearHome(screen);\n screen.setCursorPosition(cursor.row, cursor.column);\n};\n\n/**\n * VT command to insert lines at the current cursor row.\n *\n * This respects the current scroll region. Rows pushed off the bottom are\n * lost (they won't show up in the scrollback buffer).\n *\n * @param {integer} count The number of lines to insert.\n */\nhterm.Terminal.prototype.insertLines = function(count) {\n var cursorRow = this.screen_.cursorPosition.row;\n\n var bottom = this.getVTScrollBottom();\n count = Math.min(count, bottom - cursorRow);\n\n // The moveCount is the number of rows we need to relocate to make room for\n // the new row(s). The count is the distance to move them.\n var moveCount = bottom - cursorRow - count + 1;\n if (moveCount)\n this.moveRows_(cursorRow, moveCount, cursorRow + count);\n\n for (var i = count - 1; i >= 0; i--) {\n this.setAbsoluteCursorPosition(cursorRow + i, 0);\n this.screen_.clearCursorRow();\n }\n};\n\n/**\n * VT command to delete lines at the current cursor row.\n *\n * New rows are added to the bottom of scroll region to take their place. New\n * rows are strictly there to take up space and have no content or style.\n *\n * @param {number} count The number of lines to delete.\n */\nhterm.Terminal.prototype.deleteLines = function(count) {\n var cursor = this.saveCursor();\n\n var top = cursor.row;\n var bottom = this.getVTScrollBottom();\n\n var maxCount = bottom - top + 1;\n count = Math.min(count, maxCount);\n\n var moveStart = bottom - count + 1;\n if (count != maxCount)\n this.moveRows_(top, count, moveStart);\n\n for (var i = 0; i < count; i++) {\n this.setAbsoluteCursorPosition(moveStart + i, 0);\n this.screen_.clearCursorRow();\n }\n\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Inserts the given number of spaces at the current cursor position.\n *\n * The cursor position is not changed.\n *\n * @param {number} count The number of spaces to insert.\n */\nhterm.Terminal.prototype.insertSpace = function(count) {\n var cursor = this.saveCursor();\n\n var ws = lib.f.getWhitespace(count || 1);\n this.screen_.insertString(ws);\n this.screen_.maybeClipCurrentRow();\n\n this.restoreCursor(cursor);\n this.clearCursorOverflow();\n};\n\n/**\n * Forward-delete the specified number of characters starting at the cursor\n * position.\n *\n * @param {integer} count The number of characters to delete.\n */\nhterm.Terminal.prototype.deleteChars = function(count) {\n var deleted = this.screen_.deleteChars(count);\n if (deleted && !this.screen_.textAttributes.isDefault()) {\n var cursor = this.saveCursor();\n this.setCursorColumn(this.screenSize.width - deleted);\n this.screen_.insertString(lib.f.getWhitespace(deleted));\n this.restoreCursor(cursor);\n }\n\n this.clearCursorOverflow();\n};\n\n/**\n * Shift rows in the scroll region upwards by a given number of lines.\n *\n * New rows are inserted at the bottom of the scroll region to fill the\n * vacated rows. The new rows not filled out with the current text attributes.\n *\n * This function does not affect the scrollback rows at all. Rows shifted\n * off the top are lost.\n *\n * The cursor position is not altered.\n *\n * @param {integer} count The number of rows to scroll.\n */\nhterm.Terminal.prototype.vtScrollUp = function(count) {\n var cursor = this.saveCursor();\n\n this.setAbsoluteCursorRow(this.getVTScrollTop());\n this.deleteLines(count);\n\n this.restoreCursor(cursor);\n};\n\n/**\n * Shift rows below the cursor down by a given number of lines.\n *\n * This function respects the current scroll region.\n *\n * New rows are inserted at the top of the scroll region to fill the\n * vacated rows. The new rows not filled out with the current text attributes.\n *\n * This function does not affect the scrollback rows at all. Rows shifted\n * off the bottom are lost.\n *\n * @param {integer} count The number of rows to scroll.\n */\nhterm.Terminal.prototype.vtScrollDown = function(opt_count) {\n var cursor = this.saveCursor();\n\n this.setAbsoluteCursorPosition(this.getVTScrollTop(), 0);\n this.insertLines(opt_count);\n\n this.restoreCursor(cursor);\n};\n\n\n/**\n * Set the cursor position.\n *\n * The cursor row is relative to the scroll region if the terminal has\n * 'origin mode' enabled, or relative to the addressable screen otherwise.\n *\n * @param {integer} row The new zero-based cursor row.\n * @param {integer} row The new zero-based cursor column.\n */\nhterm.Terminal.prototype.setCursorPosition = function(row, column) {\n if (this.options_.originMode) {\n this.setRelativeCursorPosition(row, column);\n } else {\n this.setAbsoluteCursorPosition(row, column);\n }\n};\n\n/**\n * Move the cursor relative to its current position.\n *\n * @param {number} row\n * @param {number} column\n */\nhterm.Terminal.prototype.setRelativeCursorPosition = function(row, column) {\n var scrollTop = this.getVTScrollTop();\n row = lib.f.clamp(row + scrollTop, scrollTop, this.getVTScrollBottom());\n column = lib.f.clamp(column, 0, this.screenSize.width - 1);\n this.screen_.setCursorPosition(row, column);\n};\n\n/**\n * Move the cursor to the specified position.\n *\n * @param {number} row\n * @param {number} column\n */\nhterm.Terminal.prototype.setAbsoluteCursorPosition = function(row, column) {\n row = lib.f.clamp(row, 0, this.screenSize.height - 1);\n column = lib.f.clamp(column, 0, this.screenSize.width - 1);\n this.screen_.setCursorPosition(row, column);\n};\n\n/**\n * Set the cursor column.\n *\n * @param {integer} column The new zero-based cursor column.\n */\nhterm.Terminal.prototype.setCursorColumn = function(column) {\n this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, column);\n};\n\n/**\n * Return the cursor column.\n *\n * @return {integer} The zero-based cursor column.\n */\nhterm.Terminal.prototype.getCursorColumn = function() {\n return this.screen_.cursorPosition.column;\n};\n\n/**\n * Set the cursor row.\n *\n * The cursor row is relative to the scroll region if the terminal has\n * 'origin mode' enabled, or relative to the addressable screen otherwise.\n *\n * @param {integer} row The new cursor row.\n */\nhterm.Terminal.prototype.setAbsoluteCursorRow = function(row) {\n this.setAbsoluteCursorPosition(row, this.screen_.cursorPosition.column);\n};\n\n/**\n * Return the cursor row.\n *\n * @return {integer} The zero-based cursor row.\n */\nhterm.Terminal.prototype.getCursorRow = function() {\n return this.screen_.cursorPosition.row;\n};\n\n/**\n * Request that the ScrollPort redraw itself soon.\n *\n * The redraw will happen asynchronously, soon after the call stack winds down.\n * Multiple calls will be coalesced into a single redraw.\n */\nhterm.Terminal.prototype.scheduleRedraw_ = function() {\n if (this.timeouts_.redraw)\n return;\n\n var self = this;\n this.timeouts_.redraw = setTimeout(function() {\n delete self.timeouts_.redraw;\n self.scrollPort_.redraw_();\n }, 0);\n};\n\n/**\n * Request that the ScrollPort be scrolled to the bottom.\n *\n * The scroll will happen asynchronously, soon after the call stack winds down.\n * Multiple calls will be coalesced into a single scroll.\n *\n * This affects the scrollbar position of the ScrollPort, and has nothing to\n * do with the VT scroll commands.\n */\nhterm.Terminal.prototype.scheduleScrollDown_ = function() {\n if (this.timeouts_.scrollDown)\n return;\n\n var self = this;\n this.timeouts_.scrollDown = setTimeout(function() {\n delete self.timeouts_.scrollDown;\n self.scrollPort_.scrollRowToBottom(self.getRowCount());\n }, 10);\n};\n\n/**\n * Move the cursor up a specified number of rows.\n *\n * @param {integer} count The number of rows to move the cursor.\n */\nhterm.Terminal.prototype.cursorUp = function(count) {\n return this.cursorDown(-(count || 1));\n};\n\n/**\n * Move the cursor down a specified number of rows.\n *\n * @param {integer} count The number of rows to move the cursor.\n */\nhterm.Terminal.prototype.cursorDown = function(count) {\n count = count || 1;\n var minHeight = (this.options_.originMode ? this.getVTScrollTop() : 0);\n var maxHeight = (this.options_.originMode ? this.getVTScrollBottom() :\n this.screenSize.height - 1);\n\n var row = lib.f.clamp(this.screen_.cursorPosition.row + count,\n minHeight, maxHeight);\n this.setAbsoluteCursorRow(row);\n};\n\n/**\n * Move the cursor left a specified number of columns.\n *\n * If reverse wraparound mode is enabled and the previous row wrapped into\n * the current row then we back up through the wraparound as well.\n *\n * @param {integer} count The number of columns to move the cursor.\n */\nhterm.Terminal.prototype.cursorLeft = function(count) {\n count = count || 1;\n\n if (count < 1)\n return;\n\n var currentColumn = this.screen_.cursorPosition.column;\n if (this.options_.reverseWraparound) {\n if (this.screen_.cursorPosition.overflow) {\n // If this cursor is in the right margin, consume one count to get it\n // back to the last column. This only applies when we're in reverse\n // wraparound mode.\n count--;\n this.clearCursorOverflow();\n\n if (!count)\n return;\n }\n\n var newRow = this.screen_.cursorPosition.row;\n var newColumn = currentColumn - count;\n if (newColumn < 0) {\n newRow = newRow - Math.floor(count / this.screenSize.width) - 1;\n if (newRow < 0) {\n // xterm also wraps from row 0 to the last row.\n newRow = this.screenSize.height + newRow % this.screenSize.height;\n }\n newColumn = this.screenSize.width + newColumn % this.screenSize.width;\n }\n\n this.setCursorPosition(Math.max(newRow, 0), newColumn);\n\n } else {\n var newColumn = Math.max(currentColumn - count, 0);\n this.setCursorColumn(newColumn);\n }\n};\n\n/**\n * Move the cursor right a specified number of columns.\n *\n * @param {integer} count The number of columns to move the cursor.\n */\nhterm.Terminal.prototype.cursorRight = function(count) {\n count = count || 1;\n\n if (count < 1)\n return;\n\n var column = lib.f.clamp(this.screen_.cursorPosition.column + count,\n 0, this.screenSize.width - 1);\n this.setCursorColumn(column);\n};\n\n/**\n * Reverse the foreground and background colors of the terminal.\n *\n * This only affects text that was drawn with no attributes.\n *\n * TODO(rginda): Test xterm to see if reverse is respected for text that has\n * been drawn with attributes that happen to coincide with the default\n * 'no-attribute' colors. My guess is probably not.\n *\n * @param {boolean} state The state to set.\n */\nhterm.Terminal.prototype.setReverseVideo = function(state) {\n this.options_.reverseVideo = state;\n if (state) {\n this.scrollPort_.setForegroundColor(this.prefs_.get('background-color'));\n this.scrollPort_.setBackgroundColor(this.prefs_.get('foreground-color'));\n } else {\n this.scrollPort_.setForegroundColor(this.prefs_.get('foreground-color'));\n this.scrollPort_.setBackgroundColor(this.prefs_.get('background-color'));\n }\n};\n\n/**\n * Ring the terminal bell.\n *\n * This will not play the bell audio more than once per second.\n */\nhterm.Terminal.prototype.ringBell = function() {\n this.cursorNode_.style.backgroundColor =\n this.scrollPort_.getForegroundColor();\n\n var self = this;\n setTimeout(function() {\n self.cursorNode_.style.backgroundColor = self.prefs_.get('cursor-color');\n }, 200);\n\n // bellSquelchTimeout_ affects both audio and notification bells.\n if (this.bellSquelchTimeout_)\n return;\n\n if (this.bellAudio_.getAttribute('src')) {\n this.bellAudio_.play();\n this.bellSequelchTimeout_ = setTimeout(function() {\n delete this.bellSquelchTimeout_;\n }.bind(this), 500);\n } else {\n delete this.bellSquelchTimeout_;\n }\n\n if (this.desktopNotificationBell_ && !this.document_.hasFocus()) {\n var n = hterm.notify();\n this.bellNotificationList_.push(n);\n // TODO: Should we try to raise the window here?\n n.onclick = function() { self.closeBellNotifications_(); };\n }\n};\n\n/**\n * Set the origin mode bit.\n *\n * If origin mode is on, certain VT cursor and scrolling commands measure their\n * row parameter relative to the VT scroll region. Otherwise, row 0 corresponds\n * to the top of the addressable screen.\n *\n * Defaults to off.\n *\n * @param {boolean} state True to set origin mode, false to unset.\n */\nhterm.Terminal.prototype.setOriginMode = function(state) {\n this.options_.originMode = state;\n this.setCursorPosition(0, 0);\n};\n\n/**\n * Set the insert mode bit.\n *\n * If insert mode is on, existing text beyond the cursor position will be\n * shifted right to make room for new text. Otherwise, new text overwrites\n * any existing text.\n *\n * Defaults to off.\n *\n * @param {boolean} state True to set insert mode, false to unset.\n */\nhterm.Terminal.prototype.setInsertMode = function(state) {\n this.options_.insertMode = state;\n};\n\n/**\n * Set the auto carriage return bit.\n *\n * If auto carriage return is on then a formfeed character is interpreted\n * as a newline, otherwise it's the same as a linefeed. The difference boils\n * down to whether or not the cursor column is reset.\n *\n * @param {boolean} state The state to set.\n */\nhterm.Terminal.prototype.setAutoCarriageReturn = function(state) {\n this.options_.autoCarriageReturn = state;\n};\n\n/**\n * Set the wraparound mode bit.\n *\n * If wraparound mode is on, certain VT commands will allow the cursor to wrap\n * to the start of the following row. Otherwise, the cursor is clamped to the\n * end of the screen and attempts to write past it are ignored.\n *\n * Defaults to on.\n *\n * @param {boolean} state True to set wraparound mode, false to unset.\n */\nhterm.Terminal.prototype.setWraparound = function(state) {\n this.options_.wraparound = state;\n};\n\n/**\n * Set the reverse-wraparound mode bit.\n *\n * If wraparound mode is off, certain VT commands will allow the cursor to wrap\n * to the end of the previous row. Otherwise, the cursor is clamped to column\n * 0.\n *\n * Defaults to off.\n *\n * @param {boolean} state True to set reverse-wraparound mode, false to unset.\n */\nhterm.Terminal.prototype.setReverseWraparound = function(state) {\n this.options_.reverseWraparound = state;\n};\n\n/**\n * Selects between the primary and alternate screens.\n *\n * If alternate mode is on, the alternate screen is active. Otherwise the\n * primary screen is active.\n *\n * Swapping screens has no effect on the scrollback buffer.\n *\n * Each screen maintains its own cursor position.\n *\n * Defaults to off.\n *\n * @param {boolean} state True to set alternate mode, false to unset.\n */\nhterm.Terminal.prototype.setAlternateMode = function(state) {\n var cursor = this.saveCursor();\n this.screen_ = state ? this.alternateScreen_ : this.primaryScreen_;\n\n if (this.screen_.rowsArray.length &&\n this.screen_.rowsArray[0].rowIndex != this.scrollbackRows_.length) {\n // If the screen changed sizes while we were away, our rowIndexes may\n // be incorrect.\n var offset = this.scrollbackRows_.length;\n var ary = this.screen_.rowsArray;\n for (var i = 0; i < ary.length; i++) {\n ary[i].rowIndex = offset + i;\n }\n }\n\n this.realizeWidth_(this.screenSize.width);\n this.realizeHeight_(this.screenSize.height);\n this.scrollPort_.syncScrollHeight();\n this.scrollPort_.invalidate();\n\n this.restoreCursor(cursor);\n this.scrollPort_.resize();\n};\n\n/**\n * Set the cursor-blink mode bit.\n *\n * If cursor-blink is on, the cursor will blink when it is visible. Otherwise\n * a visible cursor does not blink.\n *\n * You should make sure to turn blinking off if you're going to dispose of a\n * terminal, otherwise you'll leak a timeout.\n *\n * Defaults to on.\n *\n * @param {boolean} state True to set cursor-blink mode, false to unset.\n */\nhterm.Terminal.prototype.setCursorBlink = function(state) {\n this.options_.cursorBlink = state;\n\n if (!state && this.timeouts_.cursorBlink) {\n clearTimeout(this.timeouts_.cursorBlink);\n delete this.timeouts_.cursorBlink;\n }\n\n if (this.options_.cursorVisible)\n this.setCursorVisible(true);\n};\n\n/**\n * Set the cursor-visible mode bit.\n *\n * If cursor-visible is on, the cursor will be visible. Otherwise it will not.\n *\n * Defaults to on.\n *\n * @param {boolean} state True to set cursor-visible mode, false to unset.\n */\nhterm.Terminal.prototype.setCursorVisible = function(state) {\n this.options_.cursorVisible = state;\n\n if (!state) {\n if (this.timeouts_.cursorBlink) {\n clearTimeout(this.timeouts_.cursorBlink);\n delete this.timeouts_.cursorBlink;\n }\n this.cursorNode_.style.opacity = '0';\n return;\n }\n\n this.syncCursorPosition_();\n\n this.cursorNode_.style.opacity = '1';\n\n if (this.options_.cursorBlink) {\n if (this.timeouts_.cursorBlink)\n return;\n\n this.onCursorBlink_();\n } else {\n if (this.timeouts_.cursorBlink) {\n clearTimeout(this.timeouts_.cursorBlink);\n delete this.timeouts_.cursorBlink;\n }\n }\n};\n\n/**\n * Synchronizes the visible cursor and document selection with the current\n * cursor coordinates.\n */\nhterm.Terminal.prototype.syncCursorPosition_ = function() {\n var topRowIndex = this.scrollPort_.getTopRowIndex();\n var bottomRowIndex = this.scrollPort_.getBottomRowIndex(topRowIndex);\n var cursorRowIndex = this.scrollbackRows_.length +\n this.screen_.cursorPosition.row;\n\n if (cursorRowIndex > bottomRowIndex) {\n // Cursor is scrolled off screen, move it outside of the visible area.\n this.setCssVar('cursor-offset-row', '-1');\n return;\n }\n\n if (this.options_.cursorVisible &&\n this.cursorNode_.style.display == 'none') {\n // Re-display the terminal cursor if it was hidden by the mouse cursor.\n this.cursorNode_.style.display = '';\n }\n\n // Position the cursor using CSS variable math. If we do the math in JS,\n // the float math will end up being more precise than the CSS which will\n // cause the cursor tracking to be off.\n this.setCssVar(\n 'cursor-offset-row',\n `${cursorRowIndex - topRowIndex} + ` +\n `${this.scrollPort_.visibleRowTopMargin}px`);\n this.setCssVar('cursor-offset-col', this.screen_.cursorPosition.column);\n\n this.cursorNode_.setAttribute('title',\n '(' + this.screen_.cursorPosition.column +\n ', ' + this.screen_.cursorPosition.row +\n ')');\n\n // Update the caret for a11y purposes.\n var selection = this.document_.getSelection();\n if (selection && selection.isCollapsed)\n this.screen_.syncSelectionCaret(selection);\n};\n\n/**\n * Adjusts the style of this.cursorNode_ according to the current cursor shape\n * and character cell dimensions.\n */\nhterm.Terminal.prototype.restyleCursor_ = function() {\n var shape = this.cursorShape_;\n\n if (this.cursorNode_.getAttribute('focus') == 'false') {\n // Always show a block cursor when unfocused.\n shape = hterm.Terminal.cursorShape.BLOCK;\n }\n\n var style = this.cursorNode_.style;\n\n switch (shape) {\n case hterm.Terminal.cursorShape.BEAM:\n style.height = 'var(--hterm-charsize-height)';\n style.backgroundColor = 'transparent';\n style.borderBottomStyle = null;\n style.borderLeftStyle = 'solid';\n break;\n\n case hterm.Terminal.cursorShape.UNDERLINE:\n style.height = this.scrollPort_.characterSize.baseline + 'px';\n style.backgroundColor = 'transparent';\n style.borderBottomStyle = 'solid';\n // correct the size to put it exactly at the baseline\n style.borderLeftStyle = null;\n break;\n\n default:\n style.height = 'var(--hterm-charsize-height)';\n style.backgroundColor = this.cursorColor_;\n style.borderBottomStyle = null;\n style.borderLeftStyle = null;\n break;\n }\n};\n\n/**\n * Synchronizes the visible cursor with the current cursor coordinates.\n *\n * The sync will happen asynchronously, soon after the call stack winds down.\n * Multiple calls will be coalesced into a single sync.\n */\nhterm.Terminal.prototype.scheduleSyncCursorPosition_ = function() {\n if (this.timeouts_.syncCursor)\n return;\n\n var self = this;\n this.timeouts_.syncCursor = setTimeout(function() {\n self.syncCursorPosition_();\n delete self.timeouts_.syncCursor;\n }, 0);\n};\n\n/**\n * Show or hide the zoom warning.\n *\n * The zoom warning is a message warning the user that their browser zoom must\n * be set to 100% in order for hterm to function properly.\n *\n * @param {boolean} state True to show the message, false to hide it.\n */\nhterm.Terminal.prototype.showZoomWarning_ = function(state) {\n if (!this.zoomWarningNode_) {\n if (!state)\n return;\n\n this.zoomWarningNode_ = this.document_.createElement('div');\n this.zoomWarningNode_.id = 'hterm:zoom-warning';\n this.zoomWarningNode_.style.cssText = (\n 'color: black;' +\n 'background-color: #ff2222;' +\n 'font-size: large;' +\n 'border-radius: 8px;' +\n 'opacity: 0.75;' +\n 'padding: 0.2em 0.5em 0.2em 0.5em;' +\n 'top: 0.5em;' +\n 'right: 1.2em;' +\n 'position: absolute;' +\n '-webkit-text-size-adjust: none;' +\n '-webkit-user-select: none;' +\n '-moz-text-size-adjust: none;' +\n '-moz-user-select: none;');\n\n this.zoomWarningNode_.addEventListener('click', function(e) {\n this.parentNode.removeChild(this);\n });\n }\n\n this.zoomWarningNode_.textContent = lib.MessageManager.replaceReferences(\n hterm.zoomWarningMessage,\n [parseInt(this.scrollPort_.characterSize.zoomFactor * 100)]);\n\n this.zoomWarningNode_.style.fontFamily = this.prefs_.get('font-family');\n\n if (state) {\n if (!this.zoomWarningNode_.parentNode)\n this.div_.parentNode.appendChild(this.zoomWarningNode_);\n } else if (this.zoomWarningNode_.parentNode) {\n this.zoomWarningNode_.parentNode.removeChild(this.zoomWarningNode_);\n }\n};\n\n/**\n * Show the terminal overlay for a given amount of time.\n *\n * The terminal overlay appears in inverse video in a large font, centered\n * over the terminal. You should probably keep the overlay message brief,\n * since it's in a large font and you probably aren't going to check the size\n * of the terminal first.\n *\n * @param {string} msg The text (not HTML) message to display in the overlay.\n * @param {number} opt_timeout The amount of time to wait before fading out\n * the overlay. Defaults to 1.5 seconds. Pass null to have the overlay\n * stay up forever (or until the next overlay).\n */\nhterm.Terminal.prototype.showOverlay = function(msg, opt_timeout) {\n if (!this.overlayNode_) {\n if (!this.div_)\n return;\n\n this.overlayNode_ = this.document_.createElement('div');\n this.overlayNode_.style.cssText = (\n 'border-radius: 15px;' +\n 'font-size: xx-large;' +\n 'opacity: 0.75;' +\n 'padding: 0.2em 0.5em 0.2em 0.5em;' +\n 'position: absolute;' +\n '-webkit-user-select: none;' +\n '-webkit-transition: opacity 180ms ease-in;' +\n '-moz-user-select: none;' +\n '-moz-transition: opacity 180ms ease-in;');\n\n this.overlayNode_.addEventListener('mousedown', function(e) {\n e.preventDefault();\n e.stopPropagation();\n }, true);\n }\n\n this.overlayNode_.style.color = this.prefs_.get('background-color');\n this.overlayNode_.style.backgroundColor = this.prefs_.get('foreground-color');\n this.overlayNode_.style.fontFamily = this.prefs_.get('font-family');\n\n this.overlayNode_.textContent = msg;\n this.overlayNode_.style.opacity = '0.75';\n\n if (!this.overlayNode_.parentNode)\n this.div_.appendChild(this.overlayNode_);\n\n var divSize = hterm.getClientSize(this.div_);\n var overlaySize = hterm.getClientSize(this.overlayNode_);\n\n this.overlayNode_.style.top =\n (divSize.height - overlaySize.height) / 2 + 'px';\n this.overlayNode_.style.left = (divSize.width - overlaySize.width -\n this.scrollPort_.currentScrollbarWidthPx) / 2 + 'px';\n\n var self = this;\n\n if (this.overlayTimeout_)\n clearTimeout(this.overlayTimeout_);\n\n if (opt_timeout === null)\n return;\n\n this.overlayTimeout_ = setTimeout(function() {\n self.overlayNode_.style.opacity = '0';\n self.overlayTimeout_ = setTimeout(function() {\n if (self.overlayNode_.parentNode)\n self.overlayNode_.parentNode.removeChild(self.overlayNode_);\n self.overlayTimeout_ = null;\n self.overlayNode_.style.opacity = '0.75';\n }, 200);\n }, opt_timeout || 1500);\n};\n\n/**\n * Paste from the system clipboard to the terminal.\n */\nhterm.Terminal.prototype.paste = function() {\n return hterm.pasteFromClipboard(this.document_);\n};\n\n/**\n * Copy a string to the system clipboard.\n *\n * Note: If there is a selected range in the terminal, it'll be cleared.\n *\n * @param {string} str The string to copy.\n */\nhterm.Terminal.prototype.copyStringToClipboard = function(str) {\n if (this.prefs_.get('enable-clipboard-notice'))\n setTimeout(this.showOverlay.bind(this, hterm.notifyCopyMessage, 500), 200);\n\n var copySource = this.document_.createElement('pre');\n copySource.id = 'hterm:copy-to-clipboard-source';\n copySource.textContent = str;\n copySource.style.cssText = (\n '-webkit-user-select: text;' +\n '-moz-user-select: text;' +\n 'position: absolute;' +\n 'top: -99px');\n\n this.document_.body.appendChild(copySource);\n\n var selection = this.document_.getSelection();\n var anchorNode = selection.anchorNode;\n var anchorOffset = selection.anchorOffset;\n var focusNode = selection.focusNode;\n var focusOffset = selection.focusOffset;\n\n selection.selectAllChildren(copySource);\n\n hterm.copySelectionToClipboard(this.document_);\n\n // IE doesn't support selection.extend. This means that the selection\n // won't return on IE.\n if (selection.extend) {\n selection.collapse(anchorNode, anchorOffset);\n selection.extend(focusNode, focusOffset);\n }\n\n copySource.parentNode.removeChild(copySource);\n};\n\n/**\n * Returns the selected text, or null if no text is selected.\n *\n * @return {string|null}\n */\nhterm.Terminal.prototype.getSelectionText = function() {\n var selection = this.scrollPort_.selection;\n selection.sync();\n\n if (selection.isCollapsed)\n return null;\n\n\n // Start offset measures from the beginning of the line.\n var startOffset = selection.startOffset;\n var node = selection.startNode;\n\n if (node.nodeName != 'X-ROW') {\n // If the selection doesn't start on an x-row node, then it must be\n // somewhere inside the x-row. Add any characters from previous siblings\n // into the start offset.\n\n if (node.nodeName == '#text' && node.parentNode.nodeName == 'SPAN') {\n // If node is the text node in a styled span, move up to the span node.\n node = node.parentNode;\n }\n\n while (node.previousSibling) {\n node = node.previousSibling;\n startOffset += hterm.TextAttributes.nodeWidth(node);\n }\n }\n\n // End offset measures from the end of the line.\n var endOffset = (hterm.TextAttributes.nodeWidth(selection.endNode) -\n selection.endOffset);\n node = selection.endNode;\n\n if (node.nodeName != 'X-ROW') {\n // If the selection doesn't end on an x-row node, then it must be\n // somewhere inside the x-row. Add any characters from following siblings\n // into the end offset.\n\n if (node.nodeName == '#text' && node.parentNode.nodeName == 'SPAN') {\n // If node is the text node in a styled span, move up to the span node.\n node = node.parentNode;\n }\n\n while (node.nextSibling) {\n node = node.nextSibling;\n endOffset += hterm.TextAttributes.nodeWidth(node);\n }\n }\n\n var rv = this.getRowsText(selection.startRow.rowIndex,\n selection.endRow.rowIndex + 1);\n return lib.wc.substring(rv, startOffset, lib.wc.strWidth(rv) - endOffset);\n};\n\n/**\n * Copy the current selection to the system clipboard, then clear it after a\n * short delay.\n */\nhterm.Terminal.prototype.copySelectionToClipboard = function() {\n var text = this.getSelectionText();\n if (text != null)\n this.copyStringToClipboard(text);\n};\n\nhterm.Terminal.prototype.overlaySize = function() {\n this.showOverlay(this.screenSize.width + 'x' + this.screenSize.height);\n};\n\n/**\n * Invoked by hterm.Terminal.Keyboard when a VT keystroke is detected.\n *\n * @param {string} string The VT string representing the keystroke, in UTF-16.\n */\nhterm.Terminal.prototype.onVTKeystroke = function(string) {\n if (this.scrollOnKeystroke_)\n this.scrollPort_.scrollRowToBottom(this.getRowCount());\n\n this.io.onVTKeystroke(this.keyboard.encode(string));\n};\n\n/**\n * Launches url in a new tab.\n *\n * @param {string} url URL to launch in a new tab.\n */\nhterm.Terminal.prototype.openUrl = function(url) {\n if (window.chrome && window.chrome.browser) {\n // For Chrome v2 apps, we need to use this API to properly open windows.\n chrome.browser.openTab({'url': url});\n } else {\n var win = window.open(url, '_blank');\n win.focus();\n }\n}\n\n/**\n * Open the selected url.\n */\nhterm.Terminal.prototype.openSelectedUrl_ = function() {\n var str = this.getSelectionText();\n\n // If there is no selection, try and expand wherever they clicked.\n if (str == null) {\n this.screen_.expandSelection(this.document_.getSelection());\n str = this.getSelectionText();\n\n // If clicking in empty space, return.\n if (str == null)\n return;\n }\n\n // Make sure URL is valid before opening.\n if (str.length > 2048 || str.search(/[\\s\\[\\](){}<>\"'\\\\^`]/) >= 0)\n return;\n\n // If the URI isn't anchored, it'll open relative to the extension.\n // We have no way of knowing the correct schema, so assume http.\n if (str.search('^[a-zA-Z][a-zA-Z0-9+.-]*://') < 0) {\n // We have to whitelist a few protocols that lack authorities and thus\n // never use the //. Like mailto.\n switch (str.split(':', 1)[0]) {\n case 'mailto':\n break;\n default:\n str = 'http://' + str;\n break;\n }\n }\n\n this.openUrl(str);\n}\n\n\n/**\n * Add the terminalRow and terminalColumn properties to mouse events and\n * then forward on to onMouse().\n *\n * The terminalRow and terminalColumn properties contain the (row, column)\n * coordinates for the mouse event.\n *\n * @param {Event} e The mouse event to handle.\n */\nhterm.Terminal.prototype.onMouse_ = function(e) {\n if (e.processedByTerminalHandler_) {\n // We register our event handlers on the document, as well as the cursor\n // and the scroll blocker. Mouse events that occur on the cursor or\n // scroll blocker will also appear on the document, but we don't want to\n // process them twice.\n //\n // We can't just prevent bubbling because that has other side effects, so\n // we decorate the event object with this property instead.\n return;\n }\n\n var reportMouseEvents = (!this.defeatMouseReports_ &&\n this.vt.mouseReport != this.vt.MOUSE_REPORT_DISABLED);\n\n e.processedByTerminalHandler_ = true;\n\n // One based row/column stored on the mouse event.\n e.terminalRow = parseInt((e.clientY - this.scrollPort_.visibleRowTopMargin) /\n this.scrollPort_.characterSize.height) + 1;\n e.terminalColumn = parseInt(e.clientX /\n this.scrollPort_.characterSize.width) + 1;\n\n if (e.type == 'mousedown' && e.terminalColumn > this.screenSize.width) {\n // Mousedown in the scrollbar area.\n return;\n }\n\n if (this.options_.cursorVisible && !reportMouseEvents) {\n // If the cursor is visible and we're not sending mouse events to the\n // host app, then we want to hide the terminal cursor when the mouse\n // cursor is over top. This keeps the terminal cursor from interfering\n // with local text selection.\n if (e.terminalRow - 1 == this.screen_.cursorPosition.row &&\n e.terminalColumn - 1 == this.screen_.cursorPosition.column) {\n this.cursorNode_.style.display = 'none';\n } else if (this.cursorNode_.style.display == 'none') {\n this.cursorNode_.style.display = '';\n }\n }\n\n if (e.type == 'mousedown') {\n if (e.altKey || !reportMouseEvents) {\n // If VT mouse reporting is disabled, or has been defeated with\n // alt-mousedown, then the mouse will act on the local selection.\n this.defeatMouseReports_ = true;\n this.setSelectionEnabled(true);\n } else {\n // Otherwise we defer ownership of the mouse to the VT.\n this.defeatMouseReports_ = false;\n this.document_.getSelection().collapseToEnd();\n this.setSelectionEnabled(false);\n e.preventDefault();\n }\n }\n\n if (!reportMouseEvents) {\n if (e.type == 'dblclick' && this.copyOnSelect) {\n this.screen_.expandSelection(this.document_.getSelection());\n this.copySelectionToClipboard(this.document_);\n }\n\n if (e.type == 'click' && !e.shiftKey && (e.ctrlKey || e.metaKey)) {\n // Debounce this event with the dblclick event. If you try to doubleclick\n // a URL to open it, Chrome will fire click then dblclick, but we won't\n // have expanded the selection text at the first click event.\n clearTimeout(this.timeouts_.openUrl);\n this.timeouts_.openUrl = setTimeout(this.openSelectedUrl_.bind(this),\n 500);\n return;\n }\n\n if (e.type == 'mousedown') {\n if ((this.mouseRightClickPaste && e.button == 2 /* right button */) ||\n e.button == this.mousePasteButton) {\n if (!this.paste())\n console.warning('Could not paste manually due to web restrictions');;\n }\n }\n\n if (e.type == 'mouseup' && e.button == 0 && this.copyOnSelect &&\n !this.document_.getSelection().isCollapsed) {\n this.copySelectionToClipboard(this.document_);\n }\n\n if ((e.type == 'mousemove' || e.type == 'mouseup') &&\n this.scrollBlockerNode_.engaged) {\n // Disengage the scroll-blocker after one of these events.\n this.scrollBlockerNode_.engaged = false;\n this.scrollBlockerNode_.style.top = '-99px';\n }\n\n // Emulate arrow key presses via scroll wheel events.\n if (this.scrollWheelArrowKeys_ && !e.shiftKey &&\n this.keyboard.applicationCursor && !this.isPrimaryScreen()) {\n if (e.type == 'wheel') {\n var delta = this.scrollPort_.scrollWheelDelta(e);\n var lines = lib.f.smartFloorDivide(\n Math.abs(delta), this.scrollPort_.characterSize.height);\n\n var data = '\\x1bO' + (delta < 0 ? 'B' : 'A');\n this.io.sendString(data.repeat(lines));\n\n e.preventDefault();\n }\n }\n } else /* if (this.reportMouseEvents) */ {\n if (!this.scrollBlockerNode_.engaged) {\n if (e.type == 'mousedown') {\n // Move the scroll-blocker into place if we want to keep the scrollport\n // from scrolling.\n this.scrollBlockerNode_.engaged = true;\n this.scrollBlockerNode_.style.top = (e.clientY - 5) + 'px';\n this.scrollBlockerNode_.style.left = (e.clientX - 5) + 'px';\n } else if (e.type == 'mousemove') {\n // Oh. This means that drag-scroll was disabled AFTER the mouse down,\n // in which case it's too late to engage the scroll-blocker.\n this.document_.getSelection().collapseToEnd();\n e.preventDefault();\n }\n }\n\n this.onMouse(e);\n }\n\n if (e.type == 'mouseup' && this.document_.getSelection().isCollapsed) {\n // Restore this on mouseup in case it was temporarily defeated with a\n // alt-mousedown. Only do this when the selection is empty so that\n // we don't immediately kill the users selection.\n this.defeatMouseReports_ = false;\n }\n};\n\n/**\n * Clients should override this if they care to know about mouse events.\n *\n * The event parameter will be a normal DOM mouse click event with additional\n * 'terminalRow' and 'terminalColumn' properties.\n *\n * @param {Event} e The mouse event to handle.\n */\nhterm.Terminal.prototype.onMouse = function(e) { };\n\n/**\n * React when focus changes.\n *\n * @param {boolean} focused True if focused, false otherwise.\n */\nhterm.Terminal.prototype.onFocusChange_ = function(focused) {\n this.cursorNode_.setAttribute('focus', focused);\n this.restyleCursor_();\n if (focused === true)\n this.closeBellNotifications_();\n};\n\n/**\n * React when the ScrollPort is scrolled.\n */\nhterm.Terminal.prototype.onScroll_ = function() {\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * React when text is pasted into the scrollPort.\n *\n * @param {Event} e The DOM paste event to handle.\n */\nhterm.Terminal.prototype.onPaste_ = function(e) {\n var data = e.text.replace(/\\n/mg, '\\r');\n data = this.keyboard.encode(data);\n if (this.options_.bracketedPaste)\n data = '\\x1b[200~' + data + '\\x1b[201~';\n\n this.io.sendString(data);\n};\n\n/**\n * React when the user tries to copy from the scrollPort.\n *\n * @param {Event} e The DOM copy event.\n */\nhterm.Terminal.prototype.onCopy_ = function(e) {\n if (!this.useDefaultWindowCopy) {\n e.preventDefault();\n setTimeout(this.copySelectionToClipboard.bind(this), 0);\n }\n};\n\n/**\n * React when the ScrollPort is resized.\n *\n * Note: This function should not directly contain code that alters the internal\n * state of the terminal. That kind of code belongs in realizeWidth or\n * realizeHeight, so that it can be executed synchronously in the case of a\n * programmatic width change.\n */\nhterm.Terminal.prototype.onResize_ = function() {\n var columnCount = Math.floor(this.scrollPort_.getScreenWidth() /\n this.scrollPort_.characterSize.width) || 0;\n var rowCount = lib.f.smartFloorDivide(this.scrollPort_.getScreenHeight(),\n this.scrollPort_.characterSize.height) || 0;\n\n if (columnCount <= 0 || rowCount <= 0) {\n // We avoid these situations since they happen sometimes when the terminal\n // gets removed from the document or during the initial load, and we can't\n // deal with that.\n // This can also happen if called before the scrollPort calculates the\n // character size, meaning we dived by 0 above and default to 0 values.\n return;\n }\n\n var isNewSize = (columnCount != this.screenSize.width ||\n rowCount != this.screenSize.height);\n\n // We do this even if the size didn't change, just to be sure everything is\n // in sync.\n this.realizeSize_(columnCount, rowCount);\n this.showZoomWarning_(this.scrollPort_.characterSize.zoomFactor != 1);\n\n if (isNewSize)\n this.overlaySize();\n\n this.restyleCursor_();\n this.scheduleSyncCursorPosition_();\n};\n\n/**\n * Service the cursor blink timeout.\n */\nhterm.Terminal.prototype.onCursorBlink_ = function() {\n if (!this.options_.cursorBlink) {\n delete this.timeouts_.cursorBlink;\n return;\n }\n\n if (this.cursorNode_.getAttribute('focus') == 'false' ||\n this.cursorNode_.style.opacity == '0') {\n this.cursorNode_.style.opacity = '1';\n this.timeouts_.cursorBlink = setTimeout(this.myOnCursorBlink_,\n this.cursorBlinkCycle_[0]);\n } else {\n this.cursorNode_.style.opacity = '0';\n this.timeouts_.cursorBlink = setTimeout(this.myOnCursorBlink_,\n this.cursorBlinkCycle_[1]);\n }\n};\n\n/**\n * Set the scrollbar-visible mode bit.\n *\n * If scrollbar-visible is on, the vertical scrollbar will be visible.\n * Otherwise it will not.\n *\n * Defaults to on.\n *\n * @param {boolean} state True to set scrollbar-visible mode, false to unset.\n */\nhterm.Terminal.prototype.setScrollbarVisible = function(state) {\n this.scrollPort_.setScrollbarVisible(state);\n};\n\n/**\n * Set the scroll wheel move multiplier. This will affect how fast the page\n * scrolls on wheel events.\n *\n * Defaults to 1.\n *\n * @param {number} multiplier The multiplier to set.\n */\nhterm.Terminal.prototype.setScrollWheelMoveMultipler = function(multiplier) {\n this.scrollPort_.setScrollWheelMoveMultipler(multiplier);\n};\n\n/**\n * Close all web notifications created by terminal bells.\n */\nhterm.Terminal.prototype.closeBellNotifications_ = function() {\n this.bellNotificationList_.forEach(function(n) {\n n.close();\n });\n this.bellNotificationList_.length = 0;\n};\n// SOURCE FILE: hterm/js/hterm_terminal_io.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.encodeUTF8');\n\n/**\n * Input/Output interface used by commands to communicate with the terminal.\n *\n * Commands like `nassh` and `crosh` receive an instance of this class as\n * part of their argv object. This allows them to write to and read from the\n * terminal without exposing them to an entire hterm.Terminal instance.\n *\n * The active command must override the onVTKeystroke() and sendString() methods\n * of this class in order to receive keystrokes and send output to the correct\n * destination.\n *\n * Isolating commands from the terminal provides the following benefits:\n * - Provides a mechanism to save and restore onVTKeystroke and sendString\n * handlers when invoking subcommands (see the push() and pop() methods).\n * - The isolation makes it easier to make changes in Terminal and supporting\n * classes without affecting commands.\n * - In The Future commands may run in web workers where they would only be able\n * to talk to a Terminal instance through an IPC mechanism.\n *\n * @param {hterm.Terminal}\n */\nhterm.Terminal.IO = function(terminal) {\n this.terminal_ = terminal;\n\n // The IO object to restore on IO.pop().\n this.previousIO_ = null;\n};\n\n/**\n * Show the terminal overlay for a given amount of time.\n *\n * The terminal overlay appears in inverse video in a large font, centered\n * over the terminal. You should probably keep the overlay message brief,\n * since it's in a large font and you probably aren't going to check the size\n * of the terminal first.\n *\n * @param {string} msg The text (not HTML) message to display in the overlay.\n * @param {number} opt_timeout The amount of time to wait before fading out\n * the overlay. Defaults to 1.5 seconds. Pass null to have the overlay\n * stay up forever (or until the next overlay).\n */\nhterm.Terminal.IO.prototype.showOverlay = function(message, opt_timeout) {\n this.terminal_.showOverlay(message, opt_timeout);\n};\n\n/**\n * Open an frame in the current terminal window, pointed to the specified\n * url.\n *\n * Eventually we'll probably need size/position/decoration options.\n * The user should also be able to move/resize the frame.\n *\n * @param {string} url The URL to load in the frame.\n * @param {Object} opt_options Optional frame options. Not implemented.\n */\nhterm.Terminal.IO.prototype.createFrame = function(url, opt_options) {\n return new hterm.Frame(this.terminal_, url, opt_options);\n};\n\n/**\n * Change the preference profile for the terminal.\n *\n * @param profileName {string} The name of the preference profile to activate.\n */\nhterm.Terminal.IO.prototype.setTerminalProfile = function(profileName) {\n this.terminal_.setProfile(profileName);\n};\n\n/**\n * Create a new hterm.Terminal.IO instance and make it active on the Terminal\n * object associated with this instance.\n *\n * This is used to pass control of the terminal IO off to a subcommand. The\n * IO.pop() method can be used to restore control when the subcommand completes.\n */\nhterm.Terminal.IO.prototype.push = function() {\n var io = new hterm.Terminal.IO(this.terminal_);\n io.keyboardCaptured_ = this.keyboardCaptured_;\n\n io.columnCount = this.columnCount;\n io.rowCount = this.rowCount;\n\n io.previousIO_ = this.terminal_.io;\n this.terminal_.io = io;\n\n return io;\n};\n\n/**\n * Restore the Terminal's previous IO object.\n */\nhterm.Terminal.IO.prototype.pop = function() {\n this.terminal_.io = this.previousIO_;\n};\n\n/**\n * Called when data needs to be sent to the current command.\n *\n * Clients should override this to receive notification of pending data.\n *\n * @param {string} string The data to send.\n */\nhterm.Terminal.IO.prototype.sendString = function(string) {\n // Override this.\n console.log('Unhandled sendString: ' + string);\n};\n\n/**\n * Called when a terminal keystroke is detected.\n *\n * Clients should override this to receive notification of keystrokes.\n *\n * The keystroke data will be encoded according to the 'send-encoding'\n * preference.\n *\n * @param {string} string The VT key sequence.\n */\nhterm.Terminal.IO.prototype.onVTKeystroke = function(string) {\n // Override this.\n console.log('Unobserverd VT keystroke: ' + JSON.stringify(string));\n};\n\nhterm.Terminal.IO.prototype.onTerminalResize_ = function(width, height) {\n var obj = this;\n while (obj) {\n obj.columnCount = width;\n obj.rowCount = height;\n obj = obj.previousIO_;\n }\n\n this.onTerminalResize(width, height);\n};\n\n/**\n * Called when terminal size is changed.\n *\n * Clients should override this to receive notification of resize.\n *\n * @param {string|integer} terminal width.\n * @param {string|integer} terminal height.\n */\nhterm.Terminal.IO.prototype.onTerminalResize = function(width, height) {\n // Override this.\n};\n\n/**\n * Write a UTF-8 encoded byte string to the terminal.\n *\n * @param {string} string The UTF-8 encoded string to print.\n */\nhterm.Terminal.IO.prototype.writeUTF8 = function(string) {\n if (this.terminal_.io != this)\n throw 'Attempt to print from inactive IO object.';\n\n this.terminal_.interpret(string);\n};\n\n/**\n * Write a UTF-8 encoded byte string to the terminal followed by crlf.\n *\n * @param {string} string The UTF-8 encoded string to print.\n */\nhterm.Terminal.IO.prototype.writelnUTF8 = function(string) {\n if (this.terminal_.io != this)\n throw 'Attempt to print from inactive IO object.';\n\n this.terminal_.interpret(string + '\\r\\n');\n};\n\n/**\n * Write a UTF-16 JavaScript string to the terminal.\n *\n * @param {string} string The string to print.\n */\nhterm.Terminal.IO.prototype.print =\nhterm.Terminal.IO.prototype.writeUTF16 = function(string) {\n this.writeUTF8(lib.encodeUTF8(string));\n};\n\n/**\n * Print a UTF-16 JavaScript string to the terminal followed by a newline.\n *\n * @param {string} string The string to print.\n */\nhterm.Terminal.IO.prototype.println =\nhterm.Terminal.IO.prototype.writelnUTF16 = function(string) {\n this.writelnUTF8(lib.encodeUTF8(string));\n};\n// SOURCE FILE: hterm/js/hterm_text_attributes.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.colors');\n\n/**\n * Constructor for TextAttribute objects.\n *\n * These objects manage a set of text attributes such as foreground/\n * background color, bold, faint, italic, blink, underline, and strikethrough.\n *\n * TextAttribute instances can be used to construct a DOM container implementing\n * the current attributes, or to test an existing DOM container for\n * compatibility with the current attributes.\n *\n * @constructor\n * @param {HTMLDocument} document The parent document to use when creating\n * new DOM containers.\n */\nhterm.TextAttributes = function(document) {\n this.document_ = document;\n // These variables contain the source of the color as either:\n // SRC_DEFAULT (use context default)\n // SRC_RGB (specified in 'rgb( r, g, b)' form)\n // number (representing the index from color palette to use)\n this.foregroundSource = this.SRC_DEFAULT;\n this.backgroundSource = this.SRC_DEFAULT;\n\n // These properties cache the value in the color table, but foregroundSource\n // and backgroundSource contain the canonical values.\n this.foreground = this.DEFAULT_COLOR;\n this.background = this.DEFAULT_COLOR;\n\n this.defaultForeground = 'rgb(255, 255, 255)';\n this.defaultBackground = 'rgb(0, 0, 0)';\n\n this.bold = false;\n this.faint = false;\n this.italic = false;\n this.blink = false;\n this.underline = false;\n this.strikethrough = false;\n this.inverse = false;\n this.invisible = false;\n this.wcNode = false;\n this.asciiNode = true;\n this.tileData = null;\n\n this.colorPalette = null;\n this.resetColorPalette();\n};\n\n/**\n * If false, we ignore the bold attribute.\n *\n * This is used for fonts that have a bold version that is a different size\n * than the normal weight version.\n */\nhterm.TextAttributes.prototype.enableBold = true;\n\n/**\n * If true, use bright colors (if available) for bold text.\n *\n * This setting is independent of the enableBold setting.\n */\nhterm.TextAttributes.prototype.enableBoldAsBright = true;\n\n/**\n * A sentinel constant meaning \"whatever the default color is in this context\".\n */\nhterm.TextAttributes.prototype.DEFAULT_COLOR = lib.f.createEnum('');\n\n/**\n * A constant string used to specify that source color is context default.\n */\nhterm.TextAttributes.prototype.SRC_DEFAULT = 'default';\n\n\n/**\n * A constant string used to specify that the source of a color is a valid\n * rgb( r, g, b) specifier.\n */\nhterm.TextAttributes.prototype.SRC_RGB = 'rgb';\n\n/**\n * The document object which should own the DOM nodes created by this instance.\n *\n * @param {HTMLDocument} document The parent document.\n */\nhterm.TextAttributes.prototype.setDocument = function(document) {\n this.document_ = document;\n};\n\n/**\n * Create a deep copy of this object.\n *\n * @return {hterm.TextAttributes} A deep copy of this object.\n */\nhterm.TextAttributes.prototype.clone = function() {\n var rv = new hterm.TextAttributes(null);\n\n for (var key in this) {\n rv[key] = this[key];\n }\n\n rv.colorPalette = this.colorPalette.concat();\n return rv;\n};\n\n/**\n * Reset the current set of attributes.\n *\n * This does not affect the palette. Use resetColorPalette() for that.\n * It also doesn't affect the tile data, it's not meant to.\n */\nhterm.TextAttributes.prototype.reset = function() {\n this.foregroundSource = this.SRC_DEFAULT;\n this.backgroundSource = this.SRC_DEFAULT;\n this.foreground = this.DEFAULT_COLOR;\n this.background = this.DEFAULT_COLOR;\n this.bold = false;\n this.faint = false;\n this.italic = false;\n this.blink = false;\n this.underline = false;\n this.strikethrough = false;\n this.inverse = false;\n this.invisible = false;\n this.wcNode = false;\n this.asciiNode = true;\n};\n\n/**\n * Reset the color palette to the default state.\n */\nhterm.TextAttributes.prototype.resetColorPalette = function() {\n this.colorPalette = lib.colors.colorPalette.concat();\n this.syncColors();\n};\n\n/**\n * Test if the current attributes describe unstyled text.\n *\n * @return {boolean} True if the current attributes describe unstyled text.\n */\nhterm.TextAttributes.prototype.isDefault = function() {\n return (this.foregroundSource == this.SRC_DEFAULT &&\n this.backgroundSource == this.SRC_DEFAULT &&\n !this.bold &&\n !this.faint &&\n !this.italic &&\n !this.blink &&\n !this.underline &&\n !this.strikethrough &&\n !this.inverse &&\n !this.invisible &&\n !this.wcNode &&\n this.asciiNode &&\n this.tileData == null);\n};\n\n/**\n * Create a DOM container (a span or a text node) with a style to match the\n * current set of attributes.\n *\n * This method will create a plain text node if the text is unstyled, or\n * an HTML span if the text is styled. Due to lack of monospace wide character\n * fonts on certain systems (e.g. Chrome OS), we need to put each wide character\n * in a span of CSS class '.wc-node' which has double column width.\n * Each vt_tiledata tile is also represented by a span with a single\n * character, with CSS classes '.tile' and '.tile_'.\n *\n * @param {string} opt_textContent Optional text content for the new container.\n * @return {HTMLNode} An HTML span or text nodes styled to match the current\n * attributes.\n */\nhterm.TextAttributes.prototype.createContainer = function(opt_textContent) {\n if (this.isDefault())\n return this.document_.createTextNode(opt_textContent);\n\n var span = this.document_.createElement('span');\n var style = span.style;\n var classes = [];\n\n if (this.foreground != this.DEFAULT_COLOR)\n style.color = this.foreground;\n\n if (this.background != this.DEFAULT_COLOR)\n style.backgroundColor = this.background;\n\n if (this.enableBold && this.bold)\n style.fontWeight = 'bold';\n\n if (this.faint)\n span.faint = true;\n\n if (this.italic)\n style.fontStyle = 'italic';\n\n if (this.blink) {\n classes.push('blink-node');\n span.blinkNode = true;\n }\n\n var textDecoration = '';\n if (this.underline) {\n textDecoration += ' underline';\n span.underline = true;\n }\n if (this.strikethrough) {\n textDecoration += ' line-through';\n span.strikethrough = true;\n }\n if (textDecoration) {\n style.textDecoration = textDecoration;\n }\n\n if (this.wcNode) {\n classes.push('wc-node');\n span.wcNode = true;\n span.asciiNode = false;\n }\n\n if (this.tileData != null) {\n classes.push('tile');\n classes.push('tile_' + this.tileData);\n span.tileNode = true;\n }\n\n if (opt_textContent)\n span.textContent = opt_textContent;\n\n if (classes.length)\n span.className = classes.join(' ');\n\n return span;\n};\n\n/**\n * Tests if the provided object (string, span or text node) has the same\n * style as this TextAttributes instance.\n *\n * This indicates that text with these attributes could be inserted directly\n * into the target DOM node.\n *\n * For the purposes of this method, a string is considered a text node.\n *\n * @param {string|HTMLNode} obj The object to test.\n * @return {boolean} True if the provided container has the same style as\n * this attributes instance.\n */\nhterm.TextAttributes.prototype.matchesContainer = function(obj) {\n if (typeof obj == 'string' || obj.nodeType == 3)\n return this.isDefault();\n\n var style = obj.style;\n\n // We don't want to put multiple characters in a wcNode or a tile.\n // See the comments in createContainer.\n return (!(this.wcNode || obj.wcNode) &&\n this.asciiNode == this.asciiNode &&\n !(this.tileData != null || obj.tileNode) &&\n this.foreground == style.color &&\n this.background == style.backgroundColor &&\n (this.enableBold && this.bold) == !!style.fontWeight &&\n this.blink == obj.blinkNode &&\n this.italic == !!style.fontStyle &&\n !!this.underline == !!obj.underline &&\n !!this.strikethrough == !!obj.strikethrough);\n};\n\nhterm.TextAttributes.prototype.setDefaults = function(foreground, background) {\n this.defaultForeground = foreground;\n this.defaultBackground = background;\n\n this.syncColors();\n};\n\n/**\n * Updates foreground and background properties based on current indices and\n * other state.\n *\n * @param {string} terminalForeground The terminal foreground color for use as\n * inverse text background.\n * @param {string} terminalBackground The terminal background color for use as\n * inverse text foreground.\n *\n */\nhterm.TextAttributes.prototype.syncColors = function() {\n function getBrightIndex(i) {\n if (i < 8) {\n // If the color is from the lower half of the ANSI 16, add 8.\n return i + 8;\n }\n\n // If it's not from the 16 color palette, ignore bold requests. This\n // matches the behavior of gnome-terminal.\n return i;\n }\n\n var foregroundSource = this.foregroundSource;\n var backgroundSource = this.backgroundSource;\n var defaultForeground = this.DEFAULT_COLOR;\n var defaultBackground = this.DEFAULT_COLOR;\n\n if (this.inverse) {\n foregroundSource = this.backgroundSource;\n backgroundSource = this.foregroundSource;\n // We can't inherit the container's color anymore.\n defaultForeground = this.defaultBackground;\n defaultBackground = this.defaultForeground;\n }\n\n if (this.enableBoldAsBright && this.bold) {\n if (foregroundSource != this.SRC_DEFAULT &&\n foregroundSource != this.SRC_RGB) {\n foregroundSource = getBrightIndex(foregroundSource);\n }\n }\n\n if (this.invisible) {\n foregroundSource = backgroundSource;\n defaultForeground = this.defaultBackground;\n }\n\n // Set fore/background colors unless already specified in rgb(r, g, b) form.\n if (foregroundSource != this.SRC_RGB) {\n this.foreground = ((foregroundSource == this.SRC_DEFAULT) ?\n defaultForeground : this.colorPalette[foregroundSource]);\n }\n\n if (this.faint && !this.invisible) {\n var colorToMakeFaint = ((this.foreground == this.DEFAULT_COLOR) ?\n this.defaultForeground : this.foreground);\n this.foreground = lib.colors.mix(colorToMakeFaint, 'rgb(0, 0, 0)', 0.3333);\n }\n\n if (backgroundSource != this.SRC_RGB) {\n this.background = ((backgroundSource == this.SRC_DEFAULT) ?\n defaultBackground : this.colorPalette[backgroundSource]);\n }\n};\n\n/**\n * Static method used to test if the provided objects (strings, spans or\n * text nodes) have the same style.\n *\n * For the purposes of this method, a string is considered a text node.\n *\n * @param {string|HTMLNode} obj1 An object to test.\n * @param {string|HTMLNode} obj2 Another object to test.\n * @return {boolean} True if the containers have the same style.\n */\nhterm.TextAttributes.containersMatch = function(obj1, obj2) {\n if (typeof obj1 == 'string')\n return hterm.TextAttributes.containerIsDefault(obj2);\n\n if (obj1.nodeType != obj2.nodeType)\n return false;\n\n if (obj1.nodeType == 3)\n return true;\n\n var style1 = obj1.style;\n var style2 = obj2.style;\n\n return (style1.color == style2.color &&\n style1.backgroundColor == style2.backgroundColor &&\n style1.fontWeight == style2.fontWeight &&\n style1.fontStyle == style2.fontStyle &&\n style1.textDecoration == style2.textDecoration);\n};\n\n/**\n * Static method to test if a given DOM container represents unstyled text.\n *\n * For the purposes of this method, a string is considered a text node.\n *\n * @param {string|HTMLNode} obj1 An object to test.\n * @return {boolean} True if the object is unstyled.\n */\nhterm.TextAttributes.containerIsDefault = function(obj) {\n return typeof obj == 'string' || obj.nodeType == 3;\n};\n\n/**\n * Static method to get the column width of a node's textContent.\n *\n * @param {HTMLElement} node The HTML element to get the width of textContent\n * from.\n * @return {integer} The column width of the node's textContent.\n */\nhterm.TextAttributes.nodeWidth = function(node) {\n if (!node.asciiNode) {\n return lib.wc.strWidth(node.textContent);\n } else {\n return node.textContent.length;\n }\n}\n\n/**\n * Static method to get the substr of a node's textContent. The start index\n * and substr width are computed in column width.\n *\n * @param {HTMLElement} node The HTML element to get the substr of textContent\n * from.\n * @param {integer} start The starting offset in column width.\n * @param {integer} width The width to capture in column width.\n * @return {integer} The extracted substr of the node's textContent.\n */\nhterm.TextAttributes.nodeSubstr = function(node, start, width) {\n if (!node.asciiNode) {\n return lib.wc.substr(node.textContent, start, width);\n } else {\n return node.textContent.substr(start, width);\n }\n}\n\n/**\n * Static method to get the substring based of a node's textContent. The\n * start index of end index are computed in column width.\n *\n * @param {HTMLElement} node The HTML element to get the substr of textContent\n * from.\n * @param {integer} start The starting offset in column width.\n * @param {integer} end The ending offset in column width.\n * @return {integer} The extracted substring of the node's textContent.\n */\nhterm.TextAttributes.nodeSubstring = function(node, start, end) {\n if (!node.asciiNode) {\n return lib.wc.substring(node.textContent, start, end);\n } else {\n return node.textContent.substring(start, end);\n }\n};\n\n/**\n * Static method to split a string into contiguous runs of single-width\n * characters and runs of double-width characters.\n *\n * @param {string} str The string to split.\n * @return {Array} An array of objects that contain substrings of str, where\n * each substring is either a contiguous runs of single-width characters\n * or a double-width character. For objects that contain a double-width\n * character, its wcNode property is set to true. For objects that contain\n * only ASCII content, its asciiNode property is set to true.\n */\nhterm.TextAttributes.splitWidecharString = function(str) {\n var rv = [];\n var base = 0, length = 0;\n var asciiNode = true;\n\n for (var i = 0; i < str.length;) {\n var c = str.codePointAt(i);\n var increment = (c <= 0xffff) ? 1 : 2;\n if (c < 128) {\n length += increment;\n } else if (lib.wc.charWidth(c) <= 1) {\n length += increment;\n asciiNode = false;\n } else {\n if (length) {\n rv.push({\n str: str.substr(base, length),\n asciiNode: asciiNode,\n });\n asciiNode = true;\n }\n rv.push({\n str: str.substr(i, increment),\n wcNode: true,\n asciiNode: false,\n });\n base = i + increment;\n length = 0;\n }\n i += increment;\n }\n\n if (length) {\n rv.push({\n str: str.substr(base, length),\n asciiNode: asciiNode,\n });\n }\n\n return rv;\n};\n// SOURCE FILE: hterm/js/hterm_vt.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.colors', 'lib.f', 'lib.UTF8Decoder',\n 'hterm.VT.CharacterMap');\n\n/**\n * Constructor for the VT escape sequence interpreter.\n *\n * The interpreter operates on a terminal object capable of performing cursor\n * move operations, painting characters, etc.\n *\n * This interpreter is intended to be compatible with xterm, though it\n * ignores some of the more esoteric escape sequences.\n *\n * Control sequences are documented in hterm/doc/ControlSequences.md.\n *\n * @param {hterm.Terminal} terminal Terminal to use with the interpreter.\n */\nhterm.VT = function(terminal) {\n /**\n * The display terminal object associated with this virtual terminal.\n */\n this.terminal = terminal;\n\n terminal.onMouse = this.onTerminalMouse_.bind(this);\n this.mouseReport = this.MOUSE_REPORT_DISABLED;\n\n // Parse state left over from the last parse. You should use the parseState\n // instance passed into your parse routine, rather than reading\n // this.parseState_ directly.\n this.parseState_ = new hterm.VT.ParseState(this.parseUnknown_);\n\n // Any \"leading modifiers\" for the escape sequence, such as '?', ' ', or the\n // other modifiers handled in this.parseCSI_.\n this.leadingModifier_ = '';\n\n // Any \"trailing modifiers\". Same character set as a leading modifier,\n // except these are found after the numeric arguments.\n this.trailingModifier_ = '';\n\n // Whether or not to respect the escape codes for setting terminal width.\n this.allowColumnWidthChanges_ = false;\n\n // The amount of time we're willing to wait for the end of an OSC sequence.\n this.oscTimeLimit_ = 20000;\n\n // Decoder to maintain UTF-8 decode state.\n this.utf8Decoder_ = new lib.UTF8Decoder();\n\n /**\n * Whether to accept the 8-bit control characters.\n *\n * An 8-bit control character is one with the eighth bit set. These\n * didn't work on 7-bit terminals so they all have two byte equivalents.\n * Most hosts still only use the two-byte versions.\n *\n * We ignore 8-bit control codes by default. This is in order to avoid\n * issues with \"accidental\" usage of codes that need to be terminated.\n * The \"accident\" usually involves cat'ing binary data.\n */\n this.enable8BitControl = false;\n\n /**\n * Whether to allow the OSC 52 sequence to write to the system clipboard.\n */\n this.enableClipboardWrite = true;\n\n /**\n * Respect the host's attempt to change the cursor blink status using\n * the DEC Private mode 12.\n */\n this.enableDec12 = false;\n\n /**\n * The expected encoding method for data received from the host.\n */\n this.characterEncoding = 'utf-8';\n\n /**\n * Max length of an unterminated DCS, OSC, PM or APC sequence before we give\n * up and ignore the code.\n *\n * These all end with a String Terminator (ST, '\\x9c', ESC '\\\\') or\n * (BEL, '\\x07') character, hence the \"string sequence\" moniker.\n */\n this.maxStringSequence = 1024;\n\n /**\n * If true, emit warnings when we encounter a control character or escape\n * sequence that we don't recognize or explicitly ignore.\n */\n this.warnUnimplemented = true;\n\n /**\n * The set of available character maps (used by G0...G3 below).\n */\n this.characterMaps = new hterm.VT.CharacterMaps();\n\n /**\n * The default G0...G3 character maps.\n * We default to the US/ASCII map everywhere as that aligns with other\n * terminals, and it makes it harder to accidentally switch to the graphics\n * character map (Ctrl-N). Any program that wants to use the graphics map\n * will usually select it anyways since there's no guarantee what state any\n * of the maps are in at any particular time.\n */\n this.G0 = this.G1 = this.G2 = this.G3 =\n this.characterMaps.getMap('B');\n\n /**\n * The 7-bit visible character set.\n *\n * This is a mapping from inbound data to display glyph. The GL set\n * contains the 94 bytes from 0x21 to 0x7e.\n *\n * The default GL set is 'B', US ASCII.\n */\n this.GL = 'G0';\n\n /**\n * The 8-bit visible character set.\n *\n * This is a mapping from inbound data to display glyph. The GR set\n * contains the 94 bytes from 0xa1 to 0xfe.\n */\n this.GR = 'G0';\n\n /**\n * The current encoding of the terminal.\n *\n * We only support ECMA-35 and UTF-8, so go with a boolean here.\n * The encoding can be locked too.\n */\n this.codingSystemUtf8_ = false;\n this.codingSystemLocked_ = false;\n\n // Construct a regular expression to match the known one-byte control chars.\n // This is used in parseUnknown_ to quickly scan a string for the next\n // control character.\n this.cc1Pattern_ = null;\n this.updateEncodingState_();\n\n // Saved state used in DECSC.\n //\n // This is a place to store a copy VT state, it is *not* the active state.\n this.savedState_ = new hterm.VT.CursorState(this);\n};\n\n/**\n * No mouse events.\n */\nhterm.VT.prototype.MOUSE_REPORT_DISABLED = 0;\n\n/**\n * DECSET mode 1000.\n *\n * Report mouse down/up events only.\n */\nhterm.VT.prototype.MOUSE_REPORT_CLICK = 1;\n\n/**\n * DECSET mode 1002.\n *\n * Report mouse down/up and movement while a button is down.\n */\nhterm.VT.prototype.MOUSE_REPORT_DRAG = 3;\n\n/**\n * ParseState constructor.\n *\n * This object tracks the current state of the parse. It has fields for the\n * current buffer, position in the buffer, and the parse function.\n *\n * @param {function} defaultFunc The default parser function.\n * @param {string} opt_buf Optional string to use as the current buffer.\n */\nhterm.VT.ParseState = function(defaultFunction, opt_buf) {\n this.defaultFunction = defaultFunction;\n this.buf = opt_buf || null;\n this.pos = 0;\n this.func = defaultFunction;\n this.args = [];\n};\n\n/**\n * Reset the parser function, buffer, and position.\n */\nhterm.VT.ParseState.prototype.reset = function(opt_buf) {\n this.resetParseFunction();\n this.resetBuf(opt_buf || '');\n this.resetArguments();\n};\n\n/**\n * Reset the parser function only.\n */\nhterm.VT.ParseState.prototype.resetParseFunction = function() {\n this.func = this.defaultFunction;\n};\n\n/**\n * Reset the buffer and position only.\n *\n * @param {string} buf Optional new value for buf, defaults to null.\n */\nhterm.VT.ParseState.prototype.resetBuf = function(opt_buf) {\n this.buf = (typeof opt_buf == 'string') ? opt_buf : null;\n this.pos = 0;\n};\n\n/**\n * Reset the arguments list only.\n *\n * @param {string} opt_arg_zero Optional initial value for args[0].\n */\nhterm.VT.ParseState.prototype.resetArguments = function(opt_arg_zero) {\n this.args.length = 0;\n if (typeof opt_arg_zero != 'undefined')\n this.args[0] = opt_arg_zero;\n};\n\n/**\n * Get an argument as an integer.\n *\n * @param {number} argnum The argument number to retrieve.\n */\nhterm.VT.ParseState.prototype.iarg = function(argnum, defaultValue) {\n var str = this.args[argnum];\n if (str) {\n var ret = parseInt(str, 10);\n // An argument of zero is treated as the default value.\n if (ret == 0)\n ret = defaultValue;\n return ret;\n }\n return defaultValue;\n};\n\n/**\n * Advance the parse position.\n *\n * @param {integer} count The number of bytes to advance.\n */\nhterm.VT.ParseState.prototype.advance = function(count) {\n this.pos += count;\n};\n\n/**\n * Return the remaining portion of the buffer without affecting the parse\n * position.\n *\n * @return {string} The remaining portion of the buffer.\n */\nhterm.VT.ParseState.prototype.peekRemainingBuf = function() {\n return this.buf.substr(this.pos);\n};\n\n/**\n * Return the next single character in the buffer without affecting the parse\n * position.\n *\n * @return {string} The next character in the buffer.\n */\nhterm.VT.ParseState.prototype.peekChar = function() {\n return this.buf.substr(this.pos, 1);\n};\n\n/**\n * Return the next single character in the buffer and advance the parse\n * position one byte.\n *\n * @return {string} The next character in the buffer.\n */\nhterm.VT.ParseState.prototype.consumeChar = function() {\n return this.buf.substr(this.pos++, 1);\n};\n\n/**\n * Return true if the buffer is empty, or the position is past the end.\n */\nhterm.VT.ParseState.prototype.isComplete = function() {\n return this.buf == null || this.buf.length <= this.pos;\n};\n\nhterm.VT.CursorState = function(vt) {\n this.vt_ = vt;\n this.save();\n};\n\nhterm.VT.CursorState.prototype.save = function() {\n this.cursor = this.vt_.terminal.saveCursor();\n\n this.textAttributes = this.vt_.terminal.getTextAttributes().clone();\n\n this.GL = this.vt_.GL;\n this.GR = this.vt_.GR;\n\n this.G0 = this.vt_.G0;\n this.G1 = this.vt_.G1;\n this.G2 = this.vt_.G2;\n this.G3 = this.vt_.G3;\n};\n\nhterm.VT.CursorState.prototype.restore = function() {\n this.vt_.terminal.restoreCursor(this.cursor);\n\n this.vt_.terminal.setTextAttributes(this.textAttributes.clone());\n\n this.vt_.GL = this.GL;\n this.vt_.GR = this.GR;\n\n this.vt_.G0 = this.G0;\n this.vt_.G1 = this.G1;\n this.vt_.G2 = this.G2;\n this.vt_.G3 = this.G3;\n};\n\nhterm.VT.prototype.reset = function() {\n this.G0 = this.characterMaps.getMap('B');\n this.G1 = this.characterMaps.getMap('0');\n this.G2 = this.characterMaps.getMap('B');\n this.G3 = this.characterMaps.getMap('B');\n\n this.GL = 'G0';\n this.GR = 'G0';\n\n this.savedState_ = new hterm.VT.CursorState(this);\n\n this.mouseReport = this.MOUSE_REPORT_DISABLED;\n};\n\n/**\n * Handle terminal mouse events.\n *\n * See the \"Mouse Tracking\" section of [xterm].\n */\nhterm.VT.prototype.onTerminalMouse_ = function(e) {\n if (this.mouseReport == this.MOUSE_REPORT_DISABLED)\n return;\n\n // Temporary storage for our response.\n var response;\n\n // Modifier key state.\n var mod = 0;\n if (e.shiftKey)\n mod |= 4;\n if (e.metaKey || (this.terminal.keyboard.altIsMeta && e.altKey))\n mod |= 8;\n if (e.ctrlKey)\n mod |= 16;\n\n // TODO(rginda): We should also support mode 1005 and/or 1006 to extend the\n // coordinate space. Though, after poking around just a little, I wasn't\n // able to get vi or emacs to use either of these modes.\n var x = String.fromCharCode(lib.f.clamp(e.terminalColumn + 32, 32, 255));\n var y = String.fromCharCode(lib.f.clamp(e.terminalRow + 32, 32, 255));\n\n switch (e.type) {\n case 'wheel':\n // Mouse wheel is treated as button 1 or 2 plus an additional 64.\n b = (((e.deltaY * -1) > 0) ? 0 : 1) + 96;\n b |= mod;\n response = '\\x1b[M' + String.fromCharCode(b) + x + y;\n\n // Keep the terminal from scrolling.\n e.preventDefault();\n break;\n\n case 'mousedown':\n // Buttons are encoded as button number plus 32.\n var b = Math.min(e.button, 2) + 32;\n\n // And mix in the modifier keys.\n b |= mod;\n\n response = '\\x1b[M' + String.fromCharCode(b) + x + y;\n break;\n\n case 'mouseup':\n // Mouse up has no indication of which button was released.\n response = '\\x1b[M\\x23' + x + y;\n break;\n\n case 'mousemove':\n if (this.mouseReport == this.MOUSE_REPORT_DRAG && e.buttons) {\n // Standard button bits. The XTerm protocol only reports the first\n // button press (e.g. if left & right are pressed, right is ignored),\n // and it only supports the first three buttons. If none of them are\n // pressed, then XTerm flags it as a release. We'll do the same.\n b = 32;\n\n // Priority here matches XTerm: left, middle, right.\n if (e.buttons & 0x1) {\n // Report left button.\n b += 0;\n } else if (e.buttons & 0x4) {\n // Report middle button.\n b += 1;\n } else if (e.buttons & 0x2) {\n // Report right button.\n b += 2;\n } else {\n // Release higher buttons.\n b += 3;\n }\n\n // Add 32 to indicate mouse motion.\n b += 32;\n\n // And mix in the modifier keys.\n b |= mod;\n\n response = '\\x1b[M' + String.fromCharCode(b) + x + y;\n }\n\n break;\n\n case 'click':\n case 'dblclick':\n break;\n\n default:\n console.error('Unknown mouse event: ' + e.type, e);\n break;\n }\n\n if (response)\n this.terminal.io.sendString(response);\n};\n\n/**\n * Interpret a string of characters, displaying the results on the associated\n * terminal object.\n *\n * The buffer will be decoded according to the 'receive-encoding' preference.\n */\nhterm.VT.prototype.interpret = function(buf) {\n this.parseState_.resetBuf(this.decode(buf));\n\n while (!this.parseState_.isComplete()) {\n var func = this.parseState_.func;\n var pos = this.parseState_.pos;\n var buf = this.parseState_.buf;\n\n this.parseState_.func.call(this, this.parseState_);\n\n if (this.parseState_.func == func && this.parseState_.pos == pos &&\n this.parseState_.buf == buf) {\n throw 'Parser did not alter the state!';\n }\n }\n};\n\n/**\n * Decode a string according to the 'receive-encoding' preference.\n */\nhterm.VT.prototype.decode = function(str) {\n if (this.characterEncoding == 'utf-8')\n return this.decodeUTF8(str);\n\n return str;\n};\n\n/**\n * Encode a UTF-16 string as UTF-8.\n *\n * See also: https://en.wikipedia.org/wiki/UTF-16\n */\nhterm.VT.prototype.encodeUTF8 = function(str) {\n return lib.encodeUTF8(str);\n};\n\n/**\n * Decode a UTF-8 string into UTF-16.\n */\nhterm.VT.prototype.decodeUTF8 = function(str) {\n return this.utf8Decoder_.decode(str);\n};\n\n/**\n * Set the encoding of the terminal.\n *\n * @param {string} encoding The name of the encoding to set.\n */\nhterm.VT.prototype.setEncoding = function(encoding) {\n switch (encoding) {\n default:\n console.warn('Invalid value for \"terminal-encoding\": ' + encoding);\n // Fall through.\n case 'iso-2022':\n this.codingSystemUtf8_ = false;\n this.codingSystemLocked_ = false;\n break;\n case 'utf-8-locked':\n this.codingSystemUtf8_ = true;\n this.codingSystemLocked_ = true;\n break;\n case 'utf-8':\n this.codingSystemUtf8_ = true;\n this.codingSystemLocked_ = false;\n break;\n }\n\n this.updateEncodingState_();\n};\n\n/**\n * Refresh internal state when the encoding changes.\n */\nhterm.VT.prototype.updateEncodingState_ = function() {\n // If we're in UTF8 mode, don't suport 8-bit escape sequences as we'll never\n // see those -- everything should be UTF8!\n var cc1 = Object.keys(hterm.VT.CC1)\n .filter((e) => !this.codingSystemUtf8_ || e.charCodeAt() < 0x80)\n .map((e) => '\\\\x' + lib.f.zpad(e.charCodeAt().toString(16), 2))\n .join('');\n this.cc1Pattern_ = new RegExp(`[${cc1}]`);\n};\n\n/**\n * The default parse function.\n *\n * This will scan the string for the first 1-byte control character (C0/C1\n * characters from [CTRL]). Any plain text coming before the code will be\n * printed to the terminal, then the control character will be dispatched.\n */\nhterm.VT.prototype.parseUnknown_ = function(parseState) {\n var self = this;\n\n function print(str) {\n if (!self.codingSystemUtf8_ && self[self.GL].GL)\n str = self[self.GL].GL(str);\n\n self.terminal.print(str);\n };\n\n // Search for the next contiguous block of plain text.\n var buf = parseState.peekRemainingBuf();\n var nextControl = buf.search(this.cc1Pattern_);\n\n if (nextControl == 0) {\n // We've stumbled right into a control character.\n this.dispatch('CC1', buf.substr(0, 1), parseState);\n parseState.advance(1);\n return;\n }\n\n if (nextControl == -1) {\n // There are no control characters in this string.\n print(buf);\n parseState.reset();\n return;\n }\n\n print(buf.substr(0, nextControl));\n this.dispatch('CC1', buf.substr(nextControl, 1), parseState);\n parseState.advance(nextControl + 1);\n};\n\n/**\n * Parse a Control Sequence Introducer code and dispatch it.\n *\n * See [CSI] for some useful information about these codes.\n */\nhterm.VT.prototype.parseCSI_ = function(parseState) {\n var ch = parseState.peekChar();\n var args = parseState.args;\n\n if (ch >= '@' && ch <= '~') {\n // This is the final character.\n this.dispatch('CSI', this.leadingModifier_ + this.trailingModifier_ + ch,\n parseState);\n parseState.resetParseFunction();\n\n } else if (ch == ';') {\n // Parameter delimiter.\n if (this.trailingModifier_) {\n // Parameter delimiter after the trailing modifier. That's a paddlin'.\n parseState.resetParseFunction();\n\n } else {\n if (!args.length) {\n // They omitted the first param, we need to supply it.\n args.push('');\n }\n\n args.push('');\n }\n\n } else if (ch >= '0' && ch <= '9') {\n // Next byte in the current parameter.\n\n if (this.trailingModifier_) {\n // Numeric parameter after the trailing modifier. That's a paddlin'.\n parseState.resetParseFunction();\n } else {\n if (!args.length) {\n args[0] = ch;\n } else {\n args[args.length - 1] += ch;\n }\n }\n\n } else if (ch >= ' ' && ch <= '?' && ch != ':') {\n // Modifier character.\n if (!args.length) {\n this.leadingModifier_ += ch;\n } else {\n this.trailingModifier_ += ch;\n }\n\n } else if (this.cc1Pattern_.test(ch)) {\n // Control character.\n this.dispatch('CC1', ch, parseState);\n\n } else {\n // Unexpected character in sequence, bail out.\n parseState.resetParseFunction();\n }\n\n parseState.advance(1);\n};\n\n/**\n * Skip over the string until the next String Terminator (ST, 'ESC \\') or\n * Bell (BEL, '\\x07').\n *\n * The string is accumulated in parseState.args[0]. Make sure to reset the\n * arguments (with parseState.resetArguments) before starting the parse.\n *\n * You can detect that parsing in complete by checking that the parse\n * function has changed back to the default parse function.\n *\n * If we encounter more than maxStringSequence characters, we send back\n * the unterminated sequence to be re-parsed with the default parser function.\n *\n * @return {boolean} If true, parsing is ongoing or complete. If false, we've\n * exceeded the max string sequence.\n */\nhterm.VT.prototype.parseUntilStringTerminator_ = function(parseState) {\n var buf = parseState.peekRemainingBuf();\n var nextTerminator = buf.search(/(\\x1b\\\\|\\x07)/);\n var args = parseState.args;\n\n if (!args.length) {\n args[0] = '';\n args[1] = new Date();\n }\n\n if (nextTerminator == -1) {\n // No terminator here, have to wait for the next string.\n\n args[0] += buf;\n\n var abortReason;\n\n if (args[0].length > this.maxStringSequence)\n abortReason = 'too long: ' + args[0].length;\n\n if (args[0].indexOf('\\x1b') != -1)\n abortReason = 'embedded escape: ' + args[0].indexOf('\\x1b');\n\n if (new Date() - args[1] > this.oscTimeLimit_)\n abortReason = 'timeout expired: ' + new Date() - args[1];\n\n if (abortReason) {\n console.log('parseUntilStringTerminator_: aborting: ' + abortReason,\n args[0]);\n parseState.reset(args[0]);\n return false;\n }\n\n parseState.advance(buf.length);\n return true;\n }\n\n if (args[0].length + nextTerminator > this.maxStringSequence) {\n // We found the end of the sequence, but we still think it's too long.\n parseState.reset(args[0] + buf);\n return false;\n }\n\n args[0] += buf.substr(0, nextTerminator);\n\n parseState.resetParseFunction();\n parseState.advance(nextTerminator +\n (buf.substr(nextTerminator, 1) == '\\x1b' ? 2 : 1));\n\n return true;\n};\n\n/**\n * Dispatch to the function that handles a given CC1, ESC, or CSI or VT52 code.\n */\nhterm.VT.prototype.dispatch = function(type, code, parseState) {\n var handler = hterm.VT[type][code];\n if (!handler) {\n if (this.warnUnimplemented)\n console.warn('Unknown ' + type + ' code: ' + JSON.stringify(code));\n return;\n }\n\n if (handler == hterm.VT.ignore) {\n if (this.warnUnimplemented)\n console.warn('Ignored ' + type + ' code: ' + JSON.stringify(code));\n return;\n }\n\n if (type == 'CC1' && code > '\\x7f' && !this.enable8BitControl) {\n // It's kind of a hack to put this here, but...\n //\n // If we're dispatching a 'CC1' code, and it's got the eighth bit set,\n // but we're not supposed to handle 8-bit codes? Just ignore it.\n //\n // This prevents an errant (DCS, '\\x90'), (OSC, '\\x9d'), (PM, '\\x9e') or\n // (APC, '\\x9f') from locking up the terminal waiting for its expected\n // (ST, '\\x9c') or (BEL, '\\x07').\n console.warn('Ignoring 8-bit control code: 0x' +\n code.charCodeAt(0).toString(16));\n return;\n }\n\n handler.apply(this, [parseState, code]);\n};\n\n/**\n * Set one of the ANSI defined terminal mode bits.\n *\n * Invoked in response to SM/RM.\n *\n * Unexpected and unimplemented values are silently ignored.\n */\nhterm.VT.prototype.setANSIMode = function(code, state) {\n if (code == 4) { // Insert Mode (IRM)\n this.terminal.setInsertMode(state);\n } else if (code == 20) { // Automatic Newline (LNM)\n this.terminal.setAutoCarriageReturn(state);\n } else if (this.warnUnimplemented) {\n console.warn('Unimplemented ANSI Mode: ' + code);\n }\n};\n\n/**\n * Set or reset one of the DEC Private modes.\n *\n * Invoked in response to DECSET/DECRST.\n */\nhterm.VT.prototype.setDECMode = function(code, state) {\n switch (parseInt(code, 10)) {\n case 1: // DECCKM\n this.terminal.keyboard.applicationCursor = state;\n break;\n\n case 3: // DECCOLM\n if (this.allowColumnWidthChanges_) {\n this.terminal.setWidth(state ? 132 : 80);\n\n this.terminal.clearHome();\n this.terminal.setVTScrollRegion(null, null);\n }\n break;\n\n case 5: // DECSCNM\n this.terminal.setReverseVideo(state);\n break;\n\n case 6: // DECOM\n this.terminal.setOriginMode(state);\n break;\n\n case 7: // DECAWM\n this.terminal.setWraparound(state);\n break;\n\n case 12: // Start blinking cursor\n if (this.enableDec12)\n this.terminal.setCursorBlink(state);\n break;\n\n case 25: // DECTCEM\n this.terminal.setCursorVisible(state);\n break;\n\n case 30: // Show scrollbar\n this.terminal.setScrollbarVisible(state);\n break;\n\n case 40: // Allow 80 - 132 (DECCOLM) Mode\n this.terminal.allowColumnWidthChanges_ = state;\n break;\n\n case 45: // Reverse-wraparound Mode\n this.terminal.setReverseWraparound(state);\n break;\n\n case 67: // Backarrow key sends backspace (DECBKM)\n this.terminal.keyboard.backspaceSendsBackspace = state;\n break;\n\n case 1000: // Report on mouse clicks only.\n this.mouseReport = (\n state ? this.MOUSE_REPORT_CLICK : this.MOUSE_REPORT_DISABLED);\n this.terminal.syncMouseStyle();\n break;\n\n case 1002: // Report on mouse clicks and drags\n this.mouseReport = (\n state ? this.MOUSE_REPORT_DRAG : this.MOUSE_REPORT_DISABLED);\n this.terminal.syncMouseStyle();\n break;\n\n case 1010: // Scroll to bottom on tty output\n this.terminal.scrollOnOutput = state;\n break;\n\n case 1011: // Scroll to bottom on key press\n this.terminal.scrollOnKeystroke = state;\n break;\n\n case 1036: // Send ESC when Meta modifies a key\n this.terminal.keyboard.metaSendsEscape = state;\n break;\n\n case 1039: // Send ESC when Alt modifies a key\n if (state) {\n if (!this.terminal.keyboard.previousAltSendsWhat_) {\n this.terminal.keyboard.previousAltSendsWhat_ =\n this.terminal.keyboard.altSendsWhat;\n this.terminal.keyboard.altSendsWhat = 'escape';\n }\n } else if (this.terminal.keyboard.previousAltSendsWhat_) {\n this.terminal.keyboard.altSendsWhat =\n this.terminal.keyboard.previousAltSendsWhat_;\n this.terminal.keyboard.previousAltSendsWhat_ = null;\n }\n break;\n\n case 47: // Use Alternate Screen Buffer\n case 1047:\n this.terminal.setAlternateMode(state);\n break;\n\n case 1048: // Save cursor as in DECSC.\n this.savedState_.save();\n\n case 1049: // 1047 + 1048 + clear.\n if (state) {\n this.savedState_.save();\n this.terminal.setAlternateMode(state);\n this.terminal.clear();\n } else {\n this.terminal.setAlternateMode(state);\n this.savedState_.restore();\n }\n\n break;\n\n case 2004: // Bracketed paste mode.\n this.terminal.setBracketedPaste(state);\n break;\n\n default:\n if (this.warnUnimplemented)\n console.warn('Unimplemented DEC Private Mode: ' + code);\n break;\n }\n};\n\n/**\n * Function shared by control characters and escape sequences that are\n * ignored.\n */\nhterm.VT.ignore = function() {};\n\n/**\n * Collection of control characters expressed in a single byte.\n *\n * This includes the characters from the C0 and C1 sets (see [CTRL]) that we\n * care about. Two byte versions of the C1 codes are defined in the\n * hterm.VT.ESC collection.\n *\n * The 'CC1' mnemonic here refers to the fact that these are one-byte Control\n * Codes. It's only used in this source file and not defined in any of the\n * referenced documents.\n */\nhterm.VT.CC1 = {};\n\n/**\n * Collection of two-byte and three-byte sequences starting with ESC.\n */\nhterm.VT.ESC = {};\n\n/**\n * Collection of CSI (Control Sequence Introducer) sequences.\n *\n * These sequences begin with 'ESC [', and may take zero or more arguments.\n */\nhterm.VT.CSI = {};\n\n/**\n * Collection of OSC (Operating System Control) sequences.\n *\n * These sequences begin with 'ESC ]', followed by a function number and a\n * string terminated by either ST or BEL.\n */\nhterm.VT.OSC = {};\n\n/**\n * Collection of VT52 sequences.\n *\n * When in VT52 mode, other sequences are disabled.\n */\nhterm.VT.VT52 = {};\n\n/**\n * Null (NUL).\n *\n * Silently ignored.\n */\nhterm.VT.CC1['\\x00'] = hterm.VT.ignore;\n\n/**\n * Enquiry (ENQ).\n *\n * Transmit answerback message.\n *\n * The default answerback message in xterm is an empty string, so we just\n * ignore this.\n */\nhterm.VT.CC1['\\x05'] = hterm.VT.ignore;\n\n/**\n * Ring Bell (BEL).\n */\nhterm.VT.CC1['\\x07'] = function() {\n this.terminal.ringBell();\n};\n\n/**\n * Backspace (BS).\n *\n * Move the cursor to the left one character position, unless it is at the\n * left margin, in which case no action occurs.\n */\nhterm.VT.CC1['\\x08'] = function() {\n this.terminal.cursorLeft(1);\n};\n\n/**\n * Horizontal Tab (HT).\n *\n * Move the cursor to the next tab stop, or to the right margin if no further\n * tab stops are present on the line.\n */\nhterm.VT.CC1['\\x09'] = function() {\n this.terminal.forwardTabStop();\n};\n\n/**\n * Line Feed (LF).\n *\n * This code causes a line feed or a new line operation. See Automatic\n * Newline (LNM).\n */\nhterm.VT.CC1['\\x0a'] = function() {\n this.terminal.formFeed();\n};\n\n/**\n * Vertical Tab (VT).\n *\n * Interpreted as LF.\n */\nhterm.VT.CC1['\\x0b'] = hterm.VT.CC1['\\x0a'];\n\n/**\n * Form Feed (FF).\n *\n * Interpreted as LF.\n */\nhterm.VT.CC1['\\x0c'] = hterm.VT.CC1['\\x0a'];\n\n/**\n * Carriage Return (CR).\n *\n * Move cursor to the left margin on the current line.\n */\nhterm.VT.CC1['\\x0d'] = function() {\n this.terminal.setCursorColumn(0);\n};\n\n/**\n * Shift Out (SO), aka Lock Shift 0 (LS1).\n *\n * Invoke G1 character set in GL.\n */\nhterm.VT.CC1['\\x0e'] = function() {\n this.GL = 'G1';\n};\n\n/**\n * Shift In (SI), aka Lock Shift 0 (LS0).\n *\n * Invoke G0 character set in GL.\n */\nhterm.VT.CC1['\\x0f'] = function() {\n this.GL = 'G0';\n};\n\n/**\n * Transmit On (XON).\n *\n * Not currently implemented.\n *\n * TODO(rginda): Implement?\n */\nhterm.VT.CC1['\\x11'] = hterm.VT.ignore;\n\n/**\n * Transmit Off (XOFF).\n *\n * Not currently implemented.\n *\n * TODO(rginda): Implement?\n */\nhterm.VT.CC1['\\x13'] = hterm.VT.ignore;\n\n/**\n * Cancel (CAN).\n *\n * If sent during a control sequence, the sequence is immediately terminated\n * and not executed.\n *\n * It also causes the error character to be displayed.\n */\nhterm.VT.CC1['\\x18'] = function(parseState) {\n // If we've shifted in the G1 character set, shift it back out to\n // the default character set.\n if (this.GL == 'G1') {\n this.GL = 'G0';\n }\n parseState.resetParseFunction();\n this.terminal.print('?');\n};\n\n/**\n * Substitute (SUB).\n *\n * Interpreted as CAN.\n */\nhterm.VT.CC1['\\x1a'] = hterm.VT.CC1['\\x18'];\n\n/**\n * Escape (ESC).\n */\nhterm.VT.CC1['\\x1b'] = function(parseState) {\n function parseESC(parseState) {\n var ch = parseState.consumeChar();\n\n if (ch == '\\x1b')\n return;\n\n this.dispatch('ESC', ch, parseState);\n\n if (parseState.func == parseESC)\n parseState.resetParseFunction();\n };\n\n parseState.func = parseESC;\n};\n\n/**\n * Delete (DEL).\n */\nhterm.VT.CC1['\\x7f'] = hterm.VT.ignore;\n\n// 8 bit control characters and their two byte equivalents, below...\n\n/**\n * Index (IND).\n *\n * Like newline, only keep the X position\n */\nhterm.VT.CC1['\\x84'] =\nhterm.VT.ESC['D'] = function() {\n this.terminal.lineFeed();\n};\n\n/**\n * Next Line (NEL).\n *\n * Like newline, but doesn't add lines.\n */\nhterm.VT.CC1['\\x85'] =\nhterm.VT.ESC['E'] = function() {\n this.terminal.setCursorColumn(0);\n this.terminal.cursorDown(1);\n};\n\n/**\n * Horizontal Tabulation Set (HTS).\n */\nhterm.VT.CC1['\\x88'] =\nhterm.VT.ESC['H'] = function() {\n this.terminal.setTabStop(this.terminal.getCursorColumn());\n};\n\n/**\n * Reverse Index (RI).\n *\n * Move up one line.\n */\nhterm.VT.CC1['\\x8d'] =\nhterm.VT.ESC['M'] = function() {\n this.terminal.reverseLineFeed();\n};\n\n/**\n * Single Shift 2 (SS2).\n *\n * Select of G2 Character Set for the next character only.\n *\n * Not currently implemented.\n */\nhterm.VT.CC1['\\x8e'] =\nhterm.VT.ESC['N'] = hterm.VT.ignore;\n\n/**\n * Single Shift 3 (SS3).\n *\n * Select of G3 Character Set for the next character only.\n *\n * Not currently implemented.\n */\nhterm.VT.CC1['\\x8f'] =\nhterm.VT.ESC['O'] = hterm.VT.ignore;\n\n/**\n * Device Control String (DCS).\n *\n * Indicate a DCS sequence. See Device-Control functions in [XTERM].\n * Not currently implemented.\n *\n * TODO(rginda): Consider implementing DECRQSS, the rest don't seem applicable.\n */\nhterm.VT.CC1['\\x90'] =\nhterm.VT.ESC['P'] = function(parseState) {\n parseState.resetArguments();\n parseState.func = this.parseUntilStringTerminator_;\n};\n\n/**\n * Start of Guarded Area (SPA).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x96'] =\nhterm.VT.ESC['V'] = hterm.VT.ignore;\n\n/**\n * End of Guarded Area (EPA).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x97'] =\nhterm.VT.ESC['W'] = hterm.VT.ignore;\n\n/**\n * Start of String (SOS).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x98'] =\nhterm.VT.ESC['X'] = hterm.VT.ignore;\n\n/**\n * Single Character Introducer (SCI, also DECID).\n *\n * Return Terminal ID. Obsolete form of 'ESC [ c' (DA).\n */\nhterm.VT.CC1['\\x9a'] =\nhterm.VT.ESC['Z'] = function() {\n this.terminal.io.sendString('\\x1b[?1;2c');\n};\n\n/**\n * Control Sequence Introducer (CSI).\n *\n * The lead into most escape sequences. See [CSI].\n */\nhterm.VT.CC1['\\x9b'] =\nhterm.VT.ESC['['] = function(parseState) {\n parseState.resetArguments();\n this.leadingModifier_ = '';\n this.trailingModifier_ = '';\n parseState.func = this.parseCSI_;\n};\n\n/**\n * String Terminator (ST).\n *\n * Used to terminate DCS/OSC/PM/APC commands which may take string arguments.\n *\n * We don't directly handle it here, as it's only used to terminate other\n * sequences. See the 'parseUntilStringTerminator_' method.\n */\nhterm.VT.CC1['\\x9c'] =\nhterm.VT.ESC['\\\\'] = hterm.VT.ignore;\n\n/**\n * Operating System Command (OSC).\n *\n * Commands relating to the operating system.\n */\nhterm.VT.CC1['\\x9d'] =\nhterm.VT.ESC[']'] = function(parseState) {\n parseState.resetArguments();\n\n function parseOSC(parseState) {\n if (!this.parseUntilStringTerminator_(parseState)) {\n // The string sequence was too long.\n return;\n }\n\n if (parseState.func == parseOSC) {\n // We're not done parsing the string yet.\n return;\n }\n\n // We're done.\n var ary = parseState.args[0].match(/^(\\d+);(.*)$/);\n if (ary) {\n parseState.args[0] = ary[2];\n this.dispatch('OSC', ary[1], parseState);\n } else {\n console.warn('Invalid OSC: ' + JSON.stringify(parseState.args[0]));\n }\n };\n\n parseState.func = parseOSC;\n};\n\n/**\n * Privacy Message (PM).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x9e'] =\nhterm.VT.ESC['^'] = function(parseState) {\n parseState.resetArguments();\n parseState.func = this.parseUntilStringTerminator_;\n};\n\n/**\n * Application Program Control (APC).\n *\n * Will not implement.\n */\nhterm.VT.CC1['\\x9f'] =\nhterm.VT.ESC['_'] = function(parseState) {\n parseState.resetArguments();\n parseState.func = this.parseUntilStringTerminator_;\n};\n\n/**\n * ESC \\x20 - Unclear to me where these originated, possibly in xterm.\n *\n * Not currently implemented:\n * ESC \\x20 F - Select 7 bit escape codes in responses (S7C1T).\n * ESC \\x20 G - Select 8 bit escape codes in responses (S8C1T).\n * NB: We currently assume S7C1T always.\n *\n * Will not implement:\n * ESC \\x20 L - Set ANSI conformance level 1.\n * ESC \\x20 M - Set ANSI conformance level 2.\n * ESC \\x20 N - Set ANSI conformance level 3.\n */\nhterm.VT.ESC['\\x20'] = function(parseState) {\n parseState.func = function(parseState) {\n var ch = parseState.consumeChar();\n if (this.warnUnimplemented)\n console.warn('Unimplemented sequence: ESC 0x20 ' + ch);\n parseState.resetParseFunction();\n };\n};\n\n/**\n * DEC 'ESC #' sequences.\n */\nhterm.VT.ESC['#'] = function(parseState) {\n parseState.func = function(parseState) {\n var ch = parseState.consumeChar();\n if (ch == '8') // DEC Screen Alignment Test (DECALN)\n this.terminal.fill('E');\n\n parseState.resetParseFunction();\n };\n};\n\n/**\n * Designate Other Coding System (DOCS).\n */\nhterm.VT.ESC['%'] = function(parseState) {\n parseState.func = function(parseState) {\n var ch = parseState.consumeChar();\n\n // If we've locked the encoding, then just eat the bytes and return.\n if (this.codingSystemLocked_) {\n if (ch == '/')\n parseState.consumeChar();\n parseState.resetParseFunction();\n return;\n }\n\n // Process the encoding requests.\n switch (ch) {\n case '@':\n // Switch to ECMA 35.\n this.setEncoding('iso-2022');\n break;\n\n case 'G':\n // Switch to UTF-8.\n this.setEncoding('utf-8');\n break;\n\n case '/':\n // One way transition to something else.\n ch = parseState.consumeChar();\n switch (ch) {\n case 'G': // UTF-8 Level 1.\n case 'H': // UTF-8 Level 2.\n case 'I': // UTF-8 Level 3.\n // We treat all UTF-8 levels the same.\n this.setEncoding('utf-8-locked');\n break;\n\n default:\n if (this.warnUnimplemented)\n console.warn('Unknown ESC % / argument: ' + JSON.stringify(ch));\n break;\n }\n break;\n\n default:\n if (this.warnUnimplemented)\n console.warn('Unknown ESC % argument: ' + JSON.stringify(ch));\n break;\n }\n\n parseState.resetParseFunction();\n };\n};\n\n/**\n * Character Set Selection (SCS).\n *\n * ESC ( Ps - Set G0 character set (VT100).\n * ESC ) Ps - Set G1 character set (VT220).\n * ESC * Ps - Set G2 character set (VT220).\n * ESC + Ps - Set G3 character set (VT220).\n * ESC - Ps - Set G1 character set (VT300).\n * ESC . Ps - Set G2 character set (VT300).\n * ESC / Ps - Set G3 character set (VT300).\n *\n * All other sequences are echoed to the terminal.\n */\nhterm.VT.ESC['('] =\nhterm.VT.ESC[')'] =\nhterm.VT.ESC['*'] =\nhterm.VT.ESC['+'] =\nhterm.VT.ESC['-'] =\nhterm.VT.ESC['.'] =\nhterm.VT.ESC['/'] = function(parseState, code) {\n parseState.func = function(parseState) {\n var ch = parseState.consumeChar();\n if (ch == '\\x1b') {\n parseState.resetParseFunction();\n parseState.func();\n return;\n }\n\n var map = this.characterMaps.getMap(ch);\n if (map !== undefined) {\n if (code == '(') {\n this.G0 = map;\n } else if (code == ')' || code == '-') {\n this.G1 = map;\n } else if (code == '*' || code == '.') {\n this.G2 = map;\n } else if (code == '+' || code == '/') {\n this.G3 = map;\n }\n } else if (this.warnUnimplemented) {\n console.log('Invalid character set for \"' + code + '\": ' + ch);\n }\n\n parseState.resetParseFunction();\n };\n};\n\n/**\n * Back Index (DECBI).\n *\n * VT420 and up. Not currently implemented.\n */\nhterm.VT.ESC['6'] = hterm.VT.ignore;\n\n/**\n * Save Cursor (DECSC).\n */\nhterm.VT.ESC['7'] = function() {\n this.savedState_.save();\n};\n\n/**\n * Restore Cursor (DECRC).\n */\nhterm.VT.ESC['8'] = function() {\n this.savedState_.restore();\n};\n\n/**\n * Forward Index (DECFI).\n *\n * VT210 and up. Not currently implemented.\n */\nhterm.VT.ESC['9'] = hterm.VT.ignore;\n\n/**\n * Application keypad (DECKPAM).\n */\nhterm.VT.ESC['='] = function() {\n this.terminal.keyboard.applicationKeypad = true;\n};\n\n/**\n * Normal keypad (DECKPNM).\n */\nhterm.VT.ESC['>'] = function() {\n this.terminal.keyboard.applicationKeypad = false;\n};\n\n/**\n * Cursor to lower left corner of screen.\n *\n * Will not implement.\n *\n * This is only recognized by xterm when the hpLowerleftBugCompat resource is\n * set.\n */\nhterm.VT.ESC['F'] = hterm.VT.ignore;\n\n/**\n * Full Reset (RIS).\n */\nhterm.VT.ESC['c'] = function() {\n this.reset();\n this.terminal.reset();\n};\n\n/**\n * Memory lock/unlock.\n *\n * Will not implement.\n */\nhterm.VT.ESC['l'] =\nhterm.VT.ESC['m'] = hterm.VT.ignore;\n\n/**\n * Lock Shift 2 (LS2)\n *\n * Invoke the G2 Character Set as GL.\n */\nhterm.VT.ESC['n'] = function() {\n this.GL = 'G2';\n};\n\n/**\n * Lock Shift 3 (LS3)\n *\n * Invoke the G3 Character Set as GL.\n */\nhterm.VT.ESC['o'] = function() {\n this.GL = 'G3';\n};\n\n/**\n * Lock Shift 2, Right (LS3R)\n *\n * Invoke the G3 Character Set as GR.\n */\nhterm.VT.ESC['|'] = function() {\n this.GR = 'G3';\n};\n\n/**\n * Lock Shift 2, Right (LS2R)\n *\n * Invoke the G2 Character Set as GR.\n */\nhterm.VT.ESC['}'] = function() {\n this.GR = 'G2';\n};\n\n/**\n * Lock Shift 1, Right (LS1R)\n *\n * Invoke the G1 Character Set as GR.\n */\nhterm.VT.ESC['~'] = function() {\n this.GR = 'G1';\n};\n\n/**\n * Change icon name and window title.\n *\n * We only change the window title.\n */\nhterm.VT.OSC['0'] = function(parseState) {\n this.terminal.setWindowTitle(parseState.args[0]);\n};\n\n/**\n * Change window title.\n */\nhterm.VT.OSC['2'] = hterm.VT.OSC['0'];\n\n/**\n * Set/read color palette.\n */\nhterm.VT.OSC['4'] = function(parseState) {\n // Args come in as a single 'index1;rgb1 ... ;indexN;rgbN' string.\n // We split on the semicolon and iterate through the pairs.\n var args = parseState.args[0].split(';');\n\n var pairCount = parseInt(args.length / 2);\n var colorPalette = this.terminal.getTextAttributes().colorPalette;\n var responseArray = [];\n\n for (var pairNumber = 0; pairNumber < pairCount; ++pairNumber) {\n var colorIndex = parseInt(args[pairNumber * 2]);\n var colorValue = args[pairNumber * 2 + 1];\n\n if (colorIndex >= colorPalette.length)\n continue;\n\n if (colorValue == '?') {\n // '?' means we should report back the current color value.\n colorValue = lib.colors.rgbToX11(colorPalette[colorIndex]);\n if (colorValue)\n responseArray.push(colorIndex + ';' + colorValue);\n\n continue;\n }\n\n colorValue = lib.colors.x11ToCSS(colorValue);\n if (colorValue)\n colorPalette[colorIndex] = colorValue;\n }\n\n if (responseArray.length)\n this.terminal.io.sendString('\\x1b]4;' + responseArray.join(';') + '\\x07');\n};\n\n/**\n * iTerm2 growl notifications.\n */\nhterm.VT.OSC['9'] = function(parseState) {\n // This just dumps the entire string as the message.\n hterm.notify({'body': parseState.args[0]});\n};\n\n/**\n * Change VT100 text foreground color.\n */\nhterm.VT.OSC['10'] = function(parseState) {\n // Args come in as a single string, but extra args will chain to the following\n // OSC sequences.\n var args = parseState.args[0].split(';');\n if (!args)\n return;\n\n var colorArg;\n var colorX11 = lib.colors.x11ToCSS(args.shift());\n if (colorX11)\n this.terminal.setForegroundColor(colorX11);\n\n if (args.length > 0) {\n parseState.args[0] = args.join(';');\n hterm.VT.OSC['11'].apply(this, [parseState]);\n }\n};\n\n/**\n * Change VT100 text background color.\n */\nhterm.VT.OSC['11'] = function(parseState) {\n // Args come in as a single string, but extra args will chain to the following\n // OSC sequences.\n var args = parseState.args[0].split(';');\n if (!args)\n return;\n\n var colorArg;\n var colorX11 = lib.colors.x11ToCSS(args.shift());\n if (colorX11)\n this.terminal.setBackgroundColor(colorX11);\n\n /* Note: If we support OSC 12+, we'd chain it here.\n if (args.length > 0) {\n parseState.args[0] = args.join(';');\n hterm.VT.OSC['12'].apply(this, [parseState]);\n }\n */\n};\n\n/**\n * Set the cursor shape.\n *\n * Parameter is expected to be in the form \"CursorShape=number\", where number is\n * one of:\n *\n * 0 - Block\n * 1 - I-Beam\n * 2 - Underline\n *\n * This is a bit of a de-facto standard supported by iTerm 2 and Konsole. See\n * also: DECSCUSR.\n *\n * Invalid numbers will restore the cursor to the block shape.\n */\nhterm.VT.OSC['50'] = function(parseState) {\n var args = parseState.args[0].match(/CursorShape=(.)/i);\n if (!args) {\n console.warn('Could not parse OSC 50 args: ' + parseState.args[0]);\n return;\n }\n\n switch (args[1]) {\n case '1': // CursorShape=1: I-Beam.\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);\n break;\n\n case '2': // CursorShape=2: Underline.\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);\n break;\n\n default: // CursorShape=0: Block.\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK);\n }\n};\n\n/**\n * Set/read system clipboard.\n *\n * Read is not implemented due to security considerations. A remote app\n * that is able to both write and read to the clipboard could essentially\n * take over your session.\n *\n * The clipboard data will be decoded according to the 'receive-encoding'\n * preference.\n */\nhterm.VT.OSC['52'] = function(parseState) {\n // Args come in as a single 'clipboard;b64-data' string. The clipboard\n // parameter is used to select which of the X clipboards to address. Since\n // we're not integrating with X, we treat them all the same.\n var args = parseState.args[0].match(/^[cps01234567]*;(.*)/);\n if (!args)\n return;\n\n var data = window.atob(args[1]);\n if (data)\n this.terminal.copyStringToClipboard(this.decode(data));\n};\n\n/**\n * URxvt perl modules.\n *\n * This is the escape system used by rxvt-unicode and its perl modules.\n * Obviously we don't support perl or custom modules, so we list a few common\n * ones that we find useful.\n *\n * Technically there is no format here, but most modules obey:\n * ;\n */\nhterm.VT.OSC['777'] = function(parseState) {\n var ary;\n var urxvtMod = parseState.args[0].split(';', 1)[0];\n\n switch (urxvtMod) {\n case 'notify':\n // Format:\n // notify;title;message\n var title, message;\n ary = parseState.args[0].match(/^[^;]+;([^;]*)(;([\\s\\S]*))?$/);\n if (ary) {\n title = ary[1];\n message = ary[3];\n }\n hterm.notify({'title': title, 'body': message});\n break;\n\n default:\n console.warn('Unknown urxvt module: ' + parseState.args[0]);\n break;\n }\n};\n\n/**\n * Insert (blank) characters (ICH).\n */\nhterm.VT.CSI['@'] = function(parseState) {\n this.terminal.insertSpace(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Up (CUU).\n */\nhterm.VT.CSI['A'] = function(parseState) {\n this.terminal.cursorUp(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Down (CUD).\n */\nhterm.VT.CSI['B'] = function(parseState) {\n this.terminal.cursorDown(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Forward (CUF).\n */\nhterm.VT.CSI['C'] = function(parseState) {\n this.terminal.cursorRight(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Backward (CUB).\n */\nhterm.VT.CSI['D'] = function(parseState) {\n this.terminal.cursorLeft(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Next Line (CNL).\n *\n * This is like Cursor Down, except the cursor moves to the beginning of the\n * line as well.\n */\nhterm.VT.CSI['E'] = function(parseState) {\n this.terminal.cursorDown(parseState.iarg(0, 1));\n this.terminal.setCursorColumn(0);\n};\n\n/**\n * Cursor Preceding Line (CPL).\n *\n * This is like Cursor Up, except the cursor moves to the beginning of the\n * line as well.\n */\nhterm.VT.CSI['F'] = function(parseState) {\n this.terminal.cursorUp(parseState.iarg(0, 1));\n this.terminal.setCursorColumn(0);\n};\n\n/**\n * Cursor Character Absolute (CHA).\n */\nhterm.VT.CSI['G'] = function(parseState) {\n this.terminal.setCursorColumn(parseState.iarg(0, 1) - 1);\n};\n\n/**\n * Cursor Position (CUP).\n */\nhterm.VT.CSI['H'] = function(parseState) {\n this.terminal.setCursorPosition(parseState.iarg(0, 1) - 1,\n parseState.iarg(1, 1) - 1);\n};\n\n/**\n * Cursor Forward Tabulation (CHT).\n */\nhterm.VT.CSI['I'] = function(parseState) {\n var count = parseState.iarg(0, 1);\n count = lib.f.clamp(count, 1, this.terminal.screenSize.width);\n for (var i = 0; i < count; i++) {\n this.terminal.forwardTabStop();\n }\n};\n\n/**\n * Erase in Display (ED, DECSED).\n */\nhterm.VT.CSI['J'] =\nhterm.VT.CSI['?J'] = function(parseState, code) {\n var arg = parseState.args[0];\n\n if (!arg || arg == 0) {\n this.terminal.eraseBelow();\n } else if (arg == 1) {\n this.terminal.eraseAbove();\n } else if (arg == 2) {\n this.terminal.clear();\n } else if (arg == 3) {\n // The xterm docs say this means \"Erase saved lines\", but we'll just clear\n // the display since killing the scrollback seems rude.\n this.terminal.clear();\n }\n};\n\n/**\n * Erase in line (EL, DECSEL).\n */\nhterm.VT.CSI['K'] =\nhterm.VT.CSI['?K'] = function(parseState, code) {\n var arg = parseState.args[0];\n\n if (!arg || arg == 0) {\n this.terminal.eraseToRight();\n } else if (arg == 1) {\n this.terminal.eraseToLeft();\n } else if (arg == 2) {\n this.terminal.eraseLine();\n }\n};\n\n/**\n * Insert Lines (IL).\n */\nhterm.VT.CSI['L'] = function(parseState) {\n this.terminal.insertLines(parseState.iarg(0, 1));\n};\n\n/**\n * Delete Lines (DL).\n */\nhterm.VT.CSI['M'] = function(parseState) {\n this.terminal.deleteLines(parseState.iarg(0, 1));\n};\n\n/**\n * Delete Characters (DCH).\n *\n * This command shifts the line contents left, starting at the cursor position.\n */\nhterm.VT.CSI['P'] = function(parseState) {\n this.terminal.deleteChars(parseState.iarg(0, 1));\n};\n\n/**\n * Scroll Up (SU).\n */\nhterm.VT.CSI['S'] = function(parseState) {\n this.terminal.vtScrollUp(parseState.iarg(0, 1));\n};\n\n/**\n * Scroll Down (SD).\n * Also 'Initiate highlight mouse tracking'. Will not implement this part.\n */\nhterm.VT.CSI['T'] = function(parseState) {\n if (parseState.args.length <= 1)\n this.terminal.vtScrollDown(parseState.iarg(0, 1));\n};\n\n/**\n * Reset one or more features of the title modes to the default value.\n *\n * ESC [ > Ps T\n *\n * Normally, \"reset\" disables the feature. It is possible to disable the\n * ability to reset features by compiling a different default for the title\n * modes into xterm.\n *\n * Ps values:\n * 0 - Do not set window/icon labels using hexadecimal.\n * 1 - Do not query window/icon labels using hexadecimal.\n * 2 - Do not set window/icon labels using UTF-8.\n * 3 - Do not query window/icon labels using UTF-8.\n *\n * Will not implement.\n */\nhterm.VT.CSI['>T'] = hterm.VT.ignore;\n\n/**\n * Erase Characters (ECH).\n */\nhterm.VT.CSI['X'] = function(parseState) {\n this.terminal.eraseToRight(parseState.iarg(0, 1));\n};\n\n/**\n * Cursor Backward Tabulation (CBT).\n */\nhterm.VT.CSI['Z'] = function(parseState) {\n var count = parseState.iarg(0, 1);\n count = lib.f.clamp(count, 1, this.terminal.screenSize.width);\n for (var i = 0; i < count; i++) {\n this.terminal.backwardTabStop();\n }\n};\n\n/**\n * Character Position Absolute (HPA).\n *\n * Same as Cursor Character Absolute (CHA).\n */\nhterm.VT.CSI['`'] = hterm.VT.CSI['G'];\n\n/**\n * Character Position Relative (HPR).\n */\nhterm.VT.CSI['a'] = function(parseState) {\n this.terminal.setCursorColumn(this.terminal.getCursorColumn() +\n parseState.iarg(0, 1));\n};\n\n/**\n * Repeat the preceding graphic character.\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['b'] = hterm.VT.ignore;\n\n/**\n * Send Device Attributes (Primary DA).\n *\n * TODO(rginda): This is hardcoded to send back 'VT100 with Advanced Video\n * Option', but it may be more correct to send a VT220 response once\n * we fill out the 'Not currently implemented' parts.\n */\nhterm.VT.CSI['c'] = function(parseState) {\n if (!parseState.args[0] || parseState.args[0] == 0) {\n this.terminal.io.sendString('\\x1b[?1;2c');\n }\n};\n\n/**\n * Send Device Attributes (Secondary DA).\n *\n * TODO(rginda): This is hardcoded to send back 'VT100' but it may be more\n * correct to send a VT220 response once we fill out more 'Not currently\n * implemented' parts.\n */\nhterm.VT.CSI['>c'] = function(parseState) {\n this.terminal.io.sendString('\\x1b[>0;256;0c');\n};\n\n/**\n * Line Position Absolute (VPA).\n */\nhterm.VT.CSI['d'] = function(parseState) {\n this.terminal.setAbsoluteCursorRow(parseState.iarg(0, 1) - 1);\n};\n\n/**\n * Horizontal and Vertical Position (HVP).\n *\n * Same as Cursor Position (CUP).\n */\nhterm.VT.CSI['f'] = hterm.VT.CSI['H'];\n\n/**\n * Tab Clear (TBC).\n */\nhterm.VT.CSI['g'] = function(parseState) {\n if (!parseState.args[0] || parseState.args[0] == 0) {\n // Clear tab stop at cursor.\n this.terminal.clearTabStopAtCursor(false);\n } else if (parseState.args[0] == 3) {\n // Clear all tab stops.\n this.terminal.clearAllTabStops();\n }\n};\n\n/**\n * Set Mode (SM).\n */\nhterm.VT.CSI['h'] = function(parseState) {\n for (var i = 0; i < parseState.args.length; i++) {\n this.setANSIMode(parseState.args[i], true);\n }\n};\n\n/**\n * DEC Private Mode Set (DECSET).\n */\nhterm.VT.CSI['?h'] = function(parseState) {\n for (var i = 0; i < parseState.args.length; i++) {\n this.setDECMode(parseState.args[i], true);\n }\n};\n\n/**\n * Media Copy (MC).\n * Media Copy (MC, DEC Specific).\n *\n * These commands control the printer. Will not implement.\n */\nhterm.VT.CSI['i'] =\nhterm.VT.CSI['?i'] = hterm.VT.ignore;\n\n/**\n * Reset Mode (RM).\n */\nhterm.VT.CSI['l'] = function(parseState) {\n for (var i = 0; i < parseState.args.length; i++) {\n this.setANSIMode(parseState.args[i], false);\n }\n};\n\n/**\n * DEC Private Mode Reset (DECRST).\n */\nhterm.VT.CSI['?l'] = function(parseState) {\n for (var i = 0; i < parseState.args.length; i++) {\n this.setDECMode(parseState.args[i], false);\n }\n};\n\n/**\n * Character Attributes (SGR).\n *\n * Iterate through the list of arguments, applying the attribute changes based\n * on the argument value...\n */\nhterm.VT.CSI['m'] = function(parseState) {\n function get256(i) {\n if (parseState.args.length < i + 2 || parseState.args[i + 1] != 5)\n return null;\n\n return parseState.iarg(i + 2, 0);\n }\n\n function getTrueColor(i) {\n if (parseState.args.length < i + 5 || parseState.args[i + 1] != 2)\n return null;\n var r = parseState.iarg(i + 2, 0);\n var g = parseState.iarg(i + 3, 0);\n var b = parseState.iarg(i + 4, 0);\n\n return 'rgb(' + r + ' ,' + g + ' ,' + b + ')';\n }\n\n var attrs = this.terminal.getTextAttributes();\n\n if (!parseState.args.length) {\n attrs.reset();\n return;\n }\n\n for (var i = 0; i < parseState.args.length; i++) {\n var arg = parseState.iarg(i, 0);\n\n if (arg < 30) {\n if (arg == 0) { // Normal (default).\n attrs.reset();\n } else if (arg == 1) { // Bold.\n attrs.bold = true;\n } else if (arg == 2) { // Faint.\n attrs.faint = true;\n } else if (arg == 3) { // Italic.\n attrs.italic = true;\n } else if (arg == 4) { // Underline.\n attrs.underline = true;\n } else if (arg == 5) { // Blink.\n attrs.blink = true;\n } else if (arg == 7) { // Inverse.\n attrs.inverse = true;\n } else if (arg == 8) { // Invisible.\n attrs.invisible = true;\n } else if (arg == 9) { // Crossed out.\n attrs.strikethrough = true;\n } else if (arg == 22) { // Not bold & not faint.\n attrs.bold = false;\n attrs.faint = false;\n } else if (arg == 23) { // Not italic.\n attrs.italic = false;\n } else if (arg == 24) { // Not underlined.\n attrs.underline = false;\n } else if (arg == 25) { // Not blink.\n attrs.blink = false;\n } else if (arg == 27) { // Steady.\n attrs.inverse = false;\n } else if (arg == 28) { // Visible.\n attrs.invisible = false;\n } else if (arg == 29) { // Not crossed out.\n attrs.strikethrough = false;\n }\n\n } else if (arg < 50) {\n // Select fore/background color from bottom half of 16 color palette\n // or from the 256 color palette or alternative specify color in fully\n // qualified rgb(r, g, b) form.\n if (arg < 38) {\n attrs.foregroundSource = arg - 30;\n\n } else if (arg == 38) {\n // First check for true color definition\n var trueColor = getTrueColor(i);\n if (trueColor != null) {\n attrs.foregroundSource = attrs.SRC_RGB;\n attrs.foreground = trueColor;\n\n i += 5;\n } else {\n // Check for 256 color\n var c = get256(i);\n if (c == null)\n break;\n\n i += 2;\n\n if (c >= attrs.colorPalette.length)\n continue;\n\n attrs.foregroundSource = c;\n }\n\n } else if (arg == 39) {\n attrs.foregroundSource = attrs.SRC_DEFAULT;\n\n } else if (arg < 48) {\n attrs.backgroundSource = arg - 40;\n\n } else if (arg == 48) {\n // First check for true color definition\n var trueColor = getTrueColor(i);\n if (trueColor != null) {\n attrs.backgroundSource = attrs.SRC_RGB;\n attrs.background = trueColor;\n\n i += 5;\n } else {\n // Check for 256 color\n var c = get256(i);\n if (c == null)\n break;\n\n i += 2;\n\n if (c >= attrs.colorPalette.length)\n continue;\n\n attrs.backgroundSource = c;\n }\n } else {\n attrs.backgroundSource = attrs.SRC_DEFAULT;\n }\n\n } else if (arg >= 90 && arg <= 97) {\n attrs.foregroundSource = arg - 90 + 8;\n\n } else if (arg >= 100 && arg <= 107) {\n attrs.backgroundSource = arg - 100 + 8;\n }\n }\n\n attrs.setDefaults(this.terminal.getForegroundColor(),\n this.terminal.getBackgroundColor());\n};\n\n/**\n * Set xterm-specific keyboard modes.\n *\n * Will not implement.\n */\nhterm.VT.CSI['>m'] = hterm.VT.ignore;\n\n/**\n * Device Status Report (DSR, DEC Specific).\n *\n * 5 - Status Report. Result (OK) is CSI 0 n\n * 6 - Report Cursor Position (CPR) [row;column]. Result is CSI r ; c R\n */\nhterm.VT.CSI['n'] = function(parseState) {\n if (parseState.args[0] == 5) {\n this.terminal.io.sendString('\\x1b0n');\n } else if (parseState.args[0] == 6) {\n var row = this.terminal.getCursorRow() + 1;\n var col = this.terminal.getCursorColumn() + 1;\n this.terminal.io.sendString('\\x1b[' + row + ';' + col + 'R');\n }\n};\n\n/**\n * Disable modifiers which may be enabled via CSI['>m'].\n *\n * Will not implement.\n */\nhterm.VT.CSI['>n'] = hterm.VT.ignore;\n\n/**\n * Device Status Report (DSR, DEC Specific).\n *\n * 6 - Report Cursor Position (CPR) [row;column] as CSI ? r ; c R\n * 15 - Report Printer status as CSI ? 1 0 n (ready) or\n * CSI ? 1 1 n (not ready).\n * 25 - Report UDK status as CSI ? 2 0 n (unlocked) or CSI ? 2 1 n (locked).\n * 26 - Report Keyboard status as CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).\n * The last two parameters apply to VT400 & up, and denote keyboard ready\n * and LK01 respectively.\n * 53 - Report Locator status as CSI ? 5 3 n Locator available, if compiled-in,\n * or CSI ? 5 0 n No Locator, if not.\n */\nhterm.VT.CSI['?n'] = function(parseState) {\n if (parseState.args[0] == 6) {\n var row = this.terminal.getCursorRow() + 1;\n var col = this.terminal.getCursorColumn() + 1;\n this.terminal.io.sendString('\\x1b[' + row + ';' + col + 'R');\n } else if (parseState.args[0] == 15) {\n this.terminal.io.sendString('\\x1b[?11n');\n } else if (parseState.args[0] == 25) {\n this.terminal.io.sendString('\\x1b[?21n');\n } else if (parseState.args[0] == 26) {\n this.terminal.io.sendString('\\x1b[?12;1;0;0n');\n } else if (parseState.args[0] == 53) {\n this.terminal.io.sendString('\\x1b[?50n');\n }\n};\n\n/**\n * This is used by xterm to decide whether to hide the pointer cursor as the\n * user types.\n *\n * Valid values for the parameter:\n * 0 - Never hide the pointer.\n * 1 - Hide if the mouse tracking mode is not enabled.\n * 2 - Always hide the pointer.\n *\n * If no parameter is given, xterm uses the default, which is 1.\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['>p'] = hterm.VT.ignore;\n\n/**\n * Soft terminal reset (DECSTR).\n */\nhterm.VT.CSI['!p'] = function() {\n this.reset();\n this.terminal.softReset();\n};\n\n/**\n * Request ANSI Mode (DECRQM).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['$p'] = hterm.VT.ignore;\nhterm.VT.CSI['?$p'] = hterm.VT.ignore;\n\n/**\n * Set conformance level (DECSCL).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['\"p'] = hterm.VT.ignore;\n\n/**\n * Load LEDs (DECLL).\n *\n * Not currently implemented. Could be implemented as virtual LEDs overlaying\n * the terminal if anyone cares.\n */\nhterm.VT.CSI['q'] = hterm.VT.ignore;\n\n/**\n * Set cursor style (DECSCUSR, VT520).\n */\nhterm.VT.CSI[' q'] = function(parseState) {\n var arg = parseState.args[0];\n\n if (arg == 0 || arg == 1) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK);\n this.terminal.setCursorBlink(true);\n } else if (arg == 2) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK);\n this.terminal.setCursorBlink(false);\n } else if (arg == 3) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);\n this.terminal.setCursorBlink(true);\n } else if (arg == 4) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);\n this.terminal.setCursorBlink(false);\n } else if (arg == 5) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);\n this.terminal.setCursorBlink(true);\n } else if (arg == 6) {\n this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);\n this.terminal.setCursorBlink(false);\n } else {\n console.warn('Unknown cursor style: ' + arg);\n }\n};\n\n/**\n * Select character protection attribute (DECSCA).\n *\n * Will not implement.\n */\nhterm.VT.CSI['\"q'] = hterm.VT.ignore;\n\n/**\n * Set Scrolling Region (DECSTBM).\n */\nhterm.VT.CSI['r'] = function(parseState) {\n var args = parseState.args;\n var scrollTop = args[0] ? parseInt(args[0], 10) -1 : null;\n var scrollBottom = args[1] ? parseInt(args[1], 10) - 1 : null;\n this.terminal.setVTScrollRegion(scrollTop, scrollBottom);\n this.terminal.setCursorPosition(0, 0);\n};\n\n/**\n * Restore DEC Private Mode Values.\n *\n * Will not implement.\n */\nhterm.VT.CSI['?r'] = hterm.VT.ignore;\n\n/**\n * Change Attributes in Rectangular Area (DECCARA)\n *\n * Will not implement.\n */\nhterm.VT.CSI['$r'] = hterm.VT.ignore;\n\n/**\n * Save cursor (ANSI.SYS)\n */\nhterm.VT.CSI['s'] = function() {\n this.savedState_.save();\n};\n\n/**\n * Save DEC Private Mode Values.\n *\n * Will not implement.\n */\nhterm.VT.CSI['?s'] = hterm.VT.ignore;\n\n/**\n * Window manipulation (from dtterm, as well as extensions).\n *\n * Will not implement.\n */\nhterm.VT.CSI['t'] = hterm.VT.ignore;\n\n/**\n * Reverse Attributes in Rectangular Area (DECRARA).\n *\n * Will not implement.\n */\nhterm.VT.CSI['$t'] = hterm.VT.ignore;\n\n/**\n * Set one or more features of the title modes.\n *\n * Will not implement.\n */\nhterm.VT.CSI['>t'] = hterm.VT.ignore;\n\n/**\n * Set warning-bell volume (DECSWBV, VT520).\n *\n * Will not implement.\n */\nhterm.VT.CSI[' t'] = hterm.VT.ignore;\n\n/**\n * Restore cursor (ANSI.SYS).\n */\nhterm.VT.CSI['u'] = function() {\n this.savedState_.restore();\n};\n\n/**\n * Set margin-bell volume (DECSMBV, VT520).\n *\n * Will not implement.\n */\nhterm.VT.CSI[' u'] = hterm.VT.ignore;\n\n/**\n * Copy Rectangular Area (DECCRA, VT400 and up).\n *\n * Will not implement.\n */\nhterm.VT.CSI['$v'] = hterm.VT.ignore;\n\n/**\n * Enable Filter Rectangle (DECEFR).\n *\n * Will not implement.\n */\nhterm.VT.CSI['\\'w'] = hterm.VT.ignore;\n\n/**\n * Request Terminal Parameters (DECREQTPARM).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['x'] = hterm.VT.ignore;\n\n/**\n * Select Attribute Change Extent (DECSACE).\n *\n * Will not implement.\n */\nhterm.VT.CSI['*x'] = hterm.VT.ignore;\n\n/**\n * Fill Rectangular Area (DECFRA), VT420 and up.\n *\n * Will not implement.\n */\nhterm.VT.CSI['$x'] = hterm.VT.ignore;\n\n/**\n * vt_tiledata (as used by NAOhack and UnNetHack)\n * (see https://nethackwiki.com/wiki/Vt_tiledata for more info)\n *\n * Implemented as far as we care (start a glyph and end a glyph).\n */\nhterm.VT.CSI['z'] = function(parseState) {\n if (parseState.args.length < 1)\n return;\n var arg = parseState.args[0];\n if (arg == 0) {\n // Start a glyph (one parameter, the glyph number).\n if (parseState.args.length < 2)\n return;\n this.terminal.getTextAttributes().tileData = parseState.args[1];\n } else if (arg == 1) {\n // End a glyph.\n this.terminal.getTextAttributes().tileData = null;\n }\n};\n\n/**\n * Enable Locator Reporting (DECELR).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['\\'z'] = hterm.VT.ignore;\n\n/**\n * Erase Rectangular Area (DECERA), VT400 and up.\n *\n * Will not implement.\n */\nhterm.VT.CSI['$z'] = hterm.VT.ignore;\n\n/**\n * Select Locator Events (DECSLE).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['\\'{'] = hterm.VT.ignore;\n\n/**\n * Request Locator Position (DECRQLP).\n *\n * Not currently implemented.\n */\nhterm.VT.CSI['\\'|'] = hterm.VT.ignore;\n\n/**\n * Insert Columns (DECIC), VT420 and up.\n *\n * Will not implement.\n */\nhterm.VT.CSI['\\'}'] = hterm.VT.ignore;\n\n/**\n * Delete P s Columns (DECDC), VT420 and up.\n *\n * Will not implement.\n */\nhterm.VT.CSI['\\'~'] = hterm.VT.ignore;\n// SOURCE FILE: hterm/js/hterm_vt_character_map.js\n// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n'use strict';\n\nlib.rtdep('lib.f');\n\n/**\n * Character map object.\n *\n * Mapping from received to display character, used depending on the active\n * VT character set.\n *\n * GR maps are not currently supported.\n *\n * @param {string} description A human readable description of this map.\n * @param {Object} glmap The GL mapping from input to output characters.\n */\nhterm.VT.CharacterMap = function(description, glmap) {\n /**\n * Short description for this character set, useful for debugging.\n */\n this.description = description;\n\n /**\n * The function to call to when this map is installed in GL.\n */\n this.GL = null;\n\n // Always keep an unmodified reference to the map.\n // This allows us to sanely reset back to the original state.\n this.glmapBase_ = glmap;\n\n // Now sync the internal state as needed.\n this.sync_();\n};\n\n/**\n * Internal helper for resyncing internal state.\n *\n * Used when the mappings change.\n *\n * @param {Object?} opt_glmap Additional mappings to overlay on top of the\n * base mapping.\n */\nhterm.VT.CharacterMap.prototype.sync_ = function(opt_glmap) {\n // If there are no maps, then reset the state back.\n if (!this.glmapBase_ && !opt_glmap) {\n this.GL = null;\n delete this.glmap_;\n delete this.glre_;\n return;\n }\n\n // Set the the GL mapping. If we're given a custom mapping, then create a\n // new object to hold the merged map. This way we can cleanly reset back.\n if (opt_glmap)\n this.glmap_ = Object.assign({}, this.glmapBase_, opt_glmap);\n else\n this.glmap_ = this.glmapBase_;\n\n var glchars = Object.keys(this.glmap_).map((key) =>\n '\\\\x' + lib.f.zpad(key.charCodeAt(0).toString(16)));\n this.glre_ = new RegExp('[' + glchars.join('') + ']', 'g');\n\n this.GL = (str) => str.replace(this.glre_, (ch) => this.glmap_[ch]);\n};\n\n/**\n * Reset map back to original mappings (discarding runtime updates).\n *\n * Specifically, any calls to setOverrides will be discarded.\n */\nhterm.VT.CharacterMap.prototype.reset = function() {\n // If we haven't been given a custom mapping, then there's nothing to reset.\n if (this.glmap_ !== this.glmapBase_)\n this.sync_();\n};\n\n/**\n * Merge custom changes to this map.\n *\n * The input map need not duplicate the existing mappings as it is merged with\n * the existing base map (what was created with). Subsequent calls to this\n * will throw away previous override settings.\n *\n * @param {Object} glmap The custom map to override existing mappings.\n */\nhterm.VT.CharacterMap.prototype.setOverrides = function(glmap) {\n this.sync_(glmap);\n};\n\n/**\n * Return a copy of this mapping.\n *\n * @return {hterm.VT.CharacterMap} A new hterm.VT.CharacterMap instance.\n */\nhterm.VT.CharacterMap.prototype.clone = function() {\n var map = new hterm.VT.CharacterMap(this.description, this.glmapBase_);\n if (this.glmap_ !== this.glmapBase_)\n map.setOverrides(this.glmap_);\n return map;\n};\n\n/**\n * Table of character maps.\n */\nhterm.VT.CharacterMaps = function() {\n this.maps_ = hterm.VT.CharacterMaps.DefaultMaps;\n\n // Always keep an unmodified reference to the map.\n // This allows us to sanely reset back to the original state.\n this.mapsBase_ = this.maps_;\n};\n\n/**\n * Look up a previously registered map.\n *\n * @param {String} name The name of the map to lookup.\n * @return {hterm.VT.CharacterMap} The map, if it's been registered.\n */\nhterm.VT.CharacterMaps.prototype.getMap = function(name) {\n if (this.maps_.hasOwnProperty(name))\n return this.maps_[name];\n else\n return undefined;\n};\n\n/**\n * Register a new map.\n *\n * Any previously registered maps by this name will be discarded.\n *\n * @param {String} name The name of the map.\n * @param {hterm.VT.CharacterMap} map The map to register.\n */\nhterm.VT.CharacterMaps.prototype.addMap = function(name, map) {\n if (this.maps_ === this.mapsBase_)\n this.maps_ = Object.assign({}, this.mapsBase_);\n this.maps_[name] = map;\n};\n\n/**\n * Reset the table and all its maps back to original state.\n */\nhterm.VT.CharacterMaps.prototype.reset = function() {\n if (this.maps_ !== hterm.VT.CharacterMaps.DefaultMaps)\n this.maps_ = hterm.VT.CharacterMaps.DefaultMaps;\n};\n\n/**\n * Merge custom changes to this table.\n *\n * @param {Object} maps A set of hterm.VT.CharacterMap objects.\n */\nhterm.VT.CharacterMaps.prototype.setOverrides = function(maps) {\n if (this.maps_ === this.mapsBase_)\n this.maps_ = Object.assign({}, this.mapsBase_);\n\n for (var name in maps) {\n var map = this.getMap(name);\n if (map !== undefined) {\n this.maps_[name] = map.clone();\n this.maps_[name].setOverrides(maps[name]);\n } else\n this.addMap(name, new hterm.VT.CharacterMap('user ' + name, maps[name]));\n }\n};\n\n/**\n * The default set of supported character maps.\n */\nhterm.VT.CharacterMaps.DefaultMaps = {};\n\n/**\n * VT100 Graphic character map.\n * http://vt100.net/docs/vt220-rm/table2-4.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['0'] = new hterm.VT.CharacterMap(\n 'graphic', {\n '\\x60':'\\u25c6', // ` -> diamond\n '\\x61':'\\u2592', // a -> grey-box\n '\\x62':'\\u2409', // b -> h/t\n '\\x63':'\\u240c', // c -> f/f\n '\\x64':'\\u240d', // d -> c/r\n '\\x65':'\\u240a', // e -> l/f\n '\\x66':'\\u00b0', // f -> degree\n '\\x67':'\\u00b1', // g -> +/-\n '\\x68':'\\u2424', // h -> n/l\n '\\x69':'\\u240b', // i -> v/t\n '\\x6a':'\\u2518', // j -> bottom-right\n '\\x6b':'\\u2510', // k -> top-right\n '\\x6c':'\\u250c', // l -> top-left\n '\\x6d':'\\u2514', // m -> bottom-left\n '\\x6e':'\\u253c', // n -> line-cross\n '\\x6f':'\\u23ba', // o -> scan1\n '\\x70':'\\u23bb', // p -> scan3\n '\\x71':'\\u2500', // q -> scan5\n '\\x72':'\\u23bc', // r -> scan7\n '\\x73':'\\u23bd', // s -> scan9\n '\\x74':'\\u251c', // t -> left-tee\n '\\x75':'\\u2524', // u -> right-tee\n '\\x76':'\\u2534', // v -> bottom-tee\n '\\x77':'\\u252c', // w -> top-tee\n '\\x78':'\\u2502', // x -> vertical-line\n '\\x79':'\\u2264', // y -> less-equal\n '\\x7a':'\\u2265', // z -> greater-equal\n '\\x7b':'\\u03c0', // { -> pi\n '\\x7c':'\\u2260', // | -> not-equal\n '\\x7d':'\\u00a3', // } -> british-pound\n '\\x7e':'\\u00b7', // ~ -> dot\n });\n\n/**\n * British character map.\n * http://vt100.net/docs/vt220-rm/table2-5.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['A'] = new hterm.VT.CharacterMap(\n 'british', {\n '\\x23': '\\u00a3', // # -> british-pound\n });\n\n/**\n * US ASCII map, no changes.\n */\nhterm.VT.CharacterMaps.DefaultMaps['B'] = new hterm.VT.CharacterMap(\n 'us', null);\n\n/**\n * Dutch character map.\n * http://vt100.net/docs/vt220-rm/table2-6.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['4'] = new hterm.VT.CharacterMap(\n 'dutch', {\n '\\x23': '\\u00a3', // # -> british-pound\n\n '\\x40': '\\u00be', // @ -> 3/4\n\n '\\x5b': '\\u0132', // [ -> 'ij' ligature (xterm goes with \\u00ff?)\n '\\x5c': '\\u00bd', // \\ -> 1/2\n '\\x5d': '\\u007c', // ] -> vertical bar\n\n '\\x7b': '\\u00a8', // { -> two dots\n '\\x7c': '\\u0066', // | -> f\n '\\x7d': '\\u00bc', // } -> 1/4\n '\\x7e': '\\u00b4', // ~ -> acute\n });\n\n/**\n * Finnish character map.\n * http://vt100.net/docs/vt220-rm/table2-7.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['C'] =\nhterm.VT.CharacterMaps.DefaultMaps['5'] = new hterm.VT.CharacterMap(\n 'finnish', {\n '\\x5b': '\\u00c4', // [ -> 'A' umlaut\n '\\x5c': '\\u00d6', // \\ -> 'O' umlaut\n '\\x5d': '\\u00c5', // ] -> 'A' ring\n '\\x5e': '\\u00dc', // ~ -> 'u' umlaut\n\n '\\x60': '\\u00e9', // ` -> 'e' acute\n\n '\\x7b': '\\u00e4', // { -> 'a' umlaut\n '\\x7c': '\\u00f6', // | -> 'o' umlaut\n '\\x7d': '\\u00e5', // } -> 'a' ring\n '\\x7e': '\\u00fc', // ~ -> 'u' umlaut\n });\n\n/**\n * French character map.\n * http://vt100.net/docs/vt220-rm/table2-8.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['R'] = new hterm.VT.CharacterMap(\n 'french', {\n '\\x23': '\\u00a3', // # -> british-pound\n\n '\\x40': '\\u00e0', // @ -> 'a' grave\n\n '\\x5b': '\\u00b0', // [ -> ring\n '\\x5c': '\\u00e7', // \\ -> 'c' cedilla\n '\\x5d': '\\u00a7', // ] -> section symbol (double s)\n\n '\\x7b': '\\u00e9', // { -> 'e' acute\n '\\x7c': '\\u00f9', // | -> 'u' grave\n '\\x7d': '\\u00e8', // } -> 'e' grave\n '\\x7e': '\\u00a8', // ~ -> umlaut\n });\n\n/**\n * French Canadian character map.\n * http://vt100.net/docs/vt220-rm/table2-9.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['Q'] = new hterm.VT.CharacterMap(\n 'french canadian', {\n '\\x40': '\\u00e0', // @ -> 'a' grave\n\n '\\x5b': '\\u00e2', // [ -> 'a' circumflex\n '\\x5c': '\\u00e7', // \\ -> 'c' cedilla\n '\\x5d': '\\u00ea', // ] -> 'e' circumflex\n '\\x5e': '\\u00ee', // ^ -> 'i' circumflex\n\n '\\x60': '\\u00f4', // ` -> 'o' circumflex\n\n '\\x7b': '\\u00e9', // { -> 'e' acute\n '\\x7c': '\\u00f9', // | -> 'u' grave\n '\\x7d': '\\u00e8', // } -> 'e' grave\n '\\x7e': '\\u00fb', // ~ -> 'u' circumflex\n });\n\n/**\n * German character map.\n * http://vt100.net/docs/vt220-rm/table2-10.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['K'] = new hterm.VT.CharacterMap(\n 'german', {\n '\\x40': '\\u00a7', // @ -> section symbol (double s)\n\n '\\x5b': '\\u00c4', // [ -> 'A' umlaut\n '\\x5c': '\\u00d6', // \\ -> 'O' umlaut\n '\\x5d': '\\u00dc', // ] -> 'U' umlaut\n\n '\\x7b': '\\u00e4', // { -> 'a' umlaut\n '\\x7c': '\\u00f6', // | -> 'o' umlaut\n '\\x7d': '\\u00fc', // } -> 'u' umlaut\n '\\x7e': '\\u00df', // ~ -> eszett\n });\n\n/**\n * Italian character map.\n * http://vt100.net/docs/vt220-rm/table2-11.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['Y'] = new hterm.VT.CharacterMap(\n 'italian', {\n '\\x23': '\\u00a3', // # -> british-pound\n\n '\\x40': '\\u00a7', // @ -> section symbol (double s)\n\n '\\x5b': '\\u00b0', // [ -> ring\n '\\x5c': '\\u00e7', // \\ -> 'c' cedilla\n '\\x5d': '\\u00e9', // ] -> 'e' acute\n\n '\\x60': '\\u00f9', // ` -> 'u' grave\n\n '\\x7b': '\\u00e0', // { -> 'a' grave\n '\\x7c': '\\u00f2', // | -> 'o' grave\n '\\x7d': '\\u00e8', // } -> 'e' grave\n '\\x7e': '\\u00ec', // ~ -> 'i' grave\n });\n\n/**\n * Norwegian/Danish character map.\n * http://vt100.net/docs/vt220-rm/table2-12.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['E'] =\nhterm.VT.CharacterMaps.DefaultMaps['6'] = new hterm.VT.CharacterMap(\n 'norwegian/danish', {\n '\\x40': '\\u00c4', // @ -> 'A' umlaut\n\n '\\x5b': '\\u00c6', // [ -> 'AE' ligature\n '\\x5c': '\\u00d8', // \\ -> 'O' stroke\n '\\x5d': '\\u00c5', // ] -> 'A' ring\n '\\x5e': '\\u00dc', // ^ -> 'U' umlaut\n\n '\\x60': '\\u00e4', // ` -> 'a' umlaut\n\n '\\x7b': '\\u00e6', // { -> 'ae' ligature\n '\\x7c': '\\u00f8', // | -> 'o' stroke\n '\\x7d': '\\u00e5', // } -> 'a' ring\n '\\x7e': '\\u00fc', // ~ -> 'u' umlaut\n });\n\n/**\n * Spanish character map.\n * http://vt100.net/docs/vt220-rm/table2-13.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['Z'] = new hterm.VT.CharacterMap(\n 'spanish', {\n '\\x23': '\\u00a3', // # -> british-pound\n\n '\\x40': '\\u00a7', // @ -> section symbol (double s)\n\n '\\x5b': '\\u00a1', // [ -> '!' inverted\n '\\x5c': '\\u00d1', // \\ -> 'N' tilde\n '\\x5d': '\\u00bf', // ] -> '?' inverted\n\n '\\x7b': '\\u00b0', // { -> ring\n '\\x7c': '\\u00f1', // | -> 'n' tilde\n '\\x7d': '\\u00e7', // } -> 'c' cedilla\n });\n\n/**\n * Swedish character map.\n * http://vt100.net/docs/vt220-rm/table2-14.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['7'] =\nhterm.VT.CharacterMaps.DefaultMaps['H'] = new hterm.VT.CharacterMap(\n 'swedish', {\n '\\x40': '\\u00c9', // @ -> 'E' acute\n\n '\\x5b': '\\u00c4', // [ -> 'A' umlaut\n '\\x5c': '\\u00d6', // \\ -> 'O' umlaut\n '\\x5d': '\\u00c5', // ] -> 'A' ring\n '\\x5e': '\\u00dc', // ^ -> 'U' umlaut\n\n '\\x60': '\\u00e9', // ` -> 'e' acute\n\n '\\x7b': '\\u00e4', // { -> 'a' umlaut\n '\\x7c': '\\u00f6', // | -> 'o' umlaut\n '\\x7d': '\\u00e5', // } -> 'a' ring\n '\\x7e': '\\u00fc', // ~ -> 'u' umlaut\n });\n\n/**\n * Swiss character map.\n * http://vt100.net/docs/vt220-rm/table2-15.html\n */\nhterm.VT.CharacterMaps.DefaultMaps['='] = new hterm.VT.CharacterMap(\n 'swiss', {\n '\\x23': '\\u00f9', // # -> 'u' grave\n\n '\\x40': '\\u00e0', // @ -> 'a' grave\n\n '\\x5b': '\\u00e9', // [ -> 'e' acute\n '\\x5c': '\\u00e7', // \\ -> 'c' cedilla\n '\\x5d': '\\u00ea', // ] -> 'e' circumflex\n '\\x5e': '\\u00ee', // ^ -> 'i' circumflex\n '\\x5f': '\\u00e8', // _ -> 'e' grave\n\n '\\x60': '\\u00f4', // ` -> 'o' circumflex\n\n '\\x7b': '\\u00e4', // { -> 'a' umlaut\n '\\x7c': '\\u00f6', // | -> 'o' umlaut\n '\\x7d': '\\u00fc', // } -> 'u' umlaut\n '\\x7e': '\\u00fb', // ~ -> 'u' circumflex\n });\nlib.resource.add('hterm/audio/bell', 'audio/ogg;base64',\n'T2dnUwACAAAAAAAAAADhqW5KAAAAAMFvEjYBHgF2b3JiaXMAAAAAAYC7AAAAAAAAAHcBAAAAAAC4' +\n'AU9nZ1MAAAAAAAAAAAAA4aluSgEAAAAAesI3EC3//////////////////8kDdm9yYmlzHQAAAFhp' +\n'cGguT3JnIGxpYlZvcmJpcyBJIDIwMDkwNzA5AAAAAAEFdm9yYmlzKUJDVgEACAAAADFMIMWA0JBV' +\n'AAAQAABgJCkOk2ZJKaWUoSh5mJRISSmllMUwiZiUicUYY4wxxhhjjDHGGGOMIDRkFQAABACAKAmO' +\n'o+ZJas45ZxgnjnKgOWlOOKcgB4pR4DkJwvUmY26mtKZrbs4pJQgNWQUAAAIAQEghhRRSSCGFFGKI' +\n'IYYYYoghhxxyyCGnnHIKKqigggoyyCCDTDLppJNOOumoo4466ii00EILLbTSSkwx1VZjrr0GXXxz' +\n'zjnnnHPOOeecc84JQkNWAQAgAAAEQgYZZBBCCCGFFFKIKaaYcgoyyIDQkFUAACAAgAAAAABHkRRJ' +\n'sRTLsRzN0SRP8ixREzXRM0VTVE1VVVVVdV1XdmXXdnXXdn1ZmIVbuH1ZuIVb2IVd94VhGIZhGIZh' +\n'GIZh+H3f933f930gNGQVACABAKAjOZbjKaIiGqLiOaIDhIasAgBkAAAEACAJkiIpkqNJpmZqrmmb' +\n'tmirtm3LsizLsgyEhqwCAAABAAQAAAAAAKBpmqZpmqZpmqZpmqZpmqZpmqZpmmZZlmVZlmVZlmVZ' +\n'lmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZQGjIKgBAAgBAx3Ecx3EkRVIkx3IsBwgNWQUAyAAA' +\n'CABAUizFcjRHczTHczzHczxHdETJlEzN9EwPCA1ZBQAAAgAIAAAAAABAMRzFcRzJ0SRPUi3TcjVX' +\n'cz3Xc03XdV1XVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVYHQkFUAAAQAACGdZpZq' +\n'gAgzkGEgNGQVAIAAAAAYoQhDDAgNWQUAAAQAAIih5CCa0JrzzTkOmuWgqRSb08GJVJsnuamYm3PO' +\n'OeecbM4Z45xzzinKmcWgmdCac85JDJqloJnQmnPOeRKbB62p0ppzzhnnnA7GGWGcc85p0poHqdlY' +\n'm3POWdCa5qi5FJtzzomUmye1uVSbc84555xzzjnnnHPOqV6czsE54Zxzzonam2u5CV2cc875ZJzu' +\n'zQnhnHPOOeecc84555xzzglCQ1YBAEAAAARh2BjGnYIgfY4GYhQhpiGTHnSPDpOgMcgppB6NjkZK' +\n'qYNQUhknpXSC0JBVAAAgAACEEFJIIYUUUkghhRRSSCGGGGKIIaeccgoqqKSSiirKKLPMMssss8wy' +\n'y6zDzjrrsMMQQwwxtNJKLDXVVmONteaec645SGultdZaK6WUUkoppSA0ZBUAAAIAQCBkkEEGGYUU' +\n'UkghhphyyimnoIIKCA1ZBQAAAgAIAAAA8CTPER3RER3RER3RER3RER3P8RxREiVREiXRMi1TMz1V' +\n'VFVXdm1Zl3Xbt4Vd2HXf133f141fF4ZlWZZlWZZlWZZlWZZlWZZlCUJDVgEAIAAAAEIIIYQUUkgh' +\n'hZRijDHHnINOQgmB0JBVAAAgAIAAAAAAR3EUx5EcyZEkS7IkTdIszfI0T/M00RNFUTRNUxVd0RV1' +\n'0xZlUzZd0zVl01Vl1XZl2bZlW7d9WbZ93/d93/d93/d93/d939d1IDRkFQAgAQCgIzmSIimSIjmO' +\n'40iSBISGrAIAZAAABACgKI7iOI4jSZIkWZImeZZniZqpmZ7pqaIKhIasAgAAAQAEAAAAAACgaIqn' +\n'mIqniIrniI4oiZZpiZqquaJsyq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7rukBo' +\n'yCoAQAIAQEdyJEdyJEVSJEVyJAcIDVkFAMgAAAgAwDEcQ1Ikx7IsTfM0T/M00RM90TM9VXRFFwgN' +\n'WQUAAAIACAAAAAAAwJAMS7EczdEkUVIt1VI11VItVVQ9VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' +\n'VVVVVVVVVVVV1TRN0zSB0JCVAAAZAAAjQQYZhBCKcpBCbj1YCDHmJAWhOQahxBiEpxAzDDkNInSQ' +\n'QSc9uJI5wwzz4FIoFURMg40lN44gDcKmXEnlOAhCQ1YEAFEAAIAxyDHEGHLOScmgRM4xCZ2UyDkn' +\n'pZPSSSktlhgzKSWmEmPjnKPSScmklBhLip2kEmOJrQAAgAAHAIAAC6HQkBUBQBQAAGIMUgophZRS' +\n'zinmkFLKMeUcUko5p5xTzjkIHYTKMQadgxAppRxTzinHHITMQeWcg9BBKAAAIMABACDAQig0ZEUA' +\n'ECcA4HAkz5M0SxQlSxNFzxRl1xNN15U0zTQ1UVRVyxNV1VRV2xZNVbYlTRNNTfRUVRNFVRVV05ZN' +\n'VbVtzzRl2VRV3RZV1bZl2xZ+V5Z13zNNWRZV1dZNVbV115Z9X9ZtXZg0zTQ1UVRVTRRV1VRV2zZV' +\n'17Y1UXRVUVVlWVRVWXZlWfdVV9Z9SxRV1VNN2RVVVbZV2fVtVZZ94XRVXVdl2fdVWRZ+W9eF4fZ9' +\n'4RhV1dZN19V1VZZ9YdZlYbd13yhpmmlqoqiqmiiqqqmqtm2qrq1bouiqoqrKsmeqrqzKsq+rrmzr' +\n'miiqrqiqsiyqqiyrsqz7qizrtqiquq3KsrCbrqvrtu8LwyzrunCqrq6rsuz7qizruq3rxnHrujB8' +\n'pinLpqvquqm6um7runHMtm0co6rqvirLwrDKsu/rui+0dSFRVXXdlF3jV2VZ921fd55b94WybTu/' +\n'rfvKceu60vg5z28cubZtHLNuG7+t+8bzKz9hOI6lZ5q2baqqrZuqq+uybivDrOtCUVV9XZVl3zdd' +\n'WRdu3zeOW9eNoqrquirLvrDKsjHcxm8cuzAcXds2jlvXnbKtC31jyPcJz2vbxnH7OuP2daOvDAnH' +\n'jwAAgAEHAIAAE8pAoSErAoA4AQAGIecUUxAqxSB0EFLqIKRUMQYhc05KxRyUUEpqIZTUKsYgVI5J' +\n'yJyTEkpoKZTSUgehpVBKa6GU1lJrsabUYu0gpBZKaS2U0lpqqcbUWowRYxAy56RkzkkJpbQWSmkt' +\n'c05K56CkDkJKpaQUS0otVsxJyaCj0kFIqaQSU0mptVBKa6WkFktKMbYUW24x1hxKaS2kEltJKcYU' +\n'U20txpojxiBkzknJnJMSSmktlNJa5ZiUDkJKmYOSSkqtlZJSzJyT0kFIqYOOSkkptpJKTKGU1kpK' +\n'sYVSWmwx1pxSbDWU0lpJKcaSSmwtxlpbTLV1EFoLpbQWSmmttVZraq3GUEprJaUYS0qxtRZrbjHm' +\n'GkppraQSW0mpxRZbji3GmlNrNabWam4x5hpbbT3WmnNKrdbUUo0txppjbb3VmnvvIKQWSmktlNJi' +\n'ai3G1mKtoZTWSiqxlZJabDHm2lqMOZTSYkmpxZJSjC3GmltsuaaWamwx5ppSi7Xm2nNsNfbUWqwt' +\n'xppTS7XWWnOPufVWAADAgAMAQIAJZaDQkJUAQBQAAEGIUs5JaRByzDkqCULMOSepckxCKSlVzEEI' +\n'JbXOOSkpxdY5CCWlFksqLcVWaykptRZrLQAAoMABACDABk2JxQEKDVkJAEQBACDGIMQYhAYZpRiD' +\n'0BikFGMQIqUYc05KpRRjzknJGHMOQioZY85BKCmEUEoqKYUQSkklpQIAAAocAAACbNCUWByg0JAV' +\n'AUAUAABgDGIMMYYgdFQyKhGETEonqYEQWgutddZSa6XFzFpqrbTYQAithdYySyXG1FpmrcSYWisA' +\n'AOzAAQDswEIoNGQlAJAHAEAYoxRjzjlnEGLMOegcNAgx5hyEDirGnIMOQggVY85BCCGEzDkIIYQQ' +\n'QuYchBBCCKGDEEIIpZTSQQghhFJK6SCEEEIppXQQQgihlFIKAAAqcAAACLBRZHOCkaBCQ1YCAHkA' +\n'AIAxSjkHoZRGKcYglJJSoxRjEEpJqXIMQikpxVY5B6GUlFrsIJTSWmw1dhBKaS3GWkNKrcVYa64h' +\n'pdZirDXX1FqMteaaa0otxlprzbkAANwFBwCwAxtFNicYCSo0ZCUAkAcAgCCkFGOMMYYUYoox55xD' +\n'CCnFmHPOKaYYc84555RijDnnnHOMMeecc845xphzzjnnHHPOOeecc44555xzzjnnnHPOOeecc845' +\n'55xzzgkAACpwAAAIsFFkc4KRoEJDVgIAqQAAABFWYowxxhgbCDHGGGOMMUYSYowxxhhjbDHGGGOM' +\n'McaYYowxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHG' +\n'GFtrrbXWWmuttdZaa6211lprrQBAvwoHAP8HG1ZHOCkaCyw0ZCUAEA4AABjDmHOOOQYdhIYp6KSE' +\n'DkIIoUNKOSglhFBKKSlzTkpKpaSUWkqZc1JSKiWlllLqIKTUWkottdZaByWl1lJqrbXWOgiltNRa' +\n'a6212EFIKaXWWostxlBKSq212GKMNYZSUmqtxdhirDGk0lJsLcYYY6yhlNZaazHGGGstKbXWYoy1' +\n'xlprSam11mKLNdZaCwDgbnAAgEiwcYaVpLPC0eBCQ1YCACEBAARCjDnnnHMQQgghUoox56CDEEII' +\n'IURKMeYcdBBCCCGEjDHnoIMQQgghhJAx5hx0EEIIIYQQOucchBBCCKGEUkrnHHQQQgghlFBC6SCE' +\n'EEIIoYRSSikdhBBCKKGEUkopJYQQQgmllFJKKaWEEEIIoYQSSimllBBCCKWUUkoppZQSQgghlFJK' +\n'KaWUUkIIoZRQSimllFJKCCGEUkoppZRSSgkhhFBKKaWUUkopIYQSSimllFJKKaUAAIADBwCAACPo' +\n'JKPKImw04cIDUGjISgCADAAAcdhq6ynWyCDFnISWS4SQchBiLhFSijlHsWVIGcUY1ZQxpRRTUmvo' +\n'nGKMUU+dY0oxw6yUVkookYLScqy1dswBAAAgCAAwECEzgUABFBjIAIADhAQpAKCwwNAxXAQE5BIy' +\n'CgwKx4Rz0mkDABCEyAyRiFgMEhOqgaJiOgBYXGDIB4AMjY20iwvoMsAFXdx1IIQgBCGIxQEUkICD' +\n'E2544g1PuMEJOkWlDgIAAAAA4AAAHgAAkg0gIiKaOY4Ojw+QEJERkhKTE5QAAAAAALABgA8AgCQF' +\n'iIiIZo6jw+MDJERkhKTE5AQlAAAAAAAAAAAACAgIAAAAAAAEAAAACAhPZ2dTAAQYOwAAAAAAAOGp' +\n'bkoCAAAAmc74DRgyNjM69TAzOTk74dnLubewsbagmZiNp4d0KbsExSY/I3XUTwJgkeZdn1HY4zoj' +\n'33/q9DFtv3Ui1/jmx7lCUtPt18/sYf9MkgAsAGRBd3gMGP4sU+qCPYBy9VrA3YqJosW3W2/ef1iO' +\n'/u3cg8ZG/57jU+pPmbGEJUgkfnaI39DbPqxddZphbMRmCc5rKlkUMkyx8iIoug5dJv1OYH9a59c+' +\n'3Gevqc7Z2XFdDjL/qHztRfjWEWxJ/aiGezjohu9HsCZdQBKbiH0VtU/3m85lDG2T/+xkZcYnX+E+' +\n'aqzv/xTgOoTFG+x7SNqQ4N+oAABSxuVXw77Jd5bmmTmuJakX7509HH0kGYKvARPpwfOSAPySPAc2' +\n'EkneDwB2HwAAJlQDYK5586N79GJCjx4+p6aDUd27XSvRyXLJkIC5YZ1jLv5lpOhZTz0s+DmnF1di' +\n'ptrnM6UDgIW11Xh8cHTd0/SmbgOAdxcyWwMAAGIrZ3fNSfZbzKiYrK4+tPqtnMVLOeWOG2kVvUY+' +\n'p2PJ/hkCl5aFRO4TLGYPZcIU3vYM1hohS4jHFlnyW/2T5J7kGsShXWT8N05V+3C/GPqJ1QdWisGP' +\n'xEzHqXISBPIinWDUt7IeJv/f5OtzBxpTzZZQ+CYEhHXfqG4aABQli72GJhN4oJv+hXcApAJSErAW' +\n'8G2raAX4NUcABnVt77CzZAB+LsHcVe+Q4h+QB1wh/ZrJTPxSBdI8mgTeAdTsQOoFUEng9BHcVPhx' +\n'SRRYkKWZJXOFYP6V4AEripJoEjXgA2wJRZHSExmJDm8F0A6gEXsg5a4ZsALItrMB7+fh7UKLvYWS' +\n'dtsDwFf1mzYzS1F82N1h2Oyt2e76B1QdS0SAsQigLPMOgJS9JRC7hFXA6kUsLFNKD5cA5cTRvgSq' +\n'Pc3Fl99xW3QTi/MHR8DEm6WnvaVQATwRqRKjywQ9BrrhugR2AKTsPQeQckrAOgDOhbTESyrXQ50C' +\n'kNpXdtWjW7W2/3UjeX3U95gIdalfRAoAmqUEiwp53hCdcCwlg47fcbfzlmQMAgaBkh7c+fcDgF+i' +\n'fwDXfzegLPcLYJsAAJQArTXjnh/uXGy3v1Hk3pV6/3t5ruW81f6prfbM2Q3WNVy98BwUtbCwhFhA' +\n'WuPev6Oe/4ZaFQUcgKrVs4defzh1TADA1DEh5b3VlDaECw5b+bPfkKos3tIAue3vJZOih3ga3l6O' +\n'3PSfIkrLv0PAS86PPdL7g8oc2KteNFKKzKRehOv2gJoFLBPXmaXvPBQILgJon0bbWBszrYZYYwE7' +\n'jl2j+vTdU7Vpk21LiU0QajPkywAAHqbUC0/YsYOdb4e6BOp7E0cCi04Ao/TgD8ZVAMid6h/A8IeB' +\n'Nkp6/xsAACZELEYIk+yvI6Qz1NN6lIftB/6IMWjWJNOqPTMedAmyaj6Es0QBklJpiSWWHnQ2CoYb' +\n'GWAmt+0gLQBFKCBnp2QUUQZ/1thtZDBJUpFWY82z34ocorB62oX7qB5y0oPAv/foxH25wVmgIHf2' +\n'xFOr8leZcBq1Kx3ZvCq9Bga639AxuHuPNL/71YCF4EywJpqHFAX6XF0sjVbuANnvvdLcrufYwOM/' +\n'iDa6iA468AYAAB6mNBMXcgTD8HSRqJ4vw8CjAlCEPACASlX/APwPOJKl9xQAAAPmnev2eWp33Xgy' +\n'w3Dvfz6myGk3oyP8YTKsCOvzAgALQi0o1c6Nzs2O2Pg2h4ACIJAgAGP0aNn5x0BDgVfH7u2TtyfD' +\n'cRIuYAyQhBF/lvSRAttgA6TPbWZA9gaUrZWAUEAA+Dx47Q3/r87HxUUqZmB0BmUuMlojFjHt1gDu' +\n'nnvuX8MImsjSq5WkzSzGS62OEIlOufWWezxWpv6FBgDgJVltfXFYtNAAnqU0xQoD0YLiXo5cF5QV' +\n'4CnY1tBLAkZCOABAhbk/AM+/AwSCCdlWAAAMcFjS7owb8GVDzveDiZvznbt2tF4bL5odN1YKl88T' +\n'AEABCZvufq9YCTBtMwVAQUEAwGtNltzSaHvADYC3TxLVjqiRA+OZAMhzcqEgRcAOwoCgvdTxsTHL' +\n'QEF6+oOb2+PAI8ciPQcXg7pOY+LjxQSv2fjmFuj34gGwz310/bGK6z3xgT887eomWULEaDd04wHe' +\n'tYxdjcgV2SxvSwn0VoZXJRqkRC5ASQ/muVoAUsX7AgAQMBNaVwAAlABRxT/1PmfqLqSRNDbhXb07' +\n'berpB3b94jpuWEZjBCD2OcdXFpCKEgCDfcFPMw8AAADUwT4lnUm50lmwrpMMhPQIKj6u0E8fr2vG' +\n'BngMNdIlrZsigjahljud6AFVg+tzXwUnXL3TJLpajaWKA4VAAAAMiFfqJgKAZ08XrtS3dxtQNYcp' +\n'PvYEG8ClvrQRJgBephwnNWJjtGqmp6VEPSvBe7EBiU3qgJbQAwD4Le8LAMDMhHbNAAAlgK+tFs5O' +\n'+YyJc9yCnJa3rxLPulGnxwsXV9Fsk2k4PisCAHC8FkwbGE9gJQAAoMnyksj0CdFMZLLgoz8M+Fxz' +\n'iwYBgIx+zHiCBAKAlBKNpF1sO9JpVcyEi9ar15YlHgrut5fPJnkdJ6vEwZPyAHQBIEDUrlMcBAAd' +\n'2KAS0Qq+JwRsE4AJZtMnAD6GnOYwYlOIZvtzUNdjreB7fiMkWI0CmBB6AIAKc38A9osEFlTSGECB' +\n'+cbeRDC0aRpLHqNPplcK/76Lxn2rpmqyXsYJWRi/FQAAAKBQk9MCAOibrQBQADCDsqpooPutd+05' +\n'Ce9g6iEdiYXgVmQAI4+4wskEBEiBloNQ6Ki0/KTQ0QjWfjxzi+AeuXKoMjEVfQOZzr0y941qLgM2' +\n'AExvbZOqcxZ6J6krlrj4y2j9AdgKDx6GnJsVLhbc42uq584+ouSdNBpoCiCVHrz+WzUA/DDtD8AT' +\n'gA3h0lMCAAzcFv+S+fSSNkeYWlTpb34mf2RfmqqJeMeklhHAfu7VoAEACgAApKRktL+KkQDWMwYC' +\n'UAAAAHCKsp80xhp91UjqQBw3x45cetqkjQEyu3G9B6N+R650Uq8OVig7wOm6Wun0ea4lKDPoabJs' +\n'6aLqgbhPzpv4KR4iODilw88ZpY7q1IOMcbASAOAVtmcCnobcrkG4KGS7/ZnskVWRNF9J0RUHKOnB' +\n'yy9WA8Dv6L4AAARMCQUA4GritfVM2lcZfH3Q3T/vZ47J2YHhcmBazjfdyuV25gLAzrc0cwAAAAAY' +\n'Ch6PdwAAAGyWjFW4yScjaWa2mGcofHxWxewKALglWBpLUvwwk+UOh5eNGyUOs1/EF+pZr+ud5Ozo' +\n'GwYdAABg2p52LiSgAY/ZVlOmilEgHn6G3OcwYjzI7vOj1t6xsx4S3lBY96EUQBF6AIBAmPYH4PoG' +\n'YCoJAADWe+OZJZi7/x76/yH7Lzf9M5XzRKnFPmveMsilQHwVAAAAAKB3LQD8PCIAAADga0QujBLy' +\n'wzeJ4a6Z/ERVBAUlAEDqvoM7BQBAuAguzFqILtmjH3Kd4wfKobnOhA3z85qWoRPm9hwoOHoDAAlC' +\n'bwDAA56FHAuXflHo3fe2ttG9XUDeA9YmYCBQ0oPr/1QC8IvuCwAAApbUAQCK22MmE3O78VAbHQT9' +\n'PIPNoT9zNc3l2Oe7TAVLANBufT8MAQAAAGzT4PS8AQAAoELGHb2uaCwwEv1EWhFriUkbAaAZ27/f' +\n'VZnTZXbWz3BwWpjUaMZKRj7dZ0J//gUeTdpVEwAAZOFsNxKAjQSgA+ABPoY8Jj5y2wje81jsXc/1' +\n'TOQWTDYZBmAkNDiqVwuA2NJ9AQAAEBKAt9Vrsfs/2N19MO91S9rd8EHTZHnzC5MYmfQEACy/FBcA' +\n'AADA5c4gi4z8RANs/m6FNXVo9DV46JG1BBDukqlw/Va5G7QbuGVSI+2aZaoLXJrdVj2zlC9Z5QEA' +\n'EFz/5QzgVZwAAAAA/oXcxyC6WfTu+09Ve/c766J4VTAGUFmA51+VANKi/QPoPwYgYAkA715OH4S0' +\n's5KDHvj99MMq8TPFc3roKZnGOoT1bmIhVgc7XAMBAAAAAMAW1VbQw3gapzOpJd+Kd2fc4iSO62fJ' +\n'v9+movui1wUNPAj059N3OVxzk4gV73PmE8FIA2F5mRq37Evc76vLXfF4rD5UJJAw46hW6LZCb5sN' +\n'Ldx+kzMCAAB+hfy95+965ZCLP7B3/VlTHCvDEKtQhTm4KiCgAEAbrfbWTPssAAAAXpee1tVrozYY' +\n'n41wD1aeYtkKfswN5/SXPO0JDnhO/4laUortv/s412fybe/nONdncoCHnBVliu0CQGBWlPY/5Kwo' +\n'm2L/kruPM6Q7oz4tvDQy+bZ3HzOi+gNHA4DZEgA=' +\n''\n);\n\nlib.resource.add('hterm/images/icon-96', 'image/png;base64',\n'iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdC' +\n'AK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dE' +\n'AP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAFKhJREFUeNrtXXlsXMd5/30z8649uDzE' +\n'mxRFibIsOXZ8VInTJFYSW3actE1ctWkctEF6I0VRFEWAoihQoAjQFmiBogWaIEADFCmQXklto04T' +\n'O0ndWI4bxZalWHJinTYtkRJFkctzl9zd977+8c49+UjuipbCD1y+9+ae75vvmJlv3gO2YRu2YRu2' +\n'YRu2YUuAtroBN3nfeKsaSXWurarvRvUrTnlccV/5a3lDReRKFdc4Za6nzvW2b7OIpwZh7N37iHYi' +\n'Pztyvy4iqA00Tng/WXH1f3GQsFki0Qbz+cAV12jeRkTwwUd2yfsVI89OjbLrwnoJILw8EoAOIAFg' +\n'LwDTCxcAJBEJIiIAgoiICAIgIgIBJGpdPRCRq3sPCBAJAii8QgAk/PIFkSBBQvh3QRkQXtECBKpx' +\n'H9br5hMikhcg4QV4dYkgARFBSkmlUmnp7LmLX8rl8q95OPKJ0DQCkPeTEcQrAD179+7+7LsP3vtJ' +\n'w9A1ZvbwFfQM/r1/AyD64KLBv5JHIaIwIpI5GIbevd82r0I3OMjvJfOo5ffCqw1EhIRlQQi3a37p' +\n'0atfTVB22PhIuHt95tnnBr75zHN/AGASoYjyxVVTCOCPfOWN9sGfue+df/L4r3z8MSGUOv3aWYDI' +\n'q43BEXXEQRPCQK5qFleFMdduOwMV3WKUBXFVyVXhtm3jrjtvw13vuL1uPXGAAUghkGlLPXJ9ZvZz' +\n'L738oz8HsOhFF2u3aH0E8JEvAWhe+n2PHD70Z7/xmccfLBSK9M1nX0AqnYFSKiB7fIiOzg3k21Be' +\n'YHW1gMkr1/DBB+6HkGLTxmRfbxf9+qc/8WszM9lzF99468twxZCAq5wbQiMCREWPBkDXde3eI489' +\n'+he/+1u/et/c3AK+/uSzyLTvgK7rm+tBE4CZA1HRaFT7oqNQKCCdsqBp61GD9eHBD77XunJ16o/+' +\n'6q+/cLJYLP2fhzfGGkRYiwBRK2fnL/3iRz7/uT/8nfuuz2Txla8+hXRbJ6QUKBaLuJmgVLJRKuSh' +\n'lIBpatiEFApACIFHH/lA//NHj33qe0ePvQJXEa/JnHEIoABYd925/zOPf+JjBxMJC//yxX+GYaZg' +\n'GAZse00ue1uByyWMQrGEldVVKCWbQgAA6OnegQP7997zvaPH2gGsIpQidWuoRwA/o2/bDz70off+' +\n'nFIa/fczz2Pq2hzSbRksLCxsNT43BI7jYCW/ihd/cBKWZTZhQcFV9qMjQ0gmEwm4hkqsOVEjDogq' +\n'37bOjvaElBKLizmYVgKWZW01HjeOLGaAbUipoJTWHAKwa4KYpmHCJUB0lQCoU0scK0gCMJRSqqOj' +\n'Hel0EqZpIpFIbDUeNwwOM2y7gO4dnWhrSzVFBDEzMpkULNM04BIgFsS1ggxNUzKVSiCRsEBEUEoF' +\n'iRq2v5HNXjMd18pSHVeZnuuniZaopIIQBAIhnUqgvb1tU3OBKFiWCdMydABWBH+bIoCvA3RNU9Ky' +\n'DOiahG2XAAAzszO4NHkZINcKALuddRHi3VWFReLcWy8dhxO5aFpvkhamD5HFwQQuStgwLPpsOza4' +\n'5GD/yD4MDw2jVCrCMHSkUwmws3kCMADD0GCZpialMG3bia4trVsJ+xkJAKSUStM0oWsSQrgTGdu2' +\n'MXllEmezF/HRhz+C4b6hyEgrnyjVLLzhcho1iFsDiGomOzt+Ds/8z7PIzmfR39eP1dVVSOEijR0n' +\n'RsFrg1ISpmkoQ9cTufxKrBbHmoUoJZWmlPDXRZgdMDNsx8HuXbtx3zvvhRQKTdFmLQACoT2dwY9e' +\n'fRWlvA1m1xJy2IEggkPrnUvXB9M0lGkaiVx+xR/ADQuPRQAppaY0JfzOBB0joFAs4Oyb59E0Y7pF' +\n'4DDDdmw47LgygQHbbs7Ij4JpGMIwjGRFcF0xFJcDdE0pUb3YQ1hYWsDFSxff7vgHMyO3kkMGiaAP' +\n'zScAwzB0YVlmAuHo3zQHkKaUppTHAUQBLQnAYm4J41feCldAGeHe2FaCq9fdXQMP8qt5sB6OlGbP' +\n'4pkBwzBgGHoKMdcIG82Ew0RK6UqTxHAJEHSBCLmVHCavXwUcwGpXMJIS2YnVhrq01cAOQxkC7YMG' +\n'5i6vwi65LV4trIK10GJyHLvpTTR0DZZlJtEEMxR+IVJJTSlFAFdZL47joFgswrEZ3X06Dv3eAH78' +\n'7Vm8/t0s8nMld9PjBhHCN1G7dlm490g3rIzCt/5yHIWiA5dxGQ5HOcBpatuYGZquwTSNTXMAogVo' +\n'SukuAXwlzFUpSRCyl1cx+VoOBz/Zi93vyeDE16bx1iuLsIsOSLSWCuwwEh0a9h/uxDs+2gWnxDj+' +\n'79dQKjhlg4bZl/vkiaDmtkvXNFimmURMJ4VYOkBpSldSug91TDYiIDdXwtEvTeDNlxZw3y/34PDn' +\n'duLCi/M4+eQ0Zt5cCdI1G/FKFxg5mME9R7rRMWTi/AtzOPnENLKXV2tyrA+lFqzkKk3BNI0k3BWE' +\n'5swDXA7wlm0bFEkEODbjzWPzmDqTw4HDnbjz57swdHcKp56+jte/k0VurtRUInSPJXD3Y90YfXcb' +\n'Zt7I49t/M45LJ5ZgF7lMAbsN9BfiXE5uthXEzFBK+TpAhrVunAAEeEp4DQ4oyyQI+fkSjn/tGsZf' +\n'WcA9j3Xjvk/0Yte72vD8FyZw/Y2VauRsAA483ImDn+oF28DL/zqFn3wni/xcESSoTvkExxdBBNil' +\n'FnCAlLBMM+Hhdk3HtThoIE1TulTuDlscAgAuNxCA6XN5HP+Pa8heWsHAgSQyA0ZzFr8IGHhHCuke' +\n'HedfmMOpb8wgly021jXkTsjYm9C0YjNJSgFvHuAP7qbMA3TpcwAo1ooDOwwjKTH2QDvu/lg3lCnw' +\n'g69cxcSpJc8dZJPgACeeuAYhgf0Pd6JjyMArX5/GlZ8sg23U5TCf+ESt0QFCCFiWYcF131kT4lhB' +\n'pDSXAMy+Eq1PAXYAIYHBu9O490g3evclMf7yAk785zSuX8i7Y68ZOoCA6xdW8N2/u4TRd2dw75Fu' +\n'PPqnu3Dmu7N49RszWLiyGvgGRfM47HjNdzmg6U6kRLAs02wGAXwieBwgggoaMUD7oI67fmEHbjvU' +\n'gfmrBTz395fw5ksLKK26pmgzO0wCsFcZ576XxeTpZdzxaCfu+HAXRg624eST0zh/dB6FXDjK3TUg' +\n'VwQREUot0AFCEEx3U8ZoBgEAVwdoUnheFnWGLztA1y4Tj/zxCIyUwI+emsaPn5nF8qyvFFs0D/C8' +\n'05Zni3jpq1MY/+EC7jnSg/f+5gB69yXw/BcnYBfDIeMrYaLW6ACAYFmmjpi7YqpmCRWMq2maLgIO' +\n'qFcUQ7MErp5ZxqmnZ0Jx0+IJWNBIr5qpszl852/fwp73ZNC3PwmhKCQAUWCGAu5MuNlriEQEy6za' +\n'FauLhHg6QClNejte9YQICcL1i3k8/4UJd/bZZHETGwGCYK8yzjw3h4vHFmAXym19dxfNE0Etcqkx' +\n'TVPTdd0qFApRPNaEtcxQAiA0TelCeKvRDTSoXWTYJb5ho75Rq0kApbwDrphrOREd0Ip5AOBuyhiG' +\n'HsttpB4BohiUmqZpgel4Mx1qournYCbcUg4wpLccUasVZVCLAJUZhKaUTp5hvTWCpXnAcEIOsG00' +\n'fxuVYRq6MA3dX5JuCGt5xhEAqWkq4IC4M+GYbV0/bLJ6h92dmlaJIG9ThkyzbE9gQ0rYB6lpSgUc' +\n'0CT8C0nQzPUvCDk2o7iysUU0gmsFcSCCnJZspeq6BtPUk3HSxrGChKZpmu/U2gwKsMPo2Z/E+397' +\n'AELFL48EMHFqGd//x0k49gYwR+VWUGvmAQxD12GZZgox1tpiuSa6HOCJIJ8umxo5hELOxvSFPEiu' +\n'IxcR5idXNzVqqwnQXBZghr8r5m/KbHgxzs+oNE1T/sBvhggiAcyOr+B//+FyUzsfD0ERM7RFIkjT' +\n'gj2BNTmgnhUUXcd2N4SpBUp4C6DVHABmaEr5+8L+rtiGlTADUK4I8kJ8XeDDes/KAw37zPUSrYUn' +\n'5tpJOJqE4ThOSACn+RzAAKSU/p7AmgI2phWkyeB4ZqQiAsFZtkFOZI+Ao7SgytVgeJoQVBkf+HRG' +\n'rxVhVBFGqHj24imSP3psFUAylYCSEsWSDdu2y86WNQukuytmIdwVq3tSJo5zrtI0JUMjiAJzbrB/' +\n'AA8YRnCWNnLON3JuFyEiIj8AZen9Vc0wL0JkRtMgGlfjDHBwDSLKzwp7dRZL+aYivZwAApZlWnAP' +\n't0TxuSYBKocCA1BKUxIgMBy0taUAOCiVikilUkin0/FbFnEz3xxQLGMg6rpemX9paQm37x2DlLLM' +\n'U6IZIITwOUCraEAVERotR4ccoDQJAI7DGBrsx8MP3o+nv/V9dHf3BAc1IjguO00d+OpHffYrw5ir' +\n'09WMi5wd4PC8QLDHXHGmIHr1G8dgsOOgoyOJB973LjR/KSLYFYtuymxYCZOUUtM8z2i/w48cPgTT' +\n'MPDD46eQX1mG768Smqq+qAFEROwIQSASZVdBAiQIQggI8q7+c/AjSCEgZBgm/TgZ3stovKy4Rsqz' +\n'LBMjOweRSiXhNOFwRi0CmJbhE2BTm/KspNQ0pcrMVaUkDj/0fnzg0P0olkqhs+4a71xoeA0LKCur' +\n'Irhmf2rJzca9cl0Um3U0qZoAqNwV25AS9pEdnA2IguM4kFLC95bYLPiiJYIjtEI83BggWKapCSEs' +\n'x3E2txinlPJOx9z8k7AbBUTBSRkrl8tv+GUdDIClksphFsvL+ZacKLn1gL3V0DICrOuQXvSohUNE' +\n'2rnz41QqcdPNtVsRGEBbOgnbdkjTVKUZWgWqRn4fHABOoVBcNE2ztHPnoL7NAfHANHS8dPzE0sxM' +\n'dsILqvsGrXocEGRYXFx67fUz5y729e7Yw4ADjumb2AJoWq2xCtrwdh0TQRz74YmLpZI9HitHjTCC' +\n'a0KZANKGoX88lUo+pCmlhBASYMmAjE76Ea4CoNyerDYuUZHRXwiq2Pan8r/yNkcMAiqvv+pwFFWm' +\n'pQqbl6isaqoVVtajsJfB0piXwCEidhyHp6/PHpudnfs8gDm4b07xX+xXBnEW43jv2Ojo73/20x+e' +\n'zc47Fy6MN/IOXZ+ZxBvIE6eeCovbn0FXzjXqt4urEsVlGsPQ8NFHP0RP/dez4sv/9G8ZuK8wq2uK' +\n'xtkRs+44cNs7e3t61NEXXwVIVUye1o+f+nnXsT1ZlrwiH9dKjLp+TZVhoRNy/Jb5PrPjlyfAzDiw' +\n'f28vgD4AV+AuS5dq5au3FuS/I0IB6B3bM7L7wsW3IJSBjvb2ls0gb3YgIiym0hi/NImB/p5Mpi09' +\n'Or+weBqu+CliHYtx/ruCpGWZu3cOD/Sceu08ioUiFhcX12rHTy0QEXTdwKVLV7B/326tt3fHnvmF' +\n'RQMu8v03aAERIjTyC5IAtJGdg/s7OjLmbHYBXV29TVt6uFVB13VMXZtFwrIwMNA3dvbcGxaAFYQb' +\n'9LE5QAFI7Nk9cgdAyOeL2CFlS8XPrbDUoZTC4lIexVIJw0P9IwDScBVxzVOT9QggvbiuvWOjY9ns' +\n'PBxmLC0tbc+G1wApJWyHMTObxcjwYB+ALgBTCN8+WTYpa0QAQUTDu0eH+ycmp5BOtyGVSm0r4Big' +\n'6wYmJqYwNNTfIaXss237DEIRVMYFUQIEnnDwOGBwoG9ff19P+tXT52BZiVtCRLS6D8wM0zRx6fJV' +\n'/Oz991jdOzp3Xp2a9iVKlTlayQFR89PYPTp8wLJMys4tItNuYH5+fqvx97YHIQQ0XcfUtRmkUgnq' +\n'7+8duTo1raGOj1AlB0TnAOm9Y6O35XJ5MAskk8lt8bMOmMzOwHEYw0P9IydOnjYR6oC6BADK5wD9' +\n'e8d2DV65Og3dMKGUuuUUcCvFkcPA/PwCRnYODAJoA3AdNRy1anGABCA7O9vHRnYOdrx84sdgBubm' +\n'5rY5ICa4m/8Sk1enMTQ00A2gG8BbKOcCBmpzgASgj44M7+/oaJfXpmfR3t5xy07AWsUFhUIRlyem' +\n'cOcde9OpVHJgaWn5FawhgqLfhkmOje26nZmRyxXQtePmfU3xVoFpmbg2PYtMW1rr6+3eeX5pOaqE' +\n'gyWJShHkJ9px297RXddnsiiWbCwuLv5UiJ9aX/bYSBlE7nV5OYe2dAqDA727zl94s5IAZSIoKv9F' +\n'ImHt2rN7pDs7N4/l5WVIOesRwH8Tbs2qgwvXi6uKr9PB+u8ujomSeKlonZG0RmRl6AcPHcTAQC8G' +\n'B/uGEb5RPToh46j3bhCxc3hg39Bgn9nbswPpVBK53ErZR2tqOV358eVx4X2wzRRx2K103q12yEXo' +\n'5Bvcry99I4ewuI5kYdsj6SIOxV5omXOwphS6ujoghMDw0EAvXEvoSgTfAKrfaUMA9F0jQ7d3d3ch' +\n'k0njoQ+9b83NiK0VTnHendOqdnLdIIY7K3YJ0N8ppeixbecMYixFpHaNDI+mU0n3pdl8a9n+NxJ8' +\n'7ujv7030dO8YvHL1mr8zWsYBlZrZymTSKaUlQNLAVo/vmxsIxCV0tLeJzs72bo8AboSH71qroStL' +\n'S8u567PzyK86G9ox32yjW1lU6/sTrYFhmQqWZSGdSmZqpVZlqV3IzcxkZ6evTWFpebWmT2+tj6MF' +\n'76OtdbSL61gyzDXTlZ0hKE9Q9rEGrrK8uELec1Vc+bcJIvfRwyM1wpiry2sU5opvRqYtCcuUKBSK' +\n'JYQf/QzcFX0CRN0Rc8dPnD5qJZ7okVKCHYd8V27/RRcM9gAAewc/2bsLH+GnCf+Xp/PmFsFtEBum' +\n'Lqss8oTIX9lzUFCQJ9rAijRV92VtjTxHyquqpKzLjn+Fu+xsKyULzLzyxhuXnkSNL66WnYRB+KnC' +\n'DNydHP/dZzpCU7WWUuAGzxwjvlYZ9cLWm4cbxMUpD2vkqQzzkVwEUIC7Gb/iXQvez3fSYlWR0YZL' +\n'uUUvkYHw453+JGK9EKdTrdT0Db2TW9CO6DeGSyhHetWXVqOfvXAq7m0vY9xvBW+28RvJ3ygP4ca3' +\n'KcpJUU7wER/VAQBqK2H/DRZ+hspDe81EYKsQsZV1Vg7oKNKjyGegsXNuFOE302Ywr/G8Fe2pq4fq' +\n'IfZmQvjbHbZ6AGzDNmzDNmzD2xT+H+5UT7Tyxc2HAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE2LTA2' +\n'LTMwVDExOjUwOjAyLTA0OjAwOaSkCgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMy0xMS0wMVQxMDoz' +\n'ODoyNC0wNDowMNba8BsAAAAASUVORK5CYII=' +\n''\n);\n\nlib.resource.add('hterm/concat/date', 'text/plain',\n'Tue, 22 Aug 2017 06:42:31 +0000' +\n''\n);\n\nlib.resource.add('hterm/changelog/version', 'text/plain',\n'1.70' +\n''\n);\n\nlib.resource.add('hterm/changelog/date', 'text/plain',\n'2017-08-16' +\n''\n);\n\nlib.resource.add('hterm/git/HEAD', 'text/plain',\n'git rev-parse HEAD' +\n''\n);\n\n// SOURCE FILE: hterm/js/hterm_export.js\nmodule.exports = {\n hterm: hterm,\n lib: lib\n};\n\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/libapps/hterm/dist/js/hterm_module.js\n// module id = 14\n// module chunks = 0","import { Hterm } from \"./hterm\";\nimport { Xterm } from \"./xterm\";\nimport { Terminal, WebTTY, protocols } from \"./webtty\";\nimport { ConnectionFactory } from \"./websocket\";\n\n// @TODO remove these\ndeclare var gotty_auth_token: string;\ndeclare var gotty_term: string;\n\nconst elem = document.getElementById(\"terminal\")\n\nif (elem !== null) {\n var term: Terminal;\n if (gotty_term == \"hterm\") {\n term = new Hterm(elem);\n } else {\n term = new Xterm(elem);\n }\n const httpsEnabled = window.location.protocol == \"https:\";\n const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';\n const args = window.location.search;\n const factory = new ConnectionFactory(url, protocols);\n const wt = new WebTTY(term, factory, args, gotty_auth_token);\n const closer = wt.open();\n\n window.addEventListener(\"unload\", () => {\n closer();\n term.close();\n });\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.ts","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar CompositionHelper = (function () {\n function CompositionHelper(textarea, compositionView, terminal) {\n this.textarea = textarea;\n this.compositionView = compositionView;\n this.terminal = terminal;\n this.isComposing = false;\n this.isSendingComposition = false;\n this.compositionPosition = { start: null, end: null };\n }\n CompositionHelper.prototype.compositionstart = function () {\n this.isComposing = true;\n this.compositionPosition.start = this.textarea.value.length;\n this.compositionView.textContent = '';\n this.compositionView.classList.add('active');\n };\n CompositionHelper.prototype.compositionupdate = function (ev) {\n var _this = this;\n this.compositionView.textContent = ev.data;\n this.updateCompositionElements();\n setTimeout(function () {\n _this.compositionPosition.end = _this.textarea.value.length;\n }, 0);\n };\n CompositionHelper.prototype.compositionend = function () {\n this.finalizeComposition(true);\n };\n CompositionHelper.prototype.keydown = function (ev) {\n if (this.isComposing || this.isSendingComposition) {\n if (ev.keyCode === 229) {\n return false;\n }\n else if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {\n return false;\n }\n else {\n this.finalizeComposition(false);\n }\n }\n if (ev.keyCode === 229) {\n this.handleAnyTextareaChanges();\n return false;\n }\n return true;\n };\n CompositionHelper.prototype.finalizeComposition = function (waitForPropogation) {\n var _this = this;\n this.compositionView.classList.remove('active');\n this.isComposing = false;\n this.clearTextareaPosition();\n if (!waitForPropogation) {\n this.isSendingComposition = false;\n var input = this.textarea.value.substring(this.compositionPosition.start, this.compositionPosition.end);\n this.terminal.handler(input);\n }\n else {\n var currentCompositionPosition_1 = {\n start: this.compositionPosition.start,\n end: this.compositionPosition.end,\n };\n this.isSendingComposition = true;\n setTimeout(function () {\n if (_this.isSendingComposition) {\n _this.isSendingComposition = false;\n var input = void 0;\n if (_this.isComposing) {\n input = _this.textarea.value.substring(currentCompositionPosition_1.start, currentCompositionPosition_1.end);\n }\n else {\n input = _this.textarea.value.substring(currentCompositionPosition_1.start);\n }\n _this.terminal.handler(input);\n }\n }, 0);\n }\n };\n CompositionHelper.prototype.handleAnyTextareaChanges = function () {\n var _this = this;\n var oldValue = this.textarea.value;\n setTimeout(function () {\n if (!_this.isComposing) {\n var newValue = _this.textarea.value;\n var diff = newValue.replace(oldValue, '');\n if (diff.length > 0) {\n _this.terminal.handler(diff);\n }\n }\n }, 0);\n };\n CompositionHelper.prototype.updateCompositionElements = function (dontRecurse) {\n var _this = this;\n if (!this.isComposing) {\n return;\n }\n var cursor = this.terminal.element.querySelector('.terminal-cursor');\n if (cursor) {\n var xtermRows = this.terminal.element.querySelector('.xterm-rows');\n var cursorTop = xtermRows.offsetTop + cursor.offsetTop;\n this.compositionView.style.left = cursor.offsetLeft + 'px';\n this.compositionView.style.top = cursorTop + 'px';\n this.compositionView.style.height = cursor.offsetHeight + 'px';\n this.compositionView.style.lineHeight = cursor.offsetHeight + 'px';\n var compositionViewBounds = this.compositionView.getBoundingClientRect();\n this.textarea.style.left = cursor.offsetLeft + 'px';\n this.textarea.style.top = cursorTop + 'px';\n this.textarea.style.width = compositionViewBounds.width + 'px';\n this.textarea.style.height = compositionViewBounds.height + 'px';\n this.textarea.style.lineHeight = compositionViewBounds.height + 'px';\n }\n if (!dontRecurse) {\n setTimeout(function () { return _this.updateCompositionElements(true); }, 0);\n }\n };\n ;\n CompositionHelper.prototype.clearTextareaPosition = function () {\n this.textarea.style.left = '';\n this.textarea.style.top = '';\n };\n ;\n return CompositionHelper;\n}());\nexports.CompositionHelper = CompositionHelper;\n\n//# sourceMappingURL=CompositionHelper.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/CompositionHelper.js\n// module id = 16\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EscapeSequences_1 = require(\"./EscapeSequences\");\nvar Charsets_1 = require(\"./Charsets\");\nvar InputHandler = (function () {\n function InputHandler(_terminal) {\n this._terminal = _terminal;\n }\n InputHandler.prototype.addChar = function (char, code) {\n if (char >= ' ') {\n var ch_width = wcwidth(code);\n if (this._terminal.charset && this._terminal.charset[char]) {\n char = this._terminal.charset[char];\n }\n var row = this._terminal.y + this._terminal.ybase;\n if (!ch_width && this._terminal.x) {\n if (this._terminal.lines.get(row)[this._terminal.x - 1]) {\n if (!this._terminal.lines.get(row)[this._terminal.x - 1][2]) {\n if (this._terminal.lines.get(row)[this._terminal.x - 2])\n this._terminal.lines.get(row)[this._terminal.x - 2][1] += char;\n }\n else {\n this._terminal.lines.get(row)[this._terminal.x - 1][1] += char;\n }\n this._terminal.updateRange(this._terminal.y);\n }\n return;\n }\n if (this._terminal.x + ch_width - 1 >= this._terminal.cols) {\n if (this._terminal.wraparoundMode) {\n this._terminal.x = 0;\n this._terminal.y++;\n if (this._terminal.y > this._terminal.scrollBottom) {\n this._terminal.y--;\n this._terminal.scroll(true);\n }\n else {\n this._terminal.lines.get(this._terminal.y).isWrapped = true;\n }\n }\n else {\n if (ch_width === 2)\n return;\n }\n }\n row = this._terminal.y + this._terminal.ybase;\n if (this._terminal.insertMode) {\n for (var moves = 0; moves < ch_width; ++moves) {\n var removed = this._terminal.lines.get(this._terminal.y + this._terminal.ybase).pop();\n if (removed[2] === 0\n && this._terminal.lines.get(row)[this._terminal.cols - 2]\n && this._terminal.lines.get(row)[this._terminal.cols - 2][2] === 2) {\n this._terminal.lines.get(row)[this._terminal.cols - 2] = [this._terminal.curAttr, ' ', 1];\n }\n this._terminal.lines.get(row).splice(this._terminal.x, 0, [this._terminal.curAttr, ' ', 1]);\n }\n }\n this._terminal.lines.get(row)[this._terminal.x] = [this._terminal.curAttr, char, ch_width];\n this._terminal.x++;\n this._terminal.updateRange(this._terminal.y);\n if (ch_width === 2) {\n this._terminal.lines.get(row)[this._terminal.x] = [this._terminal.curAttr, '', 0];\n this._terminal.x++;\n }\n }\n };\n InputHandler.prototype.bell = function () {\n var _this = this;\n if (!this._terminal.visualBell) {\n return;\n }\n this._terminal.element.style.borderColor = 'white';\n setTimeout(function () { return _this._terminal.element.style.borderColor = ''; }, 10);\n if (this._terminal.popOnBell) {\n this._terminal.focus();\n }\n };\n InputHandler.prototype.lineFeed = function () {\n if (this._terminal.convertEol) {\n this._terminal.x = 0;\n }\n this._terminal.y++;\n if (this._terminal.y > this._terminal.scrollBottom) {\n this._terminal.y--;\n this._terminal.scroll();\n }\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x--;\n }\n };\n InputHandler.prototype.carriageReturn = function () {\n this._terminal.x = 0;\n };\n InputHandler.prototype.backspace = function () {\n if (this._terminal.x > 0) {\n this._terminal.x--;\n }\n };\n InputHandler.prototype.tab = function () {\n this._terminal.x = this._terminal.nextStop();\n };\n InputHandler.prototype.shiftOut = function () {\n this._terminal.setgLevel(1);\n };\n InputHandler.prototype.shiftIn = function () {\n this._terminal.setgLevel(0);\n };\n InputHandler.prototype.insertChars = function (params) {\n var param, row, j, ch;\n param = params[0];\n if (param < 1)\n param = 1;\n row = this._terminal.y + this._terminal.ybase;\n j = this._terminal.x;\n ch = [this._terminal.eraseAttr(), ' ', 1];\n while (param-- && j < this._terminal.cols) {\n this._terminal.lines.get(row).splice(j++, 0, ch);\n this._terminal.lines.get(row).pop();\n }\n };\n InputHandler.prototype.cursorUp = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y -= param;\n if (this._terminal.y < 0) {\n this._terminal.y = 0;\n }\n };\n InputHandler.prototype.cursorDown = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y += param;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x--;\n }\n };\n InputHandler.prototype.cursorForward = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.x += param;\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x = this._terminal.cols - 1;\n }\n };\n InputHandler.prototype.cursorBackward = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x--;\n }\n this._terminal.x -= param;\n if (this._terminal.x < 0) {\n this._terminal.x = 0;\n }\n };\n InputHandler.prototype.cursorNextLine = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y += param;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n this._terminal.x = 0;\n };\n ;\n InputHandler.prototype.cursorPrecedingLine = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y -= param;\n if (this._terminal.y < 0) {\n this._terminal.y = 0;\n }\n this._terminal.x = 0;\n };\n ;\n InputHandler.prototype.cursorCharAbsolute = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.x = param - 1;\n };\n InputHandler.prototype.cursorPosition = function (params) {\n var row, col;\n row = params[0] - 1;\n if (params.length >= 2) {\n col = params[1] - 1;\n }\n else {\n col = 0;\n }\n if (row < 0) {\n row = 0;\n }\n else if (row >= this._terminal.rows) {\n row = this._terminal.rows - 1;\n }\n if (col < 0) {\n col = 0;\n }\n else if (col >= this._terminal.cols) {\n col = this._terminal.cols - 1;\n }\n this._terminal.x = col;\n this._terminal.y = row;\n };\n InputHandler.prototype.cursorForwardTab = function (params) {\n var param = params[0] || 1;\n while (param--) {\n this._terminal.x = this._terminal.nextStop();\n }\n };\n InputHandler.prototype.eraseInDisplay = function (params) {\n var j;\n switch (params[0]) {\n case 0:\n this._terminal.eraseRight(this._terminal.x, this._terminal.y);\n j = this._terminal.y + 1;\n for (; j < this._terminal.rows; j++) {\n this._terminal.eraseLine(j);\n }\n break;\n case 1:\n this._terminal.eraseLeft(this._terminal.x, this._terminal.y);\n j = this._terminal.y;\n while (j--) {\n this._terminal.eraseLine(j);\n }\n break;\n case 2:\n j = this._terminal.rows;\n while (j--)\n this._terminal.eraseLine(j);\n break;\n case 3:\n var scrollBackSize = this._terminal.lines.length - this._terminal.rows;\n if (scrollBackSize > 0) {\n this._terminal.lines.trimStart(scrollBackSize);\n this._terminal.ybase = Math.max(this._terminal.ybase - scrollBackSize, 0);\n this._terminal.ydisp = Math.max(this._terminal.ydisp - scrollBackSize, 0);\n }\n break;\n }\n };\n InputHandler.prototype.eraseInLine = function (params) {\n switch (params[0]) {\n case 0:\n this._terminal.eraseRight(this._terminal.x, this._terminal.y);\n break;\n case 1:\n this._terminal.eraseLeft(this._terminal.x, this._terminal.y);\n break;\n case 2:\n this._terminal.eraseLine(this._terminal.y);\n break;\n }\n };\n InputHandler.prototype.insertLines = function (params) {\n var param, row, j;\n param = params[0];\n if (param < 1) {\n param = 1;\n }\n row = this._terminal.y + this._terminal.ybase;\n j = this._terminal.rows - 1 - this._terminal.scrollBottom;\n j = this._terminal.rows - 1 + this._terminal.ybase - j + 1;\n while (param--) {\n if (this._terminal.lines.length === this._terminal.lines.maxLength) {\n this._terminal.lines.trimStart(1);\n this._terminal.ybase--;\n this._terminal.ydisp--;\n row--;\n j--;\n }\n this._terminal.lines.splice(row, 0, this._terminal.blankLine(true));\n this._terminal.lines.splice(j, 1);\n }\n this._terminal.updateRange(this._terminal.y);\n this._terminal.updateRange(this._terminal.scrollBottom);\n };\n InputHandler.prototype.deleteLines = function (params) {\n var param, row, j;\n param = params[0];\n if (param < 1) {\n param = 1;\n }\n row = this._terminal.y + this._terminal.ybase;\n j = this._terminal.rows - 1 - this._terminal.scrollBottom;\n j = this._terminal.rows - 1 + this._terminal.ybase - j;\n while (param--) {\n if (this._terminal.lines.length === this._terminal.lines.maxLength) {\n this._terminal.lines.trimStart(1);\n this._terminal.ybase -= 1;\n this._terminal.ydisp -= 1;\n }\n this._terminal.lines.splice(j + 1, 0, this._terminal.blankLine(true));\n this._terminal.lines.splice(row, 1);\n }\n this._terminal.updateRange(this._terminal.y);\n this._terminal.updateRange(this._terminal.scrollBottom);\n };\n InputHandler.prototype.deleteChars = function (params) {\n var param, row, ch;\n param = params[0];\n if (param < 1) {\n param = 1;\n }\n row = this._terminal.y + this._terminal.ybase;\n ch = [this._terminal.eraseAttr(), ' ', 1];\n while (param--) {\n this._terminal.lines.get(row).splice(this._terminal.x, 1);\n this._terminal.lines.get(row).push(ch);\n }\n };\n InputHandler.prototype.scrollUp = function (params) {\n var param = params[0] || 1;\n while (param--) {\n this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollTop, 1);\n this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollBottom, 0, this._terminal.blankLine());\n }\n this._terminal.updateRange(this._terminal.scrollTop);\n this._terminal.updateRange(this._terminal.scrollBottom);\n };\n InputHandler.prototype.scrollDown = function (params) {\n var param = params[0] || 1;\n while (param--) {\n this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollBottom, 1);\n this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollTop, 0, this._terminal.blankLine());\n }\n this._terminal.updateRange(this._terminal.scrollTop);\n this._terminal.updateRange(this._terminal.scrollBottom);\n };\n InputHandler.prototype.eraseChars = function (params) {\n var param, row, j, ch;\n param = params[0];\n if (param < 1) {\n param = 1;\n }\n row = this._terminal.y + this._terminal.ybase;\n j = this._terminal.x;\n ch = [this._terminal.eraseAttr(), ' ', 1];\n while (param-- && j < this._terminal.cols) {\n this._terminal.lines.get(row)[j++] = ch;\n }\n };\n InputHandler.prototype.cursorBackwardTab = function (params) {\n var param = params[0] || 1;\n while (param--) {\n this._terminal.x = this._terminal.prevStop();\n }\n };\n InputHandler.prototype.charPosAbsolute = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.x = param - 1;\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x = this._terminal.cols - 1;\n }\n };\n InputHandler.prototype.HPositionRelative = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.x += param;\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x = this._terminal.cols - 1;\n }\n };\n InputHandler.prototype.repeatPrecedingCharacter = function (params) {\n var param = params[0] || 1, line = this._terminal.lines.get(this._terminal.ybase + this._terminal.y), ch = line[this._terminal.x - 1] || [this._terminal.defAttr, ' ', 1];\n while (param--) {\n line[this._terminal.x++] = ch;\n }\n };\n InputHandler.prototype.sendDeviceAttributes = function (params) {\n if (params[0] > 0) {\n return;\n }\n if (!this._terminal.prefix) {\n if (this._terminal.is('xterm') || this._terminal.is('rxvt-unicode') || this._terminal.is('screen')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[?1;2c');\n }\n else if (this._terminal.is('linux')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[?6c');\n }\n }\n else if (this._terminal.prefix === '>') {\n if (this._terminal.is('xterm')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[>0;276;0c');\n }\n else if (this._terminal.is('rxvt-unicode')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[>85;95;0c');\n }\n else if (this._terminal.is('linux')) {\n this._terminal.send(params[0] + 'c');\n }\n else if (this._terminal.is('screen')) {\n this._terminal.send(EscapeSequences_1.C0.ESC + '[>83;40003;0c');\n }\n }\n };\n InputHandler.prototype.linePosAbsolute = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y = param - 1;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n };\n InputHandler.prototype.VPositionRelative = function (params) {\n var param = params[0];\n if (param < 1) {\n param = 1;\n }\n this._terminal.y += param;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x--;\n }\n };\n InputHandler.prototype.HVPosition = function (params) {\n if (params[0] < 1)\n params[0] = 1;\n if (params[1] < 1)\n params[1] = 1;\n this._terminal.y = params[0] - 1;\n if (this._terminal.y >= this._terminal.rows) {\n this._terminal.y = this._terminal.rows - 1;\n }\n this._terminal.x = params[1] - 1;\n if (this._terminal.x >= this._terminal.cols) {\n this._terminal.x = this._terminal.cols - 1;\n }\n };\n InputHandler.prototype.tabClear = function (params) {\n var param = params[0];\n if (param <= 0) {\n delete this._terminal.tabs[this._terminal.x];\n }\n else if (param === 3) {\n this._terminal.tabs = {};\n }\n };\n InputHandler.prototype.setMode = function (params) {\n if (params.length > 1) {\n for (var i = 0; i < params.length; i++) {\n this.setMode([params[i]]);\n }\n return;\n }\n if (!this._terminal.prefix) {\n switch (params[0]) {\n case 4:\n this._terminal.insertMode = true;\n break;\n case 20:\n break;\n }\n }\n else if (this._terminal.prefix === '?') {\n switch (params[0]) {\n case 1:\n this._terminal.applicationCursor = true;\n break;\n case 2:\n this._terminal.setgCharset(0, Charsets_1.DEFAULT_CHARSET);\n this._terminal.setgCharset(1, Charsets_1.DEFAULT_CHARSET);\n this._terminal.setgCharset(2, Charsets_1.DEFAULT_CHARSET);\n this._terminal.setgCharset(3, Charsets_1.DEFAULT_CHARSET);\n break;\n case 3:\n this._terminal.savedCols = this._terminal.cols;\n this._terminal.resize(132, this._terminal.rows);\n break;\n case 6:\n this._terminal.originMode = true;\n break;\n case 7:\n this._terminal.wraparoundMode = true;\n break;\n case 12:\n break;\n case 66:\n this._terminal.log('Serial port requested application keypad.');\n this._terminal.applicationKeypad = true;\n this._terminal.viewport.syncScrollArea();\n break;\n case 9:\n case 1000:\n case 1002:\n case 1003:\n this._terminal.x10Mouse = params[0] === 9;\n this._terminal.vt200Mouse = params[0] === 1000;\n this._terminal.normalMouse = params[0] > 1000;\n this._terminal.mouseEvents = true;\n this._terminal.element.classList.add('enable-mouse-events');\n this._terminal.selectionManager.disable();\n this._terminal.log('Binding to mouse events.');\n break;\n case 1004:\n this._terminal.sendFocus = true;\n break;\n case 1005:\n this._terminal.utfMouse = true;\n break;\n case 1006:\n this._terminal.sgrMouse = true;\n break;\n case 1015:\n this._terminal.urxvtMouse = true;\n break;\n case 25:\n this._terminal.cursorHidden = false;\n break;\n case 1049:\n ;\n case 47:\n case 1047:\n if (!this._terminal.normal) {\n var normal = {\n lines: this._terminal.lines,\n ybase: this._terminal.ybase,\n ydisp: this._terminal.ydisp,\n x: this._terminal.x,\n y: this._terminal.y,\n scrollTop: this._terminal.scrollTop,\n scrollBottom: this._terminal.scrollBottom,\n tabs: this._terminal.tabs\n };\n this._terminal.reset();\n this._terminal.viewport.syncScrollArea();\n this._terminal.normal = normal;\n this._terminal.showCursor();\n }\n break;\n }\n }\n };\n InputHandler.prototype.resetMode = function (params) {\n if (params.length > 1) {\n for (var i = 0; i < params.length; i++) {\n this.resetMode([params[i]]);\n }\n return;\n }\n if (!this._terminal.prefix) {\n switch (params[0]) {\n case 4:\n this._terminal.insertMode = false;\n break;\n case 20:\n break;\n }\n }\n else if (this._terminal.prefix === '?') {\n switch (params[0]) {\n case 1:\n this._terminal.applicationCursor = false;\n break;\n case 3:\n if (this._terminal.cols === 132 && this._terminal.savedCols) {\n this._terminal.resize(this._terminal.savedCols, this._terminal.rows);\n }\n delete this._terminal.savedCols;\n break;\n case 6:\n this._terminal.originMode = false;\n break;\n case 7:\n this._terminal.wraparoundMode = false;\n break;\n case 12:\n break;\n case 66:\n this._terminal.log('Switching back to normal keypad.');\n this._terminal.applicationKeypad = false;\n this._terminal.viewport.syncScrollArea();\n break;\n case 9:\n case 1000:\n case 1002:\n case 1003:\n this._terminal.x10Mouse = false;\n this._terminal.vt200Mouse = false;\n this._terminal.normalMouse = false;\n this._terminal.mouseEvents = false;\n this._terminal.element.classList.remove('enable-mouse-events');\n this._terminal.selectionManager.enable();\n break;\n case 1004:\n this._terminal.sendFocus = false;\n break;\n case 1005:\n this._terminal.utfMouse = false;\n break;\n case 1006:\n this._terminal.sgrMouse = false;\n break;\n case 1015:\n this._terminal.urxvtMouse = false;\n break;\n case 25:\n this._terminal.cursorHidden = true;\n break;\n case 1049:\n ;\n case 47:\n case 1047:\n if (this._terminal.normal) {\n this._terminal.lines = this._terminal.normal.lines;\n this._terminal.ybase = this._terminal.normal.ybase;\n this._terminal.ydisp = this._terminal.normal.ydisp;\n this._terminal.x = this._terminal.normal.x;\n this._terminal.y = this._terminal.normal.y;\n this._terminal.scrollTop = this._terminal.normal.scrollTop;\n this._terminal.scrollBottom = this._terminal.normal.scrollBottom;\n this._terminal.tabs = this._terminal.normal.tabs;\n this._terminal.normal = null;\n this._terminal.selectionManager.setBuffer(this._terminal.lines);\n this._terminal.refresh(0, this._terminal.rows - 1);\n this._terminal.viewport.syncScrollArea();\n this._terminal.showCursor();\n }\n break;\n }\n }\n };\n InputHandler.prototype.charAttributes = function (params) {\n if (params.length === 1 && params[0] === 0) {\n this._terminal.curAttr = this._terminal.defAttr;\n return;\n }\n var l = params.length, i = 0, flags = this._terminal.curAttr >> 18, fg = (this._terminal.curAttr >> 9) & 0x1ff, bg = this._terminal.curAttr & 0x1ff, p;\n for (; i < l; i++) {\n p = params[i];\n if (p >= 30 && p <= 37) {\n fg = p - 30;\n }\n else if (p >= 40 && p <= 47) {\n bg = p - 40;\n }\n else if (p >= 90 && p <= 97) {\n p += 8;\n fg = p - 90;\n }\n else if (p >= 100 && p <= 107) {\n p += 8;\n bg = p - 100;\n }\n else if (p === 0) {\n flags = this._terminal.defAttr >> 18;\n fg = (this._terminal.defAttr >> 9) & 0x1ff;\n bg = this._terminal.defAttr & 0x1ff;\n }\n else if (p === 1) {\n flags |= 1;\n }\n else if (p === 4) {\n flags |= 2;\n }\n else if (p === 5) {\n flags |= 4;\n }\n else if (p === 7) {\n flags |= 8;\n }\n else if (p === 8) {\n flags |= 16;\n }\n else if (p === 22) {\n flags &= ~1;\n }\n else if (p === 24) {\n flags &= ~2;\n }\n else if (p === 25) {\n flags &= ~4;\n }\n else if (p === 27) {\n flags &= ~8;\n }\n else if (p === 28) {\n flags &= ~16;\n }\n else if (p === 39) {\n fg = (this._terminal.defAttr >> 9) & 0x1ff;\n }\n else if (p === 49) {\n bg = this._terminal.defAttr & 0x1ff;\n }\n else if (p === 38) {\n if (params[i + 1] === 2) {\n i += 2;\n fg = this._terminal.matchColor(params[i] & 0xff, params[i + 1] & 0xff, params[i + 2] & 0xff);\n if (fg === -1)\n fg = 0x1ff;\n i += 2;\n }\n else if (params[i + 1] === 5) {\n i += 2;\n p = params[i] & 0xff;\n fg = p;\n }\n }\n else if (p === 48) {\n if (params[i + 1] === 2) {\n i += 2;\n bg = this._terminal.matchColor(params[i] & 0xff, params[i + 1] & 0xff, params[i + 2] & 0xff);\n if (bg === -1)\n bg = 0x1ff;\n i += 2;\n }\n else if (params[i + 1] === 5) {\n i += 2;\n p = params[i] & 0xff;\n bg = p;\n }\n }\n else if (p === 100) {\n fg = (this._terminal.defAttr >> 9) & 0x1ff;\n bg = this._terminal.defAttr & 0x1ff;\n }\n else {\n this._terminal.error('Unknown SGR attribute: %d.', p);\n }\n }\n this._terminal.curAttr = (flags << 18) | (fg << 9) | bg;\n };\n InputHandler.prototype.deviceStatus = function (params) {\n if (!this._terminal.prefix) {\n switch (params[0]) {\n case 5:\n this._terminal.send(EscapeSequences_1.C0.ESC + '[0n');\n break;\n case 6:\n this._terminal.send(EscapeSequences_1.C0.ESC + '['\n + (this._terminal.y + 1)\n + ';'\n + (this._terminal.x + 1)\n + 'R');\n break;\n }\n }\n else if (this._terminal.prefix === '?') {\n switch (params[0]) {\n case 6:\n this._terminal.send(EscapeSequences_1.C0.ESC + '[?'\n + (this._terminal.y + 1)\n + ';'\n + (this._terminal.x + 1)\n + 'R');\n break;\n case 15:\n break;\n case 25:\n break;\n case 26:\n break;\n case 53:\n break;\n }\n }\n };\n InputHandler.prototype.softReset = function (params) {\n this._terminal.cursorHidden = false;\n this._terminal.insertMode = false;\n this._terminal.originMode = false;\n this._terminal.wraparoundMode = true;\n this._terminal.applicationKeypad = false;\n this._terminal.viewport.syncScrollArea();\n this._terminal.applicationCursor = false;\n this._terminal.scrollTop = 0;\n this._terminal.scrollBottom = this._terminal.rows - 1;\n this._terminal.curAttr = this._terminal.defAttr;\n this._terminal.x = this._terminal.y = 0;\n this._terminal.charset = null;\n this._terminal.glevel = 0;\n this._terminal.charsets = [null];\n };\n InputHandler.prototype.setCursorStyle = function (params) {\n var param = params[0] < 1 ? 1 : params[0];\n switch (param) {\n case 1:\n case 2:\n this._terminal.setOption('cursorStyle', 'block');\n break;\n case 3:\n case 4:\n this._terminal.setOption('cursorStyle', 'underline');\n break;\n case 5:\n case 6:\n this._terminal.setOption('cursorStyle', 'bar');\n break;\n }\n var isBlinking = param % 2 === 1;\n this._terminal.setOption('cursorBlink', isBlinking);\n };\n InputHandler.prototype.setScrollRegion = function (params) {\n if (this._terminal.prefix)\n return;\n this._terminal.scrollTop = (params[0] || 1) - 1;\n this._terminal.scrollBottom = (params[1] && params[1] <= this._terminal.rows ? params[1] : this._terminal.rows) - 1;\n this._terminal.x = 0;\n this._terminal.y = 0;\n };\n InputHandler.prototype.saveCursor = function (params) {\n this._terminal.savedX = this._terminal.x;\n this._terminal.savedY = this._terminal.y;\n };\n InputHandler.prototype.restoreCursor = function (params) {\n this._terminal.x = this._terminal.savedX || 0;\n this._terminal.y = this._terminal.savedY || 0;\n };\n return InputHandler;\n}());\nexports.InputHandler = InputHandler;\nvar wcwidth = (function (opts) {\n var 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 [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 function bisearch(ucs) {\n var min = 0;\n var max = COMBINING.length - 1;\n var mid;\n if (ucs < COMBINING[0][0] || ucs > COMBINING[max][1])\n return false;\n while (max >= min) {\n mid = Math.floor((min + max) / 2);\n if (ucs > COMBINING[mid][1])\n min = mid + 1;\n else if (ucs < COMBINING[mid][0])\n max = mid - 1;\n else\n return true;\n }\n return false;\n }\n function wcwidth(ucs) {\n if (ucs === 0)\n return opts.nul;\n if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))\n return opts.control;\n if (bisearch(ucs))\n return 0;\n if (isWide(ucs)) {\n return 2;\n }\n return 1;\n }\n function isWide(ucs) {\n return (ucs >= 0x1100 && (ucs <= 0x115f ||\n ucs === 0x2329 ||\n ucs === 0x232a ||\n (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs !== 0x303f) ||\n (ucs >= 0xac00 && ucs <= 0xd7a3) ||\n (ucs >= 0xf900 && ucs <= 0xfaff) ||\n (ucs >= 0xfe10 && ucs <= 0xfe19) ||\n (ucs >= 0xfe30 && ucs <= 0xfe6f) ||\n (ucs >= 0xff00 && ucs <= 0xff60) ||\n (ucs >= 0xffe0 && ucs <= 0xffe6) ||\n (ucs >= 0x20000 && ucs <= 0x2fffd) ||\n (ucs >= 0x30000 && ucs <= 0x3fffd)));\n }\n return wcwidth;\n})({ nul: 0, control: 0 });\n\n//# sourceMappingURL=InputHandler.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/InputHandler.js\n// module id = 17\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar INVALID_LINK_CLASS = 'xterm-invalid-link';\nvar protocolClause = '(https?:\\\\/\\\\/)';\nvar domainCharacterSet = '[\\\\da-z\\\\.-]+';\nvar negatedDomainCharacterSet = '[^\\\\da-z\\\\.-]+';\nvar domainBodyClause = '(' + domainCharacterSet + ')';\nvar tldClause = '([a-z\\\\.]{2,6})';\nvar ipClause = '((\\\\d{1,3}\\\\.){3}\\\\d{1,3})';\nvar localHostClause = '(localhost)';\nvar portClause = '(:\\\\d{1,5})';\nvar hostClause = '((' + domainBodyClause + '\\\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?';\nvar pathClause = '(\\\\/[\\\\/\\\\w\\\\.\\\\-%~]*)*';\nvar queryStringHashFragmentCharacterSet = '[0-9\\\\w\\\\[\\\\]\\\\(\\\\)\\\\/\\\\?\\\\!#@$%&\\'*+,:;~\\\\=\\\\.\\\\-]*';\nvar queryStringClause = '(\\\\?' + queryStringHashFragmentCharacterSet + ')?';\nvar hashFragmentClause = '(#' + queryStringHashFragmentCharacterSet + ')?';\nvar negatedPathCharacterSet = '[^\\\\/\\\\w\\\\.\\\\-%]+';\nvar bodyClause = hostClause + pathClause + queryStringClause + hashFragmentClause;\nvar start = '(?:^|' + negatedDomainCharacterSet + ')(';\nvar end = ')($|' + negatedPathCharacterSet + ')';\nvar strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end);\nvar HYPERTEXT_LINK_MATCHER_ID = 0;\nvar Linkifier = (function () {\n function Linkifier() {\n this._nextLinkMatcherId = HYPERTEXT_LINK_MATCHER_ID;\n this._rowTimeoutIds = [];\n this._linkMatchers = [];\n this.registerLinkMatcher(strictUrlRegex, null, { matchIndex: 1 });\n }\n Linkifier.prototype.attachToDom = function (document, rows) {\n this._document = document;\n this._rows = rows;\n };\n Linkifier.prototype.linkifyRow = function (rowIndex) {\n if (!this._document) {\n return;\n }\n var timeoutId = this._rowTimeoutIds[rowIndex];\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n this._rowTimeoutIds[rowIndex] = setTimeout(this._linkifyRow.bind(this, rowIndex), Linkifier.TIME_BEFORE_LINKIFY);\n };\n Linkifier.prototype.setHypertextLinkHandler = function (handler) {\n this._linkMatchers[HYPERTEXT_LINK_MATCHER_ID].handler = handler;\n };\n Linkifier.prototype.setHypertextValidationCallback = function (callback) {\n this._linkMatchers[HYPERTEXT_LINK_MATCHER_ID].validationCallback = callback;\n };\n Linkifier.prototype.registerLinkMatcher = function (regex, handler, options) {\n if (options === void 0) { options = {}; }\n if (this._nextLinkMatcherId !== HYPERTEXT_LINK_MATCHER_ID && !handler) {\n throw new Error('handler must be defined');\n }\n var matcher = {\n id: this._nextLinkMatcherId++,\n regex: regex,\n handler: handler,\n matchIndex: options.matchIndex,\n validationCallback: options.validationCallback,\n priority: options.priority || 0\n };\n this._addLinkMatcherToList(matcher);\n return matcher.id;\n };\n Linkifier.prototype._addLinkMatcherToList = function (matcher) {\n if (this._linkMatchers.length === 0) {\n this._linkMatchers.push(matcher);\n return;\n }\n for (var 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 this._linkMatchers.splice(0, 0, matcher);\n };\n Linkifier.prototype.deregisterLinkMatcher = function (matcherId) {\n for (var i = 1; 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 Linkifier.prototype._linkifyRow = function (rowIndex) {\n var row = this._rows[rowIndex];\n if (!row) {\n return;\n }\n var text = row.textContent;\n for (var i = 0; i < this._linkMatchers.length; i++) {\n var matcher = this._linkMatchers[i];\n var linkElements = this._doLinkifyRow(row, matcher);\n if (linkElements.length > 0) {\n if (matcher.validationCallback) {\n var _loop_1 = function (j) {\n var element = linkElements[j];\n matcher.validationCallback(element.textContent, element, function (isValid) {\n if (!isValid) {\n element.classList.add(INVALID_LINK_CLASS);\n }\n });\n };\n for (var j = 0; j < linkElements.length; j++) {\n _loop_1(j);\n }\n }\n return;\n }\n }\n };\n Linkifier.prototype._doLinkifyRow = function (row, matcher) {\n var result = [];\n var isHttpLinkMatcher = matcher.id === HYPERTEXT_LINK_MATCHER_ID;\n var nodes = row.childNodes;\n var match = row.textContent.match(matcher.regex);\n if (!match || match.length === 0) {\n return result;\n }\n var uri = match[typeof matcher.matchIndex !== 'number' ? 0 : matcher.matchIndex];\n var rowStartIndex = match.index + uri.length;\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n var searchIndex = node.textContent.indexOf(uri);\n if (searchIndex >= 0) {\n var linkElement = this._createAnchorElement(uri, matcher.handler, isHttpLinkMatcher);\n if (node.textContent.length === uri.length) {\n if (node.nodeType === 3) {\n this._replaceNode(node, linkElement);\n }\n else {\n var element = node;\n if (element.nodeName === 'A') {\n return result;\n }\n element.innerHTML = '';\n element.appendChild(linkElement);\n }\n }\n else if (node.childNodes.length > 1) {\n for (var j = 0; j < node.childNodes.length; j++) {\n var childNode = node.childNodes[j];\n var childSearchIndex = childNode.textContent.indexOf(uri);\n if (childSearchIndex !== -1) {\n this._replaceNodeSubstringWithNode(childNode, linkElement, uri, childSearchIndex);\n break;\n }\n }\n }\n else {\n var nodesAdded = this._replaceNodeSubstringWithNode(node, linkElement, uri, searchIndex);\n i += nodesAdded;\n }\n result.push(linkElement);\n match = row.textContent.substring(rowStartIndex).match(matcher.regex);\n if (!match || match.length === 0) {\n return result;\n }\n uri = match[typeof matcher.matchIndex !== 'number' ? 0 : matcher.matchIndex];\n rowStartIndex += match.index + uri.length;\n }\n }\n return result;\n };\n Linkifier.prototype._createAnchorElement = function (uri, handler, isHypertextLinkHandler) {\n var element = this._document.createElement('a');\n element.textContent = uri;\n element.draggable = false;\n if (isHypertextLinkHandler) {\n element.href = uri;\n element.target = '_blank';\n element.addEventListener('click', function (event) {\n if (handler) {\n return handler(event, uri);\n }\n });\n }\n else {\n element.addEventListener('click', function (event) {\n if (element.classList.contains(INVALID_LINK_CLASS)) {\n return;\n }\n return handler(event, uri);\n });\n }\n return element;\n };\n Linkifier.prototype._replaceNode = function (oldNode) {\n var newNodes = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n newNodes[_i - 1] = arguments[_i];\n }\n var parent = oldNode.parentNode;\n for (var i = 0; i < newNodes.length; i++) {\n parent.insertBefore(newNodes[i], oldNode);\n }\n parent.removeChild(oldNode);\n };\n Linkifier.prototype._replaceNodeSubstringWithNode = function (targetNode, newNode, substring, substringIndex) {\n if (targetNode.childNodes.length === 1) {\n targetNode = targetNode.childNodes[0];\n }\n if (targetNode.nodeType !== 3) {\n throw new Error('targetNode must be a text node or only contain a single text node');\n }\n var fullText = targetNode.textContent;\n if (substringIndex === 0) {\n var rightText_1 = fullText.substring(substring.length);\n var rightTextNode_1 = this._document.createTextNode(rightText_1);\n this._replaceNode(targetNode, newNode, rightTextNode_1);\n return 0;\n }\n if (substringIndex === targetNode.textContent.length - substring.length) {\n var leftText_1 = fullText.substring(0, substringIndex);\n var leftTextNode_1 = this._document.createTextNode(leftText_1);\n this._replaceNode(targetNode, leftTextNode_1, newNode);\n return 0;\n }\n var leftText = fullText.substring(0, substringIndex);\n var leftTextNode = this._document.createTextNode(leftText);\n var rightText = fullText.substring(substringIndex + substring.length);\n var rightTextNode = this._document.createTextNode(rightText);\n this._replaceNode(targetNode, leftTextNode, newNode, rightTextNode);\n return 1;\n };\n return Linkifier;\n}());\nLinkifier.TIME_BEFORE_LINKIFY = 200;\nexports.Linkifier = Linkifier;\n\n//# sourceMappingURL=Linkifier.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Linkifier.js\n// module id = 18\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EscapeSequences_1 = require(\"./EscapeSequences\");\nvar Charsets_1 = require(\"./Charsets\");\nvar normalStateHandler = {};\nnormalStateHandler[EscapeSequences_1.C0.BEL] = function (parser, handler) { return handler.bell(); };\nnormalStateHandler[EscapeSequences_1.C0.LF] = function (parser, handler) { return handler.lineFeed(); };\nnormalStateHandler[EscapeSequences_1.C0.VT] = normalStateHandler[EscapeSequences_1.C0.LF];\nnormalStateHandler[EscapeSequences_1.C0.FF] = normalStateHandler[EscapeSequences_1.C0.LF];\nnormalStateHandler[EscapeSequences_1.C0.CR] = function (parser, handler) { return handler.carriageReturn(); };\nnormalStateHandler[EscapeSequences_1.C0.BS] = function (parser, handler) { return handler.backspace(); };\nnormalStateHandler[EscapeSequences_1.C0.HT] = function (parser, handler) { return handler.tab(); };\nnormalStateHandler[EscapeSequences_1.C0.SO] = function (parser, handler) { return handler.shiftOut(); };\nnormalStateHandler[EscapeSequences_1.C0.SI] = function (parser, handler) { return handler.shiftIn(); };\nnormalStateHandler[EscapeSequences_1.C0.ESC] = function (parser, handler) { return parser.setState(ParserState.ESCAPED); };\nvar escapedStateHandler = {};\nescapedStateHandler['['] = function (parser, terminal) {\n terminal.params = [];\n terminal.currentParam = 0;\n parser.setState(ParserState.CSI_PARAM);\n};\nescapedStateHandler[']'] = function (parser, terminal) {\n terminal.params = [];\n terminal.currentParam = 0;\n parser.setState(ParserState.OSC);\n};\nescapedStateHandler['P'] = function (parser, terminal) {\n terminal.params = [];\n terminal.currentParam = 0;\n parser.setState(ParserState.DCS);\n};\nescapedStateHandler['_'] = function (parser, terminal) {\n parser.setState(ParserState.IGNORE);\n};\nescapedStateHandler['^'] = function (parser, terminal) {\n parser.setState(ParserState.IGNORE);\n};\nescapedStateHandler['c'] = function (parser, terminal) {\n terminal.reset();\n};\nescapedStateHandler['E'] = function (parser, terminal) {\n terminal.x = 0;\n terminal.index();\n parser.setState(ParserState.NORMAL);\n};\nescapedStateHandler['D'] = function (parser, terminal) {\n terminal.index();\n parser.setState(ParserState.NORMAL);\n};\nescapedStateHandler['M'] = function (parser, terminal) {\n terminal.reverseIndex();\n parser.setState(ParserState.NORMAL);\n};\nescapedStateHandler['%'] = function (parser, terminal) {\n terminal.setgLevel(0);\n terminal.setgCharset(0, Charsets_1.DEFAULT_CHARSET);\n parser.setState(ParserState.NORMAL);\n parser.skipNextChar();\n};\nescapedStateHandler[EscapeSequences_1.C0.CAN] = function (parser) { return parser.setState(ParserState.NORMAL); };\nvar csiParamStateHandler = {};\ncsiParamStateHandler['?'] = function (parser) { return parser.setPrefix('?'); };\ncsiParamStateHandler['>'] = function (parser) { return parser.setPrefix('>'); };\ncsiParamStateHandler['!'] = function (parser) { return parser.setPrefix('!'); };\ncsiParamStateHandler['0'] = function (parser) { return parser.setParam(parser.getParam() * 10); };\ncsiParamStateHandler['1'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 1); };\ncsiParamStateHandler['2'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 2); };\ncsiParamStateHandler['3'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 3); };\ncsiParamStateHandler['4'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 4); };\ncsiParamStateHandler['5'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 5); };\ncsiParamStateHandler['6'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 6); };\ncsiParamStateHandler['7'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 7); };\ncsiParamStateHandler['8'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 8); };\ncsiParamStateHandler['9'] = function (parser) { return parser.setParam(parser.getParam() * 10 + 9); };\ncsiParamStateHandler['$'] = function (parser) { return parser.setPostfix('$'); };\ncsiParamStateHandler['\"'] = function (parser) { return parser.setPostfix('\"'); };\ncsiParamStateHandler[' '] = function (parser) { return parser.setPostfix(' '); };\ncsiParamStateHandler['\\''] = function (parser) { return parser.setPostfix('\\''); };\ncsiParamStateHandler[';'] = function (parser) { return parser.finalizeParam(); };\ncsiParamStateHandler[EscapeSequences_1.C0.CAN] = function (parser) { return parser.setState(ParserState.NORMAL); };\nvar csiStateHandler = {};\ncsiStateHandler['@'] = function (handler, params, prefix) { return handler.insertChars(params); };\ncsiStateHandler['A'] = function (handler, params, prefix) { return handler.cursorUp(params); };\ncsiStateHandler['B'] = function (handler, params, prefix) { return handler.cursorDown(params); };\ncsiStateHandler['C'] = function (handler, params, prefix) { return handler.cursorForward(params); };\ncsiStateHandler['D'] = function (handler, params, prefix) { return handler.cursorBackward(params); };\ncsiStateHandler['E'] = function (handler, params, prefix) { return handler.cursorNextLine(params); };\ncsiStateHandler['F'] = function (handler, params, prefix) { return handler.cursorPrecedingLine(params); };\ncsiStateHandler['G'] = function (handler, params, prefix) { return handler.cursorCharAbsolute(params); };\ncsiStateHandler['H'] = function (handler, params, prefix) { return handler.cursorPosition(params); };\ncsiStateHandler['I'] = function (handler, params, prefix) { return handler.cursorForwardTab(params); };\ncsiStateHandler['J'] = function (handler, params, prefix) { return handler.eraseInDisplay(params); };\ncsiStateHandler['K'] = function (handler, params, prefix) { return handler.eraseInLine(params); };\ncsiStateHandler['L'] = function (handler, params, prefix) { return handler.insertLines(params); };\ncsiStateHandler['M'] = function (handler, params, prefix) { return handler.deleteLines(params); };\ncsiStateHandler['P'] = function (handler, params, prefix) { return handler.deleteChars(params); };\ncsiStateHandler['S'] = function (handler, params, prefix) { return handler.scrollUp(params); };\ncsiStateHandler['T'] = function (handler, params, prefix) {\n if (params.length < 2 && !prefix) {\n handler.scrollDown(params);\n }\n};\ncsiStateHandler['X'] = function (handler, params, prefix) { return handler.eraseChars(params); };\ncsiStateHandler['Z'] = function (handler, params, prefix) { return handler.cursorBackwardTab(params); };\ncsiStateHandler['`'] = function (handler, params, prefix) { return handler.charPosAbsolute(params); };\ncsiStateHandler['a'] = function (handler, params, prefix) { return handler.HPositionRelative(params); };\ncsiStateHandler['b'] = function (handler, params, prefix) { return handler.repeatPrecedingCharacter(params); };\ncsiStateHandler['c'] = function (handler, params, prefix) { return handler.sendDeviceAttributes(params); };\ncsiStateHandler['d'] = function (handler, params, prefix) { return handler.linePosAbsolute(params); };\ncsiStateHandler['e'] = function (handler, params, prefix) { return handler.VPositionRelative(params); };\ncsiStateHandler['f'] = function (handler, params, prefix) { return handler.HVPosition(params); };\ncsiStateHandler['g'] = function (handler, params, prefix) { return handler.tabClear(params); };\ncsiStateHandler['h'] = function (handler, params, prefix) { return handler.setMode(params); };\ncsiStateHandler['l'] = function (handler, params, prefix) { return handler.resetMode(params); };\ncsiStateHandler['m'] = function (handler, params, prefix) { return handler.charAttributes(params); };\ncsiStateHandler['n'] = function (handler, params, prefix) { return handler.deviceStatus(params); };\ncsiStateHandler['p'] = function (handler, params, prefix) {\n switch (prefix) {\n case '!':\n handler.softReset(params);\n break;\n }\n};\ncsiStateHandler['q'] = function (handler, params, prefix, postfix) {\n if (postfix === ' ') {\n handler.setCursorStyle(params);\n }\n};\ncsiStateHandler['r'] = function (handler, params) { return handler.setScrollRegion(params); };\ncsiStateHandler['s'] = function (handler, params) { return handler.saveCursor(params); };\ncsiStateHandler['u'] = function (handler, params) { return handler.restoreCursor(params); };\ncsiStateHandler[EscapeSequences_1.C0.CAN] = function (handler, params, prefix, postfix, parser) { return parser.setState(ParserState.NORMAL); };\nvar ParserState;\n(function (ParserState) {\n ParserState[ParserState[\"NORMAL\"] = 0] = \"NORMAL\";\n ParserState[ParserState[\"ESCAPED\"] = 1] = \"ESCAPED\";\n ParserState[ParserState[\"CSI_PARAM\"] = 2] = \"CSI_PARAM\";\n ParserState[ParserState[\"CSI\"] = 3] = \"CSI\";\n ParserState[ParserState[\"OSC\"] = 4] = \"OSC\";\n ParserState[ParserState[\"CHARSET\"] = 5] = \"CHARSET\";\n ParserState[ParserState[\"DCS\"] = 6] = \"DCS\";\n ParserState[ParserState[\"IGNORE\"] = 7] = \"IGNORE\";\n})(ParserState || (ParserState = {}));\nvar Parser = (function () {\n function Parser(_inputHandler, _terminal) {\n this._inputHandler = _inputHandler;\n this._terminal = _terminal;\n this._state = ParserState.NORMAL;\n }\n Parser.prototype.parse = function (data) {\n var l = data.length, j, cs, ch, code, low;\n this._position = 0;\n if (this._terminal.surrogate_high) {\n data = this._terminal.surrogate_high + data;\n this._terminal.surrogate_high = '';\n }\n for (; this._position < l; this._position++) {\n ch = data[this._position];\n code = data.charCodeAt(this._position);\n if (0xD800 <= code && code <= 0xDBFF) {\n low = data.charCodeAt(this._position + 1);\n if (isNaN(low)) {\n this._terminal.surrogate_high = ch;\n continue;\n }\n code = ((code - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n ch += data.charAt(this._position + 1);\n }\n if (0xDC00 <= code && code <= 0xDFFF)\n continue;\n switch (this._state) {\n case ParserState.NORMAL:\n if (ch in normalStateHandler) {\n normalStateHandler[ch](this, this._inputHandler);\n }\n else {\n this._inputHandler.addChar(ch, code);\n }\n break;\n case ParserState.ESCAPED:\n if (ch in escapedStateHandler) {\n escapedStateHandler[ch](this, this._terminal);\n break;\n }\n switch (ch) {\n case '(':\n case ')':\n case '*':\n case '+':\n case '-':\n case '.':\n switch (ch) {\n case '(':\n this._terminal.gcharset = 0;\n break;\n case ')':\n this._terminal.gcharset = 1;\n break;\n case '*':\n this._terminal.gcharset = 2;\n break;\n case '+':\n this._terminal.gcharset = 3;\n break;\n case '-':\n this._terminal.gcharset = 1;\n break;\n case '.':\n this._terminal.gcharset = 2;\n break;\n }\n this._state = ParserState.CHARSET;\n break;\n case '/':\n this._terminal.gcharset = 3;\n this._state = ParserState.CHARSET;\n this._position--;\n break;\n case 'N':\n break;\n case 'O':\n break;\n case 'n':\n this._terminal.setgLevel(2);\n break;\n case 'o':\n this._terminal.setgLevel(3);\n break;\n case '|':\n this._terminal.setgLevel(3);\n break;\n case '}':\n this._terminal.setgLevel(2);\n break;\n case '~':\n this._terminal.setgLevel(1);\n break;\n case '7':\n this._inputHandler.saveCursor();\n this._state = ParserState.NORMAL;\n break;\n case '8':\n this._inputHandler.restoreCursor();\n this._state = ParserState.NORMAL;\n break;\n case '#':\n this._state = ParserState.NORMAL;\n this._position++;\n break;\n case 'H':\n this._terminal.tabSet();\n this._state = ParserState.NORMAL;\n break;\n case '=':\n this._terminal.log('Serial port requested application keypad.');\n this._terminal.applicationKeypad = true;\n this._terminal.viewport.syncScrollArea();\n this._state = ParserState.NORMAL;\n break;\n case '>':\n this._terminal.log('Switching back to normal keypad.');\n this._terminal.applicationKeypad = false;\n this._terminal.viewport.syncScrollArea();\n this._state = ParserState.NORMAL;\n break;\n default:\n this._state = ParserState.NORMAL;\n this._terminal.error('Unknown ESC control: %s.', ch);\n break;\n }\n break;\n case ParserState.CHARSET:\n if (ch in Charsets_1.CHARSETS) {\n cs = Charsets_1.CHARSETS[ch];\n if (ch === '/') {\n this.skipNextChar();\n }\n }\n else {\n cs = Charsets_1.DEFAULT_CHARSET;\n }\n this._terminal.setgCharset(this._terminal.gcharset, cs);\n this._terminal.gcharset = null;\n this._state = ParserState.NORMAL;\n break;\n case ParserState.OSC:\n if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) {\n if (ch === EscapeSequences_1.C0.ESC)\n this._position++;\n this._terminal.params.push(this._terminal.currentParam);\n switch (this._terminal.params[0]) {\n case 0:\n case 1:\n case 2:\n if (this._terminal.params[1]) {\n this._terminal.title = this._terminal.params[1];\n this._terminal.handleTitle(this._terminal.title);\n }\n break;\n case 3:\n break;\n case 4:\n case 5:\n break;\n case 10:\n case 11:\n case 12:\n case 13:\n case 14:\n case 15:\n case 16:\n case 17:\n case 18:\n case 19:\n break;\n case 46:\n break;\n case 50:\n break;\n case 51:\n break;\n case 52:\n break;\n case 104:\n case 105:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n break;\n }\n this._terminal.params = [];\n this._terminal.currentParam = 0;\n this._state = ParserState.NORMAL;\n }\n else {\n if (!this._terminal.params.length) {\n if (ch >= '0' && ch <= '9') {\n this._terminal.currentParam =\n this._terminal.currentParam * 10 + ch.charCodeAt(0) - 48;\n }\n else if (ch === ';') {\n this._terminal.params.push(this._terminal.currentParam);\n this._terminal.currentParam = '';\n }\n }\n else {\n this._terminal.currentParam += ch;\n }\n }\n break;\n case ParserState.CSI_PARAM:\n if (ch in csiParamStateHandler) {\n csiParamStateHandler[ch](this);\n break;\n }\n this.finalizeParam();\n this._state = ParserState.CSI;\n case ParserState.CSI:\n if (ch in csiStateHandler) {\n csiStateHandler[ch](this._inputHandler, this._terminal.params, this._terminal.prefix, this._terminal.postfix, this);\n }\n else {\n this._terminal.error('Unknown CSI code: %s.', ch);\n }\n this._state = ParserState.NORMAL;\n this._terminal.prefix = '';\n this._terminal.postfix = '';\n break;\n case ParserState.DCS:\n if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) {\n if (ch === EscapeSequences_1.C0.ESC)\n this._position++;\n var pt = void 0;\n var valid = void 0;\n switch (this._terminal.prefix) {\n case '':\n break;\n case '$q':\n pt = this._terminal.currentParam;\n valid = false;\n switch (pt) {\n case '\"q':\n pt = '0\"q';\n break;\n case '\"p':\n pt = '61\"p';\n break;\n case 'r':\n pt = ''\n + (this._terminal.scrollTop + 1)\n + ';'\n + (this._terminal.scrollBottom + 1)\n + 'r';\n break;\n case 'm':\n pt = '0m';\n break;\n default:\n this._terminal.error('Unknown DCS Pt: %s.', pt);\n pt = '';\n break;\n }\n this._terminal.send(EscapeSequences_1.C0.ESC + 'P' + +valid + '$r' + pt + EscapeSequences_1.C0.ESC + '\\\\');\n break;\n case '+p':\n break;\n case '+q':\n pt = this._terminal.currentParam;\n valid = false;\n this._terminal.send(EscapeSequences_1.C0.ESC + 'P' + +valid + '+r' + pt + EscapeSequences_1.C0.ESC + '\\\\');\n break;\n default:\n this._terminal.error('Unknown DCS prefix: %s.', this._terminal.prefix);\n break;\n }\n this._terminal.currentParam = 0;\n this._terminal.prefix = '';\n this._state = ParserState.NORMAL;\n }\n else if (!this._terminal.currentParam) {\n if (!this._terminal.prefix && ch !== '$' && ch !== '+') {\n this._terminal.currentParam = ch;\n }\n else if (this._terminal.prefix.length === 2) {\n this._terminal.currentParam = ch;\n }\n else {\n this._terminal.prefix += ch;\n }\n }\n else {\n this._terminal.currentParam += ch;\n }\n break;\n case ParserState.IGNORE:\n if (ch === EscapeSequences_1.C0.ESC || ch === EscapeSequences_1.C0.BEL) {\n if (ch === EscapeSequences_1.C0.ESC)\n this._position++;\n this._state = ParserState.NORMAL;\n }\n break;\n }\n }\n return this._state;\n };\n Parser.prototype.setState = function (state) {\n this._state = state;\n };\n Parser.prototype.setPrefix = function (prefix) {\n this._terminal.prefix = prefix;\n };\n Parser.prototype.setPostfix = function (postfix) {\n this._terminal.postfix = postfix;\n };\n Parser.prototype.setParam = function (param) {\n this._terminal.currentParam = param;\n };\n Parser.prototype.getParam = function () {\n return this._terminal.currentParam;\n };\n Parser.prototype.finalizeParam = function () {\n this._terminal.params.push(this._terminal.currentParam);\n this._terminal.currentParam = 0;\n };\n Parser.prototype.skipNextChar = function () {\n this._position++;\n };\n return Parser;\n}());\nexports.Parser = Parser;\n\n//# sourceMappingURL=Parser.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Parser.js\n// module id = 19\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar DomElementObjectPool_1 = require(\"./utils/DomElementObjectPool\");\nvar MAX_REFRESH_FRAME_SKIP = 5;\nvar FLAGS;\n(function (FLAGS) {\n FLAGS[FLAGS[\"BOLD\"] = 1] = \"BOLD\";\n FLAGS[FLAGS[\"UNDERLINE\"] = 2] = \"UNDERLINE\";\n FLAGS[FLAGS[\"BLINK\"] = 4] = \"BLINK\";\n FLAGS[FLAGS[\"INVERSE\"] = 8] = \"INVERSE\";\n FLAGS[FLAGS[\"INVISIBLE\"] = 16] = \"INVISIBLE\";\n})(FLAGS || (FLAGS = {}));\n;\nvar brokenBold = null;\nvar Renderer = (function () {\n function Renderer(_terminal) {\n this._terminal = _terminal;\n this._refreshRowsQueue = [];\n this._refreshFramesSkipped = 0;\n this._refreshAnimationFrame = null;\n this._spanElementObjectPool = new DomElementObjectPool_1.DomElementObjectPool('span');\n if (brokenBold === null) {\n brokenBold = checkBoldBroken(this._terminal.element);\n }\n this._spanElementObjectPool = new DomElementObjectPool_1.DomElementObjectPool('span');\n }\n Renderer.prototype.queueRefresh = function (start, end) {\n this._refreshRowsQueue.push({ start: start, end: end });\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = window.requestAnimationFrame(this._refreshLoop.bind(this));\n }\n };\n Renderer.prototype._refreshLoop = function () {\n var skipFrame = this._terminal.writeBuffer.length > 0 && this._refreshFramesSkipped++ <= MAX_REFRESH_FRAME_SKIP;\n if (skipFrame) {\n this._refreshAnimationFrame = window.requestAnimationFrame(this._refreshLoop.bind(this));\n return;\n }\n this._refreshFramesSkipped = 0;\n var start;\n var end;\n if (this._refreshRowsQueue.length > 4) {\n start = 0;\n end = this._terminal.rows - 1;\n }\n else {\n start = this._refreshRowsQueue[0].start;\n end = this._refreshRowsQueue[0].end;\n for (var i = 1; i < this._refreshRowsQueue.length; i++) {\n if (this._refreshRowsQueue[i].start < start) {\n start = this._refreshRowsQueue[i].start;\n }\n if (this._refreshRowsQueue[i].end > end) {\n end = this._refreshRowsQueue[i].end;\n }\n }\n }\n this._refreshRowsQueue = [];\n this._refreshAnimationFrame = null;\n this._refresh(start, end);\n };\n Renderer.prototype._refresh = function (start, end) {\n var parent;\n if (end - start >= this._terminal.rows / 2) {\n parent = this._terminal.element.parentNode;\n if (parent) {\n this._terminal.element.removeChild(this._terminal.rowContainer);\n }\n }\n var width = this._terminal.cols;\n var y = start;\n if (end >= this._terminal.rows) {\n this._terminal.log('`end` is too large. Most likely a bad CSR.');\n end = this._terminal.rows - 1;\n }\n for (; y <= end; y++) {\n var row = y + this._terminal.ydisp;\n var line = this._terminal.lines.get(row);\n var x = void 0;\n if (this._terminal.y === y - (this._terminal.ybase - this._terminal.ydisp) &&\n this._terminal.cursorState &&\n !this._terminal.cursorHidden) {\n x = this._terminal.x;\n }\n else {\n x = -1;\n }\n var attr = this._terminal.defAttr;\n var documentFragment = document.createDocumentFragment();\n var innerHTML = '';\n var currentElement = void 0;\n while (this._terminal.children[y].children.length) {\n var child = this._terminal.children[y].children[0];\n this._terminal.children[y].removeChild(child);\n this._spanElementObjectPool.release(child);\n }\n for (var i = 0; i < width; i++) {\n var data = line[i][0];\n var ch = line[i][1];\n var ch_width = line[i][2];\n if (!ch_width) {\n continue;\n }\n if (i === x) {\n data = -1;\n }\n if (data !== attr) {\n if (attr !== this._terminal.defAttr) {\n if (innerHTML) {\n currentElement.innerHTML = innerHTML;\n innerHTML = '';\n }\n documentFragment.appendChild(currentElement);\n currentElement = null;\n }\n if (data !== this._terminal.defAttr) {\n if (innerHTML && !currentElement) {\n currentElement = this._spanElementObjectPool.acquire();\n }\n if (currentElement) {\n if (innerHTML) {\n currentElement.innerHTML = innerHTML;\n innerHTML = '';\n }\n documentFragment.appendChild(currentElement);\n }\n currentElement = this._spanElementObjectPool.acquire();\n if (data === -1) {\n currentElement.classList.add('reverse-video');\n currentElement.classList.add('terminal-cursor');\n }\n else {\n var bg = data & 0x1ff;\n var fg = (data >> 9) & 0x1ff;\n var flags = data >> 18;\n if (flags & FLAGS.BOLD) {\n if (!brokenBold) {\n currentElement.classList.add('xterm-bold');\n }\n if (fg < 8) {\n fg += 8;\n }\n }\n if (flags & FLAGS.UNDERLINE) {\n currentElement.classList.add('xterm-underline');\n }\n if (flags & FLAGS.BLINK) {\n currentElement.classList.add('xterm-blink');\n }\n if (flags & FLAGS.INVERSE) {\n var temp = bg;\n bg = fg;\n fg = temp;\n if ((flags & 1) && fg < 8) {\n fg += 8;\n }\n }\n if (flags & FLAGS.INVISIBLE) {\n currentElement.classList.add('xterm-hidden');\n }\n if (flags & FLAGS.INVERSE) {\n if (bg === 257) {\n bg = 15;\n }\n if (fg === 256) {\n fg = 0;\n }\n }\n if (bg < 256) {\n currentElement.classList.add(\"xterm-bg-color-\" + bg);\n }\n if (fg < 256) {\n currentElement.classList.add(\"xterm-color-\" + fg);\n }\n }\n }\n }\n if (ch_width === 2) {\n innerHTML += \"\" + ch + \"\";\n }\n else if (ch.charCodeAt(0) > 255) {\n innerHTML += \"\" + ch + \"\";\n }\n else {\n switch (ch) {\n case '&':\n innerHTML += '&';\n break;\n case '<':\n innerHTML += '<';\n break;\n case '>':\n innerHTML += '>';\n break;\n default:\n if (ch <= ' ') {\n innerHTML += ' ';\n }\n else {\n innerHTML += ch;\n }\n break;\n }\n }\n attr = data;\n }\n if (innerHTML && !currentElement) {\n currentElement = this._spanElementObjectPool.acquire();\n }\n if (currentElement) {\n if (innerHTML) {\n currentElement.innerHTML = innerHTML;\n innerHTML = '';\n }\n documentFragment.appendChild(currentElement);\n currentElement = null;\n }\n this._terminal.children[y].appendChild(documentFragment);\n }\n if (parent) {\n this._terminal.element.appendChild(this._terminal.rowContainer);\n }\n this._terminal.emit('refresh', { element: this._terminal.element, start: start, end: end });\n };\n ;\n Renderer.prototype.refreshSelection = function (start, end) {\n while (this._terminal.selectionContainer.children.length) {\n this._terminal.selectionContainer.removeChild(this._terminal.selectionContainer.children[0]);\n }\n if (!start || !end) {\n return;\n }\n var viewportStartRow = start[1] - this._terminal.ydisp;\n var viewportEndRow = end[1] - this._terminal.ydisp;\n var viewportCappedStartRow = Math.max(viewportStartRow, 0);\n var viewportCappedEndRow = Math.min(viewportEndRow, this._terminal.rows - 1);\n if (viewportCappedStartRow >= this._terminal.rows || viewportCappedEndRow < 0) {\n return;\n }\n var documentFragment = document.createDocumentFragment();\n var startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n var endCol = viewportCappedStartRow === viewportCappedEndRow ? end[0] : this._terminal.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow, startCol, endCol));\n var middleRowsCount = viewportCappedEndRow - viewportCappedStartRow - 1;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._terminal.cols, middleRowsCount));\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n var endCol_1 = viewportEndRow === viewportCappedEndRow ? end[0] : this._terminal.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, endCol_1));\n }\n this._terminal.selectionContainer.appendChild(documentFragment);\n };\n Renderer.prototype._createSelectionElement = function (row, colStart, colEnd, rowCount) {\n if (rowCount === void 0) { rowCount = 1; }\n var element = document.createElement('div');\n element.style.height = rowCount * this._terminal.charMeasure.height + \"px\";\n element.style.top = row * this._terminal.charMeasure.height + \"px\";\n element.style.left = colStart * this._terminal.charMeasure.width + \"px\";\n element.style.width = this._terminal.charMeasure.width * (colEnd - colStart) + \"px\";\n return element;\n };\n return Renderer;\n}());\nexports.Renderer = Renderer;\nfunction checkBoldBroken(terminal) {\n var document = terminal.ownerDocument;\n var el = document.createElement('span');\n el.innerHTML = 'hello world';\n terminal.appendChild(el);\n var w1 = el.offsetWidth;\n var h1 = el.offsetHeight;\n el.style.fontWeight = 'bold';\n var w2 = el.offsetWidth;\n var h2 = el.offsetHeight;\n terminal.removeChild(el);\n return w1 !== w2 || h1 !== h2;\n}\n\n//# sourceMappingURL=Renderer.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Renderer.js\n// module id = 20\n// module chunks = 0","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Mouse = require(\"./utils/Mouse\");\nvar Browser = require(\"./utils/Browser\");\nvar EventEmitter_1 = require(\"./EventEmitter\");\nvar SelectionModel_1 = require(\"./SelectionModel\");\nvar DRAG_SCROLL_MAX_THRESHOLD = 50;\nvar DRAG_SCROLL_MAX_SPEED = 15;\nvar DRAG_SCROLL_INTERVAL = 50;\nvar CLEAR_MOUSE_DOWN_TIME = 400;\nvar CLEAR_MOUSE_DISTANCE = 10;\nvar WORD_SEPARATORS = ' ()[]{}\\'\"';\nvar LINE_DATA_CHAR_INDEX = 1;\nvar LINE_DATA_WIDTH_INDEX = 2;\nvar NON_BREAKING_SPACE_CHAR = String.fromCharCode(160);\nvar ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g');\nvar SelectionMode;\n(function (SelectionMode) {\n SelectionMode[SelectionMode[\"NORMAL\"] = 0] = \"NORMAL\";\n SelectionMode[SelectionMode[\"WORD\"] = 1] = \"WORD\";\n SelectionMode[SelectionMode[\"LINE\"] = 2] = \"LINE\";\n})(SelectionMode || (SelectionMode = {}));\nvar SelectionManager = (function (_super) {\n __extends(SelectionManager, _super);\n function SelectionManager(_terminal, _buffer, _rowContainer, _charMeasure) {\n var _this = _super.call(this) || this;\n _this._terminal = _terminal;\n _this._buffer = _buffer;\n _this._rowContainer = _rowContainer;\n _this._charMeasure = _charMeasure;\n _this._initListeners();\n _this.enable();\n _this._model = new SelectionModel_1.SelectionModel(_terminal);\n _this._lastMouseDownTime = 0;\n _this._activeSelectionMode = SelectionMode.NORMAL;\n return _this;\n }\n SelectionManager.prototype._initListeners = function () {\n var _this = this;\n this._bufferTrimListener = function (amount) { return _this._onTrim(amount); };\n this._mouseMoveListener = function (event) { return _this._onMouseMove(event); };\n this._mouseDownListener = function (event) { return _this._onMouseDown(event); };\n this._mouseUpListener = function (event) { return _this._onMouseUp(event); };\n };\n SelectionManager.prototype.disable = function () {\n this.clearSelection();\n this._buffer.off('trim', this._bufferTrimListener);\n this._rowContainer.removeEventListener('mousedown', this._mouseDownListener);\n };\n SelectionManager.prototype.enable = function () {\n this._buffer.on('trim', this._bufferTrimListener);\n this._rowContainer.addEventListener('mousedown', this._mouseDownListener);\n };\n SelectionManager.prototype.setBuffer = function (buffer) {\n this._buffer = buffer;\n this.clearSelection();\n };\n Object.defineProperty(SelectionManager.prototype, \"hasSelection\", {\n get: function () {\n var start = this._model.finalSelectionStart;\n var end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SelectionManager.prototype, \"selectionText\", {\n get: function () {\n var start = this._model.finalSelectionStart;\n var end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return '';\n }\n var startRowEndCol = start[1] === end[1] ? end[0] : null;\n var result = [];\n result.push(this._translateBufferLineToString(this._buffer.get(start[1]), true, start[0], startRowEndCol));\n for (var i = start[1] + 1; i <= end[1] - 1; i++) {\n var bufferLine = this._buffer.get(i);\n var lineText = this._translateBufferLineToString(bufferLine, true);\n if (bufferLine.isWrapped) {\n result[result.length - 1] += lineText;\n }\n else {\n result.push(lineText);\n }\n }\n if (start[1] !== end[1]) {\n var bufferLine = this._buffer.get(end[1]);\n var lineText = this._translateBufferLineToString(bufferLine, true, 0, end[0]);\n if (bufferLine.isWrapped) {\n result[result.length - 1] += lineText;\n }\n else {\n result.push(lineText);\n }\n }\n var formattedResult = result.map(function (line) {\n return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');\n }).join(Browser.isMSWindows ? '\\r\\n' : '\\n');\n return formattedResult;\n },\n enumerable: true,\n configurable: true\n });\n SelectionManager.prototype.clearSelection = function () {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n };\n SelectionManager.prototype._translateBufferLineToString = function (line, trimRight, startCol, endCol) {\n if (startCol === void 0) { startCol = 0; }\n if (endCol === void 0) { endCol = null; }\n var lineString = '';\n var widthAdjustedStartCol = startCol;\n var widthAdjustedEndCol = endCol;\n for (var i = 0; i < line.length; i++) {\n var char = line[i];\n lineString += char[LINE_DATA_CHAR_INDEX];\n if (char[LINE_DATA_WIDTH_INDEX] === 0) {\n if (startCol >= i) {\n widthAdjustedStartCol--;\n }\n if (endCol >= i) {\n widthAdjustedEndCol--;\n }\n }\n }\n var finalEndCol = widthAdjustedEndCol || line.length;\n if (trimRight) {\n var rightWhitespaceIndex = lineString.search(/\\s+$/);\n if (rightWhitespaceIndex !== -1) {\n finalEndCol = Math.min(finalEndCol, rightWhitespaceIndex);\n }\n if (finalEndCol <= widthAdjustedStartCol) {\n return '';\n }\n }\n return lineString.substring(widthAdjustedStartCol, finalEndCol);\n };\n SelectionManager.prototype.refresh = function (isNewSelection) {\n var _this = this;\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = window.requestAnimationFrame(function () { return _this._refresh(); });\n }\n if (Browser.isLinux && isNewSelection) {\n var selectionText = this.selectionText;\n if (selectionText.length) {\n this.emit('newselection', this.selectionText);\n }\n }\n };\n SelectionManager.prototype._refresh = function () {\n this._refreshAnimationFrame = null;\n this.emit('refresh', { start: this._model.finalSelectionStart, end: this._model.finalSelectionEnd });\n };\n SelectionManager.prototype.selectAll = function () {\n this._model.isSelectAllActive = true;\n this.refresh();\n };\n SelectionManager.prototype._onTrim = function (amount) {\n var needsRefresh = this._model.onTrim(amount);\n if (needsRefresh) {\n this.refresh();\n }\n };\n SelectionManager.prototype._getMouseBufferCoords = function (event) {\n var coords = Mouse.getCoords(event, this._rowContainer, this._charMeasure, this._terminal.cols, this._terminal.rows, true);\n coords[0]--;\n coords[1]--;\n coords[1] += this._terminal.ydisp;\n return coords;\n };\n SelectionManager.prototype._getMouseEventScrollAmount = function (event) {\n var offset = Mouse.getCoordsRelativeToElement(event, this._rowContainer)[1];\n var terminalHeight = this._terminal.rows * this._charMeasure.height;\n if (offset >= 0 && offset <= terminalHeight) {\n return 0;\n }\n if (offset > terminalHeight) {\n offset -= terminalHeight;\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 SelectionManager.prototype._onMouseDown = function (event) {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n this._dragScrollAmount = 0;\n this._setMouseClickCount(event);\n if (event.shiftKey) {\n this._onShiftClick(event);\n }\n else {\n if (this._clickCount === 1) {\n this._onSingleClick(event);\n }\n else if (this._clickCount === 2) {\n this._onDoubleClick(event);\n }\n else if (this._clickCount === 3) {\n this._onTripleClick(event);\n }\n }\n this._addMouseDownListeners();\n this.refresh(true);\n };\n SelectionManager.prototype._addMouseDownListeners = function () {\n var _this = this;\n this._rowContainer.ownerDocument.addEventListener('mousemove', this._mouseMoveListener);\n this._rowContainer.ownerDocument.addEventListener('mouseup', this._mouseUpListener);\n this._dragScrollIntervalTimer = setInterval(function () { return _this._dragScroll(); }, DRAG_SCROLL_INTERVAL);\n };\n SelectionManager.prototype._removeMouseDownListeners = function () {\n this._rowContainer.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener);\n this._rowContainer.ownerDocument.removeEventListener('mouseup', this._mouseUpListener);\n clearInterval(this._dragScrollIntervalTimer);\n this._dragScrollIntervalTimer = null;\n };\n SelectionManager.prototype._onShiftClick = function (event) {\n if (this._model.selectionStart) {\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n }\n };\n SelectionManager.prototype._onSingleClick = function (event) {\n this._model.selectionStartLength = 0;\n this._model.isSelectAllActive = false;\n this._activeSelectionMode = SelectionMode.NORMAL;\n this._model.selectionStart = this._getMouseBufferCoords(event);\n if (this._model.selectionStart) {\n this._model.selectionEnd = null;\n var char = this._buffer.get(this._model.selectionStart[1])[this._model.selectionStart[0]];\n if (char[LINE_DATA_WIDTH_INDEX] === 0) {\n this._model.selectionStart[0]++;\n }\n }\n };\n SelectionManager.prototype._onDoubleClick = function (event) {\n var coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.WORD;\n this._selectWordAt(coords);\n }\n };\n SelectionManager.prototype._onTripleClick = function (event) {\n var coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.LINE;\n this._selectLineAt(coords[1]);\n }\n };\n SelectionManager.prototype._setMouseClickCount = function (event) {\n var currentTime = (new Date()).getTime();\n if (currentTime - this._lastMouseDownTime > CLEAR_MOUSE_DOWN_TIME || this._distanceFromLastMousePosition(event) > CLEAR_MOUSE_DISTANCE) {\n this._clickCount = 0;\n }\n this._lastMouseDownTime = currentTime;\n this._lastMousePosition = [event.pageX, event.pageY];\n this._clickCount++;\n };\n SelectionManager.prototype._distanceFromLastMousePosition = function (event) {\n var result = Math.max(Math.abs(this._lastMousePosition[0] - event.pageX), Math.abs(this._lastMousePosition[1] - event.pageY));\n return result;\n };\n SelectionManager.prototype._onMouseMove = function (event) {\n var previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n if (this._activeSelectionMode === SelectionMode.LINE) {\n if (this._model.selectionEnd[1] < this._model.selectionStart[1]) {\n this._model.selectionEnd[0] = 0;\n }\n else {\n this._model.selectionEnd[0] = this._terminal.cols;\n }\n }\n else if (this._activeSelectionMode === SelectionMode.WORD) {\n this._selectToWordAt(this._model.selectionEnd);\n }\n this._dragScrollAmount = this._getMouseEventScrollAmount(event);\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd[0] = this._terminal.cols - 1;\n }\n else if (this._dragScrollAmount < 0) {\n this._model.selectionEnd[0] = 0;\n }\n if (this._model.selectionEnd[1] < this._buffer.length) {\n var char = this._buffer.get(this._model.selectionEnd[1])[this._model.selectionEnd[0]];\n if (char && char[2] === 0) {\n this._model.selectionEnd[0]++;\n }\n }\n if (!previousSelectionEnd ||\n previousSelectionEnd[0] !== this._model.selectionEnd[0] ||\n previousSelectionEnd[1] !== this._model.selectionEnd[1]) {\n this.refresh(true);\n }\n };\n SelectionManager.prototype._dragScroll = function () {\n if (this._dragScrollAmount) {\n this._terminal.scrollDisp(this._dragScrollAmount, false);\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd = [this._terminal.cols - 1, this._terminal.ydisp + this._terminal.rows];\n }\n else {\n this._model.selectionEnd = [0, this._terminal.ydisp];\n }\n this.refresh();\n }\n };\n SelectionManager.prototype._onMouseUp = function (event) {\n this._removeMouseDownListeners();\n };\n SelectionManager.prototype._convertViewportColToCharacterIndex = function (bufferLine, coords) {\n var charIndex = coords[0];\n for (var i = 0; coords[0] >= i; i++) {\n var char = bufferLine[i];\n if (char[LINE_DATA_WIDTH_INDEX] === 0) {\n charIndex--;\n }\n }\n return charIndex;\n };\n SelectionManager.prototype._getWordAt = function (coords) {\n var bufferLine = this._buffer.get(coords[1]);\n var line = this._translateBufferLineToString(bufferLine, false);\n var endIndex = this._convertViewportColToCharacterIndex(bufferLine, coords);\n var startIndex = endIndex;\n var charOffset = coords[0] - startIndex;\n var leftWideCharCount = 0;\n var rightWideCharCount = 0;\n if (line.charAt(startIndex) === ' ') {\n while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') {\n startIndex--;\n }\n while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') {\n endIndex++;\n }\n }\n else {\n var startCol = coords[0];\n var endCol = coords[0];\n if (bufferLine[startCol][LINE_DATA_WIDTH_INDEX] === 0) {\n leftWideCharCount++;\n startCol--;\n }\n if (bufferLine[endCol][LINE_DATA_WIDTH_INDEX] === 2) {\n rightWideCharCount++;\n endCol++;\n }\n while (startIndex > 0 && !this._isCharWordSeparator(line.charAt(startIndex - 1))) {\n if (bufferLine[startCol - 1][LINE_DATA_WIDTH_INDEX] === 0) {\n leftWideCharCount++;\n startCol--;\n }\n startIndex--;\n startCol--;\n }\n while (endIndex + 1 < line.length && !this._isCharWordSeparator(line.charAt(endIndex + 1))) {\n if (bufferLine[endCol + 1][LINE_DATA_WIDTH_INDEX] === 2) {\n rightWideCharCount++;\n endCol++;\n }\n endIndex++;\n endCol++;\n }\n }\n var start = startIndex + charOffset - leftWideCharCount;\n var length = Math.min(endIndex - startIndex + leftWideCharCount + rightWideCharCount + 1, this._terminal.cols);\n return { start: start, length: length };\n };\n SelectionManager.prototype._selectWordAt = function (coords) {\n var wordPosition = this._getWordAt(coords);\n this._model.selectionStart = [wordPosition.start, coords[1]];\n this._model.selectionStartLength = wordPosition.length;\n };\n SelectionManager.prototype._selectToWordAt = function (coords) {\n var wordPosition = this._getWordAt(coords);\n this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : (wordPosition.start + wordPosition.length), coords[1]];\n };\n SelectionManager.prototype._isCharWordSeparator = function (char) {\n return WORD_SEPARATORS.indexOf(char) >= 0;\n };\n SelectionManager.prototype._selectLineAt = function (line) {\n this._model.selectionStart = [0, line];\n this._model.selectionStartLength = this._terminal.cols;\n };\n return SelectionManager;\n}(EventEmitter_1.EventEmitter));\nexports.SelectionManager = SelectionManager;\n\n//# sourceMappingURL=SelectionManager.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/SelectionManager.js\n// module id = 21\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar SelectionModel = (function () {\n function SelectionModel(_terminal) {\n this._terminal = _terminal;\n this.clearSelection();\n }\n SelectionModel.prototype.clearSelection = function () {\n this.selectionStart = null;\n this.selectionEnd = null;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n };\n Object.defineProperty(SelectionModel.prototype, \"finalSelectionStart\", {\n get: function () {\n if (this.isSelectAllActive) {\n return [0, 0];\n }\n if (!this.selectionEnd || !this.selectionStart) {\n return this.selectionStart;\n }\n return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SelectionModel.prototype, \"finalSelectionEnd\", {\n get: function () {\n if (this.isSelectAllActive) {\n return [this._terminal.cols, this._terminal.ybase + this._terminal.rows - 1];\n }\n if (!this.selectionStart) {\n return null;\n }\n if (!this.selectionEnd || this.areSelectionValuesReversed()) {\n return [this.selectionStart[0] + this.selectionStartLength, this.selectionStart[1]];\n }\n if (this.selectionStartLength) {\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 enumerable: true,\n configurable: true\n });\n SelectionModel.prototype.areSelectionValuesReversed = function () {\n var start = this.selectionStart;\n var end = this.selectionEnd;\n return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);\n };\n SelectionModel.prototype.onTrim = function (amount) {\n if (this.selectionStart) {\n this.selectionStart[1] -= amount;\n }\n if (this.selectionEnd) {\n this.selectionEnd[1] -= amount;\n }\n if (this.selectionEnd && this.selectionEnd[1] < 0) {\n this.clearSelection();\n return true;\n }\n if (this.selectionStart && this.selectionStart[1] < 0) {\n this.selectionStart[1] = 0;\n }\n return false;\n };\n return SelectionModel;\n}());\nexports.SelectionModel = SelectionModel;\n\n//# sourceMappingURL=SelectionModel.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/SelectionModel.js\n// module id = 22\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Viewport = (function () {\n function Viewport(terminal, viewportElement, scrollArea, charMeasure) {\n var _this = this;\n this.terminal = terminal;\n this.viewportElement = viewportElement;\n this.scrollArea = scrollArea;\n this.charMeasure = charMeasure;\n this.currentRowHeight = 0;\n this.lastRecordedBufferLength = 0;\n this.lastRecordedViewportHeight = 0;\n this.terminal.on('scroll', this.syncScrollArea.bind(this));\n this.terminal.on('resize', this.syncScrollArea.bind(this));\n this.viewportElement.addEventListener('scroll', this.onScroll.bind(this));\n setTimeout(function () { return _this.syncScrollArea(); }, 0);\n }\n Viewport.prototype.refresh = function () {\n if (this.charMeasure.height > 0) {\n var rowHeightChanged = this.charMeasure.height !== this.currentRowHeight;\n if (rowHeightChanged) {\n this.currentRowHeight = this.charMeasure.height;\n this.viewportElement.style.lineHeight = this.charMeasure.height + 'px';\n this.terminal.rowContainer.style.lineHeight = this.charMeasure.height + 'px';\n }\n var viewportHeightChanged = this.lastRecordedViewportHeight !== this.terminal.rows;\n if (rowHeightChanged || viewportHeightChanged) {\n this.lastRecordedViewportHeight = this.terminal.rows;\n this.viewportElement.style.height = this.charMeasure.height * this.terminal.rows + 'px';\n this.terminal.selectionContainer.style.height = this.viewportElement.style.height;\n }\n this.scrollArea.style.height = (this.charMeasure.height * this.lastRecordedBufferLength) + 'px';\n }\n };\n Viewport.prototype.syncScrollArea = function () {\n if (this.lastRecordedBufferLength !== this.terminal.lines.length) {\n this.lastRecordedBufferLength = this.terminal.lines.length;\n this.refresh();\n }\n else if (this.lastRecordedViewportHeight !== this.terminal.rows) {\n this.refresh();\n }\n else {\n if (this.charMeasure.height !== this.currentRowHeight) {\n this.refresh();\n }\n }\n var scrollTop = this.terminal.ydisp * this.currentRowHeight;\n if (this.viewportElement.scrollTop !== scrollTop) {\n this.viewportElement.scrollTop = scrollTop;\n }\n };\n Viewport.prototype.onScroll = function (ev) {\n var newRow = Math.round(this.viewportElement.scrollTop / this.currentRowHeight);\n var diff = newRow - this.terminal.ydisp;\n this.terminal.scrollDisp(diff, true);\n };\n Viewport.prototype.onWheel = function (ev) {\n if (ev.deltaY === 0) {\n return;\n }\n var multiplier = 1;\n if (ev.deltaMode === WheelEvent.DOM_DELTA_LINE) {\n multiplier = this.currentRowHeight;\n }\n else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n multiplier = this.currentRowHeight * this.terminal.rows;\n }\n this.viewportElement.scrollTop += ev.deltaY * multiplier;\n ev.preventDefault();\n };\n ;\n Viewport.prototype.onTouchStart = function (ev) {\n this.lastTouchY = ev.touches[0].pageY;\n };\n ;\n Viewport.prototype.onTouchMove = function (ev) {\n var deltaY = this.lastTouchY - ev.touches[0].pageY;\n this.lastTouchY = ev.touches[0].pageY;\n if (deltaY === 0) {\n return;\n }\n this.viewportElement.scrollTop += deltaY;\n ev.preventDefault();\n };\n ;\n return Viewport;\n}());\nexports.Viewport = Viewport;\n\n//# sourceMappingURL=Viewport.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/Viewport.js\n// module id = 23\n// module chunks = 0","var map = {\n\t\"./attach/attach\": 4,\n\t\"./attach/attach.js\": 4,\n\t\"./attach/package.json\": 25,\n\t\"./fit/fit\": 5,\n\t\"./fit/fit.js\": 5,\n\t\"./fit/package.json\": 26,\n\t\"./fullscreen/fullscreen\": 6,\n\t\"./fullscreen/fullscreen.css\": 27,\n\t\"./fullscreen/fullscreen.js\": 6,\n\t\"./fullscreen/package.json\": 28,\n\t\"./terminado/package.json\": 29,\n\t\"./terminado/terminado\": 7,\n\t\"./terminado/terminado.js\": 7\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number or string\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 24;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons ^\\.\\/.*$\n// module id = 24\n// module chunks = 0","module.exports = {\"name\":\"xterm.attach\",\"main\":\"attach.js\",\"private\":true}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/attach/package.json\n// module id = 25\n// module chunks = 0","module.exports = {\"name\":\"xterm.fit\",\"main\":\"fit.js\",\"private\":true}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/fit/package.json\n// module id = 26\n// module chunks = 0","module.exports = {\"name\":\"xterm.fullscreen\",\"main\":\"fullscreen.js\",\"private\":true}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/fullscreen/package.json\n// module id = 28\n// module chunks = 0","module.exports = {\"name\":\"xterm.terminado\",\"main\":\"terminado.js\",\"private\":true}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/addons/terminado/package.json\n// module id = 29\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction prepareTextForTerminal(text, isMSWindows) {\n if (isMSWindows) {\n return text.replace(/\\r?\\n/g, '\\r');\n }\n return text;\n}\nexports.prepareTextForTerminal = prepareTextForTerminal;\nfunction copyHandler(ev, term, selectionManager) {\n if (term.browser.isMSIE) {\n window.clipboardData.setData('Text', selectionManager.selectionText);\n }\n else {\n ev.clipboardData.setData('text/plain', selectionManager.selectionText);\n }\n ev.preventDefault();\n}\nexports.copyHandler = copyHandler;\nfunction pasteHandler(ev, term) {\n ev.stopPropagation();\n var text;\n var dispatchPaste = function (text) {\n text = prepareTextForTerminal(text, term.browser.isMSWindows);\n term.handler(text);\n term.textarea.value = '';\n term.emit('paste', text);\n return term.cancel(ev);\n };\n if (term.browser.isMSIE) {\n if (window.clipboardData) {\n text = window.clipboardData.getData('Text');\n dispatchPaste(text);\n }\n }\n else {\n if (ev.clipboardData) {\n text = ev.clipboardData.getData('text/plain');\n dispatchPaste(text);\n }\n }\n}\nexports.pasteHandler = pasteHandler;\nfunction moveTextAreaUnderMouseCursor(ev, textarea) {\n textarea.style.position = 'fixed';\n textarea.style.width = '20px';\n textarea.style.height = '20px';\n textarea.style.left = (ev.clientX - 10) + 'px';\n textarea.style.top = (ev.clientY - 10) + 'px';\n textarea.style.zIndex = '1000';\n textarea.focus();\n setTimeout(function () {\n textarea.style.position = null;\n textarea.style.width = null;\n textarea.style.height = null;\n textarea.style.left = null;\n textarea.style.top = null;\n textarea.style.zIndex = null;\n }, 4);\n}\nexports.moveTextAreaUnderMouseCursor = moveTextAreaUnderMouseCursor;\nfunction rightClickHandler(ev, textarea, selectionManager) {\n moveTextAreaUnderMouseCursor(ev, textarea);\n textarea.value = selectionManager.selectionText;\n textarea.select();\n}\nexports.rightClickHandler = rightClickHandler;\n\n//# sourceMappingURL=Clipboard.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/handlers/Clipboard.js\n// module id = 30\n// module chunks = 0","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EventEmitter_js_1 = require(\"../EventEmitter.js\");\nvar CharMeasure = (function (_super) {\n __extends(CharMeasure, _super);\n function CharMeasure(document, parentElement) {\n var _this = _super.call(this) || this;\n _this._document = document;\n _this._parentElement = parentElement;\n return _this;\n }\n Object.defineProperty(CharMeasure.prototype, \"width\", {\n get: function () {\n return this._width;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CharMeasure.prototype, \"height\", {\n get: function () {\n return this._height;\n },\n enumerable: true,\n configurable: true\n });\n CharMeasure.prototype.measure = function () {\n var _this = this;\n if (!this._measureElement) {\n this._measureElement = this._document.createElement('span');\n this._measureElement.style.position = 'absolute';\n this._measureElement.style.top = '0';\n this._measureElement.style.left = '-9999em';\n this._measureElement.textContent = 'W';\n this._measureElement.setAttribute('aria-hidden', 'true');\n this._parentElement.appendChild(this._measureElement);\n setTimeout(function () { return _this._doMeasure(); }, 0);\n }\n else {\n this._doMeasure();\n }\n };\n CharMeasure.prototype._doMeasure = function () {\n var geometry = this._measureElement.getBoundingClientRect();\n if (geometry.width === 0 || geometry.height === 0) {\n return;\n }\n if (this._width !== geometry.width || this._height !== geometry.height) {\n this._width = geometry.width;\n this._height = geometry.height;\n this.emit('charsizechanged');\n }\n };\n return CharMeasure;\n}(EventEmitter_js_1.EventEmitter));\nexports.CharMeasure = CharMeasure;\n\n//# sourceMappingURL=CharMeasure.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/CharMeasure.js\n// module id = 31\n// module chunks = 0","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar EventEmitter_1 = require(\"../EventEmitter\");\nvar CircularList = (function (_super) {\n __extends(CircularList, _super);\n function CircularList(maxLength) {\n var _this = _super.call(this) || this;\n _this._array = new Array(maxLength);\n _this._startIndex = 0;\n _this._length = 0;\n return _this;\n }\n Object.defineProperty(CircularList.prototype, \"maxLength\", {\n get: function () {\n return this._array.length;\n },\n set: function (newMaxLength) {\n var newArray = new Array(newMaxLength);\n for (var i = 0; i < Math.min(newMaxLength, this.length); i++) {\n newArray[i] = this._array[this._getCyclicIndex(i)];\n }\n this._array = newArray;\n this._startIndex = 0;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CircularList.prototype, \"length\", {\n get: function () {\n return this._length;\n },\n set: function (newLength) {\n if (newLength > this._length) {\n for (var i = this._length; i < newLength; i++) {\n this._array[i] = undefined;\n }\n }\n this._length = newLength;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CircularList.prototype, \"forEach\", {\n get: function () {\n var _this = this;\n return function (callbackfn) {\n var i = 0;\n var length = _this.length;\n for (var i_1 = 0; i_1 < length; i_1++) {\n callbackfn(_this.get(i_1), i_1);\n }\n };\n },\n enumerable: true,\n configurable: true\n });\n CircularList.prototype.get = function (index) {\n return this._array[this._getCyclicIndex(index)];\n };\n CircularList.prototype.set = function (index, value) {\n this._array[this._getCyclicIndex(index)] = value;\n };\n CircularList.prototype.push = function (value) {\n this._array[this._getCyclicIndex(this._length)] = value;\n if (this._length === this.maxLength) {\n this._startIndex++;\n if (this._startIndex === this.maxLength) {\n this._startIndex = 0;\n }\n this.emit('trim', 1);\n }\n else {\n this._length++;\n }\n };\n CircularList.prototype.pop = function () {\n return this._array[this._getCyclicIndex(this._length-- - 1)];\n };\n CircularList.prototype.splice = function (start, deleteCount) {\n var items = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n items[_i - 2] = arguments[_i];\n }\n if (deleteCount) {\n for (var 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 }\n if (items && items.length) {\n for (var i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (var i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (this._length + items.length > this.maxLength) {\n var countToTrim = (this._length + items.length) - this.maxLength;\n this._startIndex += countToTrim;\n this._length = this.maxLength;\n this.emit('trim', countToTrim);\n }\n else {\n this._length += items.length;\n }\n }\n };\n CircularList.prototype.trimStart = function (count) {\n if (count > this._length) {\n count = this._length;\n }\n this._startIndex += count;\n this._length -= count;\n this.emit('trim', count);\n };\n CircularList.prototype.shiftElements = function (start, count, offset) {\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 if (offset > 0) {\n for (var i = count - 1; i >= 0; i--) {\n this.set(start + i + offset, this.get(start + i));\n }\n var 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.emit('trim', 1);\n }\n }\n }\n else {\n for (var i = 0; i < count; i++) {\n this.set(start + i + offset, this.get(start + i));\n }\n }\n };\n CircularList.prototype._getCyclicIndex = function (index) {\n return (this._startIndex + index) % this.maxLength;\n };\n return CircularList;\n}(EventEmitter_1.EventEmitter));\nexports.CircularList = CircularList;\n\n//# sourceMappingURL=CircularList.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/CircularList.js\n// module id = 32\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar DomElementObjectPool = (function () {\n function DomElementObjectPool(type) {\n this.type = type;\n this._type = type;\n this._pool = [];\n this._inUse = {};\n }\n DomElementObjectPool.prototype.acquire = function () {\n var element;\n if (this._pool.length === 0) {\n element = this._createNew();\n }\n else {\n element = this._pool.pop();\n }\n this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)] = element;\n return element;\n };\n DomElementObjectPool.prototype.release = function (element) {\n if (!this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)]) {\n throw new Error('Could not release an element not yet acquired');\n }\n delete this._inUse[element.getAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE)];\n this._cleanElement(element);\n this._pool.push(element);\n };\n DomElementObjectPool.prototype._createNew = function () {\n var element = document.createElement(this._type);\n var id = DomElementObjectPool._objectCount++;\n element.setAttribute(DomElementObjectPool.OBJECT_ID_ATTRIBUTE, id.toString(10));\n return element;\n };\n DomElementObjectPool.prototype._cleanElement = function (element) {\n element.className = '';\n element.innerHTML = '';\n };\n return DomElementObjectPool;\n}());\nDomElementObjectPool.OBJECT_ID_ATTRIBUTE = 'data-obj-id';\nDomElementObjectPool._objectCount = 0;\nexports.DomElementObjectPool = DomElementObjectPool;\n\n//# sourceMappingURL=DomElementObjectPool.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/DomElementObjectPool.js\n// module id = 33\n// module chunks = 0","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction contains(arr, el) {\n return arr.indexOf(el) >= 0;\n}\nexports.contains = contains;\n;\n\n//# sourceMappingURL=Generic.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/xterm/lib/utils/Generic.js\n// module id = 34\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/hterm.d.ts b/js/dist/hterm.d.ts index 8d82157..5884784 100644 --- a/js/dist/hterm.d.ts +++ b/js/dist/hterm.d.ts @@ -1,5 +1,5 @@ import * as bare from "libapps"; -export declare class TermHterm { +export declare class Hterm { elem: HTMLElement; term: bare.Terminal; io: bare.IO; diff --git a/js/dist/xterm.d.ts b/js/dist/xterm.d.ts index 9a04c18..ae28909 100644 --- a/js/dist/xterm.d.ts +++ b/js/dist/xterm.d.ts @@ -1,5 +1,5 @@ import * as bare from "xterm"; -export declare class TermXterm { +export declare class Xterm { elem: HTMLElement; message: HTMLElement; messageTimeout: number; diff --git a/js/src/hterm.ts b/js/src/hterm.ts index 171616e..b775c00 100644 --- a/js/src/hterm.ts +++ b/js/src/hterm.ts @@ -1,6 +1,6 @@ import * as bare from "libapps"; -export class TermHterm { +export class Hterm { elem: HTMLElement; term: bare.Terminal; diff --git a/js/src/main.ts b/js/src/main.ts index dfa8d11..101190a 100644 --- a/js/src/main.ts +++ b/js/src/main.ts @@ -1,5 +1,5 @@ -import { TermHterm } from "./hterm"; -import { TermXterm } from "./xterm"; +import { Hterm } from "./hterm"; +import { Xterm } from "./xterm"; import { Terminal, WebTTY, protocols } from "./webtty"; import { ConnectionFactory } from "./websocket"; @@ -12,9 +12,9 @@ const elem = document.getElementById("terminal") if (elem !== null) { var term: Terminal; if (gotty_term == "hterm") { - term = new TermHterm(elem); + term = new Hterm(elem); } else { - term = new TermXterm(elem); + term = new Xterm(elem); } const httpsEnabled = window.location.protocol == "https:"; const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws'; diff --git a/js/src/xterm.ts b/js/src/xterm.ts index 8963091..e2b5775 100644 --- a/js/src/xterm.ts +++ b/js/src/xterm.ts @@ -2,7 +2,7 @@ import * as bare from "xterm"; bare.loadAddon("fit"); -export class TermXterm { +export class Xterm { elem: HTMLElement; message: HTMLElement;