You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1199 lines
1.6 MiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/commandpalette.css":
/*!***********************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/commandpalette.css ***!
\***********************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette, /* </DEPRECATED> */\\n.lm-CommandPalette {\\n font-family: sans-serif;\\n background: #F5F5F5;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-search, /* </DEPRECATED> */\\n.lm-CommandPalette-search {\\n padding: 8px;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-wrapper, /* </DEPRECATED> */\\n.lm-CommandPalette-wrapper {\\n padding: 4px 6px;\\n background: white;\\n border: 1px solid #E0E0E0;\\n position: relative;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-input, /* </DEPRECATED> */\\n.lm-CommandPalette-input {\\n width: 92%;\\n border: none;\\n outline: none;\\n font-size: 16px;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-header, /* </DEPRECATED> */\\n.lm-CommandPalette-header {\\n padding: 4px;\\n color: #757575;\\n font-size: 12px;\\n font-weight: 600;\\n background: #E1E1E1;\\n cursor: pointer;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-header:hover::before, /* </DEPRECATED> */\\n.lm-CommandPalette-header:hover::before {\\n content: '\\\\2026'; /* ellipsis */\\n float: right;\\n margin-right: 4px;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-header > mark, /* </DEPRECATED> */\\n.lm-CommandPalette-header > mark {\\n background-color: transparent;\\n font-weight: bold;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-item, /* </DEPRECATED> */\\n.lm-CommandPalette-item {\\n padding: 4px 8px;\\n color: #757575;\\n font-size: 13px;\\n font-weight: 500;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-emptyMessage, /* </DEPRECATED> */\\n.lm-CommandPalette-emptyMessage {\\n padding: 4px;\\n color: #757575;\\n font-size: 12px;\\n font-weight: 600;\\n text-align: center;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-item.p-mod-disabled, /* </DEPRECATED> */\\n.lm-CommandPalette-item.lm-mod-disabled {\\n color: rgba(0, 0, 0, 0.25);\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-item.p-mod-active, /* </DEPRECATED> */\\n.lm-CommandPalette-item.lm-mod-active {\\n background: #7FDBFF;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-CommandPalette-item:hover:not(.p-mod-active):not(.p-mod-disabled),\\n/* </DEPRECATED> */\\n.lm-CommandPalette-item:hover:not(.lm-mod-active):not(.lm-mod-disabled) {\\n background: #E5E5E5;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-itemIcon, /* </DEPRECATED> */\\n.lm-CommandPalette-itemIcon {\\n display: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-itemLabel > mark, /* </DEPRECATED> */\\n.lm-CommandPalette-itemLabel > mark {\\n background-color: transparent;\\n font-weight: bold;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-CommandPalette-item.p-mod-disabled mark,\\n/* </DEPRECATED> */\\n.lm-CommandPalette-item.lm-mod-disabled mark {\\n color: rgba(0, 0, 0, 0.4);\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-itemCaption, /* </DEPRECATED> */\\n.lm-CommandPalette-itemCaption {\\n color: #9E9E9E;\\n font-size: 11px;\\n font-weight: 400;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/style/commandpalette.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/datagrid.css":
/*!*****************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/datagrid.css ***!
\*****************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) 2014-2018, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-DataGrid, /* </DEPRECATED> */\\n.lm-DataGrid {\\n min-width: 64px;\\n min-height: 64px;\\n border: 1px solid #A0A0A0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DataGrid-scrollCorner, /* </DEPRECATED> */\\n.lm-DataGrid-scrollCorner {\\n background-color: #F0F0F0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DataGrid-scrollCorner::after, /* </DEPRECATED> */\\n.lm-DataGrid-scrollCorner::after {\\n content: '';\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 1px;\\n height: 1px;\\n background-color: #A0A0A0;\\n}\\n\\n.lm-DataGrid-cellEditorOccluder {\\n pointer-events: none;\\n position: absolute;\\n overflow: hidden;\\n}\\n\\n.lm-DataGrid-cellEditorContainer {\\n pointer-events: auto;\\n position: absolute;\\n background-color: #ffffff;\\n box-sizing: border-box;\\n box-shadow: 0px 0px 6px #006bf7;\\n border: 2px solid #006bf7;\\n}\\n\\n.lm-DataGrid-cellEditorContainer.lm-mod-invalid {\\n box-shadow: 0px 0px 6px red;\\n border: 2px solid red;\\n}\\n\\n.lm-DataGrid-cellEditorContainer > form {\\n width: 100%;\\n height: 100%;\\n overflow: hidden;\\n}\\n\\n.lm-DataGrid-cellEditorWidget {\\n width: 100%;\\n height: 100%;\\n outline: none;\\n box-sizing: border-box;\\n}\\n\\n.lm-DataGrid-cellEditorInput {\\n background-color: #ffffff;\\n border: 0;\\n}\\n\\n.lm-DataGrid-cellEditorCheckbox {\\n margin: 0;\\n}\\n\\n.lm-DataGrid-notification {\\n position: absolute;\\n display: flex;\\n overflow: visible;\\n animation: fade-in 300ms ease-out;\\n}\\n\\n.lm-DataGrid-notificationContainer {\\n box-shadow: 0px 2px 5px #999999;\\n border-radius: 3px;\\n background-color: white;\\n color: black;\\n border: 1px solid black;\\n font-family: sans-serif;\\n font-size: 13px;\\n padding: 4px;\\n}\\n\\n@keyframes fade-in {\\n 0% {\\n opacity: 0;\\n }\\n 50% {\\n opacity: 0.7;\\n }\\n 100% {\\n opacity: 1;\\n }\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/style/datagrid.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/dockpanel.css":
/*!******************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/dockpanel.css ***!
\******************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel-overlay, /* </DEPRECATED> */\\n.lm-DockPanel-overlay {\\n background: rgba(255, 255, 255, 0.6);\\n border: 1px dashed black;\\n transition-property: top, left, right, bottom;\\n transition-duration: 150ms;\\n transition-timing-function: ease;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/style/dockpanel.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/index.css":
/*!**************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/index.css ***!
\**************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_0___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!@lumino/dragdrop/style/index.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/dragdrop/style/index.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_1___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!@lumino/widgets/style/index.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/index.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_2___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./commandpalette.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/commandpalette.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_3___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./datagrid.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/datagrid.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_4___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./dockpanel.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/dockpanel.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_5___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./menu.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/menu.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_6___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./menubar.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/menubar.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_7___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./scrollbar.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/scrollbar.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_8___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./tabbar.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/tabbar.css\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_0___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_1___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_2___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_3___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_4___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_5___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_6___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_7___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_8___);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) 2014-2018, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/style/index.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/menu.css":
/*!*************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/menu.css ***!
\*************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-Menu, /* </DEPRECATED> */\\n.lm-Menu {\\n padding: 3px 0px;\\n background: white;\\n color: rgba(0, 0, 0, 0.87);\\n border: 1px solid #C0C0C0;\\n font: 12px Helvetica, Arial, sans-serif;\\n box-shadow: 0px 1px 6px rgba(0, 0, 0, 0.2);\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-item.p-mod-active, /* </DEPRECATED> */\\n.lm-Menu-item.lm-mod-active {\\n background: #E5E5E5;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-item.p-mod-disabled, /* </DEPRECATED> */\\n.lm-Menu-item.lm-mod-disabled {\\n color: rgba(0, 0, 0, 0.25);\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-itemIcon, /* </DEPRECATED> */\\n.lm-Menu-itemIcon {\\n width: 21px;\\n padding: 4px 2px;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-itemLabel, /* </DEPRECATED> */\\n.lm-Menu-itemLabel {\\n padding: 4px 35px 4px 2px;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-itemMnemonic, /* </DEPRECATED> */\\n.lm-Menu-itemMnemonic {\\n text-decoration: underline;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-itemShortcut, /* </DEPRECATED> */\\n.lm-Menu-itemShortcut {\\n padding: 4px 0px;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-itemSubmenuIcon, /* </DEPRECATED> */\\n.lm-Menu-itemSubmenuIcon {\\n width: 16px;\\n padding: 4px 0px;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-Menu-item[data-type='separator'] > div,\\n/* </DEPRECATED> */\\n.lm-Menu-item[data-type='separator'] > div {\\n padding: 0;\\n height: 9px;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-Menu-item[data-type='separator'] > div::after,\\n/* </DEPRECATED> */\\n.lm-Menu-item[data-type='separator'] > div::after {\\n content: '';\\n display: block;\\n position: relative;\\n top: 4px;\\n border-top: 1px solid #DDDDDD;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-Menu-itemIcon::before,\\n.p-Menu-itemSubmenuIcon::before,\\n/* </DEPRECATED> */\\n.lm-Menu-itemIcon::before,\\n.lm-Menu-itemSubmenuIcon::before {\\n font-family: FontAwesome;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-Menu-item.lm-mod-toggled > .p-Menu-itemIcon::before,\\n/* </DEPRECATED> */\\n.lm-Menu-item.lm-mod-toggled > .lm-Menu-itemIcon::before {\\n content: '\\\\f00c';\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-Menu-item[data-type='submenu'] > .p-Menu-itemSubmenuIcon::before,\\n/* </DEPRECATED> */\\n.lm-Menu-item[data-type='submenu'] > .lm-Menu-itemSubmenuIcon::before {\\n content: '\\\\f0da';\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/style/menu.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/menubar.css":
/*!****************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/menubar.css ***!
\****************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-MenuBar, /* </DEPRECATED> */\\n.lm-MenuBar {\\n padding-left: 5px;\\n background: #FAFAFA;\\n color: rgba(0, 0, 0, 0.87);\\n border-bottom: 1px solid #DDDDDD;\\n font: 13px Helvetica, Arial, sans-serif;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-MenuBar-menu, /* </DEPRECATED> */\\n.lm-MenuBar-menu {\\n transform: translateY(-1px);\\n}\\n\\n\\n/* <DEPRECATED> */ .p-MenuBar-item, /* </DEPRECATED> */\\n.lm-MenuBar-item {\\n padding: 4px 8px;\\n border-left: 1px solid transparent;\\n border-right: 1px solid transparent;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-MenuBar-item.p-mod-active, /* </DEPRECATED> */\\n.lm-MenuBar-item.lm-mod-active {\\n background: #E5E5E5;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-MenuBar.p-mod-active .p-MenuBar-item.p-mod-active,\\n/* </DEPRECATED> */\\n.lm-MenuBar.lm-mod-active .lm-MenuBar-item.lm-mod-active {\\n z-index: 10001;\\n background: white;\\n border-left: 1px solid #C0C0C0;\\n border-right: 1px solid #C0C0C0;\\n box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2);\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/style/menubar.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/scrollbar.css":
/*!******************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/scrollbar.css ***!
\******************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nvar ___CSS_LOADER_GET_URL_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/getUrl.js */ \"./node_modules/css-loader/dist/runtime/getUrl.js\");\nvar ___CSS_LOADER_URL_IMPORT_0___ = __webpack_require__(/*! ../images/caretleft.png */ \"./node_modules/@lumino/default-theme/images/caretleft.png\");\nvar ___CSS_LOADER_URL_IMPORT_1___ = __webpack_require__(/*! ../images/caretright.png */ \"./node_modules/@lumino/default-theme/images/caretright.png\");\nvar ___CSS_LOADER_URL_IMPORT_2___ = __webpack_require__(/*! ../images/caretup.png */ \"./node_modules/@lumino/default-theme/images/caretup.png\");\nvar ___CSS_LOADER_URL_IMPORT_3___ = __webpack_require__(/*! ../images/caretdown.png */ \"./node_modules/@lumino/default-theme/images/caretdown.png\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\nvar ___CSS_LOADER_URL_REPLACEMENT_0___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_IMPORT_0___);\nvar ___CSS_LOADER_URL_REPLACEMENT_1___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_IMPORT_1___);\nvar ___CSS_LOADER_URL_REPLACEMENT_2___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_IMPORT_2___);\nvar ___CSS_LOADER_URL_REPLACEMENT_3___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_IMPORT_3___);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='horizontal'],\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='horizontal'] {\\n min-height: 16px;\\n max-height: 16px;\\n min-width: 45px;\\n border-top: 1px solid #A0A0A0;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='vertical'],\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='vertical'] {\\n min-width: 16px;\\n max-width: 16px;\\n min-height: 45px;\\n border-left: 1px solid #A0A0A0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-button, /* </DEPRECATED> */\\n.lm-ScrollBar-button {\\n background-color: #F0F0F0;\\n background-position: center center;\\n min-height: 15px;\\n max-height: 15px;\\n min-width: 15px;\\n max-width: 15px;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-button:hover, /* </DEPRECATED> */\\n.lm-ScrollBar-button:hover {\\n background-color: #DADADA;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-button.p-mod-active, /* </DEPRECATED> */\\n.lm-ScrollBar-button.lm-mod-active {\\n background-color: #CDCDCD;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-track, /* </DEPRECATED> */\\n.lm-ScrollBar-track {\\n background: #F0F0F0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-thumb, /* </DEPRECATED> */\\n.lm-ScrollBar-thumb {\\n background: #CDCDCD;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-thumb:hover, /* </DEPRECATED> */\\n.lm-ScrollBar-thumb:hover {\\n background: #BABABA;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-thumb.lm-mod-active, /* </DEPRECATED> */\\n.lm-ScrollBar-thumb.lm-mod-active {\\n background: #A0A0A0;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='horizontal'] .p-ScrollBar-thumb,\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='horizontal'] .lm-ScrollBar-thumb {\\n height: 100%;\\n min-width: 15px;\\n border-left: 1px solid #A0A0A0;\\n border-right: 1px solid #A0A0A0;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='vertical'] .p-ScrollBar-thumb,\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='vertical'] .lm-ScrollBar-thumb {\\n width: 100%;\\n min-height: 15px;\\n border-top: 1px solid #A0A0A0;\\n border-bottom: 1px solid #A0A0A0;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='horizontal'] .p-ScrollBar-button[data-action='decrement'],\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='horizontal'] .lm-ScrollBar-button[data-action='decrement'] {\\n background-image: url(\" + ___CSS_LOADER_URL_REPLACEMENT_0___ + \");\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='horizontal'] .p-ScrollBar-button[data-action='increment'],\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='horizontal'] .lm-ScrollBar-button[data-action='increment'] {\\n background-image: url(\" + ___CSS_LOADER_URL_REPLACEMENT_1___ + \");\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='vertical'] .p-ScrollBar-button[data-action='decrement'],\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='vertical'] .lm-ScrollBar-button[data-action='decrement'] {\\n background-image: url(\" + ___CSS_LOADER_URL_REPLACEMENT_2___ + \");\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='vertical'] .p-ScrollBar-button[data-action='increment'],\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='vertical'] .lm-ScrollBar-button[data-action='increment'] {\\n background-image: url(\" + ___CSS_LOADER_URL_REPLACEMENT_3___ + \");\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/style/scrollbar.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/tabbar.css":
/*!***************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/tabbar.css ***!
\***************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-TabBar, /* </DEPRECATED> */\\n.lm-TabBar {\\n min-height: 24px;\\n max-height: 24px;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-content, /* </DEPRECATED> */\\n.lm-TabBar-content {\\n min-width: 0;\\n min-height: 0;\\n align-items: flex-end;\\n border-bottom: 1px solid #C0C0C0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-tab, /* </DEPRECATED> */\\n.lm-TabBar-tab {\\n padding: 0px 10px;\\n background: #E5E5E5;\\n border: 1px solid #C0C0C0;\\n border-bottom: none;\\n font: 12px Helvetica, Arial, sans-serif;\\n flex: 0 1 125px;\\n min-height: 20px;\\n max-height: 20px;\\n min-width: 35px;\\n margin-left: -1px;\\n line-height: 20px;\\n}\\n\\n\\n.lm-TabBar-tabLabel .lm-TabBar-tabInput {\\n padding: 0px;\\n border: 0px;\\n font: 12px Helvetica, Arial, sans-serif\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-tab.p-mod-current, /* </DEPRECATED> */\\n.lm-TabBar-tab.lm-mod-current {\\n background: white;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-tab:hover:not(.p-mod-current), /* </DEPRECATED> */\\n.lm-TabBar-tab:hover:not(.lm-mod-current) {\\n background: #F0F0F0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-tab:first-child, /* </DEPRECATED> */\\n.lm-TabBar-tab:first-child {\\n margin-left: 0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-tab.p-mod-current, /* </DEPRECATED> */\\n.lm-TabBar-tab.lm-mod-current {\\n min-height: 23px;\\n max-height: 23px;\\n transform: translateY(1px);\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar-tabIcon,\\n.p-TabBar-tabLabel,\\n.p-TabBar-tabCloseIcon,\\n/* </DEPRECATED> */\\n.lm-TabBar-tabIcon,\\n.lm-TabBar-tabLabel,\\n.lm-TabBar-tabCloseIcon {\\n display: inline-block;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon,\\n/* </DEPRECATED> */\\n.lm-TabBar-tab.lm-mod-closable > .lm-TabBar-tabCloseIcon {\\n margin-left: 4px;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon:before,\\n/* </DEPRECATED> */\\n.lm-TabBar-tab.lm-mod-closable > .lm-TabBar-tabCloseIcon:before {\\n content: '\\\\f00d';\\n font-family: FontAwesome;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar-tab.p-mod-drag-image,\\n/* </DEPRECATED> */\\n.lm-TabBar-tab.lm-mod-drag-image {\\n min-height: 23px;\\n max-height: 23px;\\n min-width: 125px;\\n border: none;\\n box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);\\n transform: translateX(-40%) translateY(-58%);\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/style/tabbar.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/dragdrop/style/index.css":
/*!*********************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/dragdrop/style/index.css ***!
\*********************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ body.p-mod-override-cursor *, /* </DEPRECATED> */\\nbody.lm-mod-override-cursor * {\\n cursor: inherit !important;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/dragdrop/style/index.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/commandpalette.css":
/*!*****************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/commandpalette.css ***!
\*****************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette, /* </DEPRECATED> */\\n.lm-CommandPalette {\\n display: flex;\\n flex-direction: column;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-search, /* </DEPRECATED> */\\n.lm-CommandPalette-search {\\n flex: 0 0 auto;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-content, /* </DEPRECATED> */\\n.lm-CommandPalette-content {\\n flex: 1 1 auto;\\n margin: 0;\\n padding: 0;\\n min-height: 0;\\n overflow: auto;\\n list-style-type: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-header, /* </DEPRECATED> */\\n.lm-CommandPalette-header {\\n overflow: hidden;\\n white-space: nowrap;\\n text-overflow: ellipsis;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-item, /* </DEPRECATED> */\\n.lm-CommandPalette-item {\\n display: flex;\\n flex-direction: row;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-itemIcon, /* </DEPRECATED> */\\n.lm-CommandPalette-itemIcon {\\n flex: 0 0 auto;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-itemContent, /* </DEPRECATED> */\\n.lm-CommandPalette-itemContent {\\n flex: 1 1 auto;\\n overflow: hidden;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-itemShortcut, /* </DEPRECATED> */\\n.lm-CommandPalette-itemShortcut {\\n flex: 0 0 auto;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-CommandPalette-itemLabel, /* </DEPRECATED> */\\n.lm-CommandPalette-itemLabel {\\n overflow: hidden;\\n white-space: nowrap;\\n text-overflow: ellipsis;\\n}\\n\\n.lm-close-icon {\\n\\tborder:1px solid transparent;\\n background-color: transparent;\\n position: absolute;\\n\\tz-index:1;\\n\\tright:3%;\\n\\ttop: 0;\\n\\tbottom: 0;\\n\\tmargin: auto;\\n\\tpadding: 7px 0;\\n\\tdisplay: none;\\n\\tvertical-align: middle;\\n outline: 0;\\n cursor: pointer;\\n}\\n.lm-close-icon:after {\\n\\tcontent: \\\"X\\\";\\n\\tdisplay: block;\\n\\twidth: 15px;\\n\\theight: 15px;\\n\\ttext-align: center;\\n\\tcolor:#000;\\n\\tfont-weight: normal;\\n\\tfont-size: 12px;\\n\\tcursor: pointer;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/commandpalette.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/dockpanel.css":
/*!************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/dockpanel.css ***!
\************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel, /* </DEPRECATED> */\\n.lm-DockPanel {\\n z-index: 0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel-widget, /* </DEPRECATED> */\\n.lm-DockPanel-widget {\\n z-index: 0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel-tabBar, /* </DEPRECATED> */\\n.lm-DockPanel-tabBar {\\n z-index: 1;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel-handle, /* </DEPRECATED> */\\n.lm-DockPanel-handle {\\n z-index: 2;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel-handle.p-mod-hidden, /* </DEPRECATED> */\\n.lm-DockPanel-handle.lm-mod-hidden {\\n display: none !important;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel-handle:after, /* </DEPRECATED> */\\n.lm-DockPanel-handle:after {\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n content: '';\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-DockPanel-handle[data-orientation='horizontal'],\\n/* </DEPRECATED> */\\n.lm-DockPanel-handle[data-orientation='horizontal'] {\\n cursor: ew-resize;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-DockPanel-handle[data-orientation='vertical'],\\n/* </DEPRECATED> */\\n.lm-DockPanel-handle[data-orientation='vertical'] {\\n cursor: ns-resize;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-DockPanel-handle[data-orientation='horizontal']:after,\\n/* </DEPRECATED> */\\n.lm-DockPanel-handle[data-orientation='horizontal']:after {\\n left: 50%;\\n min-width: 8px;\\n transform: translateX(-50%);\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-DockPanel-handle[data-orientation='vertical']:after,\\n/* </DEPRECATED> */\\n.lm-DockPanel-handle[data-orientation='vertical']:after {\\n top: 50%;\\n min-height: 8px;\\n transform: translateY(-50%);\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel-overlay, /* </DEPRECATED> */\\n.lm-DockPanel-overlay {\\n z-index: 3;\\n box-sizing: border-box;\\n pointer-events: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-DockPanel-overlay.p-mod-hidden, /* </DEPRECATED> */\\n.lm-DockPanel-overlay.lm-mod-hidden {\\n display: none !important;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/dockpanel.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/index.css":
/*!********************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/index.css ***!
\********************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_0___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./widget.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/widget.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_1___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./commandpalette.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/commandpalette.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_2___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./dockpanel.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/dockpanel.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_3___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./menu.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/menu.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_4___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./menubar.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/menubar.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_5___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./scrollbar.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/scrollbar.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_6___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./splitpanel.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/splitpanel.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_7___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./tabbar.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/tabbar.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_8___ = __webpack_require__(/*! -!../../../css-loader/dist/cjs.js!./tabpanel.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/tabpanel.css\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_0___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_1___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_2___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_3___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_4___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_5___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_6___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_7___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_8___);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/index.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/menu.css":
/*!*******************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/menu.css ***!
\*******************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-Menu, /* </DEPRECATED> */\\n.lm-Menu {\\n z-index: 10000;\\n position: absolute;\\n white-space: nowrap;\\n overflow-x: hidden;\\n overflow-y: auto;\\n outline: none;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-content, /* </DEPRECATED> */\\n.lm-Menu-content {\\n margin: 0;\\n padding: 0;\\n display: table;\\n list-style-type: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-item, /* </DEPRECATED> */\\n.lm-Menu-item {\\n display: table-row;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-Menu-item.p-mod-hidden,\\n.p-Menu-item.p-mod-collapsed,\\n/* </DEPRECATED> */\\n.lm-Menu-item.lm-mod-hidden,\\n.lm-Menu-item.lm-mod-collapsed {\\n display: none !important;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-Menu-itemIcon,\\n.p-Menu-itemSubmenuIcon,\\n/* </DEPRECATED> */\\n.lm-Menu-itemIcon,\\n.lm-Menu-itemSubmenuIcon {\\n display: table-cell;\\n text-align: center;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-itemLabel, /* </DEPRECATED> */\\n.lm-Menu-itemLabel {\\n display: table-cell;\\n text-align: left;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Menu-itemShortcut, /* </DEPRECATED> */\\n.lm-Menu-itemShortcut {\\n display: table-cell;\\n text-align: right;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/menu.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/menubar.css":
/*!**********************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/menubar.css ***!
\**********************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-MenuBar, /* </DEPRECATED> */\\n.lm-MenuBar {\\n outline: none;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-MenuBar-content, /* </DEPRECATED> */\\n.lm-MenuBar-content {\\n margin: 0;\\n padding: 0;\\n display: flex;\\n flex-direction: row;\\n list-style-type: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p--MenuBar-item, /* </DEPRECATED> */\\n.lm-MenuBar-item {\\n box-sizing: border-box;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-MenuBar-itemIcon,\\n.p-MenuBar-itemLabel,\\n/* </DEPRECATED> */\\n.lm-MenuBar-itemIcon,\\n.lm-MenuBar-itemLabel {\\n display: inline-block;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/menubar.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/scrollbar.css":
/*!************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/scrollbar.css ***!
\************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar, /* </DEPRECATED> */\\n.lm-ScrollBar {\\n display: flex;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='horizontal'],\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='horizontal'] {\\n flex-direction: row;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-ScrollBar[data-orientation='vertical'],\\n/* </DEPRECATED> */\\n.lm-ScrollBar[data-orientation='vertical'] {\\n flex-direction: column;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-button, /* </DEPRECATED> */\\n.lm-ScrollBar-button {\\n box-sizing: border-box;\\n flex: 0 0 auto;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-track, /* </DEPRECATED> */\\n.lm-ScrollBar-track {\\n box-sizing: border-box;\\n position: relative;\\n overflow: hidden;\\n flex: 1 1 auto;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-ScrollBar-thumb, /* </DEPRECATED> */\\n.lm-ScrollBar-thumb {\\n box-sizing: border-box;\\n position: absolute;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/scrollbar.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/splitpanel.css":
/*!*************************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/splitpanel.css ***!
\*************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-SplitPanel-child, /* </DEPRECATED> */\\n.lm-SplitPanel-child {\\n z-index: 0;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-SplitPanel-handle, /* </DEPRECATED> */\\n.lm-SplitPanel-handle {\\n z-index: 1;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-SplitPanel-handle.p-mod-hidden, /* </DEPRECATED> */\\n.lm-SplitPanel-handle.lm-mod-hidden {\\n display: none !important;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-SplitPanel-handle:after, /* </DEPRECATED> */\\n.lm-SplitPanel-handle:after {\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n content: '';\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-SplitPanel[data-orientation='horizontal'] > .p-SplitPanel-handle,\\n/* </DEPRECATED> */\\n.lm-SplitPanel[data-orientation='horizontal'] > .lm-SplitPanel-handle {\\n cursor: ew-resize;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-SplitPanel[data-orientation='vertical'] > .p-SplitPanel-handle,\\n/* </DEPRECATED> */\\n.lm-SplitPanel[data-orientation='vertical'] > .lm-SplitPanel-handle {\\n cursor: ns-resize;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-SplitPanel[data-orientation='horizontal'] > .p-SplitPanel-handle:after,\\n/* </DEPRECATED> */\\n.lm-SplitPanel[data-orientation='horizontal'] > .lm-SplitPanel-handle:after {\\n left: 50%;\\n min-width: 8px;\\n transform: translateX(-50%);\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-SplitPanel[data-orientation='vertical'] > .p-SplitPanel-handle:after,\\n/* </DEPRECATED> */\\n.lm-SplitPanel[data-orientation='vertical'] > .lm-SplitPanel-handle:after {\\n top: 50%;\\n min-height: 8px;\\n transform: translateY(-50%);\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/splitpanel.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/tabbar.css":
/*!*********************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/tabbar.css ***!
\*********************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-TabBar, /* </DEPRECATED> */\\n.lm-TabBar {\\n display: flex;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar[data-orientation='horizontal'], /* </DEPRECATED> */\\n.lm-TabBar[data-orientation='horizontal'] {\\n flex-direction: row;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar[data-orientation='vertical'], /* </DEPRECATED> */\\n.lm-TabBar[data-orientation='vertical'] {\\n flex-direction: column;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-content, /* </DEPRECATED> */\\n.lm-TabBar-content {\\n margin: 0;\\n padding: 0;\\n display: flex;\\n flex: 1 1 auto;\\n list-style-type: none;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar[data-orientation='horizontal'] > .p-TabBar-content,\\n/* </DEPRECATED> */\\n.lm-TabBar[data-orientation='horizontal'] > .lm-TabBar-content {\\n flex-direction: row;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar[data-orientation='vertical'] > .p-TabBar-content,\\n/* </DEPRECATED> */\\n.lm-TabBar[data-orientation='vertical'] > .lm-TabBar-content {\\n flex-direction: column;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-tab, /* </DEPRECATED> */\\n.lm-TabBar-tab {\\n display: flex;\\n flex-direction: row;\\n box-sizing: border-box;\\n overflow: hidden;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar-tabIcon,\\n.p-TabBar-tabCloseIcon,\\n/* </DEPRECATED> */\\n.lm-TabBar-tabIcon,\\n.lm-TabBar-tabCloseIcon {\\n flex: 0 0 auto;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-tabLabel, /* </DEPRECATED> */\\n.lm-TabBar-tabLabel {\\n flex: 1 1 auto;\\n overflow: hidden;\\n white-space: nowrap;\\n}\\n\\n\\n.lm-TabBar-tabInput {\\n user-select: all;\\n width: 100%;\\n box-sizing : border-box;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar-tab.p-mod-hidden, /* </DEPRECATED> */\\n.lm-TabBar-tab.lm-mod-hidden {\\n display: none !important;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabBar.p-mod-dragging .p-TabBar-tab, /* </DEPRECATED> */\\n.lm-TabBar.lm-mod-dragging .lm-TabBar-tab {\\n position: relative;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar.p-mod-dragging[data-orientation='horizontal'] .p-TabBar-tab,\\n/* </DEPRECATED> */\\n.lm-TabBar.lm-mod-dragging[data-orientation='horizontal'] .lm-TabBar-tab {\\n left: 0;\\n transition: left 150ms ease;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar.p-mod-dragging[data-orientation='vertical'] .p-TabBar-tab,\\n/* </DEPRECATED> */\\n.lm-TabBar.lm-mod-dragging[data-orientation='vertical'] .lm-TabBar-tab {\\n top: 0;\\n transition: top 150ms ease;\\n}\\n\\n\\n/* <DEPRECATED> */\\n.p-TabBar.p-mod-dragging .p-TabBar-tab.p-mod-dragging,\\n/* </DEPRECATED> */\\n.lm-TabBar.lm-mod-dragging .lm-TabBar-tab.lm-mod-dragging {\\n transition: none;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/tabbar.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/tabpanel.css":
/*!***********************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/tabpanel.css ***!
\***********************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-TabPanel-tabBar, /* </DEPRECATED> */\\n.lm-TabPanel-tabBar {\\n z-index: 1;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-TabPanel-stackedPanel, /* </DEPRECATED> */\\n.lm-TabPanel-stackedPanel {\\n z-index: 0;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/tabpanel.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/widget.css":
/*!*********************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/widgets/style/widget.css ***!
\*********************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n/* <DEPRECATED> */ .p-Widget, /* </DEPRECATED> */\\n.lm-Widget {\\n box-sizing: border-box;\\n position: relative;\\n overflow: hidden;\\n cursor: default;\\n}\\n\\n\\n/* <DEPRECATED> */ .p-Widget.p-mod-hidden, /* </DEPRECATED> */\\n.lm-Widget.lm-mod-hidden {\\n display: none !important;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/style/widget.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./style/content.css":
/*!*****************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./style/content.css ***!
\*****************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) Jupyter Development Team.\\n| Copyright (c) 2014-2017, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\n.content {\\n min-width: 50px;\\n min-height: 50px;\\n display: flex;\\n flex-direction: column;\\n /*padding: 8px;*/\\n border: 1px solid #C0C0C0;\\n border-top: none;\\n background: white;\\n box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);\\n}\\n\\n.CodeMirror {\\n height: 100%;\\n}\\n\\n.content > div {\\n flex: 1 1 auto;\\n /*border: 1px solid #C0C0C0;*/\\n overflow: auto;\\n}\\n\\n\\n.content input {\\n margin: 8px;\\n}\\n\\n\\n.red > div {\\n background: #E74C3C;\\n}\\n\\n\\n.yellow > div {\\n background: #F1C40F;\\n}\\n\\n\\n.green > div {\\n background: #27AE60;\\n}\\n\\n\\n.blue > div {\\n background: #3498DB;\\n}\\n\\n\\n\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./style/content.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./style/index.css":
/*!***************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./style/index.css ***!
\***************************************************************/
/***/ ((module, exports, __webpack_require__) => {
eval("// Imports\nvar ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_0___ = __webpack_require__(/*! -!../node_modules/css-loader/dist/cjs.js!@lumino/default-theme/style/index.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/@lumino/default-theme/style/index.css\");\nvar ___CSS_LOADER_AT_RULE_IMPORT_1___ = __webpack_require__(/*! -!../node_modules/css-loader/dist/cjs.js!./content.css */ \"./node_modules/css-loader/dist/cjs.js!./style/content.css\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_0___);\nexports.i(___CSS_LOADER_AT_RULE_IMPORT_1___);\n// Module\nexports.push([module.id, \"/*-----------------------------------------------------------------------------\\n| Copyright (c) 2014-2018, PhosphorJS Contributors\\n|\\n| Distributed under the terms of the BSD 3-Clause License.\\n|\\n| The full license is in the file LICENSE, distributed with this software.\\n|----------------------------------------------------------------------------*/\\n\\n\\nbody {\\n display: flex;\\n flex-direction: column;\\n position: absolute;\\n top: 0;\\n left: 0;\\n right: 0;\\n bottom: 0;\\n margin: 0;\\n padding: 0;\\n overflow: hidden;\\n}\\n\\n\\n#menuBar {\\n flex: 0 0 auto;\\n}\\n\\n\\n#main {\\n flex: 1 1 auto;\\n}\\n\\n\\n#palette {\\n min-width: 300px;\\n border-right: 1px solid #DDDDDD;\\n}\\n\\n\\n#dock {\\n padding: 4px;\\n}\\n\", \"\"]);\n// Exports\nmodule.exports = exports;\n\n\n//# sourceURL=webpack://ticparse.js/./style/index.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/@lumino/default-theme/images/caretdown.png":
/*!*****************************************************************!*\
!*** ./node_modules/@lumino/default-theme/images/caretdown.png ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + \"7a564d5604efdab6ca2325dcced48457.png\");\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/images/caretdown.png?");
/***/ }),
/***/ "./node_modules/@lumino/default-theme/images/caretleft.png":
/*!*****************************************************************!*\
!*** ./node_modules/@lumino/default-theme/images/caretleft.png ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + \"995a1d96b1fef026c61ac03f4c6ff841.png\");\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/images/caretleft.png?");
/***/ }),
/***/ "./node_modules/@lumino/default-theme/images/caretright.png":
/*!******************************************************************!*\
!*** ./node_modules/@lumino/default-theme/images/caretright.png ***!
\******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + \"200b3fc810ff360a023c4cc309f77e5a.png\");\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/images/caretright.png?");
/***/ }),
/***/ "./node_modules/@lumino/default-theme/images/caretup.png":
/*!***************************************************************!*\
!*** ./node_modules/@lumino/default-theme/images/caretup.png ***!
\***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (__webpack_require__.p + \"1c8b268ec020a3aa5cd211cdda05fe2b.png\");\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/default-theme/images/caretup.png?");
/***/ }),
/***/ "./node_modules/@lumino/algorithm/dist/index.es6.js":
/*!**********************************************************!*\
!*** ./node_modules/@lumino/algorithm/dist/index.es6.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ArrayExt\": () => /* binding */ ArrayExt,\n/* harmony export */ \"ArrayIterator\": () => /* binding */ ArrayIterator,\n/* harmony export */ \"ChainIterator\": () => /* binding */ ChainIterator,\n/* harmony export */ \"EmptyIterator\": () => /* binding */ EmptyIterator,\n/* harmony export */ \"EnumerateIterator\": () => /* binding */ EnumerateIterator,\n/* harmony export */ \"FilterIterator\": () => /* binding */ FilterIterator,\n/* harmony export */ \"FnIterator\": () => /* binding */ FnIterator,\n/* harmony export */ \"ItemIterator\": () => /* binding */ ItemIterator,\n/* harmony export */ \"KeyIterator\": () => /* binding */ KeyIterator,\n/* harmony export */ \"MapIterator\": () => /* binding */ MapIterator,\n/* harmony export */ \"RangeIterator\": () => /* binding */ RangeIterator,\n/* harmony export */ \"RepeatIterator\": () => /* binding */ RepeatIterator,\n/* harmony export */ \"RetroArrayIterator\": () => /* binding */ RetroArrayIterator,\n/* harmony export */ \"StrideIterator\": () => /* binding */ StrideIterator,\n/* harmony export */ \"StringExt\": () => /* binding */ StringExt,\n/* harmony export */ \"TakeIterator\": () => /* binding */ TakeIterator,\n/* harmony export */ \"ValueIterator\": () => /* binding */ ValueIterator,\n/* harmony export */ \"ZipIterator\": () => /* binding */ ZipIterator,\n/* harmony export */ \"chain\": () => /* binding */ chain,\n/* harmony export */ \"each\": () => /* binding */ each,\n/* harmony export */ \"empty\": () => /* binding */ empty,\n/* harmony export */ \"enumerate\": () => /* binding */ enumerate,\n/* harmony export */ \"every\": () => /* binding */ every,\n/* harmony export */ \"filter\": () => /* binding */ filter,\n/* harmony export */ \"find\": () => /* binding */ find,\n/* harmony export */ \"findIndex\": () => /* binding */ findIndex,\n/* harmony export */ \"iter\": () => /* binding */ iter,\n/* harmony export */ \"iterFn\": () => /* binding */ iterFn,\n/* harmony export */ \"iterItems\": () => /* binding */ iterItems,\n/* harmony export */ \"iterKeys\": () => /* binding */ iterKeys,\n/* harmony export */ \"iterValues\": () => /* binding */ iterValues,\n/* harmony export */ \"map\": () => /* binding */ map,\n/* harmony export */ \"max\": () => /* binding */ max,\n/* harmony export */ \"min\": () => /* binding */ min,\n/* harmony export */ \"minmax\": () => /* binding */ minmax,\n/* harmony export */ \"once\": () => /* binding */ once,\n/* harmony export */ \"range\": () => /* binding */ range,\n/* harmony export */ \"reduce\": () => /* binding */ reduce,\n/* harmony export */ \"repeat\": () => /* binding */ repeat,\n/* harmony export */ \"retro\": () => /* binding */ retro,\n/* harmony export */ \"some\": () => /* binding */ some,\n/* harmony export */ \"stride\": () => /* binding */ stride,\n/* harmony export */ \"take\": () => /* binding */ take,\n/* harmony export */ \"toArray\": () => /* binding */ toArray,\n/* harmony export */ \"toObject\": () => /* binding */ toObject,\n/* harmony export */ \"topologicSort\": () => /* binding */ topologicSort,\n/* harmony export */ \"zip\": () => /* binding */ zip\n/* harmony export */ });\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for array-specific algorithms.\n */\nvar ArrayExt;\n(function (ArrayExt) {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n function firstIndexOf(array, value, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var span;\n if (stop < start) {\n span = (stop + 1) + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (var i = 0; i < span; ++i) {\n var j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.firstIndexOf = firstIndexOf;\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n function lastIndexOf(array, value, start, stop) {\n if (start === void 0) { start = -1; }\n if (stop === void 0) { stop = 0; }\n var n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var span;\n if (start < stop) {\n span = (start + 1) + (n - stop);\n }\n else {\n span = start - stop + 1;\n }\n for (var i = 0; i < span; ++i) {\n var j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.lastIndexOf = lastIndexOf;\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n function findFirstIndex(array, fn, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var span;\n if (stop < start) {\n span = (stop + 1) + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (var i = 0; i < span; ++i) {\n var j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findFirstIndex = findFirstIndex;\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n function findLastIndex(array, fn, start, stop) {\n if (start === void 0) { start = -1; }\n if (stop === void 0) { stop = 0; }\n var n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var d;\n if (start < stop) {\n d = (start + 1) + (n - stop);\n }\n else {\n d = start - stop + 1;\n }\n for (var i = 0; i < d; ++i) {\n var j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findLastIndex = findLastIndex;\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n function findFirstValue(array, fn, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findFirstValue = findFirstValue;\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n function findLastValue(array, fn, start, stop) {\n if (start === void 0) { start = -1; }\n if (stop === void 0) { stop = 0; }\n var index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findLastValue = findLastValue;\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n function lowerBound(array, value, fn, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var begin = start;\n var span = stop - start + 1;\n while (span > 0) {\n var half = span >> 1;\n var middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n }\n else {\n span = half;\n }\n }\n return begin;\n }\n ArrayExt.lowerBound = lowerBound;\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n function upperBound(array, value, fn, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var begin = start;\n var span = stop - start + 1;\n while (span > 0) {\n var half = span >> 1;\n var middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n }\n else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n ArrayExt.upperBound = upperBound;\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n function shallowEqual(a, b, fn) {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n // Compare each element for equality.\n for (var i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n // The array are shallowly equal.\n return true;\n }\n ArrayExt.shallowEqual = shallowEqual;\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n function slice(array, options) {\n if (options === void 0) { options = {}; }\n // Extract the options.\n var start = options.start, stop = options.stop, step = options.step;\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n // Look up the length of the array.\n var n = array.length;\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n }\n else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n }\n else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n }\n else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n }\n else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n // Compute the slice length.\n var length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n }\n else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n }\n else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n // Compute the sliced result.\n var result = [];\n for (var i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n // Return the result.\n return result;\n }\n ArrayExt.slice = slice;\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n function move(array, fromIndex, toIndex) {\n var n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n }\n else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n }\n else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n var value = array[fromIndex];\n var d = fromIndex < toIndex ? 1 : -1;\n for (var i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n ArrayExt.move = move;\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n function reverse(array, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n var a = array[start];\n var b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n ArrayExt.reverse = reverse;\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n function rotate(array, delta, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n var length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n }\n else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n var pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n ArrayExt.rotate = rotate;\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n function fill(array, value, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var span;\n if (stop < start) {\n span = (stop + 1) + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (var i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n ArrayExt.fill = fill;\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n function insert(array, index, value) {\n var n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n }\n else {\n index = Math.min(index, n);\n }\n for (var i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n ArrayExt.insert = insert;\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n function removeAt(array, index) {\n var n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n var value = array[index];\n for (var i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n ArrayExt.removeAt = removeAt;\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n function removeFirstOf(array, value, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeFirstOf = removeFirstOf;\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n function removeLastOf(array, value, start, stop) {\n if (start === void 0) { start = -1; }\n if (stop === void 0) { stop = 0; }\n var index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeLastOf = removeLastOf;\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n function removeAllOf(array, value, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var count = 0;\n for (var i = 0; i < n; ++i) {\n if (start <= stop && (i >= start && i <= stop) && array[i] === value) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && array[i] === value) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllOf = removeAllOf;\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n function removeFirstWhere(array, fn, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var value;\n var index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index: index, value: value };\n }\n ArrayExt.removeFirstWhere = removeFirstWhere;\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n function removeLastWhere(array, fn, start, stop) {\n if (start === void 0) { start = -1; }\n if (stop === void 0) { stop = 0; }\n var value;\n var index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index: index, value: value };\n }\n ArrayExt.removeLastWhere = removeLastWhere;\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n function removeAllWhere(array, fn, start, stop) {\n if (start === void 0) { start = 0; }\n if (stop === void 0) { stop = -1; }\n var n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n var count = 0;\n for (var i = 0; i < n; ++i) {\n if (start <= stop && (i >= start && i <= stop) && fn(array[i], i)) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllWhere = removeAllWhere;\n})(ArrayExt || (ArrayExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator for an iterable object.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new iterator for the given object.\n *\n * #### Notes\n * This function allows iteration algorithms to operate on user-defined\n * iterable types and builtin array-like objects in a uniform fashion.\n */\nfunction iter(object) {\n var it;\n if (typeof object.iter === 'function') {\n it = object.iter();\n }\n else {\n it = new ArrayIterator(object);\n }\n return it;\n}\n/**\n * Create an iterator for the keys in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the keys in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, keys } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(keys(data), key => { console.log(key); }); // 'one', 'two', 'three'\n * ```\n */\nfunction iterKeys(object) {\n return new KeyIterator(object);\n}\n/**\n * Create an iterator for the values in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the values in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, values } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(values(data), value => { console.log(value); }); // 1, 2, 3\n * ```\n */\nfunction iterValues(object) {\n return new ValueIterator(object);\n}\n/**\n * Create an iterator for the items in an object.\n *\n * @param object - The object of interest.\n *\n * @returns A new iterator for the items in the given object.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each, items } from '@lumino/algorithm';\n *\n * let data = { one: 1, two: 2, three: 3 };\n *\n * each(items(data), value => { console.log(value); }); // ['one', 1], ['two', 2], ['three', 3]\n * ```\n */\nfunction iterItems(object) {\n return new ItemIterator(object);\n}\n/**\n * Create an iterator for an iterator-like function.\n *\n * @param fn - A function which behaves like an iterator `next` method.\n *\n * @returns A new iterator for the given function.\n *\n * #### Notes\n * The returned iterator **cannot** be cloned.\n *\n * #### Example\n * ```typescript\n * import { each, iterFn } from '@lumino/algorithm';\n *\n * let it = iterFn((() => {\n * let i = 0;\n * return () => i > 3 ? undefined : i++;\n * })());\n *\n * each(it, v => { console.log(v); }); // 0, 1, 2, 3\n * ```\n */\nfunction iterFn(fn) {\n return new FnIterator(fn);\n}\n/**\n * Invoke a function for each value in an iterable.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nfunction each(object, fn) {\n var index = 0;\n var it = iter(object);\n var value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++) === false) {\n return;\n }\n }\n}\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nfunction every(object, fn) {\n var index = 0;\n var it = iter(object);\n var value;\n while ((value = it.next()) !== undefined) {\n if (!fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nfunction some(object, fn) {\n var index = 0;\n var it = iter(object);\n var value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n/**\n * Create an array from an iterable of values.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { iter, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = iter(data);\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nfunction toArray(object) {\n var index = 0;\n var result = [];\n var it = iter(object);\n var value;\n while ((value = it.next()) !== undefined) {\n result[index++] = value;\n }\n return result;\n}\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nfunction toObject(object) {\n var it = iter(object);\n var pair;\n var result = {};\n while ((pair = it.next()) !== undefined) {\n result[pair[0]] = pair[1];\n }\n return result;\n}\n/**\n * An iterator for an array-like object.\n *\n * #### Notes\n * This iterator can be used for any builtin JS array-like object.\n */\nvar ArrayIterator = /** @class */ (function () {\n /**\n * Construct a new array iterator.\n *\n * @param source - The array-like object of interest.\n */\n function ArrayIterator(source) {\n this._index = 0;\n this._source = source;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n ArrayIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n ArrayIterator.prototype.clone = function () {\n var result = new ArrayIterator(this._source);\n result._index = this._index;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n ArrayIterator.prototype.next = function () {\n if (this._index >= this._source.length) {\n return undefined;\n }\n return this._source[this._index++];\n };\n return ArrayIterator;\n}());\n/**\n * An iterator for the keys in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nvar KeyIterator = /** @class */ (function () {\n /**\n * Construct a new key iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n function KeyIterator(source, keys) {\n if (keys === void 0) { keys = Object.keys(source); }\n this._index = 0;\n this._source = source;\n this._keys = keys;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n KeyIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n KeyIterator.prototype.clone = function () {\n var result = new KeyIterator(this._source, this._keys);\n result._index = this._index;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n KeyIterator.prototype.next = function () {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n var key = this._keys[this._index++];\n if (key in this._source) {\n return key;\n }\n return this.next();\n };\n return KeyIterator;\n}());\n/**\n * An iterator for the values in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nvar ValueIterator = /** @class */ (function () {\n /**\n * Construct a new value iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n function ValueIterator(source, keys) {\n if (keys === void 0) { keys = Object.keys(source); }\n this._index = 0;\n this._source = source;\n this._keys = keys;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n ValueIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n ValueIterator.prototype.clone = function () {\n var result = new ValueIterator(this._source, this._keys);\n result._index = this._index;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n ValueIterator.prototype.next = function () {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n var key = this._keys[this._index++];\n if (key in this._source) {\n return this._source[key];\n }\n return this.next();\n };\n return ValueIterator;\n}());\n/**\n * An iterator for the items in an object.\n *\n * #### Notes\n * This iterator can be used for any JS object.\n */\nvar ItemIterator = /** @class */ (function () {\n /**\n * Construct a new item iterator.\n *\n * @param source - The object of interest.\n *\n * @param keys - The keys to iterate, if known.\n */\n function ItemIterator(source, keys) {\n if (keys === void 0) { keys = Object.keys(source); }\n this._index = 0;\n this._source = source;\n this._keys = keys;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n ItemIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n ItemIterator.prototype.clone = function () {\n var result = new ItemIterator(this._source, this._keys);\n result._index = this._index;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n ItemIterator.prototype.next = function () {\n if (this._index >= this._keys.length) {\n return undefined;\n }\n var key = this._keys[this._index++];\n if (key in this._source) {\n return [key, this._source[key]];\n }\n return this.next();\n };\n return ItemIterator;\n}());\n/**\n * An iterator for an iterator-like function.\n */\nvar FnIterator = /** @class */ (function () {\n /**\n * Construct a new function iterator.\n *\n * @param fn - The iterator-like function of interest.\n */\n function FnIterator(fn) {\n this._fn = fn;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n FnIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n FnIterator.prototype.clone = function () {\n throw new Error('An `FnIterator` cannot be cloned.');\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n FnIterator.prototype.next = function () {\n return this._fn.call(undefined);\n };\n return FnIterator;\n}());\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Chain together several iterables.\n *\n * @param objects - The iterable or array-like objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain, toArray } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nfunction chain() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n return new ChainIterator(iter(objects.map(iter)));\n}\n/**\n * An iterator which chains together several iterators.\n */\nvar ChainIterator = /** @class */ (function () {\n /**\n * Construct a new chain iterator.\n *\n * @param source - The iterator of iterators of interest.\n */\n function ChainIterator(source) {\n this._cloned = false;\n this._source = source;\n this._active = undefined;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n ChainIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n ChainIterator.prototype.clone = function () {\n var result = new ChainIterator(this._source.clone());\n result._active = this._active && this._active.clone();\n result._cloned = true;\n this._cloned = true;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n ChainIterator.prototype.next = function () {\n if (this._active === undefined) {\n var active = this._source.next();\n if (active === undefined) {\n return undefined;\n }\n this._active = this._cloned ? active.clone() : active;\n }\n var value = this._active.next();\n if (value !== undefined) {\n return value;\n }\n this._active = undefined;\n return this.next();\n };\n return ChainIterator;\n}());\n\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty, toArray } from '@lumino/algorithm';\n *\n * let stream = empty<number>();\n *\n * toArray(stream); // []\n * ```\n */\nfunction empty() {\n return new EmptyIterator();\n}\n/**\n * An iterator which is always empty.\n */\nvar EmptyIterator = /** @class */ (function () {\n /**\n * Construct a new empty iterator.\n */\n function EmptyIterator() {\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n EmptyIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n EmptyIterator.prototype.clone = function () {\n return new EmptyIterator();\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n EmptyIterator.prototype.next = function () {\n return undefined;\n };\n return EmptyIterator;\n}());\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate, toArray } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * toArray(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nfunction enumerate(object, start) {\n if (start === void 0) { start = 0; }\n return new EnumerateIterator(iter(object), start);\n}\n/**\n * An iterator which enumerates the source values.\n */\nvar EnumerateIterator = /** @class */ (function () {\n /**\n * Construct a new enumerate iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param start - The starting enum value.\n */\n function EnumerateIterator(source, start) {\n this._source = source;\n this._index = start;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n EnumerateIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n EnumerateIterator.prototype.clone = function () {\n return new EnumerateIterator(this._source.clone(), this._index);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n EnumerateIterator.prototype.next = function () {\n var value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n return [this._index++, value];\n };\n return EnumerateIterator;\n}());\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * toArray(stream); // [2, 4, 6]\n * ```\n */\nfunction filter(object, fn) {\n return new FilterIterator(iter(object), fn);\n}\n/**\n * An iterator which yields values which pass a test.\n */\nvar FilterIterator = /** @class */ (function () {\n /**\n * Construct a new filter iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n */\n function FilterIterator(source, fn) {\n this._index = 0;\n this._source = source;\n this._fn = fn;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n FilterIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n FilterIterator.prototype.clone = function () {\n var result = new FilterIterator(this._source.clone(), this._fn);\n result._index = this._index;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n FilterIterator.prototype.next = function () {\n var fn = this._fn;\n var it = this._source;\n var value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, this._index++)) {\n return value;\n }\n }\n return undefined;\n };\n return FilterIterator;\n}());\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nfunction find(object, fn) {\n var index = 0;\n var it = iter(object);\n var value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nfunction findIndex(object, fn) {\n var index = 0;\n var it = iter(object);\n var value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nfunction min(object, fn) {\n var it = iter(object);\n var value = it.next();\n if (value === undefined) {\n return undefined;\n }\n var result = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nfunction max(object, fn) {\n var it = iter(object);\n var value = it.next();\n if (value === undefined) {\n return undefined;\n }\n var result = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable or array-like object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nfunction minmax(object, fn) {\n var it = iter(object);\n var value = it.next();\n if (value === undefined) {\n return undefined;\n }\n var vmin = value;\n var vmax = value;\n while ((value = it.next()) !== undefined) {\n if (fn(value, vmin) < 0) {\n vmin = value;\n }\n else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return [vmin, vmax];\n}\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * toArray(stream); // [2, 4, 6]\n * ```\n */\nfunction map(object, fn) {\n return new MapIterator(iter(object), fn);\n}\n/**\n * An iterator which transforms values using a mapping function.\n */\nvar MapIterator = /** @class */ (function () {\n /**\n * Construct a new map iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n */\n function MapIterator(source, fn) {\n this._index = 0;\n this._source = source;\n this._fn = fn;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n MapIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n MapIterator.prototype.clone = function () {\n var result = new MapIterator(this._source.clone(), this._fn);\n result._index = this._index;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n MapIterator.prototype.next = function () {\n var value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n return this._fn.call(undefined, value, this._index++);\n };\n return MapIterator;\n}());\n\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n */\nfunction range(start, stop, step) {\n if (stop === undefined) {\n return new RangeIterator(0, start, 1);\n }\n if (step === undefined) {\n return new RangeIterator(start, stop, 1);\n }\n return new RangeIterator(start, stop, step);\n}\n/**\n * An iterator which produces a range of evenly spaced values.\n */\nvar RangeIterator = /** @class */ (function () {\n /**\n * Construct a new range iterator.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n */\n function RangeIterator(start, stop, step) {\n this._index = 0;\n this._start = start;\n this._stop = stop;\n this._step = step;\n this._length = Private.rangeLength(start, stop, step);\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n RangeIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n RangeIterator.prototype.clone = function () {\n var result = new RangeIterator(this._start, this._stop, this._step);\n result._index = this._index;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n RangeIterator.prototype.next = function () {\n if (this._index >= this._length) {\n return undefined;\n }\n return this._start + this._step * this._index++;\n };\n return RangeIterator;\n}());\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n function rangeLength(start, stop, step) {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n Private.rangeLength = rangeLength;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\nfunction reduce(object, fn, initial) {\n // Setup the iterator and fetch the first value.\n var index = 0;\n var it = iter(object);\n var first = it.next();\n // An empty iterator and no initial value is an error.\n if (first === undefined && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n // If the iterator is empty, return the initial value.\n if (first === undefined) {\n return initial;\n }\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n var second = it.next();\n if (second === undefined && initial === undefined) {\n return first;\n }\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second === undefined) {\n return fn(initial, first, index++);\n }\n // Setup the initial accumlated value.\n var accumulator;\n if (initial === undefined) {\n accumulator = fn(first, second, index++);\n }\n else {\n accumulator = fn(fn(initial, first, index++), second, index++);\n }\n // Iterate the rest of the values, updating the accumulator.\n var next;\n while ((next = it.next()) !== undefined) {\n accumulator = fn(accumulator, next, index++);\n }\n // Return the final accumulated value.\n return accumulator;\n}\n\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat, toArray } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * toArray(stream); // [7, 7, 7]\n * ```\n */\nfunction repeat(value, count) {\n return new RepeatIterator(value, count);\n}\n/**\n * Create an iterator which yields a value a single time.\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once, toArray } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * toArray(stream); // [7]\n * ```\n */\nfunction once(value) {\n return new RepeatIterator(value, 1);\n}\n/**\n * An iterator which repeats a value a specified number of times.\n */\nvar RepeatIterator = /** @class */ (function () {\n /**\n * Construct a new repeat iterator.\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n */\n function RepeatIterator(value, count) {\n this._value = value;\n this._count = count;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n RepeatIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n RepeatIterator.prototype.clone = function () {\n return new RepeatIterator(this._value, this._count);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n RepeatIterator.prototype.next = function () {\n if (this._count <= 0) {\n return undefined;\n }\n this._count--;\n return this._value;\n };\n return RepeatIterator;\n}());\n\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * toArray(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nfunction retro(object) {\n var it;\n if (typeof object.retro === 'function') {\n it = object.retro();\n }\n else {\n it = new RetroArrayIterator(object);\n }\n return it;\n}\n/**\n * An iterator which traverses an array-like object in reverse.\n *\n * #### Notes\n * This iterator can be used for any builtin JS array-like object.\n */\nvar RetroArrayIterator = /** @class */ (function () {\n /**\n * Construct a new retro iterator.\n *\n * @param source - The array-like object of interest.\n */\n function RetroArrayIterator(source) {\n this._source = source;\n this._index = source.length - 1;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n RetroArrayIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n RetroArrayIterator.prototype.clone = function () {\n var result = new RetroArrayIterator(this._source);\n result._index = this._index;\n return result;\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n RetroArrayIterator.prototype.next = function () {\n if (this._index < 0 || this._index >= this._source.length) {\n return undefined;\n }\n return this._source[this._index--];\n };\n return RetroArrayIterator;\n}());\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable or array-like object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nfunction topologicSort(edges) {\n // Setup the shared sorting state.\n var sorted = [];\n var visited = new Set();\n var graph = new Map();\n // Add the edges to the graph.\n each(edges, addEdge);\n // Visit each node in the graph.\n graph.forEach(function (v, k) { visit(k); });\n // Return the sorted results.\n return sorted;\n // Add an edge to the graph.\n function addEdge(edge) {\n var fromNode = edge[0], toNode = edge[1];\n var children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(toNode, [fromNode]);\n }\n }\n // Recursively visit the node.\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n var children = graph.get(node);\n if (children) {\n children.forEach(visit);\n }\n sorted.push(node);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride, toArray } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * toArray(stream); // [1, 3, 5];\n * ```\n */\nfunction stride(object, step) {\n return new StrideIterator(iter(object), step);\n}\n/**\n * An iterator which traverses a source iterator step-wise.\n */\nvar StrideIterator = /** @class */ (function () {\n /**\n * Construct a new stride iterator.\n *\n * @param source - The iterator of values of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n */\n function StrideIterator(source, step) {\n this._source = source;\n this._step = step;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n StrideIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n StrideIterator.prototype.clone = function () {\n return new StrideIterator(this._source.clone(), this._step);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n StrideIterator.prototype.next = function () {\n var value = this._source.next();\n for (var n = this._step - 1; n > 0; --n) {\n this._source.next();\n }\n return value;\n };\n return StrideIterator;\n}());\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for string-specific algorithms.\n */\nvar StringExt;\n(function (StringExt) {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n function findIndices(source, query, start) {\n if (start === void 0) { start = 0; }\n var indices = new Array(query.length);\n for (var i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n StringExt.findIndices = findIndices;\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n function matchSumOfSquares(source, query, start) {\n if (start === void 0) { start = 0; }\n var indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n var score = 0;\n for (var i = 0, n = indices.length; i < n; ++i) {\n var j = indices[i] - start;\n score += j * j;\n }\n return { score: score, indices: indices };\n }\n StringExt.matchSumOfSquares = matchSumOfSquares;\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n function matchSumOfDeltas(source, query, start) {\n if (start === void 0) { start = 0; }\n var indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n var score = 0;\n var last = start - 1;\n for (var i = 0, n = indices.length; i < n; ++i) {\n var j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score: score, indices: indices };\n }\n StringExt.matchSumOfDeltas = matchSumOfDeltas;\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n function highlight(source, indices, fn) {\n // Set up the result array.\n var result = [];\n // Set up the counter variables.\n var k = 0;\n var last = 0;\n var n = indices.length;\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n var i = indices[k];\n var j = indices[k];\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n // Update the last visited index.\n last = j + 1;\n }\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n // Return the highlighted result.\n return result;\n }\n StringExt.highlight = highlight;\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n function cmp(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n StringExt.cmp = cmp;\n})(StringExt || (StringExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable or array-like object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n */\nfunction take(object, count) {\n return new TakeIterator(iter(object), count);\n}\n/**\n * An iterator which takes a fixed number of items from a source.\n */\nvar TakeIterator = /** @class */ (function () {\n /**\n * Construct a new take iterator.\n *\n * @param source - The iterator of interest.\n *\n * @param count - The number of items to take from the source.\n */\n function TakeIterator(source, count) {\n this._source = source;\n this._count = count;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n TakeIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n TakeIterator.prototype.clone = function () {\n return new TakeIterator(this._source.clone(), this._count);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n TakeIterator.prototype.next = function () {\n if (this._count <= 0) {\n return undefined;\n }\n var value = this._source.next();\n if (value === undefined) {\n return undefined;\n }\n this._count--;\n return value;\n };\n return TakeIterator;\n}());\n\n// Copyright (c) Jupyter Development Team.\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable or array-like objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip, toArray } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * toArray(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nfunction zip() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n return new ZipIterator(objects.map(iter));\n}\n/**\n * An iterator which iterates several sources in lockstep.\n */\nvar ZipIterator = /** @class */ (function () {\n /**\n * Construct a new zip iterator.\n *\n * @param source - The iterators of interest.\n */\n function ZipIterator(source) {\n this._source = source;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n ZipIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n ZipIterator.prototype.clone = function () {\n return new ZipIterator(this._source.map(function (it) { return it.clone(); }));\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n ZipIterator.prototype.next = function () {\n var result = new Array(this._source.length);\n for (var i = 0, n = this._source.length; i < n; ++i) {\n var value = this._source[i].next();\n if (value === undefined) {\n return undefined;\n }\n result[i] = value;\n }\n return result;\n };\n return ZipIterator;\n}());\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/algorithm/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/collections/dist/index.es6.js":
/*!************************************************************!*\
!*** ./node_modules/@lumino/collections/dist/index.es6.js ***!
\************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BPlusTree\": () => /* binding */ BPlusTree,\n/* harmony export */ \"LinkedList\": () => /* binding */ LinkedList\n/* harmony export */ });\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ \"./node_modules/@lumino/algorithm/dist/index.es6.js\");\n\n\n// Copyright (c) Jupyter Development Team.\n/**\n * A generic B+ tree.\n *\n * #### Notes\n * Most operations have `O(log32 n)` or better complexity.\n */\nvar BPlusTree = /** @class */ (function () {\n /**\n * Construct a new B+ tree.\n *\n * @param cmp - The item comparison function for the tree.\n */\n function BPlusTree(cmp) {\n this._root = new Private.LeafNode();\n this.cmp = cmp;\n }\n Object.defineProperty(BPlusTree.prototype, \"isEmpty\", {\n /**\n * Whether the tree is empty.\n *\n * #### Complexity\n * `O(1)`\n */\n get: function () {\n return this._root.size === 0;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BPlusTree.prototype, \"size\", {\n /**\n * The size of the tree.\n *\n * #### Complexity\n * `O(1)`\n */\n get: function () {\n return this._root.size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BPlusTree.prototype, \"first\", {\n /**\n * The first item in the tree.\n *\n * This is `undefined` if the tree is empty.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n get: function () {\n var node = Private.firstLeaf(this._root);\n return node.size > 0 ? node.items[0] : undefined;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BPlusTree.prototype, \"last\", {\n /**\n * The last item in the tree.\n *\n * This is `undefined` if the tree is empty.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n get: function () {\n var node = Private.lastLeaf(this._root);\n return node.size > 0 ? node.items[node.size - 1] : undefined;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Create an iterator over the items in the tree.\n *\n * @returns A new iterator starting with the first item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.iter = function () {\n return Private.iterItems(this._root);\n };\n /**\n * Create a reverse iterator over the items in the tree.\n *\n * @returns A new iterator starting with the last item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.retro = function () {\n return Private.retroItems(this._root);\n };\n /**\n * Create an iterator for a slice of items in the tree.\n *\n * @param start - The index of the first item, inclusive. This\n * should be `< stop`. Negative values are taken as an offset\n * from the end of the tree. The default is `0`.\n *\n * @param stop - The index of the last item, exclusive. This\n * should be `> start`. Negative values are taken as an offset\n * from the end of the tree. The default is `size`.\n *\n * @returns A new iterator starting with the specified item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.slice = function (start, stop) {\n return Private.sliceItems(this._root, start, stop);\n };\n /**\n * Create a reverse iterator for a slice of items in the tree.\n *\n * @param start - The index of the first item, inclusive. This\n * should be `> stop`. Negative values are taken as an offset\n * from the end of the tree. The default is `size - 1`.\n *\n * @param stop - The index of the last item, exclusive. This\n * should be `< start`. Negative values are taken as an offset\n * from the end of the tree. The default is `-size - 1`.\n *\n * @returns A new reverse iterator starting with the specified item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.retroSlice = function (start, stop) {\n return Private.retroSliceItems(this._root, start, stop);\n };\n /**\n * Get the item at a particular index.\n *\n * @param index - The index of the item of interest. Negative\n * values are taken as an offset from the end of the tree.\n *\n * @returns The item at the specified index, or `undefined` if\n * the index is out of range.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.at = function (index) {\n return Private.itemAt(this._root, index);\n };\n /**\n * Test whether the tree has an item which matches a key.\n *\n * @param key - The key of interest.\n *\n * @param cmp - A function which compares an item against the key.\n *\n * @returns `true` if the tree has an item which matches the given\n * key, `false` otherwise.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.has = function (key, cmp) {\n return Private.hasItem(this._root, key, cmp);\n };\n /**\n * Get the index of an item which matches a key.\n *\n * @param key - The key of interest.\n *\n * @param cmp - A function which compares an item against the key.\n *\n * @returns The index of the item which matches the given key. A\n * negative value means that a matching item does not exist in\n * the tree, but if one did it would reside at `-index - 1`.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.indexOf = function (key, cmp) {\n return Private.indexOf(this._root, key, cmp);\n };\n /**\n * Get the item which matches a key.\n *\n * @param item - The key of interest.\n *\n * @param cmp - A function which compares an item against the key.\n *\n * @returns The item which matches the given key, or `undefined` if\n * the tree does not have a matching item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.get = function (key, cmp) {\n return Private.getItem(this._root, key, cmp);\n };\n /**\n * Assign new items to the tree, replacing all current items.\n *\n * @param items - The items to assign to the tree.\n *\n * #### Complexity\n * `O(n log32 n)`\n */\n BPlusTree.prototype.assign = function (items) {\n this.clear();\n this.update(items);\n };\n /**\n * Insert an item into the tree.\n *\n * @param item - The item of interest.\n *\n * @returns If the given item matches an existing item in the tree,\n * the given item will replace it, and the existing item will be\n * returned. Otherwise, this method returns `undefined`.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.insert = function (item) {\n var existing = Private.insertItem(this._root, item, this.cmp);\n this._root = Private.maybeSplitRoot(this._root);\n return existing;\n };\n /**\n * Update the tree with multiple items.\n *\n * @param items - The items to insert into the tree.\n *\n * #### Complexity\n * `O(k log32 n)`\n */\n BPlusTree.prototype.update = function (items) {\n var _this = this;\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(items, function (item) { _this.insert(item); });\n };\n /**\n * Delete an item which matches a particular key.\n *\n * @param key - The key of interest.\n *\n * @param cmp - A function which compares an item against the key.\n *\n * @returns The item removed from the tree, or `undefined` if no\n * item matched the given key.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.delete = function (key, cmp) {\n var item = Private.deleteItem(this._root, key, cmp);\n this._root = Private.maybeExtractRoot(this._root);\n return item;\n };\n /**\n * Remove an item at a particular index.\n *\n * @param index - The index of the item to remove. Negative\n * values are taken as an offset from the end of the tree.\n *\n * @returns The item removed from the tree, or `undefined` if\n * the given index is out of range.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n BPlusTree.prototype.remove = function (index) {\n var item = Private.removeItem(this._root, index);\n this._root = Private.maybeExtractRoot(this._root);\n return item;\n };\n /**\n * Clear the contents of the tree.\n *\n * #### Complexity\n * `O(n)`\n */\n BPlusTree.prototype.clear = function () {\n Private.clear(this._root);\n this._root = new Private.LeafNode();\n };\n return BPlusTree;\n}());\n/**\n * The namespace for the `BPlusTree` class statics.\n */\n(function (BPlusTree) {\n /**\n * Create a new B+ tree populated with the given items.\n *\n * @param items - The items to add to the tree.\n *\n * @param cmp - The item comparison function for the tree.\n *\n * @returns A new B+ tree populated with the given items.\n *\n * #### Complexity\n * `O(n log32 n)`\n */\n function from(items, cmp) {\n var tree = new BPlusTree(cmp);\n tree.assign(items);\n return tree;\n }\n BPlusTree.from = from;\n})(BPlusTree || (BPlusTree = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * A branch node in a B+ tree.\n */\n var BranchNode = /** @class */ (function () {\n function BranchNode() {\n /**\n * The left-most item of each child subtree.\n */\n this.items = [];\n /**\n * The cumulative sizes of each child subtree.\n */\n this.sizes = [];\n /**\n * The child nodes of this branch node.\n */\n this.children = [];\n }\n Object.defineProperty(BranchNode.prototype, \"type\", {\n /**\n * The discriminated type of the node.\n */\n get: function () {\n return 0 /* Branch */;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BranchNode.prototype, \"size\", {\n /**\n * The total number of items in the subtree.\n */\n get: function () {\n return this.sizes[this.sizes.length - 1];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BranchNode.prototype, \"width\", {\n /**\n * The tree width of the node.\n */\n get: function () {\n return this.children.length;\n },\n enumerable: true,\n configurable: true\n });\n return BranchNode;\n }());\n Private.BranchNode = BranchNode;\n /**\n * A leaf node in a B+ tree.\n */\n var LeafNode = /** @class */ (function () {\n function LeafNode() {\n /**\n * The next sibling leaf node of this leaf node.\n */\n this.next = null;\n /**\n * The previous sibling leaf node of this leaf node.\n */\n this.prev = null;\n /**\n * The items of the leaf.\n */\n this.items = [];\n }\n Object.defineProperty(LeafNode.prototype, \"type\", {\n /**\n * The discriminated type of the node.\n */\n get: function () {\n return 1 /* Leaf */;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LeafNode.prototype, \"size\", {\n /**\n * The total number of items in the leaf.\n */\n get: function () {\n return this.items.length;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LeafNode.prototype, \"width\", {\n /**\n * The tree width of the node.\n */\n get: function () {\n return this.items.length;\n },\n enumerable: true,\n configurable: true\n });\n return LeafNode;\n }());\n Private.LeafNode = LeafNode;\n /**\n * Get the first leaf node in the tree.\n *\n * @param node - The root node of interest.\n *\n * @returns The first leaf node in the tree.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function firstLeaf(node) {\n while (node.type === 0 /* Branch */) {\n node = node.children[0];\n }\n return node;\n }\n Private.firstLeaf = firstLeaf;\n /**\n * Get the last leaf node in the tree.\n *\n * @param node - The root node of interest.\n *\n * @returns The last leaf node in the tree.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function lastLeaf(node) {\n while (node.type === 0 /* Branch */) {\n node = node.children[node.children.length - 1];\n }\n return node;\n }\n Private.lastLeaf = lastLeaf;\n /**\n * Create a forward iterator for the items in the tree.\n *\n * @param node - The root node of interest.\n *\n * @returns A new forward iterator starting with the first item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function iterItems(node) {\n var leaf = firstLeaf(node);\n return new ForwardIterator(leaf, 0, -1);\n }\n Private.iterItems = iterItems;\n /**\n * Create a reverse iterator for the items in the tree.\n *\n * @param node - The root node of interest.\n *\n * @returns A new reverse iterator starting with the last item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function retroItems(node) {\n var leaf = lastLeaf(node);\n return new RetroIterator(leaf, leaf.size - 1, -1);\n }\n Private.retroItems = retroItems;\n /**\n * Create an iterator for a slice of items in the tree.\n *\n * @param node - The root node of interest.\n *\n * @param start - The index of the first item, inclusive. This\n * should be `< stop`. Negative values are taken as an offset\n * from the end of the tree. The default is `0`.\n *\n * @param stop - The index of the last item, exclusive. This\n * should be `> start`. Negative values are taken as an offset\n * from the end of the tree. The default is `size`.\n *\n * @returns A new iterator starting with the specified item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function sliceItems(node, start, stop) {\n // Normalize the start index.\n if (start === undefined) {\n start = 0;\n }\n else if (start < 0) {\n start = Math.max(0, start + node.size);\n }\n else {\n start = Math.min(start, node.size);\n }\n // Normalize the stop index.\n if (stop === undefined) {\n stop = node.size;\n }\n else if (stop < 0) {\n stop = Math.max(0, stop + node.size);\n }\n else {\n stop = Math.min(stop, node.size);\n }\n // Compute effective count.\n var count = Math.max(0, stop - start);\n // Bail early if there is nothing to iterate.\n if (count === 0) {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n }\n // Find the starting leaf node and local index.\n while (node.type === 0 /* Branch */) {\n var i = findPivotIndexByIndex(node.sizes, start);\n if (i > 0)\n start -= node.sizes[i - 1];\n node = node.children[i];\n }\n // Return the forward iterator for the range.\n return new ForwardIterator(node, start, count);\n }\n Private.sliceItems = sliceItems;\n /**\n * Create a reverse iterator for a slice of items in the tree.\n *\n * @param node - The root node of interest.\n *\n * @param start - The index of the first item, inclusive. This\n * should be `> stop`. Negative values are taken as an offset\n * from the end of the tree. The default is `size - 1`.\n *\n * @param stop - The index of the last item, exclusive. This\n * should be `< start`. Negative values are taken as an offset\n * from the end of the tree. The default is `-size - 1`.\n *\n * @returns A new reverse iterator starting with the specified item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function retroSliceItems(node, start, stop) {\n // Normalize the start index.\n if (start === undefined) {\n start = node.size - 1;\n }\n else if (start < 0) {\n start = Math.max(-1, start + node.size);\n }\n else {\n start = Math.min(start, node.size - 1);\n }\n // Normalize the stop index.\n if (stop === undefined) {\n stop = -1;\n }\n else if (stop < 0) {\n stop = Math.max(-1, stop + node.size);\n }\n else {\n stop = Math.min(stop, node.size - 1);\n }\n // Compute the effective count.\n var count = Math.max(0, start - stop);\n // Bail early if there is nothing to iterate.\n if (count === 0) {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n }\n // Find the starting leaf node and local index.\n while (node.type === 0 /* Branch */) {\n var i = findPivotIndexByIndex(node.sizes, start);\n if (i > 0)\n start -= node.sizes[i - 1];\n node = node.children[i];\n }\n // Return the retro iterator for the range.\n return new RetroIterator(node, start, count);\n }\n Private.retroSliceItems = retroSliceItems;\n /**\n * Get the item at the specified index.\n *\n * @param node - The root node of interest.\n *\n * @param index - The index of the item of interest. Negative\n * values are taken as an offset from the end of the tree.\n *\n * @returns The item at the specified index, or `undefined` if\n * the index is out of range.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function itemAt(node, index) {\n // Wrap negative indices.\n if (index < 0) {\n index += node.size;\n }\n // Bail early if the index is out of range.\n if (index < 0 || index >= node.size) {\n return undefined;\n }\n // Find the containing leaf node and local index.\n while (node.type === 0 /* Branch */) {\n var i = findPivotIndexByIndex(node.sizes, index);\n if (i > 0)\n index -= node.sizes[i - 1];\n node = node.children[i];\n }\n // Return the item at the specified index.\n return node.items[index];\n }\n Private.itemAt = itemAt;\n /**\n * Test whether the tree contains an item which matches a key.\n *\n * @param node - The root node of interest.\n *\n * @param key - The key of interest.\n *\n * @param cmp - The key comparison function.\n *\n * @returns Whether the tree contains a matching item.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function hasItem(node, key, cmp) {\n // Find the containing leaf node.\n while (node.type === 0 /* Branch */) {\n var i_1 = findPivotIndexByKey(node.items, key, cmp);\n node = node.children[i_1];\n }\n // Find the key index.\n var i = findKeyIndex(node.items, key, cmp);\n // Return whether or not the node contains a matching item.\n return i >= 0;\n }\n Private.hasItem = hasItem;\n /**\n * Get the index of the item which matches a key.\n *\n * @param node - The node of interest.\n *\n * @param key - The key of interest.\n *\n * @param cmp - The key comparison function.\n *\n * @returns The index of the item which matches the given key. A\n * negative value means that a matching item does not exist in\n * the tree, but if one did it would reside at `-index - 1`.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function indexOf(node, key, cmp) {\n // Set up the global index.\n var index = 0;\n // Find the containing leaf node and global index.\n while (node.type === 0 /* Branch */) {\n var i_2 = findPivotIndexByKey(node.items, key, cmp);\n if (i_2 > 0)\n index += node.sizes[i_2 - 1];\n node = node.children[i_2];\n }\n // Find the key index.\n var i = findKeyIndex(node.items, key, cmp);\n // Return the final computed index.\n return i >= 0 ? index + i : -index + i;\n }\n Private.indexOf = indexOf;\n /**\n * Get the item for a particular key.\n *\n * @param node - The node of interest.\n *\n * @param key - The key of interest.\n *\n * @param cmp - The key comparison function.\n *\n * @returns The item for the specified key, or `undefined` if\n * the tree does not have a matching item for the key.\n *\n * #### Complexity\n * `O(log32 n)`\n */\n function getItem(node, key, cmp) {\n // Find the containing leaf node.\n while (node.type === 0 /* Branch */) {\n var i_3 = findPivotIndexByKey(node.items, key, cmp);\n node = node.children[i_3];\n }\n // Find the key index.\n var i = findKeyIndex(node.items, key, cmp);\n // Return the item for the given key.\n return i >= 0 ? node.items[i] : undefined;\n }\n Private.getItem = getItem;\n /**\n * Insert an item into the tree.\n *\n * @param node - The root node of interest.\n *\n * @param item - The item of interest.\n *\n * @param cmp - The item comparison function.\n *\n * @returns If the given item matches an existing item in the tree,\n * the given item will replace it, and the existing item will be\n * returned. Otherwise, this function returns `undefined`.\n *\n * #### Complexity\n * `O(log32 n)`\n *\n * #### Notes\n * The root may be overfull after calling this function.\n */\n function insertItem(node, item, cmp) {\n // Handle leaf nodes first.\n if (node.type === 1 /* Leaf */) {\n // Find the index for the given item.\n var i_4 = findKeyIndex(node.items, item, cmp);\n // Fetch the existing item and insert the new item.\n var existing_1;\n if (i_4 >= 0) {\n existing_1 = node.items[i_4];\n node.items[i_4] = item;\n }\n else {\n existing_1 = undefined;\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(node.items, -i_4 - 1, item);\n }\n // Return the existing item.\n return existing_1;\n }\n // Find the pivot index for the insert.\n var i = findPivotIndexByKey(node.items, item, cmp);\n // Fetch the pivot child.\n var child = node.children[i];\n // Fetch the current size of the child.\n var prevSize = child.size;\n // Recursively insert the item into the child.\n var existing = insertItem(child, item, cmp);\n // Fetch the updated size of the child.\n var currSize = child.size;\n // Update the item state of the branch.\n node.items[i] = child.items[0];\n // Bail early if the child size did not change.\n if (prevSize === currSize) {\n return existing;\n }\n // Split the child if it's overfull.\n if (child.width > MAX_NODE_WIDTH) {\n var next = splitNode(child);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(node.children, i + 1, next);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(node.items, i + 1, next.items[0]);\n }\n // Update the dirty sizes of the branch.\n updateSizes(node, i);\n // Return the existing item.\n return existing;\n }\n Private.insertItem = insertItem;\n /**\n * Delete an item in the tree.\n *\n * @param node - The node of interest.\n *\n * @param key - The key of interest.\n *\n * @param cmp - The key comparison function.\n *\n * @returns The deleted item or `undefined`.\n *\n * #### Complexity\n * `O(log32 n)`\n *\n * #### Notes\n * The root may be underfull after calling this function.\n */\n function deleteItem(node, key, cmp) {\n // Handle leaf nodes first.\n if (node.type === 1 /* Leaf */) {\n // Find the index for the given key.\n var i_5 = findKeyIndex(node.items, key, cmp);\n // Bail early if the item does not exist.\n if (i_5 < 0) {\n return undefined;\n }\n // Remove the item at the computed index.\n return _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.items, i_5);\n }\n // Find the pivot index for the delete.\n var i = findPivotIndexByKey(node.items, key, cmp);\n // Fetch the pivot child.\n var child = node.children[i];\n // Fetch the current size of the child.\n var prevSize = child.size;\n // Recursively remove the item from the child.\n var item = deleteItem(child, key, cmp);\n // Fetch the updated size of the child.\n var currSize = child.size;\n // Bail early if the child size did not change.\n if (prevSize === currSize) {\n return item;\n }\n // Update the item state of the branch.\n node.items[i] = child.items[0];\n // Join the child if it's underfull.\n if (child.width < MIN_NODE_WIDTH) {\n i = joinChild(node, i);\n }\n // Update the dirty sizes of the branch.\n updateSizes(node, i);\n // Return the deleted item.\n return item;\n }\n Private.deleteItem = deleteItem;\n /**\n * Remove an item from the tree.\n *\n * @param node - The node of interest.\n *\n * @param index - The index of interest.\n *\n * @returns The removed item or `undefined`.\n *\n * #### Complexity\n * `O(log32 n)`\n *\n * #### Notes\n * The root may be underfull after calling this function.\n */\n function removeItem(node, index) {\n // Wrap negative indices.\n if (index < 0) {\n index += node.size;\n }\n // Bail early if the index is out of range.\n if (index < 0 || index >= node.size) {\n return undefined;\n }\n // Handle leaf nodes first.\n if (node.type === 1 /* Leaf */) {\n return _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.items, index);\n }\n // Find the pivot index for the remove.\n var i = findPivotIndexByIndex(node.sizes, index);\n if (i > 0)\n index -= node.sizes[i];\n // Fetch the pivot child.\n var child = node.children[i];\n // Recursively remove the item from the child.\n var item = removeItem(child, index);\n // Update the item state of the branch.\n node.items[i] = child.items[0];\n // Join the child if it's underfull.\n if (child.width < MIN_NODE_WIDTH) {\n i = joinChild(node, i);\n }\n // Update the dirty sizes of the branch.\n updateSizes(node, i);\n // Return the removed item.\n return item;\n }\n Private.removeItem = removeItem;\n /**\n * Recursively clear the contents of a node.\n *\n * @param node - The node of interest.\n *\n * #### Complexity\n * `O(n)`\n */\n function clear(node) {\n if (node.type === 0 /* Branch */) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(node.children, clear);\n node.children.length = 0;\n node.sizes.length = 0;\n node.items.length = 0;\n }\n else {\n node.items.length = 0;\n node.next = null;\n node.prev = null;\n }\n }\n Private.clear = clear;\n /**\n * Split a root node and create a new root, if needed.\n *\n * @param node - The root node of interest.\n *\n * @returns The new root node.\n */\n function maybeSplitRoot(node) {\n // Bail early if the current root is not overfull.\n if (node.width <= MAX_NODE_WIDTH) {\n return node;\n }\n // Create a new root branch node.\n var root = new BranchNode();\n // Split the node to the right and create a new sibling.\n var next = splitNode(node);\n // Add the sizes to the root.\n root.sizes[0] = node.size;\n root.sizes[1] = node.size + next.size;\n // Add the children to the root.\n root.children[0] = node;\n root.children[1] = next;\n // Add the items to the root.\n root.items[0] = node.items[0];\n root.items[1] = next.items[0];\n // Return the new root node.\n return root;\n }\n Private.maybeSplitRoot = maybeSplitRoot;\n /**\n * Extract a single node child as a new root, if needed.\n *\n * @param node - The root node of interest.\n *\n * @returns The new root node.\n */\n function maybeExtractRoot(node) {\n // Bail early if the node it already a leaf.\n if (node.type === 1 /* Leaf */) {\n return node;\n }\n // Bail early if the branch has more than one child.\n if (node.children.length > 1) {\n return node;\n }\n // Extract the sole remaining child as the new root.\n var root = node.children.pop();\n // Clear the rest of the node state.\n clear(node);\n // Return the new root.\n return root;\n }\n Private.maybeExtractRoot = maybeExtractRoot;\n /**\n * The maximum width for a node in the tree.\n */\n var MAX_NODE_WIDTH = 32;\n /**\n * The minimum width for a node in the tree.\n */\n var MIN_NODE_WIDTH = MAX_NODE_WIDTH >> 1;\n /**\n * A forward iterator for a B+ tree.\n */\n var ForwardIterator = /** @class */ (function () {\n /**\n * Construct a new forward iterator.\n *\n * @param node - The first leaf node in the chain.\n *\n * @param index - The local index of the first item.\n *\n * @param count - The number of items to iterate. A value `< 0`\n * will iterate all available items.\n */\n function ForwardIterator(node, index, count) {\n this._node = node;\n this._index = index;\n this._count = count;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n ForwardIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n ForwardIterator.prototype.clone = function () {\n return new ForwardIterator(this._node, this._index, this._count);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n ForwardIterator.prototype.next = function () {\n if (this._node === null || this._count === 0) {\n return undefined;\n }\n if (this._index >= this._node.size) {\n this._node = this._node.next;\n this._index = 0;\n return this.next();\n }\n if (this._count > 0) {\n this._count--;\n }\n return this._node.items[this._index++];\n };\n return ForwardIterator;\n }());\n /**\n * A reverse iterator for a B+ tree.\n */\n var RetroIterator = /** @class */ (function () {\n /**\n * Construct a new retro iterator.\n *\n * @param node - The last leaf node in the chain.\n *\n * @param index - The local index of the last item.\n *\n * @param count - The number of items to iterate. A value `< 0`\n * will iterate all available items.\n */\n function RetroIterator(node, index, count) {\n this._node = node;\n this._index = index;\n this._count = count;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n RetroIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n RetroIterator.prototype.clone = function () {\n return new RetroIterator(this._node, this._index, this._count);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n RetroIterator.prototype.next = function () {\n if (this._node === null || this._count === 0) {\n return undefined;\n }\n if (this._index >= this._node.size) {\n this._index = this._node.size - 1;\n }\n if (this._index < 0) {\n this._node = this._node.prev;\n this._index = this._node ? this._node.size - 1 : -1;\n return this.next();\n }\n if (this._count > 0) {\n this._count--;\n }\n return this._node.items[this._index--];\n };\n return RetroIterator;\n }());\n /**\n * Find the pivot index for a particular local index.\n */\n function findPivotIndexByIndex(sizes, index) {\n var n = sizes.length;\n for (var i = 0; i < n; ++i) {\n if (sizes[i] > index) {\n return i;\n }\n }\n return n - 1;\n }\n /**\n * Find the pivot index for a particular key.\n */\n function findPivotIndexByKey(items, key, cmp) {\n var n = items.length;\n for (var i = 1; i < n; ++i) {\n if (cmp(items[i], key) > 0) {\n return i - 1;\n }\n }\n return n - 1;\n }\n /**\n * Find the key index for a particular key.\n */\n function findKeyIndex(items, key, cmp) {\n var n = items.length;\n for (var i = 0; i < n; ++i) {\n var c = cmp(items[i], key);\n if (c === 0) {\n return i;\n }\n if (c > 0) {\n return -i - 1;\n }\n }\n return -n - 1;\n }\n /**\n * Update the sizes of a branch node starting at the given index.\n */\n function updateSizes(node, i) {\n var sizes = node.sizes, children = node.children;\n var last = i > 0 ? sizes[i - 1] : 0;\n for (var n = children.length; i < n; ++i) {\n last = sizes[i] = last + children[i].size;\n }\n sizes.length = children.length;\n }\n /**\n * Split a node and return its new next sibling.\n *\n * @param node - The node of interest.\n *\n * @returns The new next sibling node.\n */\n function splitNode(node) {\n // Handle leaf nodes first.\n if (node.type === 1 /* Leaf */) {\n // Create the new sibling leaf node.\n var next_1 = new LeafNode();\n // Move the items to the new sibling.\n var v1_1 = node.items;\n var v2_1 = next_1.items;\n for (var i = MIN_NODE_WIDTH, n = v1_1.length; i < n; ++i) {\n v2_1.push(v1_1[i]);\n }\n v1_1.length = MIN_NODE_WIDTH;\n // Patch up the sibling links.\n if (node.next)\n node.next.prev = next_1;\n next_1.next = node.next;\n next_1.prev = node;\n node.next = next_1;\n // Return the new next sibling.\n return next_1;\n }\n // Create the new sibling branch node.\n var next = new BranchNode();\n // Move the children to the new sibling.\n var c1 = node.children;\n var c2 = next.children;\n for (var i = MIN_NODE_WIDTH, n = c1.length; i < n; ++i) {\n c2.push(c1[i]);\n }\n c1.length = MIN_NODE_WIDTH;\n // Move the items to the new sibling.\n var v1 = node.items;\n var v2 = next.items;\n for (var i = MIN_NODE_WIDTH, n = v1.length; i < n; ++i) {\n v2.push(v1[i]);\n }\n v1.length = MIN_NODE_WIDTH;\n // Update the dirty sizes of the nodes.\n updateSizes(node, MIN_NODE_WIDTH);\n updateSizes(next, 0);\n // Return the new next sibling.\n return next;\n }\n /**\n * Join a child node of a branch with one of its siblings.\n *\n * @param node - The branch node of interest.\n *\n * @param i - The index of the child node of interest.\n *\n * @returns The first modified index.\n *\n * #### Notes\n * This may cause the branch to become underfull.\n */\n function joinChild(node, i) {\n var _a, _b, _c, _d, _e, _f;\n // Fetch the child to be joined.\n var child = node.children[i];\n // Fetch the relevant sibling.\n var sibling = i === 0 ? node.children[i + 1] : node.children[i - 1];\n // Compute the flags which control the join behavior.\n var hasNext = i === 0;\n var isLeaf = child.type === 1 /* Leaf */;\n var hasExtra = sibling.width > MIN_NODE_WIDTH;\n // Join case #1: steal from next sibling leaf\n if (isLeaf && hasExtra && hasNext) {\n // Cast the children as leaves.\n var c = child;\n var s = sibling;\n // Steal an item.\n c.items.push(s.items.shift());\n // Update the branch items.\n node.items[i + 1] = s.items[0];\n // Return the first modified index.\n return i;\n }\n // Join case #2: steal from previous sibling leaf\n if (isLeaf && hasExtra && !hasNext) {\n // Cast the children as leaves.\n var c = child;\n var s = sibling;\n // Steal an item.\n c.items.unshift(s.items.pop());\n // Update the branch items.\n node.items[i] = c.items[0];\n // Return the first modified index.\n return i - 1;\n }\n // Join case #3: merge with next sibling leaf\n if (isLeaf && !hasExtra && hasNext) {\n // Cast the children as leaves.\n var c = child;\n var s = sibling;\n // Merge items.\n (_a = s.items).unshift.apply(_a, c.items);\n // Remove the old branch child.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.children, i);\n // Remove the stale branch item.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.items, i + 1);\n // Patch up the sibling links.\n if (c.prev)\n c.prev.next = s;\n s.prev = c.prev;\n // Clear the original child.\n clear(c);\n // Return the first modified index.\n return i;\n }\n // Join case #4: merge with previous sibling leaf\n if (isLeaf && !hasExtra && !hasNext) {\n // Cast the children as leaves.\n var c = child;\n var s = sibling;\n // Merge items.\n (_b = s.items).push.apply(_b, c.items);\n // Remove the old branch child.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.children, i);\n // Remove the stale branch item.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.items, i);\n // Patch up the sibling links.\n if (c.next)\n c.next.prev = s;\n s.next = c.next;\n // Clear the original child.\n clear(c);\n // Return the first modified index.\n return i - 1;\n }\n // Join case #5: steal from next sibling branch\n if (!isLeaf && hasExtra && hasNext) {\n // Cast the children to branches.\n var c = child;\n var s = sibling;\n // Steal a child from the next sibling.\n c.children.push(s.children.shift());\n // Steal an item from the next sibling.\n c.items.push(s.items.shift());\n // Update the branch items.\n node.items[i + 1] = s.items[0];\n // Update the sibling sizes.\n updateSizes(c, c.width - 1);\n updateSizes(s, 0);\n // Return the first modified index.\n return i;\n }\n // Join case #6: steal from previous sibling branch\n if (!isLeaf && hasExtra && !hasNext) {\n // Cast the children to branches.\n var c = child;\n var s = sibling;\n // Steal a child from the previous sibling.\n c.children.unshift(s.children.pop());\n // Steal an item from the previous sibling.\n c.items.unshift(s.items.pop());\n // Update the branch items.\n node.items[i] = c.items[0];\n // Update the sibling sizes.\n updateSizes(c, 0);\n updateSizes(s, s.width - 1);\n // Return the first modified index.\n return i - 1;\n }\n // Join case #7: merge with next sibling branch\n if (!isLeaf && !hasExtra && hasNext) {\n // Cast the children to branches.\n var c = child;\n var s = sibling;\n // Merge the children with the next sibling.\n (_c = s.children).unshift.apply(_c, c.children);\n // Merge the items with the next sibling.\n (_d = s.items).unshift.apply(_d, c.items);\n // Remove the old branch child.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.children, i);\n // Remove the stale branch item.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.items, i + 1);\n // Update the sibling sizes.\n updateSizes(s, 0);\n // Clear the original child but, not its children.\n c.children.length = 0;\n clear(c);\n // Return the first modified index.\n return i;\n }\n // Join case #8: merge with previous sibling branch\n if (!isLeaf && !hasExtra && !hasNext) {\n // Cast the children to branches.\n var c = child;\n var s = sibling;\n // Merge the children with the previous sibling.\n (_e = s.children).push.apply(_e, c.children);\n // Merge the items with the previous sibling.\n (_f = s.items).push.apply(_f, c.items);\n // Remove the old branch child.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.children, i);\n // Remove the stale branch item.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(node.items, i);\n // Update the sibling sizes.\n updateSizes(s, 0);\n // Clear the original child, but not its children.\n c.children.length = 0;\n clear(c);\n // Return the first modified index.\n return i - 1;\n }\n // One of the above cases must match.\n throw 'unreachable';\n }\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n/**\n * A generic doubly-linked list.\n */\nvar LinkedList = /** @class */ (function () {\n /**\n * Construct a new linked list.\n */\n function LinkedList() {\n this._first = null;\n this._last = null;\n this._size = 0;\n }\n Object.defineProperty(LinkedList.prototype, \"isEmpty\", {\n /**\n * Whether the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get: function () {\n return this._size === 0;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LinkedList.prototype, \"size\", {\n /**\n * The size of the list.\n *\n * #### Complexity\n * `O(1)`\n *\n * #### Notes\n * This is equivalent to `length`.\n */\n get: function () {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LinkedList.prototype, \"length\", {\n /**\n * The length of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `size`.\n *\n * This property is deprecated.\n */\n get: function () {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LinkedList.prototype, \"first\", {\n /**\n * The first value in the list.\n *\n * This is `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get: function () {\n return this._first ? this._first.value : undefined;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LinkedList.prototype, \"last\", {\n /**\n * The last value in the list.\n *\n * This is `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get: function () {\n return this._last ? this._last.value : undefined;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LinkedList.prototype, \"firstNode\", {\n /**\n * The first node in the list.\n *\n * This is `null` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get: function () {\n return this._first;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LinkedList.prototype, \"lastNode\", {\n /**\n * The last node in the list.\n *\n * This is `null` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get: function () {\n return this._last;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Create an iterator over the values in the list.\n *\n * @returns A new iterator starting with the first value.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.iter = function () {\n return new LinkedList.ForwardValueIterator(this._first);\n };\n /**\n * Create a reverse iterator over the values in the list.\n *\n * @returns A new iterator starting with the last value.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.retro = function () {\n return new LinkedList.RetroValueIterator(this._last);\n };\n /**\n * Create an iterator over the nodes in the list.\n *\n * @returns A new iterator starting with the first node.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.nodes = function () {\n return new LinkedList.ForwardNodeIterator(this._first);\n };\n /**\n * Create a reverse iterator over the nodes in the list.\n *\n * @returns A new iterator starting with the last node.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.retroNodes = function () {\n return new LinkedList.RetroNodeIterator(this._last);\n };\n /**\n * Assign new values to the list, replacing all current values.\n *\n * @param values - The values to assign to the list.\n *\n * #### Complexity\n * Linear.\n */\n LinkedList.prototype.assign = function (values) {\n var _this = this;\n this.clear();\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(values, function (value) { _this.addLast(value); });\n };\n /**\n * Add a value to the end of the list.\n *\n * @param value - The value to add to the end of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `addLast`.\n */\n LinkedList.prototype.push = function (value) {\n this.addLast(value);\n };\n /**\n * Remove and return the value at the end of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `removeLast`.\n */\n LinkedList.prototype.pop = function () {\n return this.removeLast();\n };\n /**\n * Add a value to the beginning of the list.\n *\n * @param value - The value to add to the beginning of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `addFirst`.\n */\n LinkedList.prototype.shift = function (value) {\n this.addFirst(value);\n };\n /**\n * Remove and return the value at the beginning of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `removeFirst`.\n */\n LinkedList.prototype.unshift = function () {\n return this.removeFirst();\n };\n /**\n * Add a value to the beginning of the list.\n *\n * @param value - The value to add to the beginning of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.addFirst = function (value) {\n var node = new Private$1.LinkedListNode(this, value);\n if (!this._first) {\n this._first = node;\n this._last = node;\n }\n else {\n node.next = this._first;\n this._first.prev = node;\n this._first = node;\n }\n this._size++;\n return node;\n };\n /**\n * Add a value to the end of the list.\n *\n * @param value - The value to add to the end of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.addLast = function (value) {\n var node = new Private$1.LinkedListNode(this, value);\n if (!this._last) {\n this._first = node;\n this._last = node;\n }\n else {\n node.prev = this._last;\n this._last.next = node;\n this._last = node;\n }\n this._size++;\n return node;\n };\n /**\n * Insert a value before a specific node in the list.\n *\n * @param value - The value to insert before the reference node.\n *\n * @param ref - The reference node of interest. If this is `null`,\n * the value will be added to the beginning of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Notes\n * The reference node must be owned by the list.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.insertBefore = function (value, ref) {\n if (!ref || ref === this._first) {\n return this.addFirst(value);\n }\n if (!(ref instanceof Private$1.LinkedListNode) || ref.list !== this) {\n throw new Error('Reference node is not owned by the list.');\n }\n var node = new Private$1.LinkedListNode(this, value);\n var _ref = ref;\n var prev = _ref.prev;\n node.next = _ref;\n node.prev = prev;\n _ref.prev = node;\n prev.next = node;\n this._size++;\n return node;\n };\n /**\n * Insert a value after a specific node in the list.\n *\n * @param value - The value to insert after the reference node.\n *\n * @param ref - The reference node of interest. If this is `null`,\n * the value will be added to the end of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Notes\n * The reference node must be owned by the list.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.insertAfter = function (value, ref) {\n if (!ref || ref === this._last) {\n return this.addLast(value);\n }\n if (!(ref instanceof Private$1.LinkedListNode) || ref.list !== this) {\n throw new Error('Reference node is not owned by the list.');\n }\n var node = new Private$1.LinkedListNode(this, value);\n var _ref = ref;\n var next = _ref.next;\n node.next = next;\n node.prev = _ref;\n _ref.next = node;\n next.prev = node;\n this._size++;\n return node;\n };\n /**\n * Remove and return the value at the beginning of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.removeFirst = function () {\n var node = this._first;\n if (!node) {\n return undefined;\n }\n if (node === this._last) {\n this._first = null;\n this._last = null;\n }\n else {\n this._first = node.next;\n this._first.prev = null;\n }\n node.list = null;\n node.next = null;\n node.prev = null;\n this._size--;\n return node.value;\n };\n /**\n * Remove and return the value at the end of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n LinkedList.prototype.removeLast = function () {\n var node = this._last;\n if (!node) {\n return undefined;\n }\n if (node === this._first) {\n this._first = null;\n this._last = null;\n }\n else {\n this._last = node.prev;\n this._last.next = null;\n }\n node.list = null;\n node.next = null;\n node.prev = null;\n this._size--;\n return node.value;\n };\n /**\n * Remove a specific node from the list.\n *\n * @param node - The node to remove from the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * The node must be owned by the list.\n */\n LinkedList.prototype.removeNode = function (node) {\n if (!(node instanceof Private$1.LinkedListNode) || node.list !== this) {\n throw new Error('Node is not owned by the list.');\n }\n var _node = node;\n if (_node === this._first && _node === this._last) {\n this._first = null;\n this._last = null;\n }\n else if (_node === this._first) {\n this._first = _node.next;\n this._first.prev = null;\n }\n else if (_node === this._last) {\n this._last = _node.prev;\n this._last.next = null;\n }\n else {\n _node.next.prev = _node.prev;\n _node.prev.next = _node.next;\n }\n _node.list = null;\n _node.next = null;\n _node.prev = null;\n this._size--;\n };\n /**\n * Remove all values from the list.\n *\n * #### Complexity\n * Linear.\n */\n LinkedList.prototype.clear = function () {\n var node = this._first;\n while (node) {\n var next = node.next;\n node.list = null;\n node.prev = null;\n node.next = null;\n node = next;\n }\n this._first = null;\n this._last = null;\n this._size = 0;\n };\n return LinkedList;\n}());\n/**\n * The namespace for the `LinkedList` class statics.\n */\n(function (LinkedList) {\n /**\n * Create a linked list from an iterable of values.\n *\n * @param values - The iterable or array-like object of interest.\n *\n * @returns A new linked list initialized with the given values.\n *\n * #### Complexity\n * Linear.\n */\n function from(values) {\n var list = new LinkedList();\n list.assign(values);\n return list;\n }\n LinkedList.from = from;\n /**\n * A forward iterator for values in a linked list.\n */\n var ForwardValueIterator = /** @class */ (function () {\n /**\n * Construct a forward value iterator.\n *\n * @param node - The first node in the list.\n */\n function ForwardValueIterator(node) {\n this._node = node;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n ForwardValueIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n ForwardValueIterator.prototype.clone = function () {\n return new ForwardValueIterator(this._node);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n ForwardValueIterator.prototype.next = function () {\n if (!this._node) {\n return undefined;\n }\n var node = this._node;\n this._node = node.next;\n return node.value;\n };\n return ForwardValueIterator;\n }());\n LinkedList.ForwardValueIterator = ForwardValueIterator;\n /**\n * A reverse iterator for values in a linked list.\n */\n var RetroValueIterator = /** @class */ (function () {\n /**\n * Construct a retro value iterator.\n *\n * @param node - The last node in the list.\n */\n function RetroValueIterator(node) {\n this._node = node;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n RetroValueIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n RetroValueIterator.prototype.clone = function () {\n return new RetroValueIterator(this._node);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n RetroValueIterator.prototype.next = function () {\n if (!this._node) {\n return undefined;\n }\n var node = this._node;\n this._node = node.prev;\n return node.value;\n };\n return RetroValueIterator;\n }());\n LinkedList.RetroValueIterator = RetroValueIterator;\n /**\n * A forward iterator for nodes in a linked list.\n */\n var ForwardNodeIterator = /** @class */ (function () {\n /**\n * Construct a forward node iterator.\n *\n * @param node - The first node in the list.\n */\n function ForwardNodeIterator(node) {\n this._node = node;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n ForwardNodeIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n ForwardNodeIterator.prototype.clone = function () {\n return new ForwardNodeIterator(this._node);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n ForwardNodeIterator.prototype.next = function () {\n if (!this._node) {\n return undefined;\n }\n var node = this._node;\n this._node = node.next;\n return node;\n };\n return ForwardNodeIterator;\n }());\n LinkedList.ForwardNodeIterator = ForwardNodeIterator;\n /**\n * A reverse iterator for nodes in a linked list.\n */\n var RetroNodeIterator = /** @class */ (function () {\n /**\n * Construct a retro node iterator.\n *\n * @param node - The last node in the list.\n */\n function RetroNodeIterator(node) {\n this._node = node;\n }\n /**\n * Get an iterator over the object's values.\n *\n * @returns An iterator which yields the object's values.\n */\n RetroNodeIterator.prototype.iter = function () {\n return this;\n };\n /**\n * Create an independent clone of the iterator.\n *\n * @returns A new independent clone of the iterator.\n */\n RetroNodeIterator.prototype.clone = function () {\n return new RetroNodeIterator(this._node);\n };\n /**\n * Get the next value from the iterator.\n *\n * @returns The next value from the iterator, or `undefined`.\n */\n RetroNodeIterator.prototype.next = function () {\n if (!this._node) {\n return undefined;\n }\n var node = this._node;\n this._node = node.prev;\n return node;\n };\n return RetroNodeIterator;\n }());\n LinkedList.RetroNodeIterator = RetroNodeIterator;\n})(LinkedList || (LinkedList = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$1;\n(function (Private) {\n /**\n * The internal linked list node implementation.\n */\n var LinkedListNode = /** @class */ (function () {\n /**\n * Construct a new linked list node.\n *\n * @param list - The list which owns the node.\n *\n * @param value - The value for the link.\n */\n function LinkedListNode(list, value) {\n /**\n * The linked list which created and owns the node.\n */\n this.list = null;\n /**\n * The next node in the list.\n */\n this.next = null;\n /**\n * The previous node in the list.\n */\n this.prev = null;\n this.list = list;\n this.value = value;\n }\n return LinkedListNode;\n }());\n Private.LinkedListNode = LinkedListNode;\n})(Private$1 || (Private$1 = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/collections/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/commands/dist/index.es6.js":
/*!*********************************************************!*\
!*** ./node_modules/@lumino/commands/dist/index.es6.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CommandRegistry\": () => /* binding */ CommandRegistry\n/* harmony export */ });\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ \"./node_modules/@lumino/algorithm/dist/index.es6.js\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/coreutils */ \"./node_modules/@lumino/coreutils/dist/index.es6.js\");\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/disposable */ \"./node_modules/@lumino/disposable/dist/index.es6.js\");\n/* harmony import */ var _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/domutils */ \"./node_modules/@lumino/domutils/dist/index.es6.js\");\n/* harmony import */ var _lumino_keyboard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/keyboard */ \"./node_modules/@lumino/keyboard/dist/index.es6.js\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/signaling */ \"./node_modules/@lumino/signaling/dist/index.es6.js\");\n\n\n\n\n\n\n\n// Copyright (c) Jupyter Development Team.\n/**\n * An object which manages a collection of commands.\n *\n * #### Notes\n * A command registry can be used to populate a variety of action-based\n * widgets, such as command palettes, menus, and toolbars.\n */\nvar CommandRegistry = /** @class */ (function () {\n /**\n * Construct a new command registry.\n */\n function CommandRegistry() {\n this._timerID = 0;\n this._replaying = false;\n this._keystrokes = [];\n this._keydownEvents = [];\n this._keyBindings = [];\n this._exactKeyMatch = null;\n this._commands = Object.create(null);\n this._commandChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n this._commandExecuted = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n this._keyBindingChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n }\n Object.defineProperty(CommandRegistry.prototype, \"commandChanged\", {\n /**\n * A signal emitted when a command has changed.\n *\n * #### Notes\n * This signal is useful for visual representations of commands which\n * need to refresh when the state of a relevant command has changed.\n */\n get: function () {\n return this._commandChanged;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandRegistry.prototype, \"commandExecuted\", {\n /**\n * A signal emitted when a command has executed.\n *\n * #### Notes\n * Care should be taken when consuming this signal. The command system is used\n * by many components for many user actions. Handlers registered with this\n * signal must return quickly to ensure the overall application remains responsive.\n */\n get: function () {\n return this._commandExecuted;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandRegistry.prototype, \"keyBindingChanged\", {\n /**\n * A signal emitted when a key binding is changed.\n */\n get: function () {\n return this._keyBindingChanged;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandRegistry.prototype, \"keyBindings\", {\n /**\n * A read-only array of the key bindings in the registry.\n */\n get: function () {\n return this._keyBindings;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * List the ids of the registered commands.\n *\n * @returns A new array of the registered command ids.\n */\n CommandRegistry.prototype.listCommands = function () {\n return Object.keys(this._commands);\n };\n /**\n * Test whether a specific command is registered.\n *\n * @param id - The id of the command of interest.\n *\n * @returns `true` if the command is registered, `false` otherwise.\n */\n CommandRegistry.prototype.hasCommand = function (id) {\n return id in this._commands;\n };\n /**\n * Add a command to the registry.\n *\n * @param id - The unique id of the command.\n *\n * @param options - The options for the command.\n *\n * @returns A disposable which will remove the command.\n *\n * @throws An error if the given `id` is already registered.\n */\n CommandRegistry.prototype.addCommand = function (id, options) {\n var _this = this;\n // Throw an error if the id is already registered.\n if (id in this._commands) {\n throw new Error(\"Command '\" + id + \"' already registered.\");\n }\n // Add the command to the registry.\n this._commands[id] = Private.createCommand(options);\n // Emit the `commandChanged` signal.\n this._commandChanged.emit({ id: id, type: 'added' });\n // Return a disposable which will remove the command.\n return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_2__.DisposableDelegate(function () {\n // Remove the command from the registry.\n delete _this._commands[id];\n // Emit the `commandChanged` signal.\n _this._commandChanged.emit({ id: id, type: 'removed' });\n });\n };\n /**\n * Notify listeners that the state of a command has changed.\n *\n * @param id - The id of the command which has changed. If more than\n * one command has changed, this argument should be omitted.\n *\n * @throws An error if the given `id` is not registered.\n *\n * #### Notes\n * This method should be called by the command author whenever the\n * application state changes such that the results of the command\n * metadata functions may have changed.\n *\n * This will cause the `commandChanged` signal to be emitted.\n */\n CommandRegistry.prototype.notifyCommandChanged = function (id) {\n if (id !== undefined && !(id in this._commands)) {\n throw new Error(\"Command '\" + id + \"' is not registered.\");\n }\n this._commandChanged.emit({ id: id, type: id ? 'changed' : 'many-changed' });\n };\n /**\n * Get the display label for a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The display label for the command, or an empty string\n * if the command is not registered.\n */\n CommandRegistry.prototype.label = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.label.call(undefined, args) : '';\n };\n /**\n * Get the mnemonic index for a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The mnemonic index for the command, or `-1` if the\n * command is not registered.\n */\n CommandRegistry.prototype.mnemonic = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.mnemonic.call(undefined, args) : -1;\n };\n /**\n * Get the icon renderer for a specific command.\n *\n * DEPRECATED: if set to a string value, the .icon field will\n * function as an alias for the .iconClass field, for backwards\n * compatibility. In the future when this is removed, the default\n * return type will become undefined.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The icon renderer for the command, or\n * an empty string if the command is not registered.\n */\n CommandRegistry.prototype.icon = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.icon.call(undefined, args) : /* <DEPRECATED> */ '' /* </DEPRECATED> */ /* <FUTURE> undefined </FUTURE> */;\n };\n /**\n * Get the icon class for a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The icon class for the command, or an empty string if\n * the command is not registered.\n */\n CommandRegistry.prototype.iconClass = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.iconClass.call(undefined, args) : '';\n };\n /**\n * Get the icon label for a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The icon label for the command, or an empty string if\n * the command is not registered.\n */\n CommandRegistry.prototype.iconLabel = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.iconLabel.call(undefined, args) : '';\n };\n /**\n * Get the short form caption for a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The caption for the command, or an empty string if the\n * command is not registered.\n */\n CommandRegistry.prototype.caption = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.caption.call(undefined, args) : '';\n };\n /**\n * Get the usage help text for a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The usage text for the command, or an empty string if\n * the command is not registered.\n */\n CommandRegistry.prototype.usage = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.usage.call(undefined, args) : '';\n };\n /**\n * Get the extra class name for a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The class name for the command, or an empty string if\n * the command is not registered.\n */\n CommandRegistry.prototype.className = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.className.call(undefined, args) : '';\n };\n /**\n * Get the dataset for a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns The dataset for the command, or an empty dataset if\n * the command is not registered.\n */\n CommandRegistry.prototype.dataset = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.dataset.call(undefined, args) : {};\n };\n /**\n * Test whether a specific command is enabled.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns A boolean indicating whether the command is enabled,\n * or `false` if the command is not registered.\n */\n CommandRegistry.prototype.isEnabled = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.isEnabled.call(undefined, args) : false;\n };\n /**\n * Test whether a specific command is toggled.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns A boolean indicating whether the command is toggled,\n * or `false` if the command is not registered.\n */\n CommandRegistry.prototype.isToggled = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.isToggled.call(undefined, args) : false;\n };\n /**\n * Test whether a specific command is toggleable.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns A boolean indicating whether the command is toggleable,\n * or `false` if the command is not registered.\n */\n CommandRegistry.prototype.isToggleable = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.isToggleable : false;\n };\n /**\n * Test whether a specific command is visible.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns A boolean indicating whether the command is visible,\n * or `false` if the command is not registered.\n */\n CommandRegistry.prototype.isVisible = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n var cmd = this._commands[id];\n return cmd ? cmd.isVisible.call(undefined, args) : false;\n };\n /**\n * Execute a specific command.\n *\n * @param id - The id of the command of interest.\n *\n * @param args - The arguments for the command.\n *\n * @returns A promise which resolves with the result of the command.\n *\n * #### Notes\n * The promise will reject if the command throws an exception,\n * or if the command is not registered.\n */\n CommandRegistry.prototype.execute = function (id, args) {\n if (args === void 0) { args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject; }\n // Reject if the command is not registered.\n var cmd = this._commands[id];\n if (!cmd) {\n return Promise.reject(new Error(\"Command '\" + id + \"' not registered.\"));\n }\n // Execute the command and reject if an exception is thrown.\n var value;\n try {\n value = cmd.execute.call(undefined, args);\n }\n catch (err) {\n value = Promise.reject(err);\n }\n // Create the return promise which resolves the result.\n var result = Promise.resolve(value);\n // Emit the command executed signal.\n this._commandExecuted.emit({ id: id, args: args, result: result });\n // Return the result promise to the caller.\n return result;\n };\n /**\n * Add a key binding to the registry.\n *\n * @param options - The options for creating the key binding.\n *\n * @returns A disposable which removes the added key binding.\n *\n * #### Notes\n * If multiple key bindings are registered for the same sequence, the\n * binding with the highest selector specificity is executed first. A\n * tie is broken by using the most recently added key binding.\n *\n * Ambiguous key bindings are resolved with a timeout. As an example,\n * suppose two key bindings are registered: one with the key sequence\n * `['Ctrl D']`, and another with `['Ctrl D', 'Ctrl W']`. If the user\n * presses `Ctrl D`, the first binding cannot be immediately executed\n * since the user may intend to complete the chord with `Ctrl W`. For\n * such cases, a timer is used to allow the chord to be completed. If\n * the chord is not completed before the timeout, the first binding\n * is executed.\n */\n CommandRegistry.prototype.addKeyBinding = function (options) {\n var _this = this;\n // Create the binding for the given options.\n var binding = Private.createKeyBinding(options);\n // Add the key binding to the bindings array.\n this._keyBindings.push(binding);\n // Emit the `bindingChanged` signal.\n this._keyBindingChanged.emit({ binding: binding, type: 'added' });\n // Return a disposable which will remove the binding.\n return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_2__.DisposableDelegate(function () {\n // Remove the binding from the array.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeFirstOf(_this._keyBindings, binding);\n // Emit the `bindingChanged` signal.\n _this._keyBindingChanged.emit({ binding: binding, type: 'removed' });\n });\n };\n /**\n * Process a `'keydown'` event and invoke a matching key binding.\n *\n * @param event - The event object for a `'keydown'` event.\n *\n * #### Notes\n * This should be called in response to a `'keydown'` event in order\n * to invoke the command for the best matching key binding.\n *\n * The registry **does not** install its own listener for `'keydown'`\n * events. This allows the application full control over the nodes\n * and phase for which the registry processes `'keydown'` events.\n *\n * When the keydown event is processed, if the event target or any of its\n * ancestor nodes has a `data-lm-suppress-shortcuts` attribute, its keydown\n * events will not invoke commands.\n */\n CommandRegistry.prototype.processKeydownEvent = function (event) {\n // Bail immediately if playing back keystrokes.\n if (this._replaying) {\n return;\n }\n // Get the normalized keystroke for the event.\n var keystroke = CommandRegistry.keystrokeForKeydownEvent(event);\n // If the keystroke is not valid for the keyboard layout, replay\n // any suppressed events and clear the pending state.\n if (!keystroke) {\n this._replayKeydownEvents();\n this._clearPendingState();\n return;\n }\n // Add the keystroke to the current key sequence.\n this._keystrokes.push(keystroke);\n // Find the exact and partial matches for the key sequence.\n var _a = Private.matchKeyBinding(this._keyBindings, this._keystrokes, event), exact = _a.exact, partial = _a.partial;\n // If there is no exact match and no partial match, replay\n // any suppressed events and clear the pending state.\n if (!exact && !partial) {\n this._replayKeydownEvents();\n this._clearPendingState();\n return;\n }\n // Stop propagation of the event. If there is only a partial match,\n // the event will be replayed if a final exact match never occurs.\n event.preventDefault();\n event.stopPropagation();\n // If there is an exact match but no partial match, the exact match\n // can be dispatched immediately. The pending state is cleared so\n // the next key press starts from the default state.\n if (exact && !partial) {\n this._executeKeyBinding(exact);\n this._clearPendingState();\n return;\n }\n // If there is both an exact match and a partial match, the exact\n // match is stored for future dispatch in case the timer expires\n // before a more specific match is triggered.\n if (exact) {\n this._exactKeyMatch = exact;\n }\n // Store the event for possible playback in the future.\n this._keydownEvents.push(event);\n // (Re)start the timer to dispatch the most recent exact match\n // in case the partial match fails to result in an exact match.\n this._startTimer();\n };\n /**\n * Start or restart the pending timeout.\n */\n CommandRegistry.prototype._startTimer = function () {\n var _this = this;\n this._clearTimer();\n this._timerID = window.setTimeout(function () {\n _this._onPendingTimeout();\n }, Private.CHORD_TIMEOUT);\n };\n /**\n * Clear the pending timeout.\n */\n CommandRegistry.prototype._clearTimer = function () {\n if (this._timerID !== 0) {\n clearTimeout(this._timerID);\n this._timerID = 0;\n }\n };\n /**\n * Replay the keydown events which were suppressed.\n */\n CommandRegistry.prototype._replayKeydownEvents = function () {\n if (this._keydownEvents.length === 0) {\n return;\n }\n this._replaying = true;\n this._keydownEvents.forEach(Private.replayKeyEvent);\n this._replaying = false;\n };\n /**\n * Execute the command for the given key binding.\n *\n * If the command is missing or disabled, a warning will be logged.\n */\n CommandRegistry.prototype._executeKeyBinding = function (binding) {\n var command = binding.command, args = binding.args;\n if (!this.hasCommand(command) || !this.isEnabled(command, args)) {\n var word = this.hasCommand(command) ? 'enabled' : 'registered';\n var keys = binding.keys.join(', ');\n var msg1 = \"Cannot execute key binding '\" + keys + \"':\";\n var msg2 = \"command '\" + command + \"' is not \" + word + \".\";\n console.warn(msg1 + \" \" + msg2);\n return;\n }\n this.execute(command, args);\n };\n /**\n * Clear the internal pending state.\n */\n CommandRegistry.prototype._clearPendingState = function () {\n this._clearTimer();\n this._exactKeyMatch = null;\n this._keystrokes.length = 0;\n this._keydownEvents.length = 0;\n };\n /**\n * Handle the partial match timeout.\n */\n CommandRegistry.prototype._onPendingTimeout = function () {\n this._timerID = 0;\n if (this._exactKeyMatch) {\n this._executeKeyBinding(this._exactKeyMatch);\n }\n else {\n this._replayKeydownEvents();\n }\n this._clearPendingState();\n };\n return CommandRegistry;\n}());\n/**\n * The namespace for the `CommandRegistry` class statics.\n */\n(function (CommandRegistry) {\n /**\n * Parse a keystroke into its constituent components.\n *\n * @param keystroke - The keystroke of interest.\n *\n * @returns The parsed components of the keystroke.\n *\n * #### Notes\n * The keystroke should be of the form:\n * `[<modifier 1> [<modifier 2> [<modifier N> ]]]<primary key>`\n *\n * The supported modifiers are: `Accel`, `Alt`, `Cmd`, `Ctrl`, and\n * `Shift`. The `Accel` modifier is translated to `Cmd` on Mac and\n * `Ctrl` on all other platforms.\n *\n * The parsing is tolerant and will not throw exceptions. Notably:\n * - Duplicate modifiers are ignored.\n * - Extra primary keys are ignored.\n * - The order of modifiers and primary key is irrelevant.\n * - The keystroke parts should be separated by whitespace.\n * - The keystroke is case sensitive.\n */\n function parseKeystroke(keystroke) {\n var key = '';\n var alt = false;\n var cmd = false;\n var ctrl = false;\n var shift = false;\n for (var _i = 0, _a = keystroke.split(/\\s+/); _i < _a.length; _i++) {\n var token = _a[_i];\n if (token === 'Accel') {\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n cmd = true;\n }\n else {\n ctrl = true;\n }\n }\n else if (token === 'Alt') {\n alt = true;\n }\n else if (token === 'Cmd') {\n cmd = true;\n }\n else if (token === 'Ctrl') {\n ctrl = true;\n }\n else if (token === 'Shift') {\n shift = true;\n }\n else if (token.length > 0) {\n key = token;\n }\n }\n return { cmd: cmd, ctrl: ctrl, alt: alt, shift: shift, key: key };\n }\n CommandRegistry.parseKeystroke = parseKeystroke;\n /**\n * Normalize a keystroke into a canonical representation.\n *\n * @param keystroke - The keystroke of interest.\n *\n * @returns The normalized representation of the keystroke.\n *\n * #### Notes\n * This normalizes the keystroke by removing duplicate modifiers and\n * extra primary keys, and assembling the parts in a canonical order.\n *\n * The `Cmd` modifier is ignored on non-Mac platforms.\n */\n function normalizeKeystroke(keystroke) {\n var mods = '';\n var parts = parseKeystroke(keystroke);\n if (parts.ctrl) {\n mods += 'Ctrl ';\n }\n if (parts.alt) {\n mods += 'Alt ';\n }\n if (parts.shift) {\n mods += 'Shift ';\n }\n if (parts.cmd && _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n mods += 'Cmd ';\n }\n return mods + parts.key;\n }\n CommandRegistry.normalizeKeystroke = normalizeKeystroke;\n /**\n * Get the platform-specific normalized keys for an options object.\n *\n * @param options - The options for the key binding.\n *\n * @returns Array of combined, normalized keys.\n */\n function normalizeKeys(options) {\n var keys;\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_WIN) {\n keys = options.winKeys || options.keys;\n }\n else if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n keys = options.macKeys || options.keys;\n }\n else {\n keys = options.linuxKeys || options.keys;\n }\n return keys.map(normalizeKeystroke);\n }\n CommandRegistry.normalizeKeys = normalizeKeys;\n /**\n * Format a keystroke for display on the local system.\n */\n function formatKeystroke(keystroke) {\n var mods = '';\n var parts = parseKeystroke(keystroke);\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n if (parts.ctrl) {\n mods += '\\u2303 ';\n }\n if (parts.alt) {\n mods += '\\u2325 ';\n }\n if (parts.shift) {\n mods += '\\u21E7 ';\n }\n if (parts.cmd) {\n mods += '\\u2318 ';\n }\n }\n else {\n if (parts.ctrl) {\n mods += 'Ctrl+';\n }\n if (parts.alt) {\n mods += 'Alt+';\n }\n if (parts.shift) {\n mods += 'Shift+';\n }\n }\n return mods + parts.key;\n }\n CommandRegistry.formatKeystroke = formatKeystroke;\n /**\n * Create a normalized keystroke for a `'keydown'` event.\n *\n * @param event - The event object for a `'keydown'` event.\n *\n * @returns A normalized keystroke, or an empty string if the event\n * does not represent a valid keystroke for the given layout.\n */\n function keystrokeForKeydownEvent(event) {\n var key = (0,_lumino_keyboard__WEBPACK_IMPORTED_MODULE_4__.getKeyboardLayout)().keyForKeydownEvent(event);\n if (!key) {\n return '';\n }\n var mods = '';\n if (event.ctrlKey) {\n mods += 'Ctrl ';\n }\n if (event.altKey) {\n mods += 'Alt ';\n }\n if (event.shiftKey) {\n mods += 'Shift ';\n }\n if (event.metaKey && _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n mods += 'Cmd ';\n }\n return mods + key;\n }\n CommandRegistry.keystrokeForKeydownEvent = keystrokeForKeydownEvent;\n})(CommandRegistry || (CommandRegistry = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * The timeout in ms for triggering a key binding chord.\n */\n Private.CHORD_TIMEOUT = 1000;\n /**\n * Create a normalized command from an options object.\n */\n function createCommand(options) {\n var icon;\n var iconClass;\n /* <DEPRECATED> */\n if (!(options.icon) || typeof options.icon === 'string') {\n // alias icon to iconClass\n iconClass = asFunc(options.iconClass || options.icon, emptyStringFunc);\n icon = iconClass;\n }\n else {\n /* /<DEPRECATED> */\n iconClass = asFunc(options.iconClass, emptyStringFunc);\n icon = asFunc(options.icon, undefinedFunc);\n /* <DEPRECATED> */\n }\n /* </DEPRECATED> */\n return {\n execute: options.execute,\n label: asFunc(options.label, emptyStringFunc),\n mnemonic: asFunc(options.mnemonic, negativeOneFunc),\n icon: icon,\n iconClass: iconClass,\n iconLabel: asFunc(options.iconLabel, emptyStringFunc),\n caption: asFunc(options.caption, emptyStringFunc),\n usage: asFunc(options.usage, emptyStringFunc),\n className: asFunc(options.className, emptyStringFunc),\n dataset: asFunc(options.dataset, emptyDatasetFunc),\n isEnabled: options.isEnabled || trueFunc,\n isToggled: options.isToggled || falseFunc,\n isToggleable: options.isToggleable || !!options.isToggled,\n isVisible: options.isVisible || trueFunc\n };\n }\n Private.createCommand = createCommand;\n /**\n * Create a key binding object from key binding options.\n */\n function createKeyBinding(options) {\n return {\n keys: CommandRegistry.normalizeKeys(options),\n selector: validateSelector(options),\n command: options.command,\n args: options.args || _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject\n };\n }\n Private.createKeyBinding = createKeyBinding;\n /**\n * Find the key bindings which match a key sequence.\n *\n * This returns a match result which contains the best exact matching\n * binding, and a flag which indicates if there are partial matches.\n */\n function matchKeyBinding(bindings, keys, event) {\n // The current best exact match.\n var exact = null;\n // Whether a partial match has been found.\n var partial = false;\n // The match distance for the exact match.\n var distance = Infinity;\n // The specificity for the exact match.\n var specificity = 0;\n // Iterate over the bindings and search for the best match.\n for (var i = 0, n = bindings.length; i < n; ++i) {\n // Lookup the current binding.\n var binding = bindings[i];\n // Check whether the key binding sequence is a match.\n var sqm = matchSequence(binding.keys, keys);\n // If there is no match, the binding is ignored.\n if (sqm === 0 /* None */) {\n continue;\n }\n // If it is a partial match and no other partial match has been\n // found, ensure the selector matches and set the partial flag.\n if (sqm === 2 /* Partial */) {\n if (!partial && targetDistance(binding.selector, event) !== -1) {\n partial = true;\n }\n continue;\n }\n // Ignore the match if the selector doesn't match, or if the\n // matched node is farther away than the current best match.\n var td = targetDistance(binding.selector, event);\n if (td === -1 || td > distance) {\n continue;\n }\n // Get the specificity for the selector.\n var sp = _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Selector.calculateSpecificity(binding.selector);\n // Update the best match if this match is stronger.\n if (!exact || td < distance || sp >= specificity) {\n exact = binding;\n distance = td;\n specificity = sp;\n }\n }\n // Return the match result.\n return { exact: exact, partial: partial };\n }\n Private.matchKeyBinding = matchKeyBinding;\n /**\n * Replay a keyboard event.\n *\n * This synthetically dispatches a clone of the keyboard event.\n */\n function replayKeyEvent(event) {\n event.target.dispatchEvent(cloneKeyboardEvent(event));\n }\n Private.replayKeyEvent = replayKeyEvent;\n /**\n * A singleton empty string function.\n */\n var emptyStringFunc = function () { return ''; };\n /**\n * A singleton `-1` number function\n */\n var negativeOneFunc = function () { return -1; };\n /**\n * A singleton true boolean function.\n */\n var trueFunc = function () { return true; };\n /**\n * A singleton false boolean function.\n */\n var falseFunc = function () { return false; };\n /**\n * A singleton empty dataset function.\n */\n var emptyDatasetFunc = function () { return ({}); };\n /**\n * A singleton undefined function\n */\n var undefinedFunc = function () { return undefined; };\n /**\n * Cast a value or command func to a command func.\n */\n function asFunc(value, dfault) {\n if (value === undefined) {\n return dfault;\n }\n if (typeof value === 'function') {\n return value;\n }\n return function () { return value; };\n }\n /**\n * Validate the selector for an options object.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(options) {\n if (options.selector.indexOf(',') !== -1) {\n throw new Error(\"Selector cannot contain commas: \" + options.selector);\n }\n if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Selector.isValid(options.selector)) {\n throw new Error(\"Invalid selector: \" + options.selector);\n }\n return options.selector;\n }\n /**\n * Test whether a key binding sequence matches a key sequence.\n *\n * Returns a `SequenceMatch` value indicating the type of match.\n */\n function matchSequence(bindKeys, userKeys) {\n if (bindKeys.length < userKeys.length) {\n return 0 /* None */;\n }\n for (var i = 0, n = userKeys.length; i < n; ++i) {\n if (bindKeys[i] !== userKeys[i]) {\n return 0 /* None */;\n }\n }\n if (bindKeys.length > userKeys.length) {\n return 2 /* Partial */;\n }\n return 1 /* Exact */;\n }\n /**\n * Find the distance from the target node to the first matching node.\n *\n * This traverses the event path from `target` to `currentTarget` and\n * computes the distance from `target` to the first node which matches\n * the CSS selector. If no match is found, `-1` is returned.\n */\n function targetDistance(selector, event) {\n var targ = event.target;\n var curr = event.currentTarget;\n for (var dist = 0; targ !== null; targ = targ.parentElement, ++dist) {\n if (targ.hasAttribute('data-lm-suppress-shortcuts')) {\n return -1;\n }\n /* <DEPRECATED> */\n if (targ.hasAttribute('data-p-suppress-shortcuts')) {\n return -1;\n }\n /* </DEPRECATED> */\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Selector.matches(targ, selector)) {\n return dist;\n }\n if (targ === curr) {\n return -1;\n }\n }\n return -1;\n }\n /**\n * Clone a keyboard event.\n */\n function cloneKeyboardEvent(event) {\n // A custom event is required because Chrome nulls out the\n // `keyCode` field in user-generated `KeyboardEvent` types.\n var clone = document.createEvent('Event');\n var bubbles = event.bubbles || true;\n var cancelable = event.cancelable || true;\n clone.initEvent(event.type || 'keydown', bubbles, cancelable);\n clone.key = event.key || '';\n clone.keyCode = event.keyCode || 0;\n clone.which = event.keyCode || 0;\n clone.ctrlKey = event.ctrlKey || false;\n clone.altKey = event.altKey || false;\n clone.shiftKey = event.shiftKey || false;\n clone.metaKey = event.metaKey || false;\n clone.view = event.view || window;\n return clone;\n }\n})(Private || (Private = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/commands/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/coreutils/dist/index.es6.js":
/*!**********************************************************!*\
!*** ./node_modules/@lumino/coreutils/dist/index.es6.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JSONExt\": () => /* binding */ JSONExt,\n/* harmony export */ \"MimeData\": () => /* binding */ MimeData,\n/* harmony export */ \"PromiseDelegate\": () => /* binding */ PromiseDelegate,\n/* harmony export */ \"Random\": () => /* binding */ Random,\n/* harmony export */ \"Token\": () => /* binding */ Token,\n/* harmony export */ \"UUID\": () => /* binding */ UUID\n/* harmony export */ });\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for JSON-specific functions.\n */\nvar JSONExt;\n(function (JSONExt) {\n /**\n * A shared frozen empty JSONObject\n */\n JSONExt.emptyObject = Object.freeze({});\n /**\n * A shared frozen empty JSONArray\n */\n JSONExt.emptyArray = Object.freeze([]);\n /**\n * Test whether a JSON value is a primitive.\n *\n * @param value - The JSON value of interest.\n *\n * @returns `true` if the value is a primitive,`false` otherwise.\n */\n function isPrimitive(value) {\n return (value === null ||\n typeof value === 'boolean' ||\n typeof value === 'number' ||\n typeof value === 'string');\n }\n JSONExt.isPrimitive = isPrimitive;\n function isArray(value) {\n return Array.isArray(value);\n }\n JSONExt.isArray = isArray;\n function isObject(value) {\n return !isPrimitive(value) && !isArray(value);\n }\n JSONExt.isObject = isObject;\n /**\n * Compare two JSON values for deep equality.\n *\n * @param first - The first JSON value of interest.\n *\n * @param second - The second JSON value of interest.\n *\n * @returns `true` if the values are equivalent, `false` otherwise.\n */\n function deepEqual(first, second) {\n // Check referential and primitive equality first.\n if (first === second) {\n return true;\n }\n // If one is a primitive, the `===` check ruled out the other.\n if (isPrimitive(first) || isPrimitive(second)) {\n return false;\n }\n // Test whether they are arrays.\n var a1 = isArray(first);\n var a2 = isArray(second);\n // Bail if the types are different.\n if (a1 !== a2) {\n return false;\n }\n // If they are both arrays, compare them.\n if (a1 && a2) {\n return deepArrayEqual(first, second);\n }\n // At this point, they must both be objects.\n return deepObjectEqual(first, second);\n }\n JSONExt.deepEqual = deepEqual;\n /**\n * Create a deep copy of a JSON value.\n *\n * @param value - The JSON value to copy.\n *\n * @returns A deep copy of the given JSON value.\n */\n function deepCopy(value) {\n // Do nothing for primitive values.\n if (isPrimitive(value)) {\n return value;\n }\n // Deep copy an array.\n if (isArray(value)) {\n return deepArrayCopy(value);\n }\n // Deep copy an object.\n return deepObjectCopy(value);\n }\n JSONExt.deepCopy = deepCopy;\n /**\n * Compare two JSON arrays for deep equality.\n */\n function deepArrayEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Test the arrays for equal length.\n if (first.length !== second.length) {\n return false;\n }\n // Compare the values for equality.\n for (var i = 0, n = first.length; i < n; ++i) {\n if (!deepEqual(first[i], second[i])) {\n return false;\n }\n }\n // At this point, the arrays are equal.\n return true;\n }\n /**\n * Compare two JSON objects for deep equality.\n */\n function deepObjectEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Check for the first object's keys in the second object.\n for (var key in first) {\n if (first[key] !== undefined && !(key in second)) {\n return false;\n }\n }\n // Check for the second object's keys in the first object.\n for (var key in second) {\n if (second[key] !== undefined && !(key in first)) {\n return false;\n }\n }\n // Compare the values for equality.\n for (var key in first) {\n // Get the values.\n var firstValue = first[key];\n var secondValue = second[key];\n // If both are undefined, ignore the key.\n if (firstValue === undefined && secondValue === undefined) {\n continue;\n }\n // If only one value is undefined, the objects are not equal.\n if (firstValue === undefined || secondValue === undefined) {\n return false;\n }\n // Compare the values.\n if (!deepEqual(firstValue, secondValue)) {\n return false;\n }\n }\n // At this point, the objects are equal.\n return true;\n }\n /**\n * Create a deep copy of a JSON array.\n */\n function deepArrayCopy(value) {\n var result = new Array(value.length);\n for (var i = 0, n = value.length; i < n; ++i) {\n result[i] = deepCopy(value[i]);\n }\n return result;\n }\n /**\n * Create a deep copy of a JSON object.\n */\n function deepObjectCopy(value) {\n var result = {};\n for (var key in value) {\n // Ignore undefined values.\n var subvalue = value[key];\n if (subvalue === undefined) {\n continue;\n }\n result[key] = deepCopy(subvalue);\n }\n return result;\n }\n})(JSONExt || (JSONExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * An object which stores MIME data for general application use.\n *\n * #### Notes\n * This class does not attempt to enforce \"correctness\" of MIME types\n * and their associated data. Since this class is designed to transfer\n * arbitrary data and objects within the same application, it assumes\n * that the user provides correct and accurate data.\n */\nvar MimeData = /** @class */ (function () {\n function MimeData() {\n this._types = [];\n this._values = [];\n }\n /**\n * Get an array of the MIME types contained within the dataset.\n *\n * @returns A new array of the MIME types, in order of insertion.\n */\n MimeData.prototype.types = function () {\n return this._types.slice();\n };\n /**\n * Test whether the dataset has an entry for the given type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns `true` if the dataset contains a value for the given\n * MIME type, `false` otherwise.\n */\n MimeData.prototype.hasData = function (mime) {\n return this._types.indexOf(mime) !== -1;\n };\n /**\n * Get the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns The value for the given MIME type, or `undefined` if\n * the dataset does not contain a value for the type.\n */\n MimeData.prototype.getData = function (mime) {\n var i = this._types.indexOf(mime);\n return i !== -1 ? this._values[i] : undefined;\n };\n /**\n * Set the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @param data - The data value for the given MIME type.\n *\n * #### Notes\n * This will overwrite any previous entry for the MIME type.\n */\n MimeData.prototype.setData = function (mime, data) {\n this.clearData(mime);\n this._types.push(mime);\n this._values.push(data);\n };\n /**\n * Remove the data entry for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * #### Notes\n * This is a no-op if there is no entry for the given MIME type.\n */\n MimeData.prototype.clearData = function (mime) {\n var i = this._types.indexOf(mime);\n if (i !== -1) {\n this._types.splice(i, 1);\n this._values.splice(i, 1);\n }\n };\n /**\n * Remove all data entries from the dataset.\n */\n MimeData.prototype.clear = function () {\n this._types.length = 0;\n this._values.length = 0;\n };\n return MimeData;\n}());\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * A class which wraps a promise into a delegate object.\n *\n * #### Notes\n * This class is useful when the logic to resolve or reject a promise\n * cannot be defined at the point where the promise is created.\n */\nvar PromiseDelegate = /** @class */ (function () {\n /**\n * Construct a new promise delegate.\n */\n function PromiseDelegate() {\n var _this = this;\n this.promise = new Promise(function (resolve, reject) {\n _this._resolve = resolve;\n _this._reject = reject;\n });\n }\n /**\n * Resolve the wrapped promise with the given value.\n *\n * @param value - The value to use for resolving the promise.\n */\n PromiseDelegate.prototype.resolve = function (value) {\n var resolve = this._resolve;\n resolve(value);\n };\n /**\n * Reject the wrapped promise with the given value.\n *\n * @reason - The reason for rejecting the promise.\n */\n PromiseDelegate.prototype.reject = function (reason) {\n var reject = this._reject;\n reject(reason);\n };\n return PromiseDelegate;\n}());\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for random number related functionality.\n */\nvar Random;\n(function (Random) {\n /**\n * A function which generates random bytes.\n *\n * @param buffer - The `Uint8Array` to fill with random bytes.\n *\n * #### Notes\n * A cryptographically strong random number generator will be used if\n * available. Otherwise, `Math.random` will be used as a fallback for\n * randomness.\n *\n * The following RNGs are supported, listed in order of precedence:\n * - `window.crypto.getRandomValues`\n * - `window.msCrypto.getRandomValues`\n * - `require('crypto').randomFillSync\n * - `require('crypto').randomBytes\n * - `Math.random`\n */\n Random.getRandomValues = (function () {\n // Look up the crypto module if available.\n var crypto = ((typeof window !== 'undefined' && (window.crypto || window.msCrypto)) ||\n ( true && __webpack_require__(/*! crypto */ \"?8465\")) || null);\n // Modern browsers and IE 11\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return function getRandomValues(buffer) {\n return crypto.getRandomValues(buffer);\n };\n }\n // Node 7+\n if (crypto && typeof crypto.randomFillSync === 'function') {\n return function getRandomValues(buffer) {\n return crypto.randomFillSync(buffer);\n };\n }\n // Node 0.10+\n if (crypto && typeof crypto.randomBytes === 'function') {\n return function getRandomValues(buffer) {\n var bytes = crypto.randomBytes(buffer.length);\n for (var i = 0, n = bytes.length; i < n; ++i) {\n buffer[i] = bytes[i];\n }\n };\n }\n // Fallback\n return function getRandomValues(buffer) {\n var value = 0;\n for (var i = 0, n = buffer.length; i < n; ++i) {\n if (i % 4 === 0) {\n value = Math.random() * 0xFFFFFFFF >>> 0;\n }\n buffer[i] = value & 0xFF;\n value >>>= 8;\n }\n };\n })();\n})(Random || (Random = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * A runtime object which captures compile-time type information.\n *\n * #### Notes\n * A token captures the compile-time type of an interface or class in\n * an object which can be used at runtime in a type-safe fashion.\n */\nvar Token = /** @class */ (function () {\n /**\n * Construct a new token.\n *\n * @param name - A human readable name for the token.\n */\n function Token(name) {\n this.name = name;\n this._tokenStructuralPropertyT = null;\n }\n return Token;\n}());\n\n// Copyright (c) Jupyter Development Team.\n/**\n * The namespace for UUID related functionality.\n */\nvar UUID;\n(function (UUID) {\n /**\n * A function which generates UUID v4 identifiers.\n *\n * @returns A new UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n UUID.uuid4 = (function () {\n // Create a 16 byte array to hold the random values.\n var bytes = new Uint8Array(16);\n // Create a look up table from bytes to hex strings.\n var lut = new Array(256);\n // Pad the single character hex digits with a leading zero.\n for (var i = 0; i < 16; ++i) {\n lut[i] = '0' + i.toString(16);\n }\n // Populate the rest of the hex digits.\n for (var i = 16; i < 256; ++i) {\n lut[i] = i.toString(16);\n }\n // Return a function which generates the UUID.\n return function uuid4() {\n // Get a new batch of random values.\n Random.getRandomValues(bytes);\n // Set the UUID version number to 4.\n bytes[6] = 0x40 | (bytes[6] & 0x0F);\n // Set the clock sequence bit to the RFC spec.\n bytes[8] = 0x80 | (bytes[8] & 0x3F);\n // Assemble the UUID string.\n return (lut[bytes[0]] +\n lut[bytes[1]] +\n lut[bytes[2]] +\n lut[bytes[3]] +\n '-' +\n lut[bytes[4]] +\n lut[bytes[5]] +\n '-' +\n lut[bytes[6]] +\n lut[bytes[7]] +\n '-' +\n lut[bytes[8]] +\n lut[bytes[9]] +\n '-' +\n lut[bytes[10]] +\n lut[bytes[11]] +\n lut[bytes[12]] +\n lut[bytes[13]] +\n lut[bytes[14]] +\n lut[bytes[15]]);\n };\n })();\n})(UUID || (UUID = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/coreutils/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/disposable/dist/index.es6.js":
/*!***********************************************************!*\
!*** ./node_modules/@lumino/disposable/dist/index.es6.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DisposableDelegate\": () => /* binding */ DisposableDelegate,\n/* harmony export */ \"DisposableSet\": () => /* binding */ DisposableSet,\n/* harmony export */ \"ObservableDisposableDelegate\": () => /* binding */ ObservableDisposableDelegate,\n/* harmony export */ \"ObservableDisposableSet\": () => /* binding */ ObservableDisposableSet\n/* harmony export */ });\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ \"./node_modules/@lumino/algorithm/dist/index.es6.js\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ \"./node_modules/@lumino/signaling/dist/index.es6.js\");\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * A disposable object which delegates to a callback function.\n */\nvar DisposableDelegate = /** @class */ (function () {\n /**\n * Construct a new disposable delegate.\n *\n * @param fn - The callback function to invoke on dispose.\n */\n function DisposableDelegate(fn) {\n this._fn = fn;\n }\n Object.defineProperty(DisposableDelegate.prototype, \"isDisposed\", {\n /**\n * Test whether the delegate has been disposed.\n */\n get: function () {\n return !this._fn;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Dispose of the delegate and invoke the callback function.\n */\n DisposableDelegate.prototype.dispose = function () {\n if (!this._fn) {\n return;\n }\n var fn = this._fn;\n this._fn = null;\n fn();\n };\n return DisposableDelegate;\n}());\n/**\n * An observable disposable object which delegates to a callback function.\n */\nvar ObservableDisposableDelegate = /** @class */ (function (_super) {\n __extends(ObservableDisposableDelegate, _super);\n function ObservableDisposableDelegate() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._disposed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(_this);\n return _this;\n }\n Object.defineProperty(ObservableDisposableDelegate.prototype, \"disposed\", {\n /**\n * A signal emitted when the delegate is disposed.\n */\n get: function () {\n return this._disposed;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Dispose of the delegate and invoke the callback function.\n */\n ObservableDisposableDelegate.prototype.dispose = function () {\n if (this.isDisposed) {\n return;\n }\n _super.prototype.dispose.call(this);\n this._disposed.emit(undefined);\n _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal.clearData(this);\n };\n return ObservableDisposableDelegate;\n}(DisposableDelegate));\n/**\n * An object which manages a collection of disposable items.\n */\nvar DisposableSet = /** @class */ (function () {\n /**\n * Construct a new disposable set.\n */\n function DisposableSet() {\n this._isDisposed = false;\n this._items = new Set();\n }\n Object.defineProperty(DisposableSet.prototype, \"isDisposed\", {\n /**\n * Test whether the set has been disposed.\n */\n get: function () {\n return this._isDisposed;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Dispose of the set and the items it contains.\n *\n * #### Notes\n * Items are disposed in the order they are added to the set.\n */\n DisposableSet.prototype.dispose = function () {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n this._items.forEach(function (item) { item.dispose(); });\n this._items.clear();\n };\n /**\n * Test whether the set contains a specific item.\n *\n * @param item - The item of interest.\n *\n * @returns `true` if the set contains the item, `false` otherwise.\n */\n DisposableSet.prototype.contains = function (item) {\n return this._items.has(item);\n };\n /**\n * Add a disposable item to the set.\n *\n * @param item - The item to add to the set.\n *\n * #### Notes\n * If the item is already contained in the set, this is a no-op.\n */\n DisposableSet.prototype.add = function (item) {\n this._items.add(item);\n };\n /**\n * Remove a disposable item from the set.\n *\n * @param item - The item to remove from the set.\n *\n * #### Notes\n * If the item is not contained in the set, this is a no-op.\n */\n DisposableSet.prototype.remove = function (item) {\n this._items.delete(item);\n };\n /**\n * Remove all items from the set.\n */\n DisposableSet.prototype.clear = function () {\n this._items.clear();\n };\n return DisposableSet;\n}());\n/**\n * The namespace for the `DisposableSet` class statics.\n */\n(function (DisposableSet) {\n /**\n * Create a disposable set from an iterable of items.\n *\n * @param items - The iterable or array-like object of interest.\n *\n * @returns A new disposable initialized with the given items.\n */\n function from(items) {\n var set = new DisposableSet();\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(items, function (item) { set.add(item); });\n return set;\n }\n DisposableSet.from = from;\n})(DisposableSet || (DisposableSet = {}));\n/**\n * An observable object which manages a collection of disposable items.\n */\nvar ObservableDisposableSet = /** @class */ (function (_super) {\n __extends(ObservableDisposableSet, _super);\n function ObservableDisposableSet() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._disposed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal(_this);\n return _this;\n }\n Object.defineProperty(ObservableDisposableSet.prototype, \"disposed\", {\n /**\n * A signal emitted when the set is disposed.\n */\n get: function () {\n return this._disposed;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Dispose of the set and the items it contains.\n *\n * #### Notes\n * Items are disposed in the order they are added to the set.\n */\n ObservableDisposableSet.prototype.dispose = function () {\n if (this.isDisposed) {\n return;\n }\n _super.prototype.dispose.call(this);\n this._disposed.emit(undefined);\n _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__.Signal.clearData(this);\n };\n return ObservableDisposableSet;\n}(DisposableSet));\n/**\n * The namespace for the `ObservableDisposableSet` class statics.\n */\n(function (ObservableDisposableSet) {\n /**\n * Create an observable disposable set from an iterable of items.\n *\n * @param items - The iterable or array-like object of interest.\n *\n * @returns A new disposable initialized with the given items.\n */\n function from(items) {\n var set = new ObservableDisposableSet();\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(items, function (item) { set.add(item); });\n return set;\n }\n ObservableDisposableSet.from = from;\n})(ObservableDisposableSet || (ObservableDisposableSet = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/disposable/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/domutils/dist/index.es6.js":
/*!*********************************************************!*\
!*** ./node_modules/@lumino/domutils/dist/index.es6.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ClipboardExt\": () => /* binding */ ClipboardExt,\n/* harmony export */ \"ElementExt\": () => /* binding */ ElementExt,\n/* harmony export */ \"Platform\": () => /* binding */ Platform,\n/* harmony export */ \"Selector\": () => /* binding */ Selector\n/* harmony export */ });\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2019, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for clipboard related functionality.\n */\nvar ClipboardExt;\n(function (ClipboardExt) {\n /**\n * Copy text to the system clipboard.\n *\n * @param text - The text to copy to the clipboard.\n */\n function copyText(text) {\n // Fetch the document body.\n var body = document.body;\n // Set up the clipboard event listener.\n var handler = function (event) {\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n // Set the clipboard data.\n event.clipboardData.setData('text', text);\n // Remove the event listener.\n body.removeEventListener('copy', handler, true);\n };\n // Add the event listener.\n body.addEventListener('copy', handler, true);\n // Trigger the event.\n document.execCommand('copy');\n }\n ClipboardExt.copyText = copyText;\n})(ClipboardExt || (ClipboardExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for element related utilities.\n */\nvar ElementExt;\n(function (ElementExt) {\n /**\n * Compute the box sizing for an element.\n *\n * @param element - The element of interest.\n *\n * @returns The box sizing data for the specified element.\n */\n function boxSizing(element) {\n var style = window.getComputedStyle(element);\n var bt = parseFloat(style.borderTopWidth) || 0;\n var bl = parseFloat(style.borderLeftWidth) || 0;\n var br = parseFloat(style.borderRightWidth) || 0;\n var bb = parseFloat(style.borderBottomWidth) || 0;\n var pt = parseFloat(style.paddingTop) || 0;\n var pl = parseFloat(style.paddingLeft) || 0;\n var pr = parseFloat(style.paddingRight) || 0;\n var pb = parseFloat(style.paddingBottom) || 0;\n var hs = bl + pl + pr + br;\n var vs = bt + pt + pb + bb;\n return {\n borderTop: bt,\n borderLeft: bl,\n borderRight: br,\n borderBottom: bb,\n paddingTop: pt,\n paddingLeft: pl,\n paddingRight: pr,\n paddingBottom: pb,\n horizontalSum: hs,\n verticalSum: vs\n };\n }\n ElementExt.boxSizing = boxSizing;\n /**\n * Compute the size limits for an element.\n *\n * @param element - The element of interest.\n *\n * @returns The size limit data for the specified element.\n */\n function sizeLimits(element) {\n var style = window.getComputedStyle(element);\n var minWidth = parseFloat(style.minWidth) || 0;\n var minHeight = parseFloat(style.minHeight) || 0;\n var maxWidth = parseFloat(style.maxWidth) || Infinity;\n var maxHeight = parseFloat(style.maxHeight) || Infinity;\n maxWidth = Math.max(minWidth, maxWidth);\n maxHeight = Math.max(minHeight, maxHeight);\n return { minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight };\n }\n ElementExt.sizeLimits = sizeLimits;\n /**\n * Test whether a client position lies within an element.\n *\n * @param element - The DOM element of interest.\n *\n * @param clientX - The client X coordinate of interest.\n *\n * @param clientY - The client Y coordinate of interest.\n *\n * @returns Whether the point is within the given element.\n */\n function hitTest(element, clientX, clientY) {\n var rect = element.getBoundingClientRect();\n return (clientX >= rect.left &&\n clientX < rect.right &&\n clientY >= rect.top &&\n clientY < rect.bottom);\n }\n ElementExt.hitTest = hitTest;\n /**\n * Vertically scroll an element into view if needed.\n *\n * @param area - The scroll area element.\n *\n * @param element - The element of interest.\n *\n * #### Notes\n * This follows the \"nearest\" behavior of the native `scrollIntoView`\n * method, which is not supported by all browsers.\n * https://drafts.csswg.org/cssom-view/#element-scrolling-members\n *\n * If the element fully covers the visible area or is fully contained\n * within the visible area, no scrolling will take place. Otherwise,\n * the nearest edges of the area and element are aligned.\n */\n function scrollIntoViewIfNeeded(area, element) {\n var ar = area.getBoundingClientRect();\n var er = element.getBoundingClientRect();\n if (er.top <= ar.top && er.bottom >= ar.bottom) {\n return;\n }\n if (er.top < ar.top && er.height <= ar.height) {\n area.scrollTop -= ar.top - er.top;\n return;\n }\n if (er.bottom > ar.bottom && er.height >= ar.height) {\n area.scrollTop -= ar.top - er.top;\n return;\n }\n if (er.top < ar.top && er.height > ar.height) {\n area.scrollTop -= ar.bottom - er.bottom;\n return;\n }\n if (er.bottom > ar.bottom && er.height < ar.height) {\n area.scrollTop -= ar.bottom - er.bottom;\n return;\n }\n }\n ElementExt.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;\n})(ElementExt || (ElementExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for platform related utilities.\n */\nvar Platform;\n(function (Platform) {\n /**\n * A flag indicating whether the platform is Mac.\n */\n Platform.IS_MAC = !!navigator.platform.match(/Mac/i);\n /**\n * A flag indicating whether the platform is Windows.\n */\n Platform.IS_WIN = !!navigator.platform.match(/Win/i);\n /**\n * A flag indicating whether the browser is IE.\n */\n Platform.IS_IE = /Trident/.test(navigator.userAgent);\n /**\n * A flag indicating whether the browser is Edge.\n */\n Platform.IS_EDGE = /Edge/.test(navigator.userAgent);\n /**\n * Test whether the `accel` key is pressed.\n *\n * @param event - The keyboard or mouse event of interest.\n *\n * @returns Whether the `accel` key is pressed.\n *\n * #### Notes\n * On Mac the `accel` key is the command key. On all other\n * platforms the `accel` key is the control key.\n */\n function accelKey(event) {\n return Platform.IS_MAC ? event.metaKey : event.ctrlKey;\n }\n Platform.accelKey = accelKey;\n})(Platform || (Platform = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for selector related utilities.\n */\nvar Selector;\n(function (Selector) {\n /**\n * Calculate the specificity of a single CSS selector.\n *\n * @param selector - The CSS selector of interest.\n *\n * @returns The specificity of the selector.\n *\n * #### Undefined Behavior\n * The selector is invalid.\n *\n * #### Notes\n * This is based on https://www.w3.org/TR/css3-selectors/#specificity\n *\n * A larger number represents a more specific selector.\n *\n * The smallest possible specificity is `0`.\n *\n * The result is represented as a hex number `0x<aa><bb><cc>` where\n * each component is the count of the respective selector clause.\n *\n * If the selector contains commas, only the first clause is used.\n *\n * The computed result is cached, so subsequent calculations for the\n * same selector are extremely fast.\n */\n function calculateSpecificity(selector) {\n if (selector in Private.specificityCache) {\n return Private.specificityCache[selector];\n }\n var result = Private.calculateSingle(selector);\n return Private.specificityCache[selector] = result;\n }\n Selector.calculateSpecificity = calculateSpecificity;\n /**\n * Test whether a selector is a valid CSS selector.\n *\n * @param selector - The CSS selector of interest.\n *\n * @returns `true` if the selector is valid, `false` otherwise.\n *\n * #### Notes\n * The computed result is cached, so subsequent tests for the same\n * selector are extremely fast.\n */\n function isValid(selector) {\n if (selector in Private.validityCache) {\n return Private.validityCache[selector];\n }\n var result = true;\n try {\n Private.testElem.querySelector(selector);\n }\n catch (err) {\n result = false;\n }\n return Private.validityCache[selector] = result;\n }\n Selector.isValid = isValid;\n /**\n * Test whether an element matches a CSS selector.\n *\n * @param element - The element of interest.\n *\n * @param selector - The valid CSS selector of interest.\n *\n * @returns `true` if the element is a match, `false` otherwise.\n *\n * #### Notes\n * This function uses the builtin browser capabilities when possible,\n * falling back onto a document query otherwise.\n */\n function matches(element, selector) {\n return Private.protoMatchFunc.call(element, selector);\n }\n Selector.matches = matches;\n})(Selector || (Selector = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * A cache of computed selector specificity values.\n */\n Private.specificityCache = Object.create(null);\n /**\n * A cache of computed selector validity.\n */\n Private.validityCache = Object.create(null);\n /**\n * An empty element for testing selector validity.\n */\n Private.testElem = document.createElement('div');\n /**\n * A cross-browser CSS selector matching prototype function.\n */\n Private.protoMatchFunc = (function () {\n var proto = Element.prototype;\n return (proto.matches ||\n proto.matchesSelector ||\n proto.mozMatchesSelector ||\n proto.msMatchesSelector ||\n proto.oMatchesSelector ||\n proto.webkitMatchesSelector ||\n (function (selector) {\n var elem = this;\n var matches = elem.ownerDocument ? elem.ownerDocument.querySelectorAll(selector) : [];\n return Array.prototype.indexOf.call(matches, elem) !== -1;\n }));\n })();\n /**\n * Calculate the specificity of a single selector.\n *\n * The behavior is undefined if the selector is invalid.\n */\n function calculateSingle(selector) {\n // Ignore anything after the first comma.\n selector = selector.split(',', 1)[0];\n // Setup the aggregate counters.\n var a = 0;\n var b = 0;\n var c = 0;\n // Apply a regex to the front of the selector. If it succeeds, that\n // portion of the selector is removed. Returns a success/fail flag.\n function match(re) {\n var match = selector.match(re);\n if (match === null) {\n return false;\n }\n selector = selector.slice(match[0].length);\n return true;\n }\n // Replace the negation pseudo-class (which is ignored),\n // but keep its inner content (which is not ignored).\n selector = selector.replace(NEGATION_RE, ' $1 ');\n // Continue matching until the selector is consumed.\n while (selector.length > 0) {\n // Match an ID selector.\n if (match(ID_RE)) {\n a++;\n continue;\n }\n // Match a class selector.\n if (match(CLASS_RE)) {\n b++;\n continue;\n }\n // Match an attribute selector.\n if (match(ATTR_RE)) {\n b++;\n continue;\n }\n // Match a pseudo-element selector. This is done before matching\n // a pseudo-class since this regex overlaps with that regex.\n if (match(PSEUDO_ELEM_RE)) {\n c++;\n continue;\n }\n // Match a pseudo-class selector.\n if (match(PSEDUO_CLASS_RE)) {\n b++;\n continue;\n }\n // Match a plain type selector.\n if (match(TYPE_RE)) {\n c++;\n continue;\n }\n // Finally, match any ignored characters.\n if (match(IGNORE_RE)) {\n continue;\n }\n // At this point, the selector is assumed to be invalid.\n return 0;\n }\n // Clamp each component to a reasonable base.\n a = Math.min(a, 0xFF);\n b = Math.min(b, 0xFF);\n c = Math.min(c, 0xFF);\n // Combine the components into a single result.\n return (a << 16) | (b << 8) | c;\n }\n Private.calculateSingle = calculateSingle;\n /**\n * A regex which matches an ID selector at string start.\n */\n var ID_RE = /^#[^\\s\\+>~#\\.\\[:]+/;\n /**\n * A regex which matches a class selector at string start.\n */\n var CLASS_RE = /^\\.[^\\s\\+>~#\\.\\[:]+/;\n /**\n * A regex which matches an attribute selector at string start.\n */\n var ATTR_RE = /^\\[[^\\]]+\\]/;\n /**\n * A regex which matches a type selector at string start.\n */\n var TYPE_RE = /^[^\\s\\+>~#\\.\\[:]+/;\n /**\n * A regex which matches a pseudo-element selector at string start.\n */\n var PSEUDO_ELEM_RE = /^(::[^\\s\\+>~#\\.\\[:]+|:first-line|:first-letter|:before|:after)/;\n /**\n * A regex which matches a pseudo-class selector at string start.\n */\n var PSEDUO_CLASS_RE = /^:[^\\s\\+>~#\\.\\[:]+/;\n /**\n * A regex which matches ignored characters at string start.\n */\n var IGNORE_RE = /^[\\s\\+>~\\*]+/;\n /**\n * A regex which matches the negation pseudo-class globally.\n */\n var NEGATION_RE = /:not\\(([^\\)]+)\\)/g;\n})(Private || (Private = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/domutils/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/dragdrop/dist/index.es6.js":
/*!*********************************************************!*\
!*** ./node_modules/@lumino/dragdrop/dist/index.es6.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Drag\": () => /* binding */ Drag\n/* harmony export */ });\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/disposable */ \"./node_modules/@lumino/disposable/dist/index.es6.js\");\n\n\n/**\n * An object which manages a drag-drop operation.\n *\n * A drag object dispatches four different events to drop targets:\n *\n * - `'lm-dragenter'` - Dispatched when the mouse enters the target\n * element. This event must be canceled in order to receive any\n * of the other events.\n *\n * - `'lm-dragover'` - Dispatched when the mouse moves over the drop\n * target. It must cancel the event and set the `dropAction` to one\n * of the supported actions in order to receive drop events.\n *\n * - `'lm-dragleave'` - Dispatched when the mouse leaves the target\n * element. This includes moving the mouse into child elements.\n *\n * - `'lm-drop'`- Dispatched when the mouse is released over the target\n * element when the target indicates an appropriate drop action. If\n * the event is canceled, the indicated drop action is returned to\n * the initiator through the resolved promise.\n *\n * A drag operation can be terminated at any time by pressing `Escape`\n * or by disposing the drag object.\n *\n * A drag object has the ability to automatically scroll a scrollable\n * element when the mouse is hovered near one of its edges. To enable\n * this, add the `data-lm-dragscroll` attribute to any element which\n * the drag object should consider for scrolling.\n *\n * #### Notes\n * This class is designed to be used when dragging and dropping custom\n * data *within* a single application. It is *not* a replacement for\n * the native drag-drop API. Instead, it provides an API which allows\n * drag operations to be initiated programmatically and enables the\n * transfer of arbitrary non-string objects; features which are not\n * possible with the native drag-drop API.\n */\nvar Drag = /** @class */ (function () {\n /**\n * Construct a new drag object.\n *\n * @param options - The options for initializing the drag.\n */\n function Drag(options) {\n var _this = this;\n /**\n * The scroll loop handler function.\n */\n this._onScrollFrame = function () {\n // Bail early if there is no scroll target.\n if (!_this._scrollTarget) {\n return;\n }\n // Unpack the scroll target.\n var _a = _this._scrollTarget, element = _a.element, edge = _a.edge, distance = _a.distance;\n // Calculate the scroll delta using nonlinear acceleration.\n var d = Private.SCROLL_EDGE_SIZE - distance;\n var f = Math.pow(d / Private.SCROLL_EDGE_SIZE, 2);\n var s = Math.max(1, Math.round(f * Private.SCROLL_EDGE_SIZE));\n // Scroll the element in the specified direction.\n switch (edge) {\n case 'top':\n element.scrollTop -= s;\n break;\n case 'left':\n element.scrollLeft -= s;\n break;\n case 'right':\n element.scrollLeft += s;\n break;\n case 'bottom':\n element.scrollTop += s;\n break;\n }\n // Request the next cycle of the scroll loop.\n requestAnimationFrame(_this._onScrollFrame);\n };\n this._disposed = false;\n this._dropAction = 'none';\n this._override = null;\n this._currentTarget = null;\n this._currentElement = null;\n this._promise = null;\n this._scrollTarget = null;\n this._resolve = null;\n this.mimeData = options.mimeData;\n this.dragImage = options.dragImage || null;\n this.proposedAction = options.proposedAction || 'copy';\n this.supportedActions = options.supportedActions || 'all';\n this.source = options.source || null;\n }\n /**\n * Dispose of the resources held by the drag object.\n *\n * #### Notes\n * This will cancel the drag operation if it is active.\n */\n Drag.prototype.dispose = function () {\n // Do nothing if the drag object is already disposed.\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n // If there is a current target, dispatch a drag leave event.\n if (this._currentTarget) {\n var event_1 = Private.createMouseEvent('mouseup', -1, -1);\n Private.dispatchDragLeave(this, this._currentTarget, null, event_1);\n }\n // Finalize the drag object with `'none'`.\n this._finalize('none');\n };\n Object.defineProperty(Drag.prototype, \"isDisposed\", {\n /**\n * Test whether the drag object is disposed.\n */\n get: function () {\n return this._disposed;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Start the drag operation at the specified client position.\n *\n * @param clientX - The client X position for the drag start.\n *\n * @param clientY - The client Y position for the drag start.\n *\n * @returns A promise which resolves to the result of the drag.\n *\n * #### Notes\n * If the drag has already been started, the promise created by the\n * first call to `start` is returned.\n *\n * If the drag operation has ended, or if the drag object has been\n * disposed, the returned promise will resolve to `'none'`.\n *\n * The drag object will be automatically disposed when drag operation\n * completes. This means `Drag` objects are for single-use only.\n *\n * This method assumes the left mouse button is already held down.\n */\n Drag.prototype.start = function (clientX, clientY) {\n var _this = this;\n // If the drag object is already disposed, resolve to `None`.\n if (this._disposed) {\n return Promise.resolve('none');\n }\n // If the drag has already been started, return the promise.\n if (this._promise) {\n return this._promise;\n }\n // Install the document listeners for the drag object.\n this._addListeners();\n // Attach the drag image at the specified client position.\n this._attachDragImage(clientX, clientY);\n // Create the promise which will be resolved on completion.\n this._promise = new Promise(function (resolve, reject) {\n _this._resolve = resolve;\n });\n // Trigger a fake move event to kick off the drag operation.\n var event = Private.createMouseEvent('mousemove', clientX, clientY);\n document.dispatchEvent(event);\n // Return the pending promise for the drag operation.\n return this._promise;\n };\n /**\n * Handle the DOM events for the drag operation.\n *\n * @param event - The DOM event sent to the drag object.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the document. It should not be\n * called directly by user code.\n */\n Drag.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'mousemove':\n this._evtMouseMove(event);\n break;\n case 'mouseup':\n this._evtMouseUp(event);\n break;\n case 'keydown':\n this._evtKeyDown(event);\n break;\n default:\n // Stop all other events during drag-drop.\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n };\n /**\n * Move the drag image element to the specified location.\n *\n * This is a no-op if there is no drag image element.\n */\n Drag.prototype.moveDragImage = function (clientX, clientY) {\n if (!this.dragImage) {\n return;\n }\n var style = this.dragImage.style;\n style.top = clientY + \"px\";\n style.left = clientX + \"px\";\n };\n /**\n * Handle the `'mousemove'` event for the drag object.\n */\n Drag.prototype._evtMouseMove = function (event) {\n // Stop all input events during drag-drop.\n event.preventDefault();\n event.stopPropagation();\n // Update the current target node and dispatch enter/leave events.\n this._updateCurrentTarget(event);\n // Update the drag scroll element.\n this._updateDragScroll(event);\n // Move the drag image to the specified client position. This is\n // performed *after* dispatching to prevent unnecessary reflows.\n this.moveDragImage(event.clientX, event.clientY);\n };\n /**\n * Handle the `'mouseup'` event for the drag object.\n */\n Drag.prototype._evtMouseUp = function (event) {\n // Stop all input events during drag-drop.\n event.preventDefault();\n event.stopPropagation();\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n // Update the current target node and dispatch enter/leave events.\n // This prevents a subtle issue where the DOM mutates under the\n // cursor after the last move event but before the drop event.\n this._updateCurrentTarget(event);\n // If there is no current target, finalize with `'none'`.\n if (!this._currentTarget) {\n this._finalize('none');\n return;\n }\n // If the last drop action was `'none'`, dispatch a leave event\n // to the current target and finalize the drag with `'none'`.\n if (this._dropAction === 'none') {\n Private.dispatchDragLeave(this, this._currentTarget, null, event);\n this._finalize('none');\n return;\n }\n // Dispatch the drop event at the current target and finalize\n // with the resulting drop action.\n var action = Private.dispatchDrop(this, this._currentTarget, event);\n this._finalize(action);\n };\n /**\n * Handle the `'keydown'` event for the drag object.\n */\n Drag.prototype._evtKeyDown = function (event) {\n // Stop all input events during drag-drop.\n event.preventDefault();\n event.stopPropagation();\n // Cancel the drag if `Escape` is pressed.\n if (event.keyCode === 27) {\n this.dispose();\n }\n };\n /**\n * Add the document event listeners for the drag object.\n */\n Drag.prototype._addListeners = function () {\n document.addEventListener('mousedown', this, true);\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('mouseenter', this, true);\n document.addEventListener('mouseleave', this, true);\n document.addEventListener('mouseover', this, true);\n document.addEventListener('mouseout', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('keyup', this, true);\n document.addEventListener('keypress', this, true);\n document.addEventListener('contextmenu', this, true);\n };\n /**\n * Remove the document event listeners for the drag object.\n */\n Drag.prototype._removeListeners = function () {\n document.removeEventListener('mousedown', this, true);\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('mouseenter', this, true);\n document.removeEventListener('mouseleave', this, true);\n document.removeEventListener('mouseover', this, true);\n document.removeEventListener('mouseout', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('keyup', this, true);\n document.removeEventListener('keypress', this, true);\n document.removeEventListener('contextmenu', this, true);\n };\n /**\n * Update the drag scroll element under the mouse.\n */\n Drag.prototype._updateDragScroll = function (event) {\n // Find the scroll target under the mouse.\n var target = Private.findScrollTarget(event);\n // Bail if there is nothing to scroll.\n if (!this._scrollTarget && !target) {\n return;\n }\n // Start the scroll loop if needed.\n if (!this._scrollTarget) {\n setTimeout(this._onScrollFrame, 500);\n }\n // Update the scroll target.\n this._scrollTarget = target;\n };\n /**\n * Update the current target node using the given mouse event.\n */\n Drag.prototype._updateCurrentTarget = function (event) {\n // Fetch common local state.\n var prevTarget = this._currentTarget;\n var currTarget = this._currentTarget;\n var prevElem = this._currentElement;\n // Find the current indicated element at the given position.\n var currElem = document.elementFromPoint(event.clientX, event.clientY);\n // Update the current element reference.\n this._currentElement = currElem;\n // If the indicated element changes from the previous iteration,\n // and is different from the current target, dispatch the exit\n // event to the target.\n if (currElem !== prevElem && currElem !== currTarget) {\n Private.dispatchDragExit(this, currTarget, currElem, event);\n }\n // If the indicated element changes from the previous iteration,\n // and is different from the current target, dispatch the enter\n // event and compute the new target element.\n if (currElem !== prevElem && currElem !== currTarget) {\n currTarget = Private.dispatchDragEnter(this, currElem, currTarget, event);\n }\n // If the current target element has changed, update the current\n // target reference and dispatch the leave event to the old target.\n if (currTarget !== prevTarget) {\n this._currentTarget = currTarget;\n Private.dispatchDragLeave(this, prevTarget, currTarget, event);\n }\n // Dispatch the drag over event and update the drop action.\n var action = Private.dispatchDragOver(this, currTarget, event);\n this._setDropAction(action);\n };\n /**\n * Attach the drag image element at the specified location.\n *\n * This is a no-op if there is no drag image element.\n */\n Drag.prototype._attachDragImage = function (clientX, clientY) {\n if (!this.dragImage) {\n return;\n }\n this.dragImage.classList.add('lm-mod-drag-image');\n /* <DEPRECATED> */\n this.dragImage.classList.add('p-mod-drag-image');\n /* </DEPRECATED> */\n var style = this.dragImage.style;\n style.pointerEvents = 'none';\n style.position = 'fixed';\n style.top = clientY + \"px\";\n style.left = clientX + \"px\";\n document.body.appendChild(this.dragImage);\n };\n /**\n * Detach the drag image element from the DOM.\n *\n * This is a no-op if there is no drag image element.\n */\n Drag.prototype._detachDragImage = function () {\n if (!this.dragImage) {\n return;\n }\n var parent = this.dragImage.parentNode;\n if (!parent) {\n return;\n }\n parent.removeChild(this.dragImage);\n };\n /**\n * Set the internal drop action state and update the drag cursor.\n */\n Drag.prototype._setDropAction = function (action) {\n action = Private.validateAction(action, this.supportedActions);\n if (this._override && this._dropAction === action) {\n return;\n }\n switch (action) {\n case 'none':\n this._dropAction = action;\n this._override = Drag.overrideCursor('no-drop');\n break;\n case 'copy':\n this._dropAction = action;\n this._override = Drag.overrideCursor('copy');\n break;\n case 'link':\n this._dropAction = action;\n this._override = Drag.overrideCursor('alias');\n break;\n case 'move':\n this._dropAction = action;\n this._override = Drag.overrideCursor('move');\n break;\n }\n };\n /**\n * Finalize the drag operation and resolve the drag promise.\n */\n Drag.prototype._finalize = function (action) {\n // Store the resolve function as a temp variable.\n var resolve = this._resolve;\n // Remove the document event listeners.\n this._removeListeners();\n // Detach the drag image.\n this._detachDragImage();\n // Dispose of the cursor override.\n if (this._override) {\n this._override.dispose();\n this._override = null;\n }\n // Clear the mime data.\n this.mimeData.clear();\n // Clear the rest of the internal drag state.\n this._disposed = true;\n this._dropAction = 'none';\n this._currentTarget = null;\n this._currentElement = null;\n this._scrollTarget = null;\n this._promise = null;\n this._resolve = null;\n // Finally, resolve the promise to the given drop action.\n if (resolve) {\n resolve(action);\n }\n };\n return Drag;\n}());\n/**\n * The namespace for the `Drag` class statics.\n */\n(function (Drag) {\n /**\n * Override the cursor icon for the entire document.\n *\n * @param cursor - The string representing the cursor style.\n *\n * @returns A disposable which will clear the override when disposed.\n *\n * #### Notes\n * The most recent call to `overrideCursor` takes precedence.\n * Disposing an old override has no effect on the current override.\n *\n * This utility function is used by the `Drag` class to override the\n * mouse cursor during a drag-drop operation, but it can also be used\n * by other classes to fix the cursor icon during normal mouse drags.\n *\n * #### Example\n * ```typescript\n * import { Drag } from '@lumino/dragdrop';\n *\n * // Force the cursor to be 'wait' for the entire document.\n * let override = Drag.overrideCursor('wait');\n *\n * // Clear the override by disposing the return value.\n * override.dispose();\n * ```\n */\n function overrideCursor(cursor) {\n var id = ++overrideCursorID;\n document.body.style.cursor = cursor;\n document.body.classList.add('lm-mod-override-cursor');\n /* <DEPRECATED> */\n document.body.classList.add('p-mod-override-cursor');\n /* </DEPRECATED> */\n return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_0__.DisposableDelegate(function () {\n if (id === overrideCursorID) {\n document.body.style.cursor = '';\n document.body.classList.remove('lm-mod-override-cursor');\n /* <DEPRECATED> */\n document.body.classList.remove('p-mod-override-cursor');\n /* </DEPRECATED> */\n }\n });\n }\n Drag.overrideCursor = overrideCursor;\n /**\n * The internal id for the active cursor override.\n */\n var overrideCursorID = 0;\n})(Drag || (Drag = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * The size of a drag scroll edge, in pixels.\n */\n Private.SCROLL_EDGE_SIZE = 20;\n /**\n * Validate the given action is one of the supported actions.\n *\n * Returns the given action or `'none'` if the action is unsupported.\n */\n function validateAction(action, supported) {\n return (actionTable[action] & supportedTable[supported]) ? action : 'none';\n }\n Private.validateAction = validateAction;\n /**\n * Create a left mouse event at the given position.\n *\n * @param type - The event type for the mouse event.\n *\n * @param clientX - The client X position.\n *\n * @param clientY - The client Y position.\n *\n * @returns A newly created and initialized mouse event.\n */\n function createMouseEvent(type, clientX, clientY) {\n var event = document.createEvent('MouseEvent');\n event.initMouseEvent(type, true, true, window, 0, 0, 0, clientX, clientY, false, false, false, false, 0, null);\n return event;\n }\n Private.createMouseEvent = createMouseEvent;\n /**\n * Find the drag scroll target under the mouse, if any.\n */\n function findScrollTarget(event) {\n // Look up the client mouse position.\n var x = event.clientX;\n var y = event.clientY;\n // Get the element under the mouse.\n var element = document.elementFromPoint(x, y);\n // Search for a scrollable target based on the mouse position.\n // The null assert in third clause of for-loop is required due to:\n // https://github.com/Microsoft/TypeScript/issues/14143\n for (; element; element = element.parentElement) {\n // Ignore elements which are not marked as scrollable.\n var scrollable = element.hasAttribute('data-lm-dragscroll');\n /* <DEPRECATED> */\n scrollable = scrollable || element.hasAttribute('data-p-dragscroll');\n /* </DEPRECATED> */\n if (!scrollable) {\n continue;\n }\n // Set up the coordinate offsets for the element.\n var offsetX = 0;\n var offsetY = 0;\n if (element === document.body) {\n offsetX = window.pageXOffset;\n offsetY = window.pageYOffset;\n }\n // Get the element bounds in viewport coordinates.\n var r = element.getBoundingClientRect();\n var top_1 = r.top + offsetY;\n var left = r.left + offsetX;\n var right = left + r.width;\n var bottom = top_1 + r.height;\n // Skip the element if it's not under the mouse.\n if (x < left || x >= right || y < top_1 || y >= bottom) {\n continue;\n }\n // Compute the distance to each edge.\n var dl = x - left + 1;\n var dt = y - top_1 + 1;\n var dr = right - x;\n var db = bottom - y;\n // Find the smallest of the edge distances.\n var distance = Math.min(dl, dt, dr, db);\n // Skip the element if the mouse is not within a scroll edge.\n if (distance > Private.SCROLL_EDGE_SIZE) {\n continue;\n }\n // Set up the edge result variable.\n var edge = void 0;\n // Find the edge for the computed distance.\n switch (distance) {\n case db:\n edge = 'bottom';\n break;\n case dt:\n edge = 'top';\n break;\n case dr:\n edge = 'right';\n break;\n case dl:\n edge = 'left';\n break;\n default:\n throw 'unreachable';\n }\n // Compute how much the element can scroll in width and height.\n var dsw = element.scrollWidth - element.clientWidth;\n var dsh = element.scrollHeight - element.clientHeight;\n // Determine if the element should be scrolled for the edge.\n var shouldScroll = void 0;\n switch (edge) {\n case 'top':\n shouldScroll = dsh > 0 && element.scrollTop > 0;\n break;\n case 'left':\n shouldScroll = dsw > 0 && element.scrollLeft > 0;\n break;\n case 'right':\n shouldScroll = dsw > 0 && element.scrollLeft < dsw;\n break;\n case 'bottom':\n shouldScroll = dsh > 0 && element.scrollTop < dsh;\n break;\n default:\n throw 'unreachable';\n }\n // Skip the element if it should not be scrolled.\n if (!shouldScroll) {\n continue;\n }\n // Return the drag scroll target.\n return { element: element, edge: edge, distance: distance };\n }\n // No drag scroll target was found.\n return null;\n }\n Private.findScrollTarget = findScrollTarget;\n /**\n * Dispatch a drag enter event to the indicated element.\n *\n * @param drag - The drag object associated with the action.\n *\n * @param currElem - The currently indicated element, or `null`. This\n * is the \"immediate user selection\" from the whatwg spec.\n *\n * @param currTarget - The current drag target element, or `null`. This\n * is the \"current target element\" from the whatwg spec.\n *\n * @param event - The mouse event related to the action.\n *\n * @returns The element to use as the current drag target. This is the\n * \"current target element\" from the whatwg spec, and may be `null`.\n *\n * #### Notes\n * This largely implements the drag enter portion of the whatwg spec:\n * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model\n */\n function dispatchDragEnter(drag, currElem, currTarget, event) {\n // If the current element is null, return null as the new target.\n if (!currElem) {\n return null;\n }\n // Dispatch a drag enter event to the current element.\n var dragEvent = createDragEvent('lm-dragenter', drag, event, currTarget);\n var canceled = !currElem.dispatchEvent(dragEvent);\n // If the event was canceled, use the current element as the new target.\n if (canceled) {\n return currElem;\n }\n /* <DEPRECATED> */\n dragEvent = createDragEvent('p-dragenter', drag, event, currTarget);\n canceled = !currElem.dispatchEvent(dragEvent);\n if (canceled) {\n return currElem;\n }\n /* </DEPRECATED> */\n // If the current element is the document body, keep the original target.\n if (currElem === document.body) {\n return currTarget;\n }\n // Dispatch a drag enter event on the document body.\n dragEvent = createDragEvent('lm-dragenter', drag, event, currTarget);\n document.body.dispatchEvent(dragEvent);\n /* <DEPRECATED> */\n dragEvent = createDragEvent('p-dragenter', drag, event, currTarget);\n document.body.dispatchEvent(dragEvent);\n /* </DEPRECATED> */\n // Ignore the event cancellation, and use the body as the new target.\n return document.body;\n }\n Private.dispatchDragEnter = dispatchDragEnter;\n /**\n * Dispatch a drag exit event to the indicated element.\n *\n * @param drag - The drag object associated with the action.\n *\n * @param prevTarget - The previous target element, or `null`. This\n * is the previous \"current target element\" from the whatwg spec.\n *\n * @param currTarget - The current drag target element, or `null`. This\n * is the \"current target element\" from the whatwg spec.\n *\n * @param event - The mouse event related to the action.\n *\n * #### Notes\n * This largely implements the drag exit portion of the whatwg spec:\n * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model\n */\n function dispatchDragExit(drag, prevTarget, currTarget, event) {\n // If the previous target is null, do nothing.\n if (!prevTarget) {\n return;\n }\n // Dispatch the drag exit event to the previous target.\n var dragEvent = createDragEvent('lm-dragexit', drag, event, currTarget);\n prevTarget.dispatchEvent(dragEvent);\n /* <DEPRECATED> */\n dragEvent = createDragEvent('p-dragexit', drag, event, currTarget);\n prevTarget.dispatchEvent(dragEvent);\n /* </DEPRECATED> */\n }\n Private.dispatchDragExit = dispatchDragExit;\n /**\n * Dispatch a drag leave event to the indicated element.\n *\n * @param drag - The drag object associated with the action.\n *\n * @param prevTarget - The previous target element, or `null`. This\n * is the previous \"current target element\" from the whatwg spec.\n *\n * @param currTarget - The current drag target element, or `null`. This\n * is the \"current target element\" from the whatwg spec.\n *\n * @param event - The mouse event related to the action.\n *\n * #### Notes\n * This largely implements the drag leave portion of the whatwg spec:\n * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model\n */\n function dispatchDragLeave(drag, prevTarget, currTarget, event) {\n // If the previous target is null, do nothing.\n if (!prevTarget) {\n return;\n }\n // Dispatch the drag leave event to the previous target.\n var dragEvent = createDragEvent('lm-dragleave', drag, event, currTarget);\n prevTarget.dispatchEvent(dragEvent);\n /* <DEPRECATED> */\n dragEvent = createDragEvent('p-dragleave', drag, event, currTarget);\n prevTarget.dispatchEvent(dragEvent);\n /* </DEPRECATED> */\n }\n Private.dispatchDragLeave = dispatchDragLeave;\n /**\n * Dispatch a drag over event to the indicated element.\n *\n * @param drag - The drag object associated with the action.\n *\n * @param currTarget - The current drag target element, or `null`. This\n * is the \"current target element\" from the whatwg spec.\n *\n * @param event - The mouse event related to the action.\n *\n * @returns The `DropAction` result of the drag over event.\n *\n * #### Notes\n * This largely implements the drag over portion of the whatwg spec:\n * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model\n */\n function dispatchDragOver(drag, currTarget, event) {\n // If there is no current target, the drop action is none.\n if (!currTarget) {\n return 'none';\n }\n // Dispatch the drag over event to the current target.\n var dragEvent = createDragEvent('lm-dragover', drag, event, null);\n var canceled = !currTarget.dispatchEvent(dragEvent);\n // If the event was canceled, return the drop action result.\n if (canceled) {\n return dragEvent.dropAction;\n }\n /* <DEPRECATED> */\n dragEvent = createDragEvent('p-dragover', drag, event, null);\n canceled = !currTarget.dispatchEvent(dragEvent);\n if (canceled) {\n return dragEvent.dropAction;\n }\n /* </DEPRECATED> */\n // Otherwise, the effective drop action is none.\n return 'none';\n }\n Private.dispatchDragOver = dispatchDragOver;\n /**\n * Dispatch a drop event to the indicated element.\n *\n * @param drag - The drag object associated with the action.\n *\n * @param currTarget - The current drag target element, or `null`. This\n * is the \"current target element\" from the whatwg spec.\n *\n * @param event - The mouse event related to the action.\n *\n * @returns The `DropAction` result of the drop event.\n *\n * #### Notes\n * This largely implements the drag over portion of the whatwg spec:\n * https://html.spec.whatwg.org/multipage/interaction.html#drag-and-drop-processing-model\n */\n function dispatchDrop(drag, currTarget, event) {\n // If there is no current target, the drop action is none.\n if (!currTarget) {\n return 'none';\n }\n // Dispatch the drop event to the current target.\n var dragEvent = createDragEvent('lm-drop', drag, event, null);\n var canceled = !currTarget.dispatchEvent(dragEvent);\n // If the event was canceled, return the drop action result.\n if (canceled) {\n return dragEvent.dropAction;\n }\n /* <DEPRECATED> */\n dragEvent = createDragEvent('p-drop', drag, event, null);\n canceled = !currTarget.dispatchEvent(dragEvent);\n if (canceled) {\n return dragEvent.dropAction;\n }\n /* </DEPRECATED> */\n // Otherwise, the effective drop action is none.\n return 'none';\n }\n Private.dispatchDrop = dispatchDrop;\n /**\n * A lookup table from drop action to bit value.\n */\n var actionTable = {\n 'none': 0x0,\n 'copy': 0x1,\n 'link': 0x2,\n 'move': 0x4\n };\n /**\n * A lookup table from supported action to drop action bit mask.\n */\n var supportedTable = {\n 'none': actionTable['none'],\n 'copy': actionTable['copy'],\n 'link': actionTable['link'],\n 'move': actionTable['move'],\n 'copy-link': actionTable['copy'] | actionTable['link'],\n 'copy-move': actionTable['copy'] | actionTable['move'],\n 'link-move': actionTable['link'] | actionTable['move'],\n 'all': actionTable['copy'] | actionTable['link'] | actionTable['move']\n };\n /**\n * Create a new initialized `IDragEvent` from the given data.\n *\n * @param type - The event type for the drag event.\n *\n * @param drag - The drag object to use for seeding the drag data.\n *\n * @param event - The mouse event to use for seeding the mouse data.\n *\n * @param related - The related target for the event, or `null`.\n *\n * @returns A new object which implements `IDragEvent`.\n */\n function createDragEvent(type, drag, event, related) {\n // Create a new mouse event to use as the drag event. Currently,\n // JS engines do now allow user-defined Event subclasses.\n var dragEvent = document.createEvent('MouseEvent');\n // Initialize the mouse event data.\n dragEvent.initMouseEvent(type, true, true, window, 0, event.screenX, event.screenY, event.clientX, event.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, event.button, related);\n // Forcefully add the custom drag event properties.\n dragEvent.dropAction = 'none';\n dragEvent.mimeData = drag.mimeData;\n dragEvent.proposedAction = drag.proposedAction;\n dragEvent.supportedActions = drag.supportedActions;\n dragEvent.source = drag.source;\n // Return the fully initialized drag event.\n return dragEvent;\n }\n})(Private || (Private = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/dragdrop/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/keyboard/dist/index.es6.js":
/*!*********************************************************!*\
!*** ./node_modules/@lumino/keyboard/dist/index.es6.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"EN_US\": () => /* binding */ EN_US,\n/* harmony export */ \"KeycodeLayout\": () => /* binding */ KeycodeLayout,\n/* harmony export */ \"getKeyboardLayout\": () => /* binding */ getKeyboardLayout,\n/* harmony export */ \"setKeyboardLayout\": () => /* binding */ setKeyboardLayout\n/* harmony export */ });\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Get the global application keyboard layout instance.\n *\n * @returns The keyboard layout for use by the application.\n *\n * #### Notes\n * The default keyboard layout is US-English.\n */\nfunction getKeyboardLayout() {\n return Private.keyboardLayout;\n}\n/**\n * Set the global application keyboard layout instance.\n *\n * @param - The keyboard layout for use by the application.\n *\n * #### Notes\n * The keyboard layout should typically be set on application startup\n * to a layout which is appropriate for the user's system.\n */\nfunction setKeyboardLayout(layout) {\n Private.keyboardLayout = layout;\n}\n/**\n * A concrete implementation of [[IKeyboardLayout]] based on keycodes.\n *\n * The `keyCode` property of a `'keydown'` event is a browser and OS\n * specific representation of the physical key (not character) which\n * was pressed on a keyboard. While not the most convenient API, it\n * is currently the only one which works reliably on all browsers.\n *\n * This class accepts a user-defined mapping of keycode to key, which\n * allows for reliable shortcuts tailored to the user's system.\n */\nvar KeycodeLayout = /** @class */ (function () {\n /**\n * Construct a new keycode layout.\n *\n * @param name - The human readable name for the layout.\n *\n * @param codes - A mapping of keycode to key value.\n */\n function KeycodeLayout(name, codes) {\n this.name = name;\n this._codes = codes;\n this._keys = KeycodeLayout.extractKeys(codes);\n }\n /**\n * Get an array of the key values supported by the layout.\n *\n * @returns A new array of the supported key values.\n */\n KeycodeLayout.prototype.keys = function () {\n return Object.keys(this._keys);\n };\n /**\n * Test whether the given key is a valid value for the layout.\n *\n * @param key - The user provided key to test for validity.\n *\n * @returns `true` if the key is valid, `false` otherwise.\n */\n KeycodeLayout.prototype.isValidKey = function (key) {\n return key in this._keys;\n };\n /**\n * Get the key for a `'keydown'` event.\n *\n * @param event - The event object for a `'keydown'` event.\n *\n * @returns The associated key value, or an empty string if\n * the event does not represent a valid primary key.\n */\n KeycodeLayout.prototype.keyForKeydownEvent = function (event) {\n return this._codes[event.keyCode] || '';\n };\n return KeycodeLayout;\n}());\n/**\n * The namespace for the `KeycodeLayout` class statics.\n */\n(function (KeycodeLayout) {\n /**\n * Extract the set of keys from a code map.\n *\n * @param code - The code map of interest.\n *\n * @returns A set of the keys in the code map.\n */\n function extractKeys(codes) {\n var keys = Object.create(null);\n for (var c in codes) {\n keys[codes[c]] = true;\n }\n return keys;\n }\n KeycodeLayout.extractKeys = extractKeys;\n})(KeycodeLayout || (KeycodeLayout = {}));\n/**\n * A keycode-based keyboard layout for US English keyboards.\n *\n * This layout is valid for the following OS/Browser combinations.\n *\n * - Windows\n * - Chrome\n * - Firefox\n * - IE\n *\n * - OSX\n * - Chrome\n * - Firefox\n * - Safari\n *\n * - Linux\n * - Chrome\n * - Firefox\n *\n * Other combinations may also work, but are untested.\n */\nvar EN_US = new KeycodeLayout('en-us', {\n 8: 'Backspace',\n 9: 'Tab',\n 13: 'Enter',\n 19: 'Pause',\n 27: 'Escape',\n 32: 'Space',\n 33: 'PageUp',\n 34: 'PageDown',\n 35: 'End',\n 36: 'Home',\n 37: 'ArrowLeft',\n 38: 'ArrowUp',\n 39: 'ArrowRight',\n 40: 'ArrowDown',\n 45: 'Insert',\n 46: 'Delete',\n 48: '0',\n 49: '1',\n 50: '2',\n 51: '3',\n 52: '4',\n 53: '5',\n 54: '6',\n 55: '7',\n 56: '8',\n 57: '9',\n 59: ';',\n 61: '=',\n 65: 'A',\n 66: 'B',\n 67: 'C',\n 68: 'D',\n 69: 'E',\n 70: 'F',\n 71: 'G',\n 72: 'H',\n 73: 'I',\n 74: 'J',\n 75: 'K',\n 76: 'L',\n 77: 'M',\n 78: 'N',\n 79: 'O',\n 80: 'P',\n 81: 'Q',\n 82: 'R',\n 83: 'S',\n 84: 'T',\n 85: 'U',\n 86: 'V',\n 87: 'W',\n 88: 'X',\n 89: 'Y',\n 90: 'Z',\n 93: 'ContextMenu',\n 96: '0',\n 97: '1',\n 98: '2',\n 99: '3',\n 100: '4',\n 101: '5',\n 102: '6',\n 103: '7',\n 104: '8',\n 105: '9',\n 106: '*',\n 107: '+',\n 109: '-',\n 110: '.',\n 111: '/',\n 112: 'F1',\n 113: 'F2',\n 114: 'F3',\n 115: 'F4',\n 116: 'F5',\n 117: 'F6',\n 118: 'F7',\n 119: 'F8',\n 120: 'F9',\n 121: 'F10',\n 122: 'F11',\n 123: 'F12',\n 173: '-',\n 186: ';',\n 187: '=',\n 188: ',',\n 189: '-',\n 190: '.',\n 191: '/',\n 192: '`',\n 219: '[',\n 220: '\\\\',\n 221: ']',\n 222: '\\''\n});\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * The global keyboard layout instance.\n */\n Private.keyboardLayout = EN_US;\n})(Private || (Private = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/keyboard/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/messaging/dist/index.es6.js":
/*!**********************************************************!*\
!*** ./node_modules/@lumino/messaging/dist/index.es6.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ConflatableMessage\": () => /* binding */ ConflatableMessage,\n/* harmony export */ \"Message\": () => /* binding */ Message,\n/* harmony export */ \"MessageLoop\": () => /* binding */ MessageLoop\n/* harmony export */ });\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ \"./node_modules/@lumino/algorithm/dist/index.es6.js\");\n/* harmony import */ var _lumino_collections__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/collections */ \"./node_modules/@lumino/collections/dist/index.es6.js\");\n\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * A message which can be delivered to a message handler.\n *\n * #### Notes\n * This class may be subclassed to create complex message types.\n */\nvar Message = /** @class */ (function () {\n /**\n * Construct a new message.\n *\n * @param type - The type of the message.\n */\n function Message(type) {\n this.type = type;\n }\n Object.defineProperty(Message.prototype, \"isConflatable\", {\n /**\n * Test whether the message is conflatable.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most message types will\n * not make use of this feature.\n *\n * If a conflatable message is posted to a handler while another\n * conflatable message of the same `type` has already been posted\n * to the handler, the `conflate()` method of the existing message\n * will be invoked. If that method returns `true`, the new message\n * will not be enqueued. This allows messages to be compressed, so\n * that only a single instance of the message type is processed per\n * cycle, no matter how many times messages of that type are posted.\n *\n * Custom message types may reimplement this property.\n *\n * The default implementation is always `false`.\n */\n get: function () {\n return false;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Conflate this message with another message of the same `type`.\n *\n * @param other - A conflatable message of the same `type`.\n *\n * @returns `true` if the message was successfully conflated, or\n * `false` otherwise.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most message types will\n * not make use of this feature.\n *\n * This method is called automatically by the message loop when the\n * given message is posted to the handler paired with this message.\n * This message will already be enqueued and conflatable, and the\n * given message will have the same `type` and also be conflatable.\n *\n * This method should merge the state of the other message into this\n * message as needed so that when this message is finally delivered\n * to the handler, it receives the most up-to-date information.\n *\n * If this method returns `true`, it signals that the other message\n * was successfully conflated and that message will not be enqueued.\n *\n * If this method returns `false`, the other message will be enqueued\n * for normal delivery.\n *\n * Custom message types may reimplement this method.\n *\n * The default implementation always returns `false`.\n */\n Message.prototype.conflate = function (other) {\n return false;\n };\n return Message;\n}());\n/**\n * A convenience message class which conflates automatically.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most user code will not\n * make use of this class.\n *\n * This message class is useful for creating message instances which\n * should be conflated, but which have no state other than `type`.\n *\n * If conflation of stateful messages is required, a custom `Message`\n * subclass should be created.\n */\nvar ConflatableMessage = /** @class */ (function (_super) {\n __extends(ConflatableMessage, _super);\n function ConflatableMessage() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(ConflatableMessage.prototype, \"isConflatable\", {\n /**\n * Test whether the message is conflatable.\n *\n * #### Notes\n * This property is always `true`.\n */\n get: function () {\n return true;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Conflate this message with another message of the same `type`.\n *\n * #### Notes\n * This method always returns `true`.\n */\n ConflatableMessage.prototype.conflate = function (other) {\n return true;\n };\n return ConflatableMessage;\n}(Message));\n/**\n * The namespace for the global singleton message loop.\n */\nvar MessageLoop;\n(function (MessageLoop) {\n /**\n * Send a message to a message handler to process immediately.\n *\n * @param handler - The handler which should process the message.\n *\n * @param msg - The message to deliver to the handler.\n *\n * #### Notes\n * The message will first be sent through any installed message hooks\n * for the handler. If the message passes all hooks, it will then be\n * delivered to the `processMessage` method of the handler.\n *\n * The message will not be conflated with pending posted messages.\n *\n * Exceptions in hooks and handlers will be caught and logged.\n */\n function sendMessage(handler, msg) {\n // Lookup the message hooks for the handler.\n var hooks = messageHooks.get(handler);\n // Handle the common case of no installed hooks.\n if (!hooks || hooks.length === 0) {\n invokeHandler(handler, msg);\n return;\n }\n // Invoke the message hooks starting with the newest first.\n var passed = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.every)((0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.retro)(hooks), function (hook) {\n return hook ? invokeHook(hook, handler, msg) : true;\n });\n // Invoke the handler if the message passes all hooks.\n if (passed) {\n invokeHandler(handler, msg);\n }\n }\n MessageLoop.sendMessage = sendMessage;\n /**\n * Post a message to a message handler to process in the future.\n *\n * @param handler - The handler which should process the message.\n *\n * @param msg - The message to post to the handler.\n *\n * #### Notes\n * The message will be conflated with the pending posted messages for\n * the handler, if possible. If the message is not conflated, it will\n * be queued for normal delivery on the next cycle of the event loop.\n *\n * Exceptions in hooks and handlers will be caught and logged.\n */\n function postMessage(handler, msg) {\n // Handle the common case of a non-conflatable message.\n if (!msg.isConflatable) {\n enqueueMessage(handler, msg);\n return;\n }\n // Conflate the message with an existing message if possible.\n var conflated = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.some)(messageQueue, function (posted) {\n if (posted.handler !== handler) {\n return false;\n }\n if (!posted.msg) {\n return false;\n }\n if (posted.msg.type !== msg.type) {\n return false;\n }\n if (!posted.msg.isConflatable) {\n return false;\n }\n return posted.msg.conflate(msg);\n });\n // Enqueue the message if it was not conflated.\n if (!conflated) {\n enqueueMessage(handler, msg);\n }\n }\n MessageLoop.postMessage = postMessage;\n /**\n * Install a message hook for a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * @param hook - The message hook to install.\n *\n * #### Notes\n * A message hook is invoked before a message is delivered to the\n * handler. If the hook returns `false`, no other hooks will be\n * invoked and the message will not be delivered to the handler.\n *\n * The most recently installed message hook is executed first.\n *\n * If the hook is already installed, this is a no-op.\n */\n function installMessageHook(handler, hook) {\n // Lookup the hooks for the handler.\n var hooks = messageHooks.get(handler);\n // Bail early if the hook is already installed.\n if (hooks && hooks.indexOf(hook) !== -1) {\n return;\n }\n // Add the hook to the end, so it will be the first to execute.\n if (!hooks) {\n messageHooks.set(handler, [hook]);\n }\n else {\n hooks.push(hook);\n }\n }\n MessageLoop.installMessageHook = installMessageHook;\n /**\n * Remove an installed message hook for a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * @param hook - The message hook to remove.\n *\n * #### Notes\n * It is safe to call this function while the hook is executing.\n *\n * If the hook is not installed, this is a no-op.\n */\n function removeMessageHook(handler, hook) {\n // Lookup the hooks for the handler.\n var hooks = messageHooks.get(handler);\n // Bail early if the hooks do not exist.\n if (!hooks) {\n return;\n }\n // Lookup the index of the hook and bail if not found.\n var i = hooks.indexOf(hook);\n if (i === -1) {\n return;\n }\n // Clear the hook and schedule a cleanup of the array.\n hooks[i] = null;\n scheduleCleanup(hooks);\n }\n MessageLoop.removeMessageHook = removeMessageHook;\n /**\n * Clear all message data associated with a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * #### Notes\n * This will clear all posted messages and hooks for the handler.\n */\n function clearData(handler) {\n // Lookup the hooks for the handler.\n var hooks = messageHooks.get(handler);\n // Clear all messsage hooks for the handler.\n if (hooks && hooks.length > 0) {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.fill(hooks, null);\n scheduleCleanup(hooks);\n }\n // Clear all posted messages for the handler.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(messageQueue, function (posted) {\n if (posted.handler === handler) {\n posted.handler = null;\n posted.msg = null;\n }\n });\n }\n MessageLoop.clearData = clearData;\n /**\n * Process the pending posted messages in the queue immediately.\n *\n * #### Notes\n * This function is useful when posted messages must be processed\n * immediately, instead of on the next animation frame.\n *\n * This function should normally not be needed, but it may be\n * required to work around certain browser idiosyncrasies.\n *\n * Recursing into this function is a no-op.\n */\n function flush() {\n // Bail if recursion is detected or if there is no pending task.\n if (flushGuard || loopTaskID === 0) {\n return;\n }\n // Unschedule the pending loop task.\n unschedule(loopTaskID);\n // Run the message loop within the recursion guard.\n flushGuard = true;\n runMessageLoop();\n flushGuard = false;\n }\n MessageLoop.flush = flush;\n /**\n * Get the message loop exception handler.\n *\n * @returns The current exception handler.\n *\n * #### Notes\n * The default exception handler is `console.error`.\n */\n function getExceptionHandler() {\n return exceptionHandler;\n }\n MessageLoop.getExceptionHandler = getExceptionHandler;\n /**\n * Set the message loop exception handler.\n *\n * @param handler - The function to use as the exception handler.\n *\n * @returns The old exception handler.\n *\n * #### Notes\n * The exception handler is invoked when a message handler or a\n * message hook throws an exception.\n */\n function setExceptionHandler(handler) {\n var old = exceptionHandler;\n exceptionHandler = handler;\n return old;\n }\n MessageLoop.setExceptionHandler = setExceptionHandler;\n /**\n * The queue of posted message pairs.\n */\n var messageQueue = new _lumino_collections__WEBPACK_IMPORTED_MODULE_1__.LinkedList();\n /**\n * A mapping of handler to array of installed message hooks.\n */\n var messageHooks = new WeakMap();\n /**\n * A set of message hook arrays which are pending cleanup.\n */\n var dirtySet = new Set();\n /**\n * The message loop exception handler.\n */\n var exceptionHandler = function (err) {\n console.error(err);\n };\n /**\n * The id of the pending loop task animation frame.\n */\n var loopTaskID = 0;\n /**\n * A guard flag to prevent flush recursion.\n */\n var flushGuard = false;\n /**\n * A function to schedule an event loop callback.\n */\n var schedule = (function () {\n var ok = typeof requestAnimationFrame === 'function';\n return ok ? requestAnimationFrame : setImmediate;\n })();\n /**\n * A function to unschedule an event loop callback.\n */\n var unschedule = (function () {\n var ok = typeof cancelAnimationFrame === 'function';\n return ok ? cancelAnimationFrame : clearImmediate;\n })();\n /**\n * Invoke a message hook with the specified handler and message.\n *\n * Returns the result of the hook, or `true` if the hook throws.\n *\n * Exceptions in the hook will be caught and logged.\n */\n function invokeHook(hook, handler, msg) {\n var result = true;\n try {\n if (typeof hook === 'function') {\n result = hook(handler, msg);\n }\n else {\n result = hook.messageHook(handler, msg);\n }\n }\n catch (err) {\n exceptionHandler(err);\n }\n return result;\n }\n /**\n * Invoke a message handler with the specified message.\n *\n * Exceptions in the handler will be caught and logged.\n */\n function invokeHandler(handler, msg) {\n try {\n handler.processMessage(msg);\n }\n catch (err) {\n exceptionHandler(err);\n }\n }\n /**\n * Add a message to the end of the message queue.\n *\n * This will automatically schedule a run of the message loop.\n */\n function enqueueMessage(handler, msg) {\n // Add the posted message to the queue.\n messageQueue.addLast({ handler: handler, msg: msg });\n // Bail if a loop task is already pending.\n if (loopTaskID !== 0) {\n return;\n }\n // Schedule a run of the message loop.\n loopTaskID = schedule(runMessageLoop);\n }\n /**\n * Run an iteration of the message loop.\n *\n * This will process all pending messages in the queue. If a message\n * is added to the queue while the message loop is running, it will\n * be processed on the next cycle of the loop.\n */\n function runMessageLoop() {\n // Clear the task ID so the next loop can be scheduled.\n loopTaskID = 0;\n // If the message queue is empty, there is nothing else to do.\n if (messageQueue.isEmpty) {\n return;\n }\n // Add a sentinel value to the end of the queue. The queue will\n // only be processed up to the sentinel. Messages posted during\n // this cycle will execute on the next cycle.\n var sentinel = { handler: null, msg: null };\n messageQueue.addLast(sentinel);\n // Enter the message loop.\n while (true) {\n // Remove the first posted message in the queue.\n var posted = messageQueue.removeFirst();\n // If the value is the sentinel, exit the loop.\n if (posted === sentinel) {\n return;\n }\n // Dispatch the message if it has not been cleared.\n if (posted.handler && posted.msg) {\n sendMessage(posted.handler, posted.msg);\n }\n }\n }\n /**\n * Schedule a cleanup of a message hooks array.\n *\n * This will add the array to the dirty set and schedule a deferred\n * cleanup of the array contents. On cleanup, any `null` hook will\n * be removed from the array.\n */\n function scheduleCleanup(hooks) {\n if (dirtySet.size === 0) {\n schedule(cleanupDirtySet);\n }\n dirtySet.add(hooks);\n }\n /**\n * Cleanup the message hook arrays in the dirty set.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupDirtySet() {\n dirtySet.forEach(cleanupHooks);\n dirtySet.clear();\n }\n /**\n * Cleanup the dirty hooks in a message hooks array.\n *\n * This will remove any `null` hook from the array.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupHooks(hooks) {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAllWhere(hooks, isNull);\n }\n /**\n * Test whether a value is `null`.\n */\n function isNull(value) {\n return value === null;\n }\n})(MessageLoop || (MessageLoop = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/messaging/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/properties/dist/index.es6.js":
/*!***********************************************************!*\
!*** ./node_modules/@lumino/properties/dist/index.es6.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AttachedProperty\": () => /* binding */ AttachedProperty\n/* harmony export */ });\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * A class which attaches a value to an external object.\n *\n * #### Notes\n * Attached properties are used to extend the state of an object with\n * semantic data from an unrelated class. They also encapsulate value\n * creation, coercion, and notification.\n *\n * Because attached property values are stored in a hash table, which\n * in turn is stored in a WeakMap keyed on the owner object, there is\n * non-trivial storage overhead involved in their use. The pattern is\n * therefore best used for the storage of rare data.\n */\nvar AttachedProperty = /** @class */ (function () {\n /**\n * Construct a new attached property.\n *\n * @param options - The options for initializing the property.\n */\n function AttachedProperty(options) {\n this._pid = Private.nextPID();\n this.name = options.name;\n this._create = options.create;\n this._coerce = options.coerce || null;\n this._compare = options.compare || null;\n this._changed = options.changed || null;\n }\n /**\n * Get the current value of the property for a given owner.\n *\n * @param owner - The property owner of interest.\n *\n * @returns The current value of the property.\n *\n * #### Notes\n * If the value has not yet been set, the default value will be\n * computed and assigned as the current value of the property.\n */\n AttachedProperty.prototype.get = function (owner) {\n var value;\n var map = Private.ensureMap(owner);\n if (this._pid in map) {\n value = map[this._pid];\n }\n else {\n value = map[this._pid] = this._createValue(owner);\n }\n return value;\n };\n /**\n * Set the current value of the property for a given owner.\n *\n * @param owner - The property owner of interest.\n *\n * @param value - The value for the property.\n *\n * #### Notes\n * If the value has not yet been set, the default value will be\n * computed and used as the previous value for the comparison.\n */\n AttachedProperty.prototype.set = function (owner, value) {\n var oldValue;\n var map = Private.ensureMap(owner);\n if (this._pid in map) {\n oldValue = map[this._pid];\n }\n else {\n oldValue = map[this._pid] = this._createValue(owner);\n }\n var newValue = this._coerceValue(owner, value);\n this._maybeNotify(owner, oldValue, map[this._pid] = newValue);\n };\n /**\n * Explicitly coerce the current property value for a given owner.\n *\n * @param owner - The property owner of interest.\n *\n * #### Notes\n * If the value has not yet been set, the default value will be\n * computed and used as the previous value for the comparison.\n */\n AttachedProperty.prototype.coerce = function (owner) {\n var oldValue;\n var map = Private.ensureMap(owner);\n if (this._pid in map) {\n oldValue = map[this._pid];\n }\n else {\n oldValue = map[this._pid] = this._createValue(owner);\n }\n var newValue = this._coerceValue(owner, oldValue);\n this._maybeNotify(owner, oldValue, map[this._pid] = newValue);\n };\n /**\n * Get or create the default value for the given owner.\n */\n AttachedProperty.prototype._createValue = function (owner) {\n var create = this._create;\n return create(owner);\n };\n /**\n * Coerce the value for the given owner.\n */\n AttachedProperty.prototype._coerceValue = function (owner, value) {\n var coerce = this._coerce;\n return coerce ? coerce(owner, value) : value;\n };\n /**\n * Compare the old value and new value for equality.\n */\n AttachedProperty.prototype._compareValue = function (oldValue, newValue) {\n var compare = this._compare;\n return compare ? compare(oldValue, newValue) : oldValue === newValue;\n };\n /**\n * Run the change notification if the given values are different.\n */\n AttachedProperty.prototype._maybeNotify = function (owner, oldValue, newValue) {\n var changed = this._changed;\n if (changed && !this._compareValue(oldValue, newValue)) {\n changed(owner, oldValue, newValue);\n }\n };\n return AttachedProperty;\n}());\n/**\n * The namespace for the `AttachedProperty` class statics.\n */\n(function (AttachedProperty) {\n /**\n * Clear the stored property data for the given owner.\n *\n * @param owner - The property owner of interest.\n *\n * #### Notes\n * This will clear all property values for the owner, but it will\n * **not** run the change notification for any of the properties.\n */\n function clearData(owner) {\n Private.ownerData.delete(owner);\n }\n AttachedProperty.clearData = clearData;\n})(AttachedProperty || (AttachedProperty = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * A weak mapping of property owner to property map.\n */\n Private.ownerData = new WeakMap();\n /**\n * A function which computes successive unique property ids.\n */\n Private.nextPID = (function () {\n var id = 0;\n return function () {\n var rand = Math.random();\n var stem = (\"\" + rand).slice(2);\n return \"pid-\" + stem + \"-\" + id++;\n };\n })();\n /**\n * Lookup the data map for the property owner.\n *\n * This will create the map if one does not already exist.\n */\n function ensureMap(owner) {\n var map = Private.ownerData.get(owner);\n if (map) {\n return map;\n }\n map = Object.create(null);\n Private.ownerData.set(owner, map);\n return map;\n }\n Private.ensureMap = ensureMap;\n})(Private || (Private = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/properties/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/signaling/dist/index.es6.js":
/*!**********************************************************!*\
!*** ./node_modules/@lumino/signaling/dist/index.es6.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Signal\": () => /* binding */ Signal\n/* harmony export */ });\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ \"./node_modules/@lumino/algorithm/dist/index.es6.js\");\n\n\n// Copyright (c) Jupyter Development Team.\n/**\n * A concrete implementation of `ISignal`.\n *\n * #### Example\n * ```typescript\n * import { ISignal, Signal } from '@lumino/signaling';\n *\n * class SomeClass {\n *\n * constructor(name: string) {\n * this.name = name;\n * }\n *\n * readonly name: string;\n *\n * get valueChanged: ISignal<this, number> {\n * return this._valueChanged;\n * }\n *\n * get value(): number {\n * return this._value;\n * }\n *\n * set value(value: number) {\n * if (value === this._value) {\n * return;\n * }\n * this._value = value;\n * this._valueChanged.emit(value);\n * }\n *\n * private _value = 0;\n * private _valueChanged = new Signal<this, number>(this);\n * }\n *\n * function logger(sender: SomeClass, value: number): void {\n * console.log(sender.name, value);\n * }\n *\n * let m1 = new SomeClass('foo');\n * let m2 = new SomeClass('bar');\n *\n * m1.valueChanged.connect(logger);\n * m2.valueChanged.connect(logger);\n *\n * m1.value = 42; // logs: foo 42\n * m2.value = 17; // logs: bar 17\n * ```\n */\nvar Signal = /** @class */ (function () {\n /**\n * Construct a new signal.\n *\n * @param sender - The sender which owns the signal.\n */\n function Signal(sender) {\n this.sender = sender;\n }\n /**\n * Connect a slot to the signal.\n *\n * @param slot - The slot to invoke when the signal is emitted.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection succeeds, `false` otherwise.\n */\n Signal.prototype.connect = function (slot, thisArg) {\n return Private.connect(this, slot, thisArg);\n };\n /**\n * Disconnect a slot from the signal.\n *\n * @param slot - The slot to disconnect from the signal.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection is removed, `false` otherwise.\n */\n Signal.prototype.disconnect = function (slot, thisArg) {\n return Private.disconnect(this, slot, thisArg);\n };\n /**\n * Emit the signal and invoke the connected slots.\n *\n * @param args - The args to pass to the connected slots.\n *\n * #### Notes\n * Slots are invoked synchronously in connection order.\n *\n * Exceptions thrown by connected slots will be caught and logged.\n */\n Signal.prototype.emit = function (args) {\n Private.emit(this, args);\n };\n return Signal;\n}());\n/**\n * The namespace for the `Signal` class statics.\n */\n(function (Signal) {\n /**\n * Remove all connections between a sender and receiver.\n *\n * @param sender - The sender object of interest.\n *\n * @param receiver - The receiver object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectBetween(sender, receiver) {\n Private.disconnectBetween(sender, receiver);\n }\n Signal.disconnectBetween = disconnectBetween;\n /**\n * Remove all connections where the given object is the sender.\n *\n * @param sender - The sender object of interest.\n */\n function disconnectSender(sender) {\n Private.disconnectSender(sender);\n }\n Signal.disconnectSender = disconnectSender;\n /**\n * Remove all connections where the given object is the receiver.\n *\n * @param receiver - The receiver object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectReceiver(receiver) {\n Private.disconnectReceiver(receiver);\n }\n Signal.disconnectReceiver = disconnectReceiver;\n /**\n * Remove all connections where an object is the sender or receiver.\n *\n * @param object - The object of interest.\n *\n * #### Notes\n * If a `thisArg` is provided when connecting a signal, that object\n * is considered the receiver. Otherwise, the `slot` is considered\n * the receiver.\n */\n function disconnectAll(object) {\n Private.disconnectAll(object);\n }\n Signal.disconnectAll = disconnectAll;\n /**\n * Clear all signal data associated with the given object.\n *\n * @param object - The object for which the data should be cleared.\n *\n * #### Notes\n * This removes all signal connections and any other signal data\n * associated with the object.\n */\n function clearData(object) {\n Private.disconnectAll(object);\n }\n Signal.clearData = clearData;\n /**\n * Get the signal exception handler.\n *\n * @returns The current exception handler.\n *\n * #### Notes\n * The default exception handler is `console.error`.\n */\n function getExceptionHandler() {\n return Private.exceptionHandler;\n }\n Signal.getExceptionHandler = getExceptionHandler;\n /**\n * Set the signal exception handler.\n *\n * @param handler - The function to use as the exception handler.\n *\n * @returns The old exception handler.\n *\n * #### Notes\n * The exception handler is invoked when a slot throws an exception.\n */\n function setExceptionHandler(handler) {\n var old = Private.exceptionHandler;\n Private.exceptionHandler = handler;\n return old;\n }\n Signal.setExceptionHandler = setExceptionHandler;\n})(Signal || (Signal = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * The signal exception handler function.\n */\n Private.exceptionHandler = function (err) {\n console.error(err);\n };\n /**\n * Connect a slot to a signal.\n *\n * @param signal - The signal of interest.\n *\n * @param slot - The slot to invoke when the signal is emitted.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection succeeds, `false` otherwise.\n */\n function connect(signal, slot, thisArg) {\n // Coerce a `null` `thisArg` to `undefined`.\n thisArg = thisArg || undefined;\n // Ensure the sender's array of receivers is created.\n var receivers = receiversForSender.get(signal.sender);\n if (!receivers) {\n receivers = [];\n receiversForSender.set(signal.sender, receivers);\n }\n // Bail if a matching connection already exists.\n if (findConnection(receivers, signal, slot, thisArg)) {\n return false;\n }\n // Choose the best object for the receiver.\n var receiver = thisArg || slot;\n // Ensure the receiver's array of senders is created.\n var senders = sendersForReceiver.get(receiver);\n if (!senders) {\n senders = [];\n sendersForReceiver.set(receiver, senders);\n }\n // Create a new connection and add it to the end of each array.\n var connection = { signal: signal, slot: slot, thisArg: thisArg };\n receivers.push(connection);\n senders.push(connection);\n // Indicate a successful connection.\n return true;\n }\n Private.connect = connect;\n /**\n * Disconnect a slot from a signal.\n *\n * @param signal - The signal of interest.\n *\n * @param slot - The slot to disconnect from the signal.\n *\n * @param thisArg - The `this` context for the slot. If provided,\n * this must be a non-primitive object.\n *\n * @returns `true` if the connection is removed, `false` otherwise.\n */\n function disconnect(signal, slot, thisArg) {\n // Coerce a `null` `thisArg` to `undefined`.\n thisArg = thisArg || undefined;\n // Lookup the list of receivers, and bail if none exist.\n var receivers = receiversForSender.get(signal.sender);\n if (!receivers || receivers.length === 0) {\n return false;\n }\n // Bail if no matching connection exits.\n var connection = findConnection(receivers, signal, slot, thisArg);\n if (!connection) {\n return false;\n }\n // Choose the best object for the receiver.\n var receiver = thisArg || slot;\n // Lookup the array of senders, which is now known to exist.\n var senders = sendersForReceiver.get(receiver);\n // Clear the connection and schedule cleanup of the arrays.\n connection.signal = null;\n scheduleCleanup(receivers);\n scheduleCleanup(senders);\n // Indicate a successful disconnection.\n return true;\n }\n Private.disconnect = disconnect;\n /**\n * Remove all connections between a sender and receiver.\n *\n * @param sender - The sender object of interest.\n *\n * @param receiver - The receiver object of interest.\n */\n function disconnectBetween(sender, receiver) {\n // If there are no receivers, there is nothing to do.\n var receivers = receiversForSender.get(sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // If there are no senders, there is nothing to do.\n var senders = sendersForReceiver.get(receiver);\n if (!senders || senders.length === 0) {\n return;\n }\n // Clear each connection between the sender and receiver.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(senders, function (connection) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n return;\n }\n // Clear the connection if it matches the sender.\n if (connection.signal.sender === sender) {\n connection.signal = null;\n }\n });\n // Schedule a cleanup of the senders and receivers.\n scheduleCleanup(receivers);\n scheduleCleanup(senders);\n }\n Private.disconnectBetween = disconnectBetween;\n /**\n * Remove all connections where the given object is the sender.\n *\n * @param sender - The sender object of interest.\n */\n function disconnectSender(sender) {\n // If there are no receivers, there is nothing to do.\n var receivers = receiversForSender.get(sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // Clear each receiver connection.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(receivers, function (connection) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n return;\n }\n // Choose the best object for the receiver.\n var receiver = connection.thisArg || connection.slot;\n // Clear the connection.\n connection.signal = null;\n // Cleanup the array of senders, which is now known to exist.\n scheduleCleanup(sendersForReceiver.get(receiver));\n });\n // Schedule a cleanup of the receivers.\n scheduleCleanup(receivers);\n }\n Private.disconnectSender = disconnectSender;\n /**\n * Remove all connections where the given object is the receiver.\n *\n * @param receiver - The receiver object of interest.\n */\n function disconnectReceiver(receiver) {\n // If there are no senders, there is nothing to do.\n var senders = sendersForReceiver.get(receiver);\n if (!senders || senders.length === 0) {\n return;\n }\n // Clear each sender connection.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(senders, function (connection) {\n // Skip connections which have already been cleared.\n if (!connection.signal) {\n return;\n }\n // Lookup the sender for the connection.\n var sender = connection.signal.sender;\n // Clear the connection.\n connection.signal = null;\n // Cleanup the array of receivers, which is now known to exist.\n scheduleCleanup(receiversForSender.get(sender));\n });\n // Schedule a cleanup of the list of senders.\n scheduleCleanup(senders);\n }\n Private.disconnectReceiver = disconnectReceiver;\n /**\n * Remove all connections where an object is the sender or receiver.\n *\n * @param object - The object of interest.\n */\n function disconnectAll(object) {\n // Remove all connections where the given object is the sender.\n disconnectSender(object);\n // Remove all connections where the given object is the receiver.\n disconnectReceiver(object);\n }\n Private.disconnectAll = disconnectAll;\n /**\n * Emit a signal and invoke its connected slots.\n *\n * @param signal - The signal of interest.\n *\n * @param args - The args to pass to the connected slots.\n *\n * #### Notes\n * Slots are invoked synchronously in connection order.\n *\n * Exceptions thrown by connected slots will be caught and logged.\n */\n function emit(signal, args) {\n // If there are no receivers, there is nothing to do.\n var receivers = receiversForSender.get(signal.sender);\n if (!receivers || receivers.length === 0) {\n return;\n }\n // Invoke the slots for connections with a matching signal.\n // Any connections added during emission are not invoked.\n for (var i = 0, n = receivers.length; i < n; ++i) {\n var connection = receivers[i];\n if (connection.signal === signal) {\n invokeSlot(connection, args);\n }\n }\n }\n Private.emit = emit;\n /**\n * A weak mapping of sender to array of receiver connections.\n */\n var receiversForSender = new WeakMap();\n /**\n * A weak mapping of receiver to array of sender connections.\n */\n var sendersForReceiver = new WeakMap();\n /**\n * A set of connection arrays which are pending cleanup.\n */\n var dirtySet = new Set();\n /**\n * A function to schedule an event loop callback.\n */\n var schedule = (function () {\n var ok = typeof requestAnimationFrame === 'function';\n // @ts-ignore\n return ok ? requestAnimationFrame : setImmediate;\n })();\n /**\n * Find a connection which matches the given parameters.\n */\n function findConnection(connections, signal, slot, thisArg) {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.find)(connections, function (connection) { return (connection.signal === signal &&\n connection.slot === slot &&\n connection.thisArg === thisArg); });\n }\n /**\n * Invoke a slot with the given parameters.\n *\n * The connection is assumed to be valid.\n *\n * Exceptions in the slot will be caught and logged.\n */\n function invokeSlot(connection, args) {\n var signal = connection.signal, slot = connection.slot, thisArg = connection.thisArg;\n try {\n slot.call(thisArg, signal.sender, args);\n }\n catch (err) {\n Private.exceptionHandler(err);\n }\n }\n /**\n * Schedule a cleanup of a connection array.\n *\n * This will add the array to the dirty set and schedule a deferred\n * cleanup of the array contents. On cleanup, any connection with a\n * `null` signal will be removed from the array.\n */\n function scheduleCleanup(array) {\n if (dirtySet.size === 0) {\n schedule(cleanupDirtySet);\n }\n dirtySet.add(array);\n }\n /**\n * Cleanup the connection lists in the dirty set.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupDirtySet() {\n dirtySet.forEach(cleanupConnections);\n dirtySet.clear();\n }\n /**\n * Cleanup the dirty connections in a connections array.\n *\n * This will remove any connection with a `null` signal.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupConnections(connections) {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAllWhere(connections, isDeadConnection);\n }\n /**\n * Test whether a connection is dead.\n *\n * A dead connection has a `null` signal.\n */\n function isDeadConnection(connection) {\n return connection.signal === null;\n }\n})(Private || (Private = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/signaling/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/virtualdom/dist/index.es6.js":
/*!***********************************************************!*\
!*** ./node_modules/@lumino/virtualdom/dist/index.es6.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"VirtualDOM\": () => /* binding */ VirtualDOM,\n/* harmony export */ \"VirtualElement\": () => /* binding */ VirtualElement,\n/* harmony export */ \"VirtualElementPass\": () => /* binding */ VirtualElementPass,\n/* harmony export */ \"VirtualText\": () => /* binding */ VirtualText,\n/* harmony export */ \"h\": () => /* binding */ h,\n/* harmony export */ \"hpass\": () => /* binding */ hpass\n/* harmony export */ });\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ \"./node_modules/@lumino/algorithm/dist/index.es6.js\");\n\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\n * A virtual node which represents plain text content.\n *\n * #### Notes\n * User code will not typically create a `VirtualText` node directly.\n * Instead, the `h()` function will be used to create an element tree.\n */\nvar VirtualText = /** @class */ (function () {\n /**\n * Construct a new virtual text node.\n *\n * @param content - The text content for the node.\n */\n function VirtualText(content) {\n /**\n * The type of the node.\n *\n * This value can be used as a type guard for discriminating the\n * `VirtualNode` union type.\n */\n this.type = 'text';\n this.content = content;\n }\n return VirtualText;\n}());\n/**\n * A virtual node which represents an HTML element.\n *\n * #### Notes\n * User code will not typically create a `VirtualElement` node directly.\n * Instead, the `h()` function will be used to create an element tree.\n */\nvar VirtualElement = /** @class */ (function () {\n /**\n * Construct a new virtual element node.\n *\n * @param tag - The element tag name.\n *\n * @param attrs - The element attributes.\n *\n * @param children - The element children.\n *\n * @param renderer - An optional custom renderer for the element.\n */\n function VirtualElement(tag, attrs, children, renderer) {\n /**\n * The type of the node.\n *\n * This value can be used as a type guard for discriminating the\n * `VirtualNode` union type.\n */\n this.type = 'element';\n this.tag = tag;\n this.attrs = attrs;\n this.children = children;\n this.renderer = renderer;\n }\n return VirtualElement;\n}());\n/**\n * DEPRECATED - use VirtualElement with a defined renderer param instead.\n * This class is provided as a backwards compatibility shim\n *\n * A \"pass thru\" virtual node whose children are managed by a render and an\n * unrender callback. The intent of this flavor of virtual node is to make\n * it easy to blend other kinds of virtualdom (eg React) into Phosphor's\n * virtualdom.\n *\n * #### Notes\n * User code will not typically create a `VirtualElementPass` node directly.\n * Instead, the `hpass()` function will be used to create an element tree.\n */\nvar VirtualElementPass = /** @class */ (function (_super) {\n __extends(VirtualElementPass, _super);\n /**\n * DEPRECATED - use VirtualElement with a defined renderer param instead\n *\n * Construct a new virtual element pass thru node.\n *\n * @param tag - the tag of the parent element of this node. Once the parent\n * element is rendered, it will be passed as an argument to\n * renderer.render\n *\n * @param attrs - attributes that will assigned to the\n * parent element\n *\n * @param renderer - an object with render and unrender\n * functions, each of which should take a single argument of type\n * HTMLElement and return nothing. If null, the parent element\n * will be rendered barren without any children.\n */\n function VirtualElementPass(tag, attrs, renderer) {\n return _super.call(this, tag, attrs, [], renderer || undefined) || this;\n }\n return VirtualElementPass;\n}(VirtualElement));\nfunction h(tag) {\n var attrs = {};\n var renderer;\n var children = [];\n for (var i = 1, n = arguments.length; i < n; ++i) {\n var arg = arguments[i];\n if (typeof arg === 'string') {\n children.push(new VirtualText(arg));\n }\n else if (arg instanceof VirtualText) {\n children.push(arg);\n }\n else if (arg instanceof VirtualElement) {\n children.push(arg);\n }\n else if (arg instanceof Array) {\n extend(children, arg);\n }\n else if ((i === 1 || i === 2) && arg && typeof arg === 'object') {\n if (\"render\" in arg) {\n renderer = arg;\n }\n else {\n attrs = arg;\n }\n }\n }\n return new VirtualElement(tag, attrs, children, renderer);\n function extend(array, values) {\n for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {\n var child = values_1[_i];\n if (typeof child === 'string') {\n array.push(new VirtualText(child));\n }\n else if (child instanceof VirtualText) {\n array.push(child);\n }\n else if (child instanceof VirtualElement) {\n array.push(child);\n }\n }\n }\n}\n/**\n * The namespace for the `h` function statics.\n */\n(function (h) {\n h.a = h.bind(undefined, 'a');\n h.abbr = h.bind(undefined, 'abbr');\n h.address = h.bind(undefined, 'address');\n h.area = h.bind(undefined, 'area');\n h.article = h.bind(undefined, 'article');\n h.aside = h.bind(undefined, 'aside');\n h.audio = h.bind(undefined, 'audio');\n h.b = h.bind(undefined, 'b');\n h.bdi = h.bind(undefined, 'bdi');\n h.bdo = h.bind(undefined, 'bdo');\n h.blockquote = h.bind(undefined, 'blockquote');\n h.br = h.bind(undefined, 'br');\n h.button = h.bind(undefined, 'button');\n h.canvas = h.bind(undefined, 'canvas');\n h.caption = h.bind(undefined, 'caption');\n h.cite = h.bind(undefined, 'cite');\n h.code = h.bind(undefined, 'code');\n h.col = h.bind(undefined, 'col');\n h.colgroup = h.bind(undefined, 'colgroup');\n h.data = h.bind(undefined, 'data');\n h.datalist = h.bind(undefined, 'datalist');\n h.dd = h.bind(undefined, 'dd');\n h.del = h.bind(undefined, 'del');\n h.dfn = h.bind(undefined, 'dfn');\n h.div = h.bind(undefined, 'div');\n h.dl = h.bind(undefined, 'dl');\n h.dt = h.bind(undefined, 'dt');\n h.em = h.bind(undefined, 'em');\n h.embed = h.bind(undefined, 'embed');\n h.fieldset = h.bind(undefined, 'fieldset');\n h.figcaption = h.bind(undefined, 'figcaption');\n h.figure = h.bind(undefined, 'figure');\n h.footer = h.bind(undefined, 'footer');\n h.form = h.bind(undefined, 'form');\n h.h1 = h.bind(undefined, 'h1');\n h.h2 = h.bind(undefined, 'h2');\n h.h3 = h.bind(undefined, 'h3');\n h.h4 = h.bind(undefined, 'h4');\n h.h5 = h.bind(undefined, 'h5');\n h.h6 = h.bind(undefined, 'h6');\n h.header = h.bind(undefined, 'header');\n h.hr = h.bind(undefined, 'hr');\n h.i = h.bind(undefined, 'i');\n h.iframe = h.bind(undefined, 'iframe');\n h.img = h.bind(undefined, 'img');\n h.input = h.bind(undefined, 'input');\n h.ins = h.bind(undefined, 'ins');\n h.kbd = h.bind(undefined, 'kbd');\n h.label = h.bind(undefined, 'label');\n h.legend = h.bind(undefined, 'legend');\n h.li = h.bind(undefined, 'li');\n h.main = h.bind(undefined, 'main');\n h.map = h.bind(undefined, 'map');\n h.mark = h.bind(undefined, 'mark');\n h.meter = h.bind(undefined, 'meter');\n h.nav = h.bind(undefined, 'nav');\n h.noscript = h.bind(undefined, 'noscript');\n h.object = h.bind(undefined, 'object');\n h.ol = h.bind(undefined, 'ol');\n h.optgroup = h.bind(undefined, 'optgroup');\n h.option = h.bind(undefined, 'option');\n h.output = h.bind(undefined, 'output');\n h.p = h.bind(undefined, 'p');\n h.param = h.bind(undefined, 'param');\n h.pre = h.bind(undefined, 'pre');\n h.progress = h.bind(undefined, 'progress');\n h.q = h.bind(undefined, 'q');\n h.rp = h.bind(undefined, 'rp');\n h.rt = h.bind(undefined, 'rt');\n h.ruby = h.bind(undefined, 'ruby');\n h.s = h.bind(undefined, 's');\n h.samp = h.bind(undefined, 'samp');\n h.section = h.bind(undefined, 'section');\n h.select = h.bind(undefined, 'select');\n h.small = h.bind(undefined, 'small');\n h.source = h.bind(undefined, 'source');\n h.span = h.bind(undefined, 'span');\n h.strong = h.bind(undefined, 'strong');\n h.sub = h.bind(undefined, 'sub');\n h.summary = h.bind(undefined, 'summary');\n h.sup = h.bind(undefined, 'sup');\n h.table = h.bind(undefined, 'table');\n h.tbody = h.bind(undefined, 'tbody');\n h.td = h.bind(undefined, 'td');\n h.textarea = h.bind(undefined, 'textarea');\n h.tfoot = h.bind(undefined, 'tfoot');\n h.th = h.bind(undefined, 'th');\n h.thead = h.bind(undefined, 'thead');\n h.time = h.bind(undefined, 'time');\n h.title = h.bind(undefined, 'title');\n h.tr = h.bind(undefined, 'tr');\n h.track = h.bind(undefined, 'track');\n h.u = h.bind(undefined, 'u');\n h.ul = h.bind(undefined, 'ul');\n h.var_ = h.bind(undefined, 'var');\n h.video = h.bind(undefined, 'video');\n h.wbr = h.bind(undefined, 'wbr');\n})(h || (h = {}));\nfunction hpass(tag) {\n var attrs = {};\n var renderer = null;\n if (arguments.length === 2) {\n var arg = arguments[1];\n if (\"render\" in arg) {\n renderer = arg;\n }\n else {\n attrs = arg;\n }\n }\n else if (arguments.length === 3) {\n attrs = arguments[1];\n renderer = arguments[2];\n }\n else if (arguments.length > 3) {\n throw new Error(\"hpass() should be called with 1, 2, or 3 arguments\");\n }\n return new VirtualElementPass(tag, attrs, renderer);\n}\n/**\n * The namespace for the virtual DOM rendering functions.\n */\nvar VirtualDOM;\n(function (VirtualDOM) {\n function realize(node) {\n return Private.createDOMNode(node);\n }\n VirtualDOM.realize = realize;\n /**\n * Render virtual DOM content into a host element.\n *\n * @param content - The virtual DOM content to render.\n *\n * @param host - The host element for the rendered content.\n *\n * #### Notes\n * This renders the delta from the previous rendering. It assumes that\n * the content of the host element is not manipulated by external code.\n *\n * Providing `null` content will clear the rendering.\n *\n * Externally modifying the provided content or the host element will\n * result in undefined rendering behavior.\n */\n function render(content, host) {\n var oldContent = Private.hostMap.get(host) || [];\n var newContent = Private.asContentArray(content);\n Private.hostMap.set(host, newContent);\n Private.updateContent(host, oldContent, newContent);\n }\n VirtualDOM.render = render;\n})(VirtualDOM || (VirtualDOM = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * A weak mapping of host element to virtual DOM content.\n */\n Private.hostMap = new WeakMap();\n /**\n * Cast a content value to a content array.\n */\n function asContentArray(value) {\n if (!value) {\n return [];\n }\n if (value instanceof Array) {\n return value;\n }\n return [value];\n }\n Private.asContentArray = asContentArray;\n function createDOMNode(node) {\n var host = arguments[1] || null;\n var before = arguments[2] || null;\n if (host) {\n host.insertBefore(createDOMNode(node), before);\n }\n else {\n // Create a text node for a virtual text node.\n if (node.type === 'text') {\n return document.createTextNode(node.content);\n }\n // Create the HTML element with the specified tag.\n host = document.createElement(node.tag);\n // Add the attributes for the new element.\n addAttrs(host, node.attrs);\n if (node.renderer) {\n node.renderer.render(host, { attrs: node.attrs, children: node.children });\n return host;\n }\n // Recursively populate the element with child content.\n for (var i = 0, n = node.children.length; i < n; ++i) {\n createDOMNode(node.children[i], host);\n }\n }\n return host;\n }\n Private.createDOMNode = createDOMNode;\n /**\n * Update a host element with the delta of the virtual content.\n *\n * This is the core \"diff\" algorithm. There is no explicit \"patch\"\n * phase. The host is patched at each step as the diff progresses.\n */\n function updateContent(host, oldContent, newContent) {\n // Bail early if the content is identical.\n if (oldContent === newContent) {\n return;\n }\n // Collect the old keyed elems into a mapping.\n var oldKeyed = collectKeys(host, oldContent);\n // Create a copy of the old content which can be modified in-place.\n var oldCopy = oldContent.slice();\n // Update the host with the new content. The diff always proceeds\n // forward and never modifies a previously visited index. The old\n // copy array is modified in-place to reflect the changes made to\n // the host children. This causes the stale nodes to be pushed to\n // the end of the host node and removed at the end of the loop.\n var currElem = host.firstChild;\n var newCount = newContent.length;\n for (var i = 0; i < newCount; ++i) {\n // If the old content is exhausted, create a new node.\n if (i >= oldCopy.length) {\n createDOMNode(newContent[i], host);\n continue;\n }\n // Lookup the old and new virtual nodes.\n var oldVNode = oldCopy[i];\n var newVNode = newContent[i];\n // If both elements are identical, there is nothing to do.\n if (oldVNode === newVNode) {\n currElem = currElem.nextSibling;\n continue;\n }\n // Handle the simplest case of in-place text update first.\n if (oldVNode.type === 'text' && newVNode.type === 'text') {\n currElem.textContent = newVNode.content;\n currElem = currElem.nextSibling;\n continue;\n }\n // If the old or new node is a text node, the other node is now\n // known to be an element node, so create and insert a new node.\n if (oldVNode.type === 'text' || newVNode.type === 'text') {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(oldCopy, i, newVNode);\n createDOMNode(newVNode, host, currElem);\n continue;\n }\n // If the old XOR new node has a custom renderer,\n // create and insert a new node.\n if (!(oldVNode.renderer) != !(newVNode.renderer)) {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(oldCopy, i, newVNode);\n createDOMNode(newVNode, host, currElem);\n continue;\n }\n // At this point, both nodes are known to be element nodes.\n // If the new elem is keyed, move an old keyed elem to the proper\n // location before proceeding with the diff. The search can start\n // at the current index, since the unmatched old keyed elems are\n // pushed forward in the old copy array.\n var newKey = newVNode.attrs.key;\n if (newKey && newKey in oldKeyed) {\n var pair = oldKeyed[newKey];\n if (pair.vNode !== oldVNode) {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(oldCopy, oldCopy.indexOf(pair.vNode, i + 1), i);\n host.insertBefore(pair.element, currElem);\n oldVNode = pair.vNode;\n currElem = pair.element;\n }\n }\n // If both elements are identical, there is nothing to do.\n if (oldVNode === newVNode) {\n currElem = currElem.nextSibling;\n continue;\n }\n // If the old elem is keyed and does not match the new elem key,\n // create a new node. This is necessary since the old keyed elem\n // may be matched at a later point in the diff.\n var oldKey = oldVNode.attrs.key;\n if (oldKey && oldKey !== newKey) {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(oldCopy, i, newVNode);\n createDOMNode(newVNode, host, currElem);\n continue;\n }\n // If the tags are different, create a new node.\n if (oldVNode.tag !== newVNode.tag) {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(oldCopy, i, newVNode);\n createDOMNode(newVNode, host, currElem);\n continue;\n }\n // At this point, the element can be updated in-place.\n // Update the element attributes.\n updateAttrs(currElem, oldVNode.attrs, newVNode.attrs);\n // Update the element content.\n if (newVNode.renderer) {\n newVNode.renderer.render(currElem, { attrs: newVNode.attrs, children: newVNode.children });\n }\n else {\n updateContent(currElem, oldVNode.children, newVNode.children);\n }\n // Step to the next sibling element.\n currElem = currElem.nextSibling;\n }\n // Cleanup stale DOM\n removeContent(host, oldCopy, newCount, true);\n }\n Private.updateContent = updateContent;\n /**\n * Handle cleanup of stale vdom and its associated DOM. The host node is\n * traversed recursively (in depth-first order), and any explicit cleanup\n * required by a child node is carried out when it is visited (eg if a node\n * has a custom renderer, the renderer.unrender function will be called).\n * Once the subtree beneath each child of host has been completely visited,\n * that child will be removed via a call to host.removeChild.\n */\n function removeContent(host, oldContent, newCount, _sentinel) {\n // Dispose of the old nodes pushed to the end of the host.\n for (var i = oldContent.length - 1; i >= newCount; --i) {\n var oldNode = oldContent[i];\n var child = (_sentinel ? host.lastChild : host.childNodes[i]);\n // recursively clean up host children\n if (oldNode.type === 'text') ;\n else if (oldNode.renderer && oldNode.renderer.unrender) {\n oldNode.renderer.unrender(child, { attrs: oldNode.attrs, children: oldNode.children });\n }\n else {\n removeContent(child, oldNode.children, 0, false);\n }\n if (_sentinel) {\n host.removeChild(child);\n }\n }\n }\n /**\n * A set of special-cased attribute names.\n */\n var specialAttrs = {\n 'key': true,\n 'className': true,\n 'htmlFor': true,\n 'dataset': true,\n 'style': true,\n };\n /**\n * Add element attributes to a newly created HTML element.\n */\n function addAttrs(element, attrs) {\n // Add the inline event listeners and node attributes.\n for (var name_1 in attrs) {\n if (name_1 in specialAttrs) {\n continue;\n }\n if (name_1.substr(0, 2) === 'on') {\n element[name_1] = attrs[name_1];\n }\n else {\n element.setAttribute(name_1, attrs[name_1]);\n }\n }\n // Add the element `class` attribute.\n if (attrs.className !== undefined) {\n element.setAttribute('class', attrs.className);\n }\n // Add the element `for` attribute.\n if (attrs.htmlFor !== undefined) {\n element.setAttribute('for', attrs.htmlFor);\n }\n // Add the dataset values.\n if (attrs.dataset) {\n addDataset(element, attrs.dataset);\n }\n // Add the inline styles.\n if (attrs.style) {\n addStyle(element, attrs.style);\n }\n }\n /**\n * Update the element attributes of an HTML element.\n */\n function updateAttrs(element, oldAttrs, newAttrs) {\n // Do nothing if the attrs are the same object.\n if (oldAttrs === newAttrs) {\n return;\n }\n // Setup the strongly typed loop variable.\n var name;\n // Remove attributes and listeners which no longer exist.\n for (name in oldAttrs) {\n if (name in specialAttrs || name in newAttrs) {\n continue;\n }\n if (name.substr(0, 2) === 'on') {\n element[name] = null;\n }\n else {\n element.removeAttribute(name);\n }\n }\n // Add and update new and existing attributes and listeners.\n for (name in newAttrs) {\n if (name in specialAttrs || oldAttrs[name] === newAttrs[name]) {\n continue;\n }\n if (name.substr(0, 2) === 'on') {\n element[name] = newAttrs[name];\n }\n else {\n element.setAttribute(name, newAttrs[name]);\n }\n }\n // Update the element `class` attribute.\n if (oldAttrs.className !== newAttrs.className) {\n if (newAttrs.className !== undefined) {\n element.setAttribute('class', newAttrs.className);\n }\n else {\n element.removeAttribute('class');\n }\n }\n // Add the element `for` attribute.\n if (oldAttrs.htmlFor !== newAttrs.htmlFor) {\n if (newAttrs.htmlFor !== undefined) {\n element.setAttribute('for', newAttrs.htmlFor);\n }\n else {\n element.removeAttribute('for');\n }\n }\n // Update the dataset values.\n if (oldAttrs.dataset !== newAttrs.dataset) {\n updateDataset(element, oldAttrs.dataset || {}, newAttrs.dataset || {});\n }\n // Update the inline styles.\n if (oldAttrs.style !== newAttrs.style) {\n updateStyle(element, oldAttrs.style || {}, newAttrs.style || {});\n }\n }\n /**\n * Add dataset values to a newly created HTML element.\n */\n function addDataset(element, dataset) {\n for (var name_2 in dataset) {\n element.setAttribute(\"data-\" + name_2, dataset[name_2]);\n }\n }\n /**\n * Update the dataset values of an HTML element.\n */\n function updateDataset(element, oldDataset, newDataset) {\n for (var name_3 in oldDataset) {\n if (!(name_3 in newDataset)) {\n element.removeAttribute(\"data-\" + name_3);\n }\n }\n for (var name_4 in newDataset) {\n if (oldDataset[name_4] !== newDataset[name_4]) {\n element.setAttribute(\"data-\" + name_4, newDataset[name_4]);\n }\n }\n }\n /**\n * Add inline style values to a newly created HTML element.\n */\n function addStyle(element, style) {\n var elemStyle = element.style;\n var name;\n for (name in style) {\n elemStyle[name] = style[name];\n }\n }\n /**\n * Update the inline style values of an HTML element.\n */\n function updateStyle(element, oldStyle, newStyle) {\n var elemStyle = element.style;\n var name;\n for (name in oldStyle) {\n if (!(name in newStyle)) {\n elemStyle[name] = '';\n }\n }\n for (name in newStyle) {\n if (oldStyle[name] !== newStyle[name]) {\n elemStyle[name] = newStyle[name];\n }\n }\n }\n /**\n * Collect a mapping of keyed elements for the host content.\n */\n function collectKeys(host, content) {\n var node = host.firstChild;\n var keyMap = Object.create(null);\n for (var _i = 0, content_1 = content; _i < content_1.length; _i++) {\n var vNode = content_1[_i];\n if (vNode.type === 'element' && vNode.attrs.key) {\n keyMap[vNode.attrs.key] = { vNode: vNode, element: node };\n }\n node = node.nextSibling;\n }\n return keyMap;\n }\n})(Private || (Private = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/virtualdom/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/@lumino/widgets/dist/index.es6.js":
/*!********************************************************!*\
!*** ./node_modules/@lumino/widgets/dist/index.es6.js ***!
\********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BoxEngine\": () => /* binding */ BoxEngine,\n/* harmony export */ \"BoxLayout\": () => /* binding */ BoxLayout,\n/* harmony export */ \"BoxPanel\": () => /* binding */ BoxPanel,\n/* harmony export */ \"BoxSizer\": () => /* binding */ BoxSizer,\n/* harmony export */ \"CommandPalette\": () => /* binding */ CommandPalette,\n/* harmony export */ \"ContextMenu\": () => /* binding */ ContextMenu,\n/* harmony export */ \"DockLayout\": () => /* binding */ DockLayout,\n/* harmony export */ \"DockPanel\": () => /* binding */ DockPanel,\n/* harmony export */ \"FocusTracker\": () => /* binding */ FocusTracker,\n/* harmony export */ \"GridLayout\": () => /* binding */ GridLayout,\n/* harmony export */ \"Layout\": () => /* binding */ Layout,\n/* harmony export */ \"LayoutItem\": () => /* binding */ LayoutItem,\n/* harmony export */ \"Menu\": () => /* binding */ Menu,\n/* harmony export */ \"MenuBar\": () => /* binding */ MenuBar,\n/* harmony export */ \"Panel\": () => /* binding */ Panel,\n/* harmony export */ \"PanelLayout\": () => /* binding */ PanelLayout,\n/* harmony export */ \"ScrollBar\": () => /* binding */ ScrollBar,\n/* harmony export */ \"SingletonLayout\": () => /* binding */ SingletonLayout,\n/* harmony export */ \"SplitLayout\": () => /* binding */ SplitLayout,\n/* harmony export */ \"SplitPanel\": () => /* binding */ SplitPanel,\n/* harmony export */ \"StackedLayout\": () => /* binding */ StackedLayout,\n/* harmony export */ \"StackedPanel\": () => /* binding */ StackedPanel,\n/* harmony export */ \"TabBar\": () => /* binding */ TabBar,\n/* harmony export */ \"TabPanel\": () => /* binding */ TabPanel,\n/* harmony export */ \"Title\": () => /* binding */ Title,\n/* harmony export */ \"Widget\": () => /* binding */ Widget\n/* harmony export */ });\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ \"./node_modules/@lumino/algorithm/dist/index.es6.js\");\n/* harmony import */ var _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/domutils */ \"./node_modules/@lumino/domutils/dist/index.es6.js\");\n/* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/messaging */ \"./node_modules/@lumino/messaging/dist/index.es6.js\");\n/* harmony import */ var _lumino_properties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/properties */ \"./node_modules/@lumino/properties/dist/index.es6.js\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/signaling */ \"./node_modules/@lumino/signaling/dist/index.es6.js\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/coreutils */ \"./node_modules/@lumino/coreutils/dist/index.es6.js\");\n/* harmony import */ var _lumino_commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/commands */ \"./node_modules/@lumino/commands/dist/index.es6.js\");\n/* harmony import */ var _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @lumino/virtualdom */ \"./node_modules/@lumino/virtualdom/dist/index.es6.js\");\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @lumino/disposable */ \"./node_modules/@lumino/disposable/dist/index.es6.js\");\n/* harmony import */ var _lumino_keyboard__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @lumino/keyboard */ \"./node_modules/@lumino/keyboard/dist/index.es6.js\");\n/* harmony import */ var _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @lumino/dragdrop */ \"./node_modules/@lumino/dragdrop/dist/index.es6.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * A sizer object for use with the box engine layout functions.\n *\n * #### Notes\n * A box sizer holds the geometry information for an object along an\n * arbitrary layout orientation.\n *\n * For best performance, this class should be treated as a raw data\n * struct. It should not typically be subclassed.\n */\nvar BoxSizer = /** @class */ (function () {\n function BoxSizer() {\n /**\n * The preferred size for the sizer.\n *\n * #### Notes\n * The sizer will be given this initial size subject to its size\n * bounds. The sizer will not deviate from this size unless such\n * deviation is required to fit into the available layout space.\n *\n * There is no limit to this value, but it will be clamped to the\n * bounds defined by [[minSize]] and [[maxSize]].\n *\n * The default value is `0`.\n */\n this.sizeHint = 0;\n /**\n * The minimum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized less than this value, even if\n * it means the sizer will overflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity)`\n * and that it is `<=` to [[maxSize]]. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `0`.\n */\n this.minSize = 0;\n /**\n * The maximum size of the sizer.\n *\n * #### Notes\n * The sizer will never be sized greater than this value, even if\n * it means the sizer will underflow the available layout space.\n *\n * It is assumed that this value lies in the range `[0, Infinity]`\n * and that it is `>=` to [[minSize]]. Failure to adhere to this\n * constraint will yield undefined results.\n *\n * The default value is `Infinity`.\n */\n this.maxSize = Infinity;\n /**\n * The stretch factor for the sizer.\n *\n * #### Notes\n * This controls how much the sizer stretches relative to its sibling\n * sizers when layout space is distributed. A stretch factor of zero\n * is special and will cause the sizer to only be resized after all\n * other sizers with a stretch factor greater than zero have been\n * resized to their limits.\n *\n * It is assumed that this value is an integer that lies in the range\n * `[0, Infinity)`. Failure to adhere to this constraint will yield\n * undefined results.\n *\n * The default value is `1`.\n */\n this.stretch = 1;\n /**\n * The computed size of the sizer.\n *\n * #### Notes\n * This value is the output of a call to [[boxCalc]]. It represents\n * the computed size for the object along the layout orientation,\n * and will always lie in the range `[minSize, maxSize]`.\n *\n * This value is output only.\n *\n * Changing this value will have no effect.\n */\n this.size = 0;\n /**\n * An internal storage property for the layout algorithm.\n *\n * #### Notes\n * This value is used as temporary storage by the layout algorithm.\n *\n * Changing this value will have no effect.\n */\n this.done = false;\n }\n return BoxSizer;\n}());\n/**\n * The namespace for the box engine layout functions.\n */\nvar BoxEngine;\n(function (BoxEngine) {\n /**\n * Calculate the optimal layout sizes for a sequence of box sizers.\n *\n * This distributes the available layout space among the box sizers\n * according to the following algorithm:\n *\n * 1. Initialize the sizers's size to its size hint and compute the\n * sums for each of size hint, min size, and max size.\n *\n * 2. If the total size hint equals the available space, return.\n *\n * 3. If the available space is less than the total min size, set all\n * sizers to their min size and return.\n *\n * 4. If the available space is greater than the total max size, set\n * all sizers to their max size and return.\n *\n * 5. If the layout space is less than the total size hint, distribute\n * the negative delta as follows:\n *\n * a. Shrink each sizer with a stretch factor greater than zero by\n * an amount proportional to the negative space and the sum of\n * stretch factors. If the sizer reaches its min size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains negative\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its min size,\n * remove it from the computation.\n *\n * 6. If the layout space is greater than the total size hint,\n * distribute the positive delta as follows:\n *\n * a. Expand each sizer with a stretch factor greater than zero by\n * an amount proportional to the postive space and the sum of\n * stretch factors. If the sizer reaches its max size, remove\n * it and its stretch factor from the computation.\n *\n * b. If after adjusting all stretch sizers there remains positive\n * space, distribute the space equally among the sizers with a\n * stretch factor of zero. If a sizer reaches its max size,\n * remove it from the computation.\n *\n * 7. return\n *\n * @param sizers - The sizers for a particular layout line.\n *\n * @param space - The available layout space for the sizers.\n *\n * @returns The delta between the provided available space and the\n * actual consumed space. This value will be zero if the sizers\n * can be adjusted to fit, negative if the available space is too\n * small, and positive if the available space is too large.\n *\n * #### Notes\n * The [[size]] of each sizer is updated with the computed size.\n *\n * This function can be called at any time to recompute the layout for\n * an existing sequence of sizers. The previously computed results will\n * have no effect on the new output. It is therefore not necessary to\n * create new sizer objects on each resize event.\n */\n function calc(sizers, space) {\n // Bail early if there is nothing to do.\n var count = sizers.length;\n if (count === 0) {\n return space;\n }\n // Setup the size and stretch counters.\n var totalMin = 0;\n var totalMax = 0;\n var totalSize = 0;\n var totalStretch = 0;\n var stretchCount = 0;\n // Setup the sizers and compute the totals.\n for (var i = 0; i < count; ++i) {\n var sizer = sizers[i];\n var min = sizer.minSize;\n var max = sizer.maxSize;\n var hint = sizer.sizeHint;\n sizer.done = false;\n sizer.size = Math.max(min, Math.min(hint, max));\n totalSize += sizer.size;\n totalMin += min;\n totalMax += max;\n if (sizer.stretch > 0) {\n totalStretch += sizer.stretch;\n stretchCount++;\n }\n }\n // If the space is equal to the total size, return early.\n if (space === totalSize) {\n return 0;\n }\n // If the space is less than the total min, minimize each sizer.\n if (space <= totalMin) {\n for (var i = 0; i < count; ++i) {\n var sizer = sizers[i];\n sizer.size = sizer.minSize;\n }\n return space - totalMin;\n }\n // If the space is greater than the total max, maximize each sizer.\n if (space >= totalMax) {\n for (var i = 0; i < count; ++i) {\n var sizer = sizers[i];\n sizer.size = sizer.maxSize;\n }\n return space - totalMax;\n }\n // The loops below perform sub-pixel precision sizing. A near zero\n // value is used for compares instead of zero to ensure that the\n // loop terminates when the subdivided space is reasonably small.\n var nearZero = 0.01;\n // A counter which is decremented each time a sizer is resized to\n // its limit. This ensures the loops terminate even if there is\n // space remaining to distribute.\n var notDoneCount = count;\n // Distribute negative delta space.\n if (space < totalSize) {\n // Shrink each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its min size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n var freeSpace = totalSize - space;\n while (stretchCount > 0 && freeSpace > nearZero) {\n var distSpace = freeSpace;\n var distStretch = totalStretch;\n for (var i = 0; i < count; ++i) {\n var sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n var amt = sizer.stretch * distSpace / distStretch;\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n }\n else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n var amt = freeSpace / notDoneCount;\n for (var i = 0; i < count; ++i) {\n var sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size - amt <= sizer.minSize) {\n freeSpace -= sizer.size - sizer.minSize;\n sizer.size = sizer.minSize;\n sizer.done = true;\n notDoneCount--;\n }\n else {\n freeSpace -= amt;\n sizer.size -= amt;\n }\n }\n }\n }\n // Distribute positive delta space.\n else {\n // Expand each stretchable sizer by an amount proportional to its\n // stretch factor. If a sizer reaches its max size it's marked as\n // done. The loop progresses in phases where each sizer is given\n // a chance to consume its fair share for the pass, regardless of\n // whether a sizer before it reached its limit. This continues\n // until the stretchable sizers or the free space is exhausted.\n var freeSpace = space - totalSize;\n while (stretchCount > 0 && freeSpace > nearZero) {\n var distSpace = freeSpace;\n var distStretch = totalStretch;\n for (var i = 0; i < count; ++i) {\n var sizer = sizers[i];\n if (sizer.done || sizer.stretch === 0) {\n continue;\n }\n var amt = sizer.stretch * distSpace / distStretch;\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n totalStretch -= sizer.stretch;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n stretchCount--;\n }\n else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n // Distribute any remaining space evenly among the non-stretchable\n // sizers. This progresses in phases in the same manner as above.\n while (notDoneCount > 0 && freeSpace > nearZero) {\n var amt = freeSpace / notDoneCount;\n for (var i = 0; i < count; ++i) {\n var sizer = sizers[i];\n if (sizer.done) {\n continue;\n }\n if (sizer.size + amt >= sizer.maxSize) {\n freeSpace -= sizer.maxSize - sizer.size;\n sizer.size = sizer.maxSize;\n sizer.done = true;\n notDoneCount--;\n }\n else {\n freeSpace -= amt;\n sizer.size += amt;\n }\n }\n }\n }\n // Indicate that the consumed space equals the available space.\n return 0;\n }\n BoxEngine.calc = calc;\n /**\n * Adjust a sizer by a delta and update its neighbors accordingly.\n *\n * @param sizers - The sizers which should be adjusted.\n *\n * @param index - The index of the sizer to grow.\n *\n * @param delta - The amount to adjust the sizer, positive or negative.\n *\n * #### Notes\n * This will adjust the indicated sizer by the specified amount, along\n * with the sizes of the appropriate neighbors, subject to the limits\n * specified by each of the sizers.\n *\n * This is useful when implementing box layouts where the boundaries\n * between the sizers are interactively adjustable by the user.\n */\n function adjust(sizers, index, delta) {\n // Bail early when there is nothing to do.\n if (sizers.length === 0 || delta === 0) {\n return;\n }\n // Dispatch to the proper implementation.\n if (delta > 0) {\n growSizer(sizers, index, delta);\n }\n else {\n shrinkSizer(sizers, index, -delta);\n }\n }\n BoxEngine.adjust = adjust;\n /**\n * Grow a sizer by a positive delta and adjust neighbors.\n */\n function growSizer(sizers, index, delta) {\n // Compute how much the items to the left can expand.\n var growLimit = 0;\n for (var i = 0; i <= index; ++i) {\n var sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n // Compute how much the items to the right can shrink.\n var shrinkLimit = 0;\n for (var i = index + 1, n = sizers.length; i < n; ++i) {\n var sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n // Grow the sizers to the left by the delta.\n var grow = delta;\n for (var i = index; i >= 0 && grow > 0; --i) {\n var sizer = sizers[i];\n var limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n }\n else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n // Shrink the sizers to the right by the delta.\n var shrink = delta;\n for (var i = index + 1, n = sizers.length; i < n && shrink > 0; ++i) {\n var sizer = sizers[i];\n var limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n }\n else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n /**\n * Shrink a sizer by a positive delta and adjust neighbors.\n */\n function shrinkSizer(sizers, index, delta) {\n // Compute how much the items to the right can expand.\n var growLimit = 0;\n for (var i = index + 1, n = sizers.length; i < n; ++i) {\n var sizer = sizers[i];\n growLimit += sizer.maxSize - sizer.size;\n }\n // Compute how much the items to the left can shrink.\n var shrinkLimit = 0;\n for (var i = 0; i <= index; ++i) {\n var sizer = sizers[i];\n shrinkLimit += sizer.size - sizer.minSize;\n }\n // Clamp the delta adjustment to the limits.\n delta = Math.min(delta, growLimit, shrinkLimit);\n // Grow the sizers to the right by the delta.\n var grow = delta;\n for (var i = index + 1, n = sizers.length; i < n && grow > 0; ++i) {\n var sizer = sizers[i];\n var limit = sizer.maxSize - sizer.size;\n if (limit >= grow) {\n sizer.sizeHint = sizer.size + grow;\n grow = 0;\n }\n else {\n sizer.sizeHint = sizer.size + limit;\n grow -= limit;\n }\n }\n // Shrink the sizers to the left by the delta.\n var shrink = delta;\n for (var i = index; i >= 0 && shrink > 0; --i) {\n var sizer = sizers[i];\n var limit = sizer.size - sizer.minSize;\n if (limit >= shrink) {\n sizer.sizeHint = sizer.size - shrink;\n shrink = 0;\n }\n else {\n sizer.sizeHint = sizer.size - limit;\n shrink -= limit;\n }\n }\n }\n})(BoxEngine || (BoxEngine = {}));\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\n\n// Copyright (c) Jupyter Development Team.\n/**\n * An object which holds data related to an object's title.\n *\n * #### Notes\n * A title object is intended to hold the data necessary to display a\n * header for a particular object. A common example is the `TabPanel`,\n * which uses the widget title to populate the tab for a child widget.\n */\nvar Title = /** @class */ (function () {\n /**\n * Construct a new title.\n *\n * @param options - The options for initializing the title.\n */\n function Title(options) {\n this._label = '';\n this._caption = '';\n this._mnemonic = -1;\n this._iconClass = '';\n this._iconLabel = '';\n this._className = '';\n this._closable = false;\n this._changed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(this);\n this.owner = options.owner;\n if (options.label !== undefined) {\n this._label = options.label;\n }\n if (options.mnemonic !== undefined) {\n this._mnemonic = options.mnemonic;\n }\n if (options.icon !== undefined) {\n /* <DEPRECATED> */\n if (typeof options.icon === \"string\") {\n // when ._icon is null, the .icon getter will alias .iconClass\n this._icon = null;\n this._iconClass = options.icon;\n }\n else {\n /* </DEPRECATED> */\n this._icon = options.icon;\n /* <DEPRECATED> */\n }\n /* </DEPRECATED> */\n }\n /* <DEPRECATED> */\n else {\n // if unset, default to aliasing .iconClass\n this._icon = null;\n }\n /* </DEPRECATED> */\n if (options.iconClass !== undefined) {\n this._iconClass = options.iconClass;\n }\n if (options.iconLabel !== undefined) {\n this._iconLabel = options.iconLabel;\n }\n if (options.iconRenderer !== undefined) {\n this._icon = options.iconRenderer;\n }\n if (options.caption !== undefined) {\n this._caption = options.caption;\n }\n if (options.className !== undefined) {\n this._className = options.className;\n }\n if (options.closable !== undefined) {\n this._closable = options.closable;\n }\n this._dataset = options.dataset || {};\n }\n Object.defineProperty(Title.prototype, \"changed\", {\n /**\n * A signal emitted when the state of the title changes.\n */\n get: function () {\n return this._changed;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"label\", {\n /**\n * Get the label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get: function () {\n return this._label;\n },\n /**\n * Set the label for the title.\n */\n set: function (value) {\n if (this._label === value) {\n return;\n }\n this._label = value;\n this._changed.emit(undefined);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"mnemonic\", {\n /**\n * Get the mnemonic index for the title.\n *\n * #### Notes\n * The default value is `-1`.\n */\n get: function () {\n return this._mnemonic;\n },\n /**\n * Set the mnemonic index for the title.\n */\n set: function (value) {\n if (this._mnemonic === value) {\n return;\n }\n this._mnemonic = value;\n this._changed.emit(undefined);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"icon\", {\n /**\n * Get the icon renderer for the title.\n *\n * #### Notes\n * The default value is undefined.\n *\n * DEPRECATED: if set to a string value, the .icon field will function as\n * an alias for the .iconClass field, for backwards compatibility\n */\n get: function () {\n /* <DEPRECATED> */\n if (this._icon === null) {\n // only alias .iconClass if ._icon has been explicitly nulled\n return this.iconClass;\n }\n /* </DEPRECATED> */\n return this._icon;\n },\n /**\n * Set the icon renderer for the title.\n *\n * #### Notes\n * A renderer is an object that supplies a render and unrender function.\n *\n * DEPRECATED: if set to a string value, the .icon field will function as\n * an alias for the .iconClass field, for backwards compatibility\n */\n set: function (value /* </DEPRECATED> */) {\n /* <DEPRECATED> */\n if (typeof value === \"string\") {\n // when ._icon is null, the .icon getter will alias .iconClass\n this._icon = null;\n this.iconClass = value;\n }\n else {\n /* </DEPRECATED> */\n if (this._icon === value) {\n return;\n }\n this._icon = value;\n this._changed.emit(undefined);\n /* <DEPRECATED> */\n }\n /* </DEPRECATED> */\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"iconClass\", {\n /**\n * Get the icon class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get: function () {\n return this._iconClass;\n },\n /**\n * Set the icon class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set: function (value) {\n if (this._iconClass === value) {\n return;\n }\n this._iconClass = value;\n this._changed.emit(undefined);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"iconLabel\", {\n /**\n * Get the icon label for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get: function () {\n return this._iconLabel;\n },\n /**\n * Set the icon label for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set: function (value) {\n if (this._iconLabel === value) {\n return;\n }\n this._iconLabel = value;\n this._changed.emit(undefined);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"iconRenderer\", {\n /**\n * @deprecated Use `icon` instead.\n */\n get: function () {\n return this._icon || undefined;\n },\n /**\n * @deprecated Use `icon` instead.\n */\n set: function (value) {\n this.icon = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"caption\", {\n /**\n * Get the caption for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get: function () {\n return this._caption;\n },\n /**\n * Set the caption for the title.\n */\n set: function (value) {\n if (this._caption === value) {\n return;\n }\n this._caption = value;\n this._changed.emit(undefined);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"className\", {\n /**\n * Get the extra class name for the title.\n *\n * #### Notes\n * The default value is an empty string.\n */\n get: function () {\n return this._className;\n },\n /**\n * Set the extra class name for the title.\n *\n * #### Notes\n * Multiple class names can be separated with whitespace.\n */\n set: function (value) {\n if (this._className === value) {\n return;\n }\n this._className = value;\n this._changed.emit(undefined);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"closable\", {\n /**\n * Get the closable state for the title.\n *\n * #### Notes\n * The default value is `false`.\n */\n get: function () {\n return this._closable;\n },\n /**\n * Set the closable state for the title.\n *\n * #### Notes\n * This controls the presence of a close icon when applicable.\n */\n set: function (value) {\n if (this._closable === value) {\n return;\n }\n this._closable = value;\n this._changed.emit(undefined);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Title.prototype, \"dataset\", {\n /**\n * Get the dataset for the title.\n *\n * #### Notes\n * The default value is an empty dataset.\n */\n get: function () {\n return this._dataset;\n },\n /**\n * Set the dataset for the title.\n *\n * #### Notes\n * This controls the data attributes when applicable.\n */\n set: function (value) {\n if (this._dataset === value) {\n return;\n }\n this._dataset = value;\n this._changed.emit(undefined);\n },\n enumerable: true,\n configurable: true\n });\n return Title;\n}());\n\n/**\n * The base class of the lumino widget hierarchy.\n *\n * #### Notes\n * This class will typically be subclassed in order to create a useful\n * widget. However, it can be used directly to host externally created\n * content.\n */\nvar Widget = /** @class */ (function () {\n /**\n * Construct a new widget.\n *\n * @param options - The options for initializing the widget.\n */\n function Widget(options) {\n if (options === void 0) { options = {}; }\n this._flags = 0;\n this._layout = null;\n this._parent = null;\n this._disposed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(this);\n this.node = Private.createNode(options);\n this.addClass('lm-Widget');\n /* <DEPRECATED> */\n this.addClass('p-Widget');\n /* </DEPRECATED> */\n }\n /**\n * Dispose of the widget and its descendant widgets.\n *\n * #### Notes\n * It is unsafe to use the widget after it has been disposed.\n *\n * All calls made to this method after the first are a no-op.\n */\n Widget.prototype.dispose = function () {\n // Do nothing if the widget is already disposed.\n if (this.isDisposed) {\n return;\n }\n // Set the disposed flag and emit the disposed signal.\n this.setFlag(Widget.Flag.IsDisposed);\n this._disposed.emit(undefined);\n // Remove or detach the widget if necessary.\n if (this.parent) {\n this.parent = null;\n }\n else if (this.isAttached) {\n Widget.detach(this);\n }\n // Dispose of the widget layout.\n if (this._layout) {\n this._layout.dispose();\n this._layout = null;\n }\n // Clear the extra data associated with the widget.\n _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal.clearData(this);\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.clearData(this);\n _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty.clearData(this);\n };\n Object.defineProperty(Widget.prototype, \"disposed\", {\n /**\n * A signal emitted when the widget is disposed.\n */\n get: function () {\n return this._disposed;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"isDisposed\", {\n /**\n * Test whether the widget has been disposed.\n */\n get: function () {\n return this.testFlag(Widget.Flag.IsDisposed);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"isAttached\", {\n /**\n * Test whether the widget's node is attached to the DOM.\n */\n get: function () {\n return this.testFlag(Widget.Flag.IsAttached);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"isHidden\", {\n /**\n * Test whether the widget is explicitly hidden.\n */\n get: function () {\n return this.testFlag(Widget.Flag.IsHidden);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"isVisible\", {\n /**\n * Test whether the widget is visible.\n *\n * #### Notes\n * A widget is visible when it is attached to the DOM, is not\n * explicitly hidden, and has no explicitly hidden ancestors.\n */\n get: function () {\n return this.testFlag(Widget.Flag.IsVisible);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"title\", {\n /**\n * The title object for the widget.\n *\n * #### Notes\n * The title object is used by some container widgets when displaying\n * the widget alongside some title, such as a tab panel or side bar.\n *\n * Since not all widgets will use the title, it is created on demand.\n *\n * The `owner` property of the title is set to this widget.\n */\n get: function () {\n return Private.titleProperty.get(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"id\", {\n /**\n * Get the id of the widget's DOM node.\n */\n get: function () {\n return this.node.id;\n },\n /**\n * Set the id of the widget's DOM node.\n */\n set: function (value) {\n this.node.id = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"dataset\", {\n /**\n * The dataset for the widget's DOM node.\n */\n get: function () {\n return this.node.dataset;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"parent\", {\n /**\n * Get the parent of the widget.\n */\n get: function () {\n return this._parent;\n },\n /**\n * Set the parent of the widget.\n *\n * #### Notes\n * Children are typically added to a widget by using a layout, which\n * means user code will not normally set the parent widget directly.\n *\n * The widget will be automatically removed from its old parent.\n *\n * This is a no-op if there is no effective parent change.\n */\n set: function (value) {\n if (this._parent === value) {\n return;\n }\n if (value && this.contains(value)) {\n throw new Error('Invalid parent widget.');\n }\n if (this._parent && !this._parent.isDisposed) {\n var msg = new Widget.ChildMessage('child-removed', this);\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this._parent, msg);\n }\n this._parent = value;\n if (this._parent && !this._parent.isDisposed) {\n var msg = new Widget.ChildMessage('child-added', this);\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this._parent, msg);\n }\n if (!this.isDisposed) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this, Widget.Msg.ParentChanged);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Widget.prototype, \"layout\", {\n /**\n * Get the layout for the widget.\n */\n get: function () {\n return this._layout;\n },\n /**\n * Set the layout for the widget.\n *\n * #### Notes\n * The layout is single-use only. It cannot be changed after the\n * first assignment.\n *\n * The layout is disposed automatically when the widget is disposed.\n */\n set: function (value) {\n if (this._layout === value) {\n return;\n }\n if (this.testFlag(Widget.Flag.DisallowLayout)) {\n throw new Error('Cannot set widget layout.');\n }\n if (this._layout) {\n throw new Error('Cannot change widget layout.');\n }\n if (value.parent) {\n throw new Error('Cannot change layout parent.');\n }\n this._layout = value;\n value.parent = this;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Create an iterator over the widget's children.\n *\n * @returns A new iterator over the children of the widget.\n *\n * #### Notes\n * The widget must have a populated layout in order to have children.\n *\n * If a layout is not installed, the returned iterator will be empty.\n */\n Widget.prototype.children = function () {\n return this._layout ? this._layout.iter() : (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Test whether a widget is a descendant of this widget.\n *\n * @param widget - The descendant widget of interest.\n *\n * @returns `true` if the widget is a descendant, `false` otherwise.\n */\n Widget.prototype.contains = function (widget) {\n for (var value = widget; value; value = value._parent) {\n if (value === this) {\n return true;\n }\n }\n return false;\n };\n /**\n * Test whether the widget's DOM node has the given class name.\n *\n * @param name - The class name of interest.\n *\n * @returns `true` if the node has the class, `false` otherwise.\n */\n Widget.prototype.hasClass = function (name) {\n return this.node.classList.contains(name);\n };\n /**\n * Add a class name to the widget's DOM node.\n *\n * @param name - The class name to add to the node.\n *\n * #### Notes\n * If the class name is already added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n Widget.prototype.addClass = function (name) {\n this.node.classList.add(name);\n };\n /**\n * Remove a class name from the widget's DOM node.\n *\n * @param name - The class name to remove from the node.\n *\n * #### Notes\n * If the class name is not yet added to the node, this is a no-op.\n *\n * The class name must not contain whitespace.\n */\n Widget.prototype.removeClass = function (name) {\n this.node.classList.remove(name);\n };\n /**\n * Toggle a class name on the widget's DOM node.\n *\n * @param name - The class name to toggle on the node.\n *\n * @param force - Whether to force add the class (`true`) or force\n * remove the class (`false`). If not provided, the presence of\n * the class will be toggled from its current state.\n *\n * @returns `true` if the class is now present, `false` otherwise.\n *\n * #### Notes\n * The class name must not contain whitespace.\n */\n Widget.prototype.toggleClass = function (name, force) {\n if (force === true) {\n this.node.classList.add(name);\n return true;\n }\n if (force === false) {\n this.node.classList.remove(name);\n return false;\n }\n return this.node.classList.toggle(name);\n };\n /**\n * Post an `'update-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n Widget.prototype.update = function () {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Widget.Msg.UpdateRequest);\n };\n /**\n * Post a `'fit-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n Widget.prototype.fit = function () {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Widget.Msg.FitRequest);\n };\n /**\n * Post an `'activate-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for posting the message.\n */\n Widget.prototype.activate = function () {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Widget.Msg.ActivateRequest);\n };\n /**\n * Send a `'close-request'` message to the widget.\n *\n * #### Notes\n * This is a simple convenience method for sending the message.\n */\n Widget.prototype.close = function () {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this, Widget.Msg.CloseRequest);\n };\n /**\n * Show the widget and make it visible to its parent widget.\n *\n * #### Notes\n * This causes the [[isHidden]] property to be `false`.\n *\n * If the widget is not explicitly hidden, this is a no-op.\n */\n Widget.prototype.show = function () {\n if (!this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this, Widget.Msg.BeforeShow);\n }\n this.clearFlag(Widget.Flag.IsHidden);\n this.removeClass('lm-mod-hidden');\n /* <DEPRECATED> */\n this.removeClass('p-mod-hidden');\n /* </DEPRECATED> */\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this, Widget.Msg.AfterShow);\n }\n if (this.parent) {\n var msg = new Widget.ChildMessage('child-shown', this);\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent, msg);\n }\n };\n /**\n * Hide the widget and make it hidden to its parent widget.\n *\n * #### Notes\n * This causes the [[isHidden]] property to be `true`.\n *\n * If the widget is explicitly hidden, this is a no-op.\n */\n Widget.prototype.hide = function () {\n if (this.testFlag(Widget.Flag.IsHidden)) {\n return;\n }\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this, Widget.Msg.BeforeHide);\n }\n this.setFlag(Widget.Flag.IsHidden);\n this.addClass('lm-mod-hidden');\n /* <DEPRECATED> */\n this.addClass('p-mod-hidden');\n /* </DEPRECATED> */\n if (this.isAttached && (!this.parent || this.parent.isVisible)) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this, Widget.Msg.AfterHide);\n }\n if (this.parent) {\n var msg = new Widget.ChildMessage('child-hidden', this);\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent, msg);\n }\n };\n /**\n * Show or hide the widget according to a boolean value.\n *\n * @param hidden - `true` to hide the widget, or `false` to show it.\n *\n * #### Notes\n * This is a convenience method for `hide()` and `show()`.\n */\n Widget.prototype.setHidden = function (hidden) {\n if (hidden) {\n this.hide();\n }\n else {\n this.show();\n }\n };\n /**\n * Test whether the given widget flag is set.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n Widget.prototype.testFlag = function (flag) {\n return (this._flags & flag) !== 0;\n };\n /**\n * Set the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n Widget.prototype.setFlag = function (flag) {\n this._flags |= flag;\n };\n /**\n * Clear the given widget flag.\n *\n * #### Notes\n * This will not typically be called directly by user code.\n */\n Widget.prototype.clearFlag = function (flag) {\n this._flags &= ~flag;\n };\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n *\n * #### Notes\n * Subclasses may reimplement this method as needed.\n */\n Widget.prototype.processMessage = function (msg) {\n switch (msg.type) {\n case 'resize':\n this.notifyLayout(msg);\n this.onResize(msg);\n break;\n case 'update-request':\n this.notifyLayout(msg);\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.notifyLayout(msg);\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.notifyLayout(msg);\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.setFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.notifyLayout(msg);\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.clearFlag(Widget.Flag.IsVisible);\n this.notifyLayout(msg);\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.notifyLayout(msg);\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n if (!this.isHidden && (!this.parent || this.parent.isVisible)) {\n this.setFlag(Widget.Flag.IsVisible);\n }\n this.setFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.notifyLayout(msg);\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.clearFlag(Widget.Flag.IsVisible);\n this.clearFlag(Widget.Flag.IsAttached);\n this.notifyLayout(msg);\n this.onAfterDetach(msg);\n break;\n case 'activate-request':\n this.notifyLayout(msg);\n this.onActivateRequest(msg);\n break;\n case 'close-request':\n this.notifyLayout(msg);\n this.onCloseRequest(msg);\n break;\n case 'child-added':\n this.notifyLayout(msg);\n this.onChildAdded(msg);\n break;\n case 'child-removed':\n this.notifyLayout(msg);\n this.onChildRemoved(msg);\n break;\n default:\n this.notifyLayout(msg);\n break;\n }\n };\n /**\n * Invoke the message processing routine of the widget's layout.\n *\n * @param msg - The message to dispatch to the layout.\n *\n * #### Notes\n * This is a no-op if the widget does not have a layout.\n *\n * This will not typically be called directly by user code.\n */\n Widget.prototype.notifyLayout = function (msg) {\n if (this._layout) {\n this._layout.processParentMessage(msg);\n }\n };\n /**\n * A message handler invoked on a `'close-request'` message.\n *\n * #### Notes\n * The default implementation unparents or detaches the widget.\n */\n Widget.prototype.onCloseRequest = function (msg) {\n if (this.parent) {\n this.parent = null;\n }\n else if (this.isAttached) {\n Widget.detach(this);\n }\n };\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onResize = function (msg) { };\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onUpdateRequest = function (msg) { };\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onFitRequest = function (msg) { };\n /**\n * A message handler invoked on an `'activate-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onActivateRequest = function (msg) { };\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onBeforeShow = function (msg) { };\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onAfterShow = function (msg) { };\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onBeforeHide = function (msg) { };\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onAfterHide = function (msg) { };\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onBeforeAttach = function (msg) { };\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onAfterAttach = function (msg) { };\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onBeforeDetach = function (msg) { };\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onAfterDetach = function (msg) { };\n /**\n * A message handler invoked on a `'child-added'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onChildAdded = function (msg) { };\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Widget.prototype.onChildRemoved = function (msg) { };\n return Widget;\n}());\n/**\n * The namespace for the `Widget` class statics.\n */\n(function (Widget) {\n /**\n * An enum of widget bit flags.\n */\n var Flag;\n (function (Flag) {\n /**\n * The widget has been disposed.\n */\n Flag[Flag[\"IsDisposed\"] = 1] = \"IsDisposed\";\n /**\n * The widget is attached to the DOM.\n */\n Flag[Flag[\"IsAttached\"] = 2] = \"IsAttached\";\n /**\n * The widget is hidden.\n */\n Flag[Flag[\"IsHidden\"] = 4] = \"IsHidden\";\n /**\n * The widget is visible.\n */\n Flag[Flag[\"IsVisible\"] = 8] = \"IsVisible\";\n /**\n * A layout cannot be set on the widget.\n */\n Flag[Flag[\"DisallowLayout\"] = 16] = \"DisallowLayout\";\n })(Flag = Widget.Flag || (Widget.Flag = {}));\n /**\n * A collection of stateless messages related to widgets.\n */\n var Msg;\n (function (Msg) {\n /**\n * A singleton `'before-show'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n Msg.BeforeShow = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('before-show');\n /**\n * A singleton `'after-show'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes visible.\n *\n * This message is **not** sent when the widget is being attached.\n */\n Msg.AfterShow = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('after-show');\n /**\n * A singleton `'before-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget before it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n Msg.BeforeHide = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('before-hide');\n /**\n * A singleton `'after-hide'` message.\n *\n * #### Notes\n * This message is sent to a widget after it becomes not-visible.\n *\n * This message is **not** sent when the widget is being detached.\n */\n Msg.AfterHide = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('after-hide');\n /**\n * A singleton `'before-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is attached.\n */\n Msg.BeforeAttach = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('before-attach');\n /**\n * A singleton `'after-attach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is attached.\n */\n Msg.AfterAttach = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('after-attach');\n /**\n * A singleton `'before-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget before it is detached.\n */\n Msg.BeforeDetach = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('before-detach');\n /**\n * A singleton `'after-detach'` message.\n *\n * #### Notes\n * This message is sent to a widget after it is detached.\n */\n Msg.AfterDetach = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('after-detach');\n /**\n * A singleton `'parent-changed'` message.\n *\n * #### Notes\n * This message is sent to a widget when its parent has changed.\n */\n Msg.ParentChanged = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message('parent-changed');\n /**\n * A singleton conflatable `'update-request'` message.\n *\n * #### Notes\n * This message can be dispatched to supporting widgets in order to\n * update their content based on the current widget state. Not all\n * widgets will respond to messages of this type.\n *\n * For widgets with a layout, this message will inform the layout to\n * update the position and size of its child widgets.\n */\n Msg.UpdateRequest = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.ConflatableMessage('update-request');\n /**\n * A singleton conflatable `'fit-request'` message.\n *\n * #### Notes\n * For widgets with a layout, this message will inform the layout to\n * recalculate its size constraints to fit the space requirements of\n * its child widgets, and to update their position and size. Not all\n * layouts will respond to messages of this type.\n */\n Msg.FitRequest = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.ConflatableMessage('fit-request');\n /**\n * A singleton conflatable `'activate-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should\n * perform the actions necessary to activate the widget, which\n * may include focusing its node or descendant node.\n */\n Msg.ActivateRequest = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.ConflatableMessage('activate-request');\n /**\n * A singleton conflatable `'close-request'` message.\n *\n * #### Notes\n * This message should be dispatched to a widget when it should close\n * and remove itself from the widget hierarchy.\n */\n Msg.CloseRequest = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.ConflatableMessage('close-request');\n })(Msg = Widget.Msg || (Widget.Msg = {}));\n /**\n * A message class for child related messages.\n */\n var ChildMessage = /** @class */ (function (_super) {\n __extends(ChildMessage, _super);\n /**\n * Construct a new child message.\n *\n * @param type - The message type.\n *\n * @param child - The child widget for the message.\n */\n function ChildMessage(type, child) {\n var _this = _super.call(this, type) || this;\n _this.child = child;\n return _this;\n }\n return ChildMessage;\n }(_lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message));\n Widget.ChildMessage = ChildMessage;\n /**\n * A message class for `'resize'` messages.\n */\n var ResizeMessage = /** @class */ (function (_super) {\n __extends(ResizeMessage, _super);\n /**\n * Construct a new resize message.\n *\n * @param width - The **offset width** of the widget, or `-1` if\n * the width is not known.\n *\n * @param height - The **offset height** of the widget, or `-1` if\n * the height is not known.\n */\n function ResizeMessage(width, height) {\n var _this = _super.call(this, 'resize') || this;\n _this.width = width;\n _this.height = height;\n return _this;\n }\n return ResizeMessage;\n }(_lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.Message));\n Widget.ResizeMessage = ResizeMessage;\n /**\n * The namespace for the `ResizeMessage` class statics.\n */\n (function (ResizeMessage) {\n /**\n * A singleton `'resize'` message with an unknown size.\n */\n ResizeMessage.UnknownSize = new ResizeMessage(-1, -1);\n })(ResizeMessage = Widget.ResizeMessage || (Widget.ResizeMessage = {}));\n /**\n * Attach a widget to a host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * @param host - The DOM node to use as the widget's host.\n *\n * @param ref - The child of `host` to use as the reference element.\n * If this is provided, the widget will be inserted before this\n * node in the host. The default is `null`, which will cause the\n * widget to be added as the last child of the host.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget, if\n * the widget is already attached, or if the host is not attached\n * to the DOM.\n */\n function attach(widget, host, ref) {\n if (ref === void 0) { ref = null; }\n if (widget.parent) {\n throw new Error('Cannot attach a child widget.');\n }\n if (widget.isAttached || document.body.contains(widget.node)) {\n throw new Error('Widget is already attached.');\n }\n if (!document.body.contains(host)) {\n throw new Error('Host is not attached.');\n }\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n host.insertBefore(widget.node, ref);\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n Widget.attach = attach;\n /**\n * Detach the widget from its host DOM node.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will throw an error if the widget is not a root widget,\n * or if the widget is not attached to the DOM.\n */\n function detach(widget) {\n if (widget.parent) {\n throw new Error('Cannot detach a child widget.');\n }\n if (!widget.isAttached || !document.body.contains(widget.node)) {\n throw new Error('Widget is not attached.');\n }\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n widget.node.parentNode.removeChild(widget.node);\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n Widget.detach = detach;\n})(Widget || (Widget = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * An attached property for the widget title object.\n */\n Private.titleProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty({\n name: 'title',\n create: function (owner) { return new Title({ owner: owner }); },\n });\n /**\n * Create a DOM node for the given widget options.\n */\n function createNode(options) {\n return options.node || document.createElement(options.tag || 'div');\n }\n Private.createNode = createNode;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n/**\n * An abstract base class for creating lumino layouts.\n *\n * #### Notes\n * A layout is used to add widgets to a parent and to arrange those\n * widgets within the parent's DOM node.\n *\n * This class implements the base functionality which is required of\n * nearly all layouts. It must be subclassed in order to be useful.\n *\n * Notably, this class does not define a uniform interface for adding\n * widgets to the layout. A subclass should define that API in a way\n * which is meaningful for its intended use.\n */\nvar Layout = /** @class */ (function () {\n /**\n * Construct a new layout.\n *\n * @param options - The options for initializing the layout.\n */\n function Layout(options) {\n if (options === void 0) { options = {}; }\n this._disposed = false;\n this._parent = null;\n this._fitPolicy = options.fitPolicy || 'set-min-size';\n }\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This should be reimplemented to clear and dispose of the widgets.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n Layout.prototype.dispose = function () {\n this._parent = null;\n this._disposed = true;\n _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal.clearData(this);\n _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty.clearData(this);\n };\n Object.defineProperty(Layout.prototype, \"isDisposed\", {\n /**\n * Test whether the layout is disposed.\n */\n get: function () {\n return this._disposed;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Layout.prototype, \"parent\", {\n /**\n * Get the parent widget of the layout.\n */\n get: function () {\n return this._parent;\n },\n /**\n * Set the parent widget of the layout.\n *\n * #### Notes\n * This is set automatically when installing the layout on the parent\n * widget. The parent widget should not be set directly by user code.\n */\n set: function (value) {\n if (this._parent === value) {\n return;\n }\n if (this._parent) {\n throw new Error('Cannot change parent widget.');\n }\n if (value.layout !== this) {\n throw new Error('Invalid parent widget.');\n }\n this._parent = value;\n this.init();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Layout.prototype, \"fitPolicy\", {\n /**\n * Get the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n */\n get: function () {\n return this._fitPolicy;\n },\n /**\n * Set the fit policy for the layout.\n *\n * #### Notes\n * The fit policy controls the computed size constraints which are\n * applied to the parent widget by the layout.\n *\n * Some layout implementations may ignore the fit policy.\n *\n * Changing the fit policy will clear the current size constraint\n * for the parent widget and then re-fit the parent.\n */\n set: function (value) {\n // Bail if the policy does not change\n if (this._fitPolicy === value) {\n return;\n }\n // Update the internal policy.\n this._fitPolicy = value;\n // Clear the size constraints and schedule a fit of the parent.\n if (this._parent) {\n var style = this._parent.node.style;\n style.minWidth = '';\n style.minHeight = '';\n style.maxWidth = '';\n style.maxHeight = '';\n this._parent.fit();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Process a message sent to the parent widget.\n *\n * @param msg - The message sent to the parent widget.\n *\n * #### Notes\n * This method is called by the parent widget to process a message.\n *\n * Subclasses may reimplement this method as needed.\n */\n Layout.prototype.processParentMessage = function (msg) {\n switch (msg.type) {\n case 'resize':\n this.onResize(msg);\n break;\n case 'update-request':\n this.onUpdateRequest(msg);\n break;\n case 'fit-request':\n this.onFitRequest(msg);\n break;\n case 'before-show':\n this.onBeforeShow(msg);\n break;\n case 'after-show':\n this.onAfterShow(msg);\n break;\n case 'before-hide':\n this.onBeforeHide(msg);\n break;\n case 'after-hide':\n this.onAfterHide(msg);\n break;\n case 'before-attach':\n this.onBeforeAttach(msg);\n break;\n case 'after-attach':\n this.onAfterAttach(msg);\n break;\n case 'before-detach':\n this.onBeforeDetach(msg);\n break;\n case 'after-detach':\n this.onAfterDetach(msg);\n break;\n case 'child-removed':\n this.onChildRemoved(msg);\n break;\n case 'child-shown':\n this.onChildShown(msg);\n break;\n case 'child-hidden':\n this.onChildHidden(msg);\n break;\n }\n };\n /**\n * Perform layout initialization which requires the parent widget.\n *\n * #### Notes\n * This method is invoked immediately after the layout is installed\n * on the parent widget.\n *\n * The default implementation reparents all of the widgets to the\n * layout parent widget.\n *\n * Subclasses should reimplement this method and attach the child\n * widget nodes to the parent widget's node.\n */\n Layout.prototype.init = function () {\n var _this = this;\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n widget.parent = _this.parent;\n });\n };\n /**\n * A message handler invoked on a `'resize'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the specified layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onResize = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n });\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n *\n * #### Notes\n * The layout should ensure that its widgets are resized according\n * to the available layout space, and that they are sent a `'resize'`\n * message if appropriate.\n *\n * The default implementation of this method sends an `UnknownSize`\n * resize message to all widgets.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onUpdateRequest = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.ResizeMessage.UnknownSize);\n });\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onBeforeAttach = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, msg);\n });\n };\n /**\n * A message handler invoked on an `'after-attach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onAfterAttach = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, msg);\n });\n };\n /**\n * A message handler invoked on a `'before-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onBeforeDetach = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, msg);\n });\n };\n /**\n * A message handler invoked on an `'after-detach'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message\n * to all widgets. It assumes all widget nodes are attached to the\n * parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onAfterDetach = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, msg);\n });\n };\n /**\n * A message handler invoked on a `'before-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onBeforeShow = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n if (!widget.isHidden) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, msg);\n }\n });\n };\n /**\n * A message handler invoked on an `'after-show'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onAfterShow = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n if (!widget.isHidden) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, msg);\n }\n });\n };\n /**\n * A message handler invoked on a `'before-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onBeforeHide = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n if (!widget.isHidden) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, msg);\n }\n });\n };\n /**\n * A message handler invoked on an `'after-hide'` message.\n *\n * #### Notes\n * The default implementation of this method forwards the message to\n * all non-hidden widgets. It assumes all widget nodes are attached\n * to the parent widget node.\n *\n * This may be reimplemented by subclasses as needed.\n */\n Layout.prototype.onAfterHide = function (msg) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) {\n if (!widget.isHidden) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, msg);\n }\n });\n };\n /**\n * A message handler invoked on a `'child-removed'` message.\n *\n * #### Notes\n * This will remove the child widget from the layout.\n *\n * Subclasses should **not** typically reimplement this method.\n */\n Layout.prototype.onChildRemoved = function (msg) {\n this.removeWidget(msg.child);\n };\n /**\n * A message handler invoked on a `'fit-request'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Layout.prototype.onFitRequest = function (msg) { };\n /**\n * A message handler invoked on a `'child-shown'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Layout.prototype.onChildShown = function (msg) { };\n /**\n * A message handler invoked on a `'child-hidden'` message.\n *\n * #### Notes\n * The default implementation of this handler is a no-op.\n */\n Layout.prototype.onChildHidden = function (msg) { };\n return Layout;\n}());\n/**\n * The namespace for the `Layout` class statics.\n */\n(function (Layout) {\n /**\n * Get the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The horizontal alignment for the widget.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n */\n function getHorizontalAlignment(widget) {\n return Private$1.horizontalAlignmentProperty.get(widget);\n }\n Layout.getHorizontalAlignment = getHorizontalAlignment;\n /**\n * Set the horizontal alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the horizontal alignment.\n *\n * #### Notes\n * If the layout width allocated to a widget is larger than its max\n * width, the horizontal alignment controls how the widget is placed\n * within the extra horizontal space.\n *\n * If the allocated width is less than the widget's max width, the\n * horizontal alignment has no effect.\n *\n * Some layout implementations may ignore horizontal alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n function setHorizontalAlignment(widget, value) {\n Private$1.horizontalAlignmentProperty.set(widget, value);\n }\n Layout.setHorizontalAlignment = setHorizontalAlignment;\n /**\n * Get the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The vertical alignment for the widget.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n */\n function getVerticalAlignment(widget) {\n return Private$1.verticalAlignmentProperty.get(widget);\n }\n Layout.getVerticalAlignment = getVerticalAlignment;\n /**\n * Set the vertical alignment for a widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the vertical alignment.\n *\n * #### Notes\n * If the layout height allocated to a widget is larger than its max\n * height, the vertical alignment controls how the widget is placed\n * within the extra vertical space.\n *\n * If the allocated height is less than the widget's max height, the\n * vertical alignment has no effect.\n *\n * Some layout implementations may ignore vertical alignment.\n *\n * Changing the horizontal alignment will post an `update-request`\n * message to widget's parent, provided the parent has a layout\n * installed.\n */\n function setVerticalAlignment(widget, value) {\n Private$1.verticalAlignmentProperty.set(widget, value);\n }\n Layout.setVerticalAlignment = setVerticalAlignment;\n})(Layout || (Layout = {}));\n/**\n * An object which assists in the absolute layout of widgets.\n *\n * #### Notes\n * This class is useful when implementing a layout which arranges its\n * widgets using absolute positioning.\n *\n * This class is used by nearly all of the built-in lumino layouts.\n */\nvar LayoutItem = /** @class */ (function () {\n /**\n * Construct a new layout item.\n *\n * @param widget - The widget to be managed by the item.\n *\n * #### Notes\n * The widget will be set to absolute positioning.\n */\n function LayoutItem(widget) {\n this._top = NaN;\n this._left = NaN;\n this._width = NaN;\n this._height = NaN;\n this._minWidth = 0;\n this._minHeight = 0;\n this._maxWidth = Infinity;\n this._maxHeight = Infinity;\n this._disposed = false;\n this.widget = widget;\n this.widget.node.style.position = 'absolute';\n }\n /**\n * Dispose of the the layout item.\n *\n * #### Notes\n * This will reset the positioning of the widget.\n */\n LayoutItem.prototype.dispose = function () {\n // Do nothing if the item is already disposed.\n if (this._disposed) {\n return;\n }\n // Mark the item as disposed.\n this._disposed = true;\n // Reset the widget style.\n var style = this.widget.node.style;\n style.position = '';\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n };\n Object.defineProperty(LayoutItem.prototype, \"minWidth\", {\n /**\n * The computed minimum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get: function () {\n return this._minWidth;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutItem.prototype, \"minHeight\", {\n /**\n * The computed minimum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get: function () {\n return this._minHeight;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutItem.prototype, \"maxWidth\", {\n /**\n * The computed maximum width of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get: function () {\n return this._maxWidth;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutItem.prototype, \"maxHeight\", {\n /**\n * The computed maximum height of the widget.\n *\n * #### Notes\n * This value can be updated by calling the `fit` method.\n */\n get: function () {\n return this._maxHeight;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutItem.prototype, \"isDisposed\", {\n /**\n * Whether the layout item is disposed.\n */\n get: function () {\n return this._disposed;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutItem.prototype, \"isHidden\", {\n /**\n * Whether the managed widget is hidden.\n */\n get: function () {\n return this.widget.isHidden;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutItem.prototype, \"isVisible\", {\n /**\n * Whether the managed widget is visible.\n */\n get: function () {\n return this.widget.isVisible;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutItem.prototype, \"isAttached\", {\n /**\n * Whether the managed widget is attached.\n */\n get: function () {\n return this.widget.isAttached;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Update the computed size limits of the managed widget.\n */\n LayoutItem.prototype.fit = function () {\n var limits = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.sizeLimits(this.widget.node);\n this._minWidth = limits.minWidth;\n this._minHeight = limits.minHeight;\n this._maxWidth = limits.maxWidth;\n this._maxHeight = limits.maxHeight;\n };\n /**\n * Update the position and size of the managed widget.\n *\n * @param left - The left edge position of the layout box.\n *\n * @param top - The top edge position of the layout box.\n *\n * @param width - The width of the layout box.\n *\n * @param height - The height of the layout box.\n */\n LayoutItem.prototype.update = function (left, top, width, height) {\n // Clamp the size to the computed size limits.\n var clampW = Math.max(this._minWidth, Math.min(width, this._maxWidth));\n var clampH = Math.max(this._minHeight, Math.min(height, this._maxHeight));\n // Adjust the left edge for the horizontal alignment, if needed.\n if (clampW < width) {\n switch (Layout.getHorizontalAlignment(this.widget)) {\n case 'left':\n break;\n case 'center':\n left += (width - clampW) / 2;\n break;\n case 'right':\n left += width - clampW;\n break;\n default:\n throw 'unreachable';\n }\n }\n // Adjust the top edge for the vertical alignment, if needed.\n if (clampH < height) {\n switch (Layout.getVerticalAlignment(this.widget)) {\n case 'top':\n break;\n case 'center':\n top += (height - clampH) / 2;\n break;\n case 'bottom':\n top += height - clampH;\n break;\n default:\n throw 'unreachable';\n }\n }\n // Set up the resize variables.\n var resized = false;\n var style = this.widget.node.style;\n // Update the top edge of the widget if needed.\n if (this._top !== top) {\n this._top = top;\n style.top = top + \"px\";\n }\n // Update the left edge of the widget if needed.\n if (this._left !== left) {\n this._left = left;\n style.left = left + \"px\";\n }\n // Update the width of the widget if needed.\n if (this._width !== clampW) {\n resized = true;\n this._width = clampW;\n style.width = clampW + \"px\";\n }\n // Update the height of the widget if needed.\n if (this._height !== clampH) {\n resized = true;\n this._height = clampH;\n style.height = clampH + \"px\";\n }\n // Send a resize message to the widget if needed.\n if (resized) {\n var msg = new Widget.ResizeMessage(clampW, clampH);\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.widget, msg);\n }\n };\n return LayoutItem;\n}());\n/**\n * The namespace for the module implementation details.\n */\nvar Private$1;\n(function (Private) {\n /**\n * The attached property for a widget horizontal alignment.\n */\n Private.horizontalAlignmentProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty({\n name: 'horizontalAlignment',\n create: function () { return 'center'; },\n changed: onAlignmentChanged\n });\n /**\n * The attached property for a widget vertical alignment.\n */\n Private.verticalAlignmentProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty({\n name: 'verticalAlignment',\n create: function () { return 'top'; },\n changed: onAlignmentChanged\n });\n /**\n * The change handler for the attached alignment properties.\n */\n function onAlignmentChanged(child) {\n if (child.parent && child.parent.layout) {\n child.parent.update();\n }\n }\n})(Private$1 || (Private$1 = {}));\n\n/**\n * A concrete layout implementation suitable for many use cases.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * layouts, but can also be used directly with standard CSS to layout a\n * collection of widgets.\n */\nvar PanelLayout = /** @class */ (function (_super) {\n __extends(PanelLayout, _super);\n function PanelLayout() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._widgets = [];\n return _this;\n }\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n *\n * All reimplementations should call the superclass method.\n *\n * This method is called automatically when the parent is disposed.\n */\n PanelLayout.prototype.dispose = function () {\n while (this._widgets.length > 0) {\n this._widgets.pop().dispose();\n }\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(PanelLayout.prototype, \"widgets\", {\n /**\n * A read-only array of the widgets in the layout.\n */\n get: function () {\n return this._widgets;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n PanelLayout.prototype.iter = function () {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.iter)(this._widgets);\n };\n /**\n * Add a widget to the end of the layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, it will be moved.\n */\n PanelLayout.prototype.addWidget = function (widget) {\n this.insertWidget(this._widgets.length, widget);\n };\n /**\n * Insert a widget into the layout at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into the layout.\n *\n * #### Notes\n * The index will be clamped to the bounds of the widgets.\n *\n * If the widget is already added to the layout, it will be moved.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n PanelLayout.prototype.insertWidget = function (index, widget) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n widget.parent = this.parent;\n // Look up the current index of the widget.\n var i = this._widgets.indexOf(widget);\n // Clamp the insert index to the array bounds.\n var j = Math.max(0, Math.min(index, this._widgets.length));\n // If the widget is not in the array, insert it.\n if (i === -1) {\n // Insert the widget into the array.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._widgets, j, widget);\n // If the layout is parented, attach the widget to the DOM.\n if (this.parent) {\n this.attachWidget(j, widget);\n }\n // There is nothing more to do.\n return;\n }\n // Otherwise, the widget exists in the array and should be moved.\n // Adjust the index if the location is at the end of the array.\n if (j === this._widgets.length) {\n j--;\n }\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n // Move the widget to the new location.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._widgets, i, j);\n // If the layout is parented, move the widget in the DOM.\n if (this.parent) {\n this.moveWidget(i, j, widget);\n }\n };\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n PanelLayout.prototype.removeWidget = function (widget) {\n this.removeWidgetAt(this._widgets.indexOf(widget));\n };\n /**\n * Remove the widget at a given index from the layout.\n *\n * @param index - The index of the widget to remove.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n PanelLayout.prototype.removeWidgetAt = function (index) {\n // Remove the widget from the array.\n var widget = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._widgets, index);\n // If the layout is parented, detach the widget from the DOM.\n if (widget && this.parent) {\n this.detachWidget(index, widget);\n }\n };\n /**\n * Perform layout initialization which requires the parent widget.\n */\n PanelLayout.prototype.init = function () {\n var _this = this;\n _super.prototype.init.call(this);\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget, index) {\n _this.attachWidget(index, widget);\n });\n };\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n PanelLayout.prototype.attachWidget = function (index, widget) {\n // Look up the next sibling reference node.\n var ref = this.parent.node.children[index];\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n // Insert the widget's node before the sibling.\n this.parent.node.insertBefore(widget.node, ref);\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n };\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation moves the widget's node to the proper\n * location in the parent's node and sends the appropriate attach and\n * detach messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is moved in the parent's node.\n */\n PanelLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n // Remove the widget's node from the parent.\n this.parent.node.removeChild(widget.node);\n // Send an `'after-detach'` and message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n // Look up the next sibling reference node.\n var ref = this.parent.node.children[toIndex];\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n // Insert the widget's node before the sibling.\n this.parent.node.insertBefore(widget.node, ref);\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n };\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the panel layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n PanelLayout.prototype.detachWidget = function (index, widget) {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n // Remove the widget's node from the parent.\n this.parent.node.removeChild(widget.node);\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n };\n return PanelLayout;\n}(Layout));\n\n/**\n * A layout which arranges its widgets in a single row or column.\n */\nvar BoxLayout = /** @class */ (function (_super) {\n __extends(BoxLayout, _super);\n /**\n * Construct a new box layout.\n *\n * @param options - The options for initializing the layout.\n */\n function BoxLayout(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this) || this;\n _this._fixed = 0;\n _this._spacing = 4;\n _this._dirty = false;\n _this._sizers = [];\n _this._items = [];\n _this._box = null;\n _this._alignment = 'start';\n _this._direction = 'top-to-bottom';\n if (options.direction !== undefined) {\n _this._direction = options.direction;\n }\n if (options.alignment !== undefined) {\n _this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n _this._spacing = Private$2.clampSpacing(options.spacing);\n }\n return _this;\n }\n /**\n * Dispose of the resources held by the layout.\n */\n BoxLayout.prototype.dispose = function () {\n // Dispose of the layout items.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this._items, function (item) { item.dispose(); });\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n // Dispose of the rest of the layout.\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(BoxLayout.prototype, \"direction\", {\n /**\n * Get the layout direction for the box layout.\n */\n get: function () {\n return this._direction;\n },\n /**\n * Set the layout direction for the box layout.\n */\n set: function (value) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['direction'] = value;\n this.parent.fit();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BoxLayout.prototype, \"alignment\", {\n /**\n * Get the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get: function () {\n return this._alignment;\n },\n /**\n * Set the content alignment for the box layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set: function (value) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BoxLayout.prototype, \"spacing\", {\n /**\n * Get the inter-element spacing for the box layout.\n */\n get: function () {\n return this._spacing;\n },\n /**\n * Set the inter-element spacing for the box layout.\n */\n set: function (value) {\n value = Private$2.clampSpacing(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Perform layout initialization which requires the parent widget.\n */\n BoxLayout.prototype.init = function () {\n this.parent.dataset['direction'] = this.direction;\n this.parent.dataset['alignment'] = this.alignment;\n _super.prototype.init.call(this);\n };\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n BoxLayout.prototype.attachWidget = function (index, widget) {\n // Create and add a new layout item for the widget.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._items, index, new LayoutItem(widget));\n // Create and add a new sizer for the widget.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._sizers, index, new BoxSizer());\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n // Add the widget's node to the parent.\n this.parent.node.appendChild(widget.node);\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n BoxLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {\n // Move the layout item for the widget.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._items, fromIndex, toIndex);\n // Move the sizer for the widget.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._sizers, fromIndex, toIndex);\n // Post an update request for the parent widget.\n this.parent.update();\n };\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n BoxLayout.prototype.detachWidget = function (index, widget) {\n // Remove the layout item for the widget.\n var item = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._items, index);\n // Remove the sizer for the widget.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._sizers, index);\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n // Remove the widget's node from the parent.\n this.parent.node.removeChild(widget.node);\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n // Dispose of the layout item.\n item.dispose();\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n BoxLayout.prototype.onBeforeShow = function (msg) {\n _super.prototype.onBeforeShow.call(this, msg);\n this.parent.update();\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n BoxLayout.prototype.onBeforeAttach = function (msg) {\n _super.prototype.onBeforeAttach.call(this, msg);\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n BoxLayout.prototype.onChildShown = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n BoxLayout.prototype.onChildHidden = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'resize'` message.\n */\n BoxLayout.prototype.onResize = function (msg) {\n if (this.parent.isVisible) {\n this._update(msg.width, msg.height);\n }\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n BoxLayout.prototype.onUpdateRequest = function (msg) {\n if (this.parent.isVisible) {\n this._update(-1, -1);\n }\n };\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n BoxLayout.prototype.onFitRequest = function (msg) {\n if (this.parent.isAttached) {\n this._fit();\n }\n };\n /**\n * Fit the layout to the total size required by the widgets.\n */\n BoxLayout.prototype._fit = function () {\n // Compute the visible item count.\n var nVisible = 0;\n for (var i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n // Setup the computed minimum size.\n var horz = Private$2.isHorizontal(this._direction);\n var minW = horz ? this._fixed : 0;\n var minH = horz ? 0 : this._fixed;\n // Update the sizers and computed minimum size.\n for (var i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n var item = this._items[i];\n var sizer = this._sizers[i];\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n // Update the size limits for the item.\n item.fit();\n // Update the size basis and stretch factor.\n sizer.sizeHint = BoxLayout.getSizeBasis(item.widget);\n sizer.stretch = BoxLayout.getStretch(item.widget);\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n }\n else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n // Update the box sizing and add it to the computed min size.\n var box = this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n minW += box.horizontalSum;\n minH += box.verticalSum;\n // Update the parent's min size constraints.\n var style = this.parent.node.style;\n style.minWidth = minW + \"px\";\n style.minHeight = minH + \"px\";\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent.parent) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest);\n }\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);\n }\n };\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n BoxLayout.prototype._update = function (offsetWidth, offsetHeight) {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n // Compute the visible item count.\n var nVisible = 0;\n for (var i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent.node.offsetHeight;\n }\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n }\n // Compute the layout area adjusted for border and padding.\n var top = this._box.paddingTop;\n var left = this._box.paddingLeft;\n var width = offsetWidth - this._box.horizontalSum;\n var height = offsetHeight - this._box.verticalSum;\n // Distribute the layout space and adjust the start position.\n var delta;\n switch (this._direction) {\n case 'left-to-right':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n break;\n case 'top-to-bottom':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n break;\n case 'right-to-left':\n delta = BoxEngine.calc(this._sizers, Math.max(0, width - this._fixed));\n left += width;\n break;\n case 'bottom-to-top':\n delta = BoxEngine.calc(this._sizers, Math.max(0, height - this._fixed));\n top += height;\n break;\n default:\n throw 'unreachable';\n }\n // Setup the variables for justification and alignment offset.\n var extra = 0;\n var offset = 0;\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n // Layout the items using the computed box sizes.\n for (var i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n var item = this._items[i];\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n // Fetch the computed size for the widget.\n var size = this._sizers[i].size;\n // Update the widget geometry and advance the relevant edge.\n switch (this._direction) {\n case 'left-to-right':\n item.update(left + offset, top, size + extra, height);\n left += size + extra + this._spacing;\n break;\n case 'top-to-bottom':\n item.update(left, top + offset, width, size + extra);\n top += size + extra + this._spacing;\n break;\n case 'right-to-left':\n item.update(left - offset - size - extra, top, size + extra, height);\n left -= size + extra + this._spacing;\n break;\n case 'bottom-to-top':\n item.update(left, top - offset - size - extra, width, size + extra);\n top -= size + extra + this._spacing;\n break;\n default:\n throw 'unreachable';\n }\n }\n };\n return BoxLayout;\n}(PanelLayout));\n/**\n * The namespace for the `BoxLayout` class statics.\n */\n(function (BoxLayout) {\n /**\n * Get the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout stretch factor for the widget.\n */\n function getStretch(widget) {\n return Private$2.stretchProperty.get(widget);\n }\n BoxLayout.getStretch = getStretch;\n /**\n * Set the box layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n function setStretch(widget, value) {\n Private$2.stretchProperty.set(widget, value);\n }\n BoxLayout.setStretch = setStretch;\n /**\n * Get the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box layout size basis for the widget.\n */\n function getSizeBasis(widget) {\n return Private$2.sizeBasisProperty.get(widget);\n }\n BoxLayout.getSizeBasis = getSizeBasis;\n /**\n * Set the box layout size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n function setSizeBasis(widget, value) {\n Private$2.sizeBasisProperty.set(widget, value);\n }\n BoxLayout.setSizeBasis = setSizeBasis;\n})(BoxLayout || (BoxLayout = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$2;\n(function (Private) {\n /**\n * The property descriptor for a widget stretch factor.\n */\n Private.stretchProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty({\n name: 'stretch',\n create: function () { return 0; },\n coerce: function (owner, value) { return Math.max(0, Math.floor(value)); },\n changed: onChildSizingChanged\n });\n /**\n * The property descriptor for a widget size basis.\n */\n Private.sizeBasisProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty({\n name: 'sizeBasis',\n create: function () { return 0; },\n coerce: function (owner, value) { return Math.max(0, Math.floor(value)); },\n changed: onChildSizingChanged\n });\n /**\n * Test whether a direction has horizontal orientation.\n */\n function isHorizontal(dir) {\n return dir === 'left-to-right' || dir === 'right-to-left';\n }\n Private.isHorizontal = isHorizontal;\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n function clampSpacing(value) {\n return Math.max(0, Math.floor(value));\n }\n Private.clampSpacing = clampSpacing;\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child) {\n if (child.parent && child.parent.layout instanceof BoxLayout) {\n child.parent.fit();\n }\n }\n})(Private$2 || (Private$2 = {}));\n\n/**\n * A simple and convenient panel widget class.\n *\n * #### Notes\n * This class is suitable as a base class for implementing a variety of\n * convenience panel widgets, but can also be used directly with CSS to\n * arrange a collection of widgets.\n *\n * This class provides a convenience wrapper around a [[PanelLayout]].\n */\nvar Panel = /** @class */ (function (_super) {\n __extends(Panel, _super);\n /**\n * Construct a new panel.\n *\n * @param options - The options for initializing the panel.\n */\n function Panel(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this) || this;\n _this.addClass('lm-Panel');\n /* <DEPRECATED> */\n _this.addClass('p-Panel');\n /* </DEPRECATED> */\n _this.layout = Private$3.createLayout(options);\n return _this;\n }\n Object.defineProperty(Panel.prototype, \"widgets\", {\n /**\n * A read-only array of the widgets in the panel.\n */\n get: function () {\n return this.layout.widgets;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add a widget to the end of the panel.\n *\n * @param widget - The widget to add to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n Panel.prototype.addWidget = function (widget) {\n this.layout.addWidget(widget);\n };\n /**\n * Insert a widget at the specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n */\n Panel.prototype.insertWidget = function (index, widget) {\n this.layout.insertWidget(index, widget);\n };\n return Panel;\n}(Widget));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$3;\n(function (Private) {\n /**\n * Create a panel layout for the given panel options.\n */\n function createLayout(options) {\n return options.layout || new PanelLayout();\n }\n Private.createLayout = createLayout;\n})(Private$3 || (Private$3 = {}));\n\n/**\n * A panel which arranges its widgets in a single row or column.\n *\n * #### Notes\n * This class provides a convenience wrapper around a [[BoxLayout]].\n */\nvar BoxPanel = /** @class */ (function (_super) {\n __extends(BoxPanel, _super);\n /**\n * Construct a new box panel.\n *\n * @param options - The options for initializing the box panel.\n */\n function BoxPanel(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, { layout: Private$4.createLayout(options) }) || this;\n _this.addClass('lm-BoxPanel');\n /* <DEPRECATED> */\n _this.addClass('p-BoxPanel');\n return _this;\n /* </DEPRECATED> */\n }\n Object.defineProperty(BoxPanel.prototype, \"direction\", {\n /**\n * Get the layout direction for the box panel.\n */\n get: function () {\n return this.layout.direction;\n },\n /**\n * Set the layout direction for the box panel.\n */\n set: function (value) {\n this.layout.direction = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BoxPanel.prototype, \"alignment\", {\n /**\n * Get the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n get: function () {\n return this.layout.alignment;\n },\n /**\n * Set the content alignment for the box panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire box layout.\n */\n set: function (value) {\n this.layout.alignment = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BoxPanel.prototype, \"spacing\", {\n /**\n * Get the inter-element spacing for the box panel.\n */\n get: function () {\n return this.layout.spacing;\n },\n /**\n * Set the inter-element spacing for the box panel.\n */\n set: function (value) {\n this.layout.spacing = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n BoxPanel.prototype.onChildAdded = function (msg) {\n msg.child.addClass('lm-BoxPanel-child');\n /* <DEPRECATED> */\n msg.child.addClass('p-BoxPanel-child');\n /* </DEPRECATED> */\n };\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n BoxPanel.prototype.onChildRemoved = function (msg) {\n msg.child.removeClass('lm-BoxPanel-child');\n /* <DEPRECATED> */\n msg.child.removeClass('p-BoxPanel-child');\n /* </DEPRECATED> */\n };\n return BoxPanel;\n}(Panel));\n/**\n * The namespace for the `BoxPanel` class statics.\n */\n(function (BoxPanel) {\n /**\n * Get the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel stretch factor for the widget.\n */\n function getStretch(widget) {\n return BoxLayout.getStretch(widget);\n }\n BoxPanel.getStretch = getStretch;\n /**\n * Set the box panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n function setStretch(widget, value) {\n BoxLayout.setStretch(widget, value);\n }\n BoxPanel.setStretch = setStretch;\n /**\n * Get the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The box panel size basis for the widget.\n */\n function getSizeBasis(widget) {\n return BoxLayout.getSizeBasis(widget);\n }\n BoxPanel.getSizeBasis = getSizeBasis;\n /**\n * Set the box panel size basis for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the size basis.\n */\n function setSizeBasis(widget, value) {\n BoxLayout.setSizeBasis(widget, value);\n }\n BoxPanel.setSizeBasis = setSizeBasis;\n})(BoxPanel || (BoxPanel = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$4;\n(function (Private) {\n /**\n * Create a box layout for the given panel options.\n */\n function createLayout(options) {\n return options.layout || new BoxLayout(options);\n }\n Private.createLayout = createLayout;\n})(Private$4 || (Private$4 = {}));\n\n/**\n * A widget which displays command items as a searchable palette.\n */\nvar CommandPalette = /** @class */ (function (_super) {\n __extends(CommandPalette, _super);\n /**\n * Construct a new command palette.\n *\n * @param options - The options for initializing the palette.\n */\n function CommandPalette(options) {\n var _this = _super.call(this, { node: Private$5.createNode() }) || this;\n _this._activeIndex = -1;\n _this._items = [];\n _this._results = null;\n _this.addClass('lm-CommandPalette');\n /* <DEPRECATED> */\n _this.addClass('p-CommandPalette');\n /* </DEPRECATED> */\n _this.setFlag(Widget.Flag.DisallowLayout);\n _this.commands = options.commands;\n _this.renderer = options.renderer || CommandPalette.defaultRenderer;\n _this.commands.commandChanged.connect(_this._onGenericChange, _this);\n _this.commands.keyBindingChanged.connect(_this._onGenericChange, _this);\n return _this;\n }\n /**\n * Dispose of the resources held by the widget.\n */\n CommandPalette.prototype.dispose = function () {\n this._items.length = 0;\n this._results = null;\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(CommandPalette.prototype, \"searchNode\", {\n /**\n * The command palette search node.\n *\n * #### Notes\n * This is the node which contains the search-related elements.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-CommandPalette-search')[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandPalette.prototype, \"inputNode\", {\n /**\n * The command palette input node.\n *\n * #### Notes\n * This is the actual input node for the search area.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-CommandPalette-input')[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandPalette.prototype, \"contentNode\", {\n /**\n * The command palette content node.\n *\n * #### Notes\n * This is the node which holds the command item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-CommandPalette-content')[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandPalette.prototype, \"items\", {\n /**\n * A read-only array of the command items in the palette.\n */\n get: function () {\n return this._items;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add a command item to the command palette.\n *\n * @param options - The options for creating the command item.\n *\n * @returns The command item added to the palette.\n */\n CommandPalette.prototype.addItem = function (options) {\n // Create a new command item for the options.\n var item = Private$5.createItem(this.commands, options);\n // Add the item to the array.\n this._items.push(item);\n // Refresh the search results.\n this.refresh();\n // Return the item added to the palette.\n return item;\n };\n /**\n * Adds command items to the command palette.\n *\n * @param items - An array of options for creating each command item.\n *\n * @returns The command items added to the palette.\n */\n CommandPalette.prototype.addItems = function (items) {\n var _this = this;\n var newItems = items.map(function (item) { return Private$5.createItem(_this.commands, item); });\n newItems.forEach(function (item) { return _this._items.push(item); });\n this.refresh();\n return newItems;\n };\n /**\n * Remove an item from the command palette.\n *\n * @param item - The item to remove from the palette.\n *\n * #### Notes\n * This is a no-op if the item is not in the palette.\n */\n CommandPalette.prototype.removeItem = function (item) {\n this.removeItemAt(this._items.indexOf(item));\n };\n /**\n * Remove the item at a given index from the command palette.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n CommandPalette.prototype.removeItemAt = function (index) {\n // Remove the item from the array.\n var item = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._items, index);\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n // Refresh the search results.\n this.refresh();\n };\n /**\n * Remove all items from the command palette.\n */\n CommandPalette.prototype.clearItems = function () {\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n // Clear the array of items.\n this._items.length = 0;\n // Refresh the search results.\n this.refresh();\n };\n /**\n * Clear the search results and schedule an update.\n *\n * #### Notes\n * This should be called whenever the search results of the palette\n * should be updated.\n *\n * This is typically called automatically by the palette as needed,\n * but can be called manually if the input text is programatically\n * changed.\n *\n * The rendered results are updated asynchronously.\n */\n CommandPalette.prototype.refresh = function () {\n this._results = null;\n if (this.inputNode.value !== '') {\n var clear = this.node.getElementsByClassName('lm-close-icon')[0];\n clear.style.display = 'inherit';\n }\n else {\n var clear = this.node.getElementsByClassName('lm-close-icon')[0];\n clear.style.display = 'none';\n }\n this.update();\n };\n /**\n * Handle the DOM events for the command palette.\n *\n * @param event - The DOM event sent to the command palette.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the command palette's DOM node.\n * It should not be called directly by user code.\n */\n CommandPalette.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'click':\n this._evtClick(event);\n break;\n case 'keydown':\n this._evtKeyDown(event);\n break;\n case 'input':\n this.refresh();\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n }\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n CommandPalette.prototype.onBeforeAttach = function (msg) {\n this.node.addEventListener('click', this);\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('input', this);\n this.node.addEventListener('focus', this, true);\n this.node.addEventListener('blur', this, true);\n };\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n CommandPalette.prototype.onAfterDetach = function (msg) {\n this.node.removeEventListener('click', this);\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('input', this);\n this.node.removeEventListener('focus', this, true);\n this.node.removeEventListener('blur', this, true);\n };\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n CommandPalette.prototype.onActivateRequest = function (msg) {\n if (this.isAttached) {\n var input = this.inputNode;\n input.focus();\n input.select();\n }\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n CommandPalette.prototype.onUpdateRequest = function (msg) {\n // Fetch the current query text and content node.\n var query = this.inputNode.value;\n var contentNode = this.contentNode;\n // Ensure the search results are generated.\n var results = this._results;\n if (!results) {\n // Generate and store the new search results.\n results = this._results = Private$5.search(this._items, query);\n // Reset the active index.\n this._activeIndex = (query ? _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(results, Private$5.canActivate) : -1);\n }\n // If there is no query and no results, clear the content.\n if (!query && results.length === 0) {\n _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.VirtualDOM.render(null, contentNode);\n return;\n }\n // If the is a query but no results, render the empty message.\n if (query && results.length === 0) {\n var content_1 = this.renderer.renderEmptyMessage({ query: query });\n _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.VirtualDOM.render(content_1, contentNode);\n return;\n }\n // Create the render content for the search results.\n var renderer = this.renderer;\n var activeIndex = this._activeIndex;\n var content = new Array(results.length);\n for (var i = 0, n = results.length; i < n; ++i) {\n var result = results[i];\n if (result.type === 'header') {\n var indices = result.indices;\n var category = result.category;\n content[i] = renderer.renderHeader({ category: category, indices: indices });\n }\n else {\n var item = result.item;\n var indices = result.indices;\n var active = i === activeIndex;\n content[i] = renderer.renderItem({ item: item, indices: indices, active: active });\n }\n }\n // Render the search result content.\n _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.VirtualDOM.render(content, contentNode);\n // Adjust the scroll position as needed.\n if (activeIndex < 0 || activeIndex >= results.length) {\n contentNode.scrollTop = 0;\n }\n else {\n var element = contentNode.children[activeIndex];\n _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.scrollIntoViewIfNeeded(contentNode, element);\n }\n };\n /**\n * Handle the `'click'` event for the command palette.\n */\n CommandPalette.prototype._evtClick = function (event) {\n // Bail if the click is not the left button.\n if (event.button !== 0) {\n return;\n }\n // Clear input if the target is clear button\n if (event.target.classList.contains(\"lm-close-icon\")) {\n this.inputNode.value = '';\n this.refresh();\n return;\n }\n // Find the index of the item which was clicked.\n var index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(this.contentNode.children, function (node) {\n return node.contains(event.target);\n });\n // Bail if the click was not on an item.\n if (index === -1) {\n return;\n }\n // Kill the event when a content item is clicked.\n event.preventDefault();\n event.stopPropagation();\n // Execute the item if possible.\n this._execute(index);\n };\n /**\n * Handle the `'keydown'` event for the command palette.\n */\n CommandPalette.prototype._evtKeyDown = function (event) {\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {\n return;\n }\n switch (event.keyCode) {\n case 13: // Enter\n event.preventDefault();\n event.stopPropagation();\n this._execute(this._activeIndex);\n break;\n case 38: // Up Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activatePreviousItem();\n break;\n case 40: // Down Arrow\n event.preventDefault();\n event.stopPropagation();\n this._activateNextItem();\n break;\n }\n };\n /**\n * Activate the next enabled command item.\n */\n CommandPalette.prototype._activateNextItem = function () {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n // Find the next enabled item index.\n var ai = this._activeIndex;\n var n = this._results.length;\n var start = ai < n - 1 ? ai + 1 : 0;\n var stop = start === 0 ? n - 1 : start - 1;\n this._activeIndex = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(this._results, Private$5.canActivate, start, stop);\n // Schedule an update of the items.\n this.update();\n };\n /**\n * Activate the previous enabled command item.\n */\n CommandPalette.prototype._activatePreviousItem = function () {\n // Bail if there are no search results.\n if (!this._results || this._results.length === 0) {\n return;\n }\n // Find the previous enabled item index.\n var ai = this._activeIndex;\n var n = this._results.length;\n var start = ai <= 0 ? n - 1 : ai - 1;\n var stop = start === n - 1 ? 0 : start + 1;\n this._activeIndex = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findLastIndex(this._results, Private$5.canActivate, start, stop);\n // Schedule an update of the items.\n this.update();\n };\n /**\n * Execute the command item at the given index, if possible.\n */\n CommandPalette.prototype._execute = function (index) {\n // Bail if there are no search results.\n if (!this._results) {\n return;\n }\n // Bail if the index is out of range.\n var part = this._results[index];\n if (!part) {\n return;\n }\n // Update the search text if the item is a header.\n if (part.type === 'header') {\n var input = this.inputNode;\n input.value = part.category.toLowerCase() + \" \";\n input.focus();\n this.refresh();\n return;\n }\n // Bail if item is not enabled.\n if (!part.item.isEnabled) {\n return;\n }\n // Execute the item.\n this.commands.execute(part.item.command, part.item.args);\n // Clear the query text.\n this.inputNode.value = '';\n // Refresh the search results.\n this.refresh();\n };\n /**\n * Toggle the focused modifier based on the input node focus state.\n */\n CommandPalette.prototype._toggleFocused = function () {\n var focused = document.activeElement === this.inputNode;\n this.toggleClass('lm-mod-focused', focused);\n /* <DEPRECATED> */\n this.toggleClass('p-mod-focused', focused);\n /* </DEPRECATED> */\n };\n /**\n * A signal handler for generic command changes.\n */\n CommandPalette.prototype._onGenericChange = function () {\n this.refresh();\n };\n return CommandPalette;\n}(Widget));\n/**\n * The namespace for the `CommandPalette` class statics.\n */\n(function (CommandPalette) {\n /**\n * The default implementation of `IRenderer`.\n */\n var Renderer = /** @class */ (function () {\n function Renderer() {\n }\n /**\n * Render the virtual element for a command palette header.\n *\n * @param data - The data to use for rendering the header.\n *\n * @returns A virtual element representing the header.\n */\n Renderer.prototype.renderHeader = function (data) {\n var content = this.formatHeader(data);\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.li({ className: 'lm-CommandPalette-header'\n /* <DEPRECATED> */\n + ' p-CommandPalette-header'\n /* </DEPRECATED> */\n }, content);\n };\n /**\n * Render the virtual element for a command palette item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n Renderer.prototype.renderItem = function (data) {\n var className = this.createItemClass(data);\n var dataset = this.createItemDataset(data);\n if (data.item.isToggleable) {\n return (_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.li({\n className: className,\n dataset: dataset,\n role: 'checkbox',\n 'aria-checked': \"\" + data.item.isToggled\n }, this.renderItemIcon(data), this.renderItemContent(data), this.renderItemShortcut(data)));\n }\n return (_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.li({\n className: className,\n dataset: dataset\n }, this.renderItemIcon(data), this.renderItemContent(data), this.renderItemShortcut(data)));\n };\n /**\n * Render the empty results message for a command palette.\n *\n * @param data - The data to use for rendering the message.\n *\n * @returns A virtual element representing the message.\n */\n Renderer.prototype.renderEmptyMessage = function (data) {\n var content = this.formatEmptyMessage(data);\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.li({\n className: 'lm-CommandPalette-emptyMessage'\n /* <DEPRECATED> */\n + ' p-CommandPalette-emptyMessage'\n /* </DEPRECATED> */\n }, content);\n };\n /**\n * Render the icon for a command palette item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the icon.\n */\n Renderer.prototype.renderItemIcon = function (data) {\n var className = this.createIconClass(data);\n /* <DEPRECATED> */\n if (typeof data.item.icon === 'string') {\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: className }, data.item.iconLabel);\n }\n /* </DEPRECATED> */\n // if data.item.icon is undefined, it will be ignored\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: className }, data.item.icon, data.item.iconLabel);\n };\n /**\n * Render the content for a command palette item.\n *\n * @param data - The data to use for rendering the content.\n *\n * @returns A virtual element representing the content.\n */\n Renderer.prototype.renderItemContent = function (data) {\n return (_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-CommandPalette-itemContent'\n /* <DEPRECATED> */\n + ' p-CommandPalette-itemContent'\n /* </DEPRECATED> */\n }, this.renderItemLabel(data), this.renderItemCaption(data)));\n };\n /**\n * Render the label for a command palette item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the label.\n */\n Renderer.prototype.renderItemLabel = function (data) {\n var content = this.formatItemLabel(data);\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-CommandPalette-itemLabel'\n /* <DEPRECATED> */\n + ' p-CommandPalette-itemLabel'\n /* </DEPRECATED> */\n }, content);\n };\n /**\n * Render the caption for a command palette item.\n *\n * @param data - The data to use for rendering the caption.\n *\n * @returns A virtual element representing the caption.\n */\n Renderer.prototype.renderItemCaption = function (data) {\n var content = this.formatItemCaption(data);\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-CommandPalette-itemCaption'\n /* <DEPRECATED> */\n + ' p-CommandPalette-itemCaption'\n /* </DEPRECATED> */\n }, content);\n };\n /**\n * Render the shortcut for a command palette item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the shortcut.\n */\n Renderer.prototype.renderItemShortcut = function (data) {\n var content = this.formatItemShortcut(data);\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-CommandPalette-itemShortcut'\n /* <DEPRECATED> */\n + ' p-CommandPalette-itemShortcut'\n /* </DEPRECATED> */\n }, content);\n };\n /**\n * Create the class name for the command palette item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the command palette item.\n */\n Renderer.prototype.createItemClass = function (data) {\n // Set up the initial class name.\n var name = 'lm-CommandPalette-item';\n /* <DEPRECATED> */\n name += ' p-CommandPalette-item';\n /* </DEPRECATED> */\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n /* <DEPRECATED> */\n name += ' p-mod-disabled';\n /* </DEPRECATED> */\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n /* <DEPRECATED> */\n name += ' p-mod-toggled';\n /* </DEPRECATED> */\n }\n if (data.active) {\n name += ' lm-mod-active';\n /* <DEPRECATED> */\n name += ' p-mod-active';\n /* </DEPRECATED> */\n }\n // Add the extra class.\n var extra = data.item.className;\n if (extra) {\n name += \" \" + extra;\n }\n // Return the complete class name.\n return name;\n };\n /**\n * Create the dataset for the command palette item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the command palette item.\n */\n Renderer.prototype.createItemDataset = function (data) {\n return __assign(__assign({}, data.item.dataset), { command: data.item.command });\n };\n /**\n * Create the class name for the command item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n Renderer.prototype.createIconClass = function (data) {\n var name = 'lm-CommandPalette-itemIcon';\n /* <DEPRECATED> */\n name += ' p-CommandPalette-itemIcon';\n /* </DEPRECATED> */\n var extra = data.item.iconClass;\n return extra ? name + \" \" + extra : name;\n };\n /**\n * Create the render content for the header node.\n *\n * @param data - The data to use for the header content.\n *\n * @returns The content to add to the header node.\n */\n Renderer.prototype.formatHeader = function (data) {\n if (!data.indices || data.indices.length === 0) {\n return data.category;\n }\n return _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.StringExt.highlight(data.category, data.indices, _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.mark);\n };\n /**\n * Create the render content for the empty message node.\n *\n * @param data - The data to use for the empty message content.\n *\n * @returns The content to add to the empty message node.\n */\n Renderer.prototype.formatEmptyMessage = function (data) {\n return \"No commands found that match '\" + data.query + \"'\";\n };\n /**\n * Create the render content for the item shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n Renderer.prototype.formatItemShortcut = function (data) {\n var kb = data.item.keyBinding;\n return kb ? kb.keys.map(_lumino_commands__WEBPACK_IMPORTED_MODULE_6__.CommandRegistry.formatKeystroke).join(', ') : null;\n };\n /**\n * Create the render content for the item label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n Renderer.prototype.formatItemLabel = function (data) {\n if (!data.indices || data.indices.length === 0) {\n return data.item.label;\n }\n return _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.StringExt.highlight(data.item.label, data.indices, _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.mark);\n };\n /**\n * Create the render content for the item caption node.\n *\n * @param data - The data to use for the caption content.\n *\n * @returns The content to add to the caption node.\n */\n Renderer.prototype.formatItemCaption = function (data) {\n return data.item.caption;\n };\n return Renderer;\n }());\n CommandPalette.Renderer = Renderer;\n /**\n * The default `Renderer` instance.\n */\n CommandPalette.defaultRenderer = new Renderer();\n})(CommandPalette || (CommandPalette = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$5;\n(function (Private) {\n /**\n * Create the DOM node for a command palette.\n */\n function createNode() {\n var node = document.createElement('div');\n var search = document.createElement('div');\n var wrapper = document.createElement('div');\n var input = document.createElement('input');\n var content = document.createElement('ul');\n var clear = document.createElement('button');\n search.className = 'lm-CommandPalette-search';\n wrapper.className = 'lm-CommandPalette-wrapper';\n input.className = 'lm-CommandPalette-input';\n clear.className = 'lm-close-icon';\n content.className = 'lm-CommandPalette-content';\n /* <DEPRECATED> */\n search.classList.add('p-CommandPalette-search');\n wrapper.classList.add('p-CommandPalette-wrapper');\n input.classList.add('p-CommandPalette-input');\n content.classList.add('p-CommandPalette-content');\n /* </DEPRECATED> */\n input.spellcheck = false;\n wrapper.appendChild(input);\n wrapper.appendChild(clear);\n search.appendChild(wrapper);\n node.appendChild(search);\n node.appendChild(content);\n return node;\n }\n Private.createNode = createNode;\n /**\n * Create a new command item from a command registry and options.\n */\n function createItem(commands, options) {\n return new CommandItem(commands, options);\n }\n Private.createItem = createItem;\n /**\n * Search an array of command items for fuzzy matches.\n */\n function search(items, query) {\n // Fuzzy match the items for the query.\n var scores = matchItems(items, query);\n // Sort the items based on their score.\n scores.sort(scoreCmp);\n // Create the results for the search.\n return createResults(scores);\n }\n Private.search = search;\n /**\n * Test whether a result item can be activated.\n */\n function canActivate(result) {\n return result.type === 'item' && result.item.isEnabled;\n }\n Private.canActivate = canActivate;\n /**\n * Normalize a category for a command item.\n */\n function normalizeCategory(category) {\n return category.trim().replace(/\\s+/g, ' ');\n }\n /**\n * Normalize the query text for a fuzzy search.\n */\n function normalizeQuery(text) {\n return text.replace(/\\s+/g, '').toLowerCase();\n }\n /**\n * Perform a fuzzy match on an array of command items.\n */\n function matchItems(items, query) {\n // Normalize the query text to lower case with no whitespace.\n query = normalizeQuery(query);\n // Create the array to hold the scores.\n var scores = [];\n // Iterate over the items and match against the query.\n for (var i = 0, n = items.length; i < n; ++i) {\n // Ignore items which are not visible.\n var item = items[i];\n if (!item.isVisible) {\n continue;\n }\n // If the query is empty, all items are matched by default.\n if (!query) {\n scores.push({\n matchType: 3 /* Default */,\n categoryIndices: null,\n labelIndices: null,\n score: 0, item: item\n });\n continue;\n }\n // Run the fuzzy search for the item and query.\n var score = fuzzySearch(item, query);\n // Ignore the item if it is not a match.\n if (!score) {\n continue;\n }\n // Penalize disabled items.\n // TODO - push disabled items all the way down in sort cmp?\n if (!item.isEnabled) {\n score.score += 1000;\n }\n // Add the score to the results.\n scores.push(score);\n }\n // Return the final array of scores.\n return scores;\n }\n /**\n * Perform a fuzzy search on a single command item.\n */\n function fuzzySearch(item, query) {\n // Create the source text to be searched.\n var category = item.category.toLowerCase();\n var label = item.label.toLowerCase();\n var source = category + \" \" + label;\n // Set up the match score and indices array.\n var score = Infinity;\n var indices = null;\n // The regex for search word boundaries\n var rgx = /\\b\\w/g;\n // Search the source by word boundary.\n while (true) {\n // Find the next word boundary in the source.\n var rgxMatch = rgx.exec(source);\n // Break if there is no more source context.\n if (!rgxMatch) {\n break;\n }\n // Run the string match on the relevant substring.\n var match = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.StringExt.matchSumOfDeltas(source, query, rgxMatch.index);\n // Break if there is no match.\n if (!match) {\n break;\n }\n // Update the match if the score is better.\n if (match && match.score <= score) {\n score = match.score;\n indices = match.indices;\n }\n }\n // Bail if there was no match.\n if (!indices || score === Infinity) {\n return null;\n }\n // Compute the pivot index between category and label text.\n var pivot = category.length + 1;\n // Find the slice index to separate matched indices.\n var j = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.lowerBound(indices, pivot, function (a, b) { return a - b; });\n // Extract the matched category and label indices.\n var categoryIndices = indices.slice(0, j);\n var labelIndices = indices.slice(j);\n // Adjust the label indices for the pivot offset.\n for (var i = 0, n = labelIndices.length; i < n; ++i) {\n labelIndices[i] -= pivot;\n }\n // Handle a pure label match.\n if (categoryIndices.length === 0) {\n return {\n matchType: 0 /* Label */,\n categoryIndices: null,\n labelIndices: labelIndices,\n score: score, item: item\n };\n }\n // Handle a pure category match.\n if (labelIndices.length === 0) {\n return {\n matchType: 1 /* Category */,\n categoryIndices: categoryIndices,\n labelIndices: null,\n score: score, item: item\n };\n }\n // Handle a split match.\n return {\n matchType: 2 /* Split */,\n categoryIndices: categoryIndices,\n labelIndices: labelIndices,\n score: score, item: item\n };\n }\n /**\n * A sort comparison function for a match score.\n */\n function scoreCmp(a, b) {\n // First compare based on the match type\n var m1 = a.matchType - b.matchType;\n if (m1 !== 0) {\n return m1;\n }\n // Otherwise, compare based on the match score.\n var d1 = a.score - b.score;\n if (d1 !== 0) {\n return d1;\n }\n // Find the match index based on the match type.\n var i1 = 0;\n var i2 = 0;\n switch (a.matchType) {\n case 0 /* Label */:\n i1 = a.labelIndices[0];\n i2 = b.labelIndices[0];\n break;\n case 1 /* Category */:\n case 2 /* Split */:\n i1 = a.categoryIndices[0];\n i2 = b.categoryIndices[0];\n break;\n }\n // Compare based on the match index.\n if (i1 !== i2) {\n return i1 - i2;\n }\n // Otherwise, compare by category.\n var d2 = a.item.category.localeCompare(b.item.category);\n if (d2 !== 0) {\n return d2;\n }\n // Otherwise, compare by rank.\n var r1 = a.item.rank;\n var r2 = b.item.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity safe\n }\n // Finally, compare by label.\n return a.item.label.localeCompare(b.item.label);\n }\n /**\n * Create the results from an array of sorted scores.\n */\n function createResults(scores) {\n // Set up an array to track which scores have been visited.\n var visited = new Array(scores.length);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.fill(visited, false);\n // Set up the search results array.\n var results = [];\n // Iterate over each score in the array.\n for (var i = 0, n = scores.length; i < n; ++i) {\n // Ignore a score which has already been processed.\n if (visited[i]) {\n continue;\n }\n // Extract the current item and indices.\n var _a = scores[i], item = _a.item, categoryIndices = _a.categoryIndices;\n // Extract the category for the current item.\n var category = item.category;\n // Add the header result for the category.\n results.push({ type: 'header', category: category, indices: categoryIndices });\n // Find the rest of the scores with the same category.\n for (var j = i; j < n; ++j) {\n // Ignore a score which has already been processed.\n if (visited[j]) {\n continue;\n }\n // Extract the data for the current score.\n var _b = scores[j], item_1 = _b.item, labelIndices = _b.labelIndices;\n // Ignore an item with a different category.\n if (item_1.category !== category) {\n continue;\n }\n // Create the item result for the score.\n results.push({ type: 'item', item: item_1, indices: labelIndices });\n // Mark the score as processed.\n visited[j] = true;\n }\n }\n // Return the final results.\n return results;\n }\n /**\n * A concrete implementation of `CommandPalette.IItem`.\n */\n var CommandItem = /** @class */ (function () {\n /**\n * Construct a new command item.\n */\n function CommandItem(commands, options) {\n this._commands = commands;\n this.category = normalizeCategory(options.category);\n this.command = options.command;\n this.args = options.args || _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__.JSONExt.emptyObject;\n this.rank = options.rank !== undefined ? options.rank : Infinity;\n }\n Object.defineProperty(CommandItem.prototype, \"label\", {\n /**\n * The display label for the command item.\n */\n get: function () {\n return this._commands.label(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"icon\", {\n /**\n * The icon renderer for the command item.\n */\n get: function () {\n return this._commands.icon(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"iconClass\", {\n /**\n * The icon class for the command item.\n */\n get: function () {\n return this._commands.iconClass(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"iconLabel\", {\n /**\n * The icon label for the command item.\n */\n get: function () {\n return this._commands.iconLabel(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"caption\", {\n /**\n * The display caption for the command item.\n */\n get: function () {\n return this._commands.caption(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"className\", {\n /**\n * The extra class name for the command item.\n */\n get: function () {\n return this._commands.className(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"dataset\", {\n /**\n * The dataset for the command item.\n */\n get: function () {\n return this._commands.dataset(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"isEnabled\", {\n /**\n * Whether the command item is enabled.\n */\n get: function () {\n return this._commands.isEnabled(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"isToggled\", {\n /**\n * Whether the command item is toggled.\n */\n get: function () {\n return this._commands.isToggled(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"isToggleable\", {\n /**\n * Whether the command item is toggleable.\n */\n get: function () {\n return this._commands.isToggleable(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"isVisible\", {\n /**\n * Whether the command item is visible.\n */\n get: function () {\n return this._commands.isVisible(this.command, this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CommandItem.prototype, \"keyBinding\", {\n /**\n * The key binding for the command item.\n */\n get: function () {\n var _a = this, command = _a.command, args = _a.args;\n return _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findLastValue(this._commands.keyBindings, function (kb) {\n return kb.command === command && _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__.JSONExt.deepEqual(kb.args, args);\n }) || null;\n },\n enumerable: true,\n configurable: true\n });\n return CommandItem;\n }());\n})(Private$5 || (Private$5 = {}));\n\n/**\n * A widget which displays items as a canonical menu.\n */\nvar Menu = /** @class */ (function (_super) {\n __extends(Menu, _super);\n /**\n * Construct a new menu.\n *\n * @param options - The options for initializing the menu.\n */\n function Menu(options) {\n var _this = _super.call(this, { node: Private$6.createNode() }) || this;\n _this._childIndex = -1;\n _this._activeIndex = -1;\n _this._openTimerID = 0;\n _this._closeTimerID = 0;\n _this._items = [];\n _this._childMenu = null;\n _this._parentMenu = null;\n _this._aboutToClose = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this._menuRequested = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this.addClass('lm-Menu');\n /* <DEPRECATED> */\n _this.addClass('p-Menu');\n /* </DEPRECATED> */\n _this.setFlag(Widget.Flag.DisallowLayout);\n _this.commands = options.commands;\n _this.renderer = options.renderer || Menu.defaultRenderer;\n return _this;\n }\n /**\n * Dispose of the resources held by the menu.\n */\n Menu.prototype.dispose = function () {\n this.close();\n this._items.length = 0;\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(Menu.prototype, \"aboutToClose\", {\n /**\n * A signal emitted just before the menu is closed.\n *\n * #### Notes\n * This signal is emitted when the menu receives a `'close-request'`\n * message, just before it removes itself from the DOM.\n *\n * This signal is not emitted if the menu is already detached from\n * the DOM when it receives the `'close-request'` message.\n */\n get: function () {\n return this._aboutToClose;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"menuRequested\", {\n /**\n * A signal emitted when a new menu is requested by the user.\n *\n * #### Notes\n * This signal is emitted whenever the user presses the right or left\n * arrow keys, and a submenu cannot be opened or closed in response.\n *\n * This signal is useful when implementing menu bars in order to open\n * the next or previous menu in response to a user key press.\n *\n * This signal is only emitted for the root menu in a hierarchy.\n */\n get: function () {\n return this._menuRequested;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"parentMenu\", {\n /**\n * The parent menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu is an open submenu.\n */\n get: function () {\n return this._parentMenu;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"childMenu\", {\n /**\n * The child menu of the menu.\n *\n * #### Notes\n * This is `null` unless the menu has an open submenu.\n */\n get: function () {\n return this._childMenu;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"rootMenu\", {\n /**\n * The root menu of the menu hierarchy.\n */\n get: function () {\n var menu = this;\n while (menu._parentMenu) {\n menu = menu._parentMenu;\n }\n return menu;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"leafMenu\", {\n /**\n * The leaf menu of the menu hierarchy.\n */\n get: function () {\n var menu = this;\n while (menu._childMenu) {\n menu = menu._childMenu;\n }\n return menu;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"contentNode\", {\n /**\n * The menu content node.\n *\n * #### Notes\n * This is the node which holds the menu item nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-Menu-content')[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"activeItem\", {\n /**\n * Get the currently active menu item.\n */\n get: function () {\n return this._items[this._activeIndex] || null;\n },\n /**\n * Set the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the item will be set to `null`.\n */\n set: function (value) {\n this.activeIndex = value ? this._items.indexOf(value) : -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"activeIndex\", {\n /**\n * Get the index of the currently active menu item.\n *\n * #### Notes\n * This will be `-1` if no menu item is active.\n */\n get: function () {\n return this._activeIndex;\n },\n /**\n * Set the index of the currently active menu item.\n *\n * #### Notes\n * If the item cannot be activated, the index will be set to `-1`.\n */\n set: function (value) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._items.length) {\n value = -1;\n }\n // Ensure the item can be activated.\n if (value !== -1 && !Private$6.canActivate(this._items[value])) {\n value = -1;\n }\n // Bail if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n // Update the active index.\n this._activeIndex = value;\n // schedule an update of the items.\n this.update();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Menu.prototype, \"items\", {\n /**\n * A read-only array of the menu items in the menu.\n */\n get: function () {\n return this._items;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Activate the next selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n Menu.prototype.activateNextItem = function () {\n var n = this._items.length;\n var ai = this._activeIndex;\n var start = ai < n - 1 ? ai + 1 : 0;\n var stop = start === 0 ? n - 1 : start - 1;\n this.activeIndex = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(this._items, Private$6.canActivate, start, stop);\n };\n /**\n * Activate the previous selectable item in the menu.\n *\n * #### Notes\n * If no item is selectable, the index will be set to `-1`.\n */\n Menu.prototype.activatePreviousItem = function () {\n var n = this._items.length;\n var ai = this._activeIndex;\n var start = ai <= 0 ? n - 1 : ai - 1;\n var stop = start === n - 1 ? 0 : start + 1;\n this.activeIndex = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findLastIndex(this._items, Private$6.canActivate, start, stop);\n };\n /**\n * Trigger the active menu item.\n *\n * #### Notes\n * If the active item is a submenu, it will be opened and the first\n * item will be activated.\n *\n * If the active item is a command, the command will be executed.\n *\n * If the menu is not attached, this is a no-op.\n *\n * If there is no active item, this is a no-op.\n */\n Menu.prototype.triggerActiveItem = function () {\n // Bail if the menu is not attached.\n if (!this.isAttached) {\n return;\n }\n // Bail if there is no active item.\n var item = this.activeItem;\n if (!item) {\n return;\n }\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n // If the item is a submenu, open it.\n if (item.type === 'submenu') {\n this._openChildMenu(true);\n return;\n }\n // Close the root menu before executing the command.\n this.rootMenu.close();\n // Execute the command for the item.\n var command = item.command, args = item.args;\n if (this.commands.isEnabled(command, args)) {\n this.commands.execute(command, args);\n }\n else {\n console.log(\"Command '\" + command + \"' is disabled.\");\n }\n };\n /**\n * Add a menu item to the end of the menu.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n */\n Menu.prototype.addItem = function (options) {\n return this.insertItem(this._items.length, options);\n };\n /**\n * Insert a menu item into the menu at the specified index.\n *\n * @param index - The index at which to insert the item.\n *\n * @param options - The options for creating the menu item.\n *\n * @returns The menu item added to the menu.\n *\n * #### Notes\n * The index will be clamped to the bounds of the items.\n */\n Menu.prototype.insertItem = function (index, options) {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n // Reset the active index.\n this.activeIndex = -1;\n // Clamp the insert index to the array bounds.\n var i = Math.max(0, Math.min(index, this._items.length));\n // Create the item for the options.\n var item = Private$6.createItem(this, options);\n // Insert the item into the array.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._items, i, item);\n // Schedule an update of the items.\n this.update();\n // Return the item added to the menu.\n return item;\n };\n /**\n * Remove an item from the menu.\n *\n * @param item - The item to remove from the menu.\n *\n * #### Notes\n * This is a no-op if the item is not in the menu.\n */\n Menu.prototype.removeItem = function (item) {\n this.removeItemAt(this._items.indexOf(item));\n };\n /**\n * Remove the item at a given index from the menu.\n *\n * @param index - The index of the item to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n Menu.prototype.removeItemAt = function (index) {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n // Reset the active index.\n this.activeIndex = -1;\n // Remove the item from the array.\n var item = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._items, index);\n // Bail if the index is out of range.\n if (!item) {\n return;\n }\n // Schedule an update of the items.\n this.update();\n };\n /**\n * Remove all menu items from the menu.\n */\n Menu.prototype.clearItems = function () {\n // Close the menu if it's attached.\n if (this.isAttached) {\n this.close();\n }\n // Reset the active index.\n this.activeIndex = -1;\n // Bail if there is nothing to remove.\n if (this._items.length === 0) {\n return;\n }\n // Clear the items.\n this._items.length = 0;\n // Schedule an update of the items.\n this.update();\n };\n /**\n * Open the menu at the specified location.\n *\n * @param x - The client X coordinate of the menu location.\n *\n * @param y - The client Y coordinate of the menu location.\n *\n * @param options - The additional options for opening the menu.\n *\n * #### Notes\n * The menu will be opened at the given location unless it will not\n * fully fit on the screen. If it will not fit, it will be adjusted\n * to fit naturally on the screen.\n *\n * This is a no-op if the menu is already attached to the DOM.\n */\n Menu.prototype.open = function (x, y, options) {\n if (options === void 0) { options = {}; }\n // Bail early if the menu is already attached.\n if (this.isAttached) {\n return;\n }\n // Extract the position options.\n var forceX = options.forceX || false;\n var forceY = options.forceY || false;\n // Open the menu as a root menu.\n Private$6.openRootMenu(this, x, y, forceX, forceY);\n // Activate the menu to accept keyboard input.\n this.activate();\n };\n /**\n * Handle the DOM events for the menu.\n *\n * @param event - The DOM event sent to the menu.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu's DOM nodes. It should\n * not be called directly by user code.\n */\n Menu.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event);\n break;\n case 'mouseup':\n this._evtMouseUp(event);\n break;\n case 'mousemove':\n this._evtMouseMove(event);\n break;\n case 'mouseenter':\n this._evtMouseEnter(event);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event);\n break;\n case 'mousedown':\n this._evtMouseDown(event);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n Menu.prototype.onBeforeAttach = function (msg) {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mouseup', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseenter', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n document.addEventListener('mousedown', this, true);\n };\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n Menu.prototype.onAfterDetach = function (msg) {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mouseup', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseenter', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n document.removeEventListener('mousedown', this, true);\n };\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n Menu.prototype.onActivateRequest = function (msg) {\n if (this.isAttached) {\n this.node.focus();\n }\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n Menu.prototype.onUpdateRequest = function (msg) {\n var items = this._items;\n var renderer = this.renderer;\n var activeIndex = this._activeIndex;\n var collapsedFlags = Private$6.computeCollapsed(items);\n var content = new Array(items.length);\n for (var i = 0, n = items.length; i < n; ++i) {\n var item = items[i];\n var active = i === activeIndex;\n var collapsed = collapsedFlags[i];\n content[i] = renderer.renderItem({ item: item, active: active, collapsed: collapsed });\n }\n _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.VirtualDOM.render(content, this.contentNode);\n };\n /**\n * A message handler invoked on a `'close-request'` message.\n */\n Menu.prototype.onCloseRequest = function (msg) {\n // Cancel the pending timers.\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n // Reset the active index.\n this.activeIndex = -1;\n // Close any open child menu.\n var childMenu = this._childMenu;\n if (childMenu) {\n this._childIndex = -1;\n this._childMenu = null;\n childMenu._parentMenu = null;\n childMenu.close();\n }\n // Remove this menu from its parent and activate the parent.\n var parentMenu = this._parentMenu;\n if (parentMenu) {\n this._parentMenu = null;\n parentMenu._childIndex = -1;\n parentMenu._childMenu = null;\n parentMenu.activate();\n }\n // Emit the `aboutToClose` signal if the menu is attached.\n if (this.isAttached) {\n this._aboutToClose.emit(undefined);\n }\n // Finish closing the menu.\n _super.prototype.onCloseRequest.call(this, msg);\n };\n /**\n * Handle the `'keydown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n Menu.prototype._evtKeyDown = function (event) {\n // A menu handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n // Fetch the key code for the event.\n var kc = event.keyCode;\n // Enter\n if (kc === 13) {\n this.triggerActiveItem();\n return;\n }\n // Escape\n if (kc === 27) {\n this.close();\n return;\n }\n // Left Arrow\n if (kc === 37) {\n if (this._parentMenu) {\n this.close();\n }\n else {\n this._menuRequested.emit('previous');\n }\n return;\n }\n // Up Arrow\n if (kc === 38) {\n this.activatePreviousItem();\n return;\n }\n // Right Arrow\n if (kc === 39) {\n var item = this.activeItem;\n if (item && item.type === 'submenu') {\n this.triggerActiveItem();\n }\n else {\n this.rootMenu._menuRequested.emit('next');\n }\n return;\n }\n // Down Arrow\n if (kc === 40) {\n this.activateNextItem();\n return;\n }\n // Get the pressed key character.\n var key = (0,_lumino_keyboard__WEBPACK_IMPORTED_MODULE_9__.getKeyboardLayout)().keyForKeydownEvent(event);\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n // Search for the next best matching mnemonic item.\n var start = this._activeIndex + 1;\n var result = Private$6.findMnemonic(this._items, key, start);\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that item is triggered.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.triggerActiveItem();\n }\n else if (result.index !== -1) {\n this.activeIndex = result.index;\n }\n else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n };\n /**\n * Handle the `'mouseup'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n Menu.prototype._evtMouseUp = function (event) {\n if (event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.triggerActiveItem();\n };\n /**\n * Handle the `'mousemove'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n Menu.prototype._evtMouseMove = function (event) {\n // Hit test the item nodes for the item under the mouse.\n var index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(this.contentNode.children, function (node) {\n return _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n // Bail early if the mouse is already over the active index.\n if (index === this._activeIndex) {\n return;\n }\n // Update and coerce the active index.\n this.activeIndex = index;\n index = this.activeIndex;\n // If the index is the current child index, cancel the timers.\n if (index === this._childIndex) {\n this._cancelOpenTimer();\n this._cancelCloseTimer();\n return;\n }\n // If a child menu is currently open, start the close timer.\n if (this._childIndex !== -1) {\n this._startCloseTimer();\n }\n // Cancel the open timer to give a full delay for opening.\n this._cancelOpenTimer();\n // Bail if the active item is not a valid submenu item.\n var item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n return;\n }\n // Start the open timer to open the active item submenu.\n this._startOpenTimer();\n };\n /**\n * Handle the `'mouseenter'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n Menu.prototype._evtMouseEnter = function (event) {\n // Synchronize the active ancestor items.\n for (var menu = this._parentMenu; menu; menu = menu._parentMenu) {\n menu._cancelOpenTimer();\n menu._cancelCloseTimer();\n menu.activeIndex = menu._childIndex;\n }\n };\n /**\n * Handle the `'mouseleave'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the menu node.\n */\n Menu.prototype._evtMouseLeave = function (event) {\n // Cancel any pending submenu opening.\n this._cancelOpenTimer();\n // If there is no open child menu, just reset the active index.\n if (!this._childMenu) {\n this.activeIndex = -1;\n return;\n }\n // If the mouse is over the child menu, cancel the close timer.\n var clientX = event.clientX, clientY = event.clientY;\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {\n this._cancelCloseTimer();\n return;\n }\n // Otherwise, reset the active index and start the close timer.\n this.activeIndex = -1;\n this._startCloseTimer();\n };\n /**\n * Handle the `'mousedown'` event for the menu.\n *\n * #### Notes\n * This listener is attached to the document node.\n */\n Menu.prototype._evtMouseDown = function (event) {\n // Bail if the menu is not a root menu.\n if (this._parentMenu) {\n return;\n }\n // The mouse button which is pressed is irrelevant. If the press\n // is not on a menu, the entire hierarchy is closed and the event\n // is allowed to propagate. This allows other code to act on the\n // event, such as focusing the clicked element.\n if (Private$6.hitTestMenus(this, event.clientX, event.clientY)) {\n event.preventDefault();\n event.stopPropagation();\n }\n else {\n this.close();\n }\n };\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if the active item is not a valid submenu.\n */\n Menu.prototype._openChildMenu = function (activateFirst) {\n if (activateFirst === void 0) { activateFirst = false; }\n // If the item is not a valid submenu, close the child menu.\n var item = this.activeItem;\n if (!item || item.type !== 'submenu' || !item.submenu) {\n this._closeChildMenu();\n return;\n }\n // Do nothing if the child menu will not change.\n var submenu = item.submenu;\n if (submenu === this._childMenu) {\n return;\n }\n // Ensure the current child menu is closed.\n this._closeChildMenu();\n // Update the private child state.\n this._childMenu = submenu;\n this._childIndex = this._activeIndex;\n // Set the parent menu reference for the child.\n submenu._parentMenu = this;\n // Ensure the menu is updated and lookup the item node.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n var itemNode = this.contentNode.children[this._activeIndex];\n // Open the submenu at the active node.\n Private$6.openSubmenu(submenu, itemNode);\n // Activate the first item if desired.\n if (activateFirst) {\n submenu.activeIndex = -1;\n submenu.activateNextItem();\n }\n // Activate the child menu.\n submenu.activate();\n };\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n Menu.prototype._closeChildMenu = function () {\n if (this._childMenu) {\n this._childMenu.close();\n }\n };\n /**\n * Start the open timer, unless it is already pending.\n */\n Menu.prototype._startOpenTimer = function () {\n var _this = this;\n if (this._openTimerID === 0) {\n this._openTimerID = window.setTimeout(function () {\n _this._openTimerID = 0;\n _this._openChildMenu();\n }, Private$6.TIMER_DELAY);\n }\n };\n /**\n * Start the close timer, unless it is already pending.\n */\n Menu.prototype._startCloseTimer = function () {\n var _this = this;\n if (this._closeTimerID === 0) {\n this._closeTimerID = window.setTimeout(function () {\n _this._closeTimerID = 0;\n _this._closeChildMenu();\n }, Private$6.TIMER_DELAY);\n }\n };\n /**\n * Cancel the open timer, if the timer is pending.\n */\n Menu.prototype._cancelOpenTimer = function () {\n if (this._openTimerID !== 0) {\n clearTimeout(this._openTimerID);\n this._openTimerID = 0;\n }\n };\n /**\n * Cancel the close timer, if the timer is pending.\n */\n Menu.prototype._cancelCloseTimer = function () {\n if (this._closeTimerID !== 0) {\n clearTimeout(this._closeTimerID);\n this._closeTimerID = 0;\n }\n };\n return Menu;\n}(Widget));\n/**\n * The namespace for the `Menu` class statics.\n */\n(function (Menu) {\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n var Renderer = /** @class */ (function () {\n /**\n * Construct a new renderer.\n */\n function Renderer() {\n }\n /**\n * Render the virtual element for a menu item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n Renderer.prototype.renderItem = function (data) {\n var className = this.createItemClass(data);\n var dataset = this.createItemDataset(data);\n var aria = this.createItemARIA(data);\n return (_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.li(__assign({ className: className, dataset: dataset }, aria), this.renderIcon(data), this.renderLabel(data), this.renderShortcut(data), this.renderSubmenu(data)));\n };\n /**\n * Render the icon element for a menu item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n Renderer.prototype.renderIcon = function (data) {\n var className = this.createIconClass(data);\n /* <DEPRECATED> */\n if (typeof data.item.icon === 'string') {\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: className }, data.item.iconLabel);\n }\n /* </DEPRECATED> */\n // if data.item.icon is undefined, it will be ignored\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: className }, data.item.icon, data.item.iconLabel);\n };\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n Renderer.prototype.renderLabel = function (data) {\n var content = this.formatLabel(data);\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-Menu-itemLabel'\n /* <DEPRECATED> */\n + ' p-Menu-itemLabel'\n /* </DEPRECATED> */\n }, content);\n };\n /**\n * Render the shortcut element for a menu item.\n *\n * @param data - The data to use for rendering the shortcut.\n *\n * @returns A virtual element representing the item shortcut.\n */\n Renderer.prototype.renderShortcut = function (data) {\n var content = this.formatShortcut(data);\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-Menu-itemShortcut'\n /* <DEPRECATED> */\n + ' p-Menu-itemShortcut'\n /* </DEPRECATED> */\n }, content);\n };\n /**\n * Render the submenu icon element for a menu item.\n *\n * @param data - The data to use for rendering the submenu icon.\n *\n * @returns A virtual element representing the submenu icon.\n */\n Renderer.prototype.renderSubmenu = function (data) {\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-Menu-itemSubmenuIcon'\n /* <DEPRECATED> */\n + ' p-Menu-itemSubmenuIcon'\n /* </DEPRECATED> */\n });\n };\n /**\n * Create the class name for the menu item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n Renderer.prototype.createItemClass = function (data) {\n // Setup the initial class name.\n var name = 'lm-Menu-item';\n /* <DEPRECATED> */\n name += ' p-Menu-item';\n /* </DEPRECATED> */\n // Add the boolean state classes.\n if (!data.item.isEnabled) {\n name += ' lm-mod-disabled';\n /* <DEPRECATED> */\n name += ' p-mod-disabled';\n /* </DEPRECATED> */\n }\n if (data.item.isToggled) {\n name += ' lm-mod-toggled';\n /* <DEPRECATED> */\n name += ' p-mod-toggled';\n /* </DEPRECATED> */\n }\n if (!data.item.isVisible) {\n name += ' lm-mod-hidden';\n /* <DEPRECATED> */\n name += ' p-mod-hidden';\n /* </DEPRECATED> */\n }\n if (data.active) {\n name += ' lm-mod-active';\n /* <DEPRECATED> */\n name += ' p-mod-active';\n /* </DEPRECATED> */\n }\n if (data.collapsed) {\n name += ' lm-mod-collapsed';\n /* <DEPRECATED> */\n name += ' p-mod-collapsed';\n /* </DEPRECATED> */\n }\n // Add the extra class.\n var extra = data.item.className;\n if (extra) {\n name += \" \" + extra;\n }\n // Return the complete class name.\n return name;\n };\n /**\n * Create the dataset for the menu item.\n *\n * @param data - The data to use for creating the dataset.\n *\n * @returns The dataset for the menu item.\n */\n Renderer.prototype.createItemDataset = function (data) {\n var result;\n var _a = data.item, type = _a.type, command = _a.command, dataset = _a.dataset;\n if (type === 'command') {\n result = __assign(__assign({}, dataset), { type: type, command: command });\n }\n else {\n result = __assign(__assign({}, dataset), { type: type });\n }\n return result;\n };\n /**\n * Create the class name for the menu item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n Renderer.prototype.createIconClass = function (data) {\n var name = 'lm-Menu-itemIcon';\n /* <DEPRECATED> */\n name += ' p-Menu-itemIcon';\n /* </DEPRECATED> */\n var extra = data.item.iconClass;\n return extra ? name + \" \" + extra : name;\n };\n /**\n * Create the aria attributes for menu item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n Renderer.prototype.createItemARIA = function (data) {\n var aria = {};\n switch (data.item.type) {\n case 'separator':\n aria.role = 'presentation';\n break;\n case 'submenu':\n aria['aria-haspopup'] = 'true';\n break;\n default:\n aria.role = 'menuitem';\n }\n return aria;\n };\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n Renderer.prototype.formatLabel = function (data) {\n // Fetch the label text and mnemonic index.\n var _a = data.item, label = _a.label, mnemonic = _a.mnemonic;\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n // Split the label into parts.\n var prefix = label.slice(0, mnemonic);\n var suffix = label.slice(mnemonic + 1);\n var char = label[mnemonic];\n // Wrap the mnemonic character in a span.\n var span = _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.span({\n className: 'lm-Menu-itemMnemonic'\n /* <DEPRECATED> */\n + ' p-Menu-itemMnemonic'\n /* </DEPRECATED> */\n }, char);\n // Return the content parts.\n return [prefix, span, suffix];\n };\n /**\n * Create the render content for the shortcut node.\n *\n * @param data - The data to use for the shortcut content.\n *\n * @returns The content to add to the shortcut node.\n */\n Renderer.prototype.formatShortcut = function (data) {\n var kb = data.item.keyBinding;\n return kb ? kb.keys.map(_lumino_commands__WEBPACK_IMPORTED_MODULE_6__.CommandRegistry.formatKeystroke).join(', ') : null;\n };\n return Renderer;\n }());\n Menu.Renderer = Renderer;\n /**\n * The default `Renderer` instance.\n */\n Menu.defaultRenderer = new Renderer();\n})(Menu || (Menu = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$6;\n(function (Private) {\n /**\n * The ms delay for opening and closing a submenu.\n */\n Private.TIMER_DELAY = 300;\n /**\n * The horizontal pixel overlap for an open submenu.\n */\n Private.SUBMENU_OVERLAP = 3;\n /**\n * Create the DOM node for a menu.\n */\n function createNode() {\n var node = document.createElement('div');\n var content = document.createElement('ul');\n content.className = 'lm-Menu-content';\n /* <DEPRECATED> */\n content.classList.add('p-Menu-content');\n /* </DEPRECATED> */\n node.appendChild(content);\n content.setAttribute('role', 'menu');\n node.tabIndex = -1;\n return node;\n }\n Private.createNode = createNode;\n /**\n * Test whether a menu item can be activated.\n */\n function canActivate(item) {\n return item.type !== 'separator' && item.isEnabled && item.isVisible;\n }\n Private.canActivate = canActivate;\n /**\n * Create a new menu item for an owner menu.\n */\n function createItem(owner, options) {\n return new MenuItem(owner.commands, options);\n }\n Private.createItem = createItem;\n /**\n * Hit test a menu hierarchy starting at the given root.\n */\n function hitTestMenus(menu, x, y) {\n for (var temp = menu; temp; temp = temp.childMenu) {\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(temp.node, x, y)) {\n return true;\n }\n }\n return false;\n }\n Private.hitTestMenus = hitTestMenus;\n /**\n * Compute which extra separator items should be collapsed.\n */\n function computeCollapsed(items) {\n // Allocate the return array and fill it with `false`.\n var result = new Array(items.length);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.fill(result, false);\n // Collapse the leading separators.\n var k1 = 0;\n var n = items.length;\n for (; k1 < n; ++k1) {\n var item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k1] = true;\n }\n // Hide the trailing separators.\n var k2 = n - 1;\n for (; k2 >= 0; --k2) {\n var item = items[k2];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n break;\n }\n result[k2] = true;\n }\n // Hide the remaining consecutive separators.\n var hide = false;\n while (++k1 < k2) {\n var item = items[k1];\n if (!item.isVisible) {\n continue;\n }\n if (item.type !== 'separator') {\n hide = false;\n }\n else if (hide) {\n result[k1] = true;\n }\n else {\n hide = true;\n }\n }\n // Return the resulting flags.\n return result;\n }\n Private.computeCollapsed = computeCollapsed;\n /**\n * Open a menu as a root menu at the target location.\n */\n function openRootMenu(menu, x, y, forceX, forceY) {\n // Ensure the menu is updated before attaching and measuring.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);\n // Get the current position and size of the main viewport.\n var px = window.pageXOffset;\n var py = window.pageYOffset;\n var cw = document.documentElement.clientWidth;\n var ch = document.documentElement.clientHeight;\n // Compute the maximum allowed height for the menu.\n var maxHeight = ch - (forceY ? y : 0);\n // Fetch common variables.\n var node = menu.node;\n var style = node.style;\n // Clear the menu geometry and prepare it for measuring.\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.visibility = 'hidden';\n style.maxHeight = maxHeight + \"px\";\n // Attach the menu to the document.\n Widget.attach(menu, document.body);\n // Measure the size of the menu.\n var _a = node.getBoundingClientRect(), width = _a.width, height = _a.height;\n // Adjust the X position of the menu to fit on-screen.\n if (!forceX && (x + width > px + cw)) {\n x = px + cw - width;\n }\n // Adjust the Y position of the menu to fit on-screen.\n if (!forceY && (y + height > py + ch)) {\n if (y > py + ch) {\n y = py + ch - height;\n }\n else {\n y = y - height;\n }\n }\n // Update the position of the menu to the computed position.\n style.top = Math.max(0, y) + \"px\";\n style.left = Math.max(0, x) + \"px\";\n // Finally, make the menu visible on the screen.\n style.visibility = '';\n }\n Private.openRootMenu = openRootMenu;\n /**\n * Open a menu as a submenu using an item node for positioning.\n */\n function openSubmenu(submenu, itemNode) {\n // Ensure the menu is updated before opening.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);\n // Get the current position and size of the main viewport.\n var px = window.pageXOffset;\n var py = window.pageYOffset;\n var cw = document.documentElement.clientWidth;\n var ch = document.documentElement.clientHeight;\n // Compute the maximum allowed height for the menu.\n var maxHeight = ch;\n // Fetch common variables.\n var node = submenu.node;\n var style = node.style;\n // Clear the menu geometry and prepare it for measuring.\n style.top = '';\n style.left = '';\n style.width = '';\n style.height = '';\n style.visibility = 'hidden';\n style.maxHeight = maxHeight + \"px\";\n // Attach the menu to the document.\n Widget.attach(submenu, document.body);\n // Measure the size of the menu.\n var _a = node.getBoundingClientRect(), width = _a.width, height = _a.height;\n // Compute the box sizing for the menu.\n var box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(submenu.node);\n // Get the bounding rect for the target item node.\n var itemRect = itemNode.getBoundingClientRect();\n // Compute the target X position.\n var x = itemRect.right - Private.SUBMENU_OVERLAP;\n // Adjust the X position to fit on the screen.\n if (x + width > px + cw) {\n x = itemRect.left + Private.SUBMENU_OVERLAP - width;\n }\n // Compute the target Y position.\n var y = itemRect.top - box.borderTop - box.paddingTop;\n // Adjust the Y position to fit on the screen.\n if (y + height > py + ch) {\n y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;\n }\n // Update the position of the menu to the computed position.\n style.top = Math.max(0, y) + \"px\";\n style.left = Math.max(0, x) + \"px\";\n // Finally, make the menu visible on the screen.\n style.visibility = '';\n }\n Private.openSubmenu = openSubmenu;\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n function findMnemonic(items, key, start) {\n // Setup the result variables.\n var index = -1;\n var auto = -1;\n var multiple = false;\n // Normalize the key to upper case.\n var upperKey = key.toUpperCase();\n // Search the items from the given start index.\n for (var i = 0, n = items.length; i < n; ++i) {\n // Compute the wrapped index.\n var k = (i + start) % n;\n // Lookup the item\n var item = items[k];\n // Ignore items which cannot be activated.\n if (!canActivate(item)) {\n continue;\n }\n // Ignore items with an empty label.\n var label = item.label;\n if (label.length === 0) {\n continue;\n }\n // Lookup the mnemonic index for the label.\n var mn = item.mnemonic;\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < label.length) {\n if (label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n }\n else {\n multiple = true;\n }\n }\n continue;\n }\n // Finally, handle the auto index if possible.\n if (auto === -1 && label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n // Return the search results.\n return { index: index, multiple: multiple, auto: auto };\n }\n Private.findMnemonic = findMnemonic;\n /**\n * A concrete implementation of `Menu.IItem`.\n */\n var MenuItem = /** @class */ (function () {\n /**\n * Construct a new menu item.\n */\n function MenuItem(commands, options) {\n this._commands = commands;\n this.type = options.type || 'command';\n this.command = options.command || '';\n this.args = options.args || _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__.JSONExt.emptyObject;\n this.submenu = options.submenu || null;\n }\n Object.defineProperty(MenuItem.prototype, \"label\", {\n /**\n * The display label for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.label(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.label;\n }\n return '';\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"mnemonic\", {\n /**\n * The mnemonic index for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.mnemonic(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.mnemonic;\n }\n return -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"icon\", {\n /**\n * The icon renderer for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.icon(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.icon;\n }\n /* <DEPRECATED> */\n // alias to icon class if not otherwise defined\n return this.iconClass;\n /* </DEPRECATED> */\n /* <FUTURE>\n return undefined;\n </FUTURE> */\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"iconClass\", {\n /**\n * The icon class for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.iconClass(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconClass;\n }\n return '';\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"iconLabel\", {\n /**\n * The icon label for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.iconLabel(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.iconLabel;\n }\n return '';\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"caption\", {\n /**\n * The display caption for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.caption(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.caption;\n }\n return '';\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"className\", {\n /**\n * The extra class name for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.className(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.className;\n }\n return '';\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"dataset\", {\n /**\n * The dataset for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.dataset(this.command, this.args);\n }\n if (this.type === 'submenu' && this.submenu) {\n return this.submenu.title.dataset;\n }\n return {};\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"isEnabled\", {\n /**\n * Whether the menu item is enabled.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.isEnabled(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"isToggled\", {\n /**\n * Whether the menu item is toggled.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.isToggled(this.command, this.args);\n }\n return false;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"isVisible\", {\n /**\n * Whether the menu item is visible.\n */\n get: function () {\n if (this.type === 'command') {\n return this._commands.isVisible(this.command, this.args);\n }\n if (this.type === 'submenu') {\n return this.submenu !== null;\n }\n return true;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuItem.prototype, \"keyBinding\", {\n /**\n * The key binding for the menu item.\n */\n get: function () {\n if (this.type === 'command') {\n var _a = this, command_1 = _a.command, args_1 = _a.args;\n return _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findLastValue(this._commands.keyBindings, function (kb) {\n return kb.command === command_1 && _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__.JSONExt.deepEqual(kb.args, args_1);\n }) || null;\n }\n return null;\n },\n enumerable: true,\n configurable: true\n });\n return MenuItem;\n }());\n})(Private$6 || (Private$6 = {}));\n\n/**\n * An object which implements a universal context menu.\n *\n * #### Notes\n * The items shown in the context menu are determined by CSS selector\n * matching against the DOM hierarchy at the site of the mouse click.\n * This is similar in concept to how keyboard shortcuts are matched\n * in the command registry.\n */\nvar ContextMenu = /** @class */ (function () {\n /**\n * Construct a new context menu.\n *\n * @param options - The options for initializing the menu.\n */\n function ContextMenu(options) {\n this._idTick = 0;\n this._items = [];\n this.menu = new Menu(options);\n }\n /**\n * Add an item to the context menu.\n *\n * @param options - The options for creating the item.\n *\n * @returns A disposable which will remove the item from the menu.\n */\n ContextMenu.prototype.addItem = function (options) {\n var _this = this;\n // Create an item from the given options.\n var item = Private$7.createItem(options, this._idTick++);\n // Add the item to the internal array.\n this._items.push(item);\n // Return a disposable which will remove the item.\n return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_8__.DisposableDelegate(function () {\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeFirstOf(_this._items, item);\n });\n };\n /**\n * Open the context menu in response to a `'contextmenu'` event.\n *\n * @param event - The `'contextmenu'` event of interest.\n *\n * @returns `true` if the menu was opened, or `false` if no items\n * matched the event and the menu was not opened.\n *\n * #### Notes\n * This method will populate the context menu with items which match\n * the propagation path of the event, then open the menu at the mouse\n * position indicated by the event.\n */\n ContextMenu.prototype.open = function (event) {\n var _this = this;\n // Clear the current contents of the context menu.\n this.menu.clearItems();\n // Bail early if there are no items to match.\n if (this._items.length === 0) {\n return false;\n }\n // Find the matching items for the event.\n var items = Private$7.matchItems(this._items, event);\n // Bail if there are no matching items.\n if (!items || items.length === 0) {\n return false;\n }\n // Add the filtered items to the menu.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(items, function (item) { _this.menu.addItem(item); });\n // Open the context menu at the current mouse position.\n this.menu.open(event.clientX, event.clientY);\n // Indicate success.\n return true;\n };\n return ContextMenu;\n}());\n/**\n * The namespace for the module implementation details.\n */\nvar Private$7;\n(function (Private) {\n /**\n * Create a normalized context menu item from an options object.\n */\n function createItem(options, id) {\n var selector = validateSelector(options.selector);\n var rank = options.rank !== undefined ? options.rank : Infinity;\n return __assign(__assign({}, options), { selector: selector, rank: rank, id: id });\n }\n Private.createItem = createItem;\n /**\n * Find the items which match a context menu event.\n *\n * The results are sorted by DOM level, specificity, and rank.\n */\n function matchItems(items, event) {\n // Look up the target of the event.\n var target = event.target;\n // Bail if there is no target.\n if (!target) {\n return null;\n }\n // Look up the current target of the event.\n var currentTarget = event.currentTarget;\n // Bail if there is no current target.\n if (!currentTarget) {\n return null;\n }\n // There are some third party libraries that cause the `target` to\n // be detached from the DOM before lumino can process the event.\n // If that happens, search for a new target node by point. If that\n // node is still dangling, bail.\n if (!currentTarget.contains(target)) {\n target = document.elementFromPoint(event.clientX, event.clientY);\n if (!target || !currentTarget.contains(target)) {\n return null;\n }\n }\n // Set up the result array.\n var result = [];\n // Copy the items array to allow in-place modification.\n var availableItems = items.slice();\n // Walk up the DOM hierarchy searching for matches.\n while (target !== null) {\n // Set up the match array for this DOM level.\n var matches = [];\n // Search the remaining items for matches.\n for (var i = 0, n = availableItems.length; i < n; ++i) {\n // Fetch the item.\n var item = availableItems[i];\n // Skip items which are already consumed.\n if (!item) {\n continue;\n }\n // Skip items which do not match the element.\n if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Selector.matches(target, item.selector)) {\n continue;\n }\n // Add the matched item to the result for this DOM level.\n matches.push(item);\n // Mark the item as consumed.\n availableItems[i] = null;\n }\n // Sort the matches for this level and add them to the results.\n if (matches.length !== 0) {\n matches.sort(itemCmp);\n result.push.apply(result, matches);\n }\n // Stop searching at the limits of the DOM range.\n if (target === currentTarget) {\n break;\n }\n // Step to the parent DOM level.\n target = target.parentElement;\n }\n // Return the matched and sorted results.\n return result;\n }\n Private.matchItems = matchItems;\n /**\n * Validate the selector for a menu item.\n *\n * This returns the validated selector, or throws if the selector is\n * invalid or contains commas.\n */\n function validateSelector(selector) {\n if (selector.indexOf(',') !== -1) {\n throw new Error(\"Selector cannot contain commas: \" + selector);\n }\n if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Selector.isValid(selector)) {\n throw new Error(\"Invalid selector: \" + selector);\n }\n return selector;\n }\n /**\n * A sort comparison function for a context menu item.\n */\n function itemCmp(a, b) {\n // Sort first based on selector specificity.\n var s1 = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Selector.calculateSpecificity(a.selector);\n var s2 = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Selector.calculateSpecificity(b.selector);\n if (s1 !== s2) {\n return s2 - s1;\n }\n // If specificities are equal, sort based on rank.\n var r1 = a.rank;\n var r2 = b.rank;\n if (r1 !== r2) {\n return r1 < r2 ? -1 : 1; // Infinity-safe\n }\n // When all else fails, sort by item id.\n return a.id - b.id;\n }\n})(Private$7 || (Private$7 = {}));\n\n/**\n * A layout which provides a flexible docking arrangement.\n *\n * #### Notes\n * The consumer of this layout is responsible for handling all signals\n * from the generated tab bars and managing the visibility of widgets\n * and tab bars as needed.\n */\nvar DockLayout = /** @class */ (function (_super) {\n __extends(DockLayout, _super);\n /**\n * Construct a new dock layout.\n *\n * @param options - The options for initializing the layout.\n */\n function DockLayout(options) {\n var _this = _super.call(this) || this;\n _this._spacing = 4;\n _this._dirty = false;\n _this._root = null;\n _this._box = null;\n _this._items = new Map();\n _this.renderer = options.renderer;\n if (options.spacing !== undefined) {\n _this._spacing = Private$8.clampSpacing(options.spacing);\n }\n return _this;\n }\n /**\n * Dispose of the resources held by the layout.\n *\n * #### Notes\n * This will clear and dispose all widgets in the layout.\n */\n DockLayout.prototype.dispose = function () {\n // Get an iterator over the widgets in the layout.\n var widgets = this.iter();\n // Dispose of the layout items.\n this._items.forEach(function (item) { item.dispose(); });\n // Clear the layout state before disposing the widgets.\n this._box = null;\n this._root = null;\n this._items.clear();\n // Dispose of the widgets contained in the old layout root.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(widgets, function (widget) { widget.dispose(); });\n // Dispose of the base class.\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(DockLayout.prototype, \"spacing\", {\n /**\n * Get the inter-element spacing for the dock layout.\n */\n get: function () {\n return this._spacing;\n },\n /**\n * Set the inter-element spacing for the dock layout.\n */\n set: function (value) {\n value = Private$8.clampSpacing(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DockLayout.prototype, \"isEmpty\", {\n /**\n * Whether the dock layout is empty.\n */\n get: function () {\n return this._root === null;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Create an iterator over all widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n *\n * #### Notes\n * This iterator includes the generated tab bars.\n */\n DockLayout.prototype.iter = function () {\n return this._root ? this._root.iterAllWidgets() : (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Create an iterator over the user widgets in the layout.\n *\n * @returns A new iterator over the user widgets in the layout.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n DockLayout.prototype.widgets = function () {\n return this._root ? this._root.iterUserWidgets() : (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Create an iterator over the selected widgets in the layout.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the layout.\n */\n DockLayout.prototype.selectedWidgets = function () {\n return this._root ? this._root.iterSelectedWidgets() : (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Create an iterator over the tab bars in the layout.\n *\n * @returns A new iterator over the tab bars in the layout.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n DockLayout.prototype.tabBars = function () {\n return this._root ? this._root.iterTabBars() : (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Create an iterator over the handles in the layout.\n *\n * @returns A new iterator over the handles in the layout.\n */\n DockLayout.prototype.handles = function () {\n return this._root ? this._root.iterHandles() : (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Move a handle to the given offset position.\n *\n * @param handle - The handle to move.\n *\n * @param offsetX - The desired offset X position of the handle.\n *\n * @param offsetY - The desired offset Y position of the handle.\n *\n * #### Notes\n * If the given handle is not contained in the layout, this is no-op.\n *\n * The handle will be moved as close as possible to the desired\n * position without violating any of the layout constraints.\n *\n * Only one of the coordinates is used depending on the orientation\n * of the handle. This method accepts both coordinates to make it\n * easy to invoke from a mouse move event without needing to know\n * the handle orientation.\n */\n DockLayout.prototype.moveHandle = function (handle, offsetX, offsetY) {\n // Bail early if there is no root or if the handle is hidden.\n var hidden = handle.classList.contains('lm-mod-hidden');\n /* <DEPRECATED> */\n hidden = hidden || handle.classList.contains('p-mod-hidden');\n /* </DEPRECATED> */\n if (!this._root || hidden) {\n return;\n }\n // Lookup the split node for the handle.\n var data = this._root.findSplitNode(handle);\n if (!data) {\n return;\n }\n // Compute the desired delta movement for the handle.\n var delta;\n if (data.node.orientation === 'horizontal') {\n delta = offsetX - handle.offsetLeft;\n }\n else {\n delta = offsetY - handle.offsetTop;\n }\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n // Prevent sibling resizing unless needed.\n data.node.holdSizes();\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(data.node.sizers, data.index, delta);\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n };\n /**\n * Save the current configuration of the dock layout.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n DockLayout.prototype.saveLayout = function () {\n // Bail early if there is no root.\n if (!this._root) {\n return { main: null };\n }\n // Hold the current sizes in the layout tree.\n this._root.holdAllSizes();\n // Return the layout config.\n return { main: this._root.createConfig() };\n };\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n */\n DockLayout.prototype.restoreLayout = function (config) {\n var _this = this;\n // Create the widget set for validating the config.\n var widgetSet = new Set();\n // Normalize the main area config and collect the widgets.\n var mainConfig;\n if (config.main) {\n mainConfig = Private$8.normalizeAreaConfig(config.main, widgetSet);\n }\n else {\n mainConfig = null;\n }\n // Create iterators over the old content.\n var oldWidgets = this.widgets();\n var oldTabBars = this.tabBars();\n var oldHandles = this.handles();\n // Clear the root before removing the old content.\n this._root = null;\n // Unparent the old widgets which are not in the new config.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(oldWidgets, function (widget) {\n if (!widgetSet.has(widget)) {\n widget.parent = null;\n }\n });\n // Dispose of the old tab bars.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(oldTabBars, function (tabBar) {\n tabBar.dispose();\n });\n // Remove the old handles.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(oldHandles, function (handle) {\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n });\n // Reparent the new widgets to the current parent.\n widgetSet.forEach(function (widget) {\n widget.parent = _this.parent;\n });\n // Create the root node for the new config.\n if (mainConfig) {\n this._root = Private$8.realizeAreaConfig(mainConfig, {\n createTabBar: function () { return _this._createTabBar(); },\n createHandle: function () { return _this._createHandle(); }\n });\n }\n else {\n this._root = null;\n }\n // If there is no parent, there is nothing more to do.\n if (!this.parent) {\n return;\n }\n // Attach the new widgets to the parent.\n widgetSet.forEach(function (widget) {\n _this.attachWidget(widget);\n });\n // Post a fit request to the parent.\n this.parent.fit();\n };\n /**\n * Add a widget to the dock layout.\n *\n * @param widget - The widget to add to the dock layout.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * The widget will be moved if it is already contained in the layout.\n *\n * An error will be thrown if the reference widget is invalid.\n */\n DockLayout.prototype.addWidget = function (widget, options) {\n if (options === void 0) { options = {}; }\n // Parse the options.\n var ref = options.ref || null;\n var mode = options.mode || 'tab-after';\n // Find the tab node which holds the reference widget.\n var refNode = null;\n if (this._root && ref) {\n refNode = this._root.findTabNode(ref);\n }\n // Throw an error if the reference widget is invalid.\n if (ref && !refNode) {\n throw new Error('Reference widget is not in the layout.');\n }\n // Reparent the widget to the current layout parent.\n widget.parent = this.parent;\n // Insert the widget according to the insert mode.\n switch (mode) {\n case 'tab-after':\n this._insertTab(widget, ref, refNode, true);\n break;\n case 'tab-before':\n this._insertTab(widget, ref, refNode, false);\n break;\n case 'split-top':\n this._insertSplit(widget, ref, refNode, 'vertical', false);\n break;\n case 'split-left':\n this._insertSplit(widget, ref, refNode, 'horizontal', false);\n break;\n case 'split-right':\n this._insertSplit(widget, ref, refNode, 'horizontal', true);\n break;\n case 'split-bottom':\n this._insertSplit(widget, ref, refNode, 'vertical', true);\n break;\n }\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n // Ensure the widget is attached to the parent widget.\n this.attachWidget(widget);\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n DockLayout.prototype.removeWidget = function (widget) {\n // Remove the widget from its current layout location.\n this._removeWidget(widget);\n // Do nothing else if there is no parent widget.\n if (!this.parent) {\n return;\n }\n // Detach the widget from the parent widget.\n this.detachWidget(widget);\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * Find the tab area which contains the given client position.\n *\n * @param clientX - The client X position of interest.\n *\n * @param clientY - The client Y position of interest.\n *\n * @returns The geometry of the tab area at the given position, or\n * `null` if there is no tab area at the given position.\n */\n DockLayout.prototype.hitTestTabAreas = function (clientX, clientY) {\n // Bail early if hit testing cannot produce valid results.\n if (!this._root || !this.parent || !this.parent.isVisible) {\n return null;\n }\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n }\n // Convert from client to local coordinates.\n var rect = this.parent.node.getBoundingClientRect();\n var x = clientX - rect.left - this._box.borderLeft;\n var y = clientY - rect.top - this._box.borderTop;\n // Find the tab layout node at the local position.\n var tabNode = this._root.hitTestTabNodes(x, y);\n // Bail if a tab layout node was not found.\n if (!tabNode) {\n return null;\n }\n // Extract the data from the tab node.\n var tabBar = tabNode.tabBar, top = tabNode.top, left = tabNode.left, width = tabNode.width, height = tabNode.height;\n // Compute the right and bottom edges of the tab area.\n var borderWidth = this._box.borderLeft + this._box.borderRight;\n var borderHeight = this._box.borderTop + this._box.borderBottom;\n var right = rect.width - borderWidth - (left + width);\n var bottom = rect.height - borderHeight - (top + height);\n // Return the hit test results.\n return { tabBar: tabBar, x: x, y: y, top: top, left: left, right: right, bottom: bottom, width: width, height: height };\n };\n /**\n * Perform layout initialization which requires the parent widget.\n */\n DockLayout.prototype.init = function () {\n var _this = this;\n // Perform superclass initialization.\n _super.prototype.init.call(this);\n // Attach each widget to the parent.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) { _this.attachWidget(widget); });\n // Attach each handle to the parent.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this.handles(), function (handle) { _this.parent.node.appendChild(handle); });\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * Attach the widget to the layout parent widget.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a no-op if the widget is already attached.\n */\n DockLayout.prototype.attachWidget = function (widget) {\n // Do nothing if the widget is already attached.\n if (this.parent.node === widget.node.parentNode) {\n return;\n }\n // Create the layout item for the widget.\n this._items.set(widget, new LayoutItem(widget));\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n // Add the widget's node to the parent.\n this.parent.node.appendChild(widget.node);\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n };\n /**\n * Detach the widget from the layout parent widget.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a no-op if the widget is not attached.\n */\n DockLayout.prototype.detachWidget = function (widget) {\n // Do nothing if the widget is not attached.\n if (this.parent.node !== widget.node.parentNode) {\n return;\n }\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n // Remove the widget's node from the parent.\n this.parent.node.removeChild(widget.node);\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n // Delete the layout item for the widget.\n var item = this._items.get(widget);\n if (item) {\n this._items.delete(widget);\n item.dispose();\n }\n };\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n DockLayout.prototype.onBeforeShow = function (msg) {\n _super.prototype.onBeforeShow.call(this, msg);\n this.parent.update();\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n DockLayout.prototype.onBeforeAttach = function (msg) {\n _super.prototype.onBeforeAttach.call(this, msg);\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n DockLayout.prototype.onChildShown = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n DockLayout.prototype.onChildHidden = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'resize'` message.\n */\n DockLayout.prototype.onResize = function (msg) {\n if (this.parent.isVisible) {\n this._update(msg.width, msg.height);\n }\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n DockLayout.prototype.onUpdateRequest = function (msg) {\n if (this.parent.isVisible) {\n this._update(-1, -1);\n }\n };\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n DockLayout.prototype.onFitRequest = function (msg) {\n if (this.parent.isAttached) {\n this._fit();\n }\n };\n /**\n * Remove the specified widget from the layout structure.\n *\n * #### Notes\n * This is a no-op if the widget is not in the layout tree.\n *\n * This does not detach the widget from the parent node.\n */\n DockLayout.prototype._removeWidget = function (widget) {\n // Bail early if there is no layout root.\n if (!this._root) {\n return;\n }\n // Find the tab node which contains the given widget.\n var tabNode = this._root.findTabNode(widget);\n // Bail early if the tab node is not found.\n if (!tabNode) {\n return;\n }\n // If there are multiple tabs, just remove the widget's tab.\n if (tabNode.tabBar.titles.length > 1) {\n tabNode.tabBar.removeTab(widget.title);\n return;\n }\n // Otherwise, the tab node needs to be removed...\n // Dispose the tab bar.\n tabNode.tabBar.dispose();\n // Handle the case where the tab node is the root.\n if (this._root === tabNode) {\n this._root = null;\n return;\n }\n // Otherwise, remove the tab node from its parent...\n // Prevent widget resizing unless needed.\n this._root.holdAllSizes();\n // Clear the parent reference on the tab node.\n var splitNode = tabNode.parent;\n tabNode.parent = null;\n // Remove the tab node from its parent split node.\n var i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeFirstOf(splitNode.children, tabNode);\n var handle = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(splitNode.handles, i);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(splitNode.sizers, i);\n // Remove the handle from its parent DOM node.\n if (handle.parentNode) {\n handle.parentNode.removeChild(handle);\n }\n // If there are multiple children, just update the handles.\n if (splitNode.children.length > 1) {\n splitNode.syncHandles();\n return;\n }\n // Otherwise, the split node also needs to be removed...\n // Clear the parent reference on the split node.\n var maybeParent = splitNode.parent;\n splitNode.parent = null;\n // Lookup the remaining child node and handle.\n var childNode = splitNode.children[0];\n var childHandle = splitNode.handles[0];\n // Clear the split node data.\n splitNode.children.length = 0;\n splitNode.handles.length = 0;\n splitNode.sizers.length = 0;\n // Remove the child handle from its parent node.\n if (childHandle.parentNode) {\n childHandle.parentNode.removeChild(childHandle);\n }\n // Handle the case where the split node is the root.\n if (this._root === splitNode) {\n childNode.parent = null;\n this._root = childNode;\n return;\n }\n // Otherwise, move the child node to the parent node...\n var parentNode = maybeParent;\n // Lookup the index of the split node.\n var j = parentNode.children.indexOf(splitNode);\n // Handle the case where the child node is a tab node.\n if (childNode instanceof Private$8.TabLayoutNode) {\n childNode.parent = parentNode;\n parentNode.children[j] = childNode;\n return;\n }\n // Remove the split data from the parent.\n var splitHandle = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(parentNode.handles, j);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(parentNode.children, j);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(parentNode.sizers, j);\n // Remove the handle from its parent node.\n if (splitHandle.parentNode) {\n splitHandle.parentNode.removeChild(splitHandle);\n }\n // The child node and the split parent node will have the same\n // orientation. Merge the grand-children with the parent node.\n for (var i_1 = 0, n = childNode.children.length; i_1 < n; ++i_1) {\n var gChild = childNode.children[i_1];\n var gHandle = childNode.handles[i_1];\n var gSizer = childNode.sizers[i_1];\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(parentNode.children, j + i_1, gChild);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(parentNode.handles, j + i_1, gHandle);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(parentNode.sizers, j + i_1, gSizer);\n gChild.parent = parentNode;\n }\n // Clear the child node.\n childNode.children.length = 0;\n childNode.handles.length = 0;\n childNode.sizers.length = 0;\n childNode.parent = null;\n // Sync the handles on the parent node.\n parentNode.syncHandles();\n };\n /**\n * Insert a widget next to an existing tab.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n DockLayout.prototype._insertTab = function (widget, ref, refNode, after) {\n // Do nothing if the tab is inserted next to itself.\n if (widget === ref) {\n return;\n }\n // Create the root if it does not exist.\n if (!this._root) {\n var tabNode = new Private$8.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n this._root = tabNode;\n return;\n }\n // Use the first tab node as the ref node if needed.\n if (!refNode) {\n refNode = this._root.findFirstTabNode();\n }\n // If the widget is not contained in the ref node, ensure it is\n // removed from the layout and hidden before being added again.\n if (refNode.tabBar.titles.indexOf(widget.title) === -1) {\n this._removeWidget(widget);\n widget.hide();\n }\n // Lookup the target index for inserting the tab.\n var index;\n if (ref) {\n index = refNode.tabBar.titles.indexOf(ref.title);\n }\n else {\n index = refNode.tabBar.currentIndex;\n }\n // Insert the widget's tab relative to the target index.\n refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);\n };\n /**\n * Insert a widget as a new split area.\n *\n * #### Notes\n * This does not attach the widget to the parent widget.\n */\n DockLayout.prototype._insertSplit = function (widget, ref, refNode, orientation, after) {\n // Do nothing if there is no effective split.\n if (widget === ref && refNode && refNode.tabBar.titles.length === 1) {\n return;\n }\n // Ensure the widget is removed from the current layout.\n this._removeWidget(widget);\n // Create the tab layout node to hold the widget.\n var tabNode = new Private$8.TabLayoutNode(this._createTabBar());\n tabNode.tabBar.addTab(widget.title);\n // Set the root if it does not exist.\n if (!this._root) {\n this._root = tabNode;\n return;\n }\n // If the ref node parent is null, split the root.\n if (!refNode || !refNode.parent) {\n // Ensure the root is split with the correct orientation.\n var root = this._splitRoot(orientation);\n // Determine the insert index for the new tab node.\n var i_2 = after ? root.children.length : 0;\n // Normalize the split node.\n root.normalizeSizes();\n // Create the sizer for new tab node.\n var sizer = Private$8.createSizer(refNode ? 1 : Private$8.GOLDEN_RATIO);\n // Insert the tab node sized to the golden ratio.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(root.children, i_2, tabNode);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(root.sizers, i_2, sizer);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(root.handles, i_2, this._createHandle());\n tabNode.parent = root;\n // Re-normalize the split node to maintain the ratios.\n root.normalizeSizes();\n // Finally, synchronize the visibility of the handles.\n root.syncHandles();\n return;\n }\n // Lookup the split node for the ref widget.\n var splitNode = refNode.parent;\n // If the split node already had the correct orientation,\n // the widget can be inserted into the split node directly.\n if (splitNode.orientation === orientation) {\n // Find the index of the ref node.\n var i_3 = splitNode.children.indexOf(refNode);\n // Normalize the split node.\n splitNode.normalizeSizes();\n // Consume half the space for the insert location.\n var s = splitNode.sizers[i_3].sizeHint /= 2;\n // Insert the tab node sized to the other half.\n var j_1 = i_3 + (after ? 1 : 0);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(splitNode.children, j_1, tabNode);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(splitNode.sizers, j_1, Private$8.createSizer(s));\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(splitNode.handles, j_1, this._createHandle());\n tabNode.parent = splitNode;\n // Finally, synchronize the visibility of the handles.\n splitNode.syncHandles();\n return;\n }\n // Remove the ref node from the split node.\n var i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeFirstOf(splitNode.children, refNode);\n // Create a new normalized split node for the children.\n var childNode = new Private$8.SplitLayoutNode(orientation);\n childNode.normalized = true;\n // Add the ref node sized to half the space.\n childNode.children.push(refNode);\n childNode.sizers.push(Private$8.createSizer(0.5));\n childNode.handles.push(this._createHandle());\n refNode.parent = childNode;\n // Add the tab node sized to the other half.\n var j = after ? 1 : 0;\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(childNode.children, j, tabNode);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(childNode.sizers, j, Private$8.createSizer(0.5));\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(childNode.handles, j, this._createHandle());\n tabNode.parent = childNode;\n // Synchronize the visibility of the handles.\n childNode.syncHandles();\n // Finally, add the new child node to the original split node.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(splitNode.children, i, childNode);\n childNode.parent = splitNode;\n };\n /**\n * Ensure the root is a split node with the given orientation.\n */\n DockLayout.prototype._splitRoot = function (orientation) {\n // Bail early if the root already meets the requirements.\n var oldRoot = this._root;\n if (oldRoot instanceof Private$8.SplitLayoutNode) {\n if (oldRoot.orientation === orientation) {\n return oldRoot;\n }\n }\n // Create a new root node with the specified orientation.\n var newRoot = this._root = new Private$8.SplitLayoutNode(orientation);\n // Add the old root to the new root.\n if (oldRoot) {\n newRoot.children.push(oldRoot);\n newRoot.sizers.push(Private$8.createSizer(0));\n newRoot.handles.push(this._createHandle());\n oldRoot.parent = newRoot;\n }\n // Return the new root as a convenience.\n return newRoot;\n };\n /**\n * Fit the layout to the total size required by the widgets.\n */\n DockLayout.prototype._fit = function () {\n // Set up the computed minimum size.\n var minW = 0;\n var minH = 0;\n // Update the size limits for the layout tree.\n if (this._root) {\n var limits = this._root.fit(this._spacing, this._items);\n minW = limits.minWidth;\n minH = limits.minHeight;\n }\n // Update the box sizing and add it to the computed min size.\n var box = this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n minW += box.horizontalSum;\n minH += box.verticalSum;\n // Update the parent's min size constraints.\n var style = this.parent.node.style;\n style.minWidth = minW + \"px\";\n style.minHeight = minH + \"px\";\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent.parent) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest);\n }\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);\n }\n };\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n DockLayout.prototype._update = function (offsetWidth, offsetHeight) {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n // Bail early if there is no root layout node.\n if (!this._root) {\n return;\n }\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent.node.offsetHeight;\n }\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n }\n // Compute the actual layout bounds adjusted for border and padding.\n var x = this._box.paddingTop;\n var y = this._box.paddingLeft;\n var width = offsetWidth - this._box.horizontalSum;\n var height = offsetHeight - this._box.verticalSum;\n // Update the geometry of the layout tree.\n this._root.update(x, y, width, height, this._spacing, this._items);\n };\n /**\n * Create a new tab bar for use by the dock layout.\n *\n * #### Notes\n * The tab bar will be attached to the parent if it exists.\n */\n DockLayout.prototype._createTabBar = function () {\n // Create the tab bar using the renderer.\n var tabBar = this.renderer.createTabBar();\n // Enforce necessary tab bar behavior.\n tabBar.orientation = 'horizontal';\n // Reparent and attach the tab bar to the parent if possible.\n if (this.parent) {\n tabBar.parent = this.parent;\n this.attachWidget(tabBar);\n }\n // Return the initialized tab bar.\n return tabBar;\n };\n /**\n * Create a new handle for the dock layout.\n *\n * #### Notes\n * The handle will be attached to the parent if it exists.\n */\n DockLayout.prototype._createHandle = function () {\n // Create the handle using the renderer.\n var handle = this.renderer.createHandle();\n // Initialize the handle layout behavior.\n var style = handle.style;\n style.position = 'absolute';\n style.top = '0';\n style.left = '0';\n style.width = '0';\n style.height = '0';\n // Attach the handle to the parent if it exists.\n if (this.parent) {\n this.parent.node.appendChild(handle);\n }\n // Return the initialized handle.\n return handle;\n };\n return DockLayout;\n}(Layout));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$8;\n(function (Private) {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n Private.GOLDEN_RATIO = 0.618;\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n function clampSpacing(value) {\n return Math.max(0, Math.floor(value));\n }\n Private.clampSpacing = clampSpacing;\n /**\n * Create a box sizer with an initial size hint.\n */\n function createSizer(hint) {\n var sizer = new BoxSizer();\n sizer.sizeHint = hint;\n sizer.size = hint;\n return sizer;\n }\n Private.createSizer = createSizer;\n /**\n * Normalize an area config object and collect the visited widgets.\n */\n function normalizeAreaConfig(config, widgetSet) {\n var result;\n if (config.type === 'tab-area') {\n result = normalizeTabAreaConfig(config, widgetSet);\n }\n else {\n result = normalizeSplitAreaConfig(config, widgetSet);\n }\n return result;\n }\n Private.normalizeAreaConfig = normalizeAreaConfig;\n /**\n * Convert a normalized area config into a layout tree.\n */\n function realizeAreaConfig(config, renderer) {\n var node;\n if (config.type === 'tab-area') {\n node = realizeTabAreaConfig(config, renderer);\n }\n else {\n node = realizeSplitAreaConfig(config, renderer);\n }\n return node;\n }\n Private.realizeAreaConfig = realizeAreaConfig;\n /**\n * A layout node which holds the data for a tabbed area.\n */\n var TabLayoutNode = /** @class */ (function () {\n /**\n * Construct a new tab layout node.\n *\n * @param tabBar - The tab bar to use for the layout node.\n */\n function TabLayoutNode(tabBar) {\n /**\n * The parent of the layout node.\n */\n this.parent = null;\n this._top = 0;\n this._left = 0;\n this._width = 0;\n this._height = 0;\n var tabSizer = new BoxSizer();\n var widgetSizer = new BoxSizer();\n tabSizer.stretch = 0;\n widgetSizer.stretch = 1;\n this.tabBar = tabBar;\n this.sizers = [tabSizer, widgetSizer];\n }\n Object.defineProperty(TabLayoutNode.prototype, \"top\", {\n /**\n * The most recent value for the `top` edge of the layout box.\n */\n get: function () {\n return this._top;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabLayoutNode.prototype, \"left\", {\n /**\n * The most recent value for the `left` edge of the layout box.\n */\n get: function () {\n return this._left;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabLayoutNode.prototype, \"width\", {\n /**\n * The most recent value for the `width` of the layout box.\n */\n get: function () {\n return this._width;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabLayoutNode.prototype, \"height\", {\n /**\n * The most recent value for the `height` of the layout box.\n */\n get: function () {\n return this._height;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n TabLayoutNode.prototype.iterAllWidgets = function () {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.chain)((0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.once)(this.tabBar), this.iterUserWidgets());\n };\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n TabLayoutNode.prototype.iterUserWidgets = function () {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.map)(this.tabBar.titles, function (title) { return title.owner; });\n };\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n TabLayoutNode.prototype.iterSelectedWidgets = function () {\n var title = this.tabBar.currentTitle;\n return title ? (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.once)(title.owner) : (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n TabLayoutNode.prototype.iterTabBars = function () {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.once)(this.tabBar);\n };\n /**\n * Create an iterator for the handles in the layout tree.\n */\n TabLayoutNode.prototype.iterHandles = function () {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Find the tab layout node which contains the given widget.\n */\n TabLayoutNode.prototype.findTabNode = function (widget) {\n return this.tabBar.titles.indexOf(widget.title) !== -1 ? this : null;\n };\n /**\n * Find the split layout node which contains the given handle.\n */\n TabLayoutNode.prototype.findSplitNode = function (handle) {\n return null;\n };\n /**\n * Find the first tab layout node in a layout tree.\n */\n TabLayoutNode.prototype.findFirstTabNode = function () {\n return this;\n };\n /**\n * Find the tab layout node which contains the local point.\n */\n TabLayoutNode.prototype.hitTestTabNodes = function (x, y) {\n if (x < this._left || x >= this._left + this._width) {\n return null;\n }\n if (y < this._top || y >= this._top + this._height) {\n return null;\n }\n return this;\n };\n /**\n * Create a configuration object for the layout tree.\n */\n TabLayoutNode.prototype.createConfig = function () {\n var widgets = this.tabBar.titles.map(function (title) { return title.owner; });\n var currentIndex = this.tabBar.currentIndex;\n return { type: 'tab-area', widgets: widgets, currentIndex: currentIndex };\n };\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n TabLayoutNode.prototype.holdAllSizes = function () {\n return;\n };\n /**\n * Fit the layout tree.\n */\n TabLayoutNode.prototype.fit = function (spacing, items) {\n // Set up the limit variables.\n var minWidth = 0;\n var minHeight = 0;\n var maxWidth = Infinity;\n var maxHeight = Infinity;\n // Lookup the tab bar layout item.\n var tabBarItem = items.get(this.tabBar);\n // Lookup the widget layout item.\n var current = this.tabBar.currentTitle;\n var widgetItem = current ? items.get(current.owner) : undefined;\n // Lookup the tab bar and widget sizers.\n var _a = this.sizers, tabBarSizer = _a[0], widgetSizer = _a[1];\n // Update the tab bar limits.\n if (tabBarItem) {\n tabBarItem.fit();\n }\n // Update the widget limits.\n if (widgetItem) {\n widgetItem.fit();\n }\n // Update the results and sizer for the tab bar.\n if (tabBarItem && !tabBarItem.isHidden) {\n minWidth = Math.max(minWidth, tabBarItem.minWidth);\n minHeight += tabBarItem.minHeight;\n tabBarSizer.minSize = tabBarItem.minHeight;\n tabBarSizer.maxSize = tabBarItem.maxHeight;\n }\n else {\n tabBarSizer.minSize = 0;\n tabBarSizer.maxSize = 0;\n }\n // Update the results and sizer for the current widget.\n if (widgetItem && !widgetItem.isHidden) {\n minWidth = Math.max(minWidth, widgetItem.minWidth);\n minHeight += widgetItem.minHeight;\n widgetSizer.minSize = widgetItem.minHeight;\n widgetSizer.maxSize = Infinity;\n }\n else {\n widgetSizer.minSize = 0;\n widgetSizer.maxSize = Infinity;\n }\n // Return the computed size limits for the layout node.\n return { minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight };\n };\n /**\n * Update the layout tree.\n */\n TabLayoutNode.prototype.update = function (left, top, width, height, spacing, items) {\n // Update the layout box values.\n this._top = top;\n this._left = left;\n this._width = width;\n this._height = height;\n // Lookup the tab bar layout item.\n var tabBarItem = items.get(this.tabBar);\n // Lookup the widget layout item.\n var current = this.tabBar.currentTitle;\n var widgetItem = current ? items.get(current.owner) : undefined;\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, height);\n // Update the tab bar item using the computed size.\n if (tabBarItem && !tabBarItem.isHidden) {\n var size = this.sizers[0].size;\n tabBarItem.update(left, top, width, size);\n top += size;\n }\n // Layout the widget using the computed size.\n if (widgetItem && !widgetItem.isHidden) {\n var size = this.sizers[1].size;\n widgetItem.update(left, top, width, size);\n }\n };\n return TabLayoutNode;\n }());\n Private.TabLayoutNode = TabLayoutNode;\n /**\n * A layout node which holds the data for a split area.\n */\n var SplitLayoutNode = /** @class */ (function () {\n /**\n * Construct a new split layout node.\n *\n * @param orientation - The orientation of the node.\n */\n function SplitLayoutNode(orientation) {\n /**\n * The parent of the layout node.\n */\n this.parent = null;\n /**\n * Whether the sizers have been normalized.\n */\n this.normalized = false;\n /**\n * The child nodes for the split node.\n */\n this.children = [];\n /**\n * The box sizers for the layout children.\n */\n this.sizers = [];\n /**\n * The handles for the layout children.\n */\n this.handles = [];\n this.orientation = orientation;\n }\n /**\n * Create an iterator for all widgets in the layout tree.\n */\n SplitLayoutNode.prototype.iterAllWidgets = function () {\n var children = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.map)(this.children, function (child) { return child.iterAllWidgets(); });\n return new _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ChainIterator(children);\n };\n /**\n * Create an iterator for the user widgets in the layout tree.\n */\n SplitLayoutNode.prototype.iterUserWidgets = function () {\n var children = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.map)(this.children, function (child) { return child.iterUserWidgets(); });\n return new _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ChainIterator(children);\n };\n /**\n * Create an iterator for the selected widgets in the layout tree.\n */\n SplitLayoutNode.prototype.iterSelectedWidgets = function () {\n var children = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.map)(this.children, function (child) { return child.iterSelectedWidgets(); });\n return new _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ChainIterator(children);\n };\n /**\n * Create an iterator for the tab bars in the layout tree.\n */\n SplitLayoutNode.prototype.iterTabBars = function () {\n var children = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.map)(this.children, function (child) { return child.iterTabBars(); });\n return new _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ChainIterator(children);\n };\n /**\n * Create an iterator for the handles in the layout tree.\n */\n SplitLayoutNode.prototype.iterHandles = function () {\n var children = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.map)(this.children, function (child) { return child.iterHandles(); });\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.chain)(this.handles, new _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ChainIterator(children));\n };\n /**\n * Find the tab layout node which contains the given widget.\n */\n SplitLayoutNode.prototype.findTabNode = function (widget) {\n for (var i = 0, n = this.children.length; i < n; ++i) {\n var result = this.children[i].findTabNode(widget);\n if (result) {\n return result;\n }\n }\n return null;\n };\n /**\n * Find the split layout node which contains the given handle.\n */\n SplitLayoutNode.prototype.findSplitNode = function (handle) {\n var index = this.handles.indexOf(handle);\n if (index !== -1) {\n return { index: index, node: this };\n }\n for (var i = 0, n = this.children.length; i < n; ++i) {\n var result = this.children[i].findSplitNode(handle);\n if (result) {\n return result;\n }\n }\n return null;\n };\n /**\n * Find the first tab layout node in a layout tree.\n */\n SplitLayoutNode.prototype.findFirstTabNode = function () {\n if (this.children.length === 0) {\n return null;\n }\n return this.children[0].findFirstTabNode();\n };\n /**\n * Find the tab layout node which contains the local point.\n */\n SplitLayoutNode.prototype.hitTestTabNodes = function (x, y) {\n for (var i = 0, n = this.children.length; i < n; ++i) {\n var result = this.children[i].hitTestTabNodes(x, y);\n if (result) {\n return result;\n }\n }\n return null;\n };\n /**\n * Create a configuration object for the layout tree.\n */\n SplitLayoutNode.prototype.createConfig = function () {\n var orientation = this.orientation;\n var sizes = this.createNormalizedSizes();\n var children = this.children.map(function (child) { return child.createConfig(); });\n return { type: 'split-area', orientation: orientation, children: children, sizes: sizes };\n };\n /**\n * Sync the visibility and orientation of the handles.\n */\n SplitLayoutNode.prototype.syncHandles = function () {\n var _this = this;\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this.handles, function (handle, i) {\n handle.setAttribute('data-orientation', _this.orientation);\n if (i === _this.handles.length - 1) {\n handle.classList.add('lm-mod-hidden');\n /* <DEPRECATED> */\n handle.classList.add('p-mod-hidden');\n /* </DEPRECATED> */\n }\n else {\n handle.classList.remove('lm-mod-hidden');\n /* <DEPRECATED> */\n handle.classList.remove('p-mod-hidden');\n /* </DEPRECATED> */\n }\n });\n };\n /**\n * Hold the current sizes of the box sizers.\n *\n * This sets the size hint of each sizer to its current size.\n */\n SplitLayoutNode.prototype.holdSizes = function () {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this.sizers, function (sizer) { sizer.sizeHint = sizer.size; });\n };\n /**\n * Recursively hold all of the sizes in the layout tree.\n *\n * This ignores the sizers of tab layout nodes.\n */\n SplitLayoutNode.prototype.holdAllSizes = function () {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this.children, function (child) { return child.holdAllSizes(); });\n this.holdSizes();\n };\n /**\n * Normalize the sizes of the split layout node.\n */\n SplitLayoutNode.prototype.normalizeSizes = function () {\n // Bail early if the sizers are empty.\n var n = this.sizers.length;\n if (n === 0) {\n return;\n }\n // Hold the current sizes of the sizers.\n this.holdSizes();\n // Compute the sum of the sizes.\n var sum = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.reduce)(this.sizers, function (v, sizer) { return v + sizer.sizeHint; }, 0);\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this.sizers, function (sizer) {\n sizer.size = sizer.sizeHint = 1 / n;\n });\n }\n else {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this.sizers, function (sizer) {\n sizer.size = sizer.sizeHint /= sum;\n });\n }\n // Mark the sizes as normalized.\n this.normalized = true;\n };\n /**\n * Snap the normalized sizes of the split layout node.\n */\n SplitLayoutNode.prototype.createNormalizedSizes = function () {\n // Bail early if the sizers are empty.\n var n = this.sizers.length;\n if (n === 0) {\n return [];\n }\n // Grab the current sizes of the sizers.\n var sizes = this.sizers.map(function (sizer) { return sizer.size; });\n // Compute the sum of the sizes.\n var sum = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.reduce)(sizes, function (v, size) { return v + size; }, 0);\n // Normalize the sizes based on the sum.\n if (sum === 0) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(sizes, function (size, i) { sizes[i] = 1 / n; });\n }\n else {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(sizes, function (size, i) { sizes[i] = size / sum; });\n }\n // Return the normalized sizes.\n return sizes;\n };\n /**\n * Fit the layout tree.\n */\n SplitLayoutNode.prototype.fit = function (spacing, items) {\n // Compute the required fixed space.\n var horizontal = this.orientation === 'horizontal';\n var fixed = Math.max(0, this.children.length - 1) * spacing;\n // Set up the limit variables.\n var minWidth = horizontal ? fixed : 0;\n var minHeight = horizontal ? 0 : fixed;\n var maxWidth = Infinity;\n var maxHeight = Infinity;\n // Fit the children and update the limits.\n for (var i = 0, n = this.children.length; i < n; ++i) {\n var limits = this.children[i].fit(spacing, items);\n if (horizontal) {\n minHeight = Math.max(minHeight, limits.minHeight);\n minWidth += limits.minWidth;\n this.sizers[i].minSize = limits.minWidth;\n }\n else {\n minWidth = Math.max(minWidth, limits.minWidth);\n minHeight += limits.minHeight;\n this.sizers[i].minSize = limits.minHeight;\n }\n }\n // Return the computed limits for the layout node.\n return { minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight };\n };\n /**\n * Update the layout tree.\n */\n SplitLayoutNode.prototype.update = function (left, top, width, height, spacing, items) {\n // Compute the available layout space.\n var horizontal = this.orientation === 'horizontal';\n var fixed = Math.max(0, this.children.length - 1) * spacing;\n var space = Math.max(0, (horizontal ? width : height) - fixed);\n // De-normalize the sizes if needed.\n if (this.normalized) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this.sizers, function (sizer) { sizer.sizeHint *= space; });\n this.normalized = false;\n }\n // Distribute the layout space to the sizers.\n BoxEngine.calc(this.sizers, space);\n // Update the geometry of the child nodes and handles.\n for (var i = 0, n = this.children.length; i < n; ++i) {\n var child = this.children[i];\n var size = this.sizers[i].size;\n var handleStyle = this.handles[i].style;\n if (horizontal) {\n child.update(left, top, size, height, spacing, items);\n left += size;\n handleStyle.top = top + \"px\";\n handleStyle.left = left + \"px\";\n handleStyle.width = spacing + \"px\";\n handleStyle.height = height + \"px\";\n left += spacing;\n }\n else {\n child.update(left, top, width, size, spacing, items);\n top += size;\n handleStyle.top = top + \"px\";\n handleStyle.left = left + \"px\";\n handleStyle.width = width + \"px\";\n handleStyle.height = spacing + \"px\";\n top += spacing;\n }\n }\n };\n return SplitLayoutNode;\n }());\n Private.SplitLayoutNode = SplitLayoutNode;\n /**\n * Normalize a tab area config and collect the visited widgets.\n */\n function normalizeTabAreaConfig(config, widgetSet) {\n // Bail early if there is no content.\n if (config.widgets.length === 0) {\n return null;\n }\n // Setup the filtered widgets array.\n var widgets = [];\n // Filter the config for unique widgets.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(config.widgets, function (widget) {\n if (!widgetSet.has(widget)) {\n widgetSet.add(widget);\n widgets.push(widget);\n }\n });\n // Bail if there are no effective widgets.\n if (widgets.length === 0) {\n return null;\n }\n // Normalize the current index.\n var index = config.currentIndex;\n if (index !== -1 && (index < 0 || index >= widgets.length)) {\n index = 0;\n }\n // Return a normalized config object.\n return { type: 'tab-area', widgets: widgets, currentIndex: index };\n }\n /**\n * Normalize a split area config and collect the visited widgets.\n */\n function normalizeSplitAreaConfig(config, widgetSet) {\n // Set up the result variables.\n var orientation = config.orientation;\n var children = [];\n var sizes = [];\n // Normalize the config children.\n for (var i = 0, n = config.children.length; i < n; ++i) {\n // Normalize the child config.\n var child = normalizeAreaConfig(config.children[i], widgetSet);\n // Ignore an empty child.\n if (!child) {\n continue;\n }\n // Add the child or hoist its content as appropriate.\n if (child.type === 'tab-area' || child.orientation !== orientation) {\n children.push(child);\n sizes.push(Math.abs(config.sizes[i] || 0));\n }\n else {\n children.push.apply(children, child.children);\n sizes.push.apply(sizes, child.sizes);\n }\n }\n // Bail if there are no effective children.\n if (children.length === 0) {\n return null;\n }\n // If there is only one effective child, return that child.\n if (children.length === 1) {\n return children[0];\n }\n // Return a normalized config object.\n return { type: 'split-area', orientation: orientation, children: children, sizes: sizes };\n }\n /**\n * Convert a normalized tab area config into a layout tree.\n */\n function realizeTabAreaConfig(config, renderer) {\n // Create the tab bar for the layout node.\n var tabBar = renderer.createTabBar();\n // Hide each widget and add it to the tab bar.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(config.widgets, function (widget) {\n widget.hide();\n tabBar.addTab(widget.title);\n });\n // Set the current index of the tab bar.\n tabBar.currentIndex = config.currentIndex;\n // Return the new tab layout node.\n return new TabLayoutNode(tabBar);\n }\n /**\n * Convert a normalized split area config into a layout tree.\n */\n function realizeSplitAreaConfig(config, renderer) {\n // Create the split layout node.\n var node = new SplitLayoutNode(config.orientation);\n // Add each child to the layout node.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(config.children, function (child, i) {\n // Create the child data for the layout node.\n var childNode = realizeAreaConfig(child, renderer);\n var sizer = createSizer(config.sizes[i]);\n var handle = renderer.createHandle();\n // Add the child data to the layout node.\n node.children.push(childNode);\n node.handles.push(handle);\n node.sizers.push(sizer);\n // Update the parent for the child node.\n childNode.parent = node;\n });\n // Synchronize the handle state for the layout node.\n node.syncHandles();\n // Normalize the sizes for the layout node.\n node.normalizeSizes();\n // Return the new layout node.\n return node;\n }\n})(Private$8 || (Private$8 = {}));\n\n/**\n * A widget which displays titles as a single row or column of tabs.\n *\n * #### Notes\n * If CSS transforms are used to rotate nodes for vertically oriented\n * text, then tab dragging will not work correctly. The `tabsMovable`\n * property should be set to `false` when rotating nodes from CSS.\n */\nvar TabBar = /** @class */ (function (_super) {\n __extends(TabBar, _super);\n /**\n * Construct a new tab bar.\n *\n * @param options - The options for initializing the tab bar.\n */\n function TabBar(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, { node: Private$9.createNode() }) || this;\n _this._currentIndex = -1;\n _this._titles = [];\n _this._titlesEditable = false;\n _this._previousTitle = null;\n _this._dragData = null;\n _this._tabMoved = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this._currentChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this._tabCloseRequested = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this._tabDetachRequested = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this._tabActivateRequested = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this.addClass('lm-TabBar');\n /* <DEPRECATED> */\n _this.addClass('p-TabBar');\n /* </DEPRECATED> */\n _this.setFlag(Widget.Flag.DisallowLayout);\n _this.tabsMovable = options.tabsMovable || false;\n _this.titlesEditable = options.titlesEditable || false;\n _this.allowDeselect = options.allowDeselect || false;\n _this.insertBehavior = options.insertBehavior || 'select-tab-if-needed';\n _this.removeBehavior = options.removeBehavior || 'select-tab-after';\n _this.renderer = options.renderer || TabBar.defaultRenderer;\n _this._orientation = options.orientation || 'horizontal';\n _this.dataset['orientation'] = _this._orientation;\n return _this;\n }\n /**\n * Dispose of the resources held by the widget.\n */\n TabBar.prototype.dispose = function () {\n this._releaseMouse();\n this._titles.length = 0;\n this._previousTitle = null;\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(TabBar.prototype, \"currentChanged\", {\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get: function () {\n return this._currentChanged;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"tabMoved\", {\n /**\n * A signal emitted when a tab is moved by the user.\n *\n * #### Notes\n * This signal is emitted when a tab is moved by user interaction.\n *\n * This signal is not emitted when a tab is moved programmatically.\n */\n get: function () {\n return this._tabMoved;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"tabActivateRequested\", {\n /**\n * A signal emitted when a tab is clicked by the user.\n *\n * #### Notes\n * If the clicked tab is not the current tab, the clicked tab will be\n * made current and the `currentChanged` signal will be emitted first.\n *\n * This signal is emitted even if the clicked tab is the current tab.\n */\n get: function () {\n return this._tabActivateRequested;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"tabCloseRequested\", {\n /**\n * A signal emitted when a tab close icon is clicked.\n *\n * #### Notes\n * This signal is not emitted unless the tab title is `closable`.\n */\n get: function () {\n return this._tabCloseRequested;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"tabDetachRequested\", {\n /**\n * A signal emitted when a tab is dragged beyond the detach threshold.\n *\n * #### Notes\n * This signal is emitted when the user drags a tab with the mouse,\n * and mouse is dragged beyond the detach threshold.\n *\n * The consumer of the signal should call `releaseMouse` and remove\n * the tab in order to complete the detach.\n *\n * This signal is only emitted once per drag cycle.\n */\n get: function () {\n return this._tabDetachRequested;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"titlesEditable\", {\n /**\n * Whether the titles can be user-edited.\n *\n */\n get: function () {\n return this._titlesEditable;\n },\n /**\n * Set whether titles can be user edited.\n *\n */\n set: function (value) {\n this._titlesEditable = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"currentTitle\", {\n /**\n * Get the currently selected title.\n *\n * #### Notes\n * This will be `null` if no tab is selected.\n */\n get: function () {\n return this._titles[this._currentIndex] || null;\n },\n /**\n * Set the currently selected title.\n *\n * #### Notes\n * If the title does not exist, the title will be set to `null`.\n */\n set: function (value) {\n this.currentIndex = value ? this._titles.indexOf(value) : -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"currentIndex\", {\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get: function () {\n return this._currentIndex;\n },\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the value is out of range, the index will be set to `-1`.\n */\n set: function (value) {\n // Adjust for an out of range index.\n if (value < 0 || value >= this._titles.length) {\n value = -1;\n }\n // Bail early if the index will not change.\n if (this._currentIndex === value) {\n return;\n }\n // Look up the previous index and title.\n var pi = this._currentIndex;\n var pt = this._titles[pi] || null;\n // Look up the current index and title.\n var ci = value;\n var ct = this._titles[ci] || null;\n // Update the current index and previous title.\n this._currentIndex = ci;\n this._previousTitle = pt;\n // Schedule an update of the tabs.\n this.update();\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi, previousTitle: pt,\n currentIndex: ci, currentTitle: ct\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"orientation\", {\n /**\n * Get the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n get: function () {\n return this._orientation;\n },\n /**\n * Set the orientation of the tab bar.\n *\n * #### Notes\n * This controls whether the tabs are arranged in a row or column.\n */\n set: function (value) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n // Release the mouse before making any changes.\n this._releaseMouse();\n // Toggle the orientation values.\n this._orientation = value;\n this.dataset['orientation'] = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"titles\", {\n /**\n * A read-only array of the titles in the tab bar.\n */\n get: function () {\n return this._titles;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabBar.prototype, \"contentNode\", {\n /**\n * The tab bar content node.\n *\n * #### Notes\n * This is the node which holds the tab nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-TabBar-content')[0];\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add a tab to the end of the tab bar.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * If the title is already added to the tab bar, it will be moved.\n */\n TabBar.prototype.addTab = function (value) {\n return this.insertTab(this._titles.length, value);\n };\n /**\n * Insert a tab into the tab bar at the specified index.\n *\n * @param index - The index at which to insert the tab.\n *\n * @param value - The title which holds the data for the tab,\n * or an options object to convert to a title.\n *\n * @returns The title object added to the tab bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the tabs.\n *\n * If the title is already added to the tab bar, it will be moved.\n */\n TabBar.prototype.insertTab = function (index, value) {\n // Release the mouse before making any changes.\n this._releaseMouse();\n // Coerce the value to a title.\n var title = Private$9.asTitle(value);\n // Look up the index of the title.\n var i = this._titles.indexOf(title);\n // Clamp the insert index to the array bounds.\n var j = Math.max(0, Math.min(index, this._titles.length));\n // If the title is not in the array, insert it.\n if (i === -1) {\n // Insert the title into the array.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._titles, j, title);\n // Connect to the title changed signal.\n title.changed.connect(this._onTitleChanged, this);\n // Schedule an update of the tabs.\n this.update();\n // Adjust the current index for the insert.\n this._adjustCurrentForInsert(j, title);\n // Return the title added to the tab bar.\n return title;\n }\n // Otherwise, the title exists in the array and should be moved.\n // Adjust the index if the location is at the end of the array.\n if (j === this._titles.length) {\n j--;\n }\n // Bail if there is no effective move.\n if (i === j) {\n return title;\n }\n // Move the title to the new location.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._titles, i, j);\n // Schedule an update of the tabs.\n this.update();\n // Adjust the current index for the move.\n this._adjustCurrentForMove(i, j);\n // Return the title added to the tab bar.\n return title;\n };\n /**\n * Remove a tab from the tab bar.\n *\n * @param title - The title for the tab to remove.\n *\n * #### Notes\n * This is a no-op if the title is not in the tab bar.\n */\n TabBar.prototype.removeTab = function (title) {\n this.removeTabAt(this._titles.indexOf(title));\n };\n /**\n * Remove the tab at a given index from the tab bar.\n *\n * @param index - The index of the tab to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n TabBar.prototype.removeTabAt = function (index) {\n // Release the mouse before making any changes.\n this._releaseMouse();\n // Remove the title from the array.\n var title = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._titles, index);\n // Bail if the index is out of range.\n if (!title) {\n return;\n }\n // Disconnect from the title changed signal.\n title.changed.disconnect(this._onTitleChanged, this);\n // Clear the previous title if it's being removed.\n if (title === this._previousTitle) {\n this._previousTitle = null;\n }\n // Schedule an update of the tabs.\n this.update();\n // Adjust the current index for the remove.\n this._adjustCurrentForRemove(index, title);\n };\n /**\n * Remove all tabs from the tab bar.\n */\n TabBar.prototype.clearTabs = function () {\n // Bail if there is nothing to remove.\n if (this._titles.length === 0) {\n return;\n }\n // Release the mouse before making any changes.\n this._releaseMouse();\n // Disconnect from the title changed signals.\n for (var _i = 0, _a = this._titles; _i < _a.length; _i++) {\n var title = _a[_i];\n title.changed.disconnect(this._onTitleChanged, this);\n }\n // Get the current index and title.\n var pi = this.currentIndex;\n var pt = this.currentTitle;\n // Reset the current index and previous title.\n this._currentIndex = -1;\n this._previousTitle = null;\n // Clear the title array.\n this._titles.length = 0;\n // Schedule an update of the tabs.\n this.update();\n // If no tab was selected, there's nothing else to do.\n if (pi === -1) {\n return;\n }\n // Emit the current changed signal.\n this._currentChanged.emit({\n previousIndex: pi, previousTitle: pt,\n currentIndex: -1, currentTitle: null\n });\n };\n /**\n * Release the mouse and restore the non-dragged tab positions.\n *\n * #### Notes\n * This will cause the tab bar to stop handling mouse events and to\n * restore the tabs to their non-dragged positions.\n */\n TabBar.prototype.releaseMouse = function () {\n this._releaseMouse();\n };\n /**\n * Handle the DOM events for the tab bar.\n *\n * @param event - The DOM event sent to the tab bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tab bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n TabBar.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event);\n break;\n case 'mousemove':\n this._evtMouseMove(event);\n break;\n case 'mouseup':\n this._evtMouseUp(event);\n break;\n case 'dblclick':\n this._evtDblClick(event);\n break;\n case 'keydown':\n this._evtKeyDown(event);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n TabBar.prototype.onBeforeAttach = function (msg) {\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('dblclick', this);\n };\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n TabBar.prototype.onAfterDetach = function (msg) {\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('dblclick', this);\n this._releaseMouse();\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n TabBar.prototype.onUpdateRequest = function (msg) {\n var titles = this._titles;\n var renderer = this.renderer;\n var currentTitle = this.currentTitle;\n var content = new Array(titles.length);\n for (var i = 0, n = titles.length; i < n; ++i) {\n var title = titles[i];\n var current = title === currentTitle;\n var zIndex = current ? n : n - i - 1;\n content[i] = renderer.renderTab({ title: title, current: current, zIndex: zIndex });\n }\n _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.VirtualDOM.render(content, this.contentNode);\n };\n /**\n * Handle the `'dblclick'` event for the tab bar.\n */\n TabBar.prototype._evtDblClick = function (event) {\n // Do nothing if titles are not editable\n if (!this.titlesEditable) {\n return;\n }\n var tabs = this.contentNode.children;\n // Find the index of the released tab.\n var index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(tabs, function (tab) {\n return _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n var title = this.titles[index];\n var label = tabs[index].querySelector('.lm-TabBar-tabLabel');\n if (label && label.contains(event.target)) {\n var value = title.label || '';\n // Clear the label element\n var oldValue_1 = label.innerHTML;\n label.innerHTML = \"\";\n var input_1 = document.createElement('input');\n input_1.classList.add('lm-TabBar-tabInput');\n input_1.value = value;\n label.appendChild(input_1);\n var onblur_1 = function () {\n input_1.removeEventListener('blur', onblur_1);\n label.innerHTML = oldValue_1;\n };\n input_1.addEventListener('dblclick', function (event) { return event.stopPropagation(); });\n input_1.addEventListener('blur', onblur_1);\n input_1.addEventListener('keydown', function (event) {\n if (event.key === 'Enter') {\n if (input_1.value !== '') {\n title.label = title.caption = input_1.value;\n }\n onblur_1();\n }\n else if (event.key === 'Escape') {\n onblur_1();\n }\n });\n input_1.select();\n input_1.focus();\n if (label.children.length > 0) {\n label.children[0].focus();\n }\n }\n };\n /**\n * Handle the `'keydown'` event for the tab bar.\n */\n TabBar.prototype._evtKeyDown = function (event) {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n };\n /**\n * Handle the `'mousedown'` event for the tab bar.\n */\n TabBar.prototype._evtMouseDown = function (event) {\n // Do nothing if it's not a left or middle mouse press.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n // Do nothing if a drag is in progress.\n if (this._dragData) {\n return;\n }\n // Lookup the tab nodes.\n var tabs = this.contentNode.children;\n // Find the index of the pressed tab.\n var index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(tabs, function (tab) {\n return _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n // Do nothing if the press is not on a tab.\n if (index === -1) {\n return;\n }\n // Pressing on a tab stops the event propagation.\n event.preventDefault();\n event.stopPropagation();\n // Initialize the non-measured parts of the drag data.\n this._dragData = {\n tab: tabs[index],\n index: index,\n pressX: event.clientX,\n pressY: event.clientY,\n tabPos: -1,\n tabSize: -1,\n tabPressPos: -1,\n targetIndex: -1,\n tabLayout: null,\n contentRect: null,\n override: null,\n dragActive: false,\n dragAborted: false,\n detachRequested: false\n };\n // Add the document mouse up listener.\n document.addEventListener('mouseup', this, true);\n // Do nothing else if the middle button is clicked.\n if (event.button === 1) {\n return;\n }\n // Do nothing else if the close icon is clicked.\n var icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target)) {\n return;\n }\n // Add the extra listeners if the tabs are movable.\n if (this.tabsMovable) {\n document.addEventListener('mousemove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n }\n // Update the current index as appropriate.\n if (this.allowDeselect && this.currentIndex === index) {\n this.currentIndex = -1;\n }\n else {\n this.currentIndex = index;\n }\n // Do nothing else if there is no current tab.\n if (this.currentIndex === -1) {\n return;\n }\n // Emit the tab activate request signal.\n this._tabActivateRequested.emit({\n index: this.currentIndex, title: this.currentTitle\n });\n };\n /**\n * Handle the `'mousemove'` event for the tab bar.\n */\n TabBar.prototype._evtMouseMove = function (event) {\n // Do nothing if no drag is in progress.\n var data = this._dragData;\n if (!data) {\n return;\n }\n // Suppress the event during a drag.\n event.preventDefault();\n event.stopPropagation();\n // Lookup the tab nodes.\n var tabs = this.contentNode.children;\n // Bail early if the drag threshold has not been met.\n if (!data.dragActive && !Private$9.dragExceeded(data, event)) {\n return;\n }\n // Activate the drag if necessary.\n if (!data.dragActive) {\n // Fill in the rest of the drag data measurements.\n var tabRect = data.tab.getBoundingClientRect();\n if (this._orientation === 'horizontal') {\n data.tabPos = data.tab.offsetLeft;\n data.tabSize = tabRect.width;\n data.tabPressPos = data.pressX - tabRect.left;\n }\n else {\n data.tabPos = data.tab.offsetTop;\n data.tabSize = tabRect.height;\n data.tabPressPos = data.pressY - tabRect.top;\n }\n data.tabLayout = Private$9.snapTabLayout(tabs, this._orientation);\n data.contentRect = this.contentNode.getBoundingClientRect();\n data.override = _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_10__.Drag.overrideCursor('default');\n // Add the dragging style classes.\n data.tab.classList.add('lm-mod-dragging');\n this.addClass('lm-mod-dragging');\n /* <DEPRECATED> */\n data.tab.classList.add('p-mod-dragging');\n this.addClass('p-mod-dragging');\n /* </DEPRECATED> */\n // Mark the drag as active.\n data.dragActive = true;\n }\n // Emit the detach requested signal if the threshold is exceeded.\n if (!data.detachRequested && Private$9.detachExceeded(data, event)) {\n // Only emit the signal once per drag cycle.\n data.detachRequested = true;\n // Setup the arguments for the signal.\n var index = data.index;\n var clientX = event.clientX;\n var clientY = event.clientY;\n var tab = tabs[index];\n var title = this._titles[index];\n // Emit the tab detach requested signal.\n this._tabDetachRequested.emit({ index: index, title: title, tab: tab, clientX: clientX, clientY: clientY });\n // Bail if the signal handler aborted the drag.\n if (data.dragAborted) {\n return;\n }\n }\n // Update the positions of the tabs.\n Private$9.layoutTabs(tabs, data, event, this._orientation);\n };\n /**\n * Handle the `'mouseup'` event for the document.\n */\n TabBar.prototype._evtMouseUp = function (event) {\n var _this = this;\n // Do nothing if it's not a left or middle mouse release.\n if (event.button !== 0 && event.button !== 1) {\n return;\n }\n // Do nothing if no drag is in progress.\n var data = this._dragData;\n if (!data) {\n return;\n }\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n // Remove the extra mouse event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n // Handle a release when the drag is not active.\n if (!data.dragActive) {\n // Clear the drag data.\n this._dragData = null;\n // Lookup the tab nodes.\n var tabs = this.contentNode.children;\n // Find the index of the released tab.\n var index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(tabs, function (tab) {\n return _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(tab, event.clientX, event.clientY);\n });\n // Do nothing if the release is not on the original pressed tab.\n if (index !== data.index) {\n return;\n }\n // Ignore the release if the title is not closable.\n var title = this._titles[index];\n if (!title.closable) {\n return;\n }\n // Emit the close requested signal if the middle button is released.\n if (event.button === 1) {\n this._tabCloseRequested.emit({ index: index, title: title });\n return;\n }\n // Emit the close requested signal if the close icon was released.\n var icon = tabs[index].querySelector(this.renderer.closeIconSelector);\n if (icon && icon.contains(event.target)) {\n this._tabCloseRequested.emit({ index: index, title: title });\n return;\n }\n // Otherwise, there is nothing left to do.\n return;\n }\n // Do nothing if the left button is not released.\n if (event.button !== 0) {\n return;\n }\n // Position the tab at its final resting position.\n Private$9.finalizeTabPosition(data, this._orientation);\n // Remove the dragging class from the tab so it can be transitioned.\n data.tab.classList.remove('lm-mod-dragging');\n /* <DEPRECATED> */\n data.tab.classList.remove('p-mod-dragging');\n /* </DEPRECATED> */\n // Parse the transition duration for releasing the tab.\n var duration = Private$9.parseTransitionDuration(data.tab);\n // Complete the release on a timer to allow the tab to transition.\n setTimeout(function () {\n // Do nothing if the drag has been aborted.\n if (data.dragAborted) {\n return;\n }\n // Clear the drag data reference.\n _this._dragData = null;\n // Reset the positions of the tabs.\n Private$9.resetTabPositions(_this.contentNode.children, _this._orientation);\n // Clear the cursor grab.\n data.override.dispose();\n // Remove the remaining dragging style.\n _this.removeClass('lm-mod-dragging');\n /* <DEPRECATED> */\n _this.removeClass('p-mod-dragging');\n /* </DEPRECATED> */\n // If the tab was not moved, there is nothing else to do.\n var i = data.index;\n var j = data.targetIndex;\n if (j === -1 || i === j) {\n return;\n }\n // Move the title to the new locations.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(_this._titles, i, j);\n // Adjust the current index for the move.\n _this._adjustCurrentForMove(i, j);\n // Emit the tab moved signal.\n _this._tabMoved.emit({\n fromIndex: i, toIndex: j, title: _this._titles[j]\n });\n // Update the tabs immediately to prevent flicker.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(_this, Widget.Msg.UpdateRequest);\n }, duration);\n };\n /**\n * Release the mouse and restore the non-dragged tab positions.\n */\n TabBar.prototype._releaseMouse = function () {\n // Do nothing if no drag is in progress.\n var data = this._dragData;\n if (!data) {\n return;\n }\n // Clear the drag data reference.\n this._dragData = null;\n // Remove the extra mouse listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n // Indicate the drag has been aborted. This allows the mouse\n // event handlers to return early when the drag is canceled.\n data.dragAborted = true;\n // If the drag is not active, there's nothing more to do.\n if (!data.dragActive) {\n return;\n }\n // Reset the tabs to their non-dragged positions.\n Private$9.resetTabPositions(this.contentNode.children, this._orientation);\n // Clear the cursor override.\n data.override.dispose();\n // Clear the dragging style classes.\n data.tab.classList.remove('lm-mod-dragging');\n this.removeClass('lm-mod-dragging');\n /* <DEPRECATED> */\n data.tab.classList.remove('p-mod-dragging');\n this.removeClass('p-mod-dragging');\n /* </DEPRECATED> */\n };\n /**\n * Adjust the current index for a tab insert operation.\n *\n * This method accounts for the tab bar's insertion behavior when\n * adjusting the current index and emitting the changed signal.\n */\n TabBar.prototype._adjustCurrentForInsert = function (i, title) {\n // Lookup commonly used variables.\n var ct = this.currentTitle;\n var ci = this._currentIndex;\n var bh = this.insertBehavior;\n // Handle the behavior where the new tab is always selected,\n // or the behavior where the new tab is selected if needed.\n if (bh === 'select-tab' || (bh === 'select-tab-if-needed' && ci === -1)) {\n this._currentIndex = i;\n this._previousTitle = ct;\n this._currentChanged.emit({\n previousIndex: ci, previousTitle: ct,\n currentIndex: i, currentTitle: title\n });\n return;\n }\n // Otherwise, silently adjust the current index if needed.\n if (ci >= i) {\n this._currentIndex++;\n }\n };\n /**\n * Adjust the current index for a tab move operation.\n *\n * This method will not cause the actual current tab to change.\n * It silently adjusts the index to account for the given move.\n */\n TabBar.prototype._adjustCurrentForMove = function (i, j) {\n if (this._currentIndex === i) {\n this._currentIndex = j;\n }\n else if (this._currentIndex < i && this._currentIndex >= j) {\n this._currentIndex++;\n }\n else if (this._currentIndex > i && this._currentIndex <= j) {\n this._currentIndex--;\n }\n };\n /**\n * Adjust the current index for a tab remove operation.\n *\n * This method accounts for the tab bar's remove behavior when\n * adjusting the current index and emitting the changed signal.\n */\n TabBar.prototype._adjustCurrentForRemove = function (i, title) {\n // Lookup commonly used variables.\n var ci = this._currentIndex;\n var bh = this.removeBehavior;\n // Silently adjust the index if the current tab is not removed.\n if (ci !== i) {\n if (ci > i) {\n this._currentIndex--;\n }\n return;\n }\n // No tab gets selected if the tab bar is empty.\n if (this._titles.length === 0) {\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i, previousTitle: title,\n currentIndex: -1, currentTitle: null\n });\n return;\n }\n // Handle behavior where the next sibling tab is selected.\n if (bh === 'select-tab-after') {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n this._currentChanged.emit({\n previousIndex: i, previousTitle: title,\n currentIndex: this._currentIndex, currentTitle: this.currentTitle\n });\n return;\n }\n // Handle behavior where the previous sibling tab is selected.\n if (bh === 'select-tab-before') {\n this._currentIndex = Math.max(0, i - 1);\n this._currentChanged.emit({\n previousIndex: i, previousTitle: title,\n currentIndex: this._currentIndex, currentTitle: this.currentTitle\n });\n return;\n }\n // Handle behavior where the previous history tab is selected.\n if (bh === 'select-previous-tab') {\n if (this._previousTitle) {\n this._currentIndex = this._titles.indexOf(this._previousTitle);\n this._previousTitle = null;\n }\n else {\n this._currentIndex = Math.min(i, this._titles.length - 1);\n }\n this._currentChanged.emit({\n previousIndex: i, previousTitle: title,\n currentIndex: this._currentIndex, currentTitle: this.currentTitle\n });\n return;\n }\n // Otherwise, no tab gets selected.\n this._currentIndex = -1;\n this._currentChanged.emit({\n previousIndex: i, previousTitle: title,\n currentIndex: -1, currentTitle: null\n });\n };\n /**\n * Handle the `changed` signal of a title object.\n */\n TabBar.prototype._onTitleChanged = function (sender) {\n this.update();\n };\n return TabBar;\n}(Widget));\n/**\n * The namespace for the `TabBar` class statics.\n */\n(function (TabBar) {\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n var Renderer = /** @class */ (function () {\n /**\n * Construct a new renderer.\n */\n function Renderer() {\n /**\n * A selector which matches the close icon node in a tab.\n */\n this.closeIconSelector = '.lm-TabBar-tabCloseIcon';\n this._tabID = 0;\n this._tabKeys = new WeakMap();\n }\n /**\n * Render the virtual element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab.\n */\n Renderer.prototype.renderTab = function (data) {\n var title = data.title.caption;\n var key = this.createTabKey(data);\n var style = this.createTabStyle(data);\n var className = this.createTabClass(data);\n var dataset = this.createTabDataset(data);\n return (_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.li({ key: key, className: className, title: title, style: style, dataset: dataset }, this.renderIcon(data), this.renderLabel(data), this.renderCloseIcon(data)));\n };\n /**\n * Render the icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab icon.\n */\n Renderer.prototype.renderIcon = function (data) {\n var title = data.title;\n var className = this.createIconClass(data);\n /* <DEPRECATED> */\n if (typeof title.icon === 'string') {\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: className }, title.iconLabel);\n }\n /* </DEPRECATED> */\n // if title.icon is undefined, it will be ignored\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: className }, title.icon, title.iconLabel);\n };\n /**\n * Render the label element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab label.\n */\n Renderer.prototype.renderLabel = function (data) {\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-TabBar-tabLabel'\n /* <DEPRECATED> */\n + ' p-TabBar-tabLabel'\n /* </DEPRECATED> */\n }, data.title.label);\n };\n /**\n * Render the close icon element for a tab.\n *\n * @param data - The data to use for rendering the tab.\n *\n * @returns A virtual element representing the tab close icon.\n */\n Renderer.prototype.renderCloseIcon = function (data) {\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({\n className: 'lm-TabBar-tabCloseIcon'\n /* <DEPRECATED> */\n + ' p-TabBar-tabCloseIcon'\n /* </DEPRECATED> */\n });\n };\n /**\n * Create a unique render key for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The unique render key for the tab.\n *\n * #### Notes\n * This method caches the key against the tab title the first time\n * the key is generated. This enables efficient rendering of moved\n * tabs and avoids subtle hover style artifacts.\n */\n Renderer.prototype.createTabKey = function (data) {\n var key = this._tabKeys.get(data.title);\n if (key === undefined) {\n key = \"tab-key-\" + this._tabID++;\n this._tabKeys.set(data.title, key);\n }\n return key;\n };\n /**\n * Create the inline style object for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The inline style data for the tab.\n */\n Renderer.prototype.createTabStyle = function (data) {\n return { zIndex: \"\" + data.zIndex };\n };\n /**\n * Create the class name for the tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab.\n */\n Renderer.prototype.createTabClass = function (data) {\n var name = 'lm-TabBar-tab';\n /* <DEPRECATED> */\n name += ' p-TabBar-tab';\n /* </DEPRECATED> */\n if (data.title.className) {\n name += \" \" + data.title.className;\n }\n if (data.title.closable) {\n name += ' lm-mod-closable';\n /* <DEPRECATED> */\n name += ' p-mod-closable';\n /* </DEPRECATED> */\n }\n if (data.current) {\n name += ' lm-mod-current';\n /* <DEPRECATED> */\n name += ' p-mod-current';\n /* </DEPRECATED> */\n }\n return name;\n };\n /**\n * Create the dataset for a tab.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The dataset for the tab.\n */\n Renderer.prototype.createTabDataset = function (data) {\n return data.title.dataset;\n };\n /**\n * Create the class name for the tab icon.\n *\n * @param data - The data to use for the tab.\n *\n * @returns The full class name for the tab icon.\n */\n Renderer.prototype.createIconClass = function (data) {\n var name = 'lm-TabBar-tabIcon';\n /* <DEPRECATED> */\n name += ' p-TabBar-tabIcon';\n /* </DEPRECATED> */\n var extra = data.title.iconClass;\n return extra ? name + \" \" + extra : name;\n };\n return Renderer;\n }());\n TabBar.Renderer = Renderer;\n /**\n * The default `Renderer` instance.\n */\n TabBar.defaultRenderer = new Renderer();\n})(TabBar || (TabBar = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$9;\n(function (Private) {\n /**\n * The start drag distance threshold.\n */\n Private.DRAG_THRESHOLD = 5;\n /**\n * The detach distance threshold.\n */\n Private.DETACH_THRESHOLD = 20;\n /**\n * Create the DOM node for a tab bar.\n */\n function createNode() {\n var node = document.createElement('div');\n var content = document.createElement('ul');\n content.className = 'lm-TabBar-content';\n /* <DEPRECATED> */\n content.classList.add('p-TabBar-content');\n /* </DEPRECATED> */\n node.appendChild(content);\n return node;\n }\n Private.createNode = createNode;\n /**\n * Coerce a title or options into a real title.\n */\n function asTitle(value) {\n return value instanceof Title ? value : new Title(value);\n }\n Private.asTitle = asTitle;\n /**\n * Parse the transition duration for a tab node.\n */\n function parseTransitionDuration(tab) {\n var style = window.getComputedStyle(tab);\n return 1000 * (parseFloat(style.transitionDuration) || 0);\n }\n Private.parseTransitionDuration = parseTransitionDuration;\n /**\n * Get a snapshot of the current tab layout values.\n */\n function snapTabLayout(tabs, orientation) {\n var layout = new Array(tabs.length);\n for (var i = 0, n = tabs.length; i < n; ++i) {\n var node = tabs[i];\n var style = window.getComputedStyle(node);\n if (orientation === 'horizontal') {\n layout[i] = {\n pos: node.offsetLeft,\n size: node.offsetWidth,\n margin: parseFloat(style.marginLeft) || 0\n };\n }\n else {\n layout[i] = {\n pos: node.offsetTop,\n size: node.offsetHeight,\n margin: parseFloat(style.marginTop) || 0\n };\n }\n }\n return layout;\n }\n Private.snapTabLayout = snapTabLayout;\n /**\n * Test if the event exceeds the drag threshold.\n */\n function dragExceeded(data, event) {\n var dx = Math.abs(event.clientX - data.pressX);\n var dy = Math.abs(event.clientY - data.pressY);\n return dx >= Private.DRAG_THRESHOLD || dy >= Private.DRAG_THRESHOLD;\n }\n Private.dragExceeded = dragExceeded;\n /**\n * Test if the event exceeds the drag detach threshold.\n */\n function detachExceeded(data, event) {\n var rect = data.contentRect;\n return ((event.clientX < rect.left - Private.DETACH_THRESHOLD) ||\n (event.clientX >= rect.right + Private.DETACH_THRESHOLD) ||\n (event.clientY < rect.top - Private.DETACH_THRESHOLD) ||\n (event.clientY >= rect.bottom + Private.DETACH_THRESHOLD));\n }\n Private.detachExceeded = detachExceeded;\n /**\n * Update the relative tab positions and computed target index.\n */\n function layoutTabs(tabs, data, event, orientation) {\n // Compute the orientation-sensitive values.\n var pressPos;\n var localPos;\n var clientPos;\n var clientSize;\n if (orientation === 'horizontal') {\n pressPos = data.pressX;\n localPos = event.clientX - data.contentRect.left;\n clientPos = event.clientX;\n clientSize = data.contentRect.width;\n }\n else {\n pressPos = data.pressY;\n localPos = event.clientY - data.contentRect.top;\n clientPos = event.clientY;\n clientSize = data.contentRect.height;\n }\n // Compute the target data.\n var targetIndex = data.index;\n var targetPos = localPos - data.tabPressPos;\n var targetEnd = targetPos + data.tabSize;\n // Update the relative tab positions.\n for (var i = 0, n = tabs.length; i < n; ++i) {\n var pxPos = void 0;\n var layout = data.tabLayout[i];\n var threshold = layout.pos + (layout.size >> 1);\n if (i < data.index && targetPos < threshold) {\n pxPos = data.tabSize + data.tabLayout[i + 1].margin + \"px\";\n targetIndex = Math.min(targetIndex, i);\n }\n else if (i > data.index && targetEnd > threshold) {\n pxPos = -data.tabSize - layout.margin + \"px\";\n targetIndex = Math.max(targetIndex, i);\n }\n else if (i === data.index) {\n var ideal = clientPos - pressPos;\n var limit = clientSize - (data.tabPos + data.tabSize);\n pxPos = Math.max(-data.tabPos, Math.min(ideal, limit)) + \"px\";\n }\n else {\n pxPos = '';\n }\n if (orientation === 'horizontal') {\n tabs[i].style.left = pxPos;\n }\n else {\n tabs[i].style.top = pxPos;\n }\n }\n // Update the computed target index.\n data.targetIndex = targetIndex;\n }\n Private.layoutTabs = layoutTabs;\n /**\n * Position the drag tab at its final resting relative position.\n */\n function finalizeTabPosition(data, orientation) {\n // Compute the orientation-sensitive client size.\n var clientSize;\n if (orientation === 'horizontal') {\n clientSize = data.contentRect.width;\n }\n else {\n clientSize = data.contentRect.height;\n }\n // Compute the ideal final tab position.\n var ideal;\n if (data.targetIndex === data.index) {\n ideal = 0;\n }\n else if (data.targetIndex > data.index) {\n var tgt = data.tabLayout[data.targetIndex];\n ideal = tgt.pos + tgt.size - data.tabSize - data.tabPos;\n }\n else {\n var tgt = data.tabLayout[data.targetIndex];\n ideal = tgt.pos - data.tabPos;\n }\n // Compute the tab position limit.\n var limit = clientSize - (data.tabPos + data.tabSize);\n var final = Math.max(-data.tabPos, Math.min(ideal, limit));\n // Set the final orientation-sensitive position.\n if (orientation === 'horizontal') {\n data.tab.style.left = final + \"px\";\n }\n else {\n data.tab.style.top = final + \"px\";\n }\n }\n Private.finalizeTabPosition = finalizeTabPosition;\n /**\n * Reset the relative positions of the given tabs.\n */\n function resetTabPositions(tabs, orientation) {\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(tabs, function (tab) {\n if (orientation === 'horizontal') {\n tab.style.left = '';\n }\n else {\n tab.style.top = '';\n }\n });\n }\n Private.resetTabPositions = resetTabPositions;\n})(Private$9 || (Private$9 = {}));\n\n/**\n * A widget which provides a flexible docking area for widgets.\n */\nvar DockPanel = /** @class */ (function (_super) {\n __extends(DockPanel, _super);\n /**\n * Construct a new dock panel.\n *\n * @param options - The options for initializing the panel.\n */\n function DockPanel(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this) || this;\n _this._drag = null;\n _this._tabsMovable = true;\n _this._tabsConstrained = false;\n _this._pressData = null;\n _this._layoutModified = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this.addClass('lm-DockPanel');\n /* <DEPRECATED> */\n _this.addClass('p-DockPanel');\n /* </DEPRECATED> */\n _this._mode = options.mode || 'multiple-document';\n _this._renderer = options.renderer || DockPanel.defaultRenderer;\n _this._edges = options.edges || Private$a.DEFAULT_EDGES;\n if (options.tabsMovable !== undefined) {\n _this._tabsMovable = options.tabsMovable;\n }\n if (options.tabsConstrained !== undefined) {\n _this._tabsConstrained = options.tabsConstrained;\n }\n // Toggle the CSS mode attribute.\n _this.dataset['mode'] = _this._mode;\n // Create the delegate renderer for the layout.\n var renderer = {\n createTabBar: function () { return _this._createTabBar(); },\n createHandle: function () { return _this._createHandle(); }\n };\n // Set up the dock layout for the panel.\n _this.layout = new DockLayout({ renderer: renderer, spacing: options.spacing });\n // Set up the overlay drop indicator.\n _this.overlay = options.overlay || new DockPanel.Overlay();\n _this.node.appendChild(_this.overlay.node);\n return _this;\n }\n /**\n * Dispose of the resources held by the panel.\n */\n DockPanel.prototype.dispose = function () {\n // Ensure the mouse is released.\n this._releaseMouse();\n // Hide the overlay.\n this.overlay.hide(0);\n // Cancel a drag if one is in progress.\n if (this._drag) {\n this._drag.dispose();\n }\n // Dispose of the base class.\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(DockPanel.prototype, \"layoutModified\", {\n /**\n * A signal emitted when the layout configuration is modified.\n *\n * #### Notes\n * This signal is emitted whenever the current layout configuration\n * may have changed.\n *\n * This signal is emitted asynchronously in a collapsed fashion, so\n * that multiple synchronous modifications results in only a single\n * emit of the signal.\n */\n get: function () {\n return this._layoutModified;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DockPanel.prototype, \"renderer\", {\n /**\n * The renderer used by the dock panel.\n */\n get: function () {\n return this.layout.renderer;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DockPanel.prototype, \"spacing\", {\n /**\n * Get the spacing between the widgets.\n */\n get: function () {\n return this.layout.spacing;\n },\n /**\n * Set the spacing between the widgets.\n */\n set: function (value) {\n this.layout.spacing = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DockPanel.prototype, \"mode\", {\n /**\n * Get the mode for the dock panel.\n */\n get: function () {\n return this._mode;\n },\n /**\n * Set the mode for the dock panel.\n *\n * #### Notes\n * Changing the mode is a destructive operation with respect to the\n * panel's layout configuration. If layout state must be preserved,\n * save the current layout config before changing the mode.\n */\n set: function (value) {\n // Bail early if the mode does not change.\n if (this._mode === value) {\n return;\n }\n // Update the internal mode.\n this._mode = value;\n // Toggle the CSS mode attribute.\n this.dataset['mode'] = value;\n // Get the layout for the panel.\n var layout = this.layout;\n // Configure the layout for the specified mode.\n switch (value) {\n case 'multiple-document':\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(layout.tabBars(), function (tabBar) { tabBar.show(); });\n break;\n case 'single-document':\n layout.restoreLayout(Private$a.createSingleDocumentConfig(this));\n break;\n default:\n throw 'unreachable';\n }\n // Schedule an emit of the layout modified signal.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Private$a.LayoutModified);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DockPanel.prototype, \"tabsMovable\", {\n /**\n * Whether the tabs can be dragged / moved at runtime.\n */\n get: function () {\n return this._tabsMovable;\n },\n /**\n * Enable / Disable draggable / movable tabs.\n */\n set: function (value) {\n this._tabsMovable = value;\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this.tabBars(), function (tabbar) { tabbar.tabsMovable = value; });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DockPanel.prototype, \"tabsConstrained\", {\n /**\n * Whether the tabs are constrained to their source dock panel\n */\n get: function () {\n return this._tabsConstrained;\n },\n /**\n * Constrain/Allow tabs to be dragged outside of this dock panel\n */\n set: function (value) {\n this._tabsConstrained = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DockPanel.prototype, \"isEmpty\", {\n /**\n * Whether the dock panel is empty.\n */\n get: function () {\n return this.layout.isEmpty;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Create an iterator over the user widgets in the panel.\n *\n * @returns A new iterator over the user widgets in the panel.\n *\n * #### Notes\n * This iterator does not include the generated tab bars.\n */\n DockPanel.prototype.widgets = function () {\n return this.layout.widgets();\n };\n /**\n * Create an iterator over the selected widgets in the panel.\n *\n * @returns A new iterator over the selected user widgets.\n *\n * #### Notes\n * This iterator yields the widgets corresponding to the current tab\n * of each tab bar in the panel.\n */\n DockPanel.prototype.selectedWidgets = function () {\n return this.layout.selectedWidgets();\n };\n /**\n * Create an iterator over the tab bars in the panel.\n *\n * @returns A new iterator over the tab bars in the panel.\n *\n * #### Notes\n * This iterator does not include the user widgets.\n */\n DockPanel.prototype.tabBars = function () {\n return this.layout.tabBars();\n };\n /**\n * Create an iterator over the handles in the panel.\n *\n * @returns A new iterator over the handles in the panel.\n */\n DockPanel.prototype.handles = function () {\n return this.layout.handles();\n };\n /**\n * Select a specific widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will make the widget the current widget in its tab area.\n */\n DockPanel.prototype.selectWidget = function (widget) {\n // Find the tab bar which contains the widget.\n var tabBar = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.find)(this.tabBars(), function (bar) {\n return bar.titles.indexOf(widget.title) !== -1;\n });\n // Throw an error if no tab bar is found.\n if (!tabBar) {\n throw new Error('Widget is not contained in the dock panel.');\n }\n // Ensure the widget is the current widget.\n tabBar.currentTitle = widget.title;\n };\n /**\n * Activate a specified widget in the dock panel.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * This will select and activate the given widget.\n */\n DockPanel.prototype.activateWidget = function (widget) {\n this.selectWidget(widget);\n widget.activate();\n };\n /**\n * Save the current layout configuration of the dock panel.\n *\n * @returns A new config object for the current layout state.\n *\n * #### Notes\n * The return value can be provided to the `restoreLayout` method\n * in order to restore the layout to its current configuration.\n */\n DockPanel.prototype.saveLayout = function () {\n return this.layout.saveLayout();\n };\n /**\n * Restore the layout to a previously saved configuration.\n *\n * @param config - The layout configuration to restore.\n *\n * #### Notes\n * Widgets which currently belong to the layout but which are not\n * contained in the config will be unparented.\n *\n * The dock panel automatically reverts to `'multiple-document'`\n * mode when a layout config is restored.\n */\n DockPanel.prototype.restoreLayout = function (config) {\n // Reset the mode.\n this._mode = 'multiple-document';\n // Restore the layout.\n this.layout.restoreLayout(config);\n // Flush the message loop on IE and Edge to prevent flicker.\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Platform.IS_EDGE || _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Platform.IS_IE) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.flush();\n }\n // Schedule an emit of the layout modified signal.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Private$a.LayoutModified);\n };\n /**\n * Add a widget to the dock panel.\n *\n * @param widget - The widget to add to the dock panel.\n *\n * @param options - The additional options for adding the widget.\n *\n * #### Notes\n * If the panel is in single document mode, the options are ignored\n * and the widget is always added as tab in the hidden tab bar.\n */\n DockPanel.prototype.addWidget = function (widget, options) {\n if (options === void 0) { options = {}; }\n // Add the widget to the layout.\n if (this._mode === 'single-document') {\n this.layout.addWidget(widget);\n }\n else {\n this.layout.addWidget(widget, options);\n }\n // Schedule an emit of the layout modified signal.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Private$a.LayoutModified);\n };\n /**\n * Process a message sent to the widget.\n *\n * @param msg - The message sent to the widget.\n */\n DockPanel.prototype.processMessage = function (msg) {\n if (msg.type === 'layout-modified') {\n this._layoutModified.emit(undefined);\n }\n else {\n _super.prototype.processMessage.call(this, msg);\n }\n };\n /**\n * Handle the DOM events for the dock panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n DockPanel.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'lm-dragenter':\n this._evtDragEnter(event);\n break;\n case 'lm-dragleave':\n this._evtDragLeave(event);\n break;\n case 'lm-dragover':\n this._evtDragOver(event);\n break;\n case 'lm-drop':\n this._evtDrop(event);\n break;\n case 'mousedown':\n this._evtMouseDown(event);\n break;\n case 'mousemove':\n this._evtMouseMove(event);\n break;\n case 'mouseup':\n this._evtMouseUp(event);\n break;\n case 'keydown':\n this._evtKeyDown(event);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n DockPanel.prototype.onBeforeAttach = function (msg) {\n this.node.addEventListener('lm-dragenter', this);\n this.node.addEventListener('lm-dragleave', this);\n this.node.addEventListener('lm-dragover', this);\n this.node.addEventListener('lm-drop', this);\n this.node.addEventListener('mousedown', this);\n };\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n DockPanel.prototype.onAfterDetach = function (msg) {\n this.node.removeEventListener('lm-dragenter', this);\n this.node.removeEventListener('lm-dragleave', this);\n this.node.removeEventListener('lm-dragover', this);\n this.node.removeEventListener('lm-drop', this);\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n };\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n DockPanel.prototype.onChildAdded = function (msg) {\n // Ignore the generated tab bars.\n if (Private$a.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n // Add the widget class to the child.\n msg.child.addClass('lm-DockPanel-widget');\n /* <DEPRECATED> */\n msg.child.addClass('p-DockPanel-widget');\n /* </DEPRECATED> */\n };\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n DockPanel.prototype.onChildRemoved = function (msg) {\n // Ignore the generated tab bars.\n if (Private$a.isGeneratedTabBarProperty.get(msg.child)) {\n return;\n }\n // Remove the widget class from the child.\n msg.child.removeClass('lm-DockPanel-widget');\n /* <DEPRECATED> */\n msg.child.removeClass('p-DockPanel-widget');\n /* </DEPRECATED> */\n // Schedule an emit of the layout modified signal.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Private$a.LayoutModified);\n };\n /**\n * Handle the `'lm-dragenter'` event for the dock panel.\n */\n DockPanel.prototype._evtDragEnter = function (event) {\n // If the factory mime type is present, mark the event as\n // handled in order to get the rest of the drag events.\n if (event.mimeData.hasData('application/vnd.lumino.widget-factory')) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n /**\n * Handle the `'lm-dragleave'` event for the dock panel.\n */\n DockPanel.prototype._evtDragLeave = function (event) {\n // Mark the event as handled.\n event.preventDefault();\n event.stopPropagation();\n // The new target might be a descendant, so we might still handle the drop.\n // Hide asynchronously so that if a lm-dragover event bubbles up to us, the\n // hide is cancelled by the lm-dragover handler's show overlay logic.\n this.overlay.hide(1);\n };\n /**\n * Handle the `'lm-dragover'` event for the dock panel.\n */\n DockPanel.prototype._evtDragOver = function (event) {\n // Mark the event as handled.\n event.preventDefault();\n event.stopPropagation();\n // Show the drop indicator overlay and update the drop\n // action based on the drop target zone under the mouse.\n if ((this._tabsConstrained && event.source !== this) || this._showOverlay(event.clientX, event.clientY) === 'invalid') {\n event.dropAction = 'none';\n }\n else {\n event.dropAction = event.proposedAction;\n }\n };\n /**\n * Handle the `'lm-drop'` event for the dock panel.\n */\n DockPanel.prototype._evtDrop = function (event) {\n // Mark the event as handled.\n event.preventDefault();\n event.stopPropagation();\n // Hide the drop indicator overlay.\n this.overlay.hide(0);\n // Bail if the proposed action is to do nothing.\n if (event.proposedAction === 'none') {\n event.dropAction = 'none';\n return;\n }\n // Find the drop target under the mouse.\n var clientX = event.clientX, clientY = event.clientY;\n var _a = Private$a.findDropTarget(this, clientX, clientY, this._edges), zone = _a.zone, target = _a.target;\n // Bail if the drop zone is invalid.\n if (zone === 'invalid') {\n event.dropAction = 'none';\n return;\n }\n // Bail if the factory mime type has invalid data.\n var mimeData = event.mimeData;\n var factory = mimeData.getData('application/vnd.lumino.widget-factory');\n if (typeof factory !== 'function') {\n event.dropAction = 'none';\n return;\n }\n // Bail if the factory does not produce a widget.\n var widget = factory();\n if (!(widget instanceof Widget)) {\n event.dropAction = 'none';\n return;\n }\n // Bail if the widget is an ancestor of the dock panel.\n if (widget.contains(this)) {\n event.dropAction = 'none';\n return;\n }\n // Find the reference widget for the drop target.\n var ref = target ? Private$a.getDropRef(target.tabBar) : null;\n // Add the widget according to the indicated drop zone.\n switch (zone) {\n case 'root-all':\n this.addWidget(widget);\n break;\n case 'root-top':\n this.addWidget(widget, { mode: 'split-top' });\n break;\n case 'root-left':\n this.addWidget(widget, { mode: 'split-left' });\n break;\n case 'root-right':\n this.addWidget(widget, { mode: 'split-right' });\n break;\n case 'root-bottom':\n this.addWidget(widget, { mode: 'split-bottom' });\n break;\n case 'widget-all':\n this.addWidget(widget, { mode: 'tab-after', ref: ref });\n break;\n case 'widget-top':\n this.addWidget(widget, { mode: 'split-top', ref: ref });\n break;\n case 'widget-left':\n this.addWidget(widget, { mode: 'split-left', ref: ref });\n break;\n case 'widget-right':\n this.addWidget(widget, { mode: 'split-right', ref: ref });\n break;\n case 'widget-bottom':\n this.addWidget(widget, { mode: 'split-bottom', ref: ref });\n break;\n case 'widget-tab':\n this.addWidget(widget, { mode: 'tab-after', ref: ref });\n break;\n default:\n throw 'unreachable';\n }\n // Accept the proposed drop action.\n event.dropAction = event.proposedAction;\n // Activate the dropped widget.\n this.activateWidget(widget);\n };\n /**\n * Handle the `'keydown'` event for the dock panel.\n */\n DockPanel.prototype._evtKeyDown = function (event) {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n // Finalize the mouse release.\n this._releaseMouse();\n // Schedule an emit of the layout modified signal.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Private$a.LayoutModified);\n }\n };\n /**\n * Handle the `'mousedown'` event for the dock panel.\n */\n DockPanel.prototype._evtMouseDown = function (event) {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n // Find the handle which contains the mouse target, if any.\n var layout = this.layout;\n var target = event.target;\n var handle = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.find)(layout.handles(), function (handle) { return handle.contains(target); });\n if (!handle) {\n return;\n }\n // Stop the event when a handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n // Add the extra document listeners.\n document.addEventListener('keydown', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('mousemove', this, true);\n document.addEventListener('contextmenu', this, true);\n // Compute the offset deltas for the handle press.\n var rect = handle.getBoundingClientRect();\n var deltaX = event.clientX - rect.left;\n var deltaY = event.clientY - rect.top;\n // Override the cursor and store the press data.\n var style = window.getComputedStyle(handle);\n var override = _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_10__.Drag.overrideCursor(style.cursor);\n this._pressData = { handle: handle, deltaX: deltaX, deltaY: deltaY, override: override };\n };\n /**\n * Handle the `'mousemove'` event for the dock panel.\n */\n DockPanel.prototype._evtMouseMove = function (event) {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n // Stop the event when dragging a handle.\n event.preventDefault();\n event.stopPropagation();\n // Compute the desired offset position for the handle.\n var rect = this.node.getBoundingClientRect();\n var xPos = event.clientX - rect.left - this._pressData.deltaX;\n var yPos = event.clientY - rect.top - this._pressData.deltaY;\n // Set the handle as close to the desired position as possible.\n var layout = this.layout;\n layout.moveHandle(this._pressData.handle, xPos, yPos);\n };\n /**\n * Handle the `'mouseup'` event for the dock panel.\n */\n DockPanel.prototype._evtMouseUp = function (event) {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n // Finalize the mouse release.\n this._releaseMouse();\n // Schedule an emit of the layout modified signal.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Private$a.LayoutModified);\n };\n /**\n * Release the mouse grab for the dock panel.\n */\n DockPanel.prototype._releaseMouse = function () {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n // Remove the extra document listeners.\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('contextmenu', this, true);\n };\n /**\n * Show the overlay indicator at the given client position.\n *\n * Returns the drop zone at the specified client position.\n *\n * #### Notes\n * If the position is not over a valid zone, the overlay is hidden.\n */\n DockPanel.prototype._showOverlay = function (clientX, clientY) {\n // Find the dock target for the given client position.\n var _a = Private$a.findDropTarget(this, clientX, clientY, this._edges), zone = _a.zone, target = _a.target;\n // If the drop zone is invalid, hide the overlay and bail.\n if (zone === 'invalid') {\n this.overlay.hide(100);\n return zone;\n }\n // Setup the variables needed to compute the overlay geometry.\n var top;\n var left;\n var right;\n var bottom;\n var box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.node); // TODO cache this?\n var rect = this.node.getBoundingClientRect();\n // Compute the overlay geometry based on the dock zone.\n switch (zone) {\n case 'root-all':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-top':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = rect.height * Private$a.GOLDEN_RATIO;\n break;\n case 'root-left':\n top = box.paddingTop;\n left = box.paddingLeft;\n right = rect.width * Private$a.GOLDEN_RATIO;\n bottom = box.paddingBottom;\n break;\n case 'root-right':\n top = box.paddingTop;\n left = rect.width * Private$a.GOLDEN_RATIO;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'root-bottom':\n top = rect.height * Private$a.GOLDEN_RATIO;\n left = box.paddingLeft;\n right = box.paddingRight;\n bottom = box.paddingBottom;\n break;\n case 'widget-all':\n top = target.top;\n left = target.left;\n right = target.right;\n bottom = target.bottom;\n break;\n case 'widget-top':\n top = target.top;\n left = target.left;\n right = target.right;\n bottom = target.bottom + target.height / 2;\n break;\n case 'widget-left':\n top = target.top;\n left = target.left;\n right = target.right + target.width / 2;\n bottom = target.bottom;\n break;\n case 'widget-right':\n top = target.top;\n left = target.left + target.width / 2;\n right = target.right;\n bottom = target.bottom;\n break;\n case 'widget-bottom':\n top = target.top + target.height / 2;\n left = target.left;\n right = target.right;\n bottom = target.bottom;\n break;\n case 'widget-tab':\n var tabHeight = target.tabBar.node.getBoundingClientRect().height;\n top = target.top;\n left = target.left;\n right = target.right;\n bottom = target.bottom + target.height - tabHeight;\n break;\n default:\n throw 'unreachable';\n }\n // Show the overlay with the computed geometry.\n this.overlay.show({ top: top, left: left, right: right, bottom: bottom });\n // Finally, return the computed drop zone.\n return zone;\n };\n /**\n * Create a new tab bar for use by the panel.\n */\n DockPanel.prototype._createTabBar = function () {\n // Create the tab bar.\n var tabBar = this._renderer.createTabBar();\n // Set the generated tab bar property for the tab bar.\n Private$a.isGeneratedTabBarProperty.set(tabBar, true);\n // Hide the tab bar when in single document mode.\n if (this._mode === 'single-document') {\n tabBar.hide();\n }\n // Enforce necessary tab bar behavior.\n // TODO do we really want to enforce *all* of these?\n tabBar.tabsMovable = this._tabsMovable;\n tabBar.allowDeselect = false;\n tabBar.removeBehavior = 'select-previous-tab';\n tabBar.insertBehavior = 'select-tab-if-needed';\n // Connect the signal handlers for the tab bar.\n tabBar.tabMoved.connect(this._onTabMoved, this);\n tabBar.currentChanged.connect(this._onCurrentChanged, this);\n tabBar.tabCloseRequested.connect(this._onTabCloseRequested, this);\n tabBar.tabDetachRequested.connect(this._onTabDetachRequested, this);\n tabBar.tabActivateRequested.connect(this._onTabActivateRequested, this);\n // Return the initialized tab bar.\n return tabBar;\n };\n /**\n * Create a new handle for use by the panel.\n */\n DockPanel.prototype._createHandle = function () {\n return this._renderer.createHandle();\n };\n /**\n * Handle the `tabMoved` signal from a tab bar.\n */\n DockPanel.prototype._onTabMoved = function () {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Private$a.LayoutModified);\n };\n /**\n * Handle the `currentChanged` signal from a tab bar.\n */\n DockPanel.prototype._onCurrentChanged = function (sender, args) {\n // Extract the previous and current title from the args.\n var previousTitle = args.previousTitle, currentTitle = args.currentTitle;\n // Hide the previous widget.\n if (previousTitle) {\n previousTitle.owner.hide();\n }\n // Show the current widget.\n if (currentTitle) {\n currentTitle.owner.show();\n }\n // Flush the message loop on IE and Edge to prevent flicker.\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Platform.IS_EDGE || _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Platform.IS_IE) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.flush();\n }\n // Schedule an emit of the layout modified signal.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.postMessage(this, Private$a.LayoutModified);\n };\n /**\n * Handle the `tabActivateRequested` signal from a tab bar.\n */\n DockPanel.prototype._onTabActivateRequested = function (sender, args) {\n args.title.owner.activate();\n };\n /**\n * Handle the `tabCloseRequested` signal from a tab bar.\n */\n DockPanel.prototype._onTabCloseRequested = function (sender, args) {\n args.title.owner.close();\n };\n /**\n * Handle the `tabDetachRequested` signal from a tab bar.\n */\n DockPanel.prototype._onTabDetachRequested = function (sender, args) {\n var _this = this;\n // Do nothing if a drag is already in progress.\n if (this._drag) {\n return;\n }\n // Release the tab bar's hold on the mouse.\n sender.releaseMouse();\n // Extract the data from the args.\n var title = args.title, tab = args.tab, clientX = args.clientX, clientY = args.clientY;\n // Setup the mime data for the drag operation.\n var mimeData = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_5__.MimeData();\n var factory = function () { return title.owner; };\n mimeData.setData('application/vnd.lumino.widget-factory', factory);\n // Create the drag image for the drag operation.\n var dragImage = tab.cloneNode(true);\n // Create the drag object to manage the drag-drop operation.\n this._drag = new _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_10__.Drag({\n mimeData: mimeData, dragImage: dragImage,\n proposedAction: 'move',\n supportedActions: 'move',\n source: this\n });\n // Hide the tab node in the original tab.\n tab.classList.add('lm-mod-hidden');\n /* <DEPRECATED> */\n tab.classList.add('p-mod-hidden');\n // Create the cleanup callback.\n var cleanup = (function () {\n _this._drag = null;\n tab.classList.remove('lm-mod-hidden');\n /* <DEPRECATED> */\n tab.classList.remove('p-mod-hidden');\n });\n // Start the drag operation and cleanup when done.\n this._drag.start(clientX, clientY).then(cleanup);\n };\n return DockPanel;\n}(Widget));\n/**\n * The namespace for the `DockPanel` class statics.\n */\n(function (DockPanel) {\n /**\n * A concrete implementation of `IOverlay`.\n *\n * This is the default overlay implementation for a dock panel.\n */\n var Overlay = /** @class */ (function () {\n /**\n * Construct a new overlay.\n */\n function Overlay() {\n this._timer = -1;\n this._hidden = true;\n this.node = document.createElement('div');\n this.node.classList.add('lm-DockPanel-overlay');\n this.node.classList.add('lm-mod-hidden');\n /* <DEPRECATED> */\n this.node.classList.add('p-DockPanel-overlay');\n this.node.classList.add('p-mod-hidden');\n this.node.style.position = 'absolute';\n }\n /**\n * Show the overlay using the given overlay geometry.\n *\n * @param geo - The desired geometry for the overlay.\n */\n Overlay.prototype.show = function (geo) {\n // Update the position of the overlay.\n var style = this.node.style;\n style.top = geo.top + \"px\";\n style.left = geo.left + \"px\";\n style.right = geo.right + \"px\";\n style.bottom = geo.bottom + \"px\";\n // Clear any pending hide timer.\n clearTimeout(this._timer);\n this._timer = -1;\n // If the overlay is already visible, we're done.\n if (!this._hidden) {\n return;\n }\n // Clear the hidden flag.\n this._hidden = false;\n // Finally, show the overlay.\n this.node.classList.remove('lm-mod-hidden');\n /* <DEPRECATED> */\n this.node.classList.remove('p-mod-hidden');\n };\n /**\n * Hide the overlay node.\n *\n * @param delay - The delay (in ms) before hiding the overlay.\n * A delay value <= 0 will hide the overlay immediately.\n */\n Overlay.prototype.hide = function (delay) {\n var _this = this;\n // Do nothing if the overlay is already hidden.\n if (this._hidden) {\n return;\n }\n // Hide immediately if the delay is <= 0.\n if (delay <= 0) {\n clearTimeout(this._timer);\n this._timer = -1;\n this._hidden = true;\n this.node.classList.add('lm-mod-hidden');\n /* <DEPRECATED> */\n this.node.classList.add('p-mod-hidden');\n return;\n }\n // Do nothing if a hide is already pending.\n if (this._timer !== -1) {\n return;\n }\n // Otherwise setup the hide timer.\n this._timer = window.setTimeout(function () {\n _this._timer = -1;\n _this._hidden = true;\n _this.node.classList.add('lm-mod-hidden');\n /* <DEPRECATED> */\n _this.node.classList.add('p-mod-hidden');\n }, delay);\n };\n return Overlay;\n }());\n DockPanel.Overlay = Overlay;\n /**\n * The default implementation of `IRenderer`.\n */\n var Renderer = /** @class */ (function () {\n function Renderer() {\n }\n /**\n * Create a new tab bar for use with a dock panel.\n *\n * @returns A new tab bar for a dock panel.\n */\n Renderer.prototype.createTabBar = function () {\n var bar = new TabBar();\n bar.addClass('lm-DockPanel-tabBar');\n /* <DEPRECATED> */\n bar.addClass('p-DockPanel-tabBar');\n /* </DEPRECATED> */\n return bar;\n };\n /**\n * Create a new handle node for use with a dock panel.\n *\n * @returns A new handle node for a dock panel.\n */\n Renderer.prototype.createHandle = function () {\n var handle = document.createElement('div');\n handle.className = 'lm-DockPanel-handle';\n /* <DEPRECATED> */\n handle.classList.add('p-DockPanel-handle');\n return handle;\n };\n return Renderer;\n }());\n DockPanel.Renderer = Renderer;\n /**\n * The default `Renderer` instance.\n */\n DockPanel.defaultRenderer = new Renderer();\n})(DockPanel || (DockPanel = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$a;\n(function (Private) {\n /**\n * A fraction used for sizing root panels; ~= `1 / golden_ratio`.\n */\n Private.GOLDEN_RATIO = 0.618;\n /**\n * The default sizes for the edge drop zones, in pixels.\n */\n Private.DEFAULT_EDGES = {\n /**\n * The size of the top edge dock zone for the root panel, in pixels.\n * This is different from the others to distinguish between the top\n * tab bar and the top root zone.\n */\n top: 12,\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n right: 40,\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n bottom: 40,\n /**\n * The size of the edge dock zone for the root panel, in pixels.\n */\n left: 40\n };\n /**\n * A singleton `'layout-modified'` conflatable message.\n */\n Private.LayoutModified = new _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.ConflatableMessage('layout-modified');\n /**\n * An attached property used to track generated tab bars.\n */\n Private.isGeneratedTabBarProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty({\n name: 'isGeneratedTabBar',\n create: function () { return false; }\n });\n /**\n * Create a single document config for the widgets in a dock panel.\n */\n function createSingleDocumentConfig(panel) {\n // Return an empty config if the panel is empty.\n if (panel.isEmpty) {\n return { main: null };\n }\n // Get a flat array of the widgets in the panel.\n var widgets = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.toArray)(panel.widgets());\n // Get the first selected widget in the panel.\n var selected = panel.selectedWidgets().next();\n // Compute the current index for the new config.\n var currentIndex = selected ? widgets.indexOf(selected) : -1;\n // Return the single document config.\n return { main: { type: 'tab-area', widgets: widgets, currentIndex: currentIndex } };\n }\n Private.createSingleDocumentConfig = createSingleDocumentConfig;\n /**\n * Find the drop target at the given client position.\n */\n function findDropTarget(panel, clientX, clientY, edges) {\n // Bail if the mouse is not over the dock panel.\n if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(panel.node, clientX, clientY)) {\n return { zone: 'invalid', target: null };\n }\n // Look up the layout for the panel.\n var layout = panel.layout;\n // If the layout is empty, indicate the entire root drop zone.\n if (layout.isEmpty) {\n return { zone: 'root-all', target: null };\n }\n // Test the edge zones when in multiple document mode.\n if (panel.mode === 'multiple-document') {\n // Get the client rect for the dock panel.\n var panelRect = panel.node.getBoundingClientRect();\n // Compute the distance to each edge of the panel.\n var pl = clientX - panelRect.left + 1;\n var pt = clientY - panelRect.top + 1;\n var pr = panelRect.right - clientX;\n var pb = panelRect.bottom - clientY;\n // Find the minimum distance to an edge.\n var pd = Math.min(pt, pr, pb, pl);\n // Return a root zone if the mouse is within an edge.\n switch (pd) {\n case pt:\n if (pt < edges.top) {\n return { zone: 'root-top', target: null };\n }\n break;\n case pr:\n if (pr < edges.right) {\n return { zone: 'root-right', target: null };\n }\n break;\n case pb:\n if (pb < edges.bottom) {\n return { zone: 'root-bottom', target: null };\n }\n break;\n case pl:\n if (pl < edges.left) {\n return { zone: 'root-left', target: null };\n }\n break;\n default:\n throw 'unreachable';\n }\n }\n // Hit test the dock layout at the given client position.\n var target = layout.hitTestTabAreas(clientX, clientY);\n // Bail if no target area was found.\n if (!target) {\n return { zone: 'invalid', target: null };\n }\n // Return the whole tab area when in single document mode.\n if (panel.mode === 'single-document') {\n return { zone: 'widget-all', target: target };\n }\n // Compute the distance to each edge of the tab area.\n var al = target.x - target.left + 1;\n var at = target.y - target.top + 1;\n var ar = target.left + target.width - target.x;\n var ab = target.top + target.height - target.y;\n var tabHeight = target.tabBar.node.getBoundingClientRect().height;\n if (at < tabHeight) {\n return { zone: 'widget-tab', target: target };\n }\n // Get the X and Y edge sizes for the area.\n var rx = Math.round(target.width / 3);\n var ry = Math.round(target.height / 3);\n // If the mouse is not within an edge, indicate the entire area.\n if (al > rx && ar > rx && at > ry && ab > ry) {\n return { zone: 'widget-all', target: target };\n }\n // Scale the distances by the slenderness ratio.\n al /= rx;\n at /= ry;\n ar /= rx;\n ab /= ry;\n // Find the minimum distance to the area edge.\n var ad = Math.min(al, at, ar, ab);\n // Find the widget zone for the area edge.\n var zone;\n switch (ad) {\n case al:\n zone = 'widget-left';\n break;\n case at:\n zone = 'widget-top';\n break;\n case ar:\n zone = 'widget-right';\n break;\n case ab:\n zone = 'widget-bottom';\n break;\n default:\n throw 'unreachable';\n }\n // Return the final drop target.\n return { zone: zone, target: target };\n }\n Private.findDropTarget = findDropTarget;\n /**\n * Get the drop reference widget for a tab bar.\n */\n function getDropRef(tabBar) {\n if (tabBar.titles.length === 0) {\n return null;\n }\n if (tabBar.currentTitle) {\n return tabBar.currentTitle.owner;\n }\n return tabBar.titles[tabBar.titles.length - 1].owner;\n }\n Private.getDropRef = getDropRef;\n})(Private$a || (Private$a = {}));\n\n// Copyright (c) Jupyter Development Team.\n/**\n * A class which tracks focus among a set of widgets.\n *\n * This class is useful when code needs to keep track of the most\n * recently focused widget(s) among a set of related widgets.\n */\nvar FocusTracker = /** @class */ (function () {\n /**\n * Construct a new focus tracker.\n */\n function FocusTracker() {\n this._counter = 0;\n this._widgets = [];\n this._activeWidget = null;\n this._currentWidget = null;\n this._numbers = new Map();\n this._nodes = new Map();\n this._activeChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(this);\n this._currentChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(this);\n }\n /**\n * Dispose of the resources held by the tracker.\n */\n FocusTracker.prototype.dispose = function () {\n var _this = this;\n // Do nothing if the tracker is already disposed.\n if (this._counter < 0) {\n return;\n }\n // Mark the tracker as disposed.\n this._counter = -1;\n // Clear the connections for the tracker.\n _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal.clearData(this);\n // Remove all event listeners.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this._widgets, function (w) {\n w.node.removeEventListener('focus', _this, true);\n w.node.removeEventListener('blur', _this, true);\n });\n // Clear the internal data structures.\n this._activeWidget = null;\n this._currentWidget = null;\n this._nodes.clear();\n this._numbers.clear();\n this._widgets.length = 0;\n };\n Object.defineProperty(FocusTracker.prototype, \"currentChanged\", {\n /**\n * A signal emitted when the current widget has changed.\n */\n get: function () {\n return this._currentChanged;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FocusTracker.prototype, \"activeChanged\", {\n /**\n * A signal emitted when the active widget has changed.\n */\n get: function () {\n return this._activeChanged;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FocusTracker.prototype, \"isDisposed\", {\n /**\n * A flag indicating whether the tracker is disposed.\n */\n get: function () {\n return this._counter < 0;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FocusTracker.prototype, \"currentWidget\", {\n /**\n * The current widget in the tracker.\n *\n * #### Notes\n * The current widget is the widget among the tracked widgets which\n * has the *descendant node* which has most recently been focused.\n *\n * The current widget will not be updated if the node loses focus. It\n * will only be updated when a different tracked widget gains focus.\n *\n * If the current widget is removed from the tracker, the previous\n * current widget will be restored.\n *\n * This behavior is intended to follow a user's conceptual model of\n * a semantically \"current\" widget, where the \"last thing of type X\"\n * to be interacted with is the \"current instance of X\", regardless\n * of whether that instance still has focus.\n */\n get: function () {\n return this._currentWidget;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FocusTracker.prototype, \"activeWidget\", {\n /**\n * The active widget in the tracker.\n *\n * #### Notes\n * The active widget is the widget among the tracked widgets which\n * has the *descendant node* which is currently focused.\n */\n get: function () {\n return this._activeWidget;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FocusTracker.prototype, \"widgets\", {\n /**\n * A read only array of the widgets being tracked.\n */\n get: function () {\n return this._widgets;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Get the focus number for a particular widget in the tracker.\n *\n * @param widget - The widget of interest.\n *\n * @returns The focus number for the given widget, or `-1` if the\n * widget has not had focus since being added to the tracker, or\n * is not contained by the tracker.\n *\n * #### Notes\n * The focus number indicates the relative order in which the widgets\n * have gained focus. A widget with a larger number has gained focus\n * more recently than a widget with a smaller number.\n *\n * The `currentWidget` will always have the largest focus number.\n *\n * All widgets start with a focus number of `-1`, which indicates that\n * the widget has not been focused since being added to the tracker.\n */\n FocusTracker.prototype.focusNumber = function (widget) {\n var n = this._numbers.get(widget);\n return n === undefined ? -1 : n;\n };\n /**\n * Test whether the focus tracker contains a given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns `true` if the widget is tracked, `false` otherwise.\n */\n FocusTracker.prototype.has = function (widget) {\n return this._numbers.has(widget);\n };\n /**\n * Add a widget to the focus tracker.\n *\n * @param widget - The widget of interest.\n *\n * #### Notes\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is already tracked, this is a no-op.\n */\n FocusTracker.prototype.add = function (widget) {\n // Do nothing if the widget is already tracked.\n if (this._numbers.has(widget)) {\n return;\n }\n // Test whether the widget has focus.\n var focused = widget.node.contains(document.activeElement);\n // Set up the initial focus number.\n var n = focused ? this._counter++ : -1;\n // Add the widget to the internal data structures.\n this._widgets.push(widget);\n this._numbers.set(widget, n);\n this._nodes.set(widget.node, widget);\n // Set up the event listeners. The capturing phase must be used\n // since the 'focus' and 'blur' events don't bubble and Firefox\n // doesn't support the 'focusin' or 'focusout' events.\n widget.node.addEventListener('focus', this, true);\n widget.node.addEventListener('blur', this, true);\n // Connect the disposed signal handler.\n widget.disposed.connect(this._onWidgetDisposed, this);\n // Set the current and active widgets if needed.\n if (focused) {\n this._setWidgets(widget, widget);\n }\n };\n /**\n * Remove a widget from the focus tracker.\n *\n * #### Notes\n * If the widget is the `currentWidget`, the previous current widget\n * will become the new `currentWidget`.\n *\n * A widget will be automatically removed from the tracker if it\n * is disposed after being added.\n *\n * If the widget is not tracked, this is a no-op.\n */\n FocusTracker.prototype.remove = function (widget) {\n var _this = this;\n // Bail early if the widget is not tracked.\n if (!this._numbers.has(widget)) {\n return;\n }\n // Disconnect the disposed signal handler.\n widget.disposed.disconnect(this._onWidgetDisposed, this);\n // Remove the event listeners.\n widget.node.removeEventListener('focus', this, true);\n widget.node.removeEventListener('blur', this, true);\n // Remove the widget from the internal data structures.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeFirstOf(this._widgets, widget);\n this._nodes.delete(widget.node);\n this._numbers.delete(widget);\n // Bail early if the widget is not the current widget.\n if (this._currentWidget !== widget) {\n return;\n }\n // Filter the widgets for those which have had focus.\n var valid = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.filter)(this._widgets, function (w) { return _this._numbers.get(w) !== -1; });\n // Get the valid widget with the max focus number.\n var previous = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.max)(valid, function (first, second) {\n var a = _this._numbers.get(first);\n var b = _this._numbers.get(second);\n return a - b;\n }) || null;\n // Set the current and active widgets.\n this._setWidgets(previous, null);\n };\n /**\n * Handle the DOM events for the focus tracker.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the tracked nodes. It should\n * not be called directly by user code.\n */\n FocusTracker.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event);\n break;\n case 'blur':\n this._evtBlur(event);\n break;\n }\n };\n /**\n * Set the current and active widgets for the tracker.\n */\n FocusTracker.prototype._setWidgets = function (current, active) {\n // Swap the current widget.\n var oldCurrent = this._currentWidget;\n this._currentWidget = current;\n // Swap the active widget.\n var oldActive = this._activeWidget;\n this._activeWidget = active;\n // Emit the `currentChanged` signal if needed.\n if (oldCurrent !== current) {\n this._currentChanged.emit({ oldValue: oldCurrent, newValue: current });\n }\n // Emit the `activeChanged` signal if needed.\n if (oldActive !== active) {\n this._activeChanged.emit({ oldValue: oldActive, newValue: active });\n }\n };\n /**\n * Handle the `'focus'` event for a tracked widget.\n */\n FocusTracker.prototype._evtFocus = function (event) {\n // Find the widget which gained focus, which is known to exist.\n var widget = this._nodes.get(event.currentTarget);\n // Update the focus number if necessary.\n if (widget !== this._currentWidget) {\n this._numbers.set(widget, this._counter++);\n }\n // Set the current and active widgets.\n this._setWidgets(widget, widget);\n };\n /**\n * Handle the `'blur'` event for a tracked widget.\n */\n FocusTracker.prototype._evtBlur = function (event) {\n // Find the widget which lost focus, which is known to exist.\n var widget = this._nodes.get(event.currentTarget);\n // Get the node which being focused after this blur.\n var focusTarget = event.relatedTarget;\n // If no other node is being focused, clear the active widget.\n if (!focusTarget) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n // Bail if the focus widget is not changing.\n if (widget.node.contains(focusTarget)) {\n return;\n }\n // If no tracked widget is being focused, clear the active widget.\n if (!(0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.find)(this._widgets, function (w) { return w.node.contains(focusTarget); })) {\n this._setWidgets(this._currentWidget, null);\n return;\n }\n };\n /**\n * Handle the `disposed` signal for a tracked widget.\n */\n FocusTracker.prototype._onWidgetDisposed = function (sender) {\n this.remove(sender);\n };\n return FocusTracker;\n}());\n\n/**\n * A layout which arranges its widgets in a grid.\n */\nvar GridLayout = /** @class */ (function (_super) {\n __extends(GridLayout, _super);\n /**\n * Construct a new grid layout.\n *\n * @param options - The options for initializing the layout.\n */\n function GridLayout(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, options) || this;\n _this._dirty = false;\n _this._rowSpacing = 4;\n _this._columnSpacing = 4;\n _this._items = [];\n _this._rowStarts = [];\n _this._columnStarts = [];\n _this._rowSizers = [new BoxSizer()];\n _this._columnSizers = [new BoxSizer()];\n _this._box = null;\n if (options.rowCount !== undefined) {\n Private$b.reallocSizers(_this._rowSizers, options.rowCount);\n }\n if (options.columnCount !== undefined) {\n Private$b.reallocSizers(_this._columnSizers, options.columnCount);\n }\n if (options.rowSpacing !== undefined) {\n _this._rowSpacing = Private$b.clampValue(options.rowSpacing);\n }\n if (options.columnSpacing !== undefined) {\n _this._columnSpacing = Private$b.clampValue(options.columnSpacing);\n }\n return _this;\n }\n /**\n * Dispose of the resources held by the layout.\n */\n GridLayout.prototype.dispose = function () {\n // Dispose of the widgets and layout items.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this._items, function (item) {\n var widget = item.widget;\n item.dispose();\n widget.dispose();\n });\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._rowStarts.length = 0;\n this._rowSizers.length = 0;\n this._columnStarts.length = 0;\n this._columnSizers.length = 0;\n // Dispose of the rest of the layout.\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(GridLayout.prototype, \"rowCount\", {\n /**\n * Get the number of rows in the layout.\n */\n get: function () {\n return this._rowSizers.length;\n },\n /**\n * Set the number of rows in the layout.\n *\n * #### Notes\n * The minimum row count is `1`.\n */\n set: function (value) {\n // Do nothing if the row count does not change.\n if (value === this.rowCount) {\n return;\n }\n // Reallocate the row sizers.\n Private$b.reallocSizers(this._rowSizers, value);\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GridLayout.prototype, \"columnCount\", {\n /**\n * Get the number of columns in the layout.\n */\n get: function () {\n return this._columnSizers.length;\n },\n /**\n * Set the number of columns in the layout.\n *\n * #### Notes\n * The minimum column count is `1`.\n */\n set: function (value) {\n // Do nothing if the column count does not change.\n if (value === this.columnCount) {\n return;\n }\n // Reallocate the column sizers.\n Private$b.reallocSizers(this._columnSizers, value);\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GridLayout.prototype, \"rowSpacing\", {\n /**\n * Get the row spacing for the layout.\n */\n get: function () {\n return this._rowSpacing;\n },\n /**\n * Set the row spacing for the layout.\n */\n set: function (value) {\n // Clamp the spacing to the allowed range.\n value = Private$b.clampValue(value);\n // Bail if the spacing does not change\n if (this._rowSpacing === value) {\n return;\n }\n // Update the internal spacing.\n this._rowSpacing = value;\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GridLayout.prototype, \"columnSpacing\", {\n /**\n * Get the column spacing for the layout.\n */\n get: function () {\n return this._columnSpacing;\n },\n /**\n * Set the col spacing for the layout.\n */\n set: function (value) {\n // Clamp the spacing to the allowed range.\n value = Private$b.clampValue(value);\n // Bail if the spacing does not change\n if (this._columnSpacing === value) {\n return;\n }\n // Update the internal spacing.\n this._columnSpacing = value;\n // Schedule a fit of the parent.\n if (this.parent) {\n this.parent.fit();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Get the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @returns The stretch factor for the row.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n GridLayout.prototype.rowStretch = function (index) {\n var sizer = this._rowSizers[index];\n return sizer ? sizer.stretch : -1;\n };\n /**\n * Set the stretch factor for a specific row.\n *\n * @param index - The row index of interest.\n *\n * @param value - The stretch factor for the row.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n GridLayout.prototype.setRowStretch = function (index, value) {\n // Look up the row sizer.\n var sizer = this._rowSizers[index];\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n // Clamp the value to the allowed range.\n value = Private$b.clampValue(value);\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n // Update the sizer stretch.\n sizer.stretch = value;\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n };\n /**\n * Get the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @returns The stretch factor for the column.\n *\n * #### Notes\n * This returns `-1` if the index is out of range.\n */\n GridLayout.prototype.columnStretch = function (index) {\n var sizer = this._columnSizers[index];\n return sizer ? sizer.stretch : -1;\n };\n /**\n * Set the stretch factor for a specific column.\n *\n * @param index - The column index of interest.\n *\n * @param value - The stretch factor for the column.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n GridLayout.prototype.setColumnStretch = function (index, value) {\n // Look up the column sizer.\n var sizer = this._columnSizers[index];\n // Bail if the index is out of range.\n if (!sizer) {\n return;\n }\n // Clamp the value to the allowed range.\n value = Private$b.clampValue(value);\n // Bail if the stretch does not change.\n if (sizer.stretch === value) {\n return;\n }\n // Update the sizer stretch.\n sizer.stretch = value;\n // Schedule an update of the parent.\n if (this.parent) {\n this.parent.update();\n }\n };\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n GridLayout.prototype.iter = function () {\n return (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.map)(this._items, function (item) { return item.widget; });\n };\n /**\n * Add a widget to the grid layout.\n *\n * @param widget - The widget to add to the layout.\n *\n * #### Notes\n * If the widget is already contained in the layout, this is no-op.\n */\n GridLayout.prototype.addWidget = function (widget) {\n // Look up the index for the widget.\n var i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(this._items, function (it) { return it.widget === widget; });\n // Bail if the widget is already in the layout.\n if (i !== -1) {\n return;\n }\n // Add the widget to the layout.\n this._items.push(new LayoutItem(widget));\n // Attach the widget to the parent.\n if (this.parent) {\n this.attachWidget(widget);\n }\n };\n /**\n * Remove a widget from the grid layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n GridLayout.prototype.removeWidget = function (widget) {\n // Look up the index for the widget.\n var i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(this._items, function (it) { return it.widget === widget; });\n // Bail if the widget is not in the layout.\n if (i === -1) {\n return;\n }\n // Remove the widget from the layout.\n var item = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._items, i);\n // Detach the widget from the parent.\n if (this.parent) {\n this.detachWidget(widget);\n }\n // Dispose the layout item.\n item.dispose();\n };\n /**\n * Perform layout initialization which requires the parent widget.\n */\n GridLayout.prototype.init = function () {\n var _this = this;\n _super.prototype.init.call(this);\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) { _this.attachWidget(widget); });\n };\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param widget - The widget to attach to the parent.\n */\n GridLayout.prototype.attachWidget = function (widget) {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n // Add the widget's node to the parent.\n this.parent.node.appendChild(widget.node);\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n */\n GridLayout.prototype.detachWidget = function (widget) {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n // Remove the widget's node from the parent.\n this.parent.node.removeChild(widget.node);\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n GridLayout.prototype.onBeforeShow = function (msg) {\n _super.prototype.onBeforeShow.call(this, msg);\n this.parent.update();\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n GridLayout.prototype.onBeforeAttach = function (msg) {\n _super.prototype.onBeforeAttach.call(this, msg);\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n GridLayout.prototype.onChildShown = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n GridLayout.prototype.onChildHidden = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'resize'` message.\n */\n GridLayout.prototype.onResize = function (msg) {\n if (this.parent.isVisible) {\n this._update(msg.width, msg.height);\n }\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n GridLayout.prototype.onUpdateRequest = function (msg) {\n if (this.parent.isVisible) {\n this._update(-1, -1);\n }\n };\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n GridLayout.prototype.onFitRequest = function (msg) {\n if (this.parent.isAttached) {\n this._fit();\n }\n };\n /**\n * Fit the layout to the total size required by the widgets.\n */\n GridLayout.prototype._fit = function () {\n // Reset the min sizes of the sizers.\n for (var i = 0, n = this.rowCount; i < n; ++i) {\n this._rowSizers[i].minSize = 0;\n }\n for (var i = 0, n = this.columnCount; i < n; ++i) {\n this._columnSizers[i].minSize = 0;\n }\n // Filter for the visible layout items.\n var items = this._items.filter(function (it) { return !it.isHidden; });\n // Fit the layout items.\n for (var i = 0, n = items.length; i < n; ++i) {\n items[i].fit();\n }\n // Get the max row and column index.\n var maxRow = this.rowCount - 1;\n var maxCol = this.columnCount - 1;\n // Sort the items by row span.\n items.sort(Private$b.rowSpanCmp);\n // Update the min sizes of the row sizers.\n for (var i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n var item = items[i];\n // Get the row bounds for the item.\n var config = GridLayout.getCellConfig(item.widget);\n var r1 = Math.min(config.row, maxRow);\n var r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n // Distribute the minimum height to the sizers as needed.\n Private$b.distributeMin(this._rowSizers, r1, r2, item.minHeight);\n }\n // Sort the items by column span.\n items.sort(Private$b.columnSpanCmp);\n // Update the min sizes of the column sizers.\n for (var i = 0, n = items.length; i < n; ++i) {\n // Fetch the item.\n var item = items[i];\n // Get the column bounds for the item.\n var config = GridLayout.getCellConfig(item.widget);\n var c1 = Math.min(config.column, maxCol);\n var c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n // Distribute the minimum width to the sizers as needed.\n Private$b.distributeMin(this._columnSizers, c1, c2, item.minWidth);\n }\n // If no size constraint is needed, just update the parent.\n if (this.fitPolicy === 'set-no-constraint') {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);\n return;\n }\n // Set up the computed min size.\n var minH = maxRow * this._rowSpacing;\n var minW = maxCol * this._columnSpacing;\n // Add the sizer minimums to the computed min size.\n for (var i = 0, n = this.rowCount; i < n; ++i) {\n minH += this._rowSizers[i].minSize;\n }\n for (var i = 0, n = this.columnCount; i < n; ++i) {\n minW += this._columnSizers[i].minSize;\n }\n // Update the box sizing and add it to the computed min size.\n var box = this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n minW += box.horizontalSum;\n minH += box.verticalSum;\n // Update the parent's min size constraints.\n var style = this.parent.node.style;\n style.minWidth = minW + \"px\";\n style.minHeight = minH + \"px\";\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent.parent) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest);\n }\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);\n }\n };\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n GridLayout.prototype._update = function (offsetWidth, offsetHeight) {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent.node.offsetHeight;\n }\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n }\n // Compute the layout area adjusted for border and padding.\n var top = this._box.paddingTop;\n var left = this._box.paddingLeft;\n var width = offsetWidth - this._box.horizontalSum;\n var height = offsetHeight - this._box.verticalSum;\n // Get the max row and column index.\n var maxRow = this.rowCount - 1;\n var maxCol = this.columnCount - 1;\n // Compute the total fixed row and column space.\n var fixedRowSpace = maxRow * this._rowSpacing;\n var fixedColSpace = maxCol * this._columnSpacing;\n // Distribute the available space to the box sizers.\n BoxEngine.calc(this._rowSizers, Math.max(0, height - fixedRowSpace));\n BoxEngine.calc(this._columnSizers, Math.max(0, width - fixedColSpace));\n // Update the row start positions.\n for (var i = 0, pos = top, n = this.rowCount; i < n; ++i) {\n this._rowStarts[i] = pos;\n pos += this._rowSizers[i].size + this._rowSpacing;\n }\n // Update the column start positions.\n for (var i = 0, pos = left, n = this.columnCount; i < n; ++i) {\n this._columnStarts[i] = pos;\n pos += this._columnSizers[i].size + this._columnSpacing;\n }\n // Update the geometry of the layout items.\n for (var i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n var item = this._items[i];\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n // Fetch the cell bounds for the widget.\n var config = GridLayout.getCellConfig(item.widget);\n var r1 = Math.min(config.row, maxRow);\n var c1 = Math.min(config.column, maxCol);\n var r2 = Math.min(config.row + config.rowSpan - 1, maxRow);\n var c2 = Math.min(config.column + config.columnSpan - 1, maxCol);\n // Compute the cell geometry.\n var x = this._columnStarts[c1];\n var y = this._rowStarts[r1];\n var w = this._columnStarts[c2] + this._columnSizers[c2].size - x;\n var h = this._rowStarts[r2] + this._rowSizers[r2].size - y;\n // Update the geometry of the layout item.\n item.update(x, y, w, h);\n }\n };\n return GridLayout;\n}(Layout));\n/**\n * The namespace for the `GridLayout` class statics.\n */\n(function (GridLayout) {\n /**\n * Get the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The cell config for the widget.\n */\n function getCellConfig(widget) {\n return Private$b.cellConfigProperty.get(widget);\n }\n GridLayout.getCellConfig = getCellConfig;\n /**\n * Set the cell config for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the cell config.\n */\n function setCellConfig(widget, value) {\n Private$b.cellConfigProperty.set(widget, Private$b.normalizeConfig(value));\n }\n GridLayout.setCellConfig = setCellConfig;\n})(GridLayout || (GridLayout = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$b;\n(function (Private) {\n /**\n * The property descriptor for the widget cell config.\n */\n Private.cellConfigProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty({\n name: 'cellConfig',\n create: function () { return ({ row: 0, column: 0, rowSpan: 1, columnSpan: 1 }); },\n changed: onChildCellConfigChanged\n });\n /**\n * Normalize a partial cell config object.\n */\n function normalizeConfig(config) {\n var row = Math.max(0, Math.floor(config.row || 0));\n var column = Math.max(0, Math.floor(config.column || 0));\n var rowSpan = Math.max(1, Math.floor(config.rowSpan || 0));\n var columnSpan = Math.max(1, Math.floor(config.columnSpan || 0));\n return { row: row, column: column, rowSpan: rowSpan, columnSpan: columnSpan };\n }\n Private.normalizeConfig = normalizeConfig;\n /**\n * Clamp a value to an integer >= 0.\n */\n function clampValue(value) {\n return Math.max(0, Math.floor(value));\n }\n Private.clampValue = clampValue;\n /**\n * A sort comparison function for row spans.\n */\n function rowSpanCmp(a, b) {\n var c1 = Private.cellConfigProperty.get(a.widget);\n var c2 = Private.cellConfigProperty.get(b.widget);\n return c1.rowSpan - c2.rowSpan;\n }\n Private.rowSpanCmp = rowSpanCmp;\n /**\n * A sort comparison function for column spans.\n */\n function columnSpanCmp(a, b) {\n var c1 = Private.cellConfigProperty.get(a.widget);\n var c2 = Private.cellConfigProperty.get(b.widget);\n return c1.columnSpan - c2.columnSpan;\n }\n Private.columnSpanCmp = columnSpanCmp;\n /**\n * Reallocate the box sizers for the given grid dimensions.\n */\n function reallocSizers(sizers, count) {\n // Coerce the count to the valid range.\n count = Math.max(1, Math.floor(count));\n // Add the missing sizers.\n while (sizers.length < count) {\n sizers.push(new BoxSizer());\n }\n // Remove the extra sizers.\n if (sizers.length > count) {\n sizers.length = count;\n }\n }\n Private.reallocSizers = reallocSizers;\n /**\n * Distribute a min size constraint across a range of sizers.\n */\n function distributeMin(sizers, i1, i2, minSize) {\n // Sanity check the indices.\n if (i2 < i1) {\n return;\n }\n // Handle the simple case of no cell span.\n if (i1 === i2) {\n var sizer = sizers[i1];\n sizer.minSize = Math.max(sizer.minSize, minSize);\n return;\n }\n // Compute the total current min size of the span.\n var totalMin = 0;\n for (var i = i1; i <= i2; ++i) {\n totalMin += sizers[i].minSize;\n }\n // Do nothing if the total is greater than the required.\n if (totalMin >= minSize) {\n return;\n }\n // Compute the portion of the space to allocate to each sizer.\n var portion = (minSize - totalMin) / (i2 - i1 + 1);\n // Add the portion to each sizer.\n for (var i = i1; i <= i2; ++i) {\n sizers[i].minSize += portion;\n }\n }\n Private.distributeMin = distributeMin;\n /**\n * The change handler for the child cell config property.\n */\n function onChildCellConfigChanged(child) {\n if (child.parent && child.parent.layout instanceof GridLayout) {\n child.parent.fit();\n }\n }\n})(Private$b || (Private$b = {}));\n\n/**\n * A widget which displays menus as a canonical menu bar.\n */\nvar MenuBar = /** @class */ (function (_super) {\n __extends(MenuBar, _super);\n /**\n * Construct a new menu bar.\n *\n * @param options - The options for initializing the menu bar.\n */\n function MenuBar(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, { node: Private$c.createNode() }) || this;\n _this._activeIndex = -1;\n _this._menus = [];\n _this._childMenu = null;\n _this.addClass('lm-MenuBar');\n /* <DEPRECATED> */\n _this.addClass('p-MenuBar');\n /* </DEPRECATED> */\n _this.setFlag(Widget.Flag.DisallowLayout);\n _this.renderer = options.renderer || MenuBar.defaultRenderer;\n return _this;\n }\n /**\n * Dispose of the resources held by the widget.\n */\n MenuBar.prototype.dispose = function () {\n this._closeChildMenu();\n this._menus.length = 0;\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(MenuBar.prototype, \"childMenu\", {\n /**\n * The child menu of the menu bar.\n *\n * #### Notes\n * This will be `null` if the menu bar does not have an open menu.\n */\n get: function () {\n return this._childMenu;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuBar.prototype, \"contentNode\", {\n /**\n * Get the menu bar content node.\n *\n * #### Notes\n * This is the node which holds the menu title nodes.\n *\n * Modifying this node directly can lead to undefined behavior.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-MenuBar-content')[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuBar.prototype, \"activeMenu\", {\n /**\n * Get the currently active menu.\n */\n get: function () {\n return this._menus[this._activeIndex] || null;\n },\n /**\n * Set the currently active menu.\n *\n * #### Notes\n * If the menu does not exist, the menu will be set to `null`.\n */\n set: function (value) {\n this.activeIndex = value ? this._menus.indexOf(value) : -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuBar.prototype, \"activeIndex\", {\n /**\n * Get the index of the currently active menu.\n *\n * #### Notes\n * This will be `-1` if no menu is active.\n */\n get: function () {\n return this._activeIndex;\n },\n /**\n * Set the index of the currently active menu.\n *\n * #### Notes\n * If the menu cannot be activated, the index will be set to `-1`.\n */\n set: function (value) {\n // Adjust the value for an out of range index.\n if (value < 0 || value >= this._menus.length) {\n value = -1;\n }\n // Bail early if the index will not change.\n if (this._activeIndex === value) {\n return;\n }\n // Update the active index.\n this._activeIndex = value;\n // Schedule an update of the items.\n this.update();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MenuBar.prototype, \"menus\", {\n /**\n * A read-only array of the menus in the menu bar.\n */\n get: function () {\n return this._menus;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Open the active menu and activate its first menu item.\n *\n * #### Notes\n * If there is no active menu, this is a no-op.\n */\n MenuBar.prototype.openActiveMenu = function () {\n // Bail early if there is no active item.\n if (this._activeIndex === -1) {\n return;\n }\n // Open the child menu.\n this._openChildMenu();\n // Activate the first item in the child menu.\n if (this._childMenu) {\n this._childMenu.activeIndex = -1;\n this._childMenu.activateNextItem();\n }\n };\n /**\n * Add a menu to the end of the menu bar.\n *\n * @param menu - The menu to add to the menu bar.\n *\n * #### Notes\n * If the menu is already added to the menu bar, it will be moved.\n */\n MenuBar.prototype.addMenu = function (menu) {\n this.insertMenu(this._menus.length, menu);\n };\n /**\n * Insert a menu into the menu bar at the specified index.\n *\n * @param index - The index at which to insert the menu.\n *\n * @param menu - The menu to insert into the menu bar.\n *\n * #### Notes\n * The index will be clamped to the bounds of the menus.\n *\n * If the menu is already added to the menu bar, it will be moved.\n */\n MenuBar.prototype.insertMenu = function (index, menu) {\n // Close the child menu before making changes.\n this._closeChildMenu();\n // Look up the index of the menu.\n var i = this._menus.indexOf(menu);\n // Clamp the insert index to the array bounds.\n var j = Math.max(0, Math.min(index, this._menus.length));\n // If the menu is not in the array, insert it.\n if (i === -1) {\n // Insert the menu into the array.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._menus, j, menu);\n // Add the styling class to the menu.\n menu.addClass('lm-MenuBar-menu');\n /* <DEPRECATED> */\n menu.addClass('p-MenuBar-menu');\n /* </DEPRECATED> */\n // Connect to the menu signals.\n menu.aboutToClose.connect(this._onMenuAboutToClose, this);\n menu.menuRequested.connect(this._onMenuMenuRequested, this);\n menu.title.changed.connect(this._onTitleChanged, this);\n // Schedule an update of the items.\n this.update();\n // There is nothing more to do.\n return;\n }\n // Otherwise, the menu exists in the array and should be moved.\n // Adjust the index if the location is at the end of the array.\n if (j === this._menus.length) {\n j--;\n }\n // Bail if there is no effective move.\n if (i === j) {\n return;\n }\n // Move the menu to the new locations.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._menus, i, j);\n // Schedule an update of the items.\n this.update();\n };\n /**\n * Remove a menu from the menu bar.\n *\n * @param menu - The menu to remove from the menu bar.\n *\n * #### Notes\n * This is a no-op if the menu is not in the menu bar.\n */\n MenuBar.prototype.removeMenu = function (menu) {\n this.removeMenuAt(this._menus.indexOf(menu));\n };\n /**\n * Remove the menu at a given index from the menu bar.\n *\n * @param index - The index of the menu to remove.\n *\n * #### Notes\n * This is a no-op if the index is out of range.\n */\n MenuBar.prototype.removeMenuAt = function (index) {\n // Close the child menu before making changes.\n this._closeChildMenu();\n // Remove the menu from the array.\n var menu = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._menus, index);\n // Bail if the index is out of range.\n if (!menu) {\n return;\n }\n // Disconnect from the menu signals.\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n // Remove the styling class from the menu.\n menu.removeClass('lm-MenuBar-menu');\n /* <DEPRECATED> */\n menu.removeClass('p-MenuBar-menu');\n /* </DEPRECATED> */\n // Schedule an update of the items.\n this.update();\n };\n /**\n * Remove all menus from the menu bar.\n */\n MenuBar.prototype.clearMenus = function () {\n // Bail if there is nothing to remove.\n if (this._menus.length === 0) {\n return;\n }\n // Close the child menu before making changes.\n this._closeChildMenu();\n // Disconnect from the menu signals and remove the styling class.\n for (var _i = 0, _a = this._menus; _i < _a.length; _i++) {\n var menu = _a[_i];\n menu.aboutToClose.disconnect(this._onMenuAboutToClose, this);\n menu.menuRequested.disconnect(this._onMenuMenuRequested, this);\n menu.title.changed.disconnect(this._onTitleChanged, this);\n menu.removeClass('lm-MenuBar-menu');\n /* <DEPRECATED> */\n menu.removeClass('p-MenuBar-menu');\n /* </DEPRECATED> */\n }\n // Clear the menus array.\n this._menus.length = 0;\n // Schedule an update of the items.\n this.update();\n };\n /**\n * Handle the DOM events for the menu bar.\n *\n * @param event - The DOM event sent to the menu bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the menu bar's DOM nodes. It\n * should not be called directly by user code.\n */\n MenuBar.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'keydown':\n this._evtKeyDown(event);\n break;\n case 'mousedown':\n this._evtMouseDown(event);\n break;\n case 'mousemove':\n this._evtMouseMove(event);\n break;\n case 'mouseleave':\n this._evtMouseLeave(event);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n MenuBar.prototype.onBeforeAttach = function (msg) {\n this.node.addEventListener('keydown', this);\n this.node.addEventListener('mousedown', this);\n this.node.addEventListener('mousemove', this);\n this.node.addEventListener('mouseleave', this);\n this.node.addEventListener('contextmenu', this);\n };\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n MenuBar.prototype.onAfterDetach = function (msg) {\n this.node.removeEventListener('keydown', this);\n this.node.removeEventListener('mousedown', this);\n this.node.removeEventListener('mousemove', this);\n this.node.removeEventListener('mouseleave', this);\n this.node.removeEventListener('contextmenu', this);\n this._closeChildMenu();\n };\n /**\n * A message handler invoked on an `'activate-request'` message.\n */\n MenuBar.prototype.onActivateRequest = function (msg) {\n if (this.isAttached) {\n this.node.focus();\n }\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n MenuBar.prototype.onUpdateRequest = function (msg) {\n var menus = this._menus;\n var renderer = this.renderer;\n var activeIndex = this._activeIndex;\n var content = new Array(menus.length);\n for (var i = 0, n = menus.length; i < n; ++i) {\n var title = menus[i].title;\n var active = i === activeIndex;\n content[i] = renderer.renderItem({ title: title, active: active });\n }\n _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.VirtualDOM.render(content, this.contentNode);\n };\n /**\n * Handle the `'keydown'` event for the menu bar.\n */\n MenuBar.prototype._evtKeyDown = function (event) {\n // A menu bar handles all keydown events.\n event.preventDefault();\n event.stopPropagation();\n // Fetch the key code for the event.\n var kc = event.keyCode;\n // Enter, Up Arrow, Down Arrow\n if (kc === 13 || kc === 38 || kc === 40) {\n this.openActiveMenu();\n return;\n }\n // Escape\n if (kc === 27) {\n this._closeChildMenu();\n this.activeIndex = -1;\n this.node.blur();\n return;\n }\n // Left Arrow\n if (kc === 37) {\n var i = this._activeIndex;\n var n = this._menus.length;\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n return;\n }\n // Right Arrow\n if (kc === 39) {\n var i = this._activeIndex;\n var n = this._menus.length;\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n return;\n }\n // Get the pressed key character.\n var key = (0,_lumino_keyboard__WEBPACK_IMPORTED_MODULE_9__.getKeyboardLayout)().keyForKeydownEvent(event);\n // Bail if the key is not valid.\n if (!key) {\n return;\n }\n // Search for the next best matching mnemonic item.\n var start = this._activeIndex + 1;\n var result = Private$c.findMnemonic(this._menus, key, start);\n // Handle the requested mnemonic based on the search results.\n // If exactly one mnemonic is matched, that menu is opened.\n // Otherwise, the next mnemonic is activated if available,\n // followed by the auto mnemonic if available.\n if (result.index !== -1 && !result.multiple) {\n this.activeIndex = result.index;\n this.openActiveMenu();\n }\n else if (result.index !== -1) {\n this.activeIndex = result.index;\n }\n else if (result.auto !== -1) {\n this.activeIndex = result.auto;\n }\n };\n /**\n * Handle the `'mousedown'` event for the menu bar.\n */\n MenuBar.prototype._evtMouseDown = function (event) {\n // Bail if the mouse press was not on the menu bar. This can occur\n // when the document listener is installed for an active menu bar.\n if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(this.node, event.clientX, event.clientY)) {\n return;\n }\n // Stop the propagation of the event. Immediate propagation is\n // also stopped so that an open menu does not handle the event.\n event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();\n // Check if the mouse is over one of the menu items.\n var index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(this.contentNode.children, function (node) {\n return _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n // If the press was not on an item, close the child menu.\n if (index === -1) {\n this._closeChildMenu();\n return;\n }\n // If the press was not the left mouse button, do nothing further.\n if (event.button !== 0) {\n return;\n }\n // Otherwise, toggle the open state of the child menu.\n if (this._childMenu) {\n this._closeChildMenu();\n this.activeIndex = index;\n }\n else {\n this.activeIndex = index;\n this._openChildMenu();\n }\n };\n /**\n * Handle the `'mousemove'` event for the menu bar.\n */\n MenuBar.prototype._evtMouseMove = function (event) {\n // Check if the mouse is over one of the menu items.\n var index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(this.contentNode.children, function (node) {\n return _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(node, event.clientX, event.clientY);\n });\n // Bail early if the active index will not change.\n if (index === this._activeIndex) {\n return;\n }\n // Bail early if a child menu is open and the mouse is not over\n // an item. This allows the child menu to be kept open when the\n // mouse is over the empty part of the menu bar.\n if (index === -1 && this._childMenu) {\n return;\n }\n // Update the active index to the hovered item.\n this.activeIndex = index;\n // Open the new menu if a menu is already open.\n if (this._childMenu) {\n this._openChildMenu();\n }\n };\n /**\n * Handle the `'mouseleave'` event for the menu bar.\n */\n MenuBar.prototype._evtMouseLeave = function (event) {\n // Reset the active index if there is no open menu.\n if (!this._childMenu) {\n this.activeIndex = -1;\n }\n };\n /**\n * Open the child menu at the active index immediately.\n *\n * If a different child menu is already open, it will be closed,\n * even if there is no active menu.\n */\n MenuBar.prototype._openChildMenu = function () {\n // If there is no active menu, close the current menu.\n var newMenu = this.activeMenu;\n if (!newMenu) {\n this._closeChildMenu();\n return;\n }\n // Bail if there is no effective menu change.\n var oldMenu = this._childMenu;\n if (oldMenu === newMenu) {\n return;\n }\n // Swap the internal menu reference.\n this._childMenu = newMenu;\n // Close the current menu, or setup for the new menu.\n if (oldMenu) {\n oldMenu.close();\n }\n else {\n this.addClass('lm-mod-active');\n /* <DEPRECATED> */\n this.addClass('p-mod-active');\n /* </DEPRECATED> */\n document.addEventListener('mousedown', this, true);\n }\n // Ensure the menu bar is updated and look up the item node.\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);\n var itemNode = this.contentNode.children[this._activeIndex];\n // Get the positioning data for the new menu.\n var _a = itemNode.getBoundingClientRect(), left = _a.left, bottom = _a.bottom;\n // Open the new menu at the computed location.\n newMenu.open(left, bottom, { forceX: true, forceY: true });\n };\n /**\n * Close the child menu immediately.\n *\n * This is a no-op if a child menu is not open.\n */\n MenuBar.prototype._closeChildMenu = function () {\n // Bail if no child menu is open.\n if (!this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n /* <DEPRECATED> */\n this.removeClass('p-mod-active');\n /* </DEPRECATED> */\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n // Clear the internal menu reference.\n var menu = this._childMenu;\n this._childMenu = null;\n // Close the menu.\n menu.close();\n // Reset the active index.\n this.activeIndex = -1;\n };\n /**\n * Handle the `aboutToClose` signal of a menu.\n */\n MenuBar.prototype._onMenuAboutToClose = function (sender) {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n // Remove the active class from the menu bar.\n this.removeClass('lm-mod-active');\n /* <DEPRECATED> */\n this.removeClass('p-mod-active');\n /* </DEPRECATED> */\n // Remove the document listeners.\n document.removeEventListener('mousedown', this, true);\n // Clear the internal menu reference.\n this._childMenu = null;\n // Reset the active index.\n this.activeIndex = -1;\n };\n /**\n * Handle the `menuRequested` signal of a child menu.\n */\n MenuBar.prototype._onMenuMenuRequested = function (sender, args) {\n // Bail if the sender is not the child menu.\n if (sender !== this._childMenu) {\n return;\n }\n // Look up the active index and menu count.\n var i = this._activeIndex;\n var n = this._menus.length;\n // Active the next requested index.\n switch (args) {\n case 'next':\n this.activeIndex = i === n - 1 ? 0 : i + 1;\n break;\n case 'previous':\n this.activeIndex = i === 0 ? n - 1 : i - 1;\n break;\n }\n // Open the active menu.\n this.openActiveMenu();\n };\n /**\n * Handle the `changed` signal of a title object.\n */\n MenuBar.prototype._onTitleChanged = function () {\n this.update();\n };\n return MenuBar;\n}(Widget));\n/**\n * The namespace for the `MenuBar` class statics.\n */\n(function (MenuBar) {\n /**\n * The default implementation of `IRenderer`.\n *\n * #### Notes\n * Subclasses are free to reimplement rendering methods as needed.\n */\n var Renderer = /** @class */ (function () {\n /**\n * Construct a new renderer.\n */\n function Renderer() {\n }\n /**\n * Render the virtual element for a menu bar item.\n *\n * @param data - The data to use for rendering the item.\n *\n * @returns A virtual element representing the item.\n */\n Renderer.prototype.renderItem = function (data) {\n var className = this.createItemClass(data);\n var dataset = this.createItemDataset(data);\n var aria = this.createItemARIA(data);\n return (_lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.li(__assign({ className: className, dataset: dataset }, aria), this.renderIcon(data), this.renderLabel(data)));\n };\n /**\n * Render the icon element for a menu bar item.\n *\n * @param data - The data to use for rendering the icon.\n *\n * @returns A virtual element representing the item icon.\n */\n Renderer.prototype.renderIcon = function (data) {\n var className = this.createIconClass(data);\n /* <DEPRECATED> */\n if (typeof data.title.icon === 'string') {\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: className }, data.title.iconLabel);\n }\n /* </DEPRECATED> */\n // if data.title.icon is undefined, it will be ignored\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: className }, data.title.icon, data.title.iconLabel);\n };\n /**\n * Render the label element for a menu item.\n *\n * @param data - The data to use for rendering the label.\n *\n * @returns A virtual element representing the item label.\n */\n Renderer.prototype.renderLabel = function (data) {\n var content = this.formatLabel(data);\n return _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.div({ className: 'lm-MenuBar-itemLabel'\n /* <DEPRECATED> */\n + ' p-MenuBar-itemLabel'\n /* </DEPRECATED> */\n }, content);\n };\n /**\n * Create the class name for the menu bar item.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the menu item.\n */\n Renderer.prototype.createItemClass = function (data) {\n var name = 'lm-MenuBar-item';\n /* <DEPRECATED> */\n name += ' p-MenuBar-item';\n /* </DEPRECATED> */\n if (data.title.className) {\n name += \" \" + data.title.className;\n }\n if (data.active) {\n name += ' lm-mod-active';\n /* <DEPRECATED> */\n name += ' p-mod-active';\n /* </DEPRECATED> */\n }\n return name;\n };\n /**\n * Create the dataset for a menu bar item.\n *\n * @param data - The data to use for the item.\n *\n * @returns The dataset for the menu bar item.\n */\n Renderer.prototype.createItemDataset = function (data) {\n return data.title.dataset;\n };\n /**\n * Create the aria attributes for menu bar item.\n *\n * @param data - The data to use for the aria attributes.\n *\n * @returns The aria attributes object for the item.\n */\n Renderer.prototype.createItemARIA = function (data) {\n return { role: 'menuitem', 'aria-haspopup': 'true' };\n };\n /**\n * Create the class name for the menu bar item icon.\n *\n * @param data - The data to use for the class name.\n *\n * @returns The full class name for the item icon.\n */\n Renderer.prototype.createIconClass = function (data) {\n var name = 'lm-MenuBar-itemIcon';\n /* <DEPRECATED> */\n name += ' p-MenuBar-itemIcon';\n /* </DEPRECATED> */\n var extra = data.title.iconClass;\n return extra ? name + \" \" + extra : name;\n };\n /**\n * Create the render content for the label node.\n *\n * @param data - The data to use for the label content.\n *\n * @returns The content to add to the label node.\n */\n Renderer.prototype.formatLabel = function (data) {\n // Fetch the label text and mnemonic index.\n var _a = data.title, label = _a.label, mnemonic = _a.mnemonic;\n // If the index is out of range, do not modify the label.\n if (mnemonic < 0 || mnemonic >= label.length) {\n return label;\n }\n // Split the label into parts.\n var prefix = label.slice(0, mnemonic);\n var suffix = label.slice(mnemonic + 1);\n var char = label[mnemonic];\n // Wrap the mnemonic character in a span.\n var span = _lumino_virtualdom__WEBPACK_IMPORTED_MODULE_7__.h.span({\n className: 'lm-MenuBar-itemMnemonic'\n /* <DEPRECATED> */\n + ' p-MenuBar-itemMnemonic'\n /* </DEPRECATED> */\n }, char);\n // Return the content parts.\n return [prefix, span, suffix];\n };\n return Renderer;\n }());\n MenuBar.Renderer = Renderer;\n /**\n * The default `Renderer` instance.\n */\n MenuBar.defaultRenderer = new Renderer();\n})(MenuBar || (MenuBar = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$c;\n(function (Private) {\n /**\n * Create the DOM node for a menu bar.\n */\n function createNode() {\n var node = document.createElement('div');\n var content = document.createElement('ul');\n content.className = 'lm-MenuBar-content';\n /* <DEPRECATED> */\n content.classList.add('p-MenuBar-content');\n /* </DEPRECATED> */\n node.appendChild(content);\n content.setAttribute('role', 'menubar');\n node.tabIndex = -1;\n return node;\n }\n Private.createNode = createNode;\n /**\n * Find the best matching mnemonic item.\n *\n * The search starts at the given index and wraps around.\n */\n function findMnemonic(menus, key, start) {\n // Setup the result variables.\n var index = -1;\n var auto = -1;\n var multiple = false;\n // Normalize the key to upper case.\n var upperKey = key.toUpperCase();\n // Search the items from the given start index.\n for (var i = 0, n = menus.length; i < n; ++i) {\n // Compute the wrapped index.\n var k = (i + start) % n;\n // Look up the menu title.\n var title = menus[k].title;\n // Ignore titles with an empty label.\n if (title.label.length === 0) {\n continue;\n }\n // Look up the mnemonic index for the label.\n var mn = title.mnemonic;\n // Handle a valid mnemonic index.\n if (mn >= 0 && mn < title.label.length) {\n if (title.label[mn].toUpperCase() === upperKey) {\n if (index === -1) {\n index = k;\n }\n else {\n multiple = true;\n }\n }\n continue;\n }\n // Finally, handle the auto index if possible.\n if (auto === -1 && title.label[0].toUpperCase() === upperKey) {\n auto = k;\n }\n }\n // Return the search results.\n return { index: index, multiple: multiple, auto: auto };\n }\n Private.findMnemonic = findMnemonic;\n})(Private$c || (Private$c = {}));\n\n/**\n * A widget which implements a canonical scroll bar.\n */\nvar ScrollBar = /** @class */ (function (_super) {\n __extends(ScrollBar, _super);\n /**\n * Construct a new scroll bar.\n *\n * @param options - The options for initializing the scroll bar.\n */\n function ScrollBar(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, { node: Private$d.createNode() }) || this;\n /**\n * A timeout callback for repeating the mouse press.\n */\n _this._onRepeat = function () {\n // Clear the repeat timer id.\n _this._repeatTimer = -1;\n // Bail if the mouse has been released.\n if (!_this._pressData) {\n return;\n }\n // Look up the part that was pressed.\n var part = _this._pressData.part;\n // Bail if the thumb was pressed.\n if (part === 'thumb') {\n return;\n }\n // Schedule the timer for another repeat.\n _this._repeatTimer = window.setTimeout(_this._onRepeat, 20);\n // Get the current mouse position.\n var mouseX = _this._pressData.mouseX;\n var mouseY = _this._pressData.mouseY;\n // Handle a decrement button repeat.\n if (part === 'decrement') {\n // Bail if the mouse is not over the button.\n if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(_this.decrementNode, mouseX, mouseY)) {\n return;\n }\n // Emit the step requested signal.\n _this._stepRequested.emit('decrement');\n // Finished.\n return;\n }\n // Handle an increment button repeat.\n if (part === 'increment') {\n // Bail if the mouse is not over the button.\n if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(_this.incrementNode, mouseX, mouseY)) {\n return;\n }\n // Emit the step requested signal.\n _this._stepRequested.emit('increment');\n // Finished.\n return;\n }\n // Handle a track repeat.\n if (part === 'track') {\n // Bail if the mouse is not over the track.\n if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(_this.trackNode, mouseX, mouseY)) {\n return;\n }\n // Fetch the thumb node.\n var thumbNode = _this.thumbNode;\n // Bail if the mouse is over the thumb.\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.hitTest(thumbNode, mouseX, mouseY)) {\n return;\n }\n // Fetch the client rect for the thumb.\n var thumbRect = thumbNode.getBoundingClientRect();\n // Determine the direction for the page request.\n var dir = void 0;\n if (_this._orientation === 'horizontal') {\n dir = mouseX < thumbRect.left ? 'decrement' : 'increment';\n }\n else {\n dir = mouseY < thumbRect.top ? 'decrement' : 'increment';\n }\n // Emit the page requested signal.\n _this._pageRequested.emit(dir);\n // Finished.\n return;\n }\n };\n _this._value = 0;\n _this._page = 10;\n _this._maximum = 100;\n _this._repeatTimer = -1;\n _this._pressData = null;\n _this._thumbMoved = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this._stepRequested = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this._pageRequested = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this.addClass('lm-ScrollBar');\n /* <DEPRECATED> */\n _this.addClass('p-ScrollBar');\n /* </DEPRECATED> */\n _this.setFlag(Widget.Flag.DisallowLayout);\n // Set the orientation.\n _this._orientation = options.orientation || 'vertical';\n _this.dataset['orientation'] = _this._orientation;\n // Parse the rest of the options.\n if (options.maximum !== undefined) {\n _this._maximum = Math.max(0, options.maximum);\n }\n if (options.page !== undefined) {\n _this._page = Math.max(0, options.page);\n }\n if (options.value !== undefined) {\n _this._value = Math.max(0, Math.min(options.value, _this._maximum));\n }\n return _this;\n }\n Object.defineProperty(ScrollBar.prototype, \"thumbMoved\", {\n /**\n * A signal emitted when the user moves the scroll thumb.\n *\n * #### Notes\n * The payload is the current value of the scroll bar.\n */\n get: function () {\n return this._thumbMoved;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"stepRequested\", {\n /**\n * A signal emitted when the user clicks a step button.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get: function () {\n return this._stepRequested;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"pageRequested\", {\n /**\n * A signal emitted when the user clicks the scroll track.\n *\n * #### Notes\n * The payload is whether a decrease or increase is requested.\n */\n get: function () {\n return this._pageRequested;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"orientation\", {\n /**\n * Get the orientation of the scroll bar.\n */\n get: function () {\n return this._orientation;\n },\n /**\n * Set the orientation of the scroll bar.\n */\n set: function (value) {\n // Do nothing if the orientation does not change.\n if (this._orientation === value) {\n return;\n }\n // Release the mouse before making changes.\n this._releaseMouse();\n // Update the internal orientation.\n this._orientation = value;\n this.dataset['orientation'] = value;\n // Schedule an update the scroll bar.\n this.update();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"value\", {\n /**\n * Get the current value of the scroll bar.\n */\n get: function () {\n return this._value;\n },\n /**\n * Set the current value of the scroll bar.\n *\n * #### Notes\n * The value will be clamped to the range `[0, maximum]`.\n */\n set: function (value) {\n // Clamp the value to the allowable range.\n value = Math.max(0, Math.min(value, this._maximum));\n // Do nothing if the value does not change.\n if (this._value === value) {\n return;\n }\n // Update the internal value.\n this._value = value;\n // Schedule an update the scroll bar.\n this.update();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"page\", {\n /**\n * Get the page size of the scroll bar.\n *\n * #### Notes\n * The page size is the amount of visible content in the scrolled\n * region, expressed in data units. It determines the size of the\n * scroll bar thumb.\n */\n get: function () {\n return this._page;\n },\n /**\n * Set the page size of the scroll bar.\n *\n * #### Notes\n * The page size will be clamped to the range `[0, Infinity]`.\n */\n set: function (value) {\n // Clamp the page size to the allowable range.\n value = Math.max(0, value);\n // Do nothing if the value does not change.\n if (this._page === value) {\n return;\n }\n // Update the internal page size.\n this._page = value;\n // Schedule an update the scroll bar.\n this.update();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"maximum\", {\n /**\n * Get the maximum value of the scroll bar.\n */\n get: function () {\n return this._maximum;\n },\n /**\n * Set the maximum value of the scroll bar.\n *\n * #### Notes\n * The max size will be clamped to the range `[0, Infinity]`.\n */\n set: function (value) {\n // Clamp the value to the allowable range.\n value = Math.max(0, value);\n // Do nothing if the value does not change.\n if (this._maximum === value) {\n return;\n }\n // Update the internal values.\n this._maximum = value;\n // Clamp the current value to the new range.\n this._value = Math.min(this._value, value);\n // Schedule an update the scroll bar.\n this.update();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"decrementNode\", {\n /**\n * The scroll bar decrement button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-ScrollBar-button')[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"incrementNode\", {\n /**\n * The scroll bar increment button node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-ScrollBar-button')[1];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"trackNode\", {\n /**\n * The scroll bar track node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-ScrollBar-track')[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ScrollBar.prototype, \"thumbNode\", {\n /**\n * The scroll bar thumb node.\n *\n * #### Notes\n * Modifying this node directly can lead to undefined behavior.\n */\n get: function () {\n return this.node.getElementsByClassName('lm-ScrollBar-thumb')[0];\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Handle the DOM events for the scroll bar.\n *\n * @param event - The DOM event sent to the scroll bar.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the scroll bar's DOM node.\n *\n * This should not be called directly by user code.\n */\n ScrollBar.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event);\n break;\n case 'mousemove':\n this._evtMouseMove(event);\n break;\n case 'mouseup':\n this._evtMouseUp(event);\n break;\n case 'keydown':\n this._evtKeyDown(event);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n };\n /**\n * A method invoked on a 'before-attach' message.\n */\n ScrollBar.prototype.onBeforeAttach = function (msg) {\n this.node.addEventListener('mousedown', this);\n this.update();\n };\n /**\n * A method invoked on an 'after-detach' message.\n */\n ScrollBar.prototype.onAfterDetach = function (msg) {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n };\n /**\n * A method invoked on an 'update-request' message.\n */\n ScrollBar.prototype.onUpdateRequest = function (msg) {\n // Convert the value and page into percentages.\n var value = this._value * 100 / this._maximum;\n var page = this._page * 100 / (this._page + this._maximum);\n // Clamp the value and page to the relevant range.\n value = Math.max(0, Math.min(value, 100));\n page = Math.max(0, Math.min(page, 100));\n // Fetch the thumb style.\n var thumbStyle = this.thumbNode.style;\n // Update the thumb style for the current orientation.\n if (this._orientation === 'horizontal') {\n thumbStyle.top = '';\n thumbStyle.height = '';\n thumbStyle.left = value + \"%\";\n thumbStyle.width = page + \"%\";\n thumbStyle.transform = \"translate(\" + -value + \"%, 0%)\";\n }\n else {\n thumbStyle.left = '';\n thumbStyle.width = '';\n thumbStyle.top = value + \"%\";\n thumbStyle.height = page + \"%\";\n thumbStyle.transform = \"translate(0%, \" + -value + \"%)\";\n }\n };\n /**\n * Handle the `'keydown'` event for the scroll bar.\n */\n ScrollBar.prototype._evtKeyDown = function (event) {\n // Stop all input events during drag.\n event.preventDefault();\n event.stopPropagation();\n // Ignore anything except the `Escape` key.\n if (event.keyCode !== 27) {\n return;\n }\n // Fetch the previous scroll value.\n var value = this._pressData ? this._pressData.value : -1;\n // Release the mouse.\n this._releaseMouse();\n // Restore the old scroll value if possible.\n if (value !== -1) {\n this._moveThumb(value);\n }\n };\n /**\n * Handle the `'mousedown'` event for the scroll bar.\n */\n ScrollBar.prototype._evtMouseDown = function (event) {\n // Do nothing if it's not a left mouse press.\n if (event.button !== 0) {\n return;\n }\n // Send an activate request to the scroll bar. This can be\n // used by message hooks to activate something relevant.\n this.activate();\n // Do nothing if the mouse is already captured.\n if (this._pressData) {\n return;\n }\n // Find the pressed scroll bar part.\n var part = Private$d.findPart(this, event.target);\n // Do nothing if the part is not of interest.\n if (!part) {\n return;\n }\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n // Override the mouse cursor.\n var override = _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_10__.Drag.overrideCursor('default');\n // Set up the press data.\n this._pressData = {\n part: part, override: override,\n delta: -1, value: -1,\n mouseX: event.clientX,\n mouseY: event.clientY\n };\n // Add the extra event listeners.\n document.addEventListener('mousemove', this, true);\n document.addEventListener('mouseup', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n // Handle a thumb press.\n if (part === 'thumb') {\n // Fetch the thumb node.\n var thumbNode = this.thumbNode;\n // Fetch the client rect for the thumb.\n var thumbRect = thumbNode.getBoundingClientRect();\n // Update the press data delta for the current orientation.\n if (this._orientation === 'horizontal') {\n this._pressData.delta = event.clientX - thumbRect.left;\n }\n else {\n this._pressData.delta = event.clientY - thumbRect.top;\n }\n // Add the active class to the thumb node.\n thumbNode.classList.add('lm-mod-active');\n /* <DEPRECATED> */\n thumbNode.classList.add('p-mod-active');\n /* </DEPRECATED> */\n // Store the current value in the press data.\n this._pressData.value = this._value;\n // Finished.\n return;\n }\n // Handle a track press.\n if (part === 'track') {\n // Fetch the client rect for the thumb.\n var thumbRect = this.thumbNode.getBoundingClientRect();\n // Determine the direction for the page request.\n var dir = void 0;\n if (this._orientation === 'horizontal') {\n dir = event.clientX < thumbRect.left ? 'decrement' : 'increment';\n }\n else {\n dir = event.clientY < thumbRect.top ? 'decrement' : 'increment';\n }\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n // Emit the page requested signal.\n this._pageRequested.emit(dir);\n // Finished.\n return;\n }\n // Handle a decrement button press.\n if (part === 'decrement') {\n // Add the active class to the decrement node.\n this.decrementNode.classList.add('lm-mod-active');\n /* <DEPRECATED> */\n this.decrementNode.classList.add('p-mod-active');\n /* </DEPRECATED> */\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n // Emit the step requested signal.\n this._stepRequested.emit('decrement');\n // Finished.\n return;\n }\n // Handle an increment button press.\n if (part === 'increment') {\n // Add the active class to the increment node.\n this.incrementNode.classList.add('lm-mod-active');\n /* <DEPRECATED> */\n this.incrementNode.classList.add('p-mod-active');\n /* </DEPRECATED> */\n // Start the repeat timer.\n this._repeatTimer = window.setTimeout(this._onRepeat, 350);\n // Emit the step requested signal.\n this._stepRequested.emit('increment');\n // Finished.\n return;\n }\n };\n /**\n * Handle the `'mousemove'` event for the scroll bar.\n */\n ScrollBar.prototype._evtMouseMove = function (event) {\n // Do nothing if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n // Update the mouse position.\n this._pressData.mouseX = event.clientX;\n this._pressData.mouseY = event.clientY;\n // Bail if the thumb is not being dragged.\n if (this._pressData.part !== 'thumb') {\n return;\n }\n // Get the client rect for the thumb and track.\n var thumbRect = this.thumbNode.getBoundingClientRect();\n var trackRect = this.trackNode.getBoundingClientRect();\n // Fetch the scroll geometry based on the orientation.\n var trackPos;\n var trackSpan;\n if (this._orientation === 'horizontal') {\n trackPos = event.clientX - trackRect.left - this._pressData.delta;\n trackSpan = trackRect.width - thumbRect.width;\n }\n else {\n trackPos = event.clientY - trackRect.top - this._pressData.delta;\n trackSpan = trackRect.height - thumbRect.height;\n }\n // Compute the desired value from the scroll geometry.\n var value = trackSpan === 0 ? 0 : trackPos * this._maximum / trackSpan;\n // Move the thumb to the computed value.\n this._moveThumb(value);\n };\n /**\n * Handle the `'mouseup'` event for the scroll bar.\n */\n ScrollBar.prototype._evtMouseUp = function (event) {\n // Do nothing if it's not a left mouse release.\n if (event.button !== 0) {\n return;\n }\n // Stop the event propagation.\n event.preventDefault();\n event.stopPropagation();\n // Release the mouse.\n this._releaseMouse();\n };\n /**\n * Release the mouse and restore the node states.\n */\n ScrollBar.prototype._releaseMouse = function () {\n // Bail if there is no press data.\n if (!this._pressData) {\n return;\n }\n // Clear the repeat timer.\n clearTimeout(this._repeatTimer);\n this._repeatTimer = -1;\n // Clear the press data.\n this._pressData.override.dispose();\n this._pressData = null;\n // Remove the extra event listeners.\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n // Remove the active classes from the nodes.\n this.thumbNode.classList.remove('lm-mod-active');\n this.decrementNode.classList.remove('lm-mod-active');\n this.incrementNode.classList.remove('lm-mod-active');\n /* <DEPRECATED> */\n this.thumbNode.classList.remove('p-mod-active');\n this.decrementNode.classList.remove('p-mod-active');\n this.incrementNode.classList.remove('p-mod-active');\n /* </DEPRECATED> */\n };\n /**\n * Move the thumb to the specified position.\n */\n ScrollBar.prototype._moveThumb = function (value) {\n // Clamp the value to the allowed range.\n value = Math.max(0, Math.min(value, this._maximum));\n // Bail if the value does not change.\n if (this._value === value) {\n return;\n }\n // Update the internal value.\n this._value = value;\n // Schedule an update of the scroll bar.\n this.update();\n // Emit the thumb moved signal.\n this._thumbMoved.emit(value);\n };\n return ScrollBar;\n}(Widget));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$d;\n(function (Private) {\n /**\n * Create the DOM node for a scroll bar.\n */\n function createNode() {\n var node = document.createElement('div');\n var decrement = document.createElement('div');\n var increment = document.createElement('div');\n var track = document.createElement('div');\n var thumb = document.createElement('div');\n decrement.className = 'lm-ScrollBar-button';\n increment.className = 'lm-ScrollBar-button';\n decrement.dataset['action'] = 'decrement';\n increment.dataset['action'] = 'increment';\n track.className = 'lm-ScrollBar-track';\n thumb.className = 'lm-ScrollBar-thumb';\n /* <DEPRECATED> */\n decrement.classList.add('p-ScrollBar-button');\n increment.classList.add('p-ScrollBar-button');\n track.classList.add('p-ScrollBar-track');\n thumb.classList.add('p-ScrollBar-thumb');\n /* </DEPRECATED> */\n track.appendChild(thumb);\n node.appendChild(decrement);\n node.appendChild(track);\n node.appendChild(increment);\n return node;\n }\n Private.createNode = createNode;\n /**\n * Find the scroll bar part which contains the given target.\n */\n function findPart(scrollBar, target) {\n // Test the thumb.\n if (scrollBar.thumbNode.contains(target)) {\n return 'thumb';\n }\n // Test the track.\n if (scrollBar.trackNode.contains(target)) {\n return 'track';\n }\n // Test the decrement button.\n if (scrollBar.decrementNode.contains(target)) {\n return 'decrement';\n }\n // Test the increment button.\n if (scrollBar.incrementNode.contains(target)) {\n return 'increment';\n }\n // Indicate no match.\n return null;\n }\n Private.findPart = findPart;\n})(Private$d || (Private$d = {}));\n\n/**\n * A concrete layout implementation which holds a single widget.\n *\n * #### Notes\n * This class is useful for creating simple container widgets which\n * hold a single child. The child should be positioned with CSS.\n */\nvar SingletonLayout = /** @class */ (function (_super) {\n __extends(SingletonLayout, _super);\n function SingletonLayout() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._widget = null;\n return _this;\n }\n /**\n * Dispose of the resources held by the layout.\n */\n SingletonLayout.prototype.dispose = function () {\n if (this._widget) {\n var widget = this._widget;\n this._widget = null;\n widget.dispose();\n }\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(SingletonLayout.prototype, \"widget\", {\n /**\n * Get the child widget for the layout.\n */\n get: function () {\n return this._widget;\n },\n /**\n * Set the child widget for the layout.\n *\n * #### Notes\n * Setting the child widget will cause the old child widget to be\n * automatically disposed. If that is not desired, set the parent\n * of the old child to `null` before assigning a new child.\n */\n set: function (widget) {\n // Remove the widget from its current parent. This is a no-op\n // if the widget's parent is already the layout parent widget.\n if (widget) {\n widget.parent = this.parent;\n }\n // Bail early if the widget does not change.\n if (this._widget === widget) {\n return;\n }\n // Dispose of the old child widget.\n if (this._widget) {\n this._widget.dispose();\n }\n // Update the internal widget.\n this._widget = widget;\n // Attach the new child widget if needed.\n if (this.parent && widget) {\n this.attachWidget(widget);\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Create an iterator over the widgets in the layout.\n *\n * @returns A new iterator over the widgets in the layout.\n */\n SingletonLayout.prototype.iter = function () {\n return this._widget ? (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.once)(this._widget) : (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.empty)();\n };\n /**\n * Remove a widget from the layout.\n *\n * @param widget - The widget to remove from the layout.\n *\n * #### Notes\n * A widget is automatically removed from the layout when its `parent`\n * is set to `null`. This method should only be invoked directly when\n * removing a widget from a layout which has yet to be installed on a\n * parent widget.\n *\n * This method does *not* modify the widget's `parent`.\n */\n SingletonLayout.prototype.removeWidget = function (widget) {\n // Bail early if the widget does not exist in the layout.\n if (this._widget !== widget) {\n return;\n }\n // Clear the internal widget.\n this._widget = null;\n // If the layout is parented, detach the widget from the DOM.\n if (this.parent) {\n this.detachWidget(widget);\n }\n };\n /**\n * Perform layout initialization which requires the parent widget.\n */\n SingletonLayout.prototype.init = function () {\n var _this = this;\n _super.prototype.init.call(this);\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this, function (widget) { _this.attachWidget(widget); });\n };\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation adds the widgets's node to the parent's\n * node at the proper location, and sends the appropriate attach\n * messages to the widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is added to the parent's node.\n */\n SingletonLayout.prototype.attachWidget = function (widget) {\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n // Add the widget's node to the parent.\n this.parent.node.appendChild(widget.node);\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n };\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This method is called automatically by the single layout at the\n * appropriate time. It should not be called directly by user code.\n *\n * The default implementation removes the widget's node from the\n * parent's node, and sends the appropriate detach messages to the\n * widget if the parent is attached to the DOM.\n *\n * Subclasses may reimplement this method to control how the widget's\n * node is removed from the parent's node.\n */\n SingletonLayout.prototype.detachWidget = function (widget) {\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n // Remove the widget's node from the parent.\n this.parent.node.removeChild(widget.node);\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n };\n return SingletonLayout;\n}(Layout));\n\n/**\n * A layout which arranges its widgets into resizable sections.\n */\nvar SplitLayout = /** @class */ (function (_super) {\n __extends(SplitLayout, _super);\n /**\n * Construct a new split layout.\n *\n * @param options - The options for initializing the layout.\n */\n function SplitLayout(options) {\n var _this = _super.call(this) || this;\n _this._fixed = 0;\n _this._spacing = 4;\n _this._dirty = false;\n _this._hasNormedSizes = false;\n _this._sizers = [];\n _this._items = [];\n _this._handles = [];\n _this._box = null;\n _this._alignment = 'start';\n _this._orientation = 'horizontal';\n _this.renderer = options.renderer;\n if (options.orientation !== undefined) {\n _this._orientation = options.orientation;\n }\n if (options.alignment !== undefined) {\n _this._alignment = options.alignment;\n }\n if (options.spacing !== undefined) {\n _this._spacing = Private$e.clampSpacing(options.spacing);\n }\n return _this;\n }\n /**\n * Dispose of the resources held by the layout.\n */\n SplitLayout.prototype.dispose = function () {\n // Dispose of the layout items.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this._items, function (item) { item.dispose(); });\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n this._sizers.length = 0;\n this._handles.length = 0;\n // Dispose of the rest of the layout.\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(SplitLayout.prototype, \"orientation\", {\n /**\n * Get the layout orientation for the split layout.\n */\n get: function () {\n return this._orientation;\n },\n /**\n * Set the layout orientation for the split layout.\n */\n set: function (value) {\n if (this._orientation === value) {\n return;\n }\n this._orientation = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['orientation'] = value;\n this.parent.fit();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SplitLayout.prototype, \"alignment\", {\n /**\n * Get the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n get: function () {\n return this._alignment;\n },\n /**\n * Set the content alignment for the split layout.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split layout.\n */\n set: function (value) {\n if (this._alignment === value) {\n return;\n }\n this._alignment = value;\n if (!this.parent) {\n return;\n }\n this.parent.dataset['alignment'] = value;\n this.parent.update();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SplitLayout.prototype, \"spacing\", {\n /**\n * Get the inter-element spacing for the split layout.\n */\n get: function () {\n return this._spacing;\n },\n /**\n * Set the inter-element spacing for the split layout.\n */\n set: function (value) {\n value = Private$e.clampSpacing(value);\n if (this._spacing === value) {\n return;\n }\n this._spacing = value;\n if (!this.parent) {\n return;\n }\n this.parent.fit();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SplitLayout.prototype, \"handles\", {\n /**\n * A read-only array of the split handles in the layout.\n */\n get: function () {\n return this._handles;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Get the relative sizes of the widgets in the layout.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n SplitLayout.prototype.relativeSizes = function () {\n return Private$e.normalize(this._sizers.map(function (sizer) { return sizer.size; }));\n };\n /**\n * Set the relative sizes for the widgets in the layout.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n SplitLayout.prototype.setRelativeSizes = function (sizes) {\n // Copy the sizes and pad with zeros as needed.\n var n = this._sizers.length;\n var temp = sizes.slice(0, n);\n while (temp.length < n) {\n temp.push(0);\n }\n // Normalize the padded sizes.\n var normed = Private$e.normalize(temp);\n // Apply the normalized sizes to the sizers.\n for (var i = 0; i < n; ++i) {\n var sizer = this._sizers[i];\n sizer.sizeHint = normed[i];\n sizer.size = normed[i];\n }\n // Set the flag indicating the sizes are normalized.\n this._hasNormedSizes = true;\n // Trigger an update of the parent widget.\n if (this.parent) {\n this.parent.update();\n }\n };\n /**\n * Move the offset position of a split handle.\n *\n * @param index - The index of the handle of the interest.\n *\n * @param position - The desired offset position of the handle.\n *\n * #### Notes\n * The position is relative to the offset parent.\n *\n * This will move the handle as close as possible to the desired\n * position. The sibling widgets will be adjusted as necessary.\n */\n SplitLayout.prototype.moveHandle = function (index, position) {\n // Bail if the index is invalid or the handle is hidden.\n var handle = this._handles[index];\n if (!handle || handle.classList.contains('lm-mod-hidden')) {\n return;\n }\n // Compute the desired delta movement for the handle.\n var delta;\n if (this._orientation === 'horizontal') {\n delta = position - handle.offsetLeft;\n }\n else {\n delta = position - handle.offsetTop;\n }\n // Bail if there is no handle movement.\n if (delta === 0) {\n return;\n }\n // Prevent widget resizing unless needed.\n for (var _i = 0, _a = this._sizers; _i < _a.length; _i++) {\n var sizer = _a[_i];\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n }\n // Adjust the sizers to reflect the handle movement.\n BoxEngine.adjust(this._sizers, index, delta);\n // Update the layout of the widgets.\n if (this.parent) {\n this.parent.update();\n }\n };\n /**\n * Perform layout initialization which requires the parent widget.\n */\n SplitLayout.prototype.init = function () {\n this.parent.dataset['orientation'] = this.orientation;\n this.parent.dataset['alignment'] = this.alignment;\n _super.prototype.init.call(this);\n };\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n SplitLayout.prototype.attachWidget = function (index, widget) {\n // Create the item, handle, and sizer for the new widget.\n var item = new LayoutItem(widget);\n var handle = Private$e.createHandle(this.renderer);\n var average = Private$e.averageSize(this._sizers);\n var sizer = Private$e.createSizer(average);\n // Insert the item, handle, and sizer into the internal arrays.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._items, index, item);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._sizers, index, sizer);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._handles, index, handle);\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n // Add the widget and handle nodes to the parent.\n this.parent.node.appendChild(widget.node);\n this.parent.node.appendChild(handle);\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n SplitLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {\n // Move the item, sizer, and handle for the widget.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._items, fromIndex, toIndex);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._sizers, fromIndex, toIndex);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._handles, fromIndex, toIndex);\n // Post a fit request to the parent to show/hide last handle.\n this.parent.fit();\n };\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n SplitLayout.prototype.detachWidget = function (index, widget) {\n // Remove the item, handle, and sizer for the widget.\n var item = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._items, index);\n var handle = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._handles, index);\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._sizers, index);\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n // Remove the widget and handle nodes from the parent.\n this.parent.node.removeChild(widget.node);\n this.parent.node.removeChild(handle);\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n // Dispose of the layout item.\n item.dispose();\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n SplitLayout.prototype.onBeforeShow = function (msg) {\n _super.prototype.onBeforeShow.call(this, msg);\n this.parent.update();\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n SplitLayout.prototype.onBeforeAttach = function (msg) {\n _super.prototype.onBeforeAttach.call(this, msg);\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n SplitLayout.prototype.onChildShown = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n SplitLayout.prototype.onChildHidden = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'resize'` message.\n */\n SplitLayout.prototype.onResize = function (msg) {\n if (this.parent.isVisible) {\n this._update(msg.width, msg.height);\n }\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n SplitLayout.prototype.onUpdateRequest = function (msg) {\n if (this.parent.isVisible) {\n this._update(-1, -1);\n }\n };\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n SplitLayout.prototype.onFitRequest = function (msg) {\n if (this.parent.isAttached) {\n this._fit();\n }\n };\n /**\n * Fit the layout to the total size required by the widgets.\n */\n SplitLayout.prototype._fit = function () {\n // Update the handles and track the visible widget count.\n var nVisible = 0;\n var lastHandleIndex = -1;\n for (var i = 0, n = this._items.length; i < n; ++i) {\n if (this._items[i].isHidden) {\n this._handles[i].classList.add('lm-mod-hidden');\n /* <DEPRECATED> */\n this._handles[i].classList.add('p-mod-hidden');\n /* </DEPRECATED> */\n }\n else {\n this._handles[i].classList.remove('lm-mod-hidden');\n /* <DEPRECATED> */\n this._handles[i].classList.remove('p-mod-hidden');\n /* </DEPRECATED> */\n lastHandleIndex = i;\n nVisible++;\n }\n }\n // Hide the handle for the last visible widget.\n if (lastHandleIndex !== -1) {\n this._handles[lastHandleIndex].classList.add('lm-mod-hidden');\n /* <DEPRECATED> */\n this._handles[lastHandleIndex].classList.add('p-mod-hidden');\n /* </DEPRECATED> */\n }\n // Update the fixed space for the visible items.\n this._fixed = this._spacing * Math.max(0, nVisible - 1);\n // Setup the computed minimum size.\n var horz = this._orientation === 'horizontal';\n var minW = horz ? this._fixed : 0;\n var minH = horz ? 0 : this._fixed;\n // Update the sizers and computed size limits.\n for (var i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item and corresponding box sizer.\n var item = this._items[i];\n var sizer = this._sizers[i];\n // Prevent resizing unless necessary.\n if (sizer.size > 0) {\n sizer.sizeHint = sizer.size;\n }\n // If the item is hidden, it should consume zero size.\n if (item.isHidden) {\n sizer.minSize = 0;\n sizer.maxSize = 0;\n continue;\n }\n // Update the size limits for the item.\n item.fit();\n // Update the stretch factor.\n sizer.stretch = SplitLayout.getStretch(item.widget);\n // Update the sizer limits and computed min size.\n if (horz) {\n sizer.minSize = item.minWidth;\n sizer.maxSize = item.maxWidth;\n minW += item.minWidth;\n minH = Math.max(minH, item.minHeight);\n }\n else {\n sizer.minSize = item.minHeight;\n sizer.maxSize = item.maxHeight;\n minH += item.minHeight;\n minW = Math.max(minW, item.minWidth);\n }\n }\n // Update the box sizing and add it to the computed min size.\n var box = this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n minW += box.horizontalSum;\n minH += box.verticalSum;\n // Update the parent's min size constraints.\n var style = this.parent.node.style;\n style.minWidth = minW + \"px\";\n style.minHeight = minH + \"px\";\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent.parent) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest);\n }\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);\n }\n };\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n SplitLayout.prototype._update = function (offsetWidth, offsetHeight) {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n // Compute the visible item count.\n var nVisible = 0;\n for (var i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent.node.offsetHeight;\n }\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n }\n // Compute the actual layout bounds adjusted for border and padding.\n var top = this._box.paddingTop;\n var left = this._box.paddingLeft;\n var width = offsetWidth - this._box.horizontalSum;\n var height = offsetHeight - this._box.verticalSum;\n // Compute the adjusted layout space.\n var space;\n var horz = this._orientation === 'horizontal';\n if (horz) {\n space = Math.max(0, width - this._fixed);\n }\n else {\n space = Math.max(0, height - this._fixed);\n }\n // Scale the size hints if they are normalized.\n if (this._hasNormedSizes) {\n for (var _i = 0, _a = this._sizers; _i < _a.length; _i++) {\n var sizer = _a[_i];\n sizer.sizeHint *= space;\n }\n this._hasNormedSizes = false;\n }\n // Distribute the layout space to the box sizers.\n var delta = BoxEngine.calc(this._sizers, space);\n // Set up the variables for justification and alignment offset.\n var extra = 0;\n var offset = 0;\n // Account for alignment if there is extra layout space.\n if (delta > 0) {\n switch (this._alignment) {\n case 'start':\n break;\n case 'center':\n extra = 0;\n offset = delta / 2;\n break;\n case 'end':\n extra = 0;\n offset = delta;\n break;\n case 'justify':\n extra = delta / nVisible;\n offset = 0;\n break;\n default:\n throw 'unreachable';\n }\n }\n // Layout the items using the computed box sizes.\n for (var i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n var item = this._items[i];\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n // Fetch the computed size for the widget.\n var size = this._sizers[i].size;\n // Fetch the style for the handle.\n var handleStyle = this._handles[i].style;\n // Update the widget and handle, and advance the relevant edge.\n if (horz) {\n item.update(left + offset, top, size + extra, height);\n left += size + extra;\n handleStyle.top = top + \"px\";\n handleStyle.left = left + offset + \"px\";\n handleStyle.width = this._spacing + \"px\";\n handleStyle.height = height + \"px\";\n left += this._spacing;\n }\n else {\n item.update(left, top + offset, width, size + extra);\n top += size + extra;\n handleStyle.top = top + offset + \"px\";\n handleStyle.left = left + \"px\";\n handleStyle.width = width + \"px\";\n handleStyle.height = this._spacing + \"px\";\n top += this._spacing;\n }\n }\n };\n return SplitLayout;\n}(PanelLayout));\n/**\n * The namespace for the `SplitLayout` class statics.\n */\n(function (SplitLayout) {\n /**\n * Get the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split layout stretch factor for the widget.\n */\n function getStretch(widget) {\n return Private$e.stretchProperty.get(widget);\n }\n SplitLayout.getStretch = getStretch;\n /**\n * Set the split layout stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n function setStretch(widget, value) {\n Private$e.stretchProperty.set(widget, value);\n }\n SplitLayout.setStretch = setStretch;\n})(SplitLayout || (SplitLayout = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$e;\n(function (Private) {\n /**\n * The property descriptor for a widget stretch factor.\n */\n Private.stretchProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_3__.AttachedProperty({\n name: 'stretch',\n create: function () { return 0; },\n coerce: function (owner, value) { return Math.max(0, Math.floor(value)); },\n changed: onChildSizingChanged\n });\n /**\n * Create a new box sizer with the given size hint.\n */\n function createSizer(size) {\n var sizer = new BoxSizer();\n sizer.sizeHint = Math.floor(size);\n return sizer;\n }\n Private.createSizer = createSizer;\n /**\n * Create a new split handle node using the given renderer.\n */\n function createHandle(renderer) {\n var handle = renderer.createHandle();\n handle.style.position = 'absolute';\n return handle;\n }\n Private.createHandle = createHandle;\n /**\n * Clamp a spacing value to an integer >= 0.\n */\n function clampSpacing(value) {\n return Math.max(0, Math.floor(value));\n }\n Private.clampSpacing = clampSpacing;\n /**\n * Compute the average size of an array of box sizers.\n */\n function averageSize(sizers) {\n return sizers.reduce(function (v, s) { return v + s.size; }, 0) / sizers.length || 0;\n }\n Private.averageSize = averageSize;\n /**\n * Normalize an array of values.\n */\n function normalize(values) {\n var n = values.length;\n if (n === 0) {\n return [];\n }\n var sum = values.reduce(function (a, b) { return a + Math.abs(b); }, 0);\n return sum === 0 ? values.map(function (v) { return 1 / n; }) : values.map(function (v) { return v / sum; });\n }\n Private.normalize = normalize;\n /**\n * The change handler for the attached sizing properties.\n */\n function onChildSizingChanged(child) {\n if (child.parent && child.parent.layout instanceof SplitLayout) {\n child.parent.fit();\n }\n }\n})(Private$e || (Private$e = {}));\n\n/**\n * A panel which arranges its widgets into resizable sections.\n *\n * #### Notes\n * This class provides a convenience wrapper around a [[SplitLayout]].\n */\nvar SplitPanel = /** @class */ (function (_super) {\n __extends(SplitPanel, _super);\n /**\n * Construct a new split panel.\n *\n * @param options - The options for initializing the split panel.\n */\n function SplitPanel(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, { layout: Private$f.createLayout(options) }) || this;\n _this._pressData = null;\n _this.addClass('lm-SplitPanel');\n /* <DEPRECATED> */\n _this.addClass('p-SplitPanel');\n return _this;\n /* </DEPRECATED> */\n }\n /**\n * Dispose of the resources held by the panel.\n */\n SplitPanel.prototype.dispose = function () {\n this._releaseMouse();\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(SplitPanel.prototype, \"orientation\", {\n /**\n * Get the layout orientation for the split panel.\n */\n get: function () {\n return this.layout.orientation;\n },\n /**\n * Set the layout orientation for the split panel.\n */\n set: function (value) {\n this.layout.orientation = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SplitPanel.prototype, \"alignment\", {\n /**\n * Get the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n get: function () {\n return this.layout.alignment;\n },\n /**\n * Set the content alignment for the split panel.\n *\n * #### Notes\n * This is the alignment of the widgets in the layout direction.\n *\n * The alignment has no effect if the widgets can expand to fill the\n * entire split panel.\n */\n set: function (value) {\n this.layout.alignment = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SplitPanel.prototype, \"spacing\", {\n /**\n * Get the inter-element spacing for the split panel.\n */\n get: function () {\n return this.layout.spacing;\n },\n /**\n * Set the inter-element spacing for the split panel.\n */\n set: function (value) {\n this.layout.spacing = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SplitPanel.prototype, \"renderer\", {\n /**\n * The renderer used by the split panel.\n */\n get: function () {\n return this.layout.renderer;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SplitPanel.prototype, \"handles\", {\n /**\n * A read-only array of the split handles in the panel.\n */\n get: function () {\n return this.layout.handles;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Get the relative sizes of the widgets in the panel.\n *\n * @returns A new array of the relative sizes of the widgets.\n *\n * #### Notes\n * The returned sizes reflect the sizes of the widgets normalized\n * relative to their siblings.\n *\n * This method **does not** measure the DOM nodes.\n */\n SplitPanel.prototype.relativeSizes = function () {\n return this.layout.relativeSizes();\n };\n /**\n * Set the relative sizes for the widgets in the panel.\n *\n * @param sizes - The relative sizes for the widgets in the panel.\n *\n * #### Notes\n * Extra values are ignored, too few will yield an undefined layout.\n *\n * The actual geometry of the DOM nodes is updated asynchronously.\n */\n SplitPanel.prototype.setRelativeSizes = function (sizes) {\n this.layout.setRelativeSizes(sizes);\n };\n /**\n * Handle the DOM events for the split panel.\n *\n * @param event - The DOM event sent to the panel.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the panel's DOM node. It should\n * not be called directly by user code.\n */\n SplitPanel.prototype.handleEvent = function (event) {\n switch (event.type) {\n case 'mousedown':\n this._evtMouseDown(event);\n break;\n case 'mousemove':\n this._evtMouseMove(event);\n break;\n case 'mouseup':\n this._evtMouseUp(event);\n break;\n case 'keydown':\n this._evtKeyDown(event);\n break;\n case 'contextmenu':\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n SplitPanel.prototype.onBeforeAttach = function (msg) {\n this.node.addEventListener('mousedown', this);\n };\n /**\n * A message handler invoked on an `'after-detach'` message.\n */\n SplitPanel.prototype.onAfterDetach = function (msg) {\n this.node.removeEventListener('mousedown', this);\n this._releaseMouse();\n };\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n SplitPanel.prototype.onChildAdded = function (msg) {\n msg.child.addClass('lm-SplitPanel-child');\n /* <DEPRECATED> */\n msg.child.addClass('p-SplitPanel-child');\n /* </DEPRECATED> */\n this._releaseMouse();\n };\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n SplitPanel.prototype.onChildRemoved = function (msg) {\n msg.child.removeClass('lm-SplitPanel-child');\n /* <DEPRECATED> */\n msg.child.removeClass('p-SplitPanel-child');\n /* </DEPRECATED> */\n this._releaseMouse();\n };\n /**\n * Handle the `'keydown'` event for the split panel.\n */\n SplitPanel.prototype._evtKeyDown = function (event) {\n // Stop input events during drag.\n event.preventDefault();\n event.stopPropagation();\n // Release the mouse if `Escape` is pressed.\n if (event.keyCode === 27) {\n this._releaseMouse();\n }\n };\n /**\n * Handle the `'mousedown'` event for the split panel.\n */\n SplitPanel.prototype._evtMouseDown = function (event) {\n // Do nothing if the left mouse button is not pressed.\n if (event.button !== 0) {\n return;\n }\n // Find the handle which contains the mouse target, if any.\n var layout = this.layout;\n var index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.findFirstIndex(layout.handles, function (handle) {\n return handle.contains(event.target);\n });\n // Bail early if the mouse press was not on a handle.\n if (index === -1) {\n return;\n }\n // Stop the event when a split handle is pressed.\n event.preventDefault();\n event.stopPropagation();\n // Add the extra document listeners.\n document.addEventListener('mouseup', this, true);\n document.addEventListener('mousemove', this, true);\n document.addEventListener('keydown', this, true);\n document.addEventListener('contextmenu', this, true);\n // Compute the offset delta for the handle press.\n var delta;\n var handle = layout.handles[index];\n var rect = handle.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n delta = event.clientX - rect.left;\n }\n else {\n delta = event.clientY - rect.top;\n }\n // Override the cursor and store the press data.\n var style = window.getComputedStyle(handle);\n var override = _lumino_dragdrop__WEBPACK_IMPORTED_MODULE_10__.Drag.overrideCursor(style.cursor);\n this._pressData = { index: index, delta: delta, override: override };\n };\n /**\n * Handle the `'mousemove'` event for the split panel.\n */\n SplitPanel.prototype._evtMouseMove = function (event) {\n // Stop the event when dragging a split handle.\n event.preventDefault();\n event.stopPropagation();\n // Compute the desired offset position for the handle.\n var pos;\n var layout = this.layout;\n var rect = this.node.getBoundingClientRect();\n if (layout.orientation === 'horizontal') {\n pos = event.clientX - rect.left - this._pressData.delta;\n }\n else {\n pos = event.clientY - rect.top - this._pressData.delta;\n }\n // Move the handle as close to the desired position as possible.\n layout.moveHandle(this._pressData.index, pos);\n };\n /**\n * Handle the `'mouseup'` event for the split panel.\n */\n SplitPanel.prototype._evtMouseUp = function (event) {\n // Do nothing if the left mouse button is not released.\n if (event.button !== 0) {\n return;\n }\n // Stop the event when releasing a handle.\n event.preventDefault();\n event.stopPropagation();\n // Finalize the mouse release.\n this._releaseMouse();\n };\n /**\n * Release the mouse grab for the split panel.\n */\n SplitPanel.prototype._releaseMouse = function () {\n // Bail early if no drag is in progress.\n if (!this._pressData) {\n return;\n }\n // Clear the override cursor.\n this._pressData.override.dispose();\n this._pressData = null;\n // Remove the extra document listeners.\n document.removeEventListener('mouseup', this, true);\n document.removeEventListener('mousemove', this, true);\n document.removeEventListener('keydown', this, true);\n document.removeEventListener('contextmenu', this, true);\n };\n return SplitPanel;\n}(Panel));\n/**\n * The namespace for the `SplitPanel` class statics.\n */\n(function (SplitPanel) {\n /**\n * The default implementation of `IRenderer`.\n */\n var Renderer = /** @class */ (function () {\n function Renderer() {\n }\n /**\n * Create a new handle for use with a split panel.\n *\n * @returns A new handle element for a split panel.\n */\n Renderer.prototype.createHandle = function () {\n var handle = document.createElement('div');\n handle.className = 'lm-SplitPanel-handle';\n /* <DEPRECATED> */\n handle.classList.add('p-SplitPanel-handle');\n /* </DEPRECATED> */\n return handle;\n };\n return Renderer;\n }());\n SplitPanel.Renderer = Renderer;\n /**\n * The default `Renderer` instance.\n */\n SplitPanel.defaultRenderer = new Renderer();\n /**\n * Get the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @returns The split panel stretch factor for the widget.\n */\n function getStretch(widget) {\n return SplitLayout.getStretch(widget);\n }\n SplitPanel.getStretch = getStretch;\n /**\n * Set the split panel stretch factor for the given widget.\n *\n * @param widget - The widget of interest.\n *\n * @param value - The value for the stretch factor.\n */\n function setStretch(widget, value) {\n SplitLayout.setStretch(widget, value);\n }\n SplitPanel.setStretch = setStretch;\n})(SplitPanel || (SplitPanel = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$f;\n(function (Private) {\n /**\n * Create a split layout for the given panel options.\n */\n function createLayout(options) {\n return options.layout || new SplitLayout({\n renderer: options.renderer || SplitPanel.defaultRenderer,\n orientation: options.orientation,\n alignment: options.alignment,\n spacing: options.spacing\n });\n }\n Private.createLayout = createLayout;\n})(Private$f || (Private$f = {}));\n\n/**\n * A layout where visible widgets are stacked atop one another.\n *\n * #### Notes\n * The Z-order of the visible widgets follows their layout order.\n */\nvar StackedLayout = /** @class */ (function (_super) {\n __extends(StackedLayout, _super);\n function StackedLayout() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._dirty = false;\n _this._items = [];\n _this._box = null;\n return _this;\n }\n /**\n * Dispose of the resources held by the layout.\n */\n StackedLayout.prototype.dispose = function () {\n // Dispose of the layout items.\n (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.each)(this._items, function (item) { item.dispose(); });\n // Clear the layout state.\n this._box = null;\n this._items.length = 0;\n // Dispose of the rest of the layout.\n _super.prototype.dispose.call(this);\n };\n /**\n * Attach a widget to the parent's DOM node.\n *\n * @param index - The current index of the widget in the layout.\n *\n * @param widget - The widget to attach to the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n StackedLayout.prototype.attachWidget = function (index, widget) {\n // Create and add a new layout item for the widget.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.insert(this._items, index, new LayoutItem(widget));\n // Send a `'before-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);\n }\n // Add the widget's node to the parent.\n this.parent.node.appendChild(widget.node);\n // Send an `'after-attach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterAttach);\n }\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * Move a widget in the parent's DOM node.\n *\n * @param fromIndex - The previous index of the widget in the layout.\n *\n * @param toIndex - The current index of the widget in the layout.\n *\n * @param widget - The widget to move in the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n StackedLayout.prototype.moveWidget = function (fromIndex, toIndex, widget) {\n // Move the layout item for the widget.\n _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.move(this._items, fromIndex, toIndex);\n // Post an update request for the parent widget.\n this.parent.update();\n };\n /**\n * Detach a widget from the parent's DOM node.\n *\n * @param index - The previous index of the widget in the layout.\n *\n * @param widget - The widget to detach from the parent.\n *\n * #### Notes\n * This is a reimplementation of the superclass method.\n */\n StackedLayout.prototype.detachWidget = function (index, widget) {\n // Remove the layout item for the widget.\n var item = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeAt(this._items, index);\n // Send a `'before-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.BeforeDetach);\n }\n // Remove the widget's node from the parent.\n this.parent.node.removeChild(widget.node);\n // Send an `'after-detach'` message if the parent is attached.\n if (this.parent.isAttached) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(widget, Widget.Msg.AfterDetach);\n }\n // Reset the z-index for the widget.\n item.widget.node.style.zIndex = '';\n // Dispose of the layout item.\n item.dispose();\n // Post a fit request for the parent widget.\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'before-show'` message.\n */\n StackedLayout.prototype.onBeforeShow = function (msg) {\n _super.prototype.onBeforeShow.call(this, msg);\n this.parent.update();\n };\n /**\n * A message handler invoked on a `'before-attach'` message.\n */\n StackedLayout.prototype.onBeforeAttach = function (msg) {\n _super.prototype.onBeforeAttach.call(this, msg);\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-shown'` message.\n */\n StackedLayout.prototype.onChildShown = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'child-hidden'` message.\n */\n StackedLayout.prototype.onChildHidden = function (msg) {\n this.parent.fit();\n };\n /**\n * A message handler invoked on a `'resize'` message.\n */\n StackedLayout.prototype.onResize = function (msg) {\n if (this.parent.isVisible) {\n this._update(msg.width, msg.height);\n }\n };\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n StackedLayout.prototype.onUpdateRequest = function (msg) {\n if (this.parent.isVisible) {\n this._update(-1, -1);\n }\n };\n /**\n * A message handler invoked on a `'fit-request'` message.\n */\n StackedLayout.prototype.onFitRequest = function (msg) {\n if (this.parent.isAttached) {\n this._fit();\n }\n };\n /**\n * Fit the layout to the total size required by the widgets.\n */\n StackedLayout.prototype._fit = function () {\n // Set up the computed minimum size.\n var minW = 0;\n var minH = 0;\n // Update the computed minimum size.\n for (var i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n var item = this._items[i];\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n // Update the size limits for the item.\n item.fit();\n // Update the computed minimum size.\n minW = Math.max(minW, item.minWidth);\n minH = Math.max(minH, item.minHeight);\n }\n // Update the box sizing and add it to the computed min size.\n var box = this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n minW += box.horizontalSum;\n minH += box.verticalSum;\n // Update the parent's min size constraints.\n var style = this.parent.node.style;\n style.minWidth = minW + \"px\";\n style.minHeight = minH + \"px\";\n // Set the dirty flag to ensure only a single update occurs.\n this._dirty = true;\n // Notify the ancestor that it should fit immediately. This may\n // cause a resize of the parent, fulfilling the required update.\n if (this.parent.parent) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent.parent, Widget.Msg.FitRequest);\n }\n // If the dirty flag is still set, the parent was not resized.\n // Trigger the required update on the parent widget immediately.\n if (this._dirty) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.sendMessage(this.parent, Widget.Msg.UpdateRequest);\n }\n };\n /**\n * Update the layout position and size of the widgets.\n *\n * The parent offset dimensions should be `-1` if unknown.\n */\n StackedLayout.prototype._update = function (offsetWidth, offsetHeight) {\n // Clear the dirty flag to indicate the update occurred.\n this._dirty = false;\n // Compute the visible item count.\n var nVisible = 0;\n for (var i = 0, n = this._items.length; i < n; ++i) {\n nVisible += +!this._items[i].isHidden;\n }\n // Bail early if there are no visible items to layout.\n if (nVisible === 0) {\n return;\n }\n // Measure the parent if the offset dimensions are unknown.\n if (offsetWidth < 0) {\n offsetWidth = this.parent.node.offsetWidth;\n }\n if (offsetHeight < 0) {\n offsetHeight = this.parent.node.offsetHeight;\n }\n // Ensure the parent box sizing data is computed.\n if (!this._box) {\n this._box = _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.ElementExt.boxSizing(this.parent.node);\n }\n // Compute the actual layout bounds adjusted for border and padding.\n var top = this._box.paddingTop;\n var left = this._box.paddingLeft;\n var width = offsetWidth - this._box.horizontalSum;\n var height = offsetHeight - this._box.verticalSum;\n // Update the widget stacking order and layout geometry.\n for (var i = 0, n = this._items.length; i < n; ++i) {\n // Fetch the item.\n var item = this._items[i];\n // Ignore hidden items.\n if (item.isHidden) {\n continue;\n }\n // Set the z-index for the widget.\n item.widget.node.style.zIndex = \"\" + i;\n // Update the item geometry.\n item.update(left, top, width, height);\n }\n };\n return StackedLayout;\n}(PanelLayout));\n\n/**\n * A panel where visible widgets are stacked atop one another.\n *\n * #### Notes\n * This class provides a convenience wrapper around a [[StackedLayout]].\n */\nvar StackedPanel = /** @class */ (function (_super) {\n __extends(StackedPanel, _super);\n /**\n * Construct a new stacked panel.\n *\n * @param options - The options for initializing the panel.\n */\n function StackedPanel(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, { layout: Private$g.createLayout(options) }) || this;\n _this._widgetRemoved = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this.addClass('lm-StackedPanel');\n /* <DEPRECATED> */\n _this.addClass('p-StackedPanel');\n return _this;\n /* </DEPRECATED> */\n }\n Object.defineProperty(StackedPanel.prototype, \"widgetRemoved\", {\n /**\n * A signal emitted when a widget is removed from a stacked panel.\n */\n get: function () {\n return this._widgetRemoved;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * A message handler invoked on a `'child-added'` message.\n */\n StackedPanel.prototype.onChildAdded = function (msg) {\n msg.child.addClass('lm-StackedPanel-child');\n /* <DEPRECATED> */\n msg.child.addClass('p-StackedPanel-child');\n /* </DEPRECATED> */\n };\n /**\n * A message handler invoked on a `'child-removed'` message.\n */\n StackedPanel.prototype.onChildRemoved = function (msg) {\n msg.child.removeClass('lm-StackedPanel-child');\n /* <DEPRECATED> */\n msg.child.removeClass('p-StackedPanel-child');\n /* </DEPRECATED> */\n this._widgetRemoved.emit(msg.child);\n };\n return StackedPanel;\n}(Panel));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$g;\n(function (Private) {\n /**\n * Create a stacked layout for the given panel options.\n */\n function createLayout(options) {\n return options.layout || new StackedLayout();\n }\n Private.createLayout = createLayout;\n})(Private$g || (Private$g = {}));\n\n/**\n * A widget which combines a `TabBar` and a `StackedPanel`.\n *\n * #### Notes\n * This is a simple panel which handles the common case of a tab bar\n * placed next to a content area. The selected tab controls the widget\n * which is shown in the content area.\n *\n * For use cases which require more control than is provided by this\n * panel, the `TabBar` widget may be used independently.\n */\nvar TabPanel = /** @class */ (function (_super) {\n __extends(TabPanel, _super);\n /**\n * Construct a new tab panel.\n *\n * @param options - The options for initializing the tab panel.\n */\n function TabPanel(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this) || this;\n _this._currentChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__.Signal(_this);\n _this.addClass('lm-TabPanel');\n /* <DEPRECATED> */\n _this.addClass('p-TabPanel');\n /* </DEPRECATED> */\n // Create the tab bar and stacked panel.\n _this.tabBar = new TabBar(options);\n _this.tabBar.addClass('lm-TabPanel-tabBar');\n _this.stackedPanel = new StackedPanel();\n _this.stackedPanel.addClass('lm-TabPanel-stackedPanel');\n /* <DEPRECATED> */\n _this.tabBar.addClass('p-TabPanel-tabBar');\n _this.stackedPanel.addClass('p-TabPanel-stackedPanel');\n /* </DEPRECATED> */\n // Connect the tab bar signal handlers.\n _this.tabBar.tabMoved.connect(_this._onTabMoved, _this);\n _this.tabBar.currentChanged.connect(_this._onCurrentChanged, _this);\n _this.tabBar.tabCloseRequested.connect(_this._onTabCloseRequested, _this);\n _this.tabBar.tabActivateRequested.connect(_this._onTabActivateRequested, _this);\n // Connect the stacked panel signal handlers.\n _this.stackedPanel.widgetRemoved.connect(_this._onWidgetRemoved, _this);\n // Get the data related to the placement.\n _this._tabPlacement = options.tabPlacement || 'top';\n var direction = Private$h.directionFromPlacement(_this._tabPlacement);\n var orientation = Private$h.orientationFromPlacement(_this._tabPlacement);\n // Configure the tab bar for the placement.\n _this.tabBar.orientation = orientation;\n _this.tabBar.dataset['placement'] = _this._tabPlacement;\n // Create the box layout.\n var layout = new BoxLayout({ direction: direction, spacing: 0 });\n // Set the stretch factors for the child widgets.\n BoxLayout.setStretch(_this.tabBar, 0);\n BoxLayout.setStretch(_this.stackedPanel, 1);\n // Add the child widgets to the layout.\n layout.addWidget(_this.tabBar);\n layout.addWidget(_this.stackedPanel);\n // Install the layout on the tab panel.\n _this.layout = layout;\n return _this;\n }\n Object.defineProperty(TabPanel.prototype, \"currentChanged\", {\n /**\n * A signal emitted when the current tab is changed.\n *\n * #### Notes\n * This signal is emitted when the currently selected tab is changed\n * either through user or programmatic interaction.\n *\n * Notably, this signal is not emitted when the index of the current\n * tab changes due to tabs being inserted, removed, or moved. It is\n * only emitted when the actual current tab node is changed.\n */\n get: function () {\n return this._currentChanged;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabPanel.prototype, \"currentIndex\", {\n /**\n * Get the index of the currently selected tab.\n *\n * #### Notes\n * This will be `-1` if no tab is selected.\n */\n get: function () {\n return this.tabBar.currentIndex;\n },\n /**\n * Set the index of the currently selected tab.\n *\n * #### Notes\n * If the index is out of range, it will be set to `-1`.\n */\n set: function (value) {\n this.tabBar.currentIndex = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabPanel.prototype, \"currentWidget\", {\n /**\n * Get the currently selected widget.\n *\n * #### Notes\n * This will be `null` if there is no selected tab.\n */\n get: function () {\n var title = this.tabBar.currentTitle;\n return title ? title.owner : null;\n },\n /**\n * Set the currently selected widget.\n *\n * #### Notes\n * If the widget is not in the panel, it will be set to `null`.\n */\n set: function (value) {\n this.tabBar.currentTitle = value ? value.title : null;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabPanel.prototype, \"tabsMovable\", {\n /**\n * Get the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n get: function () {\n return this.tabBar.tabsMovable;\n },\n /**\n * Set the whether the tabs are movable by the user.\n *\n * #### Notes\n * Tabs can always be moved programmatically.\n */\n set: function (value) {\n this.tabBar.tabsMovable = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabPanel.prototype, \"tabPlacement\", {\n /**\n * Get the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n get: function () {\n return this._tabPlacement;\n },\n /**\n * Set the tab placement for the tab panel.\n *\n * #### Notes\n * This controls the position of the tab bar relative to the content.\n */\n set: function (value) {\n // Bail if the placement does not change.\n if (this._tabPlacement === value) {\n return;\n }\n // Update the internal value.\n this._tabPlacement = value;\n // Get the values related to the placement.\n var direction = Private$h.directionFromPlacement(value);\n var orientation = Private$h.orientationFromPlacement(value);\n // Configure the tab bar for the placement.\n this.tabBar.orientation = orientation;\n this.tabBar.dataset['placement'] = value;\n // Update the layout direction.\n this.layout.direction = direction;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TabPanel.prototype, \"widgets\", {\n /**\n * A read-only array of the widgets in the panel.\n */\n get: function () {\n return this.stackedPanel.widgets;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Add a widget to the end of the tab panel.\n *\n * @param widget - The widget to add to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n TabPanel.prototype.addWidget = function (widget) {\n this.insertWidget(this.widgets.length, widget);\n };\n /**\n * Insert a widget into the tab panel at a specified index.\n *\n * @param index - The index at which to insert the widget.\n *\n * @param widget - The widget to insert into to the tab panel.\n *\n * #### Notes\n * If the widget is already contained in the panel, it will be moved.\n *\n * The widget's `title` is used to populate the tab.\n */\n TabPanel.prototype.insertWidget = function (index, widget) {\n if (widget !== this.currentWidget) {\n widget.hide();\n }\n this.stackedPanel.insertWidget(index, widget);\n this.tabBar.insertTab(index, widget.title);\n };\n /**\n * Handle the `currentChanged` signal from the tab bar.\n */\n TabPanel.prototype._onCurrentChanged = function (sender, args) {\n // Extract the previous and current title from the args.\n var previousIndex = args.previousIndex, previousTitle = args.previousTitle, currentIndex = args.currentIndex, currentTitle = args.currentTitle;\n // Extract the widgets from the titles.\n var previousWidget = previousTitle ? previousTitle.owner : null;\n var currentWidget = currentTitle ? currentTitle.owner : null;\n // Hide the previous widget.\n if (previousWidget) {\n previousWidget.hide();\n }\n // Show the current widget.\n if (currentWidget) {\n currentWidget.show();\n }\n // Emit the `currentChanged` signal for the tab panel.\n this._currentChanged.emit({\n previousIndex: previousIndex, previousWidget: previousWidget, currentIndex: currentIndex, currentWidget: currentWidget\n });\n // Flush the message loop on IE and Edge to prevent flicker.\n if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Platform.IS_EDGE || _lumino_domutils__WEBPACK_IMPORTED_MODULE_1__.Platform.IS_IE) {\n _lumino_messaging__WEBPACK_IMPORTED_MODULE_2__.MessageLoop.flush();\n }\n };\n /**\n * Handle the `tabActivateRequested` signal from the tab bar.\n */\n TabPanel.prototype._onTabActivateRequested = function (sender, args) {\n args.title.owner.activate();\n };\n /**\n * Handle the `tabCloseRequested` signal from the tab bar.\n */\n TabPanel.prototype._onTabCloseRequested = function (sender, args) {\n args.title.owner.close();\n };\n /**\n * Handle the `tabMoved` signal from the tab bar.\n */\n TabPanel.prototype._onTabMoved = function (sender, args) {\n this.stackedPanel.insertWidget(args.toIndex, args.title.owner);\n };\n /**\n * Handle the `widgetRemoved` signal from the stacked panel.\n */\n TabPanel.prototype._onWidgetRemoved = function (sender, widget) {\n this.tabBar.removeTab(widget.title);\n };\n return TabPanel;\n}(Widget));\n/**\n * The namespace for the module implementation details.\n */\nvar Private$h;\n(function (Private) {\n /**\n * Convert a tab placement to tab bar orientation.\n */\n function orientationFromPlacement(plc) {\n return placementToOrientationMap[plc];\n }\n Private.orientationFromPlacement = orientationFromPlacement;\n /**\n * Convert a tab placement to a box layout direction.\n */\n function directionFromPlacement(plc) {\n return placementToDirectionMap[plc];\n }\n Private.directionFromPlacement = directionFromPlacement;\n /**\n * A mapping of tab placement to tab bar orientation.\n */\n var placementToOrientationMap = {\n 'top': 'horizontal',\n 'left': 'vertical',\n 'right': 'vertical',\n 'bottom': 'horizontal'\n };\n /**\n * A mapping of tab placement to box layout direction.\n */\n var placementToDirectionMap = {\n 'top': 'top-to-bottom',\n 'left': 'left-to-right',\n 'right': 'right-to-left',\n 'bottom': 'bottom-to-top'\n };\n})(Private$h || (Private$h = {}));\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/@lumino/widgets/dist/index.es6.js?");
/***/ }),
/***/ "./node_modules/codemirror/addon/fold/foldcode.js":
/*!********************************************************!*\
!*** ./node_modules/codemirror/addon/fold/foldcode.js ***!
\********************************************************/
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
eval("// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(/*! ../../lib/codemirror */ \"./node_modules/codemirror/lib/codemirror.js\"));\n else {}\n})(function(CodeMirror) {\n \"use strict\";\n\n function doFold(cm, pos, options, force) {\n if (options && options.call) {\n var finder = options;\n options = null;\n } else {\n var finder = getOption(cm, options, \"rangeFinder\");\n }\n if (typeof pos == \"number\") pos = CodeMirror.Pos(pos, 0);\n var minSize = getOption(cm, options, \"minFoldSize\");\n\n function getRange(allowFolded) {\n var range = finder(cm, pos);\n if (!range || range.to.line - range.from.line < minSize) return null;\n var marks = cm.findMarksAt(range.from);\n for (var i = 0; i < marks.length; ++i) {\n if (marks[i].__isFold && force !== \"fold\") {\n if (!allowFolded) return null;\n range.cleared = true;\n marks[i].clear();\n }\n }\n return range;\n }\n\n var range = getRange(true);\n if (getOption(cm, options, \"scanUp\")) while (!range && pos.line > cm.firstLine()) {\n pos = CodeMirror.Pos(pos.line - 1, 0);\n range = getRange(false);\n }\n if (!range || range.cleared || force === \"unfold\") return;\n\n var myWidget = makeWidget(cm, options, range);\n CodeMirror.on(myWidget, \"mousedown\", function(e) {\n myRange.clear();\n CodeMirror.e_preventDefault(e);\n });\n var myRange = cm.markText(range.from, range.to, {\n replacedWith: myWidget,\n clearOnEnter: getOption(cm, options, \"clearOnEnter\"),\n __isFold: true\n });\n myRange.on(\"clear\", function(from, to) {\n CodeMirror.signal(cm, \"unfold\", cm, from, to);\n });\n CodeMirror.signal(cm, \"fold\", cm, range.from, range.to);\n }\n\n function makeWidget(cm, options, range) {\n var widget = getOption(cm, options, \"widget\");\n\n if (typeof widget == \"function\") {\n widget = widget(range.from, range.to);\n }\n\n if (typeof widget == \"string\") {\n var text = document.createTextNode(widget);\n widget = document.createElement(\"span\");\n widget.appendChild(text);\n widget.className = \"CodeMirror-foldmarker\";\n } else if (widget) {\n widget = widget.cloneNode(true)\n }\n return widget;\n }\n\n // Clumsy backwards-compatible interface\n CodeMirror.newFoldFunction = function(rangeFinder, widget) {\n return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); };\n };\n\n // New-style interface\n CodeMirror.defineExtension(\"foldCode\", function(pos, options, force) {\n doFold(this, pos, options, force);\n });\n\n CodeMirror.defineExtension(\"isFolded\", function(pos) {\n var marks = this.findMarksAt(pos);\n for (var i = 0; i < marks.length; ++i)\n if (marks[i].__isFold) return true;\n });\n\n CodeMirror.commands.toggleFold = function(cm) {\n cm.foldCode(cm.getCursor());\n };\n CodeMirror.commands.fold = function(cm) {\n cm.foldCode(cm.getCursor(), null, \"fold\");\n };\n CodeMirror.commands.unfold = function(cm) {\n cm.foldCode(cm.getCursor(), null, \"unfold\");\n };\n CodeMirror.commands.foldAll = function(cm) {\n cm.operation(function() {\n for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)\n cm.foldCode(CodeMirror.Pos(i, 0), null, \"fold\");\n });\n };\n CodeMirror.commands.unfoldAll = function(cm) {\n cm.operation(function() {\n for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)\n cm.foldCode(CodeMirror.Pos(i, 0), null, \"unfold\");\n });\n };\n\n CodeMirror.registerHelper(\"fold\", \"combine\", function() {\n var funcs = Array.prototype.slice.call(arguments, 0);\n return function(cm, start) {\n for (var i = 0; i < funcs.length; ++i) {\n var found = funcs[i](cm, start);\n if (found) return found;\n }\n };\n });\n\n CodeMirror.registerHelper(\"fold\", \"auto\", function(cm, start) {\n var helpers = cm.getHelpers(start, \"fold\");\n for (var i = 0; i < helpers.length; i++) {\n var cur = helpers[i](cm, start);\n if (cur) return cur;\n }\n });\n\n var defaultOptions = {\n rangeFinder: CodeMirror.fold.auto,\n widget: \"\\u2194\",\n minFoldSize: 0,\n scanUp: false,\n clearOnEnter: true\n };\n\n CodeMirror.defineOption(\"foldOptions\", null);\n\n function getOption(cm, options, name) {\n if (options && options[name] !== undefined)\n return options[name];\n var editorOptions = cm.options.foldOptions;\n if (editorOptions && editorOptions[name] !== undefined)\n return editorOptions[name];\n return defaultOptions[name];\n }\n\n CodeMirror.defineExtension(\"foldOption\", function(options, name) {\n return getOption(this, options, name);\n });\n});\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/codemirror/addon/fold/foldcode.js?");
/***/ }),
/***/ "./node_modules/codemirror/addon/fold/foldgutter.js":
/*!**********************************************************!*\
!*** ./node_modules/codemirror/addon/fold/foldgutter.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
eval("// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(/*! ../../lib/codemirror */ \"./node_modules/codemirror/lib/codemirror.js\"), __webpack_require__(/*! ./foldcode */ \"./node_modules/codemirror/addon/fold/foldcode.js\"));\n else {}\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.defineOption(\"foldGutter\", false, function(cm, val, old) {\n if (old && old != CodeMirror.Init) {\n cm.clearGutter(cm.state.foldGutter.options.gutter);\n cm.state.foldGutter = null;\n cm.off(\"gutterClick\", onGutterClick);\n cm.off(\"changes\", onChange);\n cm.off(\"viewportChange\", onViewportChange);\n cm.off(\"fold\", onFold);\n cm.off(\"unfold\", onFold);\n cm.off(\"swapDoc\", onChange);\n }\n if (val) {\n cm.state.foldGutter = new State(parseOptions(val));\n updateInViewport(cm);\n cm.on(\"gutterClick\", onGutterClick);\n cm.on(\"changes\", onChange);\n cm.on(\"viewportChange\", onViewportChange);\n cm.on(\"fold\", onFold);\n cm.on(\"unfold\", onFold);\n cm.on(\"swapDoc\", onChange);\n }\n });\n\n var Pos = CodeMirror.Pos;\n\n function State(options) {\n this.options = options;\n this.from = this.to = 0;\n }\n\n function parseOptions(opts) {\n if (opts === true) opts = {};\n if (opts.gutter == null) opts.gutter = \"CodeMirror-foldgutter\";\n if (opts.indicatorOpen == null) opts.indicatorOpen = \"CodeMirror-foldgutter-open\";\n if (opts.indicatorFolded == null) opts.indicatorFolded = \"CodeMirror-foldgutter-folded\";\n return opts;\n }\n\n function isFolded(cm, line) {\n var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0));\n for (var i = 0; i < marks.length; ++i) {\n if (marks[i].__isFold) {\n var fromPos = marks[i].find(-1);\n if (fromPos && fromPos.line === line)\n return marks[i];\n }\n }\n }\n\n function marker(spec) {\n if (typeof spec == \"string\") {\n var elt = document.createElement(\"div\");\n elt.className = spec + \" CodeMirror-guttermarker-subtle\";\n return elt;\n } else {\n return spec.cloneNode(true);\n }\n }\n\n function updateFoldInfo(cm, from, to) {\n var opts = cm.state.foldGutter.options, cur = from - 1;\n var minSize = cm.foldOption(opts, \"minFoldSize\");\n var func = cm.foldOption(opts, \"rangeFinder\");\n // we can reuse the built-in indicator element if its className matches the new state\n var clsFolded = typeof opts.indicatorFolded == \"string\" && classTest(opts.indicatorFolded);\n var clsOpen = typeof opts.indicatorOpen == \"string\" && classTest(opts.indicatorOpen);\n cm.eachLine(from, to, function(line) {\n ++cur;\n var mark = null;\n var old = line.gutterMarkers;\n if (old) old = old[opts.gutter];\n if (isFolded(cm, cur)) {\n if (clsFolded && old && clsFolded.test(old.className)) return;\n mark = marker(opts.indicatorFolded);\n } else {\n var pos = Pos(cur, 0);\n var range = func && func(cm, pos);\n if (range && range.to.line - range.from.line >= minSize) {\n if (clsOpen && old && clsOpen.test(old.className)) return;\n mark = marker(opts.indicatorOpen);\n }\n }\n if (!mark && !old) return;\n cm.setGutterMarker(line, opts.gutter, mark);\n });\n }\n\n // copied from CodeMirror/src/util/dom.js\n function classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\") }\n\n function updateInViewport(cm) {\n var vp = cm.getViewport(), state = cm.state.foldGutter;\n if (!state) return;\n cm.operation(function() {\n updateFoldInfo(cm, vp.from, vp.to);\n });\n state.from = vp.from; state.to = vp.to;\n }\n\n function onGutterClick(cm, line, gutter) {\n var state = cm.state.foldGutter;\n if (!state) return;\n var opts = state.options;\n if (gutter != opts.gutter) return;\n var folded = isFolded(cm, line);\n if (folded) folded.clear();\n else cm.foldCode(Pos(line, 0), opts);\n }\n\n function onChange(cm) {\n var state = cm.state.foldGutter;\n if (!state) return;\n var opts = state.options;\n state.from = state.to = 0;\n clearTimeout(state.changeUpdate);\n state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);\n }\n\n function onViewportChange(cm) {\n var state = cm.state.foldGutter;\n if (!state) return;\n var opts = state.options;\n clearTimeout(state.changeUpdate);\n state.changeUpdate = setTimeout(function() {\n var vp = cm.getViewport();\n if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {\n updateInViewport(cm);\n } else {\n cm.operation(function() {\n if (vp.from < state.from) {\n updateFoldInfo(cm, vp.from, state.from);\n state.from = vp.from;\n }\n if (vp.to > state.to) {\n updateFoldInfo(cm, state.to, vp.to);\n state.to = vp.to;\n }\n });\n }\n }, opts.updateViewportTimeSpan || 400);\n }\n\n function onFold(cm, from) {\n var state = cm.state.foldGutter;\n if (!state) return;\n var line = from.line;\n if (line >= state.from && line < state.to)\n updateFoldInfo(cm, line, line + 1);\n }\n});\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/codemirror/addon/fold/foldgutter.js?");
/***/ }),
/***/ "./node_modules/codemirror/lib/codemirror.js":
/*!***************************************************!*\
!*** ./node_modules/codemirror/lib/codemirror.js ***!
\***************************************************/
/***/ (function(module) {
eval("// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n// This is CodeMirror (https://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function (global, factory) {\n true ? module.exports = factory() :\n 0;\n}(this, (function () { 'use strict';\n\n // Kludges for bugs and behavior differences that can't be feature\n // detected are enabled based on userAgent etc sniffing.\n var userAgent = navigator.userAgent;\n var platform = navigator.platform;\n\n var gecko = /gecko\\/\\d/i.test(userAgent);\n var ie_upto10 = /MSIE \\d/.test(userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n var edge = /Edge\\/(\\d+)/.exec(userAgent);\n var ie = ie_upto10 || ie_11up || edge;\n var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);\n var webkit = !edge && /WebKit\\//.test(userAgent);\n var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n var chrome = !edge && /Chrome\\//.test(userAgent);\n var presto = /Opera\\//.test(userAgent);\n var safari = /Apple Computer/.test(navigator.vendor);\n var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n var phantom = /PhantomJS/.test(userAgent);\n\n var ios = safari && (/Mobile\\/\\w+/.test(userAgent) || navigator.maxTouchPoints > 2);\n var android = /Android/.test(userAgent);\n // This is woefully incomplete. Suggestions for alternative methods welcome.\n var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n var mac = ios || /Mac/.test(platform);\n var chromeOS = /\\bCrOS\\b/.test(userAgent);\n var windows = /win/i.test(platform);\n\n var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n if (presto_version) { presto_version = Number(presto_version[1]); }\n if (presto_version && presto_version >= 15) { presto = false; webkit = true; }\n // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n var captureRightClick = gecko || (ie && ie_version >= 9);\n\n function classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\") }\n\n var rmClass = function(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n };\n\n function removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count)\n { e.removeChild(e.firstChild); }\n return e\n }\n\n function removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e)\n }\n\n function elt(tag, content, className, style) {\n var e = document.createElement(tag);\n if (className) { e.className = className; }\n if (style) { e.style.cssText = style; }\n if (typeof content == \"string\") { e.appendChild(document.createTextNode(content)); }\n else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }\n return e\n }\n // wrapper for elt, which removes the elt from the accessibility tree\n function eltP(tag, content, className, style) {\n var e = elt(tag, content, className, style);\n e.setAttribute(\"role\", \"presentation\");\n return e\n }\n\n var range;\n if (document.createRange) { range = function(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r\n }; }\n else { range = function(node, start, end) {\n var r = document.body.createTextRange();\n try { r.moveToElementText(node.parentNode); }\n catch(e) { return r }\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r\n }; }\n\n function contains(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n { child = child.parentNode; }\n if (parent.contains)\n { return parent.contains(child) }\n do {\n if (child.nodeType == 11) { child = child.host; }\n if (child == parent) { return true }\n } while (child = child.parentNode)\n }\n\n function activeElt() {\n // IE and Edge may throw an \"Unspecified Error\" when accessing document.activeElement.\n // IE < 10 will throw when accessed while the page is loading or in an iframe.\n // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.\n var activeElement;\n try {\n activeElement = document.activeElement;\n } catch(e) {\n activeElement = document.body || null;\n }\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)\n { activeElement = activeElement.shadowRoot.activeElement; }\n return activeElement\n }\n\n function addClass(node, cls) {\n var current = node.className;\n if (!classTest(cls).test(current)) { node.className += (current ? \" \" : \"\") + cls; }\n }\n function joinClasses(a, b) {\n var as = a.split(\" \");\n for (var i = 0; i < as.length; i++)\n { if (as[i] && !classTest(as[i]).test(b)) { b += \" \" + as[i]; } }\n return b\n }\n\n var selectInput = function(node) { node.select(); };\n if (ios) // Mobile Safari apparently has a bug where select() is broken.\n { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }\n else if (ie) // Suppress mysterious IE10 errors\n { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }\n\n function bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function(){return f.apply(null, args)}\n }\n\n function copyObj(obj, target, overwrite) {\n if (!target) { target = {}; }\n for (var prop in obj)\n { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n { target[prop] = obj[prop]; } }\n return target\n }\n\n // Counts the column offset in a string, taking tabs into account.\n // Used mostly to find indentation.\n function countColumn(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) { end = string.length; }\n }\n for (var i = startIndex || 0, n = startValue || 0;;) {\n var nextTab = string.indexOf(\"\\t\", i);\n if (nextTab < 0 || nextTab >= end)\n { return n + (end - i) }\n n += nextTab - i;\n n += tabSize - (n % tabSize);\n i = nextTab + 1;\n }\n }\n\n var Delayed = function() {\n this.id = null;\n this.f = null;\n this.time = 0;\n this.handler = bind(this.onTimeout, this);\n };\n Delayed.prototype.onTimeout = function (self) {\n self.id = 0;\n if (self.time <= +new Date) {\n self.f();\n } else {\n setTimeout(self.handler, self.time - +new Date);\n }\n };\n Delayed.prototype.set = function (ms, f) {\n this.f = f;\n var time = +new Date + ms;\n if (!this.id || time < this.time) {\n clearTimeout(this.id);\n this.id = setTimeout(this.handler, ms);\n this.time = time;\n }\n };\n\n function indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i)\n { if (array[i] == elt) { return i } }\n return -1\n }\n\n // Number of pixels added to scroller and sizer to hide scrollbar\n var scrollerGap = 50;\n\n // Returned or thrown by various protocols to signal 'I'm not\n // handling this'.\n var Pass = {toString: function(){return \"CodeMirror.Pass\"}};\n\n // Reused option objects for setSelection & friends\n var sel_dontScroll = {scroll: false}, sel_mouse = {origin: \"*mouse\"}, sel_move = {origin: \"+move\"};\n\n // The inverse of countColumn -- find the offset that corresponds to\n // a particular column.\n function findColumn(string, goal, tabSize) {\n for (var pos = 0, col = 0;;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n if (nextTab == -1) { nextTab = string.length; }\n var skipped = nextTab - pos;\n if (nextTab == string.length || col + skipped >= goal)\n { return pos + Math.min(skipped, goal - col) }\n col += nextTab - pos;\n col += tabSize - (col % tabSize);\n pos = nextTab + 1;\n if (col >= goal) { return pos }\n }\n }\n\n var spaceStrs = [\"\"];\n function spaceStr(n) {\n while (spaceStrs.length <= n)\n { spaceStrs.push(lst(spaceStrs) + \" \"); }\n return spaceStrs[n]\n }\n\n function lst(arr) { return arr[arr.length-1] }\n\n function map(array, f) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }\n return out\n }\n\n function insertSorted(array, value, score) {\n var pos = 0, priority = score(value);\n while (pos < array.length && score(array[pos]) <= priority) { pos++; }\n array.splice(pos, 0, value);\n }\n\n function nothing() {}\n\n function createObj(base, props) {\n var inst;\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n if (props) { copyObj(props, inst); }\n return inst\n }\n\n var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n function isWordCharBasic(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" &&\n (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))\n }\n function isWordChar(ch, helper) {\n if (!helper) { return isWordCharBasic(ch) }\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) { return true }\n return helper.test(ch)\n }\n\n function isEmpty(obj) {\n for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }\n return true\n }\n\n // Extending unicode characters. A series of a non-extending char +\n // any number of extending chars is treated as a single unit as far\n // as editing and measuring is concerned. This is not fully correct,\n // since some scripts/fonts/browsers also treat other configurations\n // of code points as a group.\n var extendingChars = /[\\u0300-\\u036f\\u0483-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u065e\\u0670\\u06d6-\\u06dc\\u06de-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0900-\\u0902\\u093c\\u0941-\\u0948\\u094d\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2\\u09e3\\u0a01\\u0a02\\u0a3c\\u0a41\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70\\u0a71\\u0a75\\u0a81\\u0a82\\u0abc\\u0ac1-\\u0ac5\\u0ac7\\u0ac8\\u0acd\\u0ae2\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0d3e\\u0d41-\\u0d44\\u0d4d\\u0d57\\u0d62\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86\\u0f87\\u0f90-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039\\u103a\\u103d\\u103e\\u1058\\u1059\\u105e-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108d\\u109d\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193b\\u1a17\\u1a18\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1b00-\\u1b03\\u1b34\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80\\u1b81\\u1ba2-\\u1ba5\\u1ba8\\u1ba9\\u1c2c-\\u1c33\\u1c36\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1dc0-\\u1de6\\u1dfd-\\u1dff\\u200c\\u200d\\u20d0-\\u20f0\\u2cef-\\u2cf1\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua66f-\\ua672\\ua67c\\ua67d\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua825\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc\\uaa29-\\uaa2e\\uaa31\\uaa32\\uaa35\\uaa36\\uaa43\\uaa4c\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uabe5\\uabe8\\uabed\\udc00-\\udfff\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe26\\uff9e\\uff9f]/;\n function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }\n\n // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.\n function skipExtendingChars(str, pos, dir) {\n while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }\n return pos\n }\n\n // Returns the value from the range [`from`; `to`] that satisfies\n // `pred` and is closest to `from`. Assumes that at least `to`\n // satisfies `pred`. Supports `from` being greater than `to`.\n function findFirst(pred, from, to) {\n // At any point we are certain `to` satisfies `pred`, don't know\n // whether `from` does.\n var dir = from > to ? -1 : 1;\n for (;;) {\n if (from == to) { return from }\n var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);\n if (mid == from) { return pred(mid) ? from : to }\n if (pred(mid)) { to = mid; }\n else { from = mid + dir; }\n }\n }\n\n // BIDI HELPERS\n\n function iterateBidiSections(order, from, to, f) {\n if (!order) { return f(from, to, \"ltr\", 0) }\n var found = false;\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\", i);\n found = true;\n }\n }\n if (!found) { f(from, to, \"ltr\"); }\n }\n\n var bidiOther = null;\n function getBidiPartAt(order, ch, sticky) {\n var found;\n bidiOther = null;\n for (var i = 0; i < order.length; ++i) {\n var cur = order[i];\n if (cur.from < ch && cur.to > ch) { return i }\n if (cur.to == ch) {\n if (cur.from != cur.to && sticky == \"before\") { found = i; }\n else { bidiOther = i; }\n }\n if (cur.from == ch) {\n if (cur.from != cur.to && sticky != \"before\") { found = i; }\n else { bidiOther = i; }\n }\n }\n return found != null ? found : bidiOther\n }\n\n // Bidirectional ordering algorithm\n // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n // that this (partially) implements.\n\n // One-char codes used for character types:\n // L (L): Left-to-Right\n // R (R): Right-to-Left\n // r (AL): Right-to-Left Arabic\n // 1 (EN): European Number\n // + (ES): European Number Separator\n // % (ET): European Number Terminator\n // n (AN): Arabic Number\n // , (CS): Common Number Separator\n // m (NSM): Non-Spacing Mark\n // b (BN): Boundary Neutral\n // s (B): Paragraph Separator\n // t (S): Segment Separator\n // w (WS): Whitespace\n // N (ON): Other Neutrals\n\n // Returns null if characters are ordered as they appear\n // (left-to-right), or an array of sections ({from, to, level}\n // objects) in the order in which they occur visually.\n var bidiOrdering = (function() {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n // Character types for codepoints 0x600 to 0x6f9\n var arabicTypes = \"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111\";\n function charType(code) {\n if (code <= 0xf7) { return lowTypes.charAt(code) }\n else if (0x590 <= code && code <= 0x5f4) { return \"R\" }\n else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }\n else if (0x6ee <= code && code <= 0x8ac) { return \"r\" }\n else if (0x2000 <= code && code <= 0x200b) { return \"w\" }\n else if (code == 0x200c) { return \"b\" }\n else { return \"L\" }\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from; this.to = to;\n }\n\n return function(str, direction) {\n var outerType = direction == \"ltr\" ? \"L\" : \"R\";\n\n if (str.length == 0 || direction == \"ltr\" && !bidiRE.test(str)) { return false }\n var len = str.length, types = [];\n for (var i = 0; i < len; ++i)\n { types.push(charType(str.charCodeAt(i))); }\n\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {\n var type = types[i$1];\n if (type == \"m\") { types[i$1] = prev; }\n else { prev = type; }\n }\n\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {\n var type$1 = types[i$2];\n if (type$1 == \"1\" && cur == \"r\") { types[i$2] = \"n\"; }\n else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == \"r\") { types[i$2] = \"R\"; } }\n }\n\n // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {\n var type$2 = types[i$3];\n if (type$2 == \"+\" && prev$1 == \"1\" && types[i$3+1] == \"1\") { types[i$3] = \"1\"; }\n else if (type$2 == \",\" && prev$1 == types[i$3+1] &&\n (prev$1 == \"1\" || prev$1 == \"n\")) { types[i$3] = prev$1; }\n prev$1 = type$2;\n }\n\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n for (var i$4 = 0; i$4 < len; ++i$4) {\n var type$3 = types[i$4];\n if (type$3 == \",\") { types[i$4] = \"N\"; }\n else if (type$3 == \"%\") {\n var end = (void 0);\n for (end = i$4 + 1; end < len && types[end] == \"%\"; ++end) {}\n var replace = (i$4 && types[i$4-1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n for (var j = i$4; j < end; ++j) { types[j] = replace; }\n i$4 = end - 1;\n }\n }\n\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {\n var type$4 = types[i$5];\n if (cur$1 == \"L\" && type$4 == \"1\") { types[i$5] = \"L\"; }\n else if (isStrong.test(type$4)) { cur$1 = type$4; }\n }\n\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n for (var i$6 = 0; i$6 < len; ++i$6) {\n if (isNeutral.test(types[i$6])) {\n var end$1 = (void 0);\n for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}\n var before = (i$6 ? types[i$6-1] : outerType) == \"L\";\n var after = (end$1 < len ? types[end$1] : outerType) == \"L\";\n var replace$1 = before == after ? (before ? \"L\" : \"R\") : outerType;\n for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }\n i$6 = end$1 - 1;\n }\n }\n\n // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n var order = [], m;\n for (var i$7 = 0; i$7 < len;) {\n if (countsAsLeft.test(types[i$7])) {\n var start = i$7;\n for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}\n order.push(new BidiSpan(0, start, i$7));\n } else {\n var pos = i$7, at = order.length, isRTL = direction == \"rtl\" ? 1 : 0;\n for (++i$7; i$7 < len && types[i$7] != \"L\"; ++i$7) {}\n for (var j$2 = pos; j$2 < i$7;) {\n if (countsAsNum.test(types[j$2])) {\n if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }\n var nstart = j$2;\n for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}\n order.splice(at, 0, new BidiSpan(2, nstart, j$2));\n at += isRTL;\n pos = j$2;\n } else { ++j$2; }\n }\n if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }\n }\n }\n if (direction == \"ltr\") {\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n }\n\n return direction == \"rtl\" ? order.reverse() : order\n }\n })();\n\n // Get the bidi ordering for the given line (and cache it). Returns\n // false for lines that are fully left-to-right, and an array of\n // BidiSpan objects otherwise.\n function getOrder(line, direction) {\n var order = line.order;\n if (order == null) { order = line.order = bidiOrdering(line.text, direction); }\n return order\n }\n\n // EVENT HANDLING\n\n // Lightweight event framework. on/off also work on DOM nodes,\n // registering native DOM handlers.\n\n var noHandlers = [];\n\n var on = function(emitter, type, f) {\n if (emitter.addEventListener) {\n emitter.addEventListener(type, f, false);\n } else if (emitter.attachEvent) {\n emitter.attachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers || (emitter._handlers = {});\n map[type] = (map[type] || noHandlers).concat(f);\n }\n };\n\n function getHandlers(emitter, type) {\n return emitter._handlers && emitter._handlers[type] || noHandlers\n }\n\n function off(emitter, type, f) {\n if (emitter.removeEventListener) {\n emitter.removeEventListener(type, f, false);\n } else if (emitter.detachEvent) {\n emitter.detachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers, arr = map && map[type];\n if (arr) {\n var index = indexOf(arr, f);\n if (index > -1)\n { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }\n }\n }\n }\n\n function signal(emitter, type /*, values...*/) {\n var handlers = getHandlers(emitter, type);\n if (!handlers.length) { return }\n var args = Array.prototype.slice.call(arguments, 2);\n for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }\n }\n\n // The DOM events that CodeMirror handles can be overridden by\n // registering a (non-DOM) handler on the editor for the event name,\n // and preventDefault-ing the event in that handler.\n function signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\")\n { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore\n }\n\n function signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n if (!arr) { return }\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)\n { set.push(arr[i]); } }\n }\n\n function hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0\n }\n\n // Add on and off methods to a constructor's prototype, to make\n // registering events on such objects more convenient.\n function eventMixin(ctor) {\n ctor.prototype.on = function(type, f) {on(this, type, f);};\n ctor.prototype.off = function(type, f) {off(this, type, f);};\n }\n\n // Due to the fact that we still support jurassic IE versions, some\n // compatibility wrappers are needed.\n\n function e_preventDefault(e) {\n if (e.preventDefault) { e.preventDefault(); }\n else { e.returnValue = false; }\n }\n function e_stopPropagation(e) {\n if (e.stopPropagation) { e.stopPropagation(); }\n else { e.cancelBubble = true; }\n }\n function e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false\n }\n function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}\n\n function e_target(e) {return e.target || e.srcElement}\n function e_button(e) {\n var b = e.which;\n if (b == null) {\n if (e.button & 1) { b = 1; }\n else if (e.button & 2) { b = 3; }\n else if (e.button & 4) { b = 2; }\n }\n if (mac && e.ctrlKey && b == 1) { b = 3; }\n return b\n }\n\n // Detect drag-and-drop\n var dragAndDrop = function() {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) { return false }\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div\n }();\n\n var zwspSupported;\n function zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200b\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n if (measure.firstChild.offsetHeight != 0)\n { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }\n }\n var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node\n }\n\n // Feature-detect IE's crummy client rect reporting for bidi text\n var badBidiRects;\n function hasBadBidiRects(measure) {\n if (badBidiRects != null) { return badBidiRects }\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n removeChildren(measure);\n if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)\n return badBidiRects = (r1.right - r0.right < 3)\n }\n\n // See if \"\".split is the broken IE version, if so, provide an\n // alternative way to split lines.\n var splitLinesAuto = \"\\n\\nb\".split(/\\n/).length != 3 ? function (string) {\n var pos = 0, result = [], l = string.length;\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n if (nl == -1) { nl = string.length; }\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n return result\n } : function (string) { return string.split(/\\r\\n?|\\n/); };\n\n var hasSelection = window.getSelection ? function (te) {\n try { return te.selectionStart != te.selectionEnd }\n catch(e) { return false }\n } : function (te) {\n var range;\n try {range = te.ownerDocument.selection.createRange();}\n catch(e) {}\n if (!range || range.parentElement() != te) { return false }\n return range.compareEndPoints(\"StartToEnd\", range) != 0\n };\n\n var hasCopyEvent = (function () {\n var e = elt(\"div\");\n if (\"oncopy\" in e) { return true }\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\"\n })();\n\n var badZoomedRects = null;\n function hasBadZoomedRects(measure) {\n if (badZoomedRects != null) { return badZoomedRects }\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1\n }\n\n // Known modes, by name and by MIME\n var modes = {}, mimeModes = {};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n function defineMode(name, mode) {\n if (arguments.length > 2)\n { mode.dependencies = Array.prototype.slice.call(arguments, 2); }\n modes[name] = mode;\n }\n\n function defineMIME(mime, spec) {\n mimeModes[mime] = spec;\n }\n\n // Given a MIME type, a {name, ...options} config object, or a name\n // string, return a mode config object.\n function resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n if (typeof found == \"string\") { found = {name: found}; }\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return resolveMode(\"application/xml\")\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+json$/.test(spec)) {\n return resolveMode(\"application/json\")\n }\n if (typeof spec == \"string\") { return {name: spec} }\n else { return spec || {name: \"null\"} }\n }\n\n // Given a mode spec (anything that resolveMode accepts), find and\n // initialize an actual mode object.\n function getMode(options, spec) {\n spec = resolveMode(spec);\n var mfactory = modes[spec.name];\n if (!mfactory) { return getMode(options, \"text/plain\") }\n var modeObj = mfactory(options, spec);\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) { continue }\n if (modeObj.hasOwnProperty(prop)) { modeObj[\"_\" + prop] = modeObj[prop]; }\n modeObj[prop] = exts[prop];\n }\n }\n modeObj.name = spec.name;\n if (spec.helperType) { modeObj.helperType = spec.helperType; }\n if (spec.modeProps) { for (var prop$1 in spec.modeProps)\n { modeObj[prop$1] = spec.modeProps[prop$1]; } }\n\n return modeObj\n }\n\n // This can be used to attach properties to mode objects from\n // outside the actual mode definition.\n var modeExtensions = {};\n function extendMode(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n copyObj(properties, exts);\n }\n\n function copyState(mode, state) {\n if (state === true) { return state }\n if (mode.copyState) { return mode.copyState(state) }\n var nstate = {};\n for (var n in state) {\n var val = state[n];\n if (val instanceof Array) { val = val.concat([]); }\n nstate[n] = val;\n }\n return nstate\n }\n\n // Given a mode and a state (for that mode), find the inner mode and\n // state at the position that the state refers to.\n function innerMode(mode, state) {\n var info;\n while (mode.innerMode) {\n info = mode.innerMode(state);\n if (!info || info.mode == mode) { break }\n state = info.state;\n mode = info.mode;\n }\n return info || {mode: mode, state: state}\n }\n\n function startState(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true\n }\n\n // STRING STREAM\n\n // Fed to the mode parsers, provides helper functions to make\n // parsers more succinct.\n\n var StringStream = function(string, tabSize, lineOracle) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n this.lineOracle = lineOracle;\n };\n\n StringStream.prototype.eol = function () {return this.pos >= this.string.length};\n StringStream.prototype.sol = function () {return this.pos == this.lineStart};\n StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};\n StringStream.prototype.next = function () {\n if (this.pos < this.string.length)\n { return this.string.charAt(this.pos++) }\n };\n StringStream.prototype.eat = function (match) {\n var ch = this.string.charAt(this.pos);\n var ok;\n if (typeof match == \"string\") { ok = ch == match; }\n else { ok = ch && (match.test ? match.test(ch) : match(ch)); }\n if (ok) {++this.pos; return ch}\n };\n StringStream.prototype.eatWhile = function (match) {\n var start = this.pos;\n while (this.eat(match)){}\n return this.pos > start\n };\n StringStream.prototype.eatSpace = function () {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }\n return this.pos > start\n };\n StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};\n StringStream.prototype.skipTo = function (ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {this.pos = found; return true}\n };\n StringStream.prototype.backUp = function (n) {this.pos -= n;};\n StringStream.prototype.column = function () {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.indentation = function () {\n return countColumn(this.string, null, this.tabSize) -\n (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.match = function (pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) { this.pos += pattern.length; }\n return true\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) { return null }\n if (match && consume !== false) { this.pos += match[0].length; }\n return match\n }\n };\n StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};\n StringStream.prototype.hideFirstChars = function (n, inner) {\n this.lineStart += n;\n try { return inner() }\n finally { this.lineStart -= n; }\n };\n StringStream.prototype.lookAhead = function (n) {\n var oracle = this.lineOracle;\n return oracle && oracle.lookAhead(n)\n };\n StringStream.prototype.baseToken = function () {\n var oracle = this.lineOracle;\n return oracle && oracle.baseToken(this.pos)\n };\n\n // Find the line object corresponding to the given line number.\n function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) { throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\") }\n var chunk = doc;\n while (!chunk.lines) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break }\n n -= sz;\n }\n }\n return chunk.lines[n]\n }\n\n // Get the part of a document between two positions, as an array of\n // strings.\n function getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function (line) {\n var text = line.text;\n if (n == end.line) { text = text.slice(0, end.ch); }\n if (n == start.line) { text = text.slice(start.ch); }\n out.push(text);\n ++n;\n });\n return out\n }\n // Get the lines between from and to, as array of strings.\n function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value\n return out\n }\n\n // Update the height of a line, propagating the height change\n // upwards to parent nodes.\n function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }\n\n // Given a line object, find its line number by walking up through\n // its parent links.\n function lineNo(line) {\n if (line.parent == null) { return null }\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) { break }\n no += chunk.children[i].chunkSize();\n }\n }\n return no + cur.first\n }\n\n // Find the line at the given vertical position, using the height\n // information in the document tree.\n function lineAtHeight(chunk, h) {\n var n = chunk.first;\n outer: do {\n for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {\n var child = chunk.children[i$1], ch = child.height;\n if (h < ch) { chunk = child; continue outer }\n h -= ch;\n n += child.chunkSize();\n }\n return n\n } while (!chunk.lines)\n var i = 0;\n for (; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i], lh = line.height;\n if (h < lh) { break }\n h -= lh;\n }\n return n + i\n }\n\n function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}\n\n function lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber))\n }\n\n // A Pos instance represents a position within the text.\n function Pos(line, ch, sticky) {\n if ( sticky === void 0 ) sticky = null;\n\n if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }\n this.line = line;\n this.ch = ch;\n this.sticky = sticky;\n }\n\n // Compare two positions, return 0 if they are the same, a negative\n // number when a is less, and a positive number otherwise.\n function cmp(a, b) { return a.line - b.line || a.ch - b.ch }\n\n function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }\n\n function copyPos(x) {return Pos(x.line, x.ch)}\n function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }\n function minPos(a, b) { return cmp(a, b) < 0 ? a : b }\n\n // Most of the external API clips given positions to make sure they\n // actually exist within the document.\n function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}\n function clipPos(doc, pos) {\n if (pos.line < doc.first) { return Pos(doc.first, 0) }\n var last = doc.first + doc.size - 1;\n if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }\n return clipToLen(pos, getLine(doc, pos.line).text.length)\n }\n function clipToLen(pos, linelen) {\n var ch = pos.ch;\n if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }\n else if (ch < 0) { return Pos(pos.line, 0) }\n else { return pos }\n }\n function clipPosArray(doc, array) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }\n return out\n }\n\n var SavedContext = function(state, lookAhead) {\n this.state = state;\n this.lookAhead = lookAhead;\n };\n\n var Context = function(doc, state, line, lookAhead) {\n this.state = state;\n this.doc = doc;\n this.line = line;\n this.maxLookAhead = lookAhead || 0;\n this.baseTokens = null;\n this.baseTokenPos = 1;\n };\n\n Context.prototype.lookAhead = function (n) {\n var line = this.doc.getLine(this.line + n);\n if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }\n return line\n };\n\n Context.prototype.baseToken = function (n) {\n if (!this.baseTokens) { return null }\n while (this.baseTokens[this.baseTokenPos] <= n)\n { this.baseTokenPos += 2; }\n var type = this.baseTokens[this.baseTokenPos + 1];\n return {type: type && type.replace(/( |^)overlay .*/, \"\"),\n size: this.baseTokens[this.baseTokenPos] - n}\n };\n\n Context.prototype.nextLine = function () {\n this.line++;\n if (this.maxLookAhead > 0) { this.maxLookAhead--; }\n };\n\n Context.fromSaved = function (doc, saved, line) {\n if (saved instanceof SavedContext)\n { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }\n else\n { return new Context(doc, copyState(doc.mode, saved), line) }\n };\n\n Context.prototype.save = function (copy) {\n var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;\n return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state\n };\n\n\n // Compute a style array (an array starting with a mode generation\n // -- for invalidation -- followed by pairs of end positions and\n // style strings), which is used to highlight the tokens on the\n // line.\n function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }\n\n function getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var context = getContextBefore(cm, lineNo(line));\n var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);\n var result = highlightLine(cm, line, context);\n if (resetState) { context.state = resetState; }\n line.stateAfter = context.save(!resetState);\n line.styles = result.styles;\n if (result.classes) { line.styleClasses = result.classes; }\n else if (line.styleClasses) { line.styleClasses = null; }\n if (updateFrontier === cm.doc.highlightFrontier)\n { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }\n }\n return line.styles\n }\n\n function getContextBefore(cm, n, precise) {\n var doc = cm.doc, display = cm.display;\n if (!doc.mode.startState) { return new Context(doc, true, n) }\n var start = findStartLine(cm, n, precise);\n var saved = start > doc.first && getLine(doc, start - 1).stateAfter;\n var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);\n\n doc.iter(start, n, function (line) {\n processLine(cm, line.text, context);\n var pos = context.line;\n line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;\n context.nextLine();\n });\n if (precise) { doc.modeFrontier = context.line; }\n return context\n }\n\n // Lightweight form of highlight -- proceed over this line and\n // update state, but don't save a style array. Used for lines that\n // aren't currently visible.\n function processLine(cm, text, context, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize, context);\n stream.start = stream.pos = startAt || 0;\n if (text == \"\") { callBlankLine(mode, context.state); }\n while (!stream.eol()) {\n readToken(mode, stream, context.state);\n stream.start = stream.pos;\n }\n }\n\n function callBlankLine(mode, state) {\n if (mode.blankLine) { return mode.blankLine(state) }\n if (!mode.innerMode) { return }\n var inner = innerMode(mode, state);\n if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }\n }\n\n function readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) { inner[0] = innerMode(mode, state).mode; }\n var style = mode.token(stream, state);\n if (stream.pos > stream.start) { return style }\n }\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\")\n }\n\n var Token = function(stream, type, state) {\n this.start = stream.start; this.end = stream.pos;\n this.string = stream.current();\n this.type = type || null;\n this.state = state;\n };\n\n // Utility for getTokenAt and getLineTokens\n function takeToken(cm, pos, precise, asArray) {\n var doc = cm.doc, mode = doc.mode, style;\n pos = clipPos(doc, pos);\n var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;\n if (asArray) { tokens = []; }\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, context.state);\n if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }\n }\n return asArray ? tokens : new Token(stream, style, context.state)\n }\n\n function extractLineClasses(type, output) {\n if (type) { for (;;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n if (!lineClass) { break }\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n if (output[prop] == null)\n { output[prop] = lineClass[2]; }\n else if (!(new RegExp(\"(?:^|\\\\s)\" + lineClass[2] + \"(?:$|\\\\s)\")).test(output[prop]))\n { output[prop] += \" \" + lineClass[2]; }\n } }\n return type\n }\n\n // Run the given mode's parser over a line, calling f for each token.\n function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }\n var curStart = 0, curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize, context), style;\n var inner = cm.options.addModeClass && [null];\n if (text == \"\") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n if (forceToEnd) { processLine(cm, text, context, stream.pos); }\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);\n }\n if (inner) {\n var mName = inner[0].name;\n if (mName) { style = \"m-\" + (style ? mName + \" \" + style : mName); }\n }\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 5000);\n f(curStart, curStyle);\n }\n curStyle = style;\n }\n stream.start = stream.pos;\n }\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444\n // characters, and returns inaccurate measurements in nodes\n // starting around 5000 chars.\n var pos = Math.min(stream.pos, curStart + 5000);\n f(pos, curStyle);\n curStart = pos;\n }\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }\n\n function retreatFrontier(doc, n) {\n doc.modeFrontier = Math.min(doc.modeFrontier, n);\n if (doc.highlightFrontier < n - 10) { return }\n var start = doc.first;\n for (var line = n - 1; line > start; line--) {\n var saved = getLine(doc, line).stateAfter;\n // change is on 3\n // state on line 1 looked ahead 2 -- so saw 3\n // test 1 + 2 < 3 should cover this\n if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {\n start = line + 1;\n break\n }\n }\n doc.highlightFrontier = Math.min(doc.highlightFrontier, start);\n }\n\n // Optimize some code when these features are not used.\n var sawReadOnlySpans = false, sawCollapsedSpans = false;\n\n function seeReadOnlySpans() {\n sawReadOnlySpans = true;\n }\n\n function seeCollapsedSpans() {\n sawCollapsedSpans = true;\n }\n\n // TEXTMARKER SPANS\n\n function MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from; this.to = to;\n }\n\n // Search an array of spans for a span matching the given marker.\n function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }\n // Remove a span from an array, returning undefined if no spans are\n // left (we don't store arrays for lines without spans).\n function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }\n // Add a span to a line.\n function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }\n\n // Used for the algorithm that adjusts markers for a change in the\n // document. These functions cut an array of spans at a given\n // character position, returning an array of remaining chunks (or\n // undefined if nothing remains).\n function markedSpansBefore(old, startCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n } }\n return nw\n }\n function markedSpansAfter(old, endCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n span.to == null ? null : span.to - endCh));\n }\n } }\n return nw\n }\n\n // Given a change object, compute the new set of marker spans that\n // cover the line in which the change took place. Removes spans\n // entirely within the change, reconnects spans belonging to the\n // same marker that appear on both sides of the change, and cuts off\n // spans partially within the change. Returns an array of span\n // arrays with one element for each line in (after) the change.\n function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }\n\n // Remove spans that are empty and don't have a clearWhenEmpty\n // option of false.\n function clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n { spans.splice(i--, 1); }\n }\n if (!spans.length) { return null }\n return spans\n }\n\n // Used to 'clip' out readOnly ranges when making a change.\n function removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function (line) {\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))\n { (markers || (markers = [])).push(mark); }\n } }\n });\n if (!markers) { return null }\n var parts = [{from: from, to: to}];\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i], m = mk.find(0);\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }\n var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)\n { newParts.push({from: p.from, to: m.from}); }\n if (dto > 0 || !mk.inclusiveRight && !dto)\n { newParts.push({from: m.to, to: p.to}); }\n parts.splice.apply(parts, newParts);\n j += newParts.length - 3;\n }\n }\n return parts\n }\n\n // Connect or disconnect spans from a line.\n function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }\n function attachMarkedSpans(line, spans) {\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.attachLine(line); }\n line.markedSpans = spans;\n }\n\n // Helpers used when computing which overlapping collapsed span\n // counts as the larger one.\n function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }\n function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }\n\n // Returns a number indicating which of two overlapping collapsed\n // spans is larger (and thus includes the other). Falls back to\n // comparing ids when the spans cover exactly the same range.\n function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n if (lenDiff != 0) { return lenDiff }\n var aPos = a.find(), bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n if (fromCmp) { return -fromCmp }\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n if (toCmp) { return toCmp }\n return b.id - a.id\n }\n\n // Find out whether a line ends or starts in a collapsed span. If\n // so, return the marker for that span.\n function collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0))\n { found = sp.marker; }\n } }\n return found\n }\n function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }\n function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }\n\n function collapsedSpanAround(line, ch) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }\n } }\n return found\n }\n\n // Test whether there exists a collapsed span that partially\n // overlaps (covers the start or end, but not both) of a new span.\n // Such overlap is not allowed.\n function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }\n\n // A visual line is a line as drawn on the screen. Folding, for\n // example, can cause multiple logical lines to appear on the same\n // visual line. This finds the start of the visual line that the\n // given line is part of (usually that is the line itself).\n function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }\n\n function visualLineEnd(line) {\n var merged;\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return line\n }\n\n // Returns an array of logical lines that continue the visual line\n // started by the argument, or undefined if there are no such lines.\n function visualLineContinued(line) {\n var merged, lines;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line\n ;(lines || (lines = [])).push(line);\n }\n return lines\n }\n\n // Get the line number of the start of the visual line that the\n // given line number is part of.\n function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }\n\n // Get the line number of the start of the next visual line after\n // the given line.\n function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }\n\n // Compute whether a line is hidden. Lines count as hidden when they\n // are part of a visual line that starts with another line, or when\n // they are entirely covered by collapsed, non-widget span.\n function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n if (sp.from == null) { return true }\n if (sp.marker.widgetNode) { continue }\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))\n { return true }\n } }\n }\n function lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))\n }\n if (span.marker.inclusiveRight && span.to == line.text.length)\n { return true }\n for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n (sp.to == null || sp.to != span.from) &&\n (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n lineIsHiddenInner(doc, line, sp)) { return true }\n }\n }\n\n // Find the height above the given line.\n function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }\n\n // Compute the character length of a line, taking into account\n // collapsed ranges (see markText) that might hide parts, and join\n // other lines onto it.\n function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }\n\n // Find the longest line in the document.\n function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }\n\n // LINE DATA STRUCTURE\n\n // Line objects. These hold state related to a line, including\n // highlighting info (the styles array).\n var Line = function(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n };\n\n Line.prototype.lineNo = function () { return lineNo(this) };\n eventMixin(Line);\n\n // Change the content (text, markers) of a line. Automatically\n // invalidates cached information and tries to re-estimate the\n // line's height.\n function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n }\n\n // Detach a line from the document tree and its markers.\n function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }\n\n // Convert a style as returned by a mode (either null, or a string\n // containing one or more styles) to a CSS style. This is cached,\n // and also looks for line-wide styles.\n var styleToClassCache = {}, styleToClassCacheWithMode = {};\n function interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) { return null }\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] ||\n (cache[style] = style.replace(/\\S+/g, \"cm-$&\"))\n }\n\n // Render the DOM representation of the text of a line. Also builds\n // up a 'line map', which points at the DOM nodes that represent\n // specific stretches of text, and is used by the measuring code.\n // The returned object contains the DOM node, this map, and\n // information about line-wide styles that were set by the mode.\n function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }\n\n function defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token\n }\n\n // Build up the DOM representation for a single token, and add it to\n // the line map. Takes care to render special characters separately.\n function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }\n\n // Change some spaces to NBSP to prevent the browser from collapsing\n // trailing spaces at the end of a line when rendering text (issue #1362).\n function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) { return text }\n var spaceBefore = trailingBefore, result = \"\";\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n { ch = \"\\u00a0\"; }\n result += ch;\n spaceBefore = ch == \" \";\n }\n return result\n }\n\n // Work around nonsense dimensions being reported for stretches of\n // right-to-left text.\n function buildTokenBadBidi(inner, order) {\n return function (builder, text, style, startStyle, endStyle, css, attributes) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos, end = start + text.length;\n for (;;) {\n // Find the part that overlaps with the start of this text\n var part = (void 0);\n for (var i = 0; i < order.length; i++) {\n part = order[i];\n if (part.to > start && part.from <= start) { break }\n }\n if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n }\n }\n\n function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget)\n { widget = builder.content.appendChild(document.createElement(\"span\")); }\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n builder.pos += size;\n builder.trailingSpace = false;\n }\n\n // Outputs a number of spans to make up a line, taking highlighting\n // and marked text into account.\n function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }\n\n\n // These objects are used to represent the visible (currently drawn)\n // part of the document. A LineView may correspond to multiple\n // logical lines, if those are connected by collapsed ranges.\n function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }\n\n // Create a range of LineView objects for the given lines.\n function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n }\n\n var operationGroup = null;\n\n function pushOperation(op) {\n if (operationGroup) {\n operationGroup.ops.push(op);\n } else {\n op.ownsGroup = operationGroup = {\n ops: [op],\n delayedCallbacks: []\n };\n }\n }\n\n function fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks, i = 0;\n do {\n for (; i < callbacks.length; i++)\n { callbacks[i].call(null); }\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n if (op.cursorActivityHandlers)\n { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)\n { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }\n }\n } while (i < callbacks.length)\n }\n\n function finishOperation(op, endCb) {\n var group = op.ownsGroup;\n if (!group) { return }\n\n try { fireCallbacksForOps(group); }\n finally {\n operationGroup = null;\n endCb(group);\n }\n }\n\n var orphanDelayedCallbacks = null;\n\n // Often, we want to signal events at a point where we are in the\n // middle of some work, but don't want the handler to start calling\n // other methods on the editor, which might be in an inconsistent\n // state or simply not expect any other events to happen.\n // signalLater looks whether there are any handlers, and schedules\n // them to be executed when the last operation ends, or, if no\n // operation is active, when a timeout fires.\n function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n }\n\n function fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n for (var i = 0; i < delayed.length; ++i) { delayed[i](); }\n }\n\n // When an aspect of a line changes, a string is added to\n // lineView.changes. This updates the relevant part of the line's\n // DOM structure.\n function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }\n\n // Lines with gutter elements, widgets or a background class need to\n // be wrapped, and have the extra elements added to the wrapper div\n function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }\n }\n return lineView.node\n }\n\n function updateLineBackground(cm, lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n if (cls) { cls += \" CodeMirror-linebackground\"; }\n if (lineView.background) {\n if (cls) { lineView.background.className = cls; }\n else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n cm.display.input.setUneditable(lineView.background);\n }\n }\n\n // Wrapper around buildLineContent which will reuse the structure\n // in display.externalMeasured when possible.\n function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }\n\n // Redraw the line's text. Interacts with the background and text\n // classes because the mode may output tokens that influence these\n // classes.\n function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }\n\n function updateLineClasses(cm, lineView) {\n updateLineBackground(cm, lineView);\n if (lineView.line.wrapClass)\n { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }\n else if (lineView.node != lineView.text)\n { lineView.node.className = \"\"; }\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n }\n\n function updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px; width: \" + (dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(lineView.gutterBackground);\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n var markers = lineView.line.gutterMarkers;\n if (cm.options.lineNumbers || markers) {\n var wrap$1 = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(gutterWrap);\n wrap$1.insertBefore(gutterWrap, lineView.text);\n if (lineView.line.gutterClass)\n { gutterWrap.className += \" \" + lineView.line.gutterClass; }\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"]))\n { lineView.lineNumber = gutterWrap.appendChild(\n elt(\"div\", lineNumberFor(cm.options, lineN),\n \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[\"CodeMirror-linenumbers\"]) + \"px; width: \" + (cm.display.lineNumInnerWidth) + \"px\"))); }\n if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {\n var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];\n if (found)\n { gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[id]) + \"px; width: \" + (dims.gutterWidth[id]) + \"px\"))); }\n } }\n }\n }\n\n function updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) { lineView.alignable = null; }\n var isWidget = classTest(\"CodeMirror-linewidget\");\n for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {\n next = node.nextSibling;\n if (isWidget.test(node.className)) { lineView.node.removeChild(node); }\n }\n insertLineWidgets(cm, lineView, dims);\n }\n\n // Build a line's DOM representation from scratch\n function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }\n\n // A lineView may contain multiple logical lines (when merged by\n // collapsed spans). The widgets for all of them need to be drawn.\n function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }\n\n function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) { return }\n var wrap = ensureLineWrapped(lineView);\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\" + (widget.className ? \" \" + widget.className : \"\"));\n if (!widget.handleMouseEvents) { node.setAttribute(\"cm-ignore-events\", \"true\"); }\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n if (allowAbove && widget.above)\n { wrap.insertBefore(node, lineView.gutter || lineView.text); }\n else\n { wrap.appendChild(node); }\n signalLater(widget, \"redraw\");\n }\n }\n\n function positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n node.style.width = width + \"px\";\n }\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + \"px\"; }\n }\n }\n\n function widgetHeight(widget) {\n if (widget.height != null) { return widget.height }\n var cm = widget.doc.cm;\n if (!cm) { return 0 }\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n if (widget.coverGutter)\n { parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\"; }\n if (widget.noHScroll)\n { parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\"; }\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n return widget.height = widget.node.parentNode.offsetHeight\n }\n\n // Return true when the given mouse event happened in a widget\n function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n }\n\n // POSITION MEASUREMENT\n\n function paddingTop(display) {return display.lineSpace.offsetTop}\n function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}\n function paddingH(display) {\n if (display.cachedPaddingH) { return display.cachedPaddingH }\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\", \"CodeMirror-line-like\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }\n return data\n }\n\n function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }\n function displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth\n }\n function displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight\n }\n\n // Ensure the lineView.wrapping.heights array is populated. This is\n // an array of bottom offsets for the lines that make up a drawn\n // line. When lineWrapping is on, there might be more than one\n // height.\n function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }\n\n // Find a line map (mapping character offsets to text nodes) and a\n // measurement cache for the given line number. (A line view might\n // contain multiple lines when collapsed ranges are present.)\n function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n }\n\n // Render a line into the hidden node display.externalMeasured. Used\n // when measurement is needed for a line that's not in the viewport.\n function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }\n\n // Get a {top, bottom, left, right} box (in line-local coordinates)\n // for a given character.\n function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)\n }\n\n // Find a line view that corresponds to the given line number.\n function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }\n\n // Measurement can be split in two steps, the set-up work that\n // applies to the whole line, and the measurement of the actual\n // character. Functions like coordsChar, that need to do a lot of\n // measurements in a row, can thus ensure that the set-up work is\n // only done once.\n function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }\n\n // Given a prepared measurement object, measures the position of an\n // actual character (or fetches it from the cache).\n function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n }\n\n var nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\n function nodeAndOffsetInLineMap(map, ch, bias) {\n var node, start, end, collapse, mStart, mEnd;\n // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n for (var i = 0; i < map.length; i += 3) {\n mStart = map[i];\n mEnd = map[i + 1];\n if (ch < mStart) {\n start = 0; end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n if (ch >= mEnd) { collapse = \"right\"; }\n }\n if (start != null) {\n node = map[i + 2];\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\"))\n { collapse = bias; }\n if (bias == \"left\" && start == 0)\n { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n node = map[(i -= 3) + 2];\n collapse = \"left\";\n } }\n if (bias == \"right\" && start == mEnd - mStart)\n { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {\n node = map[(i += 3) + 2];\n collapse = \"right\";\n } }\n break\n }\n }\n return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}\n }\n\n function getUsefulRect(rects, bias) {\n var rect = nullRect;\n if (bias == \"left\") { for (var i = 0; i < rects.length; i++) {\n if ((rect = rects[i]).left != rect.right) { break }\n } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {\n if ((rect = rects[i$1]).left != rect.right) { break }\n } }\n return rect\n }\n\n function measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n var rect;\n if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)\n { rect = node.parentNode.getBoundingClientRect(); }\n else\n { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }\n if (rect.left || rect.right || start == 0) { break }\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }\n } else { // If it is a widget, simply get the box for the whole widget.\n if (start > 0) { collapse = bias = \"right\"; }\n var rects;\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)\n { rect = rects[bias == \"right\" ? rects.length - 1 : 0]; }\n else\n { rect = node.getBoundingClientRect(); }\n }\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n if (rSpan)\n { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }\n else\n { rect = nullRect; }\n }\n\n var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n var i = 0;\n for (; i < heights.length - 1; i++)\n { if (mid < heights[i]) { break } }\n var top = i ? heights[i - 1] : 0, bot = heights[i];\n var result = {left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top, bottom: bot};\n if (!rect.left && !rect.right) { result.bogus = true; }\n if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }\n\n return result\n }\n\n // Work around problem with bounding client rects on ranges being\n // returned incorrectly when zoomed on IE10 and below.\n function maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null ||\n screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))\n { return rect }\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {left: rect.left * scaleX, right: rect.right * scaleX,\n top: rect.top * scaleY, bottom: rect.bottom * scaleY}\n }\n\n function clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { lineView.measure.caches[i] = {}; } }\n }\n }\n\n function clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n for (var i = 0; i < cm.display.view.length; i++)\n { clearLineMeasurementCacheFor(cm.display.view[i]); }\n }\n\n function clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }\n cm.display.lineNumChars = null;\n }\n\n function pageScrollX() {\n // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206\n // which causes page_Offset and bounding client rects to use\n // different reference viewports and invalidate our calculations.\n if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }\n return window.pageXOffset || (document.documentElement || document.body).scrollLeft\n }\n function pageScrollY() {\n if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }\n return window.pageYOffset || (document.documentElement || document.body).scrollTop\n }\n\n function widgetTopHeight(lineObj) {\n var height = 0;\n if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)\n { height += widgetHeight(lineObj.widgets[i]); } } }\n return height\n }\n\n // Converts a {top, bottom, left, right} box from line-local\n // coordinates into another coordinate system. Context may be one of\n // \"line\", \"div\" (display.lineDiv), \"local\"./null (editor), \"window\",\n // or \"page\".\n function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n if (!includeWidgets) {\n var height = widgetTopHeight(lineObj);\n rect.top += height; rect.bottom += height;\n }\n if (context == \"line\") { return rect }\n if (!context) { context = \"local\"; }\n var yOff = heightAtLine(lineObj);\n if (context == \"local\") { yOff += paddingTop(cm.display); }\n else { yOff -= cm.display.viewOffset; }\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect\n }\n\n // Coverts a box from \"div\" coords to another coordinate system.\n // Context may be \"window\", \"page\", \"div\", or \"local\"./null.\n function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n }\n\n function charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)\n }\n\n // Returns a box for a given cursor position, which may have an\n // 'other' property containing the position of the secondary cursor\n // on a bidi boundary.\n // A cursor Pos(line, char, \"before\") is on the same visual line as `char - 1`\n // and after `char - 1` in writing order of `char - 1`\n // A cursor Pos(line, char, \"after\") is on the same visual line as `char`\n // and before `char` in writing order of `char`\n // Examples (upper-case letters are RTL, lower-case are LTR):\n // Pos(0, 1, ...)\n // before after\n // ab a|b a|b\n // aB a|B aB|\n // Ab |Ab A|b\n // AB B|A B|A\n // Every position after the last character on a line is considered to stick\n // to the last character on the line.\n function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }\n\n // Used to cheaply estimate the coordinates for a position. Used for\n // intermediate scroll updates.\n function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n }\n\n // Positions returned by coordsChar contain some extra information.\n // xRel is the relative x position of the input coordinates compared\n // to the found position (so xRel > 0 means the coordinates are to\n // the right of the character position, for example). When outside\n // is true, that means the coordinates lie outside the line's\n // vertical range.\n function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n if (outside) { pos.outside = outside; }\n return pos\n }\n\n // Compute the character position closest to the given coordinates.\n // Input must be lineSpace-local (\"div\" coordinate system).\n function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }\n\n function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {\n y -= widgetTopHeight(lineObj);\n var end = lineObj.text.length;\n var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);\n end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);\n return {begin: begin, end: end}\n }\n\n function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), \"line\").top;\n return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)\n }\n\n // Returns true if the given side of a box is after the given\n // coordinates, in top-to-bottom, left-to-right order.\n function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n }\n\n function coordsCharInner(cm, lineObj, lineNo, x, y) {\n // Move y into line-local coordinate space\n y -= heightAtLine(lineObj);\n var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n // When directly calling `measureCharPrepared`, we have to adjust\n // for the widgets at this line.\n var widgetHeight = widgetTopHeight(lineObj);\n var begin = 0, end = lineObj.text.length, ltr = true;\n\n var order = getOrder(lineObj, cm.doc.direction);\n // If the line isn't plain left-to-right text, first figure out\n // which bidi section the coordinates fall into.\n if (order) {\n var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)\n (cm, lineObj, lineNo, preparedMeasure, order, x, y);\n ltr = part.level != 1;\n // The awkward -1 offsets are needed because findFirst (called\n // on these below) will treat its first bound as inclusive,\n // second as exclusive, but we want to actually address the\n // characters in the part's range\n begin = ltr ? part.from : part.to - 1;\n end = ltr ? part.to : part.from - 1;\n }\n\n // A binary search to find the first character whose bounding box\n // starts after the coordinates. If we run across any whose box wrap\n // the coordinates, store that.\n var chAround = null, boxAround = null;\n var ch = findFirst(function (ch) {\n var box = measureCharPrepared(cm, preparedMeasure, ch);\n box.top += widgetHeight; box.bottom += widgetHeight;\n if (!boxIsAfter(box, x, y, false)) { return false }\n if (box.top <= y && box.left <= x) {\n chAround = ch;\n boxAround = box;\n }\n return true\n }, begin, end);\n\n var baseX, sticky, outside = false;\n // If a box around the coordinates was found, use that\n if (boxAround) {\n // Distinguish coordinates nearer to the left or right side of the box\n var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;\n ch = chAround + (atStart ? 0 : 1);\n sticky = atStart ? \"after\" : \"before\";\n baseX = atLeft ? boxAround.left : boxAround.right;\n } else {\n // (Adjust for extended bound, if necessary.)\n if (!ltr && (ch == end || ch == begin)) { ch++; }\n // To determine which side to associate with, get the box to the\n // left of the character and compare it's vertical position to the\n // coordinates\n sticky = ch == 0 ? \"after\" : ch == lineObj.text.length ? \"before\" :\n (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?\n \"after\" : \"before\";\n // Now get accurate coordinates for this place, in order to get a\n // base X position\n var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), \"line\", lineObj, preparedMeasure);\n baseX = coords.left;\n outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;\n }\n\n ch = skipExtendingChars(lineObj.text, ch, 1);\n return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)\n }\n\n function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {\n // Bidi parts are sorted left-to-right, and in a non-line-wrapping\n // situation, we can take this ordering to correspond to the visual\n // ordering. This finds the first part whose end is after the given\n // coordinates.\n var index = findFirst(function (i) {\n var part = order[i], ltr = part.level != 1;\n return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? \"before\" : \"after\"),\n \"line\", lineObj, preparedMeasure), x, y, true)\n }, 0, order.length - 1);\n var part = order[index];\n // If this isn't the first part, the part's start is also after\n // the coordinates, and the coordinates aren't on the same line as\n // that start, move one part back.\n if (index > 0) {\n var ltr = part.level != 1;\n var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? \"after\" : \"before\"),\n \"line\", lineObj, preparedMeasure);\n if (boxIsAfter(start, x, y, true) && start.top > y)\n { part = order[index - 1]; }\n }\n return part\n }\n\n function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {\n // In a wrapped line, rtl text on wrapping boundaries can do things\n // that don't correspond to the ordering in our `order` array at\n // all, so a binary search doesn't work, and we want to return a\n // part that only spans one line so that the binary search in\n // coordsCharInner is safe. As such, we first find the extent of the\n // wrapped line, and then do a flat search in which we discard any\n // spans that aren't on the line.\n var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);\n var begin = ref.begin;\n var end = ref.end;\n if (/\\s/.test(lineObj.text.charAt(end - 1))) { end--; }\n var part = null, closestDist = null;\n for (var i = 0; i < order.length; i++) {\n var p = order[i];\n if (p.from >= end || p.to <= begin) { continue }\n var ltr = p.level != 1;\n var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;\n // Weigh against spans ending before this, so that they are only\n // picked if nothing ends after\n var dist = endX < x ? x - endX + 1e9 : endX - x;\n if (!part || closestDist > dist) {\n part = p;\n closestDist = dist;\n }\n }\n if (!part) { part = order[order.length - 1]; }\n // Clip the part to the wrapped line.\n if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }\n if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }\n return part\n }\n\n var measureText;\n // Compute the default text height.\n function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\", null, \"CodeMirror-line-like\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }\n\n // Compute the default character width.\n function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }\n\n // Do a bulk-read of the DOM positions and sizes needed to draw the\n // view, so that we don't interleave reading and writing to the DOM.\n function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }\n\n // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n // but using getBoundingClientRect to get a sub-pixel-accurate\n // result.\n function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n }\n\n // Returns a function that estimates the height of a line, to use as\n // first approximation until the line becomes visible (and is thus\n // properly measurable).\n function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }\n\n function estimateLineHeights(cm) {\n var doc = cm.doc, est = estimateHeight(cm);\n doc.iter(function (line) {\n var estHeight = est(line);\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n });\n }\n\n // Given a mouse event, find the corresponding position. If liberal\n // is false, it checks whether a gutter or scrollbar was clicked,\n // and returns null if it was. forRect is used by rectangular\n // selections, and tries to estimate a character position even for\n // coordinates beyond the right of the text.\n function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }\n\n // Find the view element corresponding to a given line. Return null\n // when the line isn't visible.\n function findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) { return null }\n n -= cm.display.viewFrom;\n if (n < 0) { return null }\n var view = cm.display.view;\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n if (n < 0) { return i }\n }\n }\n\n // Updates the display.view data structure for a given change to the\n // document. From and to are in pre-change coordinates. Lendiff is\n // the amount of lines added or subtracted by the change. This is\n // used for changes that span multiple lines, or change the way\n // lines are divided into visual lines. regLineChange (below)\n // registers single-line changes.\n function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n }\n\n // Register a change to a single line. Type must be one of \"text\",\n // \"gutter\", \"class\", \"widget\"\n function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }\n\n // Clear the view.\n function resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n }\n\n function viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)\n { return {index: index, lineN: newN} }\n var n = cm.display.viewFrom;\n for (var i = 0; i < index; i++)\n { n += view[i].size; }\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) { return null }\n diff = (n + view[index].size) - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n oldN += diff; newN += diff;\n }\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) { return null }\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n return {index: index, lineN: newN}\n }\n\n // Force the view to cover a given range, adding empty view element\n // or clipping off existing ones as needed.\n function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }\n else if (display.viewFrom < from)\n { display.view = display.view.slice(findViewIndex(cm, from)); }\n display.viewFrom = from;\n if (display.viewTo < to)\n { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }\n else if (display.viewTo > to)\n { display.view = display.view.slice(0, findViewIndex(cm, to)); }\n }\n display.viewTo = to;\n }\n\n // Count the number of lines in the view whose DOM representation is\n // out of date (or nonexistent).\n function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n }\n\n function updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n }\n\n function prepareSelection(cm, primary) {\n if ( primary === void 0 ) primary = true;\n\n var doc = cm.doc, result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (!primary && i == doc.sel.primIndex) { continue }\n var range = doc.sel.ranges[i];\n if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }\n var collapsed = range.empty();\n if (collapsed || cm.options.showCursorWhenSelecting)\n { drawSelectionCursor(cm, range.head, curFragment); }\n if (!collapsed)\n { drawSelectionRange(cm, range, selFragment); }\n }\n return result\n }\n\n // Draws a cursor for the given range\n function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }\n\n function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }\n\n // Draws the given range as a highlighted selection\n function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }\n\n // Cursor-blinking\n function restartBlink(cm) {\n if (!cm.state.focused) { return }\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n if (cm.options.cursorBlinkRate > 0)\n { display.blinker = setInterval(function () {\n if (!cm.hasFocus()) { onBlur(cm); }\n display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, cm.options.cursorBlinkRate); }\n else if (cm.options.cursorBlinkRate < 0)\n { display.cursorDiv.style.visibility = \"hidden\"; }\n }\n\n function ensureFocus(cm) {\n if (!cm.hasFocus()) {\n cm.display.input.focus();\n if (!cm.state.focused) { onFocus(cm); }\n }\n }\n\n function delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n if (cm.state.focused) { onBlur(cm); }\n } }, 100);\n }\n\n function onFocus(cm, e) {\n if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; }\n\n if (cm.options.readOnly == \"nocursor\") { return }\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm, e);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\");\n // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730\n }\n cm.display.input.receivedFocus();\n }\n restartBlink(cm);\n }\n function onBlur(cm, e) {\n if (cm.state.delayingBlurEvent) { return }\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm, e);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n clearInterval(cm.display.blinker);\n setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);\n }\n\n // Read the actual heights of the rendered lines, and update their\n // stored heights to match.\n function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }\n\n // Read and store the height of line widgets associated with the\n // given line.\n function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }\n\n // Compute the lines that are visible in a given viewport (defaults\n // the the current scroll position). viewport may contain top,\n // height, and ensure (see op.scrollToPos) properties.\n function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }\n\n // SCROLLING THINGS INTO VIEW\n\n // If an editor sits on the top or bottom of the window, partially\n // scrolled out of view, this ensures that the cursor is visible.\n function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) { return }\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n if (rect.top + box.top < 0) { doScroll = true; }\n else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200b\", null, (\"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + (rect.left) + \"px; width: \" + (Math.max(2, rect.right - rect.left)) + \"px;\"));\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }\n\n // Scroll a given position into view (immediately), verifying that\n // it actually became visible (as line heights are accurately\n // measured, the position of something may 'drift' during drawing).\n function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }\n\n // Scroll a given set of coordinates into view (immediately).\n function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }\n\n // Calculate a new scroll position needed to scroll the given\n // rectangle into view. Returns an object with scrollTop and\n // scrollLeft properties. When these are undefined, the\n // vertical/horizontal position does not need to be adjusted.\n function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }\n\n // Store a relative adjustment to the scroll position in the current\n // operation (to be applied when the operation finishes).\n function addToScrollTop(cm, top) {\n if (top == null) { return }\n resolveScrollToPos(cm);\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }\n\n // Make sure that at the end of the operation the current cursor is\n // shown.\n function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }\n\n function scrollToCoords(cm, x, y) {\n if (x != null || y != null) { resolveScrollToPos(cm); }\n if (x != null) { cm.curOp.scrollLeft = x; }\n if (y != null) { cm.curOp.scrollTop = y; }\n }\n\n function scrollToRange(cm, range) {\n resolveScrollToPos(cm);\n cm.curOp.scrollToPos = range;\n }\n\n // When an operation has its scrollToPos property set, and another\n // scroll action is applied before the end of the operation, this\n // 'simulates' scrolling that position into view in a cheap way, so\n // that the effect of intermediate scroll commands is not ignored.\n function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n scrollToCoordsRange(cm, from, to, range.margin);\n }\n }\n\n function scrollToCoordsRange(cm, from, to, margin) {\n var sPos = calculateScrollPos(cm, {\n left: Math.min(from.left, to.left),\n top: Math.min(from.top, to.top) - margin,\n right: Math.max(from.right, to.right),\n bottom: Math.max(from.bottom, to.bottom) + margin\n });\n scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);\n }\n\n // Sync the scrollable area and scrollbars, ensure the viewport\n // covers the visible area.\n function updateScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) { return }\n if (!gecko) { updateDisplaySimple(cm, {top: val}); }\n setScrollTop(cm, val, true);\n if (gecko) { updateDisplaySimple(cm); }\n startWorker(cm, 100);\n }\n\n function setScrollTop(cm, val, forceScroll) {\n val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));\n if (cm.display.scroller.scrollTop == val && !forceScroll) { return }\n cm.doc.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }\n }\n\n // Sync scroller and scrollbar, ensure the gutter elements are\n // aligned.\n function setScrollLeft(cm, val, isScroller, forceScroll) {\n val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));\n if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }\n cm.display.scrollbars.setScrollLeft(val);\n }\n\n // SCROLLBARS\n\n // Prepare DOM reads needed to update the scrollbars. Done in one\n // shot to minimize update/measure roundtrips.\n function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n }\n }\n\n var NativeScrollbars = function(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n vert.tabIndex = horiz.tabIndex = -1;\n place(vert); place(horiz);\n\n on(vert, \"scroll\", function () {\n if (vert.clientHeight) { scroll(vert.scrollTop, \"vertical\"); }\n });\n on(horiz, \"scroll\", function () {\n if (horiz.clientWidth) { scroll(horiz.scrollLeft, \"horizontal\"); }\n });\n\n this.checkedZeroWidth = false;\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\"; }\n };\n\n NativeScrollbars.prototype.update = function (measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n // A bug in IE8 can cause this value to be negative, so guard it.\n this.vert.firstChild.style.height =\n Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width =\n Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) { this.zeroWidthHack(); }\n this.checkedZeroWidth = true;\n }\n\n return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}\n };\n\n NativeScrollbars.prototype.setScrollLeft = function (pos) {\n if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }\n if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, \"horiz\"); }\n };\n\n NativeScrollbars.prototype.setScrollTop = function (pos) {\n if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }\n if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, \"vert\"); }\n };\n\n NativeScrollbars.prototype.zeroWidthHack = function () {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n this.disableHoriz = new Delayed;\n this.disableVert = new Delayed;\n };\n\n NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {\n bar.style.pointerEvents = \"auto\";\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // right corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt = type == \"vert\" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)\n : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);\n if (elt != bar) { bar.style.pointerEvents = \"none\"; }\n else { delay.set(1000, maybeDisable); }\n }\n delay.set(1000, maybeDisable);\n };\n\n NativeScrollbars.prototype.clear = function () {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n };\n\n var NullScrollbars = function () {};\n\n NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };\n NullScrollbars.prototype.setScrollLeft = function () {};\n NullScrollbars.prototype.setScrollTop = function () {};\n NullScrollbars.prototype.clear = function () {};\n\n function updateScrollbars(cm, measure) {\n if (!measure) { measure = measureForScrollbars(cm); }\n var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping)\n { updateHeightsInViewport(cm); }\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;\n }\n }\n\n // Re-synchronize the fake scrollbars with the actual size of the\n // content.\n function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }\n\n var scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\n function initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n if (cm.display.scrollbars.addClass)\n { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n // Prevent clicks in the scrollbars from killing focus\n on(node, \"mousedown\", function () {\n if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function (pos, axis) {\n if (axis == \"horizontal\") { setScrollLeft(cm, pos); }\n else { updateScrollTop(cm, pos); }\n }, cm);\n if (cm.display.scrollbars.addClass)\n { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n // Operations are used to wrap a series of changes to the editor\n // state in such a way that each change won't have to update the\n // cursor and display (which would be awkward, slow, and\n // error-prone). Instead, display updates are batched and then all\n // combined and executed at once.\n\n var nextOpId = 0;\n // Start a new operation.\n function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: 0, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n }\n\n // Finish an operation, updating the display and signalling delayed events\n function endOperation(cm) {\n var op = cm.curOp;\n if (op) { finishOperation(op, function (group) {\n for (var i = 0; i < group.ops.length; i++)\n { group.ops[i].cm.curOp = null; }\n endOperations(group);\n }); }\n }\n\n // The DOM updates done when an operation finishes are batched so\n // that the minimum number of relayouts are required.\n function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n { endOperation_R1(ops[i]); }\n for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)\n { endOperation_W1(ops[i$1]); }\n for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM\n { endOperation_R2(ops[i$2]); }\n for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)\n { endOperation_W2(ops[i$3]); }\n for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM\n { endOperation_finish(ops[i$4]); }\n }\n\n function endOperation_R1(op) {\n var cm = op.cm, display = cm.display;\n maybeClipScrollbars(cm);\n if (op.updateMaxLine) { findMaxLine(cm); }\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate &&\n new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n }\n\n function endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n }\n\n function endOperation_R2(op) {\n var cm = op.cm, display = cm.display;\n if (op.updatedDisplay) { updateHeightsInViewport(cm); }\n\n op.barMeasure = measureForScrollbars(cm);\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth =\n Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged)\n { op.preparedSelection = display.input.prepareSelection(); }\n }\n\n function endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n if (op.maxScrollLeft < cm.doc.scrollLeft)\n { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }\n cm.display.maxLineChanged = false;\n }\n\n var takeFocus = op.focus && op.focus == activeElt();\n if (op.preparedSelection)\n { cm.display.input.showSelection(op.preparedSelection, takeFocus); }\n if (op.updatedDisplay || op.startHeight != cm.doc.height)\n { updateScrollbars(cm, op.barMeasure); }\n if (op.updatedDisplay)\n { setDocumentHeight(cm, op.barMeasure); }\n\n if (op.selectionChanged) { restartBlink(cm); }\n\n if (cm.state.focused && op.updateInput)\n { cm.display.input.reset(op.typing); }\n if (takeFocus) { ensureFocus(op.cm); }\n }\n\n function endOperation_finish(op) {\n var cm = op.cm, display = cm.display, doc = cm.doc;\n\n if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n { display.wheelStartX = display.wheelStartY = null; }\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }\n\n if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n maybeScrollWindow(cm, rect);\n }\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) { for (var i = 0; i < hidden.length; ++i)\n { if (!hidden[i].lines.length) { signal(hidden[i], \"hide\"); } } }\n if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)\n { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], \"unhide\"); } } }\n\n if (display.wrapper.offsetHeight)\n { doc.scrollTop = cm.display.scroller.scrollTop; }\n\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n { signal(cm, \"changes\", cm, op.changeObjs); }\n if (op.update)\n { op.update.finish(); }\n }\n\n // Run the given function in an operation\n function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n }\n // Wraps a function in an operation. Returns the wrapped function.\n function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }\n // Used to add methods to editor and doc instances, wrapping them in\n // operations.\n function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }\n function docMethodOp(f) {\n return function() {\n var cm = this.cm;\n if (!cm || cm.curOp) { return f.apply(this, arguments) }\n startOperation(cm);\n try { return f.apply(this, arguments) }\n finally { endOperation(cm); }\n }\n }\n\n // HIGHLIGHT WORKER\n\n function startWorker(cm, time) {\n if (cm.doc.highlightFrontier < cm.display.viewTo)\n { cm.state.highlight.set(time, bind(highlightWorker, cm)); }\n }\n\n function highlightWorker(cm) {\n var doc = cm.doc;\n if (doc.highlightFrontier >= cm.display.viewTo) { return }\n var end = +new Date + cm.options.workTime;\n var context = getContextBefore(cm, doc.highlightFrontier);\n var changedLines = [];\n\n doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {\n if (context.line >= cm.display.viewFrom) { // Visible\n var oldStyles = line.styles;\n var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;\n var highlighted = highlightLine(cm, line, context, true);\n if (resetState) { context.state = resetState; }\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses, newCls = highlighted.classes;\n if (newCls) { line.styleClasses = newCls; }\n else if (oldCls) { line.styleClasses = null; }\n var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }\n if (ischange) { changedLines.push(context.line); }\n line.stateAfter = context.save();\n context.nextLine();\n } else {\n if (line.text.length <= cm.options.maxHighlightLength)\n { processLine(cm, line.text, context); }\n line.stateAfter = context.line % 5 == 0 ? context.save() : null;\n context.nextLine();\n }\n if (+new Date > end) {\n startWorker(cm, cm.options.workDelay);\n return true\n }\n });\n doc.highlightFrontier = context.line;\n doc.modeFrontier = Math.max(doc.modeFrontier, context.line);\n if (changedLines.length) { runInOp(cm, function () {\n for (var i = 0; i < changedLines.length; i++)\n { regLineChange(cm, changedLines[i], \"text\"); }\n }); }\n }\n\n // DISPLAY DRAWING\n\n var DisplayUpdate = function(cm, viewport, force) {\n var display = cm.display;\n\n this.viewport = viewport;\n // Store some values that we'll need later (but don't want to force a relayout for)\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n };\n\n DisplayUpdate.prototype.signal = function (emitter, type) {\n if (hasHandler(emitter, type))\n { this.events.push(arguments); }\n };\n DisplayUpdate.prototype.finish = function () {\n for (var i = 0; i < this.events.length; i++)\n { signal.apply(null, this.events[i]); }\n };\n\n function maybeClipScrollbars(cm) {\n var display = cm.display;\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n }\n\n function selectionSnapshot(cm) {\n if (cm.hasFocus()) { return null }\n var active = activeElt();\n if (!active || !contains(cm.display.lineDiv, active)) { return null }\n var result = {activeElt: active};\n if (window.getSelection) {\n var sel = window.getSelection();\n if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {\n result.anchorNode = sel.anchorNode;\n result.anchorOffset = sel.anchorOffset;\n result.focusNode = sel.focusNode;\n result.focusOffset = sel.focusOffset;\n }\n }\n return result\n }\n\n function restoreSelection(snapshot) {\n if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }\n snapshot.activeElt.focus();\n if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&\n snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {\n var sel = window.getSelection(), range = document.createRange();\n range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);\n range.collapse(false);\n sel.removeAllRanges();\n sel.addRange(range);\n sel.extend(snapshot.focusNode, snapshot.focusOffset);\n }\n }\n\n // Does the actual updating of the line display. Bails out\n // (returning false) when there is nothing to be done and forced is\n // false.\n function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }\n\n function postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true;; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null)\n { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)\n { break }\n } else if (first) {\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n }\n if (!updateDisplayIfNeeded(cm, update)) { break }\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.force = false;\n }\n\n update.signal(cm, \"update\", cm);\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;\n }\n }\n\n function updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n }\n\n // Sync the actual display DOM structure with display.view, removing\n // nodes for lines that are no longer in view, and creating the ones\n // that are not there yet, and updating the ones that are out of\n // date.\n function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n }\n\n function updateGutterSpace(display) {\n var width = display.gutters.offsetWidth;\n display.sizer.style.marginLeft = width + \"px\";\n }\n\n function setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n }\n\n // Re-align line numbers and gutter marks to compensate for\n // horizontal scrolling.\n function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }\n\n // Used to ensure that the line number gutter is still the right\n // size for the current document size. Returns true when an update\n // is needed.\n function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }\n\n function getGutters(gutters, lineNumbers) {\n var result = [], sawLineNumbers = false;\n for (var i = 0; i < gutters.length; i++) {\n var name = gutters[i], style = null;\n if (typeof name != \"string\") { style = name.style; name = name.className; }\n if (name == \"CodeMirror-linenumbers\") {\n if (!lineNumbers) { continue }\n else { sawLineNumbers = true; }\n }\n result.push({className: name, style: style});\n }\n if (lineNumbers && !sawLineNumbers) { result.push({className: \"CodeMirror-linenumbers\", style: null}); }\n return result\n }\n\n // Rebuild the gutter elements, ensure the margin to the left of the\n // code matches their width.\n function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }\n\n function updateGutters(cm) {\n renderGutters(cm.display);\n regChange(cm);\n alignHorizontally(cm);\n }\n\n // The display handles the DOM integration, both for input reading\n // and content drawing. It holds references to DOM nodes and\n // display-related state.\n\n function Display(place, doc, input, options) {\n var d = this;\n this.input = input;\n\n // Covers bottom-right square when both scrollbars are present.\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n // Will contain the actual code, positioned to cover the viewport.\n d.lineDiv = eltP(\"div\", null, \"CodeMirror-code\");\n // Elements are added to these to represent selection and cursors.\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n // A visibility: hidden element used to find the size of things.\n d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n // When lines outside of the viewport are measured, they are drawn in this.\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n // Wraps everything that needs to exist inside the vertically-padded coordinate system\n d.lineSpace = eltP(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n null, \"position: relative; outline: none\");\n var lines = eltP(\"div\", [d.lineSpace], \"CodeMirror-lines\");\n // Moved around its parent to cover visible view.\n d.mover = elt(\"div\", [lines], null, \"position: relative\");\n // Set to the height of the document, allowing scrolling.\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null;\n // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n // Will contain the gutters, if any.\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null;\n // Actual scrollable element.\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\");\n // The element in which the editor lives.\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n\n // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }\n if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }\n\n if (place) {\n if (place.appendChild) { place.appendChild(d.wrapper); }\n else { place(d.wrapper); }\n }\n\n // Current rendered range (may be bigger than the view window).\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first;\n // Information about the rendered lines.\n d.view = [];\n d.renderedView = null;\n // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n d.externalMeasured = null;\n // Empty space (in pixels) above the view\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false;\n\n // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n d.alignWidgets = false;\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false;\n\n // Used for measuring wheel scrolling granularity\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n // True when shift is held down.\n d.shift = false;\n\n // Used to track whether anything happened since the context menu\n // was opened.\n d.selForContextMenu = null;\n\n d.activeTouch = null;\n\n d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);\n renderGutters(d);\n\n input.init(d);\n }\n\n // Since the delta values reported on mouse wheel events are\n // unstandardized between browsers and even browser versions, and\n // generally horribly unpredictable, this code starts by measuring\n // the scroll effect that the first few mouse wheel events have,\n // and, from that, detects the way it can convert deltas to pixel\n // offsets afterwards.\n //\n // The reason we want to know the amount a wheel event will scroll\n // is that it gives us a chance to update the display before the\n // actual scrolling happens, reducing flickering.\n\n var wheelSamples = 0, wheelPixelsPerUnit = null;\n // Fill in a browser-detected starting value on browsers where we\n // know one. These don't have to be accurate -- the result of them\n // being wrong would just be a slight flicker on the first wheel\n // scroll (if it is large enough).\n if (ie) { wheelPixelsPerUnit = -.53; }\n else if (gecko) { wheelPixelsPerUnit = 15; }\n else if (chrome) { wheelPixelsPerUnit = -.7; }\n else if (safari) { wheelPixelsPerUnit = -1/3; }\n\n function wheelEventDelta(e) {\n var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }\n else if (dy == null) { dy = e.wheelDelta; }\n return {x: dx, y: dy}\n }\n function wheelEventPixels(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta\n }\n\n function onScrollWheel(cm, e) {\n var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n\n var display = cm.display, scroll = display.scroller;\n // Quit if there's nothing to scroll here\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n if (!(dx && canScrollX || dy && canScrollY)) { return }\n\n // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer\n }\n }\n }\n }\n\n // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n if (dy && canScrollY)\n { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }\n setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));\n // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n if (!dy || (dy && canScrollY))\n { e_preventDefault(e); }\n display.wheelStartX = null; // Abort measurement, if in progress\n return\n }\n\n // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n if (dy && wheelPixelsPerUnit != null) {\n var pixels = dy * wheelPixelsPerUnit;\n var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n if (pixels < 0) { top = Math.max(0, top + pixels - 50); }\n else { bot = Math.min(cm.doc.height, bot + pixels + 50); }\n updateDisplaySimple(cm, {top: top, bottom: bot});\n }\n\n if (wheelSamples < 20) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx; display.wheelDY = dy;\n setTimeout(function () {\n if (display.wheelStartX == null) { return }\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n (movedX && display.wheelDX && movedX / display.wheelDX);\n display.wheelStartX = display.wheelStartY = null;\n if (!sample) { return }\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx; display.wheelDY += dy;\n }\n }\n }\n\n // Selection objects are immutable. A new one is created every time\n // the selection changes. A selection is one or more non-overlapping\n // (and non-touching) ranges, sorted, and an integer that indicates\n // which one is the primary selection (the one that's scrolled into\n // view, that getCursor returns, etc).\n var Selection = function(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n };\n\n Selection.prototype.primary = function () { return this.ranges[this.primIndex] };\n\n Selection.prototype.equals = function (other) {\n if (other == this) { return true }\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this.ranges[i], there = other.ranges[i];\n if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }\n }\n return true\n };\n\n Selection.prototype.deepCopy = function () {\n var out = [];\n for (var i = 0; i < this.ranges.length; i++)\n { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }\n return new Selection(out, this.primIndex)\n };\n\n Selection.prototype.somethingSelected = function () {\n for (var i = 0; i < this.ranges.length; i++)\n { if (!this.ranges[i].empty()) { return true } }\n return false\n };\n\n Selection.prototype.contains = function (pos, end) {\n if (!end) { end = pos; }\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this.ranges[i];\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)\n { return i }\n }\n return -1\n };\n\n var Range = function(anchor, head) {\n this.anchor = anchor; this.head = head;\n };\n\n Range.prototype.from = function () { return minPos(this.anchor, this.head) };\n Range.prototype.to = function () { return maxPos(this.anchor, this.head) };\n Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };\n\n // Take an unsorted, potentially overlapping set of ranges, and\n // build a selection out of it. 'Consumes' ranges array (modifying\n // it).\n function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }\n\n function simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0)\n }\n\n // Compute the position of the end of a change (its 'to' property\n // refers to the pre-change end).\n function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }\n\n // Adjust a position to refer to the post-change position of the\n // same text, or the end of the change if the change covers it.\n function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }\n\n function computeSelAfterChange(doc, change) {\n var out = [];\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change),\n adjustForChange(range.head, change)));\n }\n return normalizeSelection(doc.cm, out, doc.sel.primIndex)\n }\n\n function offsetPos(pos, old, nw) {\n if (pos.line == old.line)\n { return Pos(nw.line, pos.ch - old.ch + nw.ch) }\n else\n { return Pos(nw.line + (pos.line - old.line), pos.ch) }\n }\n\n // Used by replaceSelections to allow moving the selection to the\n // start or around the replaced test. Hint may be \"start\" or \"around\".\n function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex)\n }\n\n // Used to get the editor into a consistent state again when options change.\n\n function loadMode(cm) {\n cm.doc.mode = getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n }\n\n function resetModeState(cm) {\n cm.doc.iter(function (line) {\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n });\n cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n if (cm.curOp) { regChange(cm); }\n }\n\n // DOCUMENT DATA STRUCTURE\n\n // By default, updates that start and end at the beginning of a line\n // are treated specially, in order to make the association of line\n // widgets and marker elements with the text behave more intuitive.\n function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }\n\n // Perform a change on the document data structure.\n function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }\n\n // Call f for all linked documents.\n function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n }\n\n // Attach a document to an editor.\n function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }\n\n function setDirectionClass(cm) {\n (cm.doc.direction == \"rtl\" ? addClass : rmClass)(cm.display.lineDiv, \"CodeMirror-rtl\");\n }\n\n function directionChanged(cm) {\n runInOp(cm, function () {\n setDirectionClass(cm);\n regChange(cm);\n });\n }\n\n function History(startGen) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = []; this.undone = [];\n this.undoDepth = Infinity;\n // Used to track when changes can be merged into a single undo\n // event\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null;\n // Used by the isClean() method\n this.generation = this.maxGeneration = startGen || 1;\n }\n\n // Create a history change event from an updateDoc-style change\n // object.\n function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }\n\n // Pop all selection events off the end of a history array. Stop at\n // a change event.\n function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n }\n\n // Find the top change event in the history. Pop off selection\n // events that are in the way.\n function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }\n\n // Register a change in the history. Merges changes that are within\n // a single operation, or are close together with an origin that\n // allows merging (starting with \"+\") into a single event.\n function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n }\n\n function selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" ||\n ch == \"+\" &&\n prev.ranges.length == sel.ranges.length &&\n prev.somethingSelected() == sel.somethingSelected() &&\n new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)\n }\n\n // Called whenever the selection changes, sets the new selection as\n // the pending selection in the history, and pushes the old pending\n // selection into the 'done' array when it was significantly\n // different (in number of selected ranges, emptiness, or time).\n function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }\n\n function pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n if (!(top && top.ranges && top.equals(sel)))\n { dest.push(sel); }\n }\n\n // Used to store marked span information in the history.\n function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }\n\n // When un/re-doing restores text containing marked spans, those\n // that have been explicitly cleared should not be restored.\n function removeClearedSpans(spans) {\n if (!spans) { return null }\n var out;\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }\n else if (out) { out.push(spans[i]); }\n }\n return !out ? spans : out.length ? out : null\n }\n\n // Retrieve and filter the old marked spans stored in a change event.\n function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }\n\n // Used for un/re-doing changes from the history. Combines the\n // result of computing the existing spans with the set of spans that\n // existed in the history (so that deleting around a span and then\n // undoing brings back the span).\n function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n if (!old) { return stretched }\n if (!stretched) { return old }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i], stretchCur = stretched[i];\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n for (var k = 0; k < oldCur.length; ++k)\n { if (oldCur[k].marker == span.marker) { continue spans } }\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n return old\n }\n\n // Used both to provide a JSON-safe object in .getHistory, and, when\n // detaching a document, to split the history in two\n function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m = (void 0);\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n } } }\n }\n }\n return copy\n }\n\n // The 'scroll' parameter given to many of these indicated whether\n // the new cursor position should be scrolled into view after\n // modifying the selection.\n\n // If shift is held or the extend flag is set, extends a range to\n // include a given position (and optionally a second position).\n // Otherwise, simply returns the range between the given positions.\n // Used for cursor motion and such.\n function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }\n\n // Extend the primary selection range, discard the rest.\n function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }\n\n // Extend all selections (pos is an array of selections with length\n // equal the number of selections)\n function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }\n\n // Updates a single range in the selection.\n function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }\n\n // Reset the selection to a single range.\n function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }\n\n // Give beforeSelectionChange handlers a change to influence a\n // selection update.\n function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }\n\n function setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done, last = lst(done);\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n }\n\n // Set a new selection.\n function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n }\n\n function setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n { sel = filterSelectionChange(doc, sel, options); }\n\n var bias = options && options.bias ||\n (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption(\"readOnly\") != \"nocursor\")\n { ensureCursorVisible(doc.cm); }\n }\n\n function setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) { return }\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = 1;\n doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n signalLater(doc, \"cursorActivity\", doc);\n }\n\n // Verify that the selection does not partially select any atomic\n // marked ranges.\n function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n }\n\n // Return a selection that does not partially select any atomic\n // ranges.\n function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }\n\n function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i], m = sp.marker;\n\n // Determine if we should prevent the cursor being placed to the left/right of an atomic marker\n // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it\n // is with selectLeft/Right\n var preventCursorLeft = (\"selectLeft\" in m) ? !m.selectLeft : m.inclusiveLeft;\n var preventCursorRight = (\"selectRight\" in m) ? !m.selectRight : m.inclusiveRight;\n\n if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n if (m.explicitlyCleared) {\n if (!line.markedSpans) { break }\n else {--i; continue}\n }\n }\n if (!m.atomic) { continue }\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);\n if (dir < 0 ? preventCursorRight : preventCursorLeft)\n { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))\n { return skipAtomicInner(doc, near, pos, dir, mayClear) }\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n if (dir < 0 ? preventCursorLeft : preventCursorRight)\n { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null\n }\n } }\n return pos\n }\n\n // Ensure a given position is not inside an atomic range.\n function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0)\n }\n return found\n }\n\n function movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }\n else { return null }\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }\n else { return null }\n } else {\n return new Pos(pos.line, pos.ch + dir)\n }\n }\n\n function selectAll(cm) {\n cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);\n }\n\n // UPDATING\n\n // Allow \"beforeChange\" event handlers to influence a change\n function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }\n\n // Apply a change to a document, and add it to the document's\n // history, and propagating it to all linked documents.\n function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n if (doc.cm.state.suppressEdits) { return }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) { return }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text, origin: change.origin}); }\n } else {\n makeChangeInner(doc, change);\n }\n }\n\n function makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) { return }\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n }\n\n // Revert a change stored in a document's history.\n function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !allowSelectionOnly) { return }\n\n var hist = doc.history, event, selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n var i = 0;\n for (; i < source.length; i++) {\n event = source[i];\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n { break }\n }\n if (i == source.length) { return }\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (;;) {\n event = source.pop();\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false});\n return\n }\n selAfter = event;\n } else if (suppress) {\n source.push(event);\n return\n } else { break }\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({changes: antiChanges, generation: hist.generation});\n hist.generation = event.generation || ++hist.maxGeneration;\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n var loop = function ( i ) {\n var change = event.changes[i];\n change.origin = type;\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return {}\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }\n var rebased = [];\n\n // Propagate to the linked documents\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop( i$1 );\n\n if ( returned ) return returned.v;\n }\n }\n\n // Sub-views need their line numbers shifted when text is added\n // above or below them in the parent document.\n function shiftDoc(doc, distance) {\n if (distance == 0) { return }\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(\n Pos(range.anchor.line + distance, range.anchor.ch),\n Pos(range.head.line + distance, range.head.ch)\n ); }), doc.sel.primIndex);\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)\n { regLineChange(doc.cm, l, \"gutter\"); }\n }\n }\n\n // More lower-level change function, handling only a single document\n // (not linked ones).\n function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }\n\n // Handle the interaction of a change to a document with the editor\n // that this document is part of.\n function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n }\n\n function replaceRange(doc, code, from, to, origin) {\n var assign;\n\n if (!to) { to = from; }\n if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }\n if (typeof code == \"string\") { code = doc.splitLines(code); }\n makeChange(doc, {from: from, to: to, text: code, origin: origin});\n }\n\n // Rebasing/resetting history to deal with externally-sourced changes\n\n function rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n }\n\n // Tries to rebase an array of history events given a change in the\n // document. If the change touches the same lines as the event, the\n // event, and everything 'behind' it, is discarded. If the change is\n // before the event, the event's positions are updated. Uses a\n // copy-on-write scheme for the positions, to avoid having to\n // reallocate them all on every rebase, but also avoid problems with\n // shared position objects being unsafely updated.\n function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }\n\n function rebaseHist(hist, change) {\n var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n }\n\n // Utility for applying a change to a line by handle or number,\n // returning the number and optionally registering the line as\n // changed.\n function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }\n\n // The document is represented as a BTree consisting of leaves, with\n // chunk of lines in them, and branches, with up to ten leaves or\n // other branch nodes below them. The top node is always a branch\n // node, and is the document object itself (meaning it has\n // additional methods and properties).\n //\n // All nodes have parent links. The tree is used both to go from\n // line numbers to line objects, and to go from objects to numbers.\n // It also indexes by height, and is used to convert between height\n // and line object, and to find the total height of the document.\n //\n // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }\n\n LeafChunk.prototype = {\n chunkSize: function() { return this.lines.length },\n\n // Remove the n lines at offset 'at'.\n removeInner: function(at, n) {\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this.lines[i];\n this.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n this.lines.splice(at, n);\n },\n\n // Helper used to collapse a small branch into a single leaf.\n collapse: function(lines) {\n lines.push.apply(lines, this.lines);\n },\n\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function(at, lines, height) {\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }\n },\n\n // Used to iterate over a part of the tree.\n iterN: function(at, n, op) {\n for (var e = at + n; at < e; ++at)\n { if (op(this.lines[at])) { return true } }\n }\n };\n\n function BranchChunk(children) {\n this.children = children;\n var size = 0, height = 0;\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize(); height += ch.height;\n ch.parent = this;\n }\n this.size = size;\n this.height = height;\n this.parent = null;\n }\n\n BranchChunk.prototype = {\n chunkSize: function() { return this.size },\n\n removeInner: function(at, n) {\n this.size -= n;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var rm = Math.min(n, sz - at), oldHeight = child.height;\n child.removeInner(at, rm);\n this.height -= oldHeight - child.height;\n if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }\n if ((n -= rm) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n if (this.size - n < 25 &&\n (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n\n collapse: function(lines) {\n for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }\n },\n\n insertInner: function(at, lines, height) {\n this.size += lines.length;\n this.height += height;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at <= sz) {\n child.insertInner(at, lines, height);\n if (child.lines && child.lines.length > 50) {\n // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n var remaining = child.lines.length % 25 + 25;\n for (var pos = remaining; pos < child.lines.length;) {\n var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n child.height -= leaf.height;\n this.children.splice(++i, 0, leaf);\n leaf.parent = this;\n }\n child.lines = child.lines.slice(0, remaining);\n this.maybeSpill();\n }\n break\n }\n at -= sz;\n }\n },\n\n // When a node has grown, check whether it should be split.\n maybeSpill: function() {\n if (this.children.length <= 10) { return }\n var me = this;\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n if (!me.parent) { // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n sibling.parent = me.parent;\n } while (me.children.length > 10)\n me.parent.maybeSpill();\n },\n\n iterN: function(at, n, op) {\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var used = Math.min(n, sz - at);\n if (child.iterN(at, used, op)) { return true }\n if ((n -= used) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n }\n };\n\n // Line widgets are block elements displayed above or below a line.\n\n var LineWidget = function(doc, node, options) {\n if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))\n { this[opt] = options[opt]; } } }\n this.doc = doc;\n this.node = node;\n };\n\n LineWidget.prototype.clear = function () {\n var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n if (no == null || !ws) { return }\n for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }\n if (!ws.length) { line.widgets = null; }\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n if (cm) {\n runInOp(cm, function () {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n signalLater(cm, \"lineWidgetCleared\", cm, this, no);\n }\n };\n\n LineWidget.prototype.changed = function () {\n var this$1 = this;\n\n var oldH = this.height, cm = this.doc.cm, line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n if (!diff) { return }\n if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }\n if (cm) {\n runInOp(cm, function () {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n signalLater(cm, \"lineWidgetChanged\", cm, this$1, lineNo(line));\n });\n }\n };\n eventMixin(LineWidget);\n\n function adjustScrollWhenAboveVisible(cm, line, diff) {\n if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))\n { addToScrollTop(cm, diff); }\n }\n\n function addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }\n changeLine(doc, handle, \"widget\", function (line) {\n var widgets = line.widgets || (line.widgets = []);\n if (widget.insertAt == null) { widgets.push(widget); }\n else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); }\n widget.line = line;\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n if (aboveVisible) { addToScrollTop(cm, widget.height); }\n cm.curOp.forceUpdate = true;\n }\n return true\n });\n if (cm) { signalLater(cm, \"lineWidgetAdded\", cm, widget, typeof handle == \"number\" ? handle : lineNo(handle)); }\n return widget\n }\n\n // TEXTMARKERS\n\n // Created with markText and setBookmark methods. A TextMarker is a\n // handle that can be used to clear or find a marked position in the\n // document. Line objects hold arrays (markedSpans) containing\n // {from, to, marker} object pointing to such marker objects, and\n // indicating that such a marker is present on that line. Multiple\n // lines may point to the same marker when it spans across lines.\n // The spans will have null for their from/to properties when the\n // marker continues beyond the start/end of the line. Markers have\n // links back to the lines they currently touch.\n\n // Collapsed markers have unique ids, in order to be able to order\n // them, which is needed for uniquely determining an outer marker\n // when they overlap (they may nest, but not partially overlap).\n var nextMarkerId = 0;\n\n var TextMarker = function(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n };\n\n // Clear the marker.\n TextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) { return }\n var cm = this.doc.cm, withOp = cm && !cm.curOp;\n if (withOp) { startOperation(cm); }\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n if (found) { signalLater(this, \"clear\", found.from, found.to); }\n }\n var min = null, max = null;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), \"text\"); }\n else if (cm) {\n if (span.to != null) { max = lineNo(line); }\n if (span.from != null) { min = lineNo(line); }\n }\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)\n { updateLineHeight(line, textHeight(cm.display)); }\n }\n if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {\n var visual = visualLine(this.lines[i$1]), len = lineLength(visual);\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n } }\n\n if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }\n this.lines.length = 0;\n this.explicitlyCleared = true;\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n if (cm) { reCheckSelection(cm.doc); }\n }\n if (cm) { signalLater(cm, \"markerCleared\", cm, this, min, max); }\n if (withOp) { endOperation(cm); }\n if (this.parent) { this.parent.clear(); }\n };\n\n // Find the position of the marker in the document. Returns a {from,\n // to} object by default. Side can be passed to get a specific side\n // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n // Pos objects returned contain a line object, rather than a line\n // number (used to prevent looking up the same line twice).\n TextMarker.prototype.find = function (side, lineObj) {\n if (side == null && this.type == \"bookmark\") { side = 1; }\n var from, to;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n if (side == -1) { return from }\n }\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n if (side == 1) { return to }\n }\n }\n return from && {from: from, to: to}\n };\n\n // Signals that the marker's widget changed, and surrounding layout\n // should be recomputed.\n TextMarker.prototype.changed = function () {\n var this$1 = this;\n\n var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n if (!pos || !cm) { return }\n runInOp(cm, function () {\n var line = pos.line, lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n cm.curOp.updateMaxLine = true;\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n if (dHeight)\n { updateLineHeight(line, line.height + dHeight); }\n }\n signalLater(cm, \"markerChanged\", cm, this$1);\n });\n };\n\n TextMarker.prototype.attachLine = function (line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)\n { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }\n }\n this.lines.push(line);\n };\n\n TextMarker.prototype.detachLine = function (line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp\n ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n };\n eventMixin(TextMarker);\n\n // Create a marker, wire it up to the right lines, and\n function markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) { return markTextShared(doc, from, to, options, type) }\n // Ensure we are in an operation.\n if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }\n\n var marker = new TextMarker(doc, type), diff = cmp(from, to);\n if (options) { copyObj(options, marker, false); }\n // Don't connect empty markers unless clearWhenEmpty is false\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)\n { return marker }\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = eltP(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n if (!options.handleMouseEvents) { marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\"); }\n if (options.insertLeft) { marker.widgetNode.insertLeft = true; }\n }\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n { throw new Error(\"Inserting collapsed marker partially overlapping an existing one\") }\n seeCollapsedSpans();\n }\n\n if (marker.addToHistory)\n { addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN); }\n\n var curLine = from.line, cm = doc.cm, updateMaxLine;\n doc.iter(curLine, to.line + 1, function (line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)\n { updateMaxLine = true; }\n if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }\n addMarkedSpan(line, new MarkedSpan(marker,\n curLine == from.line ? from.ch : null,\n curLine == to.line ? to.ch : null));\n ++curLine;\n });\n // lineIsHidden depends on the presence of the spans, so needs a second pass\n if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {\n if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }\n }); }\n\n if (marker.clearOnEnter) { on(marker, \"beforeCursorEnter\", function () { return marker.clear(); }); }\n\n if (marker.readOnly) {\n seeReadOnlySpans();\n if (doc.history.done.length || doc.history.undone.length)\n { doc.clearHistory(); }\n }\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n if (cm) {\n // Sync editor state\n if (updateMaxLine) { cm.curOp.updateMaxLine = true; }\n if (marker.collapsed)\n { regChange(cm, from.line, to.line + 1); }\n else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||\n marker.attributes || marker.title)\n { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, \"text\"); } }\n if (marker.atomic) { reCheckSelection(cm.doc); }\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n return marker\n }\n\n // SHARED TEXTMARKERS\n\n // A shared marker spans multiple linked documents. It is\n // implemented as a meta-marker-object controlling multiple normal\n // markers.\n var SharedTextMarker = function(markers, primary) {\n this.markers = markers;\n this.primary = primary;\n for (var i = 0; i < markers.length; ++i)\n { markers[i].parent = this; }\n };\n\n SharedTextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) { return }\n this.explicitlyCleared = true;\n for (var i = 0; i < this.markers.length; ++i)\n { this.markers[i].clear(); }\n signalLater(this, \"clear\");\n };\n\n SharedTextMarker.prototype.find = function (side, lineObj) {\n return this.primary.find(side, lineObj)\n };\n eventMixin(SharedTextMarker);\n\n function markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function (doc) {\n if (widget) { options.widgetNode = widget.cloneNode(true); }\n markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n for (var i = 0; i < doc.linked.length; ++i)\n { if (doc.linked[i].isParent) { return } }\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary)\n }\n\n function findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })\n }\n\n function copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], pos = marker.find();\n var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n if (cmp(mFrom, mTo)) {\n var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n }\n\n function detachSharedMarkers(markers) {\n var loop = function ( i ) {\n var marker = markers[i], linked = [marker.primary.doc];\n linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n };\n\n for (var i = 0; i < markers.length; i++) loop( i );\n }\n\n var nextDocId = 0;\n var Doc = function(text, mode, firstLine, lineSep, direction) {\n if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }\n if (firstLine == null) { firstLine = 0; }\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.modeFrontier = this.highlightFrontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.direction = (direction == \"rtl\") ? \"rtl\" : \"ltr\";\n this.extend = false;\n\n if (typeof text == \"string\") { text = this.splitLines(text); }\n updateDoc(this, {from: start, to: start, text: text});\n setSelection(this, simpleSelection(start), sel_dontScroll);\n };\n\n Doc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function(from, to, op) {\n if (op) { this.iterN(from - this.first, to - from, op); }\n else { this.iterN(this.first, this.first + this.size, from); }\n },\n\n // Non-public interface for adding and removing lines.\n insert: function(at, lines) {\n var height = 0;\n for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }\n this.insertInner(at - this.first, lines, height);\n },\n remove: function(at, n) { this.removeInner(at - this.first, n); },\n\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n\n getValue: function(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n setValue: docMethodOp(function(code) {\n var top = Pos(this.first, 0), last = this.first + this.size - 1;\n makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code), origin: \"setValue\", full: true}, true);\n if (this.cm) { scrollToCoords(this.cm, 0, 0); }\n setSelection(this, simpleSelection(top), sel_dontScroll);\n }),\n replaceRange: function(code, from, to, origin) {\n from = clipPos(this, from);\n to = to ? clipPos(this, to) : from;\n replaceRange(this, code, from, to, origin);\n },\n getRange: function(from, to, lineSep) {\n var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n\n getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},\n\n getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},\n getLineNumber: function(line) {return lineNo(line)},\n\n getLineHandleVisualStart: function(line) {\n if (typeof line == \"number\") { line = getLine(this, line); }\n return visualLine(line)\n },\n\n lineCount: function() {return this.size},\n firstLine: function() {return this.first},\n lastLine: function() {return this.first + this.size - 1},\n\n clipPos: function(pos) {return clipPos(this, pos)},\n\n getCursor: function(start) {\n var range = this.sel.primary(), pos;\n if (start == null || start == \"head\") { pos = range.head; }\n else if (start == \"anchor\") { pos = range.anchor; }\n else if (start == \"end\" || start == \"to\" || start === false) { pos = range.to(); }\n else { pos = range.from(); }\n return pos\n },\n listSelections: function() { return this.sel.ranges },\n somethingSelected: function() {return this.sel.somethingSelected()},\n\n setCursor: docMethodOp(function(line, ch, options) {\n setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function(anchor, head, options) {\n setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function(head, other, options) {\n extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function(heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function(f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function(ranges, primary, options) {\n if (!ranges.length) { return }\n var out = [];\n for (var i = 0; i < ranges.length; i++)\n { out[i] = new Range(clipPos(this, ranges[i].anchor),\n clipPos(this, ranges[i].head)); }\n if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }\n setSelection(this, normalizeSelection(this.cm, out, primary), options);\n }),\n addSelection: docMethodOp(function(anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);\n }),\n\n getSelection: function(lineSep) {\n var ranges = this.sel.ranges, lines;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n if (lineSep === false) { return lines }\n else { return lines.join(lineSep || this.lineSeparator()) }\n },\n getSelections: function(lineSep) {\n var parts = [], ranges = this.sel.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }\n parts[i] = sel;\n }\n return parts\n },\n replaceSelection: function(code, collapse, origin) {\n var dup = [];\n for (var i = 0; i < this.sel.ranges.length; i++)\n { dup[i] = code; }\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function(code, collapse, origin) {\n var changes = [], sel = this.sel;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};\n }\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)\n { makeChange(this, changes[i$1]); }\n if (newSel) { setSelectionReplaceHistory(this, newSel); }\n else if (this.cm) { ensureCursorVisible(this.cm); }\n }),\n undo: docMethodOp(function() {makeChangeFromHistory(this, \"undo\");}),\n redo: docMethodOp(function() {makeChangeFromHistory(this, \"redo\");}),\n undoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"undo\", true);}),\n redoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"redo\", true);}),\n\n setExtending: function(val) {this.extend = val;},\n getExtending: function() {return this.extend},\n\n historySize: function() {\n var hist = this.history, done = 0, undone = 0;\n for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }\n for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }\n return {undo: done, redo: undone}\n },\n clearHistory: function() {\n var this$1 = this;\n\n this.history = new History(this.history.maxGeneration);\n linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);\n },\n\n markClean: function() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function(forceSplit) {\n if (forceSplit)\n { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }\n return this.history.generation\n },\n isClean: function (gen) {\n return this.history.generation == (gen || this.cleanGeneration)\n },\n\n getHistory: function() {\n return {done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)}\n },\n setHistory: function(histData) {\n var hist = this.history = new History(this.history.maxGeneration);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n\n setGutterMarker: docMethodOp(function(line, gutterID, value) {\n return changeLine(this, line, \"gutter\", function (line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n if (!value && isEmpty(markers)) { line.gutterMarkers = null; }\n return true\n })\n }),\n\n clearGutter: docMethodOp(function(gutterID) {\n var this$1 = this;\n\n this.iter(function (line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n changeLine(this$1, line, \"gutter\", function () {\n line.gutterMarkers[gutterID] = null;\n if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }\n return true\n });\n }\n });\n }),\n\n lineInfo: function(line) {\n var n;\n if (typeof line == \"number\") {\n if (!isLine(this, line)) { return null }\n n = line;\n line = getLine(this, line);\n if (!line) { return null }\n } else {\n n = lineNo(line);\n if (n == null) { return null }\n }\n return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n widgets: line.widgets}\n },\n\n addLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n if (!line[prop]) { line[prop] = cls; }\n else if (classTest(cls).test(line[prop])) { return false }\n else { line[prop] += \" \" + cls; }\n return true\n })\n }),\n removeLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n if (!cur) { return false }\n else if (cls == null) { line[prop] = null; }\n else {\n var found = cur.match(classTest(cls));\n if (!found) { return false }\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n return true\n })\n }),\n\n addLineWidget: docMethodOp(function(handle, node, options) {\n return addLineWidget(this, handle, node, options)\n }),\n removeLineWidget: function(widget) { widget.clear(); },\n\n markText: function(from, to, options) {\n return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\")\n },\n setBookmark: function(pos, options) {\n var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false, shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents};\n pos = clipPos(this, pos);\n return markText(this, pos, pos, realOpts, \"bookmark\")\n },\n findMarksAt: function(pos) {\n pos = clipPos(this, pos);\n var markers = [], spans = getLine(this, pos.line).markedSpans;\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if ((span.from == null || span.from <= pos.ch) &&\n (span.to == null || span.to >= pos.ch))\n { markers.push(span.marker.parent || span.marker); }\n } }\n return markers\n },\n findMarks: function(from, to, filter) {\n from = clipPos(this, from); to = clipPos(this, to);\n var found = [], lineNo = from.line;\n this.iter(from.line, to.line + 1, function (line) {\n var spans = line.markedSpans;\n if (spans) { for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||\n span.from == null && lineNo != from.line ||\n span.from != null && lineNo == to.line && span.from >= to.ch) &&\n (!filter || filter(span.marker)))\n { found.push(span.marker.parent || span.marker); }\n } }\n ++lineNo;\n });\n return found\n },\n getAllMarks: function() {\n var markers = [];\n this.iter(function (line) {\n var sps = line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i)\n { if (sps[i].from != null) { markers.push(sps[i].marker); } } }\n });\n return markers\n },\n\n posFromIndex: function(off) {\n var ch, lineNo = this.first, sepSize = this.lineSeparator().length;\n this.iter(function (line) {\n var sz = line.text.length + sepSize;\n if (sz > off) { ch = off; return true }\n off -= sz;\n ++lineNo;\n });\n return clipPos(this, Pos(lineNo, ch))\n },\n indexFromPos: function (coords) {\n coords = clipPos(this, coords);\n var index = coords.ch;\n if (coords.line < this.first || coords.ch < 0) { return 0 }\n var sepSize = this.lineSeparator().length;\n this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value\n index += line.text.length + sepSize;\n });\n return index\n },\n\n copy: function(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size),\n this.modeOption, this.first, this.lineSep, this.direction);\n doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n return doc\n },\n\n linkedDoc: function(options) {\n if (!options) { options = {}; }\n var from = this.first, to = this.first + this.size;\n if (options.from != null && options.from > from) { from = options.from; }\n if (options.to != null && options.to < to) { to = options.to; }\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);\n if (options.sharedHist) { copy.history = this.history\n ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy\n },\n unlinkDoc: function(other) {\n if (other instanceof CodeMirror) { other = other.doc; }\n if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {\n var link = this.linked[i];\n if (link.doc != other) { continue }\n this.linked.splice(i, 1);\n other.unlinkDoc(this);\n detachSharedMarkers(findSharedMarkers(this));\n break\n } }\n // If the histories were shared, split them again\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function(f) {linkedDocs(this, f);},\n\n getMode: function() {return this.mode},\n getEditor: function() {return this.cm},\n\n splitLines: function(str) {\n if (this.lineSep) { return str.split(this.lineSep) }\n return splitLinesAuto(str)\n },\n lineSeparator: function() { return this.lineSep || \"\\n\" },\n\n setDirection: docMethodOp(function (dir) {\n if (dir != \"rtl\") { dir = \"ltr\"; }\n if (dir == this.direction) { return }\n this.direction = dir;\n this.iter(function (line) { return line.order = null; });\n if (this.cm) { directionChanged(this.cm); }\n })\n });\n\n // Public alias.\n Doc.prototype.eachLine = Doc.prototype.iter;\n\n // Kludge to work around strange IE behavior where it'll sometimes\n // re-fire a series of drag-related events right after the drop (#1551)\n var lastDrop = 0;\n\n function onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))\n { return }\n e_preventDefault(e);\n if (ie) { lastDrop = +new Date; }\n var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n if (!pos || cm.isReadOnly()) { return }\n // Might be a file drop, in which case we simply extract the text\n // and insert it.\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length, text = Array(n), read = 0;\n var markAsReadAndPasteIfAllFilesAreRead = function () {\n if (++read == n) {\n operation(cm, function () {\n pos = clipPos(cm.doc, pos);\n var change = {from: pos, to: pos,\n text: cm.doc.splitLines(\n text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),\n origin: \"paste\"};\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));\n })();\n }\n };\n var readTextFromFile = function (file, i) {\n if (cm.options.allowDropFileTypes &&\n indexOf(cm.options.allowDropFileTypes, file.type) == -1) {\n markAsReadAndPasteIfAllFilesAreRead();\n return\n }\n var reader = new FileReader;\n reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };\n reader.onload = function () {\n var content = reader.result;\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) {\n markAsReadAndPasteIfAllFilesAreRead();\n return\n }\n text[i] = content;\n markAsReadAndPasteIfAllFilesAreRead();\n };\n reader.readAsText(file);\n };\n for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }\n } else { // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e);\n // Ensure the editor is re-focused\n setTimeout(function () { return cm.display.input.focus(); }, 20);\n return\n }\n try {\n var text$1 = e.dataTransfer.getData(\"Text\");\n if (text$1) {\n var selected;\n if (cm.state.draggingText && !cm.state.draggingText.copy)\n { selected = cm.listSelections(); }\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)\n { replaceRange(cm.doc, \"\", selected[i$1].anchor, selected[i$1].head, \"drag\"); } }\n cm.replaceSelection(text$1, \"around\", \"paste\");\n cm.display.input.focus();\n }\n }\n catch(e$1){}\n }\n }\n\n function onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n e.dataTransfer.effectAllowed = \"copyMove\";\n\n // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img);\n // Force a relayout, or Opera won't use our image for some obscure reason\n img._top = img.offsetTop;\n }\n e.dataTransfer.setDragImage(img, 0, 0);\n if (presto) { img.parentNode.removeChild(img); }\n }\n }\n\n function onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n if (!pos) { return }\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n }\n\n function clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n }\n\n // These must be handled carefully, because naively registering a\n // handler for each editor will cause the editors to never be\n // garbage collected.\n\n function forEachCodeMirror(f) {\n if (!document.getElementsByClassName) { return }\n var byClass = document.getElementsByClassName(\"CodeMirror\"), editors = [];\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n if (cm) { editors.push(cm); }\n }\n if (editors.length) { editors[0].operation(function () {\n for (var i = 0; i < editors.length; i++) { f(editors[i]); }\n }); }\n }\n\n var globalsRegistered = false;\n function ensureGlobalHandlers() {\n if (globalsRegistered) { return }\n registerGlobalHandlers();\n globalsRegistered = true;\n }\n function registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function () {\n if (resizeTimer == null) { resizeTimer = setTimeout(function () {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100); }\n });\n // When the window loses focus, we want to show the editor as blurred\n on(window, \"blur\", function () { return forEachCodeMirror(onBlur); });\n }\n // Called when the window resizes\n function onResize(cm) {\n var d = cm.display;\n // Might be a text scaling operation, clear size caches.\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n }\n\n var keyNames = {\n 3: \"Pause\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n 19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n 36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n 46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n 106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 145: \"ScrollLock\",\n 173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n 221: \"]\", 222: \"'\", 224: \"Mod\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n 63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n };\n\n // Number keys\n for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }\n // Alphabetic keys\n for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }\n // Function keys\n for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = \"F\" + i$2; }\n\n var keyMap = {};\n\n keyMap.basic = {\n \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n };\n // Note that the save and find-related commands aren't defined by\n // default. User code or addons can define them. Unknown commands\n // are simply ignored.\n keyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n \"fallthrough\": \"basic\"\n };\n // Very basic readline/emacs-style bindings, which are standard on Mac.\n keyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n \"Alt-F\": \"goWordRight\", \"Alt-B\": \"goWordLeft\", \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\", \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\",\n \"Alt-D\": \"delWordAfter\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\", \"Ctrl-T\": \"transposeChars\",\n \"Ctrl-O\": \"openLine\"\n };\n keyMap.macDefault = {\n \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n \"fallthrough\": [\"basic\", \"emacsy\"]\n };\n keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n // KEYMAP DISPATCH\n\n function normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/);\n name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }\n else if (/^a(lt)?$/i.test(mod)) { alt = true; }\n else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }\n else if (/^s(hift)?$/i.test(mod)) { shift = true; }\n else { throw new Error(\"Unrecognized modifier name: \" + mod) }\n }\n if (alt) { name = \"Alt-\" + name; }\n if (ctrl) { name = \"Ctrl-\" + name; }\n if (cmd) { name = \"Cmd-\" + name; }\n if (shift) { name = \"Shift-\" + name; }\n return name\n }\n\n // This is a kludge to keep keymaps mostly working as raw objects\n // (backwards compatibility) while at the same time support features\n // like normalization and multi-stroke key bindings. It compiles a\n // new normalized keymap, and then updates the old object to reflect\n // this.\n function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n }\n\n function lookupKey(key, map, handle, context) {\n map = getKeyMap(map);\n var found = map.call ? map.call(key, context) : map[key];\n if (found === false) { return \"nothing\" }\n if (found === \"...\") { return \"multi\" }\n if (found != null && handle(found)) { return \"handled\" }\n\n if (map.fallthrough) {\n if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\")\n { return lookupKey(key, map.fallthrough, handle, context) }\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle, context);\n if (result) { return result }\n }\n }\n }\n\n // Modifier key presses don't count as 'real' key presses for the\n // purpose of keymap fallthrough.\n function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n }\n\n function addModifierNames(name, event, noShift) {\n var base = name;\n if (event.altKey && base != \"Alt\") { name = \"Alt-\" + name; }\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") { name = \"Ctrl-\" + name; }\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Mod\") { name = \"Cmd-\" + name; }\n if (!noShift && event.shiftKey && base != \"Shift\") { name = \"Shift-\" + name; }\n return name\n }\n\n // Look up the name of a key as indicated by an event object.\n function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }\n\n function getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val\n }\n\n // Helper for deleting text near the selection(s), used to implement\n // backspace, delete, and similar functionality.\n function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n }\n\n function moveCharLogically(line, ch, dir) {\n var target = skipExtendingChars(line.text, ch + dir, dir);\n return target < 0 || target > line.text.length ? null : target\n }\n\n function moveLogically(line, start, dir) {\n var ch = moveCharLogically(line, start.ch, dir);\n return ch == null ? null : new Pos(start.line, ch, dir < 0 ? \"after\" : \"before\")\n }\n\n function endOfLine(visually, cm, lineObj, lineNo, dir) {\n if (visually) {\n if (cm.doc.direction == \"rtl\") { dir = -dir; }\n var order = getOrder(lineObj, cm.doc.direction);\n if (order) {\n var part = dir < 0 ? lst(order) : order[0];\n var moveInStorageOrder = (dir < 0) == (part.level == 1);\n var sticky = moveInStorageOrder ? \"after\" : \"before\";\n var ch;\n // With a wrapped rtl chunk (possibly spanning multiple bidi parts),\n // it could be that the last bidi part is not on the last visual line,\n // since visual lines contain content order-consecutive chunks.\n // Thus, in rtl, we are looking for the first (content-order) character\n // in the rtl chunk that is on the last line (that is, the same line\n // as the last (content-order) character).\n if (part.level > 0 || cm.doc.direction == \"rtl\") {\n var prep = prepareMeasureForLine(cm, lineObj);\n ch = dir < 0 ? lineObj.text.length - 1 : 0;\n var targetTop = measureCharPrepared(cm, prep, ch).top;\n ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);\n if (sticky == \"before\") { ch = moveCharLogically(lineObj, ch, 1); }\n } else { ch = dir < 0 ? part.to : part.from; }\n return new Pos(lineNo, ch, sticky)\n }\n }\n return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? \"before\" : \"after\")\n }\n\n function moveVisually(cm, line, start, dir) {\n var bidi = getOrder(line, cm.doc.direction);\n if (!bidi) { return moveLogically(line, start, dir) }\n if (start.ch >= line.text.length) {\n start.ch = line.text.length;\n start.sticky = \"before\";\n } else if (start.ch <= 0) {\n start.ch = 0;\n start.sticky = \"after\";\n }\n var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];\n if (cm.doc.direction == \"ltr\" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {\n // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,\n // nothing interesting happens.\n return moveLogically(line, start, dir)\n }\n\n var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };\n var prep;\n var getWrappedLineExtent = function (ch) {\n if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }\n prep = prep || prepareMeasureForLine(cm, line);\n return wrappedLineExtentChar(cm, line, prep, ch)\n };\n var wrappedLineExtent = getWrappedLineExtent(start.sticky == \"before\" ? mv(start, -1) : start.ch);\n\n if (cm.doc.direction == \"rtl\" || part.level == 1) {\n var moveInStorageOrder = (part.level == 1) == (dir < 0);\n var ch = mv(start, moveInStorageOrder ? 1 : -1);\n if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {\n // Case 2: We move within an rtl part or in an rtl editor on the same visual line\n var sticky = moveInStorageOrder ? \"before\" : \"after\";\n return new Pos(start.line, ch, sticky)\n }\n }\n\n // Case 3: Could not move within this bidi part in this visual line, so leave\n // the current bidi part\n\n var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {\n var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder\n ? new Pos(start.line, mv(ch, 1), \"before\")\n : new Pos(start.line, ch, \"after\"); };\n\n for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {\n var part = bidi[partPos];\n var moveInStorageOrder = (dir > 0) == (part.level != 1);\n var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);\n if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }\n ch = moveInStorageOrder ? part.from : mv(part.to, -1);\n if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }\n }\n };\n\n // Case 3a: Look for other bidi parts on the same visual line\n var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);\n if (res) { return res }\n\n // Case 3b: Look for other bidi parts on the next visual line\n var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);\n if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {\n res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));\n if (res) { return res }\n }\n\n // Case 4: Nowhere to move\n return null\n }\n\n // Commands are parameter-less actions that can be performed on an\n // editor, mostly used for keybindings.\n var commands = {\n selectAll: selectAll,\n singleSelection: function (cm) { return cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll); },\n killLine: function (cm) { return deleteNearSelection(cm, function (range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n if (range.head.ch == len && range.head.line < cm.lastLine())\n { return {from: range.head, to: Pos(range.head.line + 1, 0)} }\n else\n { return {from: range.head, to: Pos(range.head.line, len)} }\n } else {\n return {from: range.from(), to: range.to()}\n }\n }); },\n deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0),\n to: clipPos(cm.doc, Pos(range.to().line + 1, 0))\n }); }); },\n delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0), to: range.from()\n }); }); },\n delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n return {from: leftPos, to: range.from()}\n }); },\n delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n return {from: range.from(), to: rightPos }\n }); },\n undo: function (cm) { return cm.undo(); },\n redo: function (cm) { return cm.redo(); },\n undoSelection: function (cm) { return cm.undoSelection(); },\n redoSelection: function (cm) { return cm.redoSelection(); },\n goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },\n goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },\n goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },\n {origin: \"+move\", bias: -1}\n ); },\n goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\")\n }, sel_move); },\n goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: 0, top: top}, \"div\")\n }, sel_move); },\n goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) { return lineStartSmart(cm, range.head) }\n return pos\n }, sel_move); },\n goLineUp: function (cm) { return cm.moveV(-1, \"line\"); },\n goLineDown: function (cm) { return cm.moveV(1, \"line\"); },\n goPageUp: function (cm) { return cm.moveV(-1, \"page\"); },\n goPageDown: function (cm) { return cm.moveV(1, \"page\"); },\n goCharLeft: function (cm) { return cm.moveH(-1, \"char\"); },\n goCharRight: function (cm) { return cm.moveH(1, \"char\"); },\n goColumnLeft: function (cm) { return cm.moveH(-1, \"column\"); },\n goColumnRight: function (cm) { return cm.moveH(1, \"column\"); },\n goWordLeft: function (cm) { return cm.moveH(-1, \"word\"); },\n goGroupRight: function (cm) { return cm.moveH(1, \"group\"); },\n goGroupLeft: function (cm) { return cm.moveH(-1, \"group\"); },\n goWordRight: function (cm) { return cm.moveH(1, \"word\"); },\n delCharBefore: function (cm) { return cm.deleteH(-1, \"codepoint\"); },\n delCharAfter: function (cm) { return cm.deleteH(1, \"char\"); },\n delWordBefore: function (cm) { return cm.deleteH(-1, \"word\"); },\n delWordAfter: function (cm) { return cm.deleteH(1, \"word\"); },\n delGroupBefore: function (cm) { return cm.deleteH(-1, \"group\"); },\n delGroupAfter: function (cm) { return cm.deleteH(1, \"group\"); },\n indentAuto: function (cm) { return cm.indentSelection(\"smart\"); },\n indentMore: function (cm) { return cm.indentSelection(\"add\"); },\n indentLess: function (cm) { return cm.indentSelection(\"subtract\"); },\n insertTab: function (cm) { return cm.replaceSelection(\"\\t\"); },\n insertSoftTab: function (cm) {\n var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(spaceStr(tabSize - col % tabSize));\n }\n cm.replaceSelections(spaces);\n },\n defaultTab: function (cm) {\n if (cm.somethingSelected()) { cm.indentSelection(\"add\"); }\n else { cm.execCommand(\"insertTab\"); }\n },\n // Swap the two chars left and right of each selection's head.\n // Move cursor behind the two swapped characters afterwards.\n //\n // Doesn't consider line feeds a character.\n // Doesn't scan more than one line above to find a character.\n // Doesn't do anything on an empty line.\n // Doesn't do anything with non-empty selections.\n transposeChars: function (cm) { return runInOp(cm, function () {\n var ranges = cm.listSelections(), newSel = [];\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) { continue }\n var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n if (line) {\n if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n if (prev) {\n cur = new Pos(cur.line, 1);\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n prev.charAt(prev.length - 1),\n Pos(cur.line - 1, prev.length - 1), cur, \"+transpose\");\n }\n }\n }\n newSel.push(new Range(cur, cur));\n }\n cm.setSelections(newSel);\n }); },\n newlineAndIndent: function (cm) { return runInOp(cm, function () {\n var sels = cm.listSelections();\n for (var i = sels.length - 1; i >= 0; i--)\n { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, \"+input\"); }\n sels = cm.listSelections();\n for (var i$1 = 0; i$1 < sels.length; i$1++)\n { cm.indentLine(sels[i$1].from().line, null, true); }\n ensureCursorVisible(cm);\n }); },\n openLine: function (cm) { return cm.replaceSelection(\"\\n\", \"start\"); },\n toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }\n };\n\n\n function lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, visual, lineN, 1)\n }\n function lineEnd(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLineEnd(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, line, lineN, -1)\n }\n function lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line, cm.doc.direction);\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(start.ch, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)\n }\n return start\n }\n\n // Run a handler that was bound to a key.\n function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }\n\n function lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n if (result) { return result }\n }\n return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n || lookupKey(name, cm.options.keyMap, handle, cm)\n }\n\n // Note that, despite the name, this function is also used to check\n // for bound mouse clicks.\n\n var stopSeq = new Delayed;\n\n function dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n if (seq) {\n if (isModifierKey(name)) { return \"handled\" }\n if (/\\'$/.test(name))\n { cm.state.keySeq = null; }\n else\n { stopSeq.set(50, function () {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n }); }\n if (dispatchKeyInner(cm, seq + \" \" + name, e, handle)) { return true }\n }\n return dispatchKeyInner(cm, name, e, handle)\n }\n\n function dispatchKeyInner(cm, name, e, handle) {\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\")\n { cm.state.keySeq = name; }\n if (result == \"handled\")\n { signalLater(cm, \"keyHandled\", cm, name, e); }\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n return !!result\n }\n\n // Handle a key from the keydown event.\n function handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n if (!name) { return false }\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function (b) { return doHandleBinding(cm, b, true); })\n || dispatchKey(cm, name, e, function (b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n { return doHandleBinding(cm, b) }\n })\n } else {\n return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })\n }\n }\n\n // Handle a key from the keypress event\n function handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e, function (b) { return doHandleBinding(cm, b, true); })\n }\n\n var lastStoppedKey = null;\n function onKeyDown(e) {\n var cm = this;\n if (e.target && e.target != cm.display.input.getField()) { return }\n cm.curOp.focus = activeElt();\n if (signalDOMEvent(cm, e)) { return }\n // IE does strange things with escape.\n if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n if (presto) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))\n { cm.replaceSelection(\"\", null, \"cut\"); }\n }\n if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)\n { document.execCommand(\"cut\"); }\n\n // Turn mouse into crosshair when Alt is held on Mac.\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className))\n { showCrossHair(cm); }\n }\n\n function showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n }\n\n function onKeyUp(e) {\n if (e.keyCode == 16) { this.doc.sel.shift = false; }\n signalDOMEvent(this, e);\n }\n\n function onKeyPress(e) {\n var cm = this;\n if (e.target && e.target != cm.display.input.getField()) { return }\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }\n var keyCode = e.keyCode, charCode = e.charCode;\n if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}\n if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n // Some browsers fire keypress events for backspace\n if (ch == \"\\x08\") { return }\n if (handleCharBinding(cm, e, ch)) { return }\n cm.display.input.onKeyPress(e);\n }\n\n var DOUBLECLICK_DELAY = 400;\n\n var PastClick = function(time, pos, button) {\n this.time = time;\n this.pos = pos;\n this.button = button;\n };\n\n PastClick.prototype.compare = function (time, pos, button) {\n return this.time + DOUBLECLICK_DELAY > time &&\n cmp(pos, this.pos) == 0 && button == this.button\n };\n\n var lastClick, lastDoubleClick;\n function clickRepeat(pos, button) {\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {\n lastClick = lastDoubleClick = null;\n return \"triple\"\n } else if (lastClick && lastClick.compare(now, pos, button)) {\n lastDoubleClick = new PastClick(now, pos, button);\n lastClick = null;\n return \"double\"\n } else {\n lastClick = new PastClick(now, pos, button);\n lastDoubleClick = null;\n return \"single\"\n }\n }\n\n // A mouse down can be a single click, double click, triple click,\n // start of selection drag, start of text drag, new cursor\n // (ctrl-click), rectangle drag (alt-drag), or xwin\n // middle-click-paste. Or it might be a click on something we should\n // not interfere with, such as a scrollbar or widget.\n function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { cm.display.input.onContextMenu(e); }\n else { delayBlurEvent(cm); }\n }\n }\n\n function handleMappedButton(cm, button, pos, repeat, event) {\n var name = \"Click\";\n if (repeat == \"double\") { name = \"Double\" + name; }\n else if (repeat == \"triple\") { name = \"Triple\" + name; }\n name = (button == 1 ? \"Left\" : button == 2 ? \"Middle\" : \"Right\") + name;\n\n return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {\n if (typeof bound == \"string\") { bound = commands[bound]; }\n if (!bound) { return false }\n var done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n done = bound(cm, pos) != Pass;\n } finally {\n cm.state.suppressEdits = false;\n }\n return done\n })\n }\n\n function configureMouse(cm, repeat, event) {\n var option = cm.getOption(\"configureMouse\");\n var value = option ? option(cm, repeat, event) : {};\n if (value.unit == null) {\n var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;\n value.unit = rect ? \"rectangle\" : repeat == \"single\" ? \"char\" : repeat == \"double\" ? \"word\" : \"line\";\n }\n if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }\n if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }\n if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }\n return value\n }\n\n function leftButtonDown(cm, pos, repeat, event) {\n if (ie) { setTimeout(bind(ensureFocus, cm), 0); }\n else { cm.curOp.focus = activeElt(); }\n\n var behavior = configureMouse(cm, repeat, event);\n\n var sel = cm.doc.sel, contained;\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n repeat == \"single\" && (contained = sel.contains(pos)) > -1 &&\n (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&\n (cmp(contained.to(), pos) > 0 || pos.xRel < 0))\n { leftButtonStartDrag(cm, event, pos, behavior); }\n else\n { leftButtonSelect(cm, event, pos, behavior); }\n }\n\n // Start a text drag. When it ends, see if any dragging actually\n // happen, and treat as a click if it didn't.\n function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }\n\n function rangeForUnit(cm, pos, unit) {\n if (unit == \"char\") { return new Range(pos, pos) }\n if (unit == \"word\") { return cm.findWordAt(pos) }\n if (unit == \"line\") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }\n var result = unit(cm, pos);\n return new Range(result.from, result.to)\n }\n\n // Normal selection, as opposed to text dragging.\n function leftButtonSelect(cm, event, start, behavior) {\n if (ie) { delayBlurEvent(cm); }\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }\n\n // Used when mouse-selecting to adjust the anchor to the proper side\n // of a bidi jump depending on the visual position of the head.\n function bidiSimplify(cm, range) {\n var anchor = range.anchor;\n var head = range.head;\n var anchorLine = getLine(cm.doc, anchor.line);\n if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }\n var order = getOrder(anchorLine);\n if (!order) { return range }\n var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];\n if (part.from != anchor.ch && part.to != anchor.ch) { return range }\n var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);\n if (boundary == 0 || boundary == order.length) { return range }\n\n // Compute the relative visual position of the head compared to the\n // anchor (<0 is to the left, >0 to the right)\n var leftSide;\n if (head.line != anchor.line) {\n leftSide = (head.line - anchor.line) * (cm.doc.direction == \"ltr\" ? 1 : -1) > 0;\n } else {\n var headIndex = getBidiPartAt(order, head.ch, head.sticky);\n var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);\n if (headIndex == boundary - 1 || headIndex == boundary)\n { leftSide = dir < 0; }\n else\n { leftSide = dir > 0; }\n }\n\n var usePart = order[boundary + (leftSide ? -1 : 0)];\n var from = leftSide == (usePart.level == 1);\n var ch = from ? usePart.from : usePart.to, sticky = from ? \"after\" : \"before\";\n return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)\n }\n\n\n // Determines whether an event happened in the gutter, and fires the\n // handlers for the corresponding event.\n function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }\n\n function clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true)\n }\n\n // CONTEXT MENU HANDLING\n\n // To make the context menu work, we need to briefly unhide the\n // textarea (making it as unobtrusive as possible) to let the\n // right-click take effect on it.\n function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }\n if (signalDOMEvent(cm, e, \"contextmenu\")) { return }\n if (!captureRightClick) { cm.display.input.onContextMenu(e); }\n }\n\n function contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) { return false }\n return gutterEvent(cm, e, \"gutterContextMenu\", false)\n }\n\n function themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n }\n\n var Init = {toString: function(){return \"CodeMirror.Init\"}};\n\n var defaults = {};\n var optionHandlers = {};\n\n function defineOptions(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n if (handle) { optionHandlers[name] =\n notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }\n }\n\n CodeMirror.defineOption = option;\n\n // Passed to option handlers when there is no old value.\n CodeMirror.Init = Init;\n\n // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n option(\"value\", \"\", function (cm, val) { return cm.setValue(val); }, true);\n option(\"mode\", null, function (cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function (cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n\n option(\"lineSeparator\", null, function (cm, val) {\n cm.doc.lineSep = val;\n if (!val) { return }\n var newBreaks = [], lineNo = cm.doc.first;\n cm.doc.iter(function (line) {\n for (var pos = 0;;) {\n var found = line.text.indexOf(val, pos);\n if (found == -1) { break }\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n lineNo++;\n });\n for (var i = newBreaks.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }\n });\n option(\"specialChars\", /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200c\\u200e\\u200f\\u2028\\u2029\\ufeff\\ufff9-\\ufffc]/g, function (cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n if (old != Init) { cm.refresh(); }\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function () {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\") // FIXME\n }, true);\n option(\"spellcheck\", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);\n option(\"autocorrect\", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);\n option(\"autocapitalize\", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n\n option(\"theme\", \"default\", function (cm) {\n themeChanged(cm);\n updateGutters(cm);\n }, true);\n option(\"keyMap\", \"default\", function (cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != Init && getKeyMap(old);\n if (prev && prev.detach) { prev.detach(cm, next); }\n if (next.attach) { next.attach(cm, prev || null); }\n });\n option(\"extraKeys\", null);\n option(\"configureMouse\", null);\n\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function (cm, val) {\n cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);\n updateGutters(cm);\n }, true);\n option(\"fixedGutter\", true, function (cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function (cm) { return updateScrollbars(cm); }, true);\n option(\"scrollbarStyle\", \"native\", function (cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function (cm, val) {\n cm.display.gutterSpecs = getGutters(cm.options.gutters, val);\n updateGutters(cm);\n }, true);\n option(\"firstLineNumber\", 1, updateGutters, true);\n option(\"lineNumberFormatter\", function (integer) { return integer; }, updateGutters, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n option(\"pasteLinesPerSelection\", true);\n option(\"selectionsMayTouch\", false);\n\n option(\"readOnly\", false, function (cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n }\n cm.display.input.readOnlyChanged(val);\n });\n\n option(\"screenReaderLabel\", null, function (cm, val) {\n val = (val === '') ? null : val;\n cm.display.input.screenReaderLabelChanged(val);\n });\n\n option(\"disableInput\", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function (cm) { return cm.refresh(); }, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function (cm, val) {\n if (!val) { cm.display.input.resetPosition(); }\n });\n\n option(\"tabindex\", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || \"\"; });\n option(\"autofocus\", null);\n option(\"direction\", \"ltr\", function (cm, val) { return cm.doc.setDirection(val); }, true);\n option(\"phrases\", null);\n }\n\n function dragDropChanged(cm, value, old) {\n var wasOn = old && old != Init;\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n }\n\n function wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function () { return updateScrollbars(cm); }, 100);\n }\n\n // A CodeMirror instance represents an editor. This is the object\n // that user code is usually dealing with.\n\n function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }\n\n // The default configuration options.\n CodeMirror.defaults = defaults;\n // Functions to run when options are changed.\n CodeMirror.optionHandlers = optionHandlers;\n\n // Attach the necessary event handlers when initializing the editor\n function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n { on(d.scroller, \"dblclick\", operation(cm, function (e) {\n if (signalDOMEvent(cm, e)) { return }\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n })); }\n else\n { on(d.scroller, \"dblclick\", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n on(d.scroller, \"contextmenu\", function (e) { return onContextMenu(cm, e); });\n on(d.input.getField(), \"contextmenu\", function (e) {\n if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }\n });\n\n // Used to suppress mouse event handling when a touch happens\n var touchFinished, prevTouch = {end: 0};\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date;\n }\n }\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) { return false }\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1\n }\n function farAway(touch, other) {\n if (other.left == null) { return true }\n var dx = other.left - touch.left, dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20\n }\n on(d.scroller, \"touchstart\", function (e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {\n d.input.ensurePolled();\n clearTimeout(touchFinished);\n var now = +new Date;\n d.activeTouch = {start: now, moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null};\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function () {\n if (d.activeTouch) { d.activeTouch.moved = true; }\n });\n on(d.scroller, \"touchend\", function (e) {\n var touch = d.activeTouch;\n if (touch && !eventInWidget(d, e) && touch.left != null &&\n !touch.moved && new Date - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n { range = new Range(pos, pos); }\n else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n { range = cm.findWordAt(pos); }\n else // Triple tap\n { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch);\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function () {\n if (d.scroller.clientHeight) {\n updateScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function (e) { return onScrollWheel(cm, e); });\n on(d.scroller, \"DOMMouseScroll\", function (e) { return onScrollWheel(cm, e); });\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n d.dragFunctions = {\n enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},\n over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},\n start: function (e) { return onDragStart(cm, e); },\n drop: operation(cm, onDrop),\n leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}\n };\n\n var inp = d.input.getField();\n on(inp, \"keyup\", function (e) { return onKeyUp.call(cm, e); });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", function (e) { return onFocus(cm, e); });\n on(inp, \"blur\", function (e) { return onBlur(cm, e); });\n }\n\n var initHooks = [];\n CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };\n\n // Indent the given line. The how parameter can be \"smart\",\n // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n // (typically set to true for forced single-line indents), empty\n // lines are not indented, and places where the mode returns Pass\n // are left alone.\n function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n }\n\n // This will be set to a {lineWise: bool, text: [string]} object, so\n // that, when pasting, we know what kind of selections the copied\n // text was made out of.\n var lastCopied = null;\n\n function setLastCopied(newLastCopied) {\n lastCopied = newLastCopied;\n }\n\n function applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n if (!sel) { sel = doc.sel; }\n\n var recent = +new Date - 200;\n var paste = origin == \"paste\" || cm.state.pasteIncoming > recent;\n var textLines = splitLinesAuto(inserted), multiPaste = null;\n // When pasting N lines into N selections, insert one line per selection\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.text.length == 0) {\n multiPaste = [];\n for (var i = 0; i < lastCopied.text.length; i++)\n { multiPaste.push(doc.splitLines(lastCopied.text[i])); }\n }\n } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {\n multiPaste = map(textLines, function (l) { return [l]; });\n }\n }\n\n var updateInput = cm.curOp.updateInput;\n // Normal behavior is to insert the new text into every selection\n for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {\n var range = sel.ranges[i$1];\n var from = range.from(), to = range.to();\n if (range.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n { from = Pos(from.line, from.ch - deleted); }\n else if (cm.state.overwrite && !paste) // Handle overwrite\n { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }\n else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == textLines.join(\"\\n\"))\n { from = to = Pos(from.line, 0); }\n }\n var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming > recent ? \"cut\" : \"+input\")};\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n if (inserted && !paste)\n { triggerElectric(cm, inserted); }\n\n ensureCursorVisible(cm);\n if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = -1;\n }\n\n function handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"Text\");\n if (pasted) {\n e.preventDefault();\n if (!cm.isReadOnly() && !cm.options.disableInput)\n { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, \"paste\"); }); }\n return true\n }\n }\n\n function triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) { return }\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }\n var mode = cm.getModeAt(range.head);\n var indented = false;\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++)\n { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range.head.line, \"smart\");\n break\n } }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))\n { indented = indentLine(cm, range.head.line, \"smart\"); }\n }\n if (indented) { signalLater(cm, \"electricInput\", cm, range.head.line); }\n }\n }\n\n function copyableRanges(cm) {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n return {text: text, ranges: ranges}\n }\n\n function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {\n field.setAttribute(\"autocorrect\", autocorrect ? \"\" : \"off\");\n field.setAttribute(\"autocapitalize\", autocapitalize ? \"\" : \"off\");\n field.setAttribute(\"spellcheck\", !!spellcheck);\n }\n\n function hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n if (webkit) { te.style.width = \"1000px\"; }\n else { te.setAttribute(\"wrap\", \"off\"); }\n // If border: 0; -- iOS fails to open keyboard (issue #1287)\n if (ios) { te.style.border = \"1px solid black\"; }\n disableBrowserMagic(te);\n return div\n }\n\n // The publicly visible API. Note that methodOp(f) means\n // 'wrap f in an operation, performed on its `this` parameter'.\n\n // This is not the complete set of editor methods. Most of the\n // methods defined on the Doc type are also injected into\n // CodeMirror.prototype, for backwards compatibility and\n // convenience.\n\n function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }\n\n // Used for horizontal relative motion. Dir is -1 or 1 (left or\n // right), unit can be \"codepoint\", \"char\", \"column\" (like char, but\n // doesn't cross line boundaries), \"word\" (across next word), or\n // \"group\" (to the start of next group of word or\n // non-word-non-whitespace chars). The visually param controls\n // whether, in right-to-left text, direction 1 means to move towards\n // the next index in the string, or towards the character to the right\n // of the current position. The resulting position will have a\n // hitSide=true property if it reached the end of the document.\n function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }\n\n // For relative vertical movement. Dir may be -1 or 1. Unit can be\n // \"page\" or \"line\". The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }\n\n // CONTENTEDITABLE INPUT STYLE\n\n var ContentEditableInput = function(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.composing = null;\n this.gracePeriod = false;\n this.readDOMTimeout = null;\n };\n\n ContentEditableInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = input.cm;\n var div = input.div = display.lineDiv;\n disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);\n\n function belongsToInput(e) {\n for (var t = e.target; t; t = t.parentNode) {\n if (t == div) { return true }\n if (/\\bCodeMirror-(?:line)?widget\\b/.test(t.className)) { break }\n }\n return false\n }\n\n on(div, \"paste\", function (e) {\n if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n // IE doesn't fire input events, so we schedule a read for the pasted content in this way\n if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }\n });\n\n on(div, \"compositionstart\", function (e) {\n this$1.composing = {data: e.data, done: false};\n });\n on(div, \"compositionupdate\", function (e) {\n if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }\n });\n on(div, \"compositionend\", function (e) {\n if (this$1.composing) {\n if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }\n this$1.composing.done = true;\n }\n });\n\n on(div, \"touchstart\", function () { return input.forceCompositionEnd(); });\n\n on(div, \"input\", function () {\n if (!this$1.composing) { this$1.readFromDOMSoon(); }\n });\n\n function onCopyCut(e) {\n if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n if (e.type == \"cut\") { cm.replaceSelection(\"\", null, \"cut\"); }\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.operation(function () {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n if (e.clipboardData) {\n e.clipboardData.clearData();\n var content = lastCopied.text.join(\"\\n\");\n // iOS exposes the clipboard API, but seems to discard content inserted into it\n e.clipboardData.setData(\"Text\", content);\n if (e.clipboardData.getData(\"Text\") == content) {\n e.preventDefault();\n return\n }\n }\n // Old-fashioned briefly-focus-a-textarea hack\n var kludge = hiddenTextarea(), te = kludge.firstChild;\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.text.join(\"\\n\");\n var hadFocus = document.activeElement;\n selectInput(te);\n setTimeout(function () {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n if (hadFocus == div) { input.showPrimarySelection(); }\n }, 50);\n }\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n };\n\n ContentEditableInput.prototype.screenReaderLabelChanged = function (label) {\n // Label for screenreaders, accessibility\n if(label) {\n this.div.setAttribute('aria-label', label);\n } else {\n this.div.removeAttribute('aria-label');\n }\n };\n\n ContentEditableInput.prototype.prepareSelection = function () {\n var result = prepareSelection(this.cm, false);\n result.focus = document.activeElement == this.div;\n return result\n };\n\n ContentEditableInput.prototype.showSelection = function (info, takeFocus) {\n if (!info || !this.cm.display.view.length) { return }\n if (info.focus || takeFocus) { this.showPrimarySelection(); }\n this.showMultipleSelections(info);\n };\n\n ContentEditableInput.prototype.getSelection = function () {\n return this.cm.display.wrapper.ownerDocument.getSelection()\n };\n\n ContentEditableInput.prototype.showPrimarySelection = function () {\n var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();\n var from = prim.from(), to = prim.to();\n\n if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {\n sel.removeAllRanges();\n return\n }\n\n var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n cmp(minPos(curAnchor, curFocus), from) == 0 &&\n cmp(maxPos(curAnchor, curFocus), to) == 0)\n { return }\n\n var view = cm.display.view;\n var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||\n {node: view[0].measure.map[2], offset: 0};\n var end = to.line < cm.display.viewTo && posToDOM(cm, to);\n if (!end) {\n var measure = view[view.length - 1].measure;\n var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};\n }\n\n if (!start || !end) {\n sel.removeAllRanges();\n return\n }\n\n var old = sel.rangeCount && sel.getRangeAt(0), rng;\n try { rng = range(start.node, start.offset, end.offset, end.node); }\n catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n if (rng) {\n if (!gecko && cm.state.focused) {\n sel.collapse(start.node, start.offset);\n if (!rng.collapsed) {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n if (old && sel.anchorNode == null) { sel.addRange(old); }\n else if (gecko) { this.startGracePeriod(); }\n }\n this.rememberSelection();\n };\n\n ContentEditableInput.prototype.startGracePeriod = function () {\n var this$1 = this;\n\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function () {\n this$1.gracePeriod = false;\n if (this$1.selectionChanged())\n { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }\n }, 20);\n };\n\n ContentEditableInput.prototype.showMultipleSelections = function (info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n };\n\n ContentEditableInput.prototype.rememberSelection = function () {\n var sel = this.getSelection();\n this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;\n };\n\n ContentEditableInput.prototype.selectionInEditor = function () {\n var sel = this.getSelection();\n if (!sel.rangeCount) { return false }\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node)\n };\n\n ContentEditableInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\") {\n if (!this.selectionInEditor() || document.activeElement != this.div)\n { this.showSelection(this.prepareSelection(), true); }\n this.div.focus();\n }\n };\n ContentEditableInput.prototype.blur = function () { this.div.blur(); };\n ContentEditableInput.prototype.getField = function () { return this.div };\n\n ContentEditableInput.prototype.supportsTouch = function () { return true };\n\n ContentEditableInput.prototype.receivedFocus = function () {\n var input = this;\n if (this.selectionInEditor())\n { this.pollSelection(); }\n else\n { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n this.polling.set(this.cm.options.pollInterval, poll);\n };\n\n ContentEditableInput.prototype.selectionChanged = function () {\n var sel = this.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset\n };\n\n ContentEditableInput.prototype.pollSelection = function () {\n if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }\n var sel = this.getSelection(), cm = this.cm;\n // On Android Chrome (version 56, at least), backspacing into an\n // uneditable block element will put the cursor in that element,\n // and then, because it's not editable, hide the virtual keyboard.\n // Because Android doesn't allow us to actually detect backspace\n // presses in a sane way, this code checks for when that happens\n // and simulates a backspace press in this case.\n if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {\n this.cm.triggerOnKeyDown({type: \"keydown\", keyCode: 8, preventDefault: Math.abs});\n this.blur();\n this.focus();\n return\n }\n if (this.composing) { return }\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (anchor && head) { runInOp(cm, function () {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }\n }); }\n };\n\n ContentEditableInput.prototype.pollContent = function () {\n if (this.readDOMTimeout != null) {\n clearTimeout(this.readDOMTimeout);\n this.readDOMTimeout = null;\n }\n\n var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n var from = sel.from(), to = sel.to();\n if (from.ch == 0 && from.line > cm.firstLine())\n { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }\n if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())\n { to = Pos(to.line + 1, 0); }\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }\n\n var fromIndex, fromLine, fromNode;\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n fromLine = lineNo(display.view[0].line);\n fromNode = display.view[0].node;\n } else {\n fromLine = lineNo(display.view[fromIndex].line);\n fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n var toIndex = findViewIndex(cm, to.line);\n var toLine, toNode;\n if (toIndex == display.view.length - 1) {\n toLine = display.viewTo - 1;\n toNode = display.lineDiv.lastChild;\n } else {\n toLine = lineNo(display.view[toIndex + 1].line) - 1;\n toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n if (!fromNode) { return false }\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }\n else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }\n else { break }\n }\n\n var cutFront = 0, cutEnd = 0;\n var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))\n { ++cutFront; }\n var newBot = lst(newText), oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n oldBot.length - (oldText.length == 1 ? cutFront : 0));\n while (cutEnd < maxCutEnd &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))\n { ++cutEnd; }\n // Try to move start of change to start of selection if ambiguous\n if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {\n while (cutFront && cutFront > from.ch &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n cutFront--;\n cutEnd++;\n }\n }\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\\u200b+/, \"\");\n newText[0] = newText[0].slice(cutFront).replace(/\\u200b+$/, \"\");\n\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n return true\n }\n };\n\n ContentEditableInput.prototype.ensurePolled = function () {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.reset = function () {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.forceCompositionEnd = function () {\n if (!this.composing) { return }\n clearTimeout(this.readDOMTimeout);\n this.composing = null;\n this.updateFromDOM();\n this.div.blur();\n this.div.focus();\n };\n ContentEditableInput.prototype.readFromDOMSoon = function () {\n var this$1 = this;\n\n if (this.readDOMTimeout != null) { return }\n this.readDOMTimeout = setTimeout(function () {\n this$1.readDOMTimeout = null;\n if (this$1.composing) {\n if (this$1.composing.done) { this$1.composing = null; }\n else { return }\n }\n this$1.updateFromDOM();\n }, 80);\n };\n\n ContentEditableInput.prototype.updateFromDOM = function () {\n var this$1 = this;\n\n if (this.cm.isReadOnly() || !this.pollContent())\n { runInOp(this.cm, function () { return regChange(this$1.cm); }); }\n };\n\n ContentEditableInput.prototype.setUneditable = function (node) {\n node.contentEditable = \"false\";\n };\n\n ContentEditableInput.prototype.onKeyPress = function (e) {\n if (e.charCode == 0 || this.composing) { return }\n e.preventDefault();\n if (!this.cm.isReadOnly())\n { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }\n };\n\n ContentEditableInput.prototype.readOnlyChanged = function (val) {\n this.div.contentEditable = String(val != \"nocursor\");\n };\n\n ContentEditableInput.prototype.onContextMenu = function () {};\n ContentEditableInput.prototype.resetPosition = function () {};\n\n ContentEditableInput.prototype.needsContentAttribute = true;\n\n function posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n if (!view || view.hidden) { return null }\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n\n var order = getOrder(line, cm.doc.direction), side = \"left\";\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result\n }\n\n function isInGutter(node) {\n for (var scan = node; scan; scan = scan.parentNode)\n { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }\n return false\n }\n\n function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }\n\n function domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;\n function recognizeMarker(id) { return function (marker) { return marker.id == id; } }\n function close() {\n if (closing) {\n text += lineSep;\n if (extraLinebreak) { text += lineSep; }\n closing = extraLinebreak = false;\n }\n }\n function addText(str) {\n if (str) {\n close();\n text += str;\n }\n }\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n if (cmText) {\n addText(cmText);\n return\n }\n var markerID = node.getAttribute(\"cm-marker\"), range;\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n if (found.length && (range = found[0].find(0)))\n { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }\n return\n }\n if (node.getAttribute(\"contenteditable\") == \"false\") { return }\n var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);\n if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }\n\n if (isBlock) { close(); }\n for (var i = 0; i < node.childNodes.length; i++)\n { walk(node.childNodes[i]); }\n\n if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }\n if (isBlock) { closing = true; }\n } else if (node.nodeType == 3) {\n addText(node.nodeValue.replace(/\\u200b/g, \"\").replace(/\\u00a0/g, \" \"));\n }\n }\n for (;;) {\n walk(from);\n if (from == to) { break }\n from = from.nextSibling;\n extraLinebreak = false;\n }\n return text\n }\n\n function domToPos(cm, node, offset) {\n var lineNode;\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }\n node = null; offset = 0;\n } else {\n for (lineNode = node;; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) { return null }\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }\n }\n }\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n if (lineView.node == lineNode)\n { return locateNodeInLineView(lineView, node, offset) }\n }\n }\n\n function locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild, bad = false;\n if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad)\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null, topNode = node;\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n if (offset) { offset = textNode.nodeValue.length; }\n }\n while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }\n var measure = lineView.measure, maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map = i < 0 ? measure.map : maps[i];\n for (var j = 0; j < map.length; j += 3) {\n var curNode = map[j + 2];\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map[j] + offset;\n if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }\n return Pos(line, ch)\n }\n }\n }\n }\n var found = find(textNode, topNode, offset);\n if (found) { return badPos(found, bad) }\n\n // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n if (found)\n { return badPos(Pos(found.line, found.ch - dist), bad) }\n else\n { dist += after.textContent.length; }\n }\n for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n if (found)\n { return badPos(Pos(found.line, found.ch + dist$1), bad) }\n else\n { dist$1 += before.textContent.length; }\n }\n }\n\n // TEXTAREA INPUT STYLE\n\n var TextareaInput = function(cm) {\n this.cm = cm;\n // See input.poll and input.reset\n this.prevInput = \"\";\n\n // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n this.pollingFast = false;\n // Self-resetting timeout for the poller\n this.polling = new Delayed();\n // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n this.hasSelection = false;\n this.composing = null;\n };\n\n TextareaInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = this.cm;\n this.createField(display);\n var te = this.textarea;\n\n display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);\n\n // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n if (ios) { te.style.width = \"0px\"; }\n\n on(te, \"input\", function () {\n if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }\n input.poll();\n });\n\n on(te, \"paste\", function (e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n\n cm.state.pasteIncoming = +new Date;\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n if (e.type == \"cut\") { cm.state.cutIncoming = +new Date; }\n }\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n\n on(display.scroller, \"paste\", function (e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }\n if (!te.dispatchEvent) {\n cm.state.pasteIncoming = +new Date;\n input.focus();\n return\n }\n\n // Pass the `paste` event to the textarea so it's handled by its event listener.\n var event = new Event(\"paste\");\n event.clipboardData = e.clipboardData;\n te.dispatchEvent(event);\n });\n\n // Prevent normal selection in the editor (we handle our own)\n on(display.lineSpace, \"selectstart\", function (e) {\n if (!eventInWidget(display, e)) { e_preventDefault(e); }\n });\n\n on(te, \"compositionstart\", function () {\n var start = cm.getCursor(\"from\");\n if (input.composing) { input.composing.range.clear(); }\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n };\n });\n on(te, \"compositionend\", function () {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n };\n\n TextareaInput.prototype.createField = function (_display) {\n // Wraps and hides input textarea\n this.wrapper = hiddenTextarea();\n // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n this.textarea = this.wrapper.firstChild;\n };\n\n TextareaInput.prototype.screenReaderLabelChanged = function (label) {\n // Label for screenreaders, accessibility\n if(label) {\n this.textarea.setAttribute('aria-label', label);\n } else {\n this.textarea.removeAttribute('aria-label');\n }\n };\n\n TextareaInput.prototype.prepareSelection = function () {\n // Redraw the selection and/or cursor\n var cm = this.cm, display = cm.display, doc = cm.doc;\n var result = prepareSelection(cm);\n\n // Move the hidden textarea near the cursor to prevent scrolling artifacts\n if (cm.options.moveInputWithCursor) {\n var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result\n };\n\n TextareaInput.prototype.showSelection = function (drawn) {\n var cm = this.cm, display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n };\n\n // Reset the input to correspond to the selection (or to be empty,\n // when not typing and nothing is selected)\n TextareaInput.prototype.reset = function (typing) {\n if (this.contextMenuPending || this.composing) { return }\n var cm = this.cm;\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var content = cm.getSelection();\n this.textarea.value = content;\n if (cm.state.focused) { selectInput(this.textarea); }\n if (ie && ie_version >= 9) { this.hasSelection = content; }\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n }\n };\n\n TextareaInput.prototype.getField = function () { return this.textarea };\n\n TextareaInput.prototype.supportsTouch = function () { return false };\n\n TextareaInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n try { this.textarea.focus(); }\n catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n }\n };\n\n TextareaInput.prototype.blur = function () { this.textarea.blur(); };\n\n TextareaInput.prototype.resetPosition = function () {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n };\n\n TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };\n\n // Poll for input changes, using the normal rate of polling. This\n // runs as long as the editor is focused.\n TextareaInput.prototype.slowPoll = function () {\n var this$1 = this;\n\n if (this.pollingFast) { return }\n this.polling.set(this.cm.options.pollInterval, function () {\n this$1.poll();\n if (this$1.cm.state.focused) { this$1.slowPoll(); }\n });\n };\n\n // When an event has just come in that is likely to add or change\n // something in the input textarea, we poll faster, to ensure that\n // the change appears on the screen quickly.\n TextareaInput.prototype.fastPoll = function () {\n var missed = false, input = this;\n input.pollingFast = true;\n function p() {\n var changed = input.poll();\n if (!changed && !missed) {missed = true; input.polling.set(60, p);}\n else {input.pollingFast = false; input.slowPoll();}\n }\n input.polling.set(20, p);\n };\n\n // Read input from the textarea, and update the document to match.\n // When something is selected, it is present in the textarea, and\n // selected (unless it is huge, in which case a placeholder is\n // used). When nothing is selected, the cursor sits after previously\n // seen text (can be empty), which is stored in prevInput (we must\n // not reset the textarea when typing, because that breaks IME).\n TextareaInput.prototype.poll = function () {\n var this$1 = this;\n\n var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n if (this.contextMenuPending || !cm.state.focused ||\n (hasSelection(input) && !prevInput && !this.composing) ||\n cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)\n { return false }\n\n var text = input.value;\n // If nothing changed, bail.\n if (text == prevInput && !cm.somethingSelected()) { return false }\n // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n if (ie && ie_version >= 9 && this.hasSelection === text ||\n mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n if (first == 0x200b && !prevInput) { prevInput = \"\\u200b\"; }\n if (first == 0x21da) { this.reset(); return this.cm.execCommand(\"undo\") }\n }\n // Find the part of the input that is actually new\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }\n\n runInOp(cm, function () {\n applyTextInput(cm, text.slice(same), prevInput.length - same,\n null, this$1.composing ? \"*compose\" : null);\n\n // Don't leave long text in the textarea, since it makes further polling slow\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) { input.value = this$1.prevInput = \"\"; }\n else { this$1.prevInput = text; }\n\n if (this$1.composing) {\n this$1.composing.range.clear();\n this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor(\"to\"),\n {className: \"CodeMirror-composing\"});\n }\n });\n return true\n };\n\n TextareaInput.prototype.ensurePolled = function () {\n if (this.pollingFast && this.poll()) { this.pollingFast = false; }\n };\n\n TextareaInput.prototype.onKeyPress = function () {\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n this.fastPoll();\n };\n\n TextareaInput.prototype.onContextMenu = function (e) {\n var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n if (input.contextMenuPending) { input.contextMenuPending(); }\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) { return } // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }\n\n var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();\n input.wrapper.style.cssText = \"position: static\";\n te.style.cssText = \"position: absolute; width: 30px; height: 30px;\\n top: \" + (e.clientY - wrapperBox.top - 5) + \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px;\\n z-index: 1000; background: \" + (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") + \";\\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n var oldScrollY;\n if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)\n display.input.focus();\n if (webkit) { window.scrollTo(null, oldScrollY); }\n display.input.reset();\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) { te.value = input.prevInput = \" \"; }\n input.contextMenuPending = rehide;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n if (input.contextMenuPending != rehide) { return }\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS;\n te.style.cssText = oldCSS;\n if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }\n\n // Try to detect the user choosing select-all\n if (te.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }\n var i = 0, poll = function () {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n te.selectionEnd > 0 && input.prevInput == \"\\u200b\") {\n operation(cm, selectAll)(cm);\n } else if (i++ < 10) {\n display.detectingSelectAll = setTimeout(poll, 500);\n } else {\n display.selForContextMenu = null;\n display.input.reset();\n }\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) { prepareSelectAllHack(); }\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function () {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n };\n\n TextareaInput.prototype.readOnlyChanged = function (val) {\n if (!val) { this.reset(); }\n this.textarea.disabled = val == \"nocursor\";\n this.textarea.readOnly = !!val;\n };\n\n TextareaInput.prototype.setUneditable = function () {};\n\n TextareaInput.prototype.needsContentAttribute = false;\n\n function fromTextArea(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n if (!options.tabindex && textarea.tabIndex)\n { options.tabindex = textarea.tabIndex; }\n if (!options.placeholder && textarea.placeholder)\n { options.placeholder = textarea.placeholder; }\n // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n if (options.autofocus == null) {\n var hasFocus = activeElt();\n options.autofocus = hasFocus == textarea ||\n textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {textarea.value = cm.getValue();}\n\n var realSubmit;\n if (textarea.form) {\n on(textarea.form, \"submit\", save);\n // Deplorable hack to make the submit method do the right thing.\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form;\n realSubmit = form.submit;\n try {\n var wrappedSubmit = form.submit = function () {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch(e) {}\n }\n }\n\n options.finishInit = function (cm) {\n cm.save = save;\n cm.getTextArea = function () { return textarea; };\n cm.toTextArea = function () {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == \"function\")\n { textarea.form.submit = realSubmit; }\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },\n options);\n return cm\n }\n\n function addLegacyProps(CodeMirror) {\n CodeMirror.off = off;\n CodeMirror.on = on;\n CodeMirror.wheelEventPixels = wheelEventPixels;\n CodeMirror.Doc = Doc;\n CodeMirror.splitLines = splitLinesAuto;\n CodeMirror.countColumn = countColumn;\n CodeMirror.findColumn = findColumn;\n CodeMirror.isWordChar = isWordCharBasic;\n CodeMirror.Pass = Pass;\n CodeMirror.signal = signal;\n CodeMirror.Line = Line;\n CodeMirror.changeEnd = changeEnd;\n CodeMirror.scrollbarModel = scrollbarModel;\n CodeMirror.Pos = Pos;\n CodeMirror.cmpPos = cmp;\n CodeMirror.modes = modes;\n CodeMirror.mimeModes = mimeModes;\n CodeMirror.resolveMode = resolveMode;\n CodeMirror.getMode = getMode;\n CodeMirror.modeExtensions = modeExtensions;\n CodeMirror.extendMode = extendMode;\n CodeMirror.copyState = copyState;\n CodeMirror.startState = startState;\n CodeMirror.innerMode = innerMode;\n CodeMirror.commands = commands;\n CodeMirror.keyMap = keyMap;\n CodeMirror.keyName = keyName;\n CodeMirror.isModifierKey = isModifierKey;\n CodeMirror.lookupKey = lookupKey;\n CodeMirror.normalizeKeyMap = normalizeKeyMap;\n CodeMirror.StringStream = StringStream;\n CodeMirror.SharedTextMarker = SharedTextMarker;\n CodeMirror.TextMarker = TextMarker;\n CodeMirror.LineWidget = LineWidget;\n CodeMirror.e_preventDefault = e_preventDefault;\n CodeMirror.e_stopPropagation = e_stopPropagation;\n CodeMirror.e_stop = e_stop;\n CodeMirror.addClass = addClass;\n CodeMirror.contains = contains;\n CodeMirror.rmClass = rmClass;\n CodeMirror.keyNames = keyNames;\n }\n\n // EDITOR CONSTRUCTOR\n\n defineOptions(CodeMirror);\n\n addEditorMethods(CodeMirror);\n\n // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)\n { CodeMirror.prototype[prop] = (function(method) {\n return function() {return method.apply(this.doc, arguments)}\n })(Doc.prototype[prop]); } }\n\n eventMixin(Doc);\n CodeMirror.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n CodeMirror.defineMode = function(name/*, mode, …*/) {\n if (!CodeMirror.defaults.mode && name != \"null\") { CodeMirror.defaults.mode = name; }\n defineMode.apply(this, arguments);\n };\n\n CodeMirror.defineMIME = defineMIME;\n\n // Minimal default mode.\n CodeMirror.defineMode(\"null\", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });\n CodeMirror.defineMIME(\"text/plain\", \"null\");\n\n // EXTENSIONS\n\n CodeMirror.defineExtension = function (name, func) {\n CodeMirror.prototype[name] = func;\n };\n CodeMirror.defineDocExtension = function (name, func) {\n Doc.prototype[name] = func;\n };\n\n CodeMirror.fromTextArea = fromTextArea;\n\n addLegacyProps(CodeMirror);\n\n CodeMirror.version = \"5.59.2\";\n\n return CodeMirror;\n\n})));\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/codemirror/lib/codemirror.js?");
/***/ }),
/***/ "./node_modules/codemirror/mode/javascript/javascript.js":
/*!***************************************************************!*\
!*** ./node_modules/codemirror/mode/javascript/javascript.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
eval("// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(/*! ../../lib/codemirror */ \"./node_modules/codemirror/lib/codemirror.js\"));\n else {}\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"javascript\", function(config, parserConfig) {\n var indentUnit = config.indentUnit;\n var statementIndent = parserConfig.statementIndent;\n var jsonldMode = parserConfig.jsonld;\n var jsonMode = parserConfig.json || jsonldMode;\n var isTS = parserConfig.typescript;\n var wordRE = parserConfig.wordCharacters || /[\\w$\\xa1-\\uffff]/;\n\n // Tokenizer\n\n var keywords = function(){\n function kw(type) {return {type: type, style: \"keyword\"};}\n var A = kw(\"keyword a\"), B = kw(\"keyword b\"), C = kw(\"keyword c\"), D = kw(\"keyword d\");\n var operator = kw(\"operator\"), atom = {type: \"atom\", style: \"atom\"};\n\n return {\n \"if\": kw(\"if\"), \"while\": A, \"with\": A, \"else\": B, \"do\": B, \"try\": B, \"finally\": B,\n \"return\": D, \"break\": D, \"continue\": D, \"new\": kw(\"new\"), \"delete\": C, \"void\": C, \"throw\": C,\n \"debugger\": kw(\"debugger\"), \"var\": kw(\"var\"), \"const\": kw(\"var\"), \"let\": kw(\"var\"),\n \"function\": kw(\"function\"), \"catch\": kw(\"catch\"),\n \"for\": kw(\"for\"), \"switch\": kw(\"switch\"), \"case\": kw(\"case\"), \"default\": kw(\"default\"),\n \"in\": operator, \"typeof\": operator, \"instanceof\": operator,\n \"true\": atom, \"false\": atom, \"null\": atom, \"undefined\": atom, \"NaN\": atom, \"Infinity\": atom,\n \"this\": kw(\"this\"), \"class\": kw(\"class\"), \"super\": kw(\"atom\"),\n \"yield\": C, \"export\": kw(\"export\"), \"import\": kw(\"import\"), \"extends\": C,\n \"await\": C\n };\n }();\n\n var isOperatorChar = /[+\\-*&%=<>!?|~^@]/;\n var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/;\n\n function readRegexp(stream) {\n var escaped = false, next, inSet = false;\n while ((next = stream.next()) != null) {\n if (!escaped) {\n if (next == \"/\" && !inSet) return;\n if (next == \"[\") inSet = true;\n else if (inSet && next == \"]\") inSet = false;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n }\n\n // Used as scratch variables to communicate multiple values without\n // consing up tons of objects.\n var type, content;\n function ret(tp, style, cont) {\n type = tp; content = cont;\n return style;\n }\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (ch == '\"' || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \".\" && stream.match(/^\\d[\\d_]*(?:[eE][+\\-]?[\\d_]+)?/)) {\n return ret(\"number\", \"number\");\n } else if (ch == \".\" && stream.match(\"..\")) {\n return ret(\"spread\", \"meta\");\n } else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n return ret(ch);\n } else if (ch == \"=\" && stream.eat(\">\")) {\n return ret(\"=>\", \"operator\");\n } else if (ch == \"0\" && stream.match(/^(?:x[\\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {\n return ret(\"number\", \"number\");\n } else if (/\\d/.test(ch)) {\n stream.match(/^[\\d_]*(?:n|(?:\\.[\\d_]*)?(?:[eE][+\\-]?[\\d_]+)?)?/);\n return ret(\"number\", \"number\");\n } else if (ch == \"/\") {\n if (stream.eat(\"*\")) {\n state.tokenize = tokenComment;\n return tokenComment(stream, state);\n } else if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return ret(\"comment\", \"comment\");\n } else if (expressionAllowed(stream, state, 1)) {\n readRegexp(stream);\n stream.match(/^\\b(([gimyus])(?![gimyus]*\\2))+\\b/);\n return ret(\"regexp\", \"string-2\");\n } else {\n stream.eat(\"=\");\n return ret(\"operator\", \"operator\", stream.current());\n }\n } else if (ch == \"`\") {\n state.tokenize = tokenQuasi;\n return tokenQuasi(stream, state);\n } else if (ch == \"#\" && stream.peek() == \"!\") {\n stream.skipToEnd();\n return ret(\"meta\", \"meta\");\n } else if (ch == \"#\" && stream.eatWhile(wordRE)) {\n return ret(\"variable\", \"property\")\n } else if (ch == \"<\" && stream.match(\"!--\") ||\n (ch == \"-\" && stream.match(\"->\") && !/\\S/.test(stream.string.slice(0, stream.start)))) {\n stream.skipToEnd()\n return ret(\"comment\", \"comment\")\n } else if (isOperatorChar.test(ch)) {\n if (ch != \">\" || !state.lexical || state.lexical.type != \">\") {\n if (stream.eat(\"=\")) {\n if (ch == \"!\" || ch == \"=\") stream.eat(\"=\")\n } else if (/[<>*+\\-|&?]/.test(ch)) {\n stream.eat(ch)\n if (ch == \">\") stream.eat(ch)\n }\n }\n if (ch == \"?\" && stream.eat(\".\")) return ret(\".\")\n return ret(\"operator\", \"operator\", stream.current());\n } else if (wordRE.test(ch)) {\n stream.eatWhile(wordRE);\n var word = stream.current()\n if (state.lastType != \".\") {\n if (keywords.propertyIsEnumerable(word)) {\n var kw = keywords[word]\n return ret(kw.type, kw.style, word)\n }\n if (word == \"async\" && stream.match(/^(\\s|\\/\\*([^*]|\\*(?!\\/))*?\\*\\/)*[\\[\\(\\w]/, false))\n return ret(\"async\", \"keyword\", word)\n }\n return ret(\"variable\", \"variable\", word)\n }\n }\n\n function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, next;\n if (jsonldMode && stream.peek() == \"@\" && stream.match(isJsonldKeyword)){\n state.tokenize = tokenBase;\n return ret(\"jsonld-keyword\", \"meta\");\n }\n while ((next = stream.next()) != null) {\n if (next == quote && !escaped) break;\n escaped = !escaped && next == \"\\\\\";\n }\n if (!escaped) state.tokenize = tokenBase;\n return ret(\"string\", \"string\");\n };\n }\n\n function tokenComment(stream, state) {\n var maybeEnd = false, ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return ret(\"comment\", \"comment\");\n }\n\n function tokenQuasi(stream, state) {\n var escaped = false, next;\n while ((next = stream.next()) != null) {\n if (!escaped && (next == \"`\" || next == \"$\" && stream.eat(\"{\"))) {\n state.tokenize = tokenBase;\n break;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n return ret(\"quasi\", \"string-2\", stream.current());\n }\n\n var brackets = \"([{}])\";\n // This is a crude lookahead trick to try and notice that we're\n // parsing the argument patterns for a fat-arrow function before we\n // actually hit the arrow token. It only works if the arrow is on\n // the same line as the arguments and there's no strange noise\n // (comments) in between. Fallback is to only notice when we hit the\n // arrow, and not declare the arguments as locals for the arrow\n // body.\n function findFatArrow(stream, state) {\n if (state.fatArrowAt) state.fatArrowAt = null;\n var arrow = stream.string.indexOf(\"=>\", stream.start);\n if (arrow < 0) return;\n\n if (isTS) { // Try to skip TypeScript return type declarations after the arguments\n var m = /:\\s*(?:\\w+(?:<[^>]*>|\\[\\])?|\\{[^}]*\\})\\s*$/.exec(stream.string.slice(stream.start, arrow))\n if (m) arrow = m.index\n }\n\n var depth = 0, sawSomething = false;\n for (var pos = arrow - 1; pos >= 0; --pos) {\n var ch = stream.string.charAt(pos);\n var bracket = brackets.indexOf(ch);\n if (bracket >= 0 && bracket < 3) {\n if (!depth) { ++pos; break; }\n if (--depth == 0) { if (ch == \"(\") sawSomething = true; break; }\n } else if (bracket >= 3 && bracket < 6) {\n ++depth;\n } else if (wordRE.test(ch)) {\n sawSomething = true;\n } else if (/[\"'\\/`]/.test(ch)) {\n for (;; --pos) {\n if (pos == 0) return\n var next = stream.string.charAt(pos - 1)\n if (next == ch && stream.string.charAt(pos - 2) != \"\\\\\") { pos--; break }\n }\n } else if (sawSomething && !depth) {\n ++pos;\n break;\n }\n }\n if (sawSomething && !depth) state.fatArrowAt = pos;\n }\n\n // Parser\n\n var atomicTypes = {\"atom\": true, \"number\": true, \"variable\": true, \"string\": true, \"regexp\": true, \"this\": true, \"jsonld-keyword\": true};\n\n function JSLexical(indented, column, type, align, prev, info) {\n this.indented = indented;\n this.column = column;\n this.type = type;\n this.prev = prev;\n this.info = info;\n if (align != null) this.align = align;\n }\n\n function inScope(state, varname) {\n for (var v = state.localVars; v; v = v.next)\n if (v.name == varname) return true;\n for (var cx = state.context; cx; cx = cx.prev) {\n for (var v = cx.vars; v; v = v.next)\n if (v.name == varname) return true;\n }\n }\n\n function parseJS(state, style, type, content, stream) {\n var cc = state.cc;\n // Communicate our context to the combinators.\n // (Less wasteful than consing up a hundred closures on every call.)\n cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;\n\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = true;\n\n while(true) {\n var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;\n if (combinator(type, content)) {\n while(cc.length && cc[cc.length - 1].lex)\n cc.pop()();\n if (cx.marked) return cx.marked;\n if (type == \"variable\" && inScope(state, content)) return \"variable-2\";\n return style;\n }\n }\n }\n\n // Combinator utils\n\n var cx = {state: null, column: null, marked: null, cc: null};\n function pass() {\n for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);\n }\n function cont() {\n pass.apply(null, arguments);\n return true;\n }\n function inList(name, list) {\n for (var v = list; v; v = v.next) if (v.name == name) return true\n return false;\n }\n function register(varname) {\n var state = cx.state;\n cx.marked = \"def\";\n if (state.context) {\n if (state.lexical.info == \"var\" && state.context && state.context.block) {\n // FIXME function decls are also not block scoped\n var newContext = registerVarScoped(varname, state.context)\n if (newContext != null) {\n state.context = newContext\n return\n }\n } else if (!inList(varname, state.localVars)) {\n state.localVars = new Var(varname, state.localVars)\n return\n }\n }\n // Fall through means this is global\n if (parserConfig.globalVars && !inList(varname, state.globalVars))\n state.globalVars = new Var(varname, state.globalVars)\n }\n function registerVarScoped(varname, context) {\n if (!context) {\n return null\n } else if (context.block) {\n var inner = registerVarScoped(varname, context.prev)\n if (!inner) return null\n if (inner == context.prev) return context\n return new Context(inner, context.vars, true)\n } else if (inList(varname, context.vars)) {\n return context\n } else {\n return new Context(context.prev, new Var(varname, context.vars), false)\n }\n }\n\n function isModifier(name) {\n return name == \"public\" || name == \"private\" || name == \"protected\" || name == \"abstract\" || name == \"readonly\"\n }\n\n // Combinators\n\n function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }\n function Var(name, next) { this.name = name; this.next = next }\n\n var defaultVars = new Var(\"this\", new Var(\"arguments\", null))\n function pushcontext() {\n cx.state.context = new Context(cx.state.context, cx.state.localVars, false)\n cx.state.localVars = defaultVars\n }\n function pushblockcontext() {\n cx.state.context = new Context(cx.state.context, cx.state.localVars, true)\n cx.state.localVars = null\n }\n function popcontext() {\n cx.state.localVars = cx.state.context.vars\n cx.state.context = cx.state.context.prev\n }\n popcontext.lex = true\n function pushlex(type, info) {\n var result = function() {\n var state = cx.state, indent = state.indented;\n if (state.lexical.type == \"stat\") indent = state.lexical.indented;\n else for (var outer = state.lexical; outer && outer.type == \")\" && outer.align; outer = outer.prev)\n indent = outer.indented;\n state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);\n };\n result.lex = true;\n return result;\n }\n function poplex() {\n var state = cx.state;\n if (state.lexical.prev) {\n if (state.lexical.type == \")\")\n state.indented = state.lexical.indented;\n state.lexical = state.lexical.prev;\n }\n }\n poplex.lex = true;\n\n function expect(wanted) {\n function exp(type) {\n if (type == wanted) return cont();\n else if (wanted == \";\" || type == \"}\" || type == \")\" || type == \"]\") return pass();\n else return cont(exp);\n };\n return exp;\n }\n\n function statement(type, value) {\n if (type == \"var\") return cont(pushlex(\"vardef\", value), vardef, expect(\";\"), poplex);\n if (type == \"keyword a\") return cont(pushlex(\"form\"), parenExpr, statement, poplex);\n if (type == \"keyword b\") return cont(pushlex(\"form\"), statement, poplex);\n if (type == \"keyword d\") return cx.stream.match(/^\\s*$/, false) ? cont() : cont(pushlex(\"stat\"), maybeexpression, expect(\";\"), poplex);\n if (type == \"debugger\") return cont(expect(\";\"));\n if (type == \"{\") return cont(pushlex(\"}\"), pushblockcontext, block, poplex, popcontext);\n if (type == \";\") return cont();\n if (type == \"if\") {\n if (cx.state.lexical.info == \"else\" && cx.state.cc[cx.state.cc.length - 1] == poplex)\n cx.state.cc.pop()();\n return cont(pushlex(\"form\"), parenExpr, statement, poplex, maybeelse);\n }\n if (type == \"function\") return cont(functiondef);\n if (type == \"for\") return cont(pushlex(\"form\"), forspec, statement, poplex);\n if (type == \"class\" || (isTS && value == \"interface\")) {\n cx.marked = \"keyword\"\n return cont(pushlex(\"form\", type == \"class\" ? type : value), className, poplex)\n }\n if (type == \"variable\") {\n if (isTS && value == \"declare\") {\n cx.marked = \"keyword\"\n return cont(statement)\n } else if (isTS && (value == \"module\" || value == \"enum\" || value == \"type\") && cx.stream.match(/^\\s*\\w/, false)) {\n cx.marked = \"keyword\"\n if (value == \"enum\") return cont(enumdef);\n else if (value == \"type\") return cont(typename, expect(\"operator\"), typeexpr, expect(\";\"));\n else return cont(pushlex(\"form\"), pattern, expect(\"{\"), pushlex(\"}\"), block, poplex, poplex)\n } else if (isTS && value == \"namespace\") {\n cx.marked = \"keyword\"\n return cont(pushlex(\"form\"), expression, statement, poplex)\n } else if (isTS && value == \"abstract\") {\n cx.marked = \"keyword\"\n return cont(statement)\n } else {\n return cont(pushlex(\"stat\"), maybelabel);\n }\n }\n if (type == \"switch\") return cont(pushlex(\"form\"), parenExpr, expect(\"{\"), pushlex(\"}\", \"switch\"), pushblockcontext,\n block, poplex, poplex, popcontext);\n if (type == \"case\") return cont(expression, expect(\":\"));\n if (type == \"default\") return cont(expect(\":\"));\n if (type == \"catch\") return cont(pushlex(\"form\"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);\n if (type == \"export\") return cont(pushlex(\"stat\"), afterExport, poplex);\n if (type == \"import\") return cont(pushlex(\"stat\"), afterImport, poplex);\n if (type == \"async\") return cont(statement)\n if (value == \"@\") return cont(expression, statement)\n return pass(pushlex(\"stat\"), expression, expect(\";\"), poplex);\n }\n function maybeCatchBinding(type) {\n if (type == \"(\") return cont(funarg, expect(\")\"))\n }\n function expression(type, value) {\n return expressionInner(type, value, false);\n }\n function expressionNoComma(type, value) {\n return expressionInner(type, value, true);\n }\n function parenExpr(type) {\n if (type != \"(\") return pass()\n return cont(pushlex(\")\"), maybeexpression, expect(\")\"), poplex)\n }\n function expressionInner(type, value, noComma) {\n if (cx.state.fatArrowAt == cx.stream.start) {\n var body = noComma ? arrowBodyNoComma : arrowBody;\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, expect(\"=>\"), body, popcontext);\n else if (type == \"variable\") return pass(pushcontext, pattern, expect(\"=>\"), body, popcontext);\n }\n\n var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;\n if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);\n if (type == \"function\") return cont(functiondef, maybeop);\n if (type == \"class\" || (isTS && value == \"interface\")) { cx.marked = \"keyword\"; return cont(pushlex(\"form\"), classExpression, poplex); }\n if (type == \"keyword c\" || type == \"async\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"(\") return cont(pushlex(\")\"), maybeexpression, expect(\")\"), poplex, maybeop);\n if (type == \"operator\" || type == \"spread\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"[\") return cont(pushlex(\"]\"), arrayLiteral, poplex, maybeop);\n if (type == \"{\") return contCommasep(objprop, \"}\", null, maybeop);\n if (type == \"quasi\") return pass(quasi, maybeop);\n if (type == \"new\") return cont(maybeTarget(noComma));\n if (type == \"import\") return cont(expression);\n return cont();\n }\n function maybeexpression(type) {\n if (type.match(/[;\\}\\)\\],]/)) return pass();\n return pass(expression);\n }\n\n function maybeoperatorComma(type, value) {\n if (type == \",\") return cont(maybeexpression);\n return maybeoperatorNoComma(type, value, false);\n }\n function maybeoperatorNoComma(type, value, noComma) {\n var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;\n var expr = noComma == false ? expression : expressionNoComma;\n if (type == \"=>\") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);\n if (type == \"operator\") {\n if (/\\+\\+|--/.test(value) || isTS && value == \"!\") return cont(me);\n if (isTS && value == \"<\" && cx.stream.match(/^([^<>]|<[^<>]*>)*>\\s*\\(/, false))\n return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, me);\n if (value == \"?\") return cont(expression, expect(\":\"), expr);\n return cont(expr);\n }\n if (type == \"quasi\") { return pass(quasi, me); }\n if (type == \";\") return;\n if (type == \"(\") return contCommasep(expressionNoComma, \")\", \"call\", me);\n if (type == \".\") return cont(property, me);\n if (type == \"[\") return cont(pushlex(\"]\"), maybeexpression, expect(\"]\"), poplex, me);\n if (isTS && value == \"as\") { cx.marked = \"keyword\"; return cont(typeexpr, me) }\n if (type == \"regexp\") {\n cx.state.lastType = cx.marked = \"operator\"\n cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)\n return cont(expr)\n }\n }\n function quasi(type, value) {\n if (type != \"quasi\") return pass();\n if (value.slice(value.length - 2) != \"${\") return cont(quasi);\n return cont(expression, continueQuasi);\n }\n function continueQuasi(type) {\n if (type == \"}\") {\n cx.marked = \"string-2\";\n cx.state.tokenize = tokenQuasi;\n return cont(quasi);\n }\n }\n function arrowBody(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expression);\n }\n function arrowBodyNoComma(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expressionNoComma);\n }\n function maybeTarget(noComma) {\n return function(type) {\n if (type == \".\") return cont(noComma ? targetNoComma : target);\n else if (type == \"variable\" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)\n else return pass(noComma ? expressionNoComma : expression);\n };\n }\n function target(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorComma); }\n }\n function targetNoComma(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorNoComma); }\n }\n function maybelabel(type) {\n if (type == \":\") return cont(poplex, statement);\n return pass(maybeoperatorComma, expect(\";\"), poplex);\n }\n function property(type) {\n if (type == \"variable\") {cx.marked = \"property\"; return cont();}\n }\n function objprop(type, value) {\n if (type == \"async\") {\n cx.marked = \"property\";\n return cont(objprop);\n } else if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n if (value == \"get\" || value == \"set\") return cont(getterSetter);\n var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params\n if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\\s*:\\s*/, false)))\n cx.state.fatArrowAt = cx.stream.pos + m[0].length\n return cont(afterprop);\n } else if (type == \"number\" || type == \"string\") {\n cx.marked = jsonldMode ? \"property\" : (cx.style + \" property\");\n return cont(afterprop);\n } else if (type == \"jsonld-keyword\") {\n return cont(afterprop);\n } else if (isTS && isModifier(value)) {\n cx.marked = \"keyword\"\n return cont(objprop)\n } else if (type == \"[\") {\n return cont(expression, maybetype, expect(\"]\"), afterprop);\n } else if (type == \"spread\") {\n return cont(expressionNoComma, afterprop);\n } else if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(objprop);\n } else if (type == \":\") {\n return pass(afterprop)\n }\n }\n function getterSetter(type) {\n if (type != \"variable\") return pass(afterprop);\n cx.marked = \"property\";\n return cont(functiondef);\n }\n function afterprop(type) {\n if (type == \":\") return cont(expressionNoComma);\n if (type == \"(\") return pass(functiondef);\n }\n function commasep(what, end, sep) {\n function proceed(type, value) {\n if (sep ? sep.indexOf(type) > -1 : type == \",\") {\n var lex = cx.state.lexical;\n if (lex.info == \"call\") lex.pos = (lex.pos || 0) + 1;\n return cont(function(type, value) {\n if (type == end || value == end) return pass()\n return pass(what)\n }, proceed);\n }\n if (type == end || value == end) return cont();\n if (sep && sep.indexOf(\";\") > -1) return pass(what)\n return cont(expect(end));\n }\n return function(type, value) {\n if (type == end || value == end) return cont();\n return pass(what, proceed);\n };\n }\n function contCommasep(what, end, info) {\n for (var i = 3; i < arguments.length; i++)\n cx.cc.push(arguments[i]);\n return cont(pushlex(end, info), commasep(what, end), poplex);\n }\n function block(type) {\n if (type == \"}\") return cont();\n return pass(statement, block);\n }\n function maybetype(type, value) {\n if (isTS) {\n if (type == \":\") return cont(typeexpr);\n if (value == \"?\") return cont(maybetype);\n }\n }\n function maybetypeOrIn(type, value) {\n if (isTS && (type == \":\" || value == \"in\")) return cont(typeexpr)\n }\n function mayberettype(type) {\n if (isTS && type == \":\") {\n if (cx.stream.match(/^\\s*\\w+\\s+is\\b/, false)) return cont(expression, isKW, typeexpr)\n else return cont(typeexpr)\n }\n }\n function isKW(_, value) {\n if (value == \"is\") {\n cx.marked = \"keyword\"\n return cont()\n }\n }\n function typeexpr(type, value) {\n if (value == \"keyof\" || value == \"typeof\" || value == \"infer\") {\n cx.marked = \"keyword\"\n return cont(value == \"typeof\" ? expressionNoComma : typeexpr)\n }\n if (type == \"variable\" || value == \"void\") {\n cx.marked = \"type\"\n return cont(afterType)\n }\n if (value == \"|\" || value == \"&\") return cont(typeexpr)\n if (type == \"string\" || type == \"number\" || type == \"atom\") return cont(afterType);\n if (type == \"[\") return cont(pushlex(\"]\"), commasep(typeexpr, \"]\", \",\"), poplex, afterType)\n if (type == \"{\") return cont(pushlex(\"}\"), typeprops, poplex, afterType)\n if (type == \"(\") return cont(commasep(typearg, \")\"), maybeReturnType, afterType)\n if (type == \"<\") return cont(commasep(typeexpr, \">\"), typeexpr)\n }\n function maybeReturnType(type) {\n if (type == \"=>\") return cont(typeexpr)\n }\n function typeprops(type) {\n if (type.match(/[\\}\\)\\]]/)) return cont()\n if (type == \",\" || type == \";\") return cont(typeprops)\n return pass(typeprop, typeprops)\n }\n function typeprop(type, value) {\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\"\n return cont(typeprop)\n } else if (value == \"?\" || type == \"number\" || type == \"string\") {\n return cont(typeprop)\n } else if (type == \":\") {\n return cont(typeexpr)\n } else if (type == \"[\") {\n return cont(expect(\"variable\"), maybetypeOrIn, expect(\"]\"), typeprop)\n } else if (type == \"(\") {\n return pass(functiondecl, typeprop)\n } else if (!type.match(/[;\\}\\)\\],]/)) {\n return cont()\n }\n }\n function typearg(type, value) {\n if (type == \"variable\" && cx.stream.match(/^\\s*[?:]/, false) || value == \"?\") return cont(typearg)\n if (type == \":\") return cont(typeexpr)\n if (type == \"spread\") return cont(typearg)\n return pass(typeexpr)\n }\n function afterType(type, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, afterType)\n if (value == \"|\" || type == \".\" || value == \"&\") return cont(typeexpr)\n if (type == \"[\") return cont(typeexpr, expect(\"]\"), afterType)\n if (value == \"extends\" || value == \"implements\") { cx.marked = \"keyword\"; return cont(typeexpr) }\n if (value == \"?\") return cont(typeexpr, expect(\":\"), typeexpr)\n }\n function maybeTypeArgs(_, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, afterType)\n }\n function typeparam() {\n return pass(typeexpr, maybeTypeDefault)\n }\n function maybeTypeDefault(_, value) {\n if (value == \"=\") return cont(typeexpr)\n }\n function vardef(_, value) {\n if (value == \"enum\") {cx.marked = \"keyword\"; return cont(enumdef)}\n return pass(pattern, maybetype, maybeAssign, vardefCont);\n }\n function pattern(type, value) {\n if (isTS && isModifier(value)) { cx.marked = \"keyword\"; return cont(pattern) }\n if (type == \"variable\") { register(value); return cont(); }\n if (type == \"spread\") return cont(pattern);\n if (type == \"[\") return contCommasep(eltpattern, \"]\");\n if (type == \"{\") return contCommasep(proppattern, \"}\");\n }\n function proppattern(type, value) {\n if (type == \"variable\" && !cx.stream.match(/^\\s*:/, false)) {\n register(value);\n return cont(maybeAssign);\n }\n if (type == \"variable\") cx.marked = \"property\";\n if (type == \"spread\") return cont(pattern);\n if (type == \"}\") return pass();\n if (type == \"[\") return cont(expression, expect(']'), expect(':'), proppattern);\n return cont(expect(\":\"), pattern, maybeAssign);\n }\n function eltpattern() {\n return pass(pattern, maybeAssign)\n }\n function maybeAssign(_type, value) {\n if (value == \"=\") return cont(expressionNoComma);\n }\n function vardefCont(type) {\n if (type == \",\") return cont(vardef);\n }\n function maybeelse(type, value) {\n if (type == \"keyword b\" && value == \"else\") return cont(pushlex(\"form\", \"else\"), statement, poplex);\n }\n function forspec(type, value) {\n if (value == \"await\") return cont(forspec);\n if (type == \"(\") return cont(pushlex(\")\"), forspec1, poplex);\n }\n function forspec1(type) {\n if (type == \"var\") return cont(vardef, forspec2);\n if (type == \"variable\") return cont(forspec2);\n return pass(forspec2)\n }\n function forspec2(type, value) {\n if (type == \")\") return cont()\n if (type == \";\") return cont(forspec2)\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression, forspec2) }\n return pass(expression, forspec2)\n }\n function functiondef(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondef);}\n if (type == \"variable\") {register(value); return cont(functiondef);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, mayberettype, statement, popcontext);\n if (isTS && value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, functiondef)\n }\n function functiondecl(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondecl);}\n if (type == \"variable\") {register(value); return cont(functiondecl);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, mayberettype, popcontext);\n if (isTS && value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, functiondecl)\n }\n function typename(type, value) {\n if (type == \"keyword\" || type == \"variable\") {\n cx.marked = \"type\"\n return cont(typename)\n } else if (value == \"<\") {\n return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex)\n }\n }\n function funarg(type, value) {\n if (value == \"@\") cont(expression, funarg)\n if (type == \"spread\") return cont(funarg);\n if (isTS && isModifier(value)) { cx.marked = \"keyword\"; return cont(funarg); }\n if (isTS && type == \"this\") return cont(maybetype, maybeAssign)\n return pass(pattern, maybetype, maybeAssign);\n }\n function classExpression(type, value) {\n // Class expressions may have an optional name.\n if (type == \"variable\") return className(type, value);\n return classNameAfter(type, value);\n }\n function className(type, value) {\n if (type == \"variable\") {register(value); return cont(classNameAfter);}\n }\n function classNameAfter(type, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeparam, \">\"), poplex, classNameAfter)\n if (value == \"extends\" || value == \"implements\" || (isTS && type == \",\")) {\n if (value == \"implements\") cx.marked = \"keyword\";\n return cont(isTS ? typeexpr : expression, classNameAfter);\n }\n if (type == \"{\") return cont(pushlex(\"}\"), classBody, poplex);\n }\n function classBody(type, value) {\n if (type == \"async\" ||\n (type == \"variable\" &&\n (value == \"static\" || value == \"get\" || value == \"set\" || (isTS && isModifier(value))) &&\n cx.stream.match(/^\\s+[\\w$\\xa1-\\uffff]/, false))) {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n return cont(classfield, classBody);\n }\n if (type == \"number\" || type == \"string\") return cont(classfield, classBody);\n if (type == \"[\")\n return cont(expression, maybetype, expect(\"]\"), classfield, classBody)\n if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (isTS && type == \"(\") return pass(functiondecl, classBody)\n if (type == \";\" || type == \",\") return cont(classBody);\n if (type == \"}\") return cont();\n if (value == \"@\") return cont(expression, classBody)\n }\n function classfield(type, value) {\n if (value == \"?\") return cont(classfield)\n if (type == \":\") return cont(typeexpr, maybeAssign)\n if (value == \"=\") return cont(expressionNoComma)\n var context = cx.state.lexical.prev, isInterface = context && context.info == \"interface\"\n return pass(isInterface ? functiondecl : functiondef)\n }\n function afterExport(type, value) {\n if (value == \"*\") { cx.marked = \"keyword\"; return cont(maybeFrom, expect(\";\")); }\n if (value == \"default\") { cx.marked = \"keyword\"; return cont(expression, expect(\";\")); }\n if (type == \"{\") return cont(commasep(exportField, \"}\"), maybeFrom, expect(\";\"));\n return pass(statement);\n }\n function exportField(type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(expect(\"variable\")); }\n if (type == \"variable\") return pass(expressionNoComma, exportField);\n }\n function afterImport(type) {\n if (type == \"string\") return cont();\n if (type == \"(\") return pass(expression);\n return pass(importSpec, maybeMoreImports, maybeFrom);\n }\n function importSpec(type, value) {\n if (type == \"{\") return contCommasep(importSpec, \"}\");\n if (type == \"variable\") register(value);\n if (value == \"*\") cx.marked = \"keyword\";\n return cont(maybeAs);\n }\n function maybeMoreImports(type) {\n if (type == \",\") return cont(importSpec, maybeMoreImports)\n }\n function maybeAs(_type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(importSpec); }\n }\n function maybeFrom(_type, value) {\n if (value == \"from\") { cx.marked = \"keyword\"; return cont(expression); }\n }\n function arrayLiteral(type) {\n if (type == \"]\") return cont();\n return pass(commasep(expressionNoComma, \"]\"));\n }\n function enumdef() {\n return pass(pushlex(\"form\"), pattern, expect(\"{\"), pushlex(\"}\"), commasep(enummember, \"}\"), poplex, poplex)\n }\n function enummember() {\n return pass(pattern, maybeAssign);\n }\n\n function isContinuedStatement(state, textAfter) {\n return state.lastType == \"operator\" || state.lastType == \",\" ||\n isOperatorChar.test(textAfter.charAt(0)) ||\n /[,.]/.test(textAfter.charAt(0));\n }\n\n function expressionAllowed(stream, state, backUp) {\n return state.tokenize == tokenBase &&\n /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\\[{}\\(,;:]|=>)$/.test(state.lastType) ||\n (state.lastType == \"quasi\" && /\\{\\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))\n }\n\n // Interface\n\n return {\n startState: function(basecolumn) {\n var state = {\n tokenize: tokenBase,\n lastType: \"sof\",\n cc: [],\n lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, \"block\", false),\n localVars: parserConfig.localVars,\n context: parserConfig.localVars && new Context(null, null, false),\n indented: basecolumn || 0\n };\n if (parserConfig.globalVars && typeof parserConfig.globalVars == \"object\")\n state.globalVars = parserConfig.globalVars;\n return state;\n },\n\n token: function(stream, state) {\n if (stream.sol()) {\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = false;\n state.indented = stream.indentation();\n findFatArrow(stream, state);\n }\n if (state.tokenize != tokenComment && stream.eatSpace()) return null;\n var style = state.tokenize(stream, state);\n if (type == \"comment\") return style;\n state.lastType = type == \"operator\" && (content == \"++\" || content == \"--\") ? \"incdec\" : type;\n return parseJS(state, style, type, content, stream);\n },\n\n indent: function(state, textAfter) {\n if (state.tokenize == tokenComment || state.tokenize == tokenQuasi) return CodeMirror.Pass;\n if (state.tokenize != tokenBase) return 0;\n var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top\n // Kludge to prevent 'maybelse' from blocking lexical scope pops\n if (!/^\\s*else\\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {\n var c = state.cc[i];\n if (c == poplex) lexical = lexical.prev;\n else if (c != maybeelse) break;\n }\n while ((lexical.type == \"stat\" || lexical.type == \"form\") &&\n (firstChar == \"}\" || ((top = state.cc[state.cc.length - 1]) &&\n (top == maybeoperatorComma || top == maybeoperatorNoComma) &&\n !/^[,\\.=+\\-*:?[\\(]/.test(textAfter))))\n lexical = lexical.prev;\n if (statementIndent && lexical.type == \")\" && lexical.prev.type == \"stat\")\n lexical = lexical.prev;\n var type = lexical.type, closing = firstChar == type;\n\n if (type == \"vardef\") return lexical.indented + (state.lastType == \"operator\" || state.lastType == \",\" ? lexical.info.length + 1 : 0);\n else if (type == \"form\" && firstChar == \"{\") return lexical.indented;\n else if (type == \"form\") return lexical.indented + indentUnit;\n else if (type == \"stat\")\n return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);\n else if (lexical.info == \"switch\" && !closing && parserConfig.doubleIndentSwitch != false)\n return lexical.indented + (/^(?:case|default)\\b/.test(textAfter) ? indentUnit : 2 * indentUnit);\n else if (lexical.align) return lexical.column + (closing ? 0 : 1);\n else return lexical.indented + (closing ? 0 : indentUnit);\n },\n\n electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\n blockCommentStart: jsonMode ? null : \"/*\",\n blockCommentEnd: jsonMode ? null : \"*/\",\n blockCommentContinue: jsonMode ? null : \" * \",\n lineComment: jsonMode ? null : \"//\",\n fold: \"brace\",\n closeBrackets: \"()[]{}''\\\"\\\"``\",\n\n helperType: jsonMode ? \"json\" : \"javascript\",\n jsonldMode: jsonldMode,\n jsonMode: jsonMode,\n\n expressionAllowed: expressionAllowed,\n\n skipExpression: function(state) {\n var top = state.cc[state.cc.length - 1]\n if (top == expression || top == expressionNoComma) state.cc.pop()\n }\n };\n});\n\nCodeMirror.registerHelper(\"wordChars\", \"javascript\", /[\\w$]/);\n\nCodeMirror.defineMIME(\"text/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"text/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/x-javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/json\", { name: \"javascript\", json: true });\nCodeMirror.defineMIME(\"application/x-json\", { name: \"javascript\", json: true });\nCodeMirror.defineMIME(\"application/manifest+json\", { name: \"javascript\", json: true })\nCodeMirror.defineMIME(\"application/ld+json\", { name: \"javascript\", jsonld: true });\nCodeMirror.defineMIME(\"text/typescript\", { name: \"javascript\", typescript: true });\nCodeMirror.defineMIME(\"application/typescript\", { name: \"javascript\", typescript: true });\n\n});\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/codemirror/mode/javascript/javascript.js?");
/***/ }),
/***/ "./node_modules/codemirror/mode/lua/lua.js":
/*!*************************************************!*\
!*** ./node_modules/codemirror/mode/lua/lua.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
eval("// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's\n// CodeMirror 1 mode.\n// highlights keywords, strings, comments (no leveling supported! (\"[==[\")), tokens, basic indenting\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(/*! ../../lib/codemirror */ \"./node_modules/codemirror/lib/codemirror.js\"));\n else {}\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"lua\", function(config, parserConfig) {\n var indentUnit = config.indentUnit;\n\n function prefixRE(words) {\n return new RegExp(\"^(?:\" + words.join(\"|\") + \")\", \"i\");\n }\n function wordRE(words) {\n return new RegExp(\"^(?:\" + words.join(\"|\") + \")$\", \"i\");\n }\n var specials = wordRE(parserConfig.specials || []);\n\n // long list of standard functions from lua manual\n var builtins = wordRE([\n \"_G\",\"_VERSION\",\"assert\",\"collectgarbage\",\"dofile\",\"error\",\"getfenv\",\"getmetatable\",\"ipairs\",\"load\",\n \"loadfile\",\"loadstring\",\"module\",\"next\",\"pairs\",\"pcall\",\"print\",\"rawequal\",\"rawget\",\"rawset\",\"require\",\n \"select\",\"setfenv\",\"setmetatable\",\"tonumber\",\"tostring\",\"type\",\"unpack\",\"xpcall\",\n\n \"coroutine.create\",\"coroutine.resume\",\"coroutine.running\",\"coroutine.status\",\"coroutine.wrap\",\"coroutine.yield\",\n\n \"debug.debug\",\"debug.getfenv\",\"debug.gethook\",\"debug.getinfo\",\"debug.getlocal\",\"debug.getmetatable\",\n \"debug.getregistry\",\"debug.getupvalue\",\"debug.setfenv\",\"debug.sethook\",\"debug.setlocal\",\"debug.setmetatable\",\n \"debug.setupvalue\",\"debug.traceback\",\n\n \"close\",\"flush\",\"lines\",\"read\",\"seek\",\"setvbuf\",\"write\",\n\n \"io.close\",\"io.flush\",\"io.input\",\"io.lines\",\"io.open\",\"io.output\",\"io.popen\",\"io.read\",\"io.stderr\",\"io.stdin\",\n \"io.stdout\",\"io.tmpfile\",\"io.type\",\"io.write\",\n\n \"math.abs\",\"math.acos\",\"math.asin\",\"math.atan\",\"math.atan2\",\"math.ceil\",\"math.cos\",\"math.cosh\",\"math.deg\",\n \"math.exp\",\"math.floor\",\"math.fmod\",\"math.frexp\",\"math.huge\",\"math.ldexp\",\"math.log\",\"math.log10\",\"math.max\",\n \"math.min\",\"math.modf\",\"math.pi\",\"math.pow\",\"math.rad\",\"math.random\",\"math.randomseed\",\"math.sin\",\"math.sinh\",\n \"math.sqrt\",\"math.tan\",\"math.tanh\",\n\n \"os.clock\",\"os.date\",\"os.difftime\",\"os.execute\",\"os.exit\",\"os.getenv\",\"os.remove\",\"os.rename\",\"os.setlocale\",\n \"os.time\",\"os.tmpname\",\n\n \"package.cpath\",\"package.loaded\",\"package.loaders\",\"package.loadlib\",\"package.path\",\"package.preload\",\n \"package.seeall\",\n\n \"string.byte\",\"string.char\",\"string.dump\",\"string.find\",\"string.format\",\"string.gmatch\",\"string.gsub\",\n \"string.len\",\"string.lower\",\"string.match\",\"string.rep\",\"string.reverse\",\"string.sub\",\"string.upper\",\n\n \"table.concat\",\"table.insert\",\"table.maxn\",\"table.remove\",\"table.sort\"\n ]);\n var keywords = wordRE([\"and\",\"break\",\"elseif\",\"false\",\"nil\",\"not\",\"or\",\"return\",\n \"true\",\"function\", \"end\", \"if\", \"then\", \"else\", \"do\",\n \"while\", \"repeat\", \"until\", \"for\", \"in\", \"local\" ]);\n\n var indentTokens = wordRE([\"function\", \"if\",\"repeat\",\"do\", \"\\\\(\", \"{\"]);\n var dedentTokens = wordRE([\"end\", \"until\", \"\\\\)\", \"}\"]);\n var dedentPartial = prefixRE([\"end\", \"until\", \"\\\\)\", \"}\", \"else\", \"elseif\"]);\n\n function readBracket(stream) {\n var level = 0;\n while (stream.eat(\"=\")) ++level;\n stream.eat(\"[\");\n return level;\n }\n\n function normal(stream, state) {\n var ch = stream.next();\n if (ch == \"-\" && stream.eat(\"-\")) {\n if (stream.eat(\"[\") && stream.eat(\"[\"))\n return (state.cur = bracketed(readBracket(stream), \"comment\"))(stream, state);\n stream.skipToEnd();\n return \"comment\";\n }\n if (ch == \"\\\"\" || ch == \"'\")\n return (state.cur = string(ch))(stream, state);\n if (ch == \"[\" && /[\\[=]/.test(stream.peek()))\n return (state.cur = bracketed(readBracket(stream), \"string\"))(stream, state);\n if (/\\d/.test(ch)) {\n stream.eatWhile(/[\\w.%]/);\n return \"number\";\n }\n if (/[\\w_]/.test(ch)) {\n stream.eatWhile(/[\\w\\\\\\-_.]/);\n return \"variable\";\n }\n return null;\n }\n\n function bracketed(level, style) {\n return function(stream, state) {\n var curlev = null, ch;\n while ((ch = stream.next()) != null) {\n if (curlev == null) {if (ch == \"]\") curlev = 0;}\n else if (ch == \"=\") ++curlev;\n else if (ch == \"]\" && curlev == level) { state.cur = normal; break; }\n else curlev = null;\n }\n return style;\n };\n }\n\n function string(quote) {\n return function(stream, state) {\n var escaped = false, ch;\n while ((ch = stream.next()) != null) {\n if (ch == quote && !escaped) break;\n escaped = !escaped && ch == \"\\\\\";\n }\n if (!escaped) state.cur = normal;\n return \"string\";\n };\n }\n\n return {\n startState: function(basecol) {\n return {basecol: basecol || 0, indentDepth: 0, cur: normal};\n },\n\n token: function(stream, state) {\n if (stream.eatSpace()) return null;\n var style = state.cur(stream, state);\n var word = stream.current();\n if (style == \"variable\") {\n if (keywords.test(word)) style = \"keyword\";\n else if (builtins.test(word)) style = \"builtin\";\n else if (specials.test(word)) style = \"variable-2\";\n }\n if ((style != \"comment\") && (style != \"string\")){\n if (indentTokens.test(word)) ++state.indentDepth;\n else if (dedentTokens.test(word)) --state.indentDepth;\n }\n return style;\n },\n\n indent: function(state, textAfter) {\n var closing = dedentPartial.test(textAfter);\n return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0));\n },\n\n lineComment: \"--\",\n blockCommentStart: \"--[[\",\n blockCommentEnd: \"]]\"\n };\n});\n\nCodeMirror.defineMIME(\"text/x-lua\", \"lua\");\n\n});\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/codemirror/mode/lua/lua.js?");
/***/ }),
/***/ "./node_modules/css-loader/dist/runtime/api.js":
/*!*****************************************************!*\
!*** ./node_modules/css-loader/dist/runtime/api.js ***!
\*****************************************************/
/***/ ((module) => {
"use strict";
eval("\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (useSourceMap) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item, useSourceMap);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join('');\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === 'string') {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, '']];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring\n\n var cssMapping = item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (useSourceMap && typeof btoa === 'function') {\n var sourceMapping = toComment(cssMapping);\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || '').concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n }\n\n return [content].join('\\n');\n} // Adapted from convert-source-map (MIT)\n\n\nfunction toComment(sourceMap) {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n return \"/*# \".concat(data, \" */\");\n}\n\n//# sourceURL=webpack://ticparse.js/./node_modules/css-loader/dist/runtime/api.js?");
/***/ }),
/***/ "./node_modules/css-loader/dist/runtime/getUrl.js":
/*!********************************************************!*\
!*** ./node_modules/css-loader/dist/runtime/getUrl.js ***!
\********************************************************/
/***/ ((module) => {
"use strict";
eval("\n\nmodule.exports = function (url, options) {\n if (!options) {\n // eslint-disable-next-line no-param-reassign\n options = {};\n } // eslint-disable-next-line no-underscore-dangle, no-param-reassign\n\n\n url = url && url.__esModule ? url.default : url;\n\n if (typeof url !== 'string') {\n return url;\n } // If url is already wrapped in quotes, remove them\n\n\n if (/^['\"].*['\"]$/.test(url)) {\n // eslint-disable-next-line no-param-reassign\n url = url.slice(1, -1);\n }\n\n if (options.hash) {\n // eslint-disable-next-line no-param-reassign\n url += options.hash;\n } // Should url be wrapped?\n // See https://drafts.csswg.org/css-values-3/#urls\n\n\n if (/[\"'() \\t\\n]/.test(url) || options.needQuotes) {\n return \"\\\"\".concat(url.replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n'), \"\\\"\");\n }\n\n return url;\n};\n\n//# sourceURL=webpack://ticparse.js/./node_modules/css-loader/dist/runtime/getUrl.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/array.js":
/*!************************************************!*\
!*** ./node_modules/d3-selection/src/array.js ***!
\************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/array.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/constant.js":
/*!***************************************************!*\
!*** ./node_modules/d3-selection/src/constant.js ***!
\***************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(x) {\n return function() {\n return x;\n };\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/constant.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/creator.js":
/*!**************************************************!*\
!*** ./node_modules/d3-selection/src/creator.js ***!
\**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./namespace.js */ \"./node_modules/d3-selection/src/namespace.js\");\n/* harmony import */ var _namespaces_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./namespaces.js */ \"./node_modules/d3-selection/src/namespaces.js\");\n\n\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === _namespaces_js__WEBPACK_IMPORTED_MODULE_0__.xhtml && document.documentElement.namespaceURI === _namespaces_js__WEBPACK_IMPORTED_MODULE_0__.xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name) {\n var fullname = (0,_namespace_js__WEBPACK_IMPORTED_MODULE_1__.default)(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/creator.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/matcher.js":
/*!**************************************************!*\
!*** ./node_modules/d3-selection/src/matcher.js ***!
\**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__,\n/* harmony export */ \"childMatcher\": () => /* binding */ childMatcher\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nfunction childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/matcher.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/namespace.js":
/*!****************************************************!*\
!*** ./node_modules/d3-selection/src/namespace.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _namespaces_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./namespaces.js */ \"./node_modules/d3-selection/src/namespaces.js\");\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return _namespaces_js__WEBPACK_IMPORTED_MODULE_0__.default.hasOwnProperty(prefix) ? {space: _namespaces_js__WEBPACK_IMPORTED_MODULE_0__.default[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/namespace.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/namespaces.js":
/*!*****************************************************!*\
!*** ./node_modules/d3-selection/src/namespaces.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"xhtml\": () => /* binding */ xhtml,\n/* harmony export */ \"default\": () => __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nvar xhtml = \"http://www.w3.org/1999/xhtml\";\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n});\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/namespaces.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/select.js":
/*!*************************************************!*\
!*** ./node_modules/d3-selection/src/select.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _selection_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./selection/index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(selector) {\n return typeof selector === \"string\"\n ? new _selection_index_js__WEBPACK_IMPORTED_MODULE_0__.Selection([[document.querySelector(selector)]], [document.documentElement])\n : new _selection_index_js__WEBPACK_IMPORTED_MODULE_0__.Selection([[selector]], _selection_index_js__WEBPACK_IMPORTED_MODULE_0__.root);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/select.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/append.js":
/*!***********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/append.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _creator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../creator.js */ \"./node_modules/d3-selection/src/creator.js\");\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name) {\n var create = typeof name === \"function\" ? name : (0,_creator_js__WEBPACK_IMPORTED_MODULE_0__.default)(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/append.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/attr.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/attr.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../namespace.js */ \"./node_modules/d3-selection/src/namespace.js\");\n\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name, value) {\n var fullname = (0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.default)(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/attr.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/call.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/call.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/call.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/classed.js":
/*!************************************************************!*\
!*** ./node_modules/d3-selection/src/selection/classed.js ***!
\************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/classed.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/clone.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/clone.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/clone.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/data.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/data.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n/* harmony import */ var _enter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enter.js */ \"./node_modules/d3-selection/src/selection/enter.js\");\n/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../array.js */ \"./node_modules/d3-selection/src/array.js\");\n/* harmony import */ var _constant_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constant.js */ \"./node_modules/d3-selection/src/constant.js\");\n\n\n\n\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new _enter_js__WEBPACK_IMPORTED_MODULE_0__.EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that dont fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new _enter_js__WEBPACK_IMPORTED_MODULE_0__.EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = (0,_constant_js__WEBPACK_IMPORTED_MODULE_1__.default)(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = (0,_array_js__WEBPACK_IMPORTED_MODULE_2__.default)(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new _index_js__WEBPACK_IMPORTED_MODULE_3__.Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/data.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/datum.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/datum.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/datum.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/dispatch.js":
/*!*************************************************************!*\
!*** ./node_modules/d3-selection/src/selection/dispatch.js ***!
\*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _window_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../window.js */ \"./node_modules/d3-selection/src/window.js\");\n\n\nfunction dispatchEvent(node, type, params) {\n var window = (0,_window_js__WEBPACK_IMPORTED_MODULE_0__.default)(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/dispatch.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/each.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/each.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/each.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/empty.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/empty.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n return !this.node();\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/empty.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/enter.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/enter.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__,\n/* harmony export */ \"EnterNode\": () => /* binding */ EnterNode\n/* harmony export */ });\n/* harmony import */ var _sparse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sparse.js */ \"./node_modules/d3-selection/src/selection/sparse.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n return new _index_js__WEBPACK_IMPORTED_MODULE_0__.Selection(this._enter || this._groups.map(_sparse_js__WEBPACK_IMPORTED_MODULE_1__.default), this._parents);\n}\n\nfunction EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/enter.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/exit.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/exit.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _sparse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sparse.js */ \"./node_modules/d3-selection/src/selection/sparse.js\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n return new _index_js__WEBPACK_IMPORTED_MODULE_0__.Selection(this._exit || this._groups.map(_sparse_js__WEBPACK_IMPORTED_MODULE_1__.default), this._parents);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/exit.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/filter.js":
/*!***********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/filter.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n/* harmony import */ var _matcher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../matcher.js */ \"./node_modules/d3-selection/src/matcher.js\");\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(match) {\n if (typeof match !== \"function\") match = (0,_matcher_js__WEBPACK_IMPORTED_MODULE_0__.default)(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new _index_js__WEBPACK_IMPORTED_MODULE_1__.Selection(subgroups, this._parents);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/filter.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/html.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/html.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/html.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/index.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/index.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"root\": () => /* binding */ root,\n/* harmony export */ \"Selection\": () => /* binding */ Selection,\n/* harmony export */ \"default\": () => __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _select_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./select.js */ \"./node_modules/d3-selection/src/selection/select.js\");\n/* harmony import */ var _selectAll_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./selectAll.js */ \"./node_modules/d3-selection/src/selection/selectAll.js\");\n/* harmony import */ var _selectChild_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectChild.js */ \"./node_modules/d3-selection/src/selection/selectChild.js\");\n/* harmony import */ var _selectChildren_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectChildren.js */ \"./node_modules/d3-selection/src/selection/selectChildren.js\");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./filter.js */ \"./node_modules/d3-selection/src/selection/filter.js\");\n/* harmony import */ var _data_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./data.js */ \"./node_modules/d3-selection/src/selection/data.js\");\n/* harmony import */ var _enter_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./enter.js */ \"./node_modules/d3-selection/src/selection/enter.js\");\n/* harmony import */ var _exit_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./exit.js */ \"./node_modules/d3-selection/src/selection/exit.js\");\n/* harmony import */ var _join_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./join.js */ \"./node_modules/d3-selection/src/selection/join.js\");\n/* harmony import */ var _merge_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./merge.js */ \"./node_modules/d3-selection/src/selection/merge.js\");\n/* harmony import */ var _order_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./order.js */ \"./node_modules/d3-selection/src/selection/order.js\");\n/* harmony import */ var _sort_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./sort.js */ \"./node_modules/d3-selection/src/selection/sort.js\");\n/* harmony import */ var _call_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./call.js */ \"./node_modules/d3-selection/src/selection/call.js\");\n/* harmony import */ var _nodes_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./nodes.js */ \"./node_modules/d3-selection/src/selection/nodes.js\");\n/* harmony import */ var _node_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./node.js */ \"./node_modules/d3-selection/src/selection/node.js\");\n/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./size.js */ \"./node_modules/d3-selection/src/selection/size.js\");\n/* harmony import */ var _empty_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./empty.js */ \"./node_modules/d3-selection/src/selection/empty.js\");\n/* harmony import */ var _each_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./each.js */ \"./node_modules/d3-selection/src/selection/each.js\");\n/* harmony import */ var _attr_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./attr.js */ \"./node_modules/d3-selection/src/selection/attr.js\");\n/* harmony import */ var _style_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./style.js */ \"./node_modules/d3-selection/src/selection/style.js\");\n/* harmony import */ var _property_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./property.js */ \"./node_modules/d3-selection/src/selection/property.js\");\n/* harmony import */ var _classed_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./classed.js */ \"./node_modules/d3-selection/src/selection/classed.js\");\n/* harmony import */ var _text_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./text.js */ \"./node_modules/d3-selection/src/selection/text.js\");\n/* harmony import */ var _html_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./html.js */ \"./node_modules/d3-selection/src/selection/html.js\");\n/* harmony import */ var _raise_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./raise.js */ \"./node_modules/d3-selection/src/selection/raise.js\");\n/* harmony import */ var _lower_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./lower.js */ \"./node_modules/d3-selection/src/selection/lower.js\");\n/* harmony import */ var _append_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./append.js */ \"./node_modules/d3-selection/src/selection/append.js\");\n/* harmony import */ var _insert_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./insert.js */ \"./node_modules/d3-selection/src/selection/insert.js\");\n/* harmony import */ var _remove_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./remove.js */ \"./node_modules/d3-selection/src/selection/remove.js\");\n/* harmony import */ var _clone_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./clone.js */ \"./node_modules/d3-selection/src/selection/clone.js\");\n/* harmony import */ var _datum_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./datum.js */ \"./node_modules/d3-selection/src/selection/datum.js\");\n/* harmony import */ var _on_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./on.js */ \"./node_modules/d3-selection/src/selection/on.js\");\n/* harmony import */ var _dispatch_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./dispatch.js */ \"./node_modules/d3-selection/src/selection/dispatch.js\");\n/* harmony import */ var _iterator_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./iterator.js */ \"./node_modules/d3-selection/src/selection/iterator.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar root = [null];\n\nfunction Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: _select_js__WEBPACK_IMPORTED_MODULE_0__.default,\n selectAll: _selectAll_js__WEBPACK_IMPORTED_MODULE_1__.default,\n selectChild: _selectChild_js__WEBPACK_IMPORTED_MODULE_2__.default,\n selectChildren: _selectChildren_js__WEBPACK_IMPORTED_MODULE_3__.default,\n filter: _filter_js__WEBPACK_IMPORTED_MODULE_4__.default,\n data: _data_js__WEBPACK_IMPORTED_MODULE_5__.default,\n enter: _enter_js__WEBPACK_IMPORTED_MODULE_6__.default,\n exit: _exit_js__WEBPACK_IMPORTED_MODULE_7__.default,\n join: _join_js__WEBPACK_IMPORTED_MODULE_8__.default,\n merge: _merge_js__WEBPACK_IMPORTED_MODULE_9__.default,\n selection: selection_selection,\n order: _order_js__WEBPACK_IMPORTED_MODULE_10__.default,\n sort: _sort_js__WEBPACK_IMPORTED_MODULE_11__.default,\n call: _call_js__WEBPACK_IMPORTED_MODULE_12__.default,\n nodes: _nodes_js__WEBPACK_IMPORTED_MODULE_13__.default,\n node: _node_js__WEBPACK_IMPORTED_MODULE_14__.default,\n size: _size_js__WEBPACK_IMPORTED_MODULE_15__.default,\n empty: _empty_js__WEBPACK_IMPORTED_MODULE_16__.default,\n each: _each_js__WEBPACK_IMPORTED_MODULE_17__.default,\n attr: _attr_js__WEBPACK_IMPORTED_MODULE_18__.default,\n style: _style_js__WEBPACK_IMPORTED_MODULE_19__.default,\n property: _property_js__WEBPACK_IMPORTED_MODULE_20__.default,\n classed: _classed_js__WEBPACK_IMPORTED_MODULE_21__.default,\n text: _text_js__WEBPACK_IMPORTED_MODULE_22__.default,\n html: _html_js__WEBPACK_IMPORTED_MODULE_23__.default,\n raise: _raise_js__WEBPACK_IMPORTED_MODULE_24__.default,\n lower: _lower_js__WEBPACK_IMPORTED_MODULE_25__.default,\n append: _append_js__WEBPACK_IMPORTED_MODULE_26__.default,\n insert: _insert_js__WEBPACK_IMPORTED_MODULE_27__.default,\n remove: _remove_js__WEBPACK_IMPORTED_MODULE_28__.default,\n clone: _clone_js__WEBPACK_IMPORTED_MODULE_29__.default,\n datum: _datum_js__WEBPACK_IMPORTED_MODULE_30__.default,\n on: _on_js__WEBPACK_IMPORTED_MODULE_31__.default,\n dispatch: _dispatch_js__WEBPACK_IMPORTED_MODULE_32__.default,\n [Symbol.iterator]: _iterator_js__WEBPACK_IMPORTED_MODULE_33__.default\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (selection);\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/index.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/insert.js":
/*!***********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/insert.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _creator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../creator.js */ \"./node_modules/d3-selection/src/creator.js\");\n/* harmony import */ var _selector_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../selector.js */ \"./node_modules/d3-selection/src/selector.js\");\n\n\n\nfunction constantNull() {\n return null;\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name, before) {\n var create = typeof name === \"function\" ? name : (0,_creator_js__WEBPACK_IMPORTED_MODULE_0__.default)(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : (0,_selector_js__WEBPACK_IMPORTED_MODULE_1__.default)(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/insert.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/iterator.js":
/*!*************************************************************!*\
!*** ./node_modules/d3-selection/src/selection/iterator.js ***!
\*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function* __WEBPACK_DEFAULT_EXPORT__() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/iterator.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/join.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/join.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n enter = typeof onenter === \"function\" ? onenter(enter) : enter.append(onenter + \"\");\n if (onupdate != null) update = onupdate(update);\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/join.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/lower.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/lower.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n return this.each(lower);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/lower.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/merge.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/merge.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(selection) {\n if (!(selection instanceof _index_js__WEBPACK_IMPORTED_MODULE_0__.Selection)) throw new Error(\"invalid merge\");\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new _index_js__WEBPACK_IMPORTED_MODULE_0__.Selection(merges, this._parents);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/merge.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/node.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/node.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/node.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/nodes.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/nodes.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n return Array.from(this);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/nodes.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/on.js":
/*!*******************************************************!*\
!*** ./node_modules/d3-selection/src/selection/on.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/on.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/order.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/order.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/order.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/property.js":
/*!*************************************************************!*\
!*** ./node_modules/d3-selection/src/selection/property.js ***!
\*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/property.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/raise.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/raise.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n return this.each(raise);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/raise.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/remove.js":
/*!***********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/remove.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n return this.each(remove);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/remove.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/select.js":
/*!***********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/select.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n/* harmony import */ var _selector_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../selector.js */ \"./node_modules/d3-selection/src/selector.js\");\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(select) {\n if (typeof select !== \"function\") select = (0,_selector_js__WEBPACK_IMPORTED_MODULE_0__.default)(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new _index_js__WEBPACK_IMPORTED_MODULE_1__.Selection(subgroups, this._parents);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/select.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/selectAll.js":
/*!**************************************************************!*\
!*** ./node_modules/d3-selection/src/selection/selectAll.js ***!
\**************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ \"./node_modules/d3-selection/src/array.js\");\n/* harmony import */ var _selectorAll_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../selectorAll.js */ \"./node_modules/d3-selection/src/selectorAll.js\");\n\n\n\n\nfunction arrayAll(select) {\n return function() {\n var group = select.apply(this, arguments);\n return group == null ? [] : (0,_array_js__WEBPACK_IMPORTED_MODULE_0__.default)(group);\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = (0,_selectorAll_js__WEBPACK_IMPORTED_MODULE_1__.default)(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new _index_js__WEBPACK_IMPORTED_MODULE_2__.Selection(subgroups, parents);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/selectAll.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/selectChild.js":
/*!****************************************************************!*\
!*** ./node_modules/d3-selection/src/selection/selectChild.js ***!
\****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _matcher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../matcher.js */ \"./node_modules/d3-selection/src/matcher.js\");\n\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : (0,_matcher_js__WEBPACK_IMPORTED_MODULE_0__.childMatcher)(match)));\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/selectChild.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/selectChildren.js":
/*!*******************************************************************!*\
!*** ./node_modules/d3-selection/src/selection/selectChildren.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _matcher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../matcher.js */ \"./node_modules/d3-selection/src/matcher.js\");\n\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return this.children;\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : (0,_matcher_js__WEBPACK_IMPORTED_MODULE_0__.childMatcher)(match)));\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/selectChildren.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/size.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/size.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/size.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/sort.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/sort.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/d3-selection/src/selection/index.js\");\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new _index_js__WEBPACK_IMPORTED_MODULE_0__.Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/sort.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/sparse.js":
/*!***********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/sparse.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(update) {\n return new Array(update.length);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/sparse.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/style.js":
/*!**********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/style.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__,\n/* harmony export */ \"styleValue\": () => /* binding */ styleValue\n/* harmony export */ });\n/* harmony import */ var _window_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../window.js */ \"./node_modules/d3-selection/src/window.js\");\n\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nfunction styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || (0,_window_js__WEBPACK_IMPORTED_MODULE_0__.default)(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/style.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selection/text.js":
/*!*********************************************************!*\
!*** ./node_modules/d3-selection/src/selection/text.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selection/text.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selector.js":
/*!***************************************************!*\
!*** ./node_modules/d3-selection/src/selector.js ***!
\***************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction none() {}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selector.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/selectorAll.js":
/*!******************************************************!*\
!*** ./node_modules/d3-selection/src/selectorAll.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\nfunction empty() {\n return [];\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/selectorAll.js?");
/***/ }),
/***/ "./node_modules/d3-selection/src/window.js":
/*!*************************************************!*\
!*** ./node_modules/d3-selection/src/window.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => /* export default binding */ __WEBPACK_DEFAULT_EXPORT__\n/* harmony export */ });\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/d3-selection/src/window.js?");
/***/ }),
/***/ "./node_modules/filesize/lib/filesize.min.js":
/*!***************************************************!*\
!*** ./node_modules/filesize/lib/filesize.min.js ***!
\***************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
eval("/*\r\n 2020 Jason Mulligan <jason.mulligan@avoidwork.com>\r\n @version 6.1.0\r\n*/\r\n!function(e){var x=/^(b|B)$/,M={iec:{bits:[\"b\",\"Kib\",\"Mib\",\"Gib\",\"Tib\",\"Pib\",\"Eib\",\"Zib\",\"Yib\"],bytes:[\"B\",\"KiB\",\"MiB\",\"GiB\",\"TiB\",\"PiB\",\"EiB\",\"ZiB\",\"YiB\"]},jedec:{bits:[\"b\",\"Kb\",\"Mb\",\"Gb\",\"Tb\",\"Pb\",\"Eb\",\"Zb\",\"Yb\"],bytes:[\"B\",\"KB\",\"MB\",\"GB\",\"TB\",\"PB\",\"EB\",\"ZB\",\"YB\"]}},w={iec:[\"\",\"kibi\",\"mebi\",\"gibi\",\"tebi\",\"pebi\",\"exbi\",\"zebi\",\"yobi\"],jedec:[\"\",\"kilo\",\"mega\",\"giga\",\"tera\",\"peta\",\"exa\",\"zetta\",\"yotta\"]};function t(e){var i,t,o,n,b,r,a,l,s,d,u,c,f,p,B,y=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},g=[],v=0,m=void 0,h=void 0;if(isNaN(e))throw new TypeError(\"Invalid number\");return t=!0===y.bits,u=!0===y.unix,i=y.base||2,d=void 0!==y.round?y.round:u?1:2,r=void 0!==y.locale?y.locale:\"\",a=y.localeOptions||{},c=void 0!==y.separator?y.separator:\"\",f=void 0!==y.spacer?y.spacer:u?\"\":\" \",B=y.symbols||{},p=2===i&&y.standard||\"jedec\",s=y.output||\"string\",n=!0===y.fullform,b=y.fullforms instanceof Array?y.fullforms:[],m=void 0!==y.exponent?y.exponent:-1,o=2<i?1e3:1024,(l=(h=Number(e))<0)&&(h=-h),(-1===m||isNaN(m))&&(m=Math.floor(Math.log(h)/Math.log(o)))<0&&(m=0),8<m&&(m=8),\"exponent\"===s?m:(0===h?(g[0]=0,g[1]=u?\"\":M[p][t?\"bits\":\"bytes\"][m]):(v=h/(2===i?Math.pow(2,10*m):Math.pow(1e3,m)),t&&o<=(v*=8)&&m<8&&(v/=o,m++),g[0]=Number(v.toFixed(0<m?d:0)),g[0]===o&&m<8&&void 0===y.exponent&&(g[0]=1,m++),g[1]=10===i&&1===m?t?\"kb\":\"kB\":M[p][t?\"bits\":\"bytes\"][m],u&&(g[1]=\"jedec\"===p?g[1].charAt(0):0<m?g[1].replace(/B$/,\"\"):g[1],x.test(g[1])&&(g[0]=Math.floor(g[0]),g[1]=\"\"))),l&&(g[0]=-g[0]),g[1]=B[g[1]]||g[1],!0===r?g[0]=g[0].toLocaleString():0<r.length?g[0]=g[0].toLocaleString(r,a):0<c.length&&(g[0]=g[0].toString().replace(\".\",c)),\"array\"===s?g:(n&&(g[1]=b[m]?b[m]:w[p][m]+(t?\"bit\":\"byte\")+(1===g[0]?\"\":\"s\")),\"object\"===s?{value:g[0],symbol:g[1],exponent:m}:g.join(f)))}t.partial=function(i){return function(e){return t(e,i)}}, true?module.exports=t:0}(\"undefined\"!=typeof window?window:__webpack_require__.g);\r\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/filesize/lib/filesize.min.js?");
/***/ }),
/***/ "./node_modules/indexed-pdb/build/esm/index.js":
/*!*****************************************************!*\
!*** ./node_modules/indexed-pdb/build/esm/index.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"isIndexedDBSupported\": () => /* binding */ isIndexedDBSupported,\n/* harmony export */ \"openDB\": () => /* binding */ openDB\n/* harmony export */ });\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\n\nfunction isIndexedDBSupported() {\r\n if (!window.indexedDB) {\r\n console.log(\"Your browser doesn't support a stable version of IndexedDB. some of the features will not be available.\");\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n}\r\nfunction is_number_float(data) {\r\n var found_period = data.toString().includes('.');\r\n if (found_period) {\r\n // posibility of the floating number\r\n return true;\r\n }\r\n else {\r\n // check if the given number is number\r\n return isNaN(Number(data));\r\n }\r\n}\r\nvar IDBTransactionWrapper = /** @class */ (function () {\r\n function IDBTransactionWrapper(IDBTransaction) {\r\n this.IDBTransaction = IDBTransaction;\r\n this.db = new IDBDatabaseWrapper(IDBTransaction.db);\r\n this.error = IDBTransaction.error;\r\n this.mode = IDBTransaction.mode;\r\n this.objectStoreNames = IDBTransaction.objectStoreNames;\r\n }\r\n IDBTransactionWrapper.prototype.is_complete = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.IDBTransaction.onerror = function (err) {\r\n reject(err);\r\n };\r\n _this.IDBTransaction.onabort = function (err) {\r\n reject(err);\r\n };\r\n _this.IDBTransaction.oncomplete = function () {\r\n resolve(true);\r\n };\r\n });\r\n };\r\n /** Aborts the transaction. All pending requests will fail with a \"AbortError\" DOMException and all changes made to the database will be reverted. */\r\n IDBTransactionWrapper.prototype.abort = function () {\r\n return this.IDBTransaction.abort();\r\n };\r\n /** Returns an IDBObjectStore in the transaction's scope. */\r\n IDBTransactionWrapper.prototype.objectStore = function (name) {\r\n return new IDBObjectStoreWrapper(this.IDBTransaction.objectStore(name));\r\n };\r\n return IDBTransactionWrapper;\r\n}());\r\nvar IDBIndexWrapper = /** @class */ (function () {\r\n function IDBIndexWrapper(IDBIndex) {\r\n this.IDBIndex = IDBIndex;\r\n this.name = IDBIndex.name;\r\n this.objectStore = new IDBObjectStoreWrapper(IDBIndex.objectStore);\r\n this.keyPath = IDBIndex.keyPath;\r\n this.multiEntry = IDBIndex.multiEntry;\r\n this.unique = IDBIndex.unique;\r\n }\r\n /** Returns an IDBRequest object, and in a separate thread, returns the number of records within a key range.\r\n *\r\n * If successful, request's result will be the count.\r\n */\r\n IDBIndexWrapper.prototype.count = function (key) {\r\n var _this = this;\r\n var request = this.IDBIndex.count(key);\r\n return new Promise(function (resolve, reject) {\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while counting number of record in indexed object store called - \" + _this.name);\r\n };\r\n });\r\n };\r\n /**\r\n * Retrieves the value of the first record matching the given key or key range in query.\r\n\r\n * If successful, request's result will be the value, or undefined if there was no matching record.\r\n\r\n * Returns an IDBRequest object, and, in a separate thread, finds either the value in the referenced object store that corresponds to the given key or the first corresponding value, if key is an IDBKeyRange.\r\n */\r\n IDBIndexWrapper.prototype.get = function (key) {\r\n var _this = this;\r\n var request = this.IDBIndex.get(key);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while retriving records in indexed object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /**\r\n * Retrieves the key of the first record matching the given key or key range in query.\r\n * If successful, request's result will be the key, or undefined if there was no matching record.\r\n */\r\n IDBIndexWrapper.prototype.getKey = function (key) {\r\n var _this = this;\r\n var request = this.IDBIndex.getKey(key);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while getting key in indexed object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /**\r\n * Retrieves the values of the records matching the given key or key range in query (up to count if given).\r\n *\r\n * If successful, request's result will be an Array of the values.\r\n * */\r\n IDBIndexWrapper.prototype.getAll = function (query, count) {\r\n var _this = this;\r\n var request = this.IDBIndex.getAll(query, count);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while retriving all records in indexed object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /**\r\n * Retrieves the keys of records matching the given key or key range in query (up to count if given).\r\n *\r\n * If successful, request's result will be an Array of the keys. */\r\n IDBIndexWrapper.prototype.getAllKeys = function (query, count) {\r\n var _this = this;\r\n var request = this.IDBIndex.getAllKeys(query, count);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while retriving all keys in indexed object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /**\r\n * Opens a cursor over the records matching query, ordered by direction. If query is null, all records in index are matched.\r\n *\r\n * If successful, request's result will be an IDBCursorWithValue, or null if there were no matching records.\r\n */\r\n IDBIndexWrapper.prototype.openCursor = function (query, direction) {\r\n var _this = this;\r\n var cursorWrapper = [];\r\n var request = this.IDBIndex.openCursor(query, direction);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n if (cursorWrapper.length === 0) {\r\n reject(err + \" - Error while opeing the cursor from the object store - \" + _this.name);\r\n }\r\n else {\r\n // notify the observer\r\n var curWrapper = cursorWrapper[cursorWrapper.length - 1];\r\n curWrapper.cursorMoved(null, err);\r\n }\r\n };\r\n request.onsuccess = function (event) {\r\n var new_cursor = event.target.result;\r\n if (cursorWrapper.length === 0) {\r\n // when no continue or advance is called\r\n cursorWrapper.push(new IDBCursorWrapper(new_cursor));\r\n resolve(cursorWrapper[cursorWrapper.length - 1]);\r\n }\r\n else {\r\n // when continue or advance is called this part will get called\r\n var curWrapper = cursorWrapper[cursorWrapper.length - 1];\r\n if (new_cursor) {\r\n var insCursorWrapper = new IDBCursorWrapper(new_cursor);\r\n curWrapper.cursorMoved(insCursorWrapper, null);\r\n cursorWrapper.push(insCursorWrapper);\r\n }\r\n else {\r\n // end of the cursor\r\n curWrapper.cursorMoved(null, null);\r\n }\r\n }\r\n };\r\n });\r\n };\r\n /** Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in index are matched.\r\n *\r\n * If successful, request's result will be an IDBCursor, or null if there were no matching records. */\r\n IDBIndexWrapper.prototype.openKeyCursor = function (query, direction) {\r\n var _this = this;\r\n var request = this.IDBIndex.openKeyCursor(query, direction);\r\n var cursorWrapper = [];\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n if (cursorWrapper.length === 0) {\r\n reject(err + \" - Error while opeing the cursor from the object store - \" + _this.name);\r\n }\r\n else {\r\n // notify the observer\r\n var curWrapper = cursorWrapper[cursorWrapper.length - 1];\r\n curWrapper.cursorMoved(null, err);\r\n }\r\n };\r\n request.onsuccess = function (event) {\r\n var new_cursor = event.target.result;\r\n if (cursorWrapper.length === 0) {\r\n // when no continue or advance is called\r\n cursorWrapper.push(new IDBCursorWrapper(new_cursor));\r\n resolve(cursorWrapper[cursorWrapper.length - 1]);\r\n }\r\n else {\r\n // when continue or advance is called this part will get called\r\n var curWrapper = cursorWrapper[cursorWrapper.length - 1];\r\n if (new_cursor) {\r\n var insCursorWrapper = new IDBCursorWrapper(new_cursor);\r\n curWrapper.cursorMoved(insCursorWrapper, null);\r\n cursorWrapper.push(insCursorWrapper);\r\n }\r\n else {\r\n // end of the cursor\r\n curWrapper.cursorMoved(null, null);\r\n }\r\n }\r\n };\r\n });\r\n };\r\n return IDBIndexWrapper;\r\n}());\r\nvar IDBObjectStoreWrapper = /** @class */ (function () {\r\n function IDBObjectStoreWrapper(IDBObjectStore) {\r\n this.IDBObjectStore = IDBObjectStore;\r\n this.indexNames = IDBObjectStore.indexNames;\r\n this.keyPath = IDBObjectStore.keyPath;\r\n this.name = IDBObjectStore.name;\r\n this.transaction = new IDBTransactionWrapper(IDBObjectStore.transaction);\r\n this.autoIncrement = IDBObjectStore.autoIncrement;\r\n }\r\n /**\r\n Adds or updates a record in store with the given value and key.\r\n\r\n If the store uses in-line keys and key is specified a \"DataError\" DOMException will be thrown.\r\n\r\n If put() is used, any existing record with the key will be replaced. If add() is used, and if a record with the key already exists the request will fail, with request's error set to a \"ConstraintError\" DOMException.\r\n\r\n If successful, request's result will be the record's key.\r\n */\r\n IDBObjectStoreWrapper.prototype.add = function (value, key, transactionCallback) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.add(value, key);\r\n if (transactionCallback) {\r\n transactionCallback(new IDBTransactionWrapper(request.transaction));\r\n }\r\n return new Promise(function (resolve, reject) {\r\n request.onsuccess = function (result) {\r\n resolve(result.target.result);\r\n };\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while adding new data to object store called - \" + _this.name);\r\n };\r\n });\r\n };\r\n /**\r\n * Add array of the data one at a time to Object Store\r\n *\r\n * @param value\r\n * @returns primary_keys[]\r\n */\r\n IDBObjectStoreWrapper.prototype.addAll = function (value) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var inserted_primary_keys, index, item, primary_key;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n inserted_primary_keys = [];\r\n if (!(value.length !== 0)) return [3 /*break*/, 4];\r\n index = 0;\r\n _a.label = 1;\r\n case 1:\r\n if (!(index < value.length)) return [3 /*break*/, 4];\r\n item = value[index];\r\n return [4 /*yield*/, this.add(item)];\r\n case 2:\r\n primary_key = _a.sent();\r\n inserted_primary_keys.push(primary_key);\r\n _a.label = 3;\r\n case 3:\r\n index++;\r\n return [3 /*break*/, 1];\r\n case 4: return [2 /*return*/, inserted_primary_keys];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n Creates and immediately returns an IDBRequest object, and clears this object store in a separate thread. This is for deleting all current records out of an object store.\r\n\r\n If successful, request's result will be undefined.\r\n */\r\n IDBObjectStoreWrapper.prototype.clear = function () {\r\n var _this = this;\r\n var request = this.IDBObjectStore.clear();\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while clearing all the data from the object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (result) {\r\n if (!result.target.result) {\r\n resolve('DONE');\r\n }\r\n else {\r\n reject('ERR');\r\n }\r\n };\r\n });\r\n };\r\n /**\r\n Returns an IDBRequest object, and, in a separate thread, returns the total number of records that match the provided key or IDBKeyRange.\r\n \r\n If no arguments are provided, it returns the total number of records in the store.\r\n */\r\n IDBObjectStoreWrapper.prototype.count = function (key) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.count(key);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while counting all record from the object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /**\r\n * Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a \"ConstraintError\" DOMException.\r\n *\r\n * Throws an \"InvalidStateError\" DOMException if not called within an upgrade transaction.\r\n */\r\n IDBObjectStoreWrapper.prototype.createIndex = function (name, keyPath, options) {\r\n return new IDBIndexWrapper(this.IDBObjectStore.createIndex(name, keyPath, options));\r\n };\r\n /** Deletes records in store with the given key or in the given key range in query.\r\n *\r\n * If successful, request's result will be undefined. */\r\n IDBObjectStoreWrapper.prototype.delete = function (key) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.delete(key);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while deleting the row from the object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n if (!event.target.result) {\r\n resolve('OK');\r\n }\r\n };\r\n });\r\n };\r\n /** Deletes the index in store with the given name.\r\n *\r\n * Throws an \"InvalidStateError\" DOMException if not called within an upgrade transaction. */\r\n IDBObjectStoreWrapper.prototype.deleteIndex = function (name) {\r\n return this.IDBObjectStore.deleteIndex(name);\r\n };\r\n /** Retrieves the value of the first record matching the given key or key range in query.\r\n *\r\n * If successful, request's result will be the value, or undefined if there was no matching record. */\r\n IDBObjectStoreWrapper.prototype.get = function (query) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.get(query);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while geting the row from the object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /** Retrieves the key of the first record matching the given key or key range in query.\r\n *\r\n * If successful, request's result will be the key, or undefined if there was no matching record. */\r\n IDBObjectStoreWrapper.prototype.getKey = function (query) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.getKey(query);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while geting key from the object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /** Retrieves the values of the records matching the given key or key range in query (up to count if given).\r\n *\r\n * If successful, request's result will be an Array of the values. */\r\n IDBObjectStoreWrapper.prototype.getAll = function (query, count) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.getAll(query, count);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while geting all keys from the object store called - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /** Retrieves the keys of records matching the given key or key range in query (up to count if given).\r\n *\r\n * If successful, request's result will be an Array of the keys.*/\r\n IDBObjectStoreWrapper.prototype.getAllKeys = function (query, count) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.getAllKeys(query, count);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while getting all keys from the object store - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n /** Opens an index from this object store after which it can, for example, be used to return a sequence of records sorted by that index using a cursor. */\r\n IDBObjectStoreWrapper.prototype.index = function (name) {\r\n var request = new IDBIndexWrapper(this.IDBObjectStore.index(name));\r\n return request;\r\n };\r\n /** Opens a cursor over the records matching query, ordered by direction. If query is null, all records in store are matched.\r\n *\r\n * If successful, request's result will be an IDBCursorWithValue pointing at the first matching record, or null if there were no matching records. */\r\n IDBObjectStoreWrapper.prototype.openCursor = function (query, direction) {\r\n var _this = this;\r\n var cursorWrapper = [];\r\n var request = this.IDBObjectStore.openCursor(query, direction);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n if (cursorWrapper.length === 0) {\r\n reject(err + \" - Error while opeing the cursor from the object store - \" + _this.name);\r\n }\r\n else {\r\n // notify the observer\r\n var curWrapper = cursorWrapper[cursorWrapper.length - 1];\r\n curWrapper.cursorMoved(null, err);\r\n }\r\n };\r\n request.onsuccess = function (event) {\r\n var new_cursor = event.target.result;\r\n if (cursorWrapper.length === 0) {\r\n // when no continue or advance is called\r\n cursorWrapper.push(new IDBCursorWrapper(new_cursor));\r\n resolve(cursorWrapper[cursorWrapper.length - 1]);\r\n }\r\n else {\r\n // when continue or advance is called this part will get called\r\n var curWrapper = cursorWrapper[cursorWrapper.length - 1];\r\n if (new_cursor) {\r\n var insCursorWrapper = new IDBCursorWrapper(new_cursor);\r\n curWrapper.cursorMoved(insCursorWrapper, null);\r\n cursorWrapper.push(insCursorWrapper);\r\n }\r\n else {\r\n // end of the cursor value is null\r\n curWrapper.cursorMoved(null, null);\r\n }\r\n }\r\n };\r\n });\r\n };\r\n /** Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in store are matched.\r\n *\r\n * If successful, request's result will be an IDBCursor pointing at the first matching record, or null if there were no matching records. */\r\n IDBObjectStoreWrapper.prototype.openKeyCursor = function (query, direction) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.openKeyCursor(query, direction);\r\n var cursorWrapper = [];\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n if (cursorWrapper.length === 0) {\r\n reject(err + \" - Error while opeing the cursor from the object store - \" + _this.name);\r\n }\r\n else {\r\n // notify the observer\r\n var curWrapper = cursorWrapper[cursorWrapper.length - 1];\r\n curWrapper.cursorMoved(null, err);\r\n }\r\n };\r\n request.onsuccess = function (event) {\r\n var new_cursor = event.target.result;\r\n if (cursorWrapper.length === 0) {\r\n // when no continue or advance is called\r\n cursorWrapper.push(new IDBCursorWrapper(new_cursor));\r\n resolve(cursorWrapper[cursorWrapper.length - 1]);\r\n }\r\n else {\r\n // when continue or advance is called this part will get called\r\n var curWrapper = cursorWrapper[cursorWrapper.length - 1];\r\n if (new_cursor) {\r\n var insCursorWrapper = new IDBCursorWrapper(new_cursor);\r\n curWrapper.cursorMoved(insCursorWrapper, null);\r\n cursorWrapper.push(insCursorWrapper);\r\n }\r\n else {\r\n // end of the cursor no item to continue\r\n curWrapper.cursorMoved(null, null);\r\n }\r\n }\r\n };\r\n });\r\n };\r\n /** Adds or updates a record in store with the given value and key.\r\n *\r\n * If the store uses in-line keys and key is specified a \"DataError\" DOMException will be thrown\r\n *\r\n * If put() is used, any existing record with the key will be replaced. If add() is used, and if a record with the key already exists the request will fail, with request's error set to a \"ConstraintError\" DOMException.\r\n * If successful, request's result will be the record's key.\r\n * */\r\n IDBObjectStoreWrapper.prototype.put = function (value, key) {\r\n var _this = this;\r\n var request = this.IDBObjectStore.put(value, key);\r\n return new Promise(function (resolve, reject) {\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while putting value to the object store - \" + _this.name);\r\n };\r\n request.onsuccess = function (event) {\r\n resolve(event.target.result);\r\n };\r\n });\r\n };\r\n return IDBObjectStoreWrapper;\r\n}());\r\nvar IDBDatabaseWrapper = /** @class */ (function () {\r\n function IDBDatabaseWrapper(IDBDatabase) {\r\n this.IDBDatabase = IDBDatabase;\r\n this.name = IDBDatabase.name;\r\n this.version = IDBDatabase.version;\r\n this.objectStoreNames = IDBDatabase.objectStoreNames;\r\n }\r\n /**\r\n The close() method of the IDBDatabase interface returns immediately and closes the connection in a separate thread.\r\n\r\n The connection is not actually closed until all transactions created using this connection are complete.\r\n No new transactions can be created for this connection once this method is called.\r\n Methods that create transactions throw an exception if a closing operation is pending.\r\n */\r\n IDBDatabaseWrapper.prototype.close = function () {\r\n return this.IDBDatabase.close();\r\n };\r\n /**\r\n Creates a new object store with the given name and options and returns a new IDBObjectStore.\r\n\r\n Throws a \"InvalidStateError\" DOMException if not called within an upgrade transaction.\r\n */\r\n IDBDatabaseWrapper.prototype.createObjectStore = function (name, optionalParameters) {\r\n return new IDBObjectStoreWrapper(this.IDBDatabase.createObjectStore(name, optionalParameters));\r\n };\r\n /** Deletes the object store with the given name.\r\n *\r\n * Throws a \"InvalidStateError\" DOMException if not called within an upgrade transaction. */\r\n IDBDatabaseWrapper.prototype.deleteObjectStore = function (name) {\r\n return this.IDBDatabase.deleteObjectStore(name);\r\n };\r\n /** Immediately returns a transaction object (IDBTransaction) containing the IDBTransaction.objectStore method, which you can use to access your object store. Runs in a separate thread. */\r\n IDBDatabaseWrapper.prototype.transaction = function (storeNames, mode) {\r\n return new IDBTransactionWrapper(this.IDBDatabase.transaction(storeNames, mode));\r\n };\r\n return IDBDatabaseWrapper;\r\n}());\r\n/** Open the database connection to IndexDB */\r\nfunction openDB(database_name, version, upgradeCallback) {\r\n return new Promise(function (resolve, reject) {\r\n if (isIndexedDBSupported()) {\r\n if (version) {\r\n if (is_number_float(version)) {\r\n reject('Invalid Version Number | Only Integer is supported');\r\n }\r\n }\r\n // version number is ok\r\n // open the database connection\r\n var request = window.indexedDB.open(database_name, version);\r\n // after onupgradeneeded this event will fire\r\n request.onsuccess = function (result) {\r\n resolve(new IDBDatabaseWrapper(result.target.result));\r\n };\r\n request.onerror = function (err) {\r\n reject(err + \" - Error while connecting to database\");\r\n };\r\n // after completion of this event and callback onSuccess will be called\r\n request.onupgradeneeded = function (result) {\r\n if (upgradeCallback) {\r\n upgradeCallback(new IDBDatabaseWrapper(result.target.result));\r\n }\r\n };\r\n }\r\n else {\r\n reject('Browser not supported ');\r\n }\r\n });\r\n}\r\nvar IDBCursorWrapper = /** @class */ (function () {\r\n function IDBCursorWrapper(IDBCursor) {\r\n this.IDBCursor = IDBCursor;\r\n this.cursor_movement_promise = {\r\n resolve: function (value) { },\r\n reject: function (err) { }\r\n };\r\n this.direction = this.IDBCursor.direction;\r\n this.key = this.IDBCursor.key;\r\n this.primaryKey = this.IDBCursor.primaryKey;\r\n this.source = this.IDBCursor.source;\r\n if (this.IDBCursor.value) {\r\n this.value = this.IDBCursor.value;\r\n }\r\n else {\r\n this.value = null;\r\n }\r\n }\r\n // when the cursor will move to next item this method will be called\r\n IDBCursorWrapper.prototype.cursorMoved = function (IDBCursorWrapper, err) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n // there some one watching for this method\r\n if (err) {\r\n this.cursor_movement_promise.reject(err);\r\n }\r\n else {\r\n if (IDBCursorWrapper) {\r\n this.cursor_movement_promise.resolve(IDBCursorWrapper);\r\n }\r\n else {\r\n this.cursor_movement_promise.resolve(null);\r\n }\r\n }\r\n return [2 /*return*/];\r\n });\r\n });\r\n };\r\n /**\r\n * Advances the cursor through the next count records in range.\r\n */\r\n IDBCursorWrapper.prototype.advance = function (count) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n _this.cursor_movement_promise.reject = reject;\r\n _this.cursor_movement_promise.resolve = resolve;\r\n _this.IDBCursor.advance(count);\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Advances the cursor to the next record in range.\r\n */\r\n IDBCursorWrapper.prototype.continue = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n _this.cursor_movement_promise.reject = reject;\r\n _this.cursor_movement_promise.resolve = resolve;\r\n _this.IDBCursor.continue(key);\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Advances the cursor to the next record in range matching or after key and primaryKey. Throws an \"InvalidAccessError\" DOMException if the source is not an index.\r\n */\r\n IDBCursorWrapper.prototype.continuePrimaryKey = function (key, primaryKey) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n _this.cursor_movement_promise.reject = reject;\r\n _this.cursor_movement_promise.resolve = resolve;\r\n _this.IDBCursor.continuePrimaryKey(key, primaryKey);\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Delete the record pointed at by the cursor with a new value.\r\n *\r\n * If successful, request's result will be undefined.\r\n */\r\n IDBCursorWrapper.prototype.delete = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var request;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n request = this.IDBCursor.delete();\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n request.onsuccess = function () {\r\n resolve({ status: 'OK', IDBCursor: new IDBCursorWrapper(_this.IDBCursor) });\r\n };\r\n request.onerror = function (err) {\r\n reject(\"Error while deleting the row using cursor - \" + err);\r\n };\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Updated the record pointed at by the cursor with a new value.\r\n *\r\n * Throws a \"DataError\" DOMException if the effective object store uses in-line keys and the key would have changed.\r\n *\r\n * If successful, request's result will be the record's key.\r\n */\r\n IDBCursorWrapper.prototype.update = function (value) {\r\n var _this = this;\r\n var request = this.IDBCursor.update(value);\r\n return new Promise(function (resolve, reject) {\r\n request.onsuccess = function (result) {\r\n resolve({ IDBValidKey: result.target.result, IDBCursor: new IDBCursorWrapper(_this.IDBCursor) });\r\n };\r\n request.onerror = function (err) {\r\n reject(\"Error while update the row using cursor - \" + err);\r\n };\r\n });\r\n };\r\n return IDBCursorWrapper;\r\n}());\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./node_modules/indexed-pdb/build/esm/index.js?");
/***/ }),
/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
/*!****************************************************************************!*\
!*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
\****************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
eval("\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = true ? __webpack_require__.nc : 0;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n // tags it will allow on a page\n\n if (!options.singleton && typeof options.singleton !== 'boolean') {\n options.singleton = isOldIE();\n }\n\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n if (Object.prototype.toString.call(newList) !== '[object Array]') {\n return;\n }\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDom[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDom[_index].references === 0) {\n stylesInDom[_index].updater();\n\n stylesInDom.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};\n\n//# sourceURL=webpack://ticparse.js/./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?");
/***/ }),
/***/ "./src/app.js":
/*!********************!*\
!*** ./src/app.js ***!
\********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _lumino_commands__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/commands */ \"./node_modules/@lumino/commands/dist/index.es6.js\");\n/* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/messaging */ \"./node_modules/@lumino/messaging/dist/index.es6.js\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/widgets */ \"./node_modules/@lumino/widgets/dist/index.es6.js\");\n/* harmony import */ var _style_index_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../style/index.css */ \"./style/index.css\");\n/* harmony import */ var _style_index_css__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_index_css__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _editor_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.js */ \"./src/editor.js\");\n/* harmony import */ var _listing_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./listing.js */ \"./src/listing.js\");\n/* harmony import */ var _ticdb_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ticdb.js */ \"./src/ticdb.js\");\n\n\n\n\n\n// import '@fortawesome/fontawesome-free/css/all.min.css';\n\n\n\n\n// class ContentWidget extends Widget {\n\n// static createNode() {\n// let node = document.createElement('div');\n// let content = document.createElement('div');\n// let input = document.createElement('input');\n// input.placeholder = 'Placeholder...';\n// content.appendChild(input);\n// node.appendChild(content);\n// return node;\n// }\n\n// constructor(name) {\n// super({ node: ContentWidget.createNode() });\n// this.setFlag(Widget.Flag.DisallowLayout);\n// this.addClass('content');\n// this.addClass(name.toLowerCase());\n// this.title.label = name;\n// this.title.closable = true;\n// this.title.caption = `Long description for: ${name}`;\n// }\n\n// get inputNode() {\n// return this.node.getElementsByTagName('input')[0];\n// }\n\n// onActivateRequest(Message) {\n// if (this.isAttached) {\n// this.inputNode.focus();\n// }\n// }\n// }\n\nwindow._tic = {};\nconst commands = new _lumino_commands__WEBPACK_IMPORTED_MODULE_0__.CommandRegistry();\n\n\nfunction main () {\n const dialog = document.getElementById(\"dialog\"),\n openfile = document.getElementById(\"openfile\"),\n openfile_fileinput = document.getElementById(\"openfile_fileinput\"),\n openfile_cancel = document.getElementById(\"openfile_cancel\");\n\n function dialog_is_open () {\n return dialog.style.display != \"none\";\n }\n\n function close_dialog() {\n dialog.style.display = \"none\";\n openfile.style.display = \"none\";\n openfile_fileinput.value = null;\n }\n\n function show_openfile() {\n dialog.style.display = \"flex\";\n openfile.style.display = \"block\";\n openfile_fileinput.focus();\n }\n\n openfile_cancel.addEventListener(\"click\", e=> {\n close_dialog();\n })\n\n commands.addCommand('tic:open', {\n label: 'Open...',\n mnemonic: 1,\n iconClass: 'fa fa-file',\n execute: () => {\n // console.log('Import...');\n show_openfile();\n }\n });\n\n commands.addCommand('tic:save', {\n label: 'Save',\n mnemonic: 0,\n iconClass: 'fa fa-save',\n execute: async () => {\n console.log('Save');\n // current_cart.code.text = codesrc; // code.getValue();\n if (window._tic.filename && window._tic.cart) {\n let cart = window._tic.cart;\n cart.code.text = editor.getValue();\n // console.log(\"saving code\", cart.code.text);\n await _ticdb_js__WEBPACK_IMPORTED_MODULE_6__.save_cart(window._tic.filename, cart, window._tic.item.mode);\n listing.sync();\n }\n }\n });\n\n commands.addCommand('tic:save-as', {\n label: 'Save as...',\n mnemonic: 0,\n iconClass: 'fa fa-save',\n execute: async () => {\n console.log('Save as...');\n if (window._tic.cart) {\n let filename = prompt(\"Save as...\");\n if (!filename) { return; }\n window._tic.filename = filename;\n let cart = window._tic.cart;\n cart.code.text = editor.getValue();\n // console.log(\"saving code\", cart.code.text);\n await _ticdb_js__WEBPACK_IMPORTED_MODULE_6__.save_cart(filename, cart, window._tic.item.mode);\n listing.sync();\n }\n }\n });\n\n commands.addKeyBinding({\n keys: ['Accel S'],\n selector: 'body',\n command: 'tic:save'\n });\n\n commands.addKeyBinding({\n keys: ['Accel O'],\n selector: 'body',\n command: 'tic:open'\n });\n\n let filemenu = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__.Menu({ commands });\n filemenu.addItem({ command: 'tic:open' });\n filemenu.addItem({ command: 'tic:save' });\n filemenu.addItem({ command: 'tic:save-as' });\n // filemenu.addItem({ type: 'separator' });\n\n filemenu.title.label = 'File';\n filemenu.title.mnemonic = 0;\n\n let bar = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__.MenuBar();\n bar.addMenu(filemenu);\n bar.id = 'menuBar';\n\n document.addEventListener('keydown', (event) => {\n // console.log(\"keydown\", event);\n if (event.key == \"Escape\" && dialog_is_open()) {\n close_dialog();\n } else {\n commands.processKeydownEvent(event);\n\n }\n });\n\n let listing = new _listing_js__WEBPACK_IMPORTED_MODULE_5__.ListingWidget('Listing');\n window._tic.listing = listing;\n let editor = new _editor_js__WEBPACK_IMPORTED_MODULE_4__.EditorWidget('Editor');\n window._tic.editor = editor;\n\n let dock = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__.DockPanel();\n dock.addWidget(listing);\n dock.addWidget(editor, { mode: 'split-right', ref: listing });\n // dock.addWidget(editor2, { ref: editor1 });\n dock.id = 'dock';\n\n _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__.BoxPanel.setStretch(dock, 1);\n\n let main = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__.BoxPanel({ direction: 'left-to-right', spacing: 0 });\n main.id = 'main';\n // main.addWidget(palette);\n main.addWidget(dock);\n\n window.onresize = () => { main.update(); };\n\n _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__.Widget.attach(bar, document.body);\n _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__.Widget.attach(main, document.body);\n}\n\nwindow.onload = main;\n\n\n//# sourceURL=webpack://ticparse.js/./src/app.js?");
/***/ }),
/***/ "./src/editor.js":
/*!***********************!*\
!*** ./src/editor.js ***!
\***********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"EditorWidget\": () => /* binding */ EditorWidget\n/* harmony export */ });\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/widgets */ \"./node_modules/@lumino/widgets/dist/index.es6.js\");\n/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! codemirror */ \"./node_modules/codemirror/lib/codemirror.js\");\n/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var codemirror_mode_lua_lua_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! codemirror/mode/lua/lua.js */ \"./node_modules/codemirror/mode/lua/lua.js\");\n/* harmony import */ var codemirror_mode_lua_lua_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_lua_lua_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var codemirror_mode_javascript_javascript_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! codemirror/mode/javascript/javascript.js */ \"./node_modules/codemirror/mode/javascript/javascript.js\");\n/* harmony import */ var codemirror_mode_javascript_javascript_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(codemirror_mode_javascript_javascript_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var codemirror_addon_fold_foldcode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! codemirror/addon/fold/foldcode.js */ \"./node_modules/codemirror/addon/fold/foldcode.js\");\n/* harmony import */ var codemirror_addon_fold_foldcode_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_fold_foldcode_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var codemirror_addon_fold_foldgutter_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! codemirror/addon/fold/foldgutter.js */ \"./node_modules/codemirror/addon/fold/foldgutter.js\");\n/* harmony import */ var codemirror_addon_fold_foldgutter_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(codemirror_addon_fold_foldgutter_js__WEBPACK_IMPORTED_MODULE_5__);\n\n\n\n\n\n\n\n// import 'codemirror/lib/codemirror.css';\n// import 'codemirror/theme/monokai.css';\n\nconst TIC_SPECIALS = [\"TIC\", \"SCN\", \"OVR\", \"btn\", \"btnp\", \"clip\", \"cls\", \"circ\", \"circb\", \"exit\", \"fget\", \"font\", \"fset\", \"key\", \"keyp\", \"line\", \"map\", \"memcpy\", \"memset\", \"mget\", \"mouse\", \"mset\", \"music\", \"peek\", \"peek4\", \"pix\", \"pmem\", \"poke\", \"poke4\", \"print\", \"rect\", \"rectb\", \"reset\", \"sfx\", \"spr\", \"sync\", \"time\", \"tstamp\", \"trace\", \"tri\", \"textri\"],\n CM_OPTS = {\n mode: {'name': 'lua', 'specials': TIC_SPECIALS, 'fold': true},\n // mode: {'name': 'lua'},\n theme: 'default',\n lineNumbers: true,\n lineWrapping: true,\n // extraKeys: {\"Ctrl-S\": function(cm){ save(); }},\n foldGutter: true,\n gutters: [\"CodeMirror-linenumbers\", \"CodeMirror-foldgutter\"] \n };\n\nclass EditorWidget extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__.Widget {\n\n static createNode() {\n let node = document.createElement('div');\n let editor = document.createElement('div');\n\n // let input = document.createElement('input');\n // input.placeholder = 'Placeholder...';\n // content.appendChild(input);\n node.appendChild(editor);\n return node;\n }\n\n constructor(name) {\n super({ node: EditorWidget.createNode() });\n // let editor_div = this.node.getElementsByTagName('div')[0];\n this.cm = codemirror__WEBPACK_IMPORTED_MODULE_1__(this.editorDiv, CM_OPTS);\n // window.code = this.cm;\n this.setFlag(_lumino_widgets__WEBPACK_IMPORTED_MODULE_0__.Widget.Flag.DisallowLayout);\n this.addClass('content');\n this.addClass(name.toLowerCase());\n this.title.label = name;\n this.title.closable = false;\n this.title.caption = `Editor: ${name}`;\n }\n\n get editorDiv () {\n return this.node.getElementsByTagName('div')[0];\n }\n\n get inputNode() {\n return this.node.getElementsByTagName('input')[0];\n }\n setValue (text) {\n this.cm.setValue(text);\n // this.cm.update();\n }\n getValue () {\n return this.cm.getValue();\n }\n // onUpdateRequest (Message) {\n // }\n onAfterShow () {\n console.log(\"editor.onAfterShow\");\n this.cm.refresh();\n }\n onActivateRequest(Message) {\n // if (this.isAttached) {\n // this.inputNode.focus();\n // }\n }\n}\n\n\n//# sourceURL=webpack://ticparse.js/./src/editor.js?");
/***/ }),
/***/ "./src/listing.js":
/*!************************!*\
!*** ./src/listing.js ***!
\************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ListingWidget\": () => /* binding */ ListingWidget\n/* harmony export */ });\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/widgets */ \"./node_modules/@lumino/widgets/dist/index.es6.js\");\n/* harmony import */ var indexed_pdb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! indexed-pdb */ \"./node_modules/indexed-pdb/build/esm/index.js\");\n/* harmony import */ var _ticparse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ticparse.js */ \"./src/ticparse.js\");\n/* harmony import */ var filesize__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! filesize */ \"./node_modules/filesize/lib/filesize.min.js\");\n/* harmony import */ var filesize__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(filesize__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var d3_selection__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! d3-selection */ \"./node_modules/d3-selection/src/select.js\");\n/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! codemirror */ \"./node_modules/codemirror/lib/codemirror.js\");\n/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _ticdb_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ticdb.js */ \"./src/ticdb.js\");\n\n\n\n\n\n\n\n\n\n\nclass ListingWidget extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__.Widget {\n\n static createNode() {\n let node = document.createElement('div');\n let editor = document.createElement('div');\n\n // let input = document.createElement('input');\n // input.placeholder = 'Placeholder...';\n // content.appendChild(input);\n node.appendChild(editor);\n return node;\n }\n\n constructor(name) {\n super({ node: ListingWidget.createNode() });\n // let editor_div = this.node.getElementsByTagName('div')[0];\n // this.cm = CodeMirror(this.editorDiv, CM_OPTS);\n\n this.setFlag(_lumino_widgets__WEBPACK_IMPORTED_MODULE_0__.Widget.Flag.DisallowLayout);\n // this.addClass('content');\n this.addClass(name.toLowerCase());\n this.title.label = name;\n this.title.closable = false;\n this.title.caption = `Editor: ${name}`;\n\n this.listing = (0,d3_selection__WEBPACK_IMPORTED_MODULE_6__.default)(this.node),\n this.table = this.listing.append(\"table\"),\n this.thead = this.table.append(\"thead\").append(\"tr\"),\n this.tbody = this.table.append(\"tbody\");\n this.thead.selectAll(\"th\").data([\"name\", \"size\", \"time\", \"&nbsp;\"]).enter().append(\"th\").html(d => d);\n this.sync();\n }\n\n // get inputNode() {\n // return this.node.getElementsByTagName('input')[0];\n // }\n\n\n onActivateRequest(Message) {\n // if (this.isAttached) {\n // this.inputNode.focus();\n // }\n }\n\n async sync () {\n console.log(\"listing.sync\");\n try {\n const db = await (0,indexed_pdb__WEBPACK_IMPORTED_MODULE_1__.openDB)(_ticdb_js__WEBPACK_IMPORTED_MODULE_5__.DB_NAME);\n var objectStore = db.transaction([_ticdb_js__WEBPACK_IMPORTED_MODULE_5__.DB_STORE], \"readonly\").objectStore(_ticdb_js__WEBPACK_IMPORTED_MODULE_5__.DB_STORE);\n var files = [];\n await objectStore.openCursor().then(function push_item(cursor) {\n if (!cursor) { return }\n var filename = _ticdb_js__WEBPACK_IMPORTED_MODULE_5__.filename_from_key(cursor.key);\n if (filename && !filename.startsWith(\".\")) {\n // console.log(cursor.value.contents);\n var blob = new Blob([cursor.value.contents]);\n // console.log(\"blob\", blob, {type: \"application/octet-stream\"});\n var objecturl = URL.createObjectURL(blob);\n files.push({\n key: cursor.key,\n filename: filename,\n size: cursor.value.contents.length,\n timestamp: cursor.value.timestamp,\n objecturl: objecturl\n });\n\n }\n return cursor.continue().then(push_item)\n })\n\n // console.log(\"files\", files);\n let join = this.tbody.selectAll(\"tr\").data(files, d=>d.key);\n join.exit().remove();\n let tr = join.enter().append(\"tr\");\n tr.append(\"td\").attr(\"class\", \"link\").append(\"a\").attr(\"href\", \"#\").html(d => d.filename).on(\"click\", async (e, d) => {\n e.preventDefault();\n var filename = _ticdb_js__WEBPACK_IMPORTED_MODULE_5__.filename_from_key(d.key);\n if (filename) {\n window._tic.filename = filename;\n window._tic.item = await _ticdb_js__WEBPACK_IMPORTED_MODULE_5__.load_key(_ticdb_js__WEBPACK_IMPORTED_MODULE_5__.DB_NAME+\"/\"+window._tic.filename);\n // console.log(\"loaded item\", window._tic.item);\n window._tic.cart = _ticparse_js__WEBPACK_IMPORTED_MODULE_2__.parsetic(window._tic.item.contents.buffer);\n // console.log(\"current_cart\", current_cart);\n window._tic.editor.setValue(window._tic.cart.code.text); \n }\n });\n tr.append(\"td\").attr(\"class\", \"size\");\n tr.append(\"td\").attr(\"class\", \"timestamp\");\n tr.append(\"td\").attr(\"class\", \"download\").append(\"a\").attr(\"href\", d=>d.objecturl).attr(\"download\", d=>d.filename).html(\"download\");\n\n // update Merged enter + join\n let update = tr.merge(join);\n update.select(\".size\").html(d => filesize__WEBPACK_IMPORTED_MODULE_3__(d.size));\n update.select(\".timestamp\").html(d => d.timestamp.toLocaleString());\n\n } catch (error) {\n console.log(error, 'any error during the process');\n }\n }\n}\n\n\n\n/*\nlisting.append(\"button\").html(\"save as...\").on(\"click\", (e, d) => {\n if (current_filename) {\n var save_filename = prompt(\"key\", current_filename);\n if (save_filename) {\n current_filename = save_filename;\n save(); \n }\n }\n});\n*/\n\n/*\nlisting.append(\"input\").attr(\"type\", \"file\").on(\"change\", function (e, d) {\n console.log(\"filechange\", this.files);\n if (this.files.length == 1) {\n this.files[0].arrayBuffer().then(result => {\n console.log(\"file\", result);\n var file_cart = tic.parsetic(result);\n console.log(\"file_cart\", file_cart);\n })\n // reader.readAsArrayBuffer(this.files[0]);\n }\n});\n*/\n\n\n\n//# sourceURL=webpack://ticparse.js/./src/listing.js?");
/***/ }),
/***/ "./src/ticdb.js":
/*!**********************!*\
!*** ./src/ticdb.js ***!
\**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DB_NAME\": () => /* binding */ DB_NAME,\n/* harmony export */ \"DB_STORE\": () => /* binding */ DB_STORE,\n/* harmony export */ \"filename_from_key\": () => /* binding */ filename_from_key,\n/* harmony export */ \"load_key\": () => /* binding */ load_key,\n/* harmony export */ \"save_key\": () => /* binding */ save_key,\n/* harmony export */ \"save_cart\": () => /* binding */ save_cart,\n/* harmony export */ \"compareBuffers\": () => /* binding */ compareBuffers\n/* harmony export */ });\n/* harmony import */ var indexed_pdb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! indexed-pdb */ \"./node_modules/indexed-pdb/build/esm/index.js\");\n\n\nconst DB_NAME = \"/com.nesbox.tic/TIC-80\";\nconst DB_STORE = \"FILE_DATA\";\n\nfunction filename_from_key (key) {\n if (key.startsWith(DB_NAME+\"/\")) { return key.substr((DB_NAME+\"/\").length); }\n}\n\nasync function load_key (key) {\n const db = await (0,indexed_pdb__WEBPACK_IMPORTED_MODULE_0__.openDB)(DB_NAME),\n objectStore = db.transaction([DB_STORE], \"readonly\").objectStore(DB_STORE);\n return await objectStore.get(key);\n} \n\nasync function save_key (key, item) {\n const db = await (0,indexed_pdb__WEBPACK_IMPORTED_MODULE_0__.openDB)(DB_NAME),\n objectStore = db.transaction([DB_STORE], \"readwrite\").objectStore(DB_STORE);\n return await objectStore.put(item, key);\n} \n\nasync function save_cart(filename, cart, mode) {\n return await save_key(DB_NAME+\"/\"+filename, {timestamp: new Date(), contents: cart.tobuffer(), mode: mode});\n}\n\nfunction compareBuffers (a, b) {\n var ad = new DataView(a.buffer),\n bd = new DataView(b.buffer);\n if (ad.byteLength != bd.byteLength) { return false; }\n for (var i=0; i<ad.byteLength; i++) {\n if (ad.getUint8(i, 1) != bd.getUint8(i, 1)) { return false;}\n }\n return true;\n}\n\n\n\n\n//# sourceURL=webpack://ticparse.js/./src/ticdb.js?");
/***/ }),
/***/ "./src/ticparse.js":
/*!*************************!*\
!*** ./src/ticparse.js ***!
\*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CHUNK_TILES\": () => /* binding */ CHUNK_TILES,\n/* harmony export */ \"CHUNK_SPRITES\": () => /* binding */ CHUNK_SPRITES,\n/* harmony export */ \"CHUNK_COVER\": () => /* binding */ CHUNK_COVER,\n/* harmony export */ \"CHUNK_MAP\": () => /* binding */ CHUNK_MAP,\n/* harmony export */ \"CHUNK_CODE\": () => /* binding */ CHUNK_CODE,\n/* harmony export */ \"CHUNK_FLAGS\": () => /* binding */ CHUNK_FLAGS,\n/* harmony export */ \"CHUNK_SAMPLES\": () => /* binding */ CHUNK_SAMPLES,\n/* harmony export */ \"CHUNK_WAVEFORM\": () => /* binding */ CHUNK_WAVEFORM,\n/* harmony export */ \"CHUNK_PALETTE\": () => /* binding */ CHUNK_PALETTE,\n/* harmony export */ \"CHUNK_MUSIC_TRACKS\": () => /* binding */ CHUNK_MUSIC_TRACKS,\n/* harmony export */ \"CHUNK_MUSIC_PATTERNS\": () => /* binding */ CHUNK_MUSIC_PATTERNS,\n/* harmony export */ \"CHUNK_CODE_ZIP\": () => /* binding */ CHUNK_CODE_ZIP,\n/* harmony export */ \"LITTLE_ENDIAN\": () => /* binding */ LITTLE_ENDIAN,\n/* harmony export */ \"parsetic\": () => /* binding */ parsetic\n/* harmony export */ });\n// import { base64decode, base64encode, base64ToBytes } from './base64.js';\n// https://github.com/nesbox/TIC-80/wiki/TIC-File-Format\nconst CHUNK_TILES = 1,\n CHUNK_SPRITES = 2,\n CHUNK_COVER = 3,\n CHUNK_MAP = 4,\n CHUNK_CODE = 5,\n CHUNK_FLAGS = 6,\n CHUNK_SAMPLES = 9,\n CHUNK_WAVEFORM = 10,\n CHUNK_PALETTE = 12,\n CHUNK_MUSIC_TRACKS = 14,\n CHUNK_MUSIC_PATTERNS = 15,\n CHUNK_CODE_ZIP = 16,\n LITTLE_ENDIAN = 1;\n\nfunction pad0(n, p) {\n n = ''+n;\n while (n.length < p) { n = '0'+n; }\n return n;\n}\n\nfunction tohex (a) {\n let ret = '', hh;\n console.log(\"tohex\", a);\n for (var b=0, len=a.byteLength; b<len; b+=1) {\n ret += pad0(a.getUint8(b).toString(16), 2);\n }\n \n return ret;\n}\n\nfunction parsetic (buffer) {\n var ret = {},\n data = new DataView(buffer),\n i=0,\n bank,\n ctype,\n clen,\n future_use,\n firstbyte;\n\n ret.chunks = [];\n ret.chunks_by_type = {};\n while (i<data.byteLength) {\n firstbyte = data.getUint8(i, LITTLE_ENDIAN);\n bank = firstbyte >> 5;\n ctype = firstbyte & 0b11111;\n i+=1;\n clen = data.getUint16(i, LITTLE_ENDIAN);\n i+=2;\n future_use = data.getUint8(i, LITTLE_ENDIAN);\n i+=1; // byte reserved for future_use\n var chunk = {bank: bank, ctype: ctype, future_use: future_use};\n chunk.original_length = clen; // can be out of sync with data, only for control purposes\n ret.chunks.push(chunk);\n ret.chunks_by_type[ctype] = chunk;\n var chunk_data = buffer.slice(i, i+clen);\n if (ctype == CHUNK_CODE) {\n ret.code = chunk;\n chunk.text = new TextDecoder().decode(chunk_data);\n } else {\n //chunk.data = new DataView(buf.buffer, i, clen);\n chunk.data = chunk_data;\n }\n i += clen;\n// chunk.data = base64encode(chunk.data);\n }\n ret.tobuffer = function () {\n // dry run for length\n var outputLength = 0;\n ret.chunks.forEach(chunk => {\n outputLength += 4;\n outputLength += (chunk.text) ? new TextEncoder().encode(chunk.text).byteLength : chunk.data.byteLength;\n });\n var outputBuffer = new Uint8Array(outputLength),\n o = 0,\n data = new DataView(outputBuffer.buffer);\n\n ret.chunks.forEach(chunk => {\n data.setUint8(o++, (chunk.bank << 5) | chunk.ctype);\n var chunk_data = chunk.text ? new TextEncoder().encode(chunk.text) : chunk.data;\n data.setUint16(o, chunk_data.byteLength, 1);\n o += 2;\n data.setUint8(o++, chunk.future_use);\n for (var i=0; i<chunk_data.byteLength; i++) {\n data.setUint8(o++, chunk_data[i]);\n }\n });\n return outputBuffer;\n };\n return ret;\n}\n\n\n//# sourceURL=webpack://ticparse.js/./src/ticparse.js?");
/***/ }),
/***/ "./style/index.css":
/*!*************************!*\
!*** ./style/index.css ***!
\*************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
eval("var api = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ \"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = __webpack_require__(/*! !!../node_modules/css-loader/dist/cjs.js!./index.css */ \"./node_modules/css-loader/dist/cjs.js!./style/index.css\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};\n\n//# sourceURL=webpack://ticparse.js/./style/index.css?");
/***/ }),
/***/ "?8465":
/*!************************!*\
!*** crypto (ignored) ***!
\************************/
/***/ (() => {
eval("/* (ignored) */\n\n//# sourceURL=webpack://ticparse.js/crypto_(ignored)?");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => module['default'] :
/******/ () => module;
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript)
/******/ scriptUrl = document.currentScript.src
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/************************************************************************/
/******/ // startup
/******/ // Load entry module
/******/ __webpack_require__("./src/app.js");
/******/ // This entry module used 'exports' so it can't be inlined
/******/ })()
;