/******/ (function(modules) { // webpackBootstrap /******/ // install a JSONP callback for chunk loading /******/ function webpackJsonpCallback(data) { /******/ var chunkIds = data[0]; /******/ var moreModules = data[1]; /******/ /******/ /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback /******/ var moduleId, chunkId, i = 0, resolves = []; /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ resolves.push(installedChunks[chunkId][0]); /******/ } /******/ installedChunks[chunkId] = 0; /******/ } /******/ for(moduleId in moreModules) { /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { /******/ modules[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if(parentJsonpFunction) parentJsonpFunction(data); /******/ /******/ while(resolves.length) { /******/ resolves.shift()(); /******/ } /******/ /******/ }; /******/ /******/ /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "main": 0 /******/ }; /******/ /******/ /******/ /******/ // script path function /******/ function jsonpScriptSrc(chunkId) { /******/ return __webpack_require__.p + "" + chunkId + ".index.js" /******/ } /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // This file contains only the entry chunk. /******/ // The chunk loading function for additional chunks /******/ __webpack_require__.e = function requireEnsure(chunkId) { /******/ var promises = []; /******/ /******/ /******/ // JSONP chunk loading for javascript /******/ /******/ var installedChunkData = installedChunks[chunkId]; /******/ if(installedChunkData !== 0) { // 0 means "already installed". /******/ /******/ // a Promise means "currently loading". /******/ if(installedChunkData) { /******/ promises.push(installedChunkData[2]); /******/ } else { /******/ // setup Promise in chunk cache /******/ var promise = new Promise(function(resolve, reject) { /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; /******/ }); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading /******/ var script = document.createElement('script'); /******/ var onScriptComplete; /******/ /******/ script.charset = 'utf-8'; /******/ script.timeout = 120; /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } /******/ script.src = jsonpScriptSrc(chunkId); /******/ /******/ // create error before stack unwound to get useful stacktrace later /******/ var error = new Error(); /******/ onScriptComplete = function (event) { /******/ // avoid mem leaks in IE. /******/ script.onerror = script.onload = null; /******/ clearTimeout(timeout); /******/ var chunk = installedChunks[chunkId]; /******/ if(chunk !== 0) { /******/ if(chunk) { /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type); /******/ var realSrc = event && event.target && event.target.src; /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'; /******/ error.name = 'ChunkLoadError'; /******/ error.type = errorType; /******/ error.request = realSrc; /******/ chunk[1](error); /******/ } /******/ installedChunks[chunkId] = undefined; /******/ } /******/ }; /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ document.head.appendChild(script); /******/ } /******/ } /******/ return Promise.all(promises); /******/ }; /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "../lib/"; /******/ /******/ // on error function for async loading /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; /******/ /******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); /******/ jsonpArray.push = webpackJsonpCallback; /******/ jsonpArray = jsonpArray.slice(); /******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); /******/ var parentJsonpFunction = oldJsonpFunction; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/@jupyter-widgets/base/css/index.css": /*!**********************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/css/index.css ***! \**********************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _css_loader_dist_cjs_js_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../../css-loader/dist/cjs.js!./index.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/@jupyter-widgets/base/css/index.css"); var options = {}; options.insert = "head"; options.singleton = false; var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_index_css__WEBPACK_IMPORTED_MODULE_1__["default"], options); /* harmony default export */ __webpack_exports__["default"] = (_css_loader_dist_cjs_js_index_css__WEBPACK_IMPORTED_MODULE_1__["default"].locals || {}); /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/backbone-patch.js": /*!******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/backbone-patch.js ***! \******************************************************************/ /*! exports provided: set */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/base/lib/utils.js"); // This file contains a modified version of the set function from the Backbone // (see // https://github.com/jashkenas/backbone/blob/05fde9e201f7e2137796663081105cd6dad12a98/backbone.js#L460, // with changes below marked with an EDIT comment). This file in Backbone has the following license. var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; // (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Backbone may be freely distributed under the MIT license. // For all details and documentation: // http://backbonejs.org // Backbone's full license is below (from https://github.com/jashkenas/backbone/blob/05fde9e201f7e2137796663081105cd6dad12a98/LICENSE) /* Copyright (c) 2010-2015 Jeremy Ashkenas, DocumentCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // Set a hash of model attributes on the object, firing `"change"`. This is // the core primitive operation of a model, updating the data and notifying // anyone who needs to know about the change in state. The heart of the beast. // This *MUST* be called with the model as the `this` context. function set(key, val, options) { /* tslint:disable:no-invalid-this */ if (key == null) { return this; } // Handle both `"key", value` and `{key: value}` -style arguments. var attrs; if (typeof key === 'object') { attrs = key; options = val; } else { (attrs = {})[key] = val; } options || (options = {}); // Run validation. if (!this._validate(attrs, options)) { return false; } // Extract attributes and options. var unset = options.unset; var silent = options.silent; var changes = []; var changing = this._changing; this._changing = true; if (!changing) { // EDIT: changed to use object spread instead of _.clone this._previousAttributes = __assign({}, this.attributes); this.changed = {}; } var current = this.attributes; var changed = this.changed; var prev = this._previousAttributes; // For each `set` attribute, update or delete the current value. for (var attr in attrs) { val = attrs[attr]; // EDIT: the following two lines use our isEqual instead of _.isEqual if (!_utils__WEBPACK_IMPORTED_MODULE_0__["isEqual"](current[attr], val)) { changes.push(attr); } if (!_utils__WEBPACK_IMPORTED_MODULE_0__["isEqual"](prev[attr], val)) { changed[attr] = val; } else { delete changed[attr]; } unset ? delete current[attr] : current[attr] = val; } // Update the `id`. this.id = this.get(this.idAttribute); // Trigger all relevant attribute changes. if (!silent) { if (changes.length) { this._pending = options; } for (var i = 0; i < changes.length; i++) { this.trigger('change:' + changes[i], this, current[changes[i]], options); } } // You might be wondering why there's a `while` loop here. Changes can // be recursively nested within `"change"` events. if (changing) { return this; } if (!silent) { while (this._pending) { options = this._pending; this._pending = false; this.trigger('change', this, options); } } this._pending = false; this._changing = false; return this; /* tslint:enable:no-invalid-this */ } /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/index.js": /*!*********************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/index.js ***! \*********************************************************/ /*! exports provided: CONTROL_COMM_TARGET, CONTROL_COMM_PROTOCOL_VERSION, CONTROL_COMM_TIMEOUT, ManagerBase, serialize_state, unpack_models, WidgetModel, DOMWidgetModel, WidgetView, JupyterPhosphorWidget, JupyterPhosphorPanelWidget, DOMWidgetView, LayoutModel, LayoutView, StyleModel, StyleView, shims, ViewList, JUPYTER_WIDGETS_VERSION, PROTOCOL_VERSION, difference, isEqual, assign, uuid, WrappedError, resolvePromisesDict, reject, put_buffers, remove_buffers, bufferToHex, hexToBuffer, bufferToBase64, base64ToBuffer, IJupyterWidgetRegistry */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _manager_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./manager-base */ "./node_modules/@jupyter-widgets/base/lib/manager-base.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CONTROL_COMM_TARGET", function() { return _manager_base__WEBPACK_IMPORTED_MODULE_0__["CONTROL_COMM_TARGET"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CONTROL_COMM_PROTOCOL_VERSION", function() { return _manager_base__WEBPACK_IMPORTED_MODULE_0__["CONTROL_COMM_PROTOCOL_VERSION"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CONTROL_COMM_TIMEOUT", function() { return _manager_base__WEBPACK_IMPORTED_MODULE_0__["CONTROL_COMM_TIMEOUT"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ManagerBase", function() { return _manager_base__WEBPACK_IMPORTED_MODULE_0__["ManagerBase"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "serialize_state", function() { return _manager_base__WEBPACK_IMPORTED_MODULE_0__["serialize_state"]; }); /* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget */ "./node_modules/@jupyter-widgets/base/lib/widget.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "unpack_models", function() { return _widget__WEBPACK_IMPORTED_MODULE_1__["unpack_models"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WidgetModel", function() { return _widget__WEBPACK_IMPORTED_MODULE_1__["WidgetModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DOMWidgetModel", function() { return _widget__WEBPACK_IMPORTED_MODULE_1__["DOMWidgetModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WidgetView", function() { return _widget__WEBPACK_IMPORTED_MODULE_1__["WidgetView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorWidget", function() { return _widget__WEBPACK_IMPORTED_MODULE_1__["JupyterPhosphorWidget"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorPanelWidget", function() { return _widget__WEBPACK_IMPORTED_MODULE_1__["JupyterPhosphorPanelWidget"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DOMWidgetView", function() { return _widget__WEBPACK_IMPORTED_MODULE_1__["DOMWidgetView"]; }); /* harmony import */ var _widget_layout__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./widget_layout */ "./node_modules/@jupyter-widgets/base/lib/widget_layout.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LayoutModel", function() { return _widget_layout__WEBPACK_IMPORTED_MODULE_2__["LayoutModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LayoutView", function() { return _widget_layout__WEBPACK_IMPORTED_MODULE_2__["LayoutView"]; }); /* harmony import */ var _widget_style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./widget_style */ "./node_modules/@jupyter-widgets/base/lib/widget_style.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StyleModel", function() { return _widget_style__WEBPACK_IMPORTED_MODULE_3__["StyleModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StyleView", function() { return _widget_style__WEBPACK_IMPORTED_MODULE_3__["StyleView"]; }); /* harmony import */ var _services_shim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./services-shim */ "./node_modules/@jupyter-widgets/base/lib/services-shim.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shims", function() { return _services_shim__WEBPACK_IMPORTED_MODULE_4__["shims"]; }); /* harmony import */ var _viewlist__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./viewlist */ "./node_modules/@jupyter-widgets/base/lib/viewlist.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ViewList", function() { return _viewlist__WEBPACK_IMPORTED_MODULE_5__["ViewList"]; }); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./version */ "./node_modules/@jupyter-widgets/base/lib/version.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JUPYTER_WIDGETS_VERSION", function() { return _version__WEBPACK_IMPORTED_MODULE_6__["JUPYTER_WIDGETS_VERSION"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PROTOCOL_VERSION", function() { return _version__WEBPACK_IMPORTED_MODULE_6__["PROTOCOL_VERSION"]; }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/base/lib/utils.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["difference"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["isEqual"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["assign"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "uuid", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["uuid"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WrappedError", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["WrappedError"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resolvePromisesDict", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["resolvePromisesDict"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["reject"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "put_buffers", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["put_buffers"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "remove_buffers", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["remove_buffers"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferToHex", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["bufferToHex"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexToBuffer", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["hexToBuffer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferToBase64", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["bufferToBase64"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "base64ToBuffer", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__["base64ToBuffer"]; }); /* harmony import */ var _registry__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./registry */ "./node_modules/@jupyter-widgets/base/lib/registry.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IJupyterWidgetRegistry", function() { return _registry__WEBPACK_IMPORTED_MODULE_8__["IJupyterWidgetRegistry"]; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/manager-base.js": /*!****************************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/manager-base.js ***! \****************************************************************/ /*! exports provided: CONTROL_COMM_TARGET, CONTROL_COMM_PROTOCOL_VERSION, CONTROL_COMM_TIMEOUT, ManagerBase, serialize_state */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONTROL_COMM_TARGET", function() { return CONTROL_COMM_TARGET; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONTROL_COMM_PROTOCOL_VERSION", function() { return CONTROL_COMM_PROTOCOL_VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONTROL_COMM_TIMEOUT", function() { return CONTROL_COMM_TIMEOUT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ManagerBase", function() { return ManagerBase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serialize_state", function() { return serialize_state; }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/base/lib/utils.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./version */ "./node_modules/@jupyter-widgets/base/lib/version.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var PROTOCOL_MAJOR_VERSION = _version__WEBPACK_IMPORTED_MODULE_2__["PROTOCOL_VERSION"].split('.', 1)[0]; /** * The control comm target name. */ var CONTROL_COMM_TARGET = 'jupyter.widget.control'; /** * The supported version for the control comm channel. */ var CONTROL_COMM_PROTOCOL_VERSION = '1.0.0'; /** * Time (in ms) after which we consider the control comm target not responding. */ var CONTROL_COMM_TIMEOUT = 4000; /** * Manager abstract base class */ var ManagerBase = /** @class */ (function () { function ManagerBase() { /** * The comm target name to register */ this.comm_target_name = 'jupyter.widget'; /** * Dictionary of model ids and model instance promises */ this._models = Object.create(null); } /** * Display a DOMWidgetView for a particular model. */ ManagerBase.prototype.display_model = function (msg, model, options) { var _this = this; if (options === void 0) { options = {}; } return this.create_view(model, options).then(function (view) { return _this.display_view(msg, view, options); }).catch(_utils__WEBPACK_IMPORTED_MODULE_0__["reject"]('Could not create view', true)); }; /** * Modifies view options. Generally overloaded in custom widget manager * implementations. */ ManagerBase.prototype.setViewOptions = function (options) { if (options === void 0) { options = {}; } return options; }; ManagerBase.prototype.create_view = function (model, options) { var _this = this; if (options === void 0) { options = {}; } var viewPromise = model.state_change = model.state_change.then(function () { return _this.loadClass(model.get('_view_name'), model.get('_view_module'), model.get('_view_module_version')).then(function (ViewType) { var view = new ViewType({ model: model, options: _this.setViewOptions(options) }); view.listenTo(model, 'destroy', view.remove); return Promise.resolve(view.render()).then(function () { return view; }); }).catch(_utils__WEBPACK_IMPORTED_MODULE_0__["reject"]('Could not create a view for model id ' + model.model_id, true)); }); var id = _utils__WEBPACK_IMPORTED_MODULE_0__["uuid"](); model.views[id] = viewPromise; viewPromise.then(function (view) { view.once('remove', function () { delete view.model.views[id]; }, _this); }); return model.state_change; }; /** * callback handlers specific to a view */ ManagerBase.prototype.callbacks = function (view) { return {}; }; /** * Get a promise for a model by model id. * * #### Notes * If a model is not found, undefined is returned (NOT a promise). However, * the calling code should also deal with the case where a rejected promise * is returned, and should treat that also as a model not found. */ ManagerBase.prototype.get_model = function (model_id) { // TODO: Perhaps we should return a Promise.reject if the model is not // found. Right now this isn't a true async function because it doesn't // always return a promise. return this._models[model_id]; }; /** * Returns true if the given model is registered, otherwise false. * * #### Notes * This is a synchronous way to check if a model is registered. */ ManagerBase.prototype.has_model = function (model_id) { return this._models[model_id] !== undefined; }; /** * Handle when a comm is opened. */ ManagerBase.prototype.handle_comm_open = function (comm, msg) { var protocolVersion = (msg.metadata || {}).version || ''; if (protocolVersion.split('.', 1)[0] !== PROTOCOL_MAJOR_VERSION) { var error = "Wrong widget protocol version: received protocol version '" + protocolVersion + "', but was expecting major version '" + PROTOCOL_MAJOR_VERSION + "'"; console.error(error); return Promise.reject(error); } var data = msg.content.data; var buffer_paths = data.buffer_paths || []; // Make sure the buffers are DataViews var buffers = (msg.buffers || []).map(function (b) { if (b instanceof DataView) { return b; } else { return new DataView(b instanceof ArrayBuffer ? b : b.buffer); } }); _utils__WEBPACK_IMPORTED_MODULE_0__["put_buffers"](data.state, buffer_paths, buffers); return this.new_model({ model_name: data.state['_model_name'], model_module: data.state['_model_module'], model_module_version: data.state['_model_module_version'], comm: comm }, data.state).catch(_utils__WEBPACK_IMPORTED_MODULE_0__["reject"]('Could not create a model.', true)); }; /** * Create a comm and new widget model. * @param options - same options as new_model but comm is not * required and additional options are available. * @param serialized_state - serialized model attributes. */ ManagerBase.prototype.new_widget = function (options, serialized_state) { var _this = this; if (serialized_state === void 0) { serialized_state = {}; } var commPromise; // we check to make sure the view information is provided, to help catch // backwards incompatibility errors. if (options.view_name === undefined || options.view_module === undefined || options.view_module_version === undefined) { return Promise.reject('new_widget(...) must be given view information in the options.'); } // If no comm is provided, a new comm is opened for the jupyter.widget // target. if (options.comm) { commPromise = Promise.resolve(options.comm); } else { commPromise = this._create_comm(this.comm_target_name, options.model_id, { state: { _model_module: options.model_module, _model_module_version: options.model_module_version, _model_name: options.model_name, _view_module: options.view_module, _view_module_version: options.view_module_version, _view_name: options.view_name }, }, { version: _version__WEBPACK_IMPORTED_MODULE_2__["PROTOCOL_VERSION"] }); } // The options dictionary is copied since data will be added to it. var options_clone = __assign({}, options); // Create the model. In the case where the comm promise is rejected a // comm-less model is still created with the required model id. return commPromise.then(function (comm) { // Comm Promise Resolved. options_clone.comm = comm; var widget_model = _this.new_model(options_clone, serialized_state); return widget_model.then(function (model) { model.sync('create', model); return model; }); }, function () { // Comm Promise Rejected. if (!options_clone.model_id) { options_clone.model_id = _utils__WEBPACK_IMPORTED_MODULE_0__["uuid"](); } return _this.new_model(options_clone, serialized_state); }); }; ManagerBase.prototype.register_model = function (model_id, modelPromise) { var _this = this; this._models[model_id] = modelPromise; modelPromise.then(function (model) { model.once('comm:close', function () { delete _this._models[model_id]; }); }); }; /** * Create and return a promise for a new widget model * * @param options - the options for creating the model. * @param serialized_state - attribute values for the model. * * @example * widget_manager.new_model({ * model_name: 'IntSlider', * model_module: '@jupyter-widgets/controls', * model_module_version: '1.0.0', * model_id: 'u-u-i-d' * }).then((model) => { console.log('Create success!', model); }, * (err) => {console.error(err)}); * */ ManagerBase.prototype.new_model = function (options, serialized_state) { if (serialized_state === void 0) { serialized_state = {}; } return __awaiter(this, void 0, void 0, function () { var model_id, modelPromise; return __generator(this, function (_a) { switch (_a.label) { case 0: if (options.model_id) { model_id = options.model_id; } else if (options.comm) { model_id = options.model_id = options.comm.comm_id; } else { throw new Error('Neither comm nor model_id provided in options object. At least one must exist.'); } modelPromise = this._make_model(options, serialized_state); // this call needs to happen before the first `await`, see note in `set_state`: this.register_model(model_id, modelPromise); return [4 /*yield*/, modelPromise]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; ManagerBase.prototype._make_model = function (options, serialized_state) { if (serialized_state === void 0) { serialized_state = {}; } return __awaiter(this, void 0, void 0, function () { var model_id, model_promise, ModelType, error_1, attributes, modelOptions, widget_model; return __generator(this, function (_a) { switch (_a.label) { case 0: model_id = options.model_id; model_promise = this.loadClass(options.model_name, options.model_module, options.model_module_version); _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4 /*yield*/, model_promise]; case 2: ModelType = _a.sent(); return [3 /*break*/, 4]; case 3: error_1 = _a.sent(); console.error('Could not instantiate widget'); throw error_1; case 4: if (!ModelType) { throw new Error("Cannot find model module " + options.model_module + "@" + options.model_module_version + ", " + options.model_name); } return [4 /*yield*/, ModelType._deserialize_state(serialized_state, this)]; case 5: attributes = _a.sent(); modelOptions = { widget_manager: this, model_id: model_id, comm: options.comm, }; widget_model = new ModelType(attributes, modelOptions); widget_model.name = options.model_name; widget_model.module = options.model_module; return [2 /*return*/, widget_model]; } }); }); }; /** * Fetch all widgets states from the kernel using the control comm channel * If this fails (control comm handler not implemented kernel side), * it will fall back to `_loadFromKernelModels`. * * This is a utility function that can be used in subclasses. */ ManagerBase.prototype._loadFromKernel = function () { return __awaiter(this, void 0, void 0, function () { var data, buffers, initComm_1, error_2, states, bufferPaths, bufferGroups, i, _a, widget_id, path, b, widget_comms; var _this = this; return __generator(this, function (_b) { switch (_b.label) { case 0: _b.trys.push([0, 3, , 4]); return [4 /*yield*/, this._create_comm(CONTROL_COMM_TARGET, _utils__WEBPACK_IMPORTED_MODULE_0__["uuid"](), {}, { version: CONTROL_COMM_PROTOCOL_VERSION })]; case 1: initComm_1 = _b.sent(); return [4 /*yield*/, new Promise(function (resolve, reject) { initComm_1.on_msg(function (msg) { data = msg['content']['data']; if (data.method !== 'update_states') { console.warn("\n Unknown " + data.method + " message on the Control channel\n "); return; } buffers = (msg.buffers || []).map(function (b) { if (b instanceof DataView) { return b; } else { return new DataView(b instanceof ArrayBuffer ? b : b.buffer); } }); resolve(null); }); initComm_1.on_close(function () { return reject('Control comm was closed too early'); }); // Send a states request msg initComm_1.send({ method: 'request_states' }, {}); // Reject if we didn't get a response in time setTimeout(function () { return reject('Control comm did not respond in time'); }, CONTROL_COMM_TIMEOUT); })]; case 2: _b.sent(); initComm_1.close(); return [3 /*break*/, 4]; case 3: error_2 = _b.sent(); console.warn('Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason:', error_2); // Fall back to the old implementation for old ipywidgets backend versions (ipywidgets<=7.6) return [2 /*return*/, this._loadFromKernelModels()]; case 4: states = data.states; bufferPaths = {}; bufferGroups = {}; // Group buffers and buffer paths by widget id for (i = 0; i < data.buffer_paths.length; i++) { _a = data.buffer_paths[i], widget_id = _a[0], path = _a.slice(1); b = buffers[i]; if (!bufferPaths[widget_id]) { bufferPaths[widget_id] = []; bufferGroups[widget_id] = []; } bufferPaths[widget_id].push(path); bufferGroups[widget_id].push(b); } return [4 /*yield*/, Promise.all(Object.keys(states).map(function (widget_id) { return __awaiter(_this, void 0, void 0, function () { var comm, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: if (!this.has_model(widget_id)) return [3 /*break*/, 1]; _a = undefined; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, this._create_comm('jupyter.widget', widget_id)]; case 2: _a = _b.sent(); _b.label = 3; case 3: comm = _a; return [2 /*return*/, { widget_id: widget_id, comm: comm }]; } }); }); }))]; case 5: widget_comms = _b.sent(); return [4 /*yield*/, Promise.all(widget_comms.map(function (_a) { var widget_id = _a.widget_id, comm = _a.comm; return __awaiter(_this, void 0, void 0, function () { var state, model, error_3; return __generator(this, function (_b) { switch (_b.label) { case 0: state = states[widget_id]; // Put binary buffers if (widget_id in bufferPaths) { _utils__WEBPACK_IMPORTED_MODULE_0__["put_buffers"](state, bufferPaths[widget_id], bufferGroups[widget_id]); } _b.label = 1; case 1: _b.trys.push([1, 6, , 7]); if (!comm) return [3 /*break*/, 3]; // This must be the first await in the code path that // reaches here so that registering the model promise in // new_model can register the widget promise before it may // be required by other widgets. return [4 /*yield*/, this.new_model({ model_name: state.model_name, model_module: state.model_module, model_module_version: state.model_module_version, model_id: widget_id, comm: comm, }, state.state)]; case 2: // This must be the first await in the code path that // reaches here so that registering the model promise in // new_model can register the widget promise before it may // be required by other widgets. _b.sent(); return [3 /*break*/, 5]; case 3: return [4 /*yield*/, this.get_model(widget_id)]; case 4: model = _b.sent(); model.set_state(state.state); _b.label = 5; case 5: return [3 /*break*/, 7]; case 6: error_3 = _b.sent(); // Failed to create a widget model, we continue creating other models so that // other widgets can render console.error(error_3); return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }))]; case 6: _b.sent(); return [2 /*return*/]; } }); }); }; /** * Old implementation of fetching widget models one by one using * the request_state message on each comm. * * This is a utility function that can be used in subclasses. */ ManagerBase.prototype._loadFromKernelModels = function () { return __awaiter(this, void 0, void 0, function () { var comm_ids, widgets_info; var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this._get_comm_info()]; case 1: comm_ids = _a.sent(); return [4 /*yield*/, Promise.all(Object.keys(comm_ids).map(function (comm_id) { return __awaiter(_this, void 0, void 0, function () { var comm, msg_id, info; return __generator(this, function (_a) { switch (_a.label) { case 0: if (this.has_model(comm_id)) { return [2 /*return*/]; } return [4 /*yield*/, this._create_comm(this.comm_target_name, comm_id)]; case 1: comm = _a.sent(); msg_id = ''; info = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__["PromiseDelegate"](); comm.on_msg(function (msg) { if (msg.parent_header.msg_id === msg_id && msg.header.msg_type === 'comm_msg' && msg.content.data.method === 'update') { var data = msg.content.data; var buffer_paths = data.buffer_paths || []; var buffers = msg.buffers || []; _utils__WEBPACK_IMPORTED_MODULE_0__["put_buffers"](data.state, buffer_paths, buffers); info.resolve({ comm: comm, msg: msg }); } }); msg_id = comm.send({ method: 'request_state', }, this.callbacks(undefined)); return [2 /*return*/, info.promise]; } }); }); }))]; case 2: widgets_info = _a.sent(); // We put in a synchronization barrier here so that we don't have to // topologically sort the restored widgets. `new_model` synchronously // registers the widget ids before reconstructing their state // asynchronously, so promises to every widget reference should be available // by the time they are used. return [4 /*yield*/, Promise.all(widgets_info.map(function (widget_info) { return __awaiter(_this, void 0, void 0, function () { var content; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!widget_info) { return [2 /*return*/]; } content = widget_info.msg.content; return [4 /*yield*/, this.new_model({ model_name: content.data.state._model_name, model_module: content.data.state._model_module, model_module_version: content.data.state._model_module_version, comm: widget_info.comm, }, content.data.state)]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }))]; case 3: // We put in a synchronization barrier here so that we don't have to // topologically sort the restored widgets. `new_model` synchronously // registers the widget ids before reconstructing their state // asynchronously, so promises to every widget reference should be available // by the time they are used. _a.sent(); return [2 /*return*/]; } }); }); }; /** * Close all widgets and empty the widget state. * @return Promise that resolves when the widget state is cleared. */ ManagerBase.prototype.clear_state = function () { var _this = this; return _utils__WEBPACK_IMPORTED_MODULE_0__["resolvePromisesDict"](this._models).then(function (models) { Object.keys(models).forEach(function (id) { return models[id].close(); }); _this._models = Object.create(null); }); }; /** * Asynchronously get the state of the widget manager. * * This includes all of the widget models, and follows the format given in * the @jupyter-widgets/schema package. * * @param options - The options for what state to return. * @returns Promise for a state dictionary */ ManagerBase.prototype.get_state = function (options) { var _this = this; if (options === void 0) { options = {}; } var modelPromises = Object.keys(this._models).map(function (id) { return _this._models[id]; }); return Promise.all(modelPromises).then(function (models) { return serialize_state(models, options); }); }; /** * Set the widget manager state. * * @param state - a Javascript object conforming to the application/vnd.jupyter.widget-state+json spec. * * Reconstructs all of the widget models in the state, merges that with the * current manager state, and then attempts to redisplay the widgets in the * state. */ ManagerBase.prototype.set_state = function (state) { var _this = this; // Check to make sure that it's the same version we are parsing. if (!(state.version_major && state.version_major <= 2)) { throw 'Unsupported widget state format'; } var models = state.state; // Recreate all the widget models for the given widget manager state. var all_models = this._get_comm_info().then(function (live_comms) { /* Note: It is currently safe to just loop over the models in any order, given that the following holds (does at the time of writing): 1: any call to `new_model` with state registers the model promise (e.g. with `register_model`) synchronously (before it's first `await` statement). 2: any calls to a model constructor or the `set_state` method on a model, happens asynchronously (in a `then` clause, or after an `await` statement). Without these assumptions, one risks trying to set model state with a reference to another model that doesn't exist yet! */ return Promise.all(Object.keys(models).map(function (model_id) { // First put back the binary buffers var decode = { 'base64': _utils__WEBPACK_IMPORTED_MODULE_0__["base64ToBuffer"], 'hex': _utils__WEBPACK_IMPORTED_MODULE_0__["hexToBuffer"] }; var model = models[model_id]; var modelState = model.state; if (model.buffers) { var bufferPaths = model.buffers.map(function (b) { return b.path; }); // put_buffers expects buffers to be DataViews var buffers = model.buffers.map(function (b) { return new DataView(decode[b.encoding](b.data)); }); _utils__WEBPACK_IMPORTED_MODULE_0__["put_buffers"](model.state, bufferPaths, buffers); } // If the model has already been created, set its state and then // return it. if (_this.has_model(model_id)) { return _this.get_model(model_id).then(function (model) { // deserialize state return model.constructor._deserialize_state(modelState || {}, _this).then(function (attributes) { model.set_state(attributes); // case 2 return model; }); }); } var modelCreate = { model_id: model_id, model_name: model.model_name, model_module: model.model_module, model_module_version: model.model_module_version }; if (live_comms.hasOwnProperty(model_id)) { // live comm // This connects to an existing comm if it exists, and // should *not* send a comm open message. return _this._create_comm(_this.comm_target_name, model_id).then(function (comm) { modelCreate.comm = comm; return _this.new_model(modelCreate); // No state, so safe wrt. case 1 }); } else { return _this.new_model(modelCreate, modelState); // case 1 } })); }); return all_models; }; /** * Disconnect the widget manager from the kernel, setting each model's comm * as dead. */ ManagerBase.prototype.disconnect = function () { var _this = this; Object.keys(this._models).forEach(function (i) { _this._models[i].then(function (model) { model.comm_live = false; }); }); }; /** * Resolve a URL relative to the current notebook location. * * The default implementation just returns the original url. */ ManagerBase.prototype.resolveUrl = function (url) { return Promise.resolve(url); }; /** * Filter serialized widget state to remove any ID's already present in manager. * * @param {*} state Serialized state to filter * * @returns {*} A copy of the state, with its 'state' attribute filtered */ ManagerBase.prototype.filterExistingModelState = function (serialized_state) { var _this = this; var models = serialized_state.state; models = Object.keys(models) .filter(function (model_id) { return !_this.has_model(model_id); }) .reduce(function (res, model_id) { res[model_id] = models[model_id]; return res; }, {}); return __assign(__assign({}, serialized_state), { state: models }); }; return ManagerBase; }()); /** * Serialize an array of widget models * * #### Notes * The return value follows the format given in the * @jupyter-widgets/schema package. */ function serialize_state(models, options) { if (options === void 0) { options = {}; } var state = {}; models.forEach(function (model) { var model_id = model.model_id; var split = _utils__WEBPACK_IMPORTED_MODULE_0__["remove_buffers"](model.serialize(model.get_state(options.drop_defaults))); var buffers = split.buffers.map(function (buffer, index) { return { data: _utils__WEBPACK_IMPORTED_MODULE_0__["bufferToBase64"](buffer), path: split.buffer_paths[index], encoding: 'base64' }; }); state[model_id] = { model_name: model.name, model_module: model.module, model_module_version: model.get('_model_module_version'), state: split.state }; // To save space, only include the buffers key if we have buffers if (buffers.length > 0) { state[model_id].buffers = buffers; } }); return { version_major: 2, version_minor: 0, state: state }; } /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/nativeview.js": /*!**************************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/nativeview.js ***! \**************************************************************/ /*! exports provided: NativeView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NativeView", function() { return NativeView; }); /* harmony import */ var backbone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! backbone */ "./node_modules/backbone/backbone.js"); /* harmony import */ var backbone__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(backbone__WEBPACK_IMPORTED_MODULE_0__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* This file contains substantial portions of https://github.com/akre54/Backbone.NativeView/blob/521188d9554b53d95d70ed34f878d8ac9fc10df2/backbone.nativeview.js, which has the following license: (c) 2015 Adam Krebs, Jimmy Yuen Ho Wong Backbone.NativeView may be freely distributed under the MIT license. Copyright (c) 2014 Adam Krebs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // Caches a local reference to `Element.prototype` for faster access. var ElementProto = Element.prototype; // : typeof Element = (typeof Element !== 'undefined' && Element.prototype) || {}; // Find the right `Element#matches` for IE>=9 and modern browsers. var matchesSelector = ElementProto.matches || ElementProto['webkitMatchesSelector'] || ElementProto['mozMatchesSelector'] || ElementProto['msMatchesSelector'] || ElementProto['oMatchesSelector'] || function matches(selector) { /* tslint:disable:no-invalid-this */ var matches = (this.document || this.ownerDocument).querySelectorAll(selector); var i = matches.length; while (--i >= 0 && matches.item(i) !== this) { continue; } return i > -1; /* tslint:enable:no-invalid-this */ }; var NativeView = /** @class */ (function (_super) { __extends(NativeView, _super); function NativeView() { return _super !== null && _super.apply(this, arguments) || this; } NativeView.prototype._removeElement = function () { this.undelegateEvents(); if (this.el.parentNode) { this.el.parentNode.removeChild(this.el); } }; // Apply the `element` to the view. NativeView.prototype._setElement = function (element) { this.el = element; }; // Set a hash of attributes to the view's `el`. We use the "prop" version // if available, falling back to `setAttribute` for the catch-all. NativeView.prototype._setAttributes = function (attrs) { for (var attr in attrs) { attr in this.el ? this.el[attr] = attrs[attr] : this.el.setAttribute(attr, attrs[attr]); } }; /** * Make an event delegation handler for the given `eventName` and `selector` * and attach it to `this.el`. * If selector is empty, the listener will be bound to `this.el`. If not, a * new handler that will recursively traverse up the event target's DOM * hierarchy looking for a node that matches the selector. If one is found, * the event's `delegateTarget` property is set to it and the return the * result of calling bound `listener` with the parameters given to the * handler. * * This does not properly handle selectors for things like focus and blur (see * https://github.com/jquery/jquery/blob/7d21f02b9ec9f655583e898350badf89165ed4d5/src/event.js#L442 * for some similar exceptional cases). */ NativeView.prototype.delegate = function (eventName, selector, listener) { if (typeof selector !== 'string') { listener = selector; selector = null; } // We have to initialize this here, instead of in the constructor, because the // super constructor eventually calls this method before we get a chance to initialize // this._domEvents to an empty list. if (this._domEvents === void 0) { this._domEvents = []; } var root = this.el; var handler = selector ? function (e) { var node = e.target || e.srcElement; for (; node && node !== root; node = node.parentNode) { if (matchesSelector.call(node, selector)) { e.delegateTarget = node; if (listener.handleEvent) { return listener.handleEvent(e); } else { return listener(e); } } } } : listener; this.el.addEventListener(eventName, handler, false); this._domEvents.push({ eventName: eventName, handler: handler, listener: listener, selector: selector }); return handler; }; // Remove a single delegated event. Either `eventName` or `selector` must // be included, `selector` and `listener` are optional. NativeView.prototype.undelegate = function (eventName, selector, listener) { if (typeof selector === 'function') { listener = selector; selector = null; } if (this.el && this._domEvents) { var handlers = this._domEvents.slice(); var i = handlers.length; while (i--) { var item = handlers[i]; var match = item.eventName === eventName && (listener ? item.listener === listener : true) && (selector ? item.selector === selector : true); if (!match) { continue; } this.el.removeEventListener(item.eventName, item.handler, false); this._domEvents.splice(i, 1); } } return this; }; // Remove all events created with `delegate` from `el` NativeView.prototype.undelegateEvents = function () { if (this.el && this._domEvents) { var len = this._domEvents.length; for (var i = 0; i < len; i++) { var item = this._domEvents[i]; this.el.removeEventListener(item.eventName, item.handler, false); } this._domEvents.length = 0; } return this; }; return NativeView; }(backbone__WEBPACK_IMPORTED_MODULE_0__["View"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/registry.js": /*!************************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/registry.js ***! \************************************************************/ /*! exports provided: IJupyterWidgetRegistry */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IJupyterWidgetRegistry", function() { return IJupyterWidgetRegistry; }); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * A runtime interface token for a widget registry. */ var IJupyterWidgetRegistry = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["Token"]('jupyter.extensions.jupyterWidgetRegistry'); /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/services-shim.js": /*!*****************************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/services-shim.js ***! \*****************************************************************/ /*! exports provided: shims */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shims", function() { return shims; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { 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; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var shims; (function (shims) { var services; (function (services) { /** * Public constructor * @param jsServicesKernel - @jupyterlab/services Kernel.IKernel instance */ var CommManager = /** @class */ (function () { function CommManager(jsServicesKernel) { this.targets = Object.create(null); this.comms = Object.create(null); this.kernel = null; this.jsServicesKernel = null; this.init_kernel(jsServicesKernel); } /** * Hookup kernel events. * @param {Kernel.IKernel} jsServicesKernel - @jupyterlab/services Kernel.IKernel instance */ CommManager.prototype.init_kernel = function (jsServicesKernel) { this.kernel = jsServicesKernel; // These aren't really the same. this.jsServicesKernel = jsServicesKernel; }; /** * Creates a new connected comm */ CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id, buffers) { return __awaiter(this, void 0, void 0, function () { var c, comm; return __generator(this, function (_a) { c = this.jsServicesKernel.createComm(target_name, comm_id); comm = new Comm(c); this.register_comm(comm); comm.open(data, callbacks, metadata, buffers); return [2 /*return*/, comm]; }); }); }; /** * Register a comm target * @param {string} target_name * @param {(Comm, object) => void} f - callback that is called when the * comm is made. Signature of f(comm, msg). */ CommManager.prototype.register_target = function (target_name, f) { var _this = this; var handle = this.jsServicesKernel.registerCommTarget(target_name, function (jsServicesComm, msg) { // Create the comm. var comm = new Comm(jsServicesComm); _this.register_comm(comm); // Call the callback for the comm. try { return f(comm, msg); } catch (e) { comm.close(); console.error(e); console.error(new Error('Exception opening new comm')); } }); this.targets[target_name] = handle; }; /** * Unregisters a comm target * @param {string} target_name */ CommManager.prototype.unregister_target = function (target_name, f) { var handle = this.targets[target_name]; handle.dispose(); delete this.targets[target_name]; }; /** * Register a comm in the mapping */ CommManager.prototype.register_comm = function (comm) { this.comms[comm.comm_id] = Promise.resolve(comm); comm.kernel = this.kernel; return comm.comm_id; }; return CommManager; }()); services.CommManager = CommManager; /** * Public constructor * @param {IComm} jsServicesComm - @jupyterlab/services IComm instance */ var Comm = /** @class */ (function () { function Comm(jsServicesComm) { this.jsServicesComm = null; this.kernel = null; this.jsServicesComm = jsServicesComm; } Object.defineProperty(Comm.prototype, "comm_id", { /** * Comm id * @return {string} */ get: function () { return this.jsServicesComm.commId; }, enumerable: true, configurable: true }); Object.defineProperty(Comm.prototype, "target_name", { /** * Target name * @return {string} */ get: function () { return this.jsServicesComm.targetName; }, enumerable: true, configurable: true }); /** * Opens a sibling comm in the backend * @param data * @param callbacks * @param metadata * @return msg id */ Comm.prototype.open = function (data, callbacks, metadata, buffers) { var future = this.jsServicesComm.open(data, metadata, buffers); this._hookupCallbacks(future, callbacks); return future.msg.header.msg_id; }; /** * Sends a message to the sibling comm in the backend * @param data * @param callbacks * @param metadata * @param buffers * @return message id */ Comm.prototype.send = function (data, callbacks, metadata, buffers) { var future = this.jsServicesComm.send(data, metadata, buffers); this._hookupCallbacks(future, callbacks); return future.msg.header.msg_id; }; /** * Closes the sibling comm in the backend * @param data * @param callbacks * @param metadata * @return msg id */ Comm.prototype.close = function (data, callbacks, metadata, buffers) { var future = this.jsServicesComm.close(data, metadata, buffers); this._hookupCallbacks(future, callbacks); return future.msg.header.msg_id; }; /** * Register a message handler * @param callback, which is given a message */ Comm.prototype.on_msg = function (callback) { this.jsServicesComm.onMsg = callback.bind(this); }; /** * Register a handler for when the comm is closed by the backend * @param callback, which is given a message */ Comm.prototype.on_close = function (callback) { this.jsServicesComm.onClose = callback.bind(this); }; /** * Hooks callback object up with @jupyterlab/services IKernelFuture * @param @jupyterlab/services IKernelFuture instance * @param callbacks */ Comm.prototype._hookupCallbacks = function (future, callbacks) { if (callbacks) { future.onReply = function (msg) { if (callbacks.shell && callbacks.shell.reply) { callbacks.shell.reply(msg); } // TODO: Handle payloads. See https://github.com/jupyter/notebook/blob/master/notebook/static/services/kernels/kernel.js#L923-L947 }; future.onStdin = function (msg) { if (callbacks.input) { callbacks.input(msg); } }; future.onIOPub = function (msg) { if (callbacks.iopub) { if (callbacks.iopub.status && msg.header.msg_type === 'status') { callbacks.iopub.status(msg); } else if (callbacks.iopub.clear_output && msg.header.msg_type === 'clear_output') { callbacks.iopub.clear_output(msg); } else if (callbacks.iopub.output) { switch (msg.header.msg_type) { case 'display_data': case 'execute_result': case 'stream': case 'error': callbacks.iopub.output(msg); break; default: break; } } } }; } }; return Comm; }()); services.Comm = Comm; })(services = shims.services || (shims.services = {})); })(shims || (shims = {})); /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/utils.js": /*!*********************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/utils.js ***! \*********************************************************/ /*! exports provided: difference, isEqual, assign, uuid, WrappedError, resolvePromisesDict, reject, put_buffers, remove_buffers, bufferToHex, hexToBuffer, bufferToBase64, base64ToBuffer */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return difference; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return isEqual; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return assign; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uuid", function() { return uuid; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WrappedError", function() { return WrappedError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolvePromisesDict", function() { return resolvePromisesDict; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return reject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "put_buffers", function() { return put_buffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "remove_buffers", function() { return remove_buffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferToHex", function() { return bufferToHex; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexToBuffer", function() { return hexToBuffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferToBase64", function() { return bufferToBase64; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "base64ToBuffer", function() { return base64ToBuffer; }); /* harmony import */ var base64_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js"); /* harmony import */ var base64_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(base64_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/isEqual */ "./node_modules/lodash/isEqual.js"); /* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isEqual__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/isPlainObject */ "./node_modules/lodash/isPlainObject.js"); /* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; /** * Find all strings in the first argument that are not in the second. */ function difference(a, b) { return a.filter(function (v) { return b.indexOf(v) === -1; }); } /** * Compare two objects deeply to see if they are equal. */ function isEqual(a, b) { return lodash_isEqual__WEBPACK_IMPORTED_MODULE_2___default()(a, b); } /** * A polyfill for Object.assign * * This is from code that Typescript 2.4 generates for a polyfill. */ var assign = Object.assign || function (t) { for (var i = 1; i < arguments.length; i++) { var s = arguments[i]; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } } return t; }; /** * Generate a UUID * * http://www.ietf.org/rfc/rfc4122.txt */ function uuid() { return _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__["UUID"].uuid4(); } /** * Wrappable Error class * * The Error class doesn't actually act on `this`. Instead it always * returns a new instance of Error. Here we capture that instance so we * can apply it's properties to `this`. */ var WrappedError = /** @class */ (function (_super) { __extends(WrappedError, _super); function WrappedError(message, error) { var _this = _super.call(this, message) || this; console.warn('WrappedError has been deprecated!'); // Keep a stack of the original error messages. if (error instanceof WrappedError) { _this.error_stack = error.error_stack; } else { _this.error_stack = [error]; } _this.error_stack.push(_this); return _this; } return WrappedError; }(Error)); /** * Resolve a promiseful dictionary. * Returns a single Promise. */ function resolvePromisesDict(d) { var keys = Object.keys(d); var values = []; keys.forEach(function (key) { values.push(d[key]); }); return Promise.all(values).then(function (v) { var d = {}; for (var i = 0; i < keys.length; i++) { d[keys[i]] = v[i]; } return d; }); } /** * Creates a wrappable Promise rejection function. * * Creates a function that logs an error message before rethrowing * the original error that caused the promise to reject. */ function reject(message, log) { return function promiseRejection(error) { if (log) { console.error(new Error(message)); } throw error; }; } /** * Takes an object 'state' and fills in buffer[i] at 'path' buffer_paths[i] * where buffer_paths[i] is a list indicating where in the object buffer[i] should * be placed * Example: state = {a: 1, b: {}, c: [0, null]} * buffers = [array1, array2] * buffer_paths = [['b', 'data'], ['c', 1]] * Will lead to {a: 1, b: {data: array1}, c: [0, array2]} */ function put_buffers(state, buffer_paths, buffers) { for (var i = 0; i < buffer_paths.length; i++) { var buffer_path = buffer_paths[i]; // say we want to set state[x][y][z] = buffers[i] var obj = state; // we first get obj = state[x][y] for (var j = 0; j < buffer_path.length - 1; j++) { obj = obj[buffer_path[j]]; } // and then set: obj[z] = buffers[i] obj[buffer_path[buffer_path.length - 1]] = buffers[i]; } } /** * The inverse of put_buffers, return an objects with the new state where all buffers(ArrayBuffer) * are removed. If a buffer is a member of an object, that object is cloned, and the key removed. If a buffer * is an element of an array, that array is cloned, and the element is set to null. * See put_buffers for the meaning of buffer_paths * Returns an object with the new state (.state) an array with paths to the buffers (.buffer_paths), * and the buffers associated to those paths (.buffers). */ function remove_buffers(state) { var buffers = []; var buffer_paths = []; // if we need to remove an object from a list, we need to clone that list, otherwise we may modify // the internal state of the widget model // however, we do not want to clone everything, for performance function remove(obj, path) { if (obj.toJSON) { // We need to get the JSON form of the object before recursing. // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior obj = obj.toJSON(); } if (Array.isArray(obj)) { var is_cloned = false; for (var i = 0; i < obj.length; i++) { var value = obj[i]; if (value) { if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) { if (!is_cloned) { obj = obj.slice(); is_cloned = true; } buffers.push(ArrayBuffer.isView(value) ? value.buffer : value); buffer_paths.push(path.concat([i])); // easier to just keep the array, but clear the entry, otherwise we have to think // about array length, much easier this way obj[i] = null; } else { var new_value = remove(value, path.concat([i])); // only assigned when the value changes, we may serialize objects that don't support assignment if (new_value !== value) { if (!is_cloned) { obj = obj.slice(); is_cloned = true; } obj[i] = new_value; } } } } } else if (lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_3___default()(obj)) { for (var key in obj) { var is_cloned = false; if (obj.hasOwnProperty(key)) { var value = obj[key]; if (value) { if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) { if (!is_cloned) { obj = __assign({}, obj); is_cloned = true; } buffers.push(ArrayBuffer.isView(value) ? value.buffer : value); buffer_paths.push(path.concat([key])); delete obj[key]; // for objects/dicts we just delete them } else { var new_value = remove(value, path.concat([key])); // only assigned when the value changes, we may serialize objects that don't support assignment if (new_value !== value) { if (!is_cloned) { obj = __assign({}, obj); is_cloned = true; } obj[key] = new_value; } } } } } } return obj; } var new_state = remove(state, []); return { state: new_state, buffers: buffers, buffer_paths: buffer_paths }; } var hexTable = [ '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0A', '0B', '0C', '0D', '0E', '0F', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1A', '1B', '1C', '1D', '1E', '1F', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2A', '2B', '2C', '2D', '2E', '2F', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3A', '3B', '3C', '3D', '3E', '3F', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4A', '4B', '4C', '4D', '4E', '4F', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5A', '5B', '5C', '5D', '5E', '5F', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6A', '6B', '6C', '6D', '6E', '6F', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7A', '7B', '7C', '7D', '7E', '7F', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8A', '8B', '8C', '8D', '8E', '8F', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9A', '9B', '9C', '9D', '9E', '9F', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'B0', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9', 'CA', 'CB', 'CC', 'CD', 'CE', 'CF', 'D0', 'D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'DA', 'DB', 'DC', 'DD', 'DE', 'DF', 'E0', 'E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8', 'E9', 'EA', 'EB', 'EC', 'ED', 'EE', 'EF', 'F0', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'FA', 'FB', 'FC', 'FD', 'FE', 'FF' ]; /** * Convert an ArrayBuffer to a hex string. */ function bufferToHex(buffer) { var x = new Uint8Array(buffer); var s = []; for (var i = 0; i < x.length; i++) { s.push(hexTable[x[i]]); } return s.join(''); } /** * Convert a hex string to an ArrayBuffer. */ function hexToBuffer(hex) { var x = new Uint8Array(hex.length / 2); for (var i = 0; i < hex.length; i += 2) { x[i / 2] = parseInt(hex.slice(i, i + 2), 16); } return x.buffer; } /** * Convert an ArrayBuffer to a base64 string. */ function bufferToBase64(buffer) { return Object(base64_js__WEBPACK_IMPORTED_MODULE_0__["fromByteArray"])(new Uint8Array(buffer)); } /** * Convert a base64 string to an ArrayBuffer. */ function base64ToBuffer(base64) { return Object(base64_js__WEBPACK_IMPORTED_MODULE_0__["toByteArray"])(base64).buffer; } /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/version.js": /*!***********************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/version.js ***! \***********************************************************/ /*! exports provided: JUPYTER_WIDGETS_VERSION, PROTOCOL_VERSION */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JUPYTER_WIDGETS_VERSION", function() { return JUPYTER_WIDGETS_VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PROTOCOL_VERSION", function() { return PROTOCOL_VERSION; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var JUPYTER_WIDGETS_VERSION = '1.2.0'; var PROTOCOL_VERSION = '2.1.0'; /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/viewlist.js": /*!************************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/viewlist.js ***! \************************************************************/ /*! exports provided: ViewList */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewList", function() { return ViewList; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * - create_view and remove_view are default functions called when adding or removing views * - create_view takes a model and an index and returns a view or a promise for a view for that model * - remove_view takes a view and destroys it (including calling `view.remove()`) * - each time the update() function is called with a new list, the create and remove * callbacks will be called in an order so that if you append the views created in the * create callback and remove the views in the remove callback, you will duplicate * the order of the list. * - the remove callback defaults to just removing the view (e.g., pass in null for the second parameter) * - the context defaults to the created ViewList. If you pass another context, the create and remove * will be called in that context. */ var ViewList = /** @class */ (function () { function ViewList(create_view, remove_view, context) { this.initialize(create_view, remove_view, context); } ViewList.prototype.initialize = function (create_view, remove_view, context) { this._handler_context = context || this; this._models = []; this.views = []; // list of promises for views this._create_view = create_view; this._remove_view = remove_view || function (view) { view.remove(); }; }; /** * the create_view, remove_view, and context arguments override the defaults * specified when the list is created. * after this function, the .views attribute is a list of promises for views * if you want to perform some action on the list of views, do something like * `Promise.all(myviewlist.views).then(function(views) {...});` */ ViewList.prototype.update = function (new_models, create_view, remove_view, context) { var remove = remove_view || this._remove_view; var create = create_view || this._create_view; context = context || this._handler_context; var i = 0; // first, skip past the beginning of the lists if they are identical for (; i < new_models.length; i++) { if (i >= this._models.length || new_models[i] !== this._models[i]) { break; } } var first_removed = i; // Remove the non-matching items from the old list. var removed = this.views.splice(first_removed, this.views.length - first_removed); for (var j = 0; j < removed.length; j++) { removed[j].then(function (view) { remove.call(context, view); }); } // Add the rest of the new list items. for (; i < new_models.length; i++) { this.views.push(Promise.resolve(create.call(context, new_models[i], i))); } // make a copy of the input array this._models = new_models.slice(); // return a promise that resolves to all of the resolved views return Promise.all(this.views); }; /** * removes every view in the list; convenience function for `.update([])` * that should be faster * returns a promise that resolves after this removal is done */ ViewList.prototype.remove = function () { var _this = this; return Promise.all(this.views).then(function (views) { views.forEach(function (value) { return _this._remove_view.call(_this._handler_context, value); }); _this.views = []; _this._models = []; }); }; /** * Dispose this viewlist. * * A synchronous function which just deletes references to child views. This * function does not call .remove() on child views because that is * asynchronous. Use this in cases where child views will be removed in * another way. */ ViewList.prototype.dispose = function () { this.views = null; this._models = null; }; return ViewList; }()); /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/widget.js": /*!**********************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/widget.js ***! \**********************************************************/ /*! exports provided: unpack_models, WidgetModel, DOMWidgetModel, WidgetView, JupyterPhosphorWidget, JupyterPhosphorPanelWidget, DOMWidgetView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unpack_models", function() { return unpack_models; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WidgetModel", function() { return WidgetModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMWidgetModel", function() { return DOMWidgetModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WidgetView", function() { return WidgetView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorWidget", function() { return JupyterPhosphorWidget; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorPanelWidget", function() { return JupyterPhosphorPanelWidget; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMWidgetView", function() { return DOMWidgetView; }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/base/lib/utils.js"); /* harmony import */ var _backbone_patch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./backbone-patch */ "./node_modules/@jupyter-widgets/base/lib/backbone-patch.js"); /* harmony import */ var backbone__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! backbone */ "./node_modules/backbone/backbone.js"); /* harmony import */ var backbone__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(backbone__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _nativeview__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nativeview */ "./node_modules/@jupyter-widgets/base/lib/nativeview.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/messaging */ "./node_modules/@lumino/messaging/dist/index.es6.js"); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./version */ "./node_modules/@jupyter-widgets/base/lib/version.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; /** * Replace model ids with models recursively. */ function unpack_models(value, manager) { if (Array.isArray(value)) { var unpacked_1 = []; value.forEach(function (sub_value, key) { unpacked_1.push(unpack_models(sub_value, manager)); }); return Promise.all(unpacked_1); } else if (value instanceof Object) { var unpacked_2 = {}; Object.keys(value).forEach(function (key) { unpacked_2[key] = unpack_models(value[key], manager); }); return _utils__WEBPACK_IMPORTED_MODULE_0__["resolvePromisesDict"](unpacked_2); } else if (typeof value === 'string' && value.slice(0, 10) === 'IPY_MODEL_') { // get_model returns a promise already return manager.get_model(value.slice(10, value.length)); } else { return Promise.resolve(value); } } var WidgetModel = /** @class */ (function (_super) { __extends(WidgetModel, _super); function WidgetModel() { return _super !== null && _super.apply(this, arguments) || this; } /** * The default attributes. */ WidgetModel.prototype.defaults = function () { return { _model_module: '@jupyter-widgets/base', _model_name: 'WidgetModel', _model_module_version: _version__WEBPACK_IMPORTED_MODULE_7__["JUPYTER_WIDGETS_VERSION"], _view_module: '@jupyter-widgets/base', _view_name: null, _view_module_version: _version__WEBPACK_IMPORTED_MODULE_7__["JUPYTER_WIDGETS_VERSION"], _view_count: null, }; }; /** * Test to see if the model has been synced with the server. * * #### Notes * As of backbone 1.1, backbone ignores `patch` if it thinks the * model has never been pushed. */ WidgetModel.prototype.isNew = function () { return false; }; /** * Constructor * * Initializes a WidgetModel instance. Called by the Backbone constructor. * * Parameters * ---------- * widget_manager : WidgetManager instance * model_id : string * An ID unique to this model. * comm : Comm instance (optional) */ WidgetModel.prototype.initialize = function (attributes, options) { this._expectedEchoMsgIds = {}; this._attrsToUpdate = {}; _super.prototype.initialize.call(this, attributes, options); // Attributes should be initialized here, since user initialization may depend on it this.widget_manager = options.widget_manager; this.model_id = options.model_id; var comm = options.comm; this.views = Object.create(null); this.state_change = Promise.resolve(); this._closed = false; this._state_lock = null; this._msg_buffer = null; this._msg_buffer_callbacks = null; this._pending_msgs = 0; // _buffered_state_diff must be created *after* the super.initialize // call above. See the note in the set() method below. this._buffered_state_diff = {}; if (comm) { // Remember comm associated with the model. this.comm = comm; // Hook comm messages up to model. comm.on_close(this._handle_comm_closed.bind(this)); comm.on_msg(this._handle_comm_msg.bind(this)); this.comm_live = true; } else { this.comm_live = false; } }; Object.defineProperty(WidgetModel.prototype, "comm_live", { get: function () { return this._comm_live; }, set: function (x) { this._comm_live = x; this.trigger('comm_live_update'); }, enumerable: true, configurable: true }); /** * Send a custom msg over the comm. */ WidgetModel.prototype.send = function (content, callbacks, buffers) { if (this.comm !== undefined) { var data = { method: 'custom', content: content }; this.comm.send(data, callbacks, {}, buffers); } }; /** * Close model * * @param comm_closed - true if the comm is already being closed. If false, the comm will be closed. * * @returns - a promise that is fulfilled when all the associated views have been removed. */ WidgetModel.prototype.close = function (comm_closed) { var _this = this; if (comm_closed === void 0) { comm_closed = false; } // can only be closed once. if (this._closed) { return; } this._closed = true; if (this.comm && !comm_closed) { this.comm.close(); } this.stopListening(); this.trigger('destroy', this); if (this.comm) { delete this.comm; } // Delete all views of this model var views = Object.keys(this.views).map(function (id) { return _this.views[id].then(function (view) { return view.remove(); }); }); delete this.views; return Promise.all(views).then(function () { return; }); }; /** * Handle when a widget comm is closed. */ WidgetModel.prototype._handle_comm_closed = function (msg) { this.trigger('comm:close'); this.close(true); }; /** * Handle incoming comm msg. */ WidgetModel.prototype._handle_comm_msg = function (msg) { var _this = this; var data = msg.content.data; var method = data.method; // tslint:disable-next-line:switch-default switch (method) { case 'update': case 'echo_update': this.state_change = this.state_change .then(function () { var _a, _b, _c; var state = data.state; var buffer_paths = (_a = data.buffer_paths, (_a !== null && _a !== void 0 ? _a : [])); // Make sure the buffers are DataViews var buffers = (_c = (_b = msg.buffers) === null || _b === void 0 ? void 0 : _b.slice(0, buffer_paths.length), (_c !== null && _c !== void 0 ? _c : [])).map(function (b) { if (b instanceof DataView) { return b; } else { return new DataView(b instanceof ArrayBuffer ? b : b.buffer); } }); _utils__WEBPACK_IMPORTED_MODULE_0__["put_buffers"](state, buffer_paths, buffers); if (msg.parent_header && method === 'echo_update') { var msgId_1 = msg.parent_header.msg_id; // we may have echos coming from other clients, we only care about // dropping echos for which we expected a reply var expectedEcho = Object.keys(state).filter(function (attrName) { return _this._expectedEchoMsgIds.hasOwnProperty(attrName); }); expectedEcho.forEach(function (attrName) { // Skip echo messages until we get the reply we are expecting. var isOldMessage = _this._expectedEchoMsgIds[attrName] !== msgId_1; if (isOldMessage) { // Ignore an echo update that comes before our echo. delete state[attrName]; } else { // we got our echo confirmation, so stop looking for it delete _this._expectedEchoMsgIds[attrName]; // Start accepting echo updates unless we plan to send out a new state soon if (_this._msg_buffer !== null && Object.prototype.hasOwnProperty.call(_this._msg_buffer, attrName)) { delete state[attrName]; } } }); } return _this.constructor._deserialize_state(state, _this.widget_manager); }).then(function (state) { _this.set_state(state); }).catch(_utils__WEBPACK_IMPORTED_MODULE_0__["reject"]("Could not process update msg for model id: " + this.model_id, true)); return this.state_change; case 'custom': this.trigger('msg:custom', data.content, msg.buffers); return Promise.resolve(); } }; /** * Handle when a widget is updated from the backend. * * This function is meant for internal use only. Values set here will not be propagated on a sync. */ WidgetModel.prototype.set_state = function (state) { this._state_lock = state; try { this.set(state); } catch (e) { console.error("Error setting state: " + e.message); } finally { this._state_lock = null; } }; /** * Get the serializable state of the model. * * If drop_default is truthy, attributes that are equal to their default * values are dropped. */ WidgetModel.prototype.get_state = function (drop_defaults) { var fullState = this.attributes; if (drop_defaults) { // if defaults is a function, call it var d = this.defaults; var defaults_1 = (typeof d === 'function') ? d.call(this) : d; var state_1 = {}; Object.keys(fullState).forEach(function (key) { if (!(_utils__WEBPACK_IMPORTED_MODULE_0__["isEqual"](fullState[key], defaults_1[key]))) { state_1[key] = fullState[key]; } }); return state_1; } else { return __assign({}, fullState); } }; /** * Handle status msgs. * * execution_state : ('busy', 'idle', 'starting') */ WidgetModel.prototype._handle_status = function (msg) { if (this.comm !== void 0) { if (msg.content.execution_state === 'idle') { this._pending_msgs--; // Send buffer if one is waiting and we are below the throttle. if (this._msg_buffer !== null && this._pending_msgs < 1) { var msgId = this.send_sync_message(this._msg_buffer, this._msg_buffer_callbacks); this.rememberLastUpdateFor(msgId); this._msg_buffer = null; this._msg_buffer_callbacks = null; } } } }; /** * Create msg callbacks for a comm msg. */ WidgetModel.prototype.callbacks = function (view) { return this.widget_manager.callbacks(view); }; /** * Set one or more values. * * We just call the super method, in which val and options are optional. * Handles both "key", value and {key: value} -style arguments. */ WidgetModel.prototype.set = function (key, val, options) { // Call our patched backbone set. See #1642 and #1643. var return_value = _backbone_patch__WEBPACK_IMPORTED_MODULE_1__["set"].call(this, key, val, options); // Backbone only remembers the diff of the most recent set() // operation. Calling set multiple times in a row results in a // loss of change information. Here we keep our own running diff. // // We don't buffer the state set in the constructor (including // defaults), so we first check to see if we've initialized _buffered_state_diff. // which happens after the constructor sets attributes at creation. if (this._buffered_state_diff !== void 0) { var attrs = this.changedAttributes() || {}; // The state_lock lists attributes that are currently being changed // right now from a kernel message. We don't want to send these // non-changes back to the kernel, so we delete them out of attrs if // they haven't changed from their state_lock value. // The state lock could be null or undefined (if set is being called from // the initializer). if (this._state_lock) { for (var _i = 0, _a = Object.keys(this._state_lock); _i < _a.length; _i++) { var key_1 = _a[_i]; if (attrs[key_1] === this._state_lock[key_1]) { delete attrs[key_1]; } } } this._buffered_state_diff = _utils__WEBPACK_IMPORTED_MODULE_0__["assign"](this._buffered_state_diff, attrs); } return return_value; }; /** * Handle sync to the back-end. Called when a model.save() is called. * * Make sure a comm exists. * * Parameters * ---------- * method : create, update, patch, delete, read * create/update always send the full attribute set * patch - only send attributes listed in options.attrs, and if we * are queuing up messages, combine with previous messages that have * not been sent yet * model : the model we are syncing * will normally be the same as `this` * options : dict * the `attrs` key, if it exists, gives an {attr: value} dict that * should be synced, otherwise, sync all attributes. * */ WidgetModel.prototype.sync = function (method, model, options) { var _this = this; if (options === void 0) { options = {}; } // the typing is to return `any` since the super.sync method returns a JqXHR, but we just return false if there is an error. if (this.comm === undefined) { throw 'Syncing error: no comm channel defined'; } var attrs = (method === 'patch') ? options.attrs : model.get_state(options.drop_defaults); // The state_lock lists attributes that are currently being changed // right now from a kernel message. We don't want to send these // non-changes back to the kernel, so we delete them out of attrs if // they haven't changed from their state_lock value. // The state lock could be null or undefined (if this is triggered // from the initializer). if (this._state_lock) { for (var _i = 0, _a = Object.keys(this._state_lock); _i < _a.length; _i++) { var key = _a[_i]; if (attrs[key] === this._state_lock[key]) { delete attrs[key]; } } } Object.keys(attrs).forEach(function (attrName) { _this._attrsToUpdate[attrName] = true; }); var msgState = this.serialize(attrs); if (Object.keys(msgState).length > 0) { // If this message was sent via backbone itself, it will not // have any callbacks. It's important that we create callbacks // so we can listen for status messages, etc... var callbacks = options.callbacks || this.callbacks(); // Check throttle. if (this._pending_msgs >= 1) { // The throttle has been exceeded, buffer the current msg so // it can be sent once the kernel has finished processing // some of the existing messages. // Combine updates if it is a 'patch' sync, otherwise replace updates switch (method) { case 'patch': this._msg_buffer = _utils__WEBPACK_IMPORTED_MODULE_0__["assign"](this._msg_buffer || {}, msgState); break; case 'update': case 'create': this._msg_buffer = msgState; break; default: throw 'unrecognized syncing method'; } this._msg_buffer_callbacks = callbacks; } else { // We haven't exceeded the throttle, send the message like // normal. var msgId = this.send_sync_message(attrs, callbacks); this.rememberLastUpdateFor(msgId); // Since the comm is a one-way communication, assume the message // arrived and was processed successfully. // Don't call options.success since we don't have a model back from // the server. Note that this means we don't have the Backbone // 'sync' event. } } }; WidgetModel.prototype.rememberLastUpdateFor = function (msgId) { var _this = this; Object.keys(this._attrsToUpdate).forEach(function (attrName) { _this._expectedEchoMsgIds[attrName] = msgId; }); this._attrsToUpdate = {}; }; /** * Serialize widget state. * * A serializer is a function which takes in a state attribute and a widget, * and synchronously returns a JSONable object. The returned object will * have toJSON called if possible, and the final result should be a * primitive object that is a snapshot of the widget state that may have * binary array buffers. */ WidgetModel.prototype.serialize = function (state) { var serializers = this.constructor.serializers || {}; for (var _i = 0, _a = Object.keys(state); _i < _a.length; _i++) { var k = _a[_i]; try { if (serializers[k] && serializers[k].serialize) { state[k] = (serializers[k].serialize)(state[k], this); } else { // the default serializer just deep-copies the object state[k] = JSON.parse(JSON.stringify(state[k])); } if (state[k] && state[k].toJSON) { state[k] = state[k].toJSON(); } } catch (e) { console.error('Error serializing widget state attribute: ', k); throw e; } } return state; }; /** * Send a sync message to the kernel. */ WidgetModel.prototype.send_sync_message = function (state, callbacks) { var _this = this; if (callbacks === void 0) { callbacks = {}; } if (!this.comm) { return ''; } try { callbacks.iopub = callbacks.iopub || {}; var statuscb_1 = callbacks.iopub.status; callbacks.iopub.status = function (msg) { _this._handle_status(msg); if (statuscb_1) { statuscb_1(msg); } }; // split out the binary buffers var split = _utils__WEBPACK_IMPORTED_MODULE_0__["remove_buffers"](state); var msgId = this.comm.send({ method: 'update', state: split.state, buffer_paths: split.buffer_paths }, callbacks, {}, split.buffers); this._pending_msgs++; return msgId; } catch (e) { console.error('Could not send widget sync message', e); } return ''; }; /** * Push this model's state to the back-end * * This invokes a Backbone.Sync. */ WidgetModel.prototype.save_changes = function (callbacks) { if (this.comm_live) { var options = { patch: true }; if (callbacks) { options.callbacks = callbacks; } this.save(this._buffered_state_diff, options); this._buffered_state_diff = {}; } }; /** * on_some_change(['key1', 'key2'], foo, context) differs from * on('change:key1 change:key2', foo, context). * If the widget attributes key1 and key2 are both modified, * the second form will result in foo being called twice * while the first will call foo only once. */ WidgetModel.prototype.on_some_change = function (keys, callback, context) { var scope = this; this.on('change', function () { if (keys.some(scope.hasChanged, scope)) { callback.apply(context, arguments); } }, this); }; /** * Serialize the model. See the deserialization function at the top of this file * and the kernel-side serializer/deserializer. */ WidgetModel.prototype.toJSON = function (options) { return "IPY_MODEL_" + this.model_id; }; /** * Returns a promise for the deserialized state. The second argument * is an instance of widget manager, which is required for the * deserialization of widget models. */ WidgetModel._deserialize_state = function (state, manager) { var serializers = this.serializers; var deserialized; if (serializers) { deserialized = {}; for (var k in state) { if (serializers[k] && serializers[k].deserialize) { deserialized[k] = (serializers[k].deserialize)(state[k], manager); } else { deserialized[k] = state[k]; } } } else { deserialized = state; } return _utils__WEBPACK_IMPORTED_MODULE_0__["resolvePromisesDict"](deserialized); }; return WidgetModel; }(backbone__WEBPACK_IMPORTED_MODULE_2__["Model"])); var DOMWidgetModel = /** @class */ (function (_super) { __extends(DOMWidgetModel, _super); function DOMWidgetModel() { return _super !== null && _super.apply(this, arguments) || this; } DOMWidgetModel.prototype.defaults = function () { return _utils__WEBPACK_IMPORTED_MODULE_0__["assign"](_super.prototype.defaults.call(this), { _dom_classes: [] // We do not declare defaults for the layout and style attributes. // Those defaults are constructed on the kernel side and synced here // as needed, and our code here copes with those attributes being // undefined. See // https://github.com/jupyter-widgets/ipywidgets/issues/1620 and // https://github.com/jupyter-widgets/ipywidgets/pull/1621 }); }; DOMWidgetModel.serializers = __assign(__assign({}, WidgetModel.serializers), { layout: { deserialize: unpack_models }, style: { deserialize: unpack_models } }); return DOMWidgetModel; }(WidgetModel)); var WidgetView = /** @class */ (function (_super) { __extends(WidgetView, _super); /** * Public constructor. */ function WidgetView(options) { return _super.call(this, options) || this; } /** * Initializer, called at the end of the constructor. */ WidgetView.prototype.initialize = function (parameters) { var _this = this; this.listenTo(this.model, 'change', function () { var changed = Object.keys(_this.model.changedAttributes() || {}); if (changed[0] === '_view_count' && changed.length === 1) { // Just the view count was updated return; } _this.update(); }); this.options = parameters.options; this.once('remove', function () { if (typeof (_this.model.get('_view_count')) === 'number') { _this.model.set('_view_count', _this.model.get('_view_count') - 1); _this.model.save_changes(); } }); this.once('displayed', function () { if (typeof (_this.model.get('_view_count')) === 'number') { _this.model.set('_view_count', _this.model.get('_view_count') + 1); _this.model.save_changes(); } }); this.displayed = new Promise(function (resolve, reject) { _this.once('displayed', resolve); }); }; /** * Triggered on model change. * * Update view to be consistent with this.model */ WidgetView.prototype.update = function (options) { return; }; /** * Render a view * * @returns the view or a promise to the view. */ WidgetView.prototype.render = function () { return; }; /** * Create and promise that resolves to a child view of a given model */ WidgetView.prototype.create_child_view = function (child_model, options) { if (options === void 0) { options = {}; } options = __assign({ parent: this }, options); return this.model.widget_manager.create_view(child_model, options) .catch(_utils__WEBPACK_IMPORTED_MODULE_0__["reject"]('Could not create child view', true)); }; /** * Create msg callbacks for a comm msg. */ WidgetView.prototype.callbacks = function () { return this.model.callbacks(this); }; /** * Send a custom msg associated with this view. */ WidgetView.prototype.send = function (content, buffers) { this.model.send(content, this.callbacks(), buffers); }; WidgetView.prototype.touch = function () { this.model.save_changes(this.callbacks()); }; WidgetView.prototype.remove = function () { // Raise a remove event when the view is removed. _super.prototype.remove.call(this); this.trigger('remove'); return this; }; return WidgetView; }(_nativeview__WEBPACK_IMPORTED_MODULE_4__["NativeView"])); var JupyterPhosphorWidget = /** @class */ (function (_super) { __extends(JupyterPhosphorWidget, _super); function JupyterPhosphorWidget(options) { var _this = this; var view = options.view; delete options.view; _this = _super.call(this, options) || this; _this._view = view; return _this; } /** * Dispose the widget. * * This causes the view to be destroyed as well with 'remove' */ JupyterPhosphorWidget.prototype.dispose = function () { if (this.isDisposed) { return; } _super.prototype.dispose.call(this); if (this._view) { this._view.remove(); } this._view = null; }; /** * Process the phosphor message. * * Any custom phosphor widget used inside a Jupyter widget should override * the processMessage function like this. */ JupyterPhosphorWidget.prototype.processMessage = function (msg) { _super.prototype.processMessage.call(this, msg); this._view.processPhosphorMessage(msg); }; return JupyterPhosphorWidget; }(_lumino_widgets__WEBPACK_IMPORTED_MODULE_5__["Widget"])); var JupyterPhosphorPanelWidget = /** @class */ (function (_super) { __extends(JupyterPhosphorPanelWidget, _super); function JupyterPhosphorPanelWidget(options) { var _this = this; var view = options.view; delete options.view; _this = _super.call(this, options) || this; _this._view = view; return _this; } /** * Process the phosphor message. * * Any custom phosphor widget used inside a Jupyter widget should override * the processMessage function like this. */ JupyterPhosphorPanelWidget.prototype.processMessage = function (msg) { _super.prototype.processMessage.call(this, msg); this._view.processPhosphorMessage(msg); }; /** * Dispose the widget. * * This causes the view to be destroyed as well with 'remove' */ JupyterPhosphorPanelWidget.prototype.dispose = function () { if (this.isDisposed) { return; } _super.prototype.dispose.call(this); if (this._view) { this._view.remove(); } this._view = null; }; return JupyterPhosphorPanelWidget; }(_lumino_widgets__WEBPACK_IMPORTED_MODULE_5__["Panel"])); var DOMWidgetView = /** @class */ (function (_super) { __extends(DOMWidgetView, _super); function DOMWidgetView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor */ DOMWidgetView.prototype.initialize = function (parameters) { var _this = this; _super.prototype.initialize.call(this, parameters); this.listenTo(this.model, 'change:_dom_classes', function (model, new_classes) { var old_classes = model.previous('_dom_classes'); _this.update_classes(old_classes, new_classes); }); this.layoutPromise = Promise.resolve(); this.listenTo(this.model, 'change:layout', function (model, value) { _this.setLayout(value, model.previous('layout')); }); this.stylePromise = Promise.resolve(); this.listenTo(this.model, 'change:style', function (model, value) { _this.setStyle(value, model.previous('style')); }); this.displayed.then(function () { _this.update_classes([], _this.model.get('_dom_classes')); _this.setLayout(_this.model.get('layout')); _this.setStyle(_this.model.get('style')); }); this._comm_live_update(); this.listenTo(this.model, 'comm_live_update', function () { _this._comm_live_update(); }); }; DOMWidgetView.prototype.setLayout = function (layout, oldLayout) { var _this = this; if (layout) { this.layoutPromise = this.layoutPromise.then(function (oldLayoutView) { if (oldLayoutView) { oldLayoutView.unlayout(); _this.stopListening(oldLayoutView.model); oldLayoutView.remove(); } return _this.create_child_view(layout).then(function (view) { // Trigger the displayed event of the child view. return _this.displayed.then(function () { view.trigger('displayed'); _this.listenTo(view.model, 'change', function () { // Post (asynchronous) so layout changes can take // effect first. _lumino_messaging__WEBPACK_IMPORTED_MODULE_6__["MessageLoop"].postMessage(_this.pWidget, _lumino_widgets__WEBPACK_IMPORTED_MODULE_5__["Widget"].ResizeMessage.UnknownSize); }); _lumino_messaging__WEBPACK_IMPORTED_MODULE_6__["MessageLoop"].postMessage(_this.pWidget, _lumino_widgets__WEBPACK_IMPORTED_MODULE_5__["Widget"].ResizeMessage.UnknownSize); return view; }); }).catch(_utils__WEBPACK_IMPORTED_MODULE_0__["reject"]('Could not add LayoutView to DOMWidgetView', true)); }); } }; DOMWidgetView.prototype.setStyle = function (style, oldStyle) { var _this = this; if (style) { this.stylePromise = this.stylePromise.then(function (oldStyleView) { if (oldStyleView) { oldStyleView.unstyle(); _this.stopListening(oldStyleView.model); oldStyleView.remove(); } return _this.create_child_view(style).then(function (view) { // Trigger the displayed event of the child view. return _this.displayed.then(function () { view.trigger('displayed'); // Unlike for the layout attribute, style changes don't // trigger phosphor resize messages. return view; }); }).catch(_utils__WEBPACK_IMPORTED_MODULE_0__["reject"]('Could not add styleView to DOMWidgetView', true)); }); } }; /** * Update the DOM classes applied to an element, default to this.el. */ DOMWidgetView.prototype.update_classes = function (old_classes, new_classes, el) { if (el === undefined) { el = this.el; } _utils__WEBPACK_IMPORTED_MODULE_0__["difference"](old_classes, new_classes).map(function (c) { if (el.classList) { // classList is not supported by IE for svg elements el.classList.remove(c); } else { el.setAttribute('class', el.getAttribute('class').replace(c, '')); } }); _utils__WEBPACK_IMPORTED_MODULE_0__["difference"](new_classes, old_classes).map(function (c) { if (el.classList) { // classList is not supported by IE for svg elements el.classList.add(c); } else { el.setAttribute('class', el.getAttribute('class').concat(' ', c)); } }); }; /** * Update the DOM classes applied to the widget based on a single * trait's value. * * Given a trait value classes map, this function automatically * handles applying the appropriate classes to the widget element * and removing classes that are no longer valid. * * Parameters * ---------- * class_map: dictionary * Dictionary of trait values to class lists. * Example: * { * success: ['alert', 'alert-success'], * info: ['alert', 'alert-info'], * warning: ['alert', 'alert-warning'], * danger: ['alert', 'alert-danger'] * }; * trait_name: string * Name of the trait to check the value of. * el: optional DOM element handle, defaults to this.el * Element that the classes are applied to. */ DOMWidgetView.prototype.update_mapped_classes = function (class_map, trait_name, el) { var key = this.model.previous(trait_name); var old_classes = class_map[key] ? class_map[key] : []; key = this.model.get(trait_name); var new_classes = class_map[key] ? class_map[key] : []; this.update_classes(old_classes, new_classes, el || this.el); }; DOMWidgetView.prototype.set_mapped_classes = function (class_map, trait_name, el) { var key = this.model.get(trait_name); var new_classes = class_map[key] ? class_map[key] : []; this.update_classes([], new_classes, el || this.el); }; DOMWidgetView.prototype._setElement = function (el) { if (this.pWidget) { this.pWidget.dispose(); } this.$el = el instanceof jquery__WEBPACK_IMPORTED_MODULE_3___default.a ? el : jquery__WEBPACK_IMPORTED_MODULE_3___default()(el); this.el = this.$el[0]; this.pWidget = new JupyterPhosphorWidget({ node: el, view: this }); }; DOMWidgetView.prototype.remove = function () { if (this.pWidget) { this.pWidget.dispose(); } return _super.prototype.remove.call(this); }; DOMWidgetView.prototype.processPhosphorMessage = function (msg) { // tslint:disable-next-line:switch-default switch (msg.type) { case 'after-attach': this.trigger('displayed'); break; } }; DOMWidgetView.prototype._comm_live_update = function () { if (this.model.comm_live) { this.pWidget.removeClass('jupyter-widgets-disconnected'); } else { this.pWidget.addClass('jupyter-widgets-disconnected'); } }; return DOMWidgetView; }(WidgetView)); /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/widget_layout.js": /*!*****************************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/widget_layout.js ***! \*****************************************************************/ /*! exports provided: LayoutModel, LayoutView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LayoutModel", function() { return LayoutModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LayoutView", function() { return LayoutView; }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/base/lib/utils.js"); /* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget */ "./node_modules/@jupyter-widgets/base/lib/widget.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * css properties exposed by the layout widget with their default values. */ var css_properties = { align_content: null, align_items: null, align_self: null, border: null, bottom: null, display: null, flex: null, flex_flow: null, height: null, justify_content: null, justify_items: null, left: null, margin: null, max_height: null, max_width: null, min_height: null, min_width: null, overflow: null, overflow_x: null, overflow_y: null, order: null, padding: null, right: null, top: null, visibility: null, width: null, // image-specific object_fit: null, object_position: null, // container grid_auto_columns: null, grid_auto_flow: null, grid_auto_rows: null, grid_gap: null, grid_template_rows: null, grid_template_columns: null, grid_template_areas: null, // items grid_row: null, grid_column: null, grid_area: null }; var LayoutModel = /** @class */ (function (_super) { __extends(LayoutModel, _super); function LayoutModel() { return _super !== null && _super.apply(this, arguments) || this; } LayoutModel.prototype.defaults = function () { return Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_super.prototype.defaults.call(this), { _model_name: 'LayoutModel', _view_name: 'LayoutView' }, css_properties); }; return LayoutModel; }(_widget__WEBPACK_IMPORTED_MODULE_1__["WidgetModel"])); var LayoutView = /** @class */ (function (_super) { __extends(LayoutView, _super); function LayoutView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor */ LayoutView.prototype.initialize = function (parameters) { this._traitNames = []; _super.prototype.initialize.call(this, parameters); // Register the traits that live on the Python side for (var _i = 0, _a = Object.keys(css_properties); _i < _a.length; _i++) { var key = _a[_i]; this.registerTrait(key); } }; /** * Register a CSS trait that is known by the model * @param trait */ LayoutView.prototype.registerTrait = function (trait) { var _this = this; this._traitNames.push(trait); // Treat overflow_x and overflow_y as a special case since they are deprecated // and interact in special ways with the overflow attribute. if (trait === 'overflow_x' || trait === 'overflow_y') { // Listen to changes, and set the value on change. this.listenTo(this.model, 'change:' + trait, function (model, value) { _this.handleOverflowChange(trait, value); }); // Set the initial value on display. this.handleOverflowChange(trait, this.model.get(trait)); return; } // Listen to changes, and set the value on change. this.listenTo(this.model, 'change:' + trait, function (model, value) { _this.handleChange(trait, value); }); // Set the initial value on display. this.handleChange(trait, this.model.get(trait)); }; /** * Get the the name of the css property from the trait name * @param model attribute name * @return css property name */ LayoutView.prototype.css_name = function (trait) { return trait.replace(/_/g, '-'); }; /** * Handles when a trait value changes */ LayoutView.prototype.handleChange = function (trait, value) { // should be synchronous so that we can measure later. var parent = this.options.parent; if (parent) { if (value === null) { parent.el.style.removeProperty(this.css_name(trait)); } else { parent.el.style[this.css_name(trait)] = value; } } else { console.warn('Style not applied because a parent view does not exist'); } }; /** * Handles when the value of overflow_x or overflow_y changes */ LayoutView.prototype.handleOverflowChange = function (trait, value) { // This differs from the default handleChange method // in that setting `overflow_x` or `overflow_y` to null // when `overflow` is null removes the attribute. var parent = this.options.parent; if (parent) { if (value === null) { if (this.model.get('overflow') === null) { parent.el.style.removeProperty(this.css_name(trait)); } } else { parent.el.style[this.css_name(trait)] = value; } } else { console.warn('Style not applied because a parent view does not exist'); } }; /** * Remove the styling from the parent view. */ LayoutView.prototype.unlayout = function () { var _this = this; var parent = this.options.parent; this._traitNames.forEach(function (trait) { if (parent) { parent.el.style.removeProperty(_this.css_name(trait)); } else { console.warn('Style not removed because a parent view does not exist'); } }, this); }; return LayoutView; }(_widget__WEBPACK_IMPORTED_MODULE_1__["WidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/base/lib/widget_style.js": /*!****************************************************************!*\ !*** ./node_modules/@jupyter-widgets/base/lib/widget_style.js ***! \****************************************************************/ /*! exports provided: StyleModel, StyleView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StyleModel", function() { return StyleModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StyleView", function() { return StyleView; }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/base/lib/utils.js"); /* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget */ "./node_modules/@jupyter-widgets/base/lib/widget.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var StyleModel = /** @class */ (function (_super) { __extends(StyleModel, _super); function StyleModel() { return _super !== null && _super.apply(this, arguments) || this; } StyleModel.prototype.defaults = function () { var Derived = this.constructor; return Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assign"])(_super.prototype.defaults.call(this), { _model_name: 'StyleModel', _view_name: 'StyleView', }, Object.keys(Derived.styleProperties).reduce(function (obj, key) { obj[key] = Derived.styleProperties[key].default; return obj; }, {})); }; StyleModel.styleProperties = {}; return StyleModel; }(_widget__WEBPACK_IMPORTED_MODULE_1__["WidgetModel"])); var StyleView = /** @class */ (function (_super) { __extends(StyleView, _super); function StyleView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor */ StyleView.prototype.initialize = function (parameters) { this._traitNames = []; _super.prototype.initialize.call(this, parameters); // Register the traits that live on the Python side var ModelType = this.model.constructor; for (var _i = 0, _a = Object.keys(ModelType.styleProperties); _i < _a.length; _i++) { var key = _a[_i]; this.registerTrait(key); } // Set the initial styles this.style(); }; /** * Register a CSS trait that is known by the model * @param trait */ StyleView.prototype.registerTrait = function (trait) { var _this = this; this._traitNames.push(trait); // Listen to changes, and set the value on change. this.listenTo(this.model, 'change:' + trait, function (model, value) { _this.handleChange(trait, value); }); }; /** * Handles when a trait value changes */ StyleView.prototype.handleChange = function (trait, value) { // should be synchronous so that we can measure later. var parent = this.options.parent; if (parent) { var ModelType = this.model.constructor; var styleProperties = ModelType.styleProperties; var attribute = styleProperties[trait].attribute; var selector = styleProperties[trait].selector; var elements = selector ? parent.el.querySelectorAll(selector) : [parent.el]; if (value === null) { for (var i = 0; i !== elements.length; ++i) { elements[i].style.removeProperty(attribute); } } else { for (var i = 0; i !== elements.length; ++i) { elements[i].style[attribute] = value; } } } else { console.warn('Style not applied because a parent view does not exist'); } }; /** * Apply styles for all registered traits */ StyleView.prototype.style = function () { for (var _i = 0, _a = this._traitNames; _i < _a.length; _i++) { var trait = _a[_i]; this.handleChange(trait, this.model.get(trait)); } }; /** * Remove the styling from the parent view. */ StyleView.prototype.unstyle = function () { var parent = this.options.parent; var ModelType = this.model.constructor; var styleProperties = ModelType.styleProperties; this._traitNames.forEach(function (trait) { if (parent) { var attribute = styleProperties[trait].attribute; var selector = styleProperties[trait].selector; var elements = selector ? parent.el.querySelectorAll(selector) : [parent.el]; for (var i = 0; i !== elements.length; ++i) { elements[i].style.removeProperty(attribute); } } else { console.warn('Style not removed because a parent view does not exist'); } }, this); }; return StyleView; }(_widget__WEBPACK_IMPORTED_MODULE_1__["WidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/css/labvariables.css": /*!*********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/css/labvariables.css ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _css_loader_dist_cjs_js_labvariables_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../../css-loader/dist/cjs.js!./labvariables.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/@jupyter-widgets/controls/css/labvariables.css"); var options = {}; options.insert = "head"; options.singleton = false; var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_labvariables_css__WEBPACK_IMPORTED_MODULE_1__["default"], options); /* harmony default export */ __webpack_exports__["default"] = (_css_loader_dist_cjs_js_labvariables_css__WEBPACK_IMPORTED_MODULE_1__["default"].locals || {}); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/css/widgets-base.css": /*!*********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/css/widgets-base.css ***! \*********************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _css_loader_dist_cjs_js_widgets_base_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../../css-loader/dist/cjs.js!./widgets-base.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/@jupyter-widgets/controls/css/widgets-base.css"); var options = {}; options.insert = "head"; options.singleton = false; var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_widgets_base_css__WEBPACK_IMPORTED_MODULE_1__["default"], options); /* harmony default export */ __webpack_exports__["default"] = (_css_loader_dist_cjs_js_widgets_base_css__WEBPACK_IMPORTED_MODULE_1__["default"].locals || {}); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/index.js": /*!*************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/index.js ***! \*************************************************************/ /*! exports provided: uuid, WrappedError, resolvePromisesDict, reject, typeset, escape_html, JUPYTER_CONTROLS_VERSION, DirectionalLinkModel, LinkModel, BoolModel, CheckboxModel, CheckboxView, ToggleButtonModel, ToggleButtonView, ValidModel, ValidView, ButtonStyleModel, ButtonModel, ButtonView, BoxModel, HBoxModel, VBoxModel, BoxView, HBoxView, VBoxView, GridBoxView, GridBoxModel, ImageModel, ImageView, VideoModel, VideoView, AudioModel, AudioView, ColorPickerModel, ColorPickerView, serialize_date, deserialize_date, DatePickerModel, DatePickerView, IntModel, BoundedIntModel, SliderStyleModel, IntSliderModel, IntRangeSliderModel, BaseIntSliderView, IntRangeSliderView, IntSliderView, IntTextModel, BoundedIntTextModel, IntTextView, ProgressStyleModel, IntProgressModel, ProgressView, PlayModel, PlayView, FloatModel, BoundedFloatModel, FloatSliderModel, FloatLogSliderModel, FloatRangeSliderModel, FloatSliderView, FloatLogSliderView, FloatRangeSliderView, FloatTextModel, BoundedFloatTextModel, FloatTextView, FloatProgressModel, ControllerButtonModel, ControllerButtonView, ControllerAxisModel, ControllerAxisView, ControllerModel, ControllerView, SelectionModel, DropdownModel, DropdownView, SelectModel, SelectView, RadioButtonsModel, RadioButtonsView, ToggleButtonsStyleModel, ToggleButtonsModel, ToggleButtonsView, SelectionSliderModel, SelectionSliderView, MultipleSelectionModel, SelectMultipleModel, SelectMultipleView, SelectionRangeSliderModel, SelectionRangeSliderView, SelectionContainerModel, AccordionModel, JupyterPhosphorAccordionWidget, AccordionView, TabModel, JupyterPhosphorTabPanelWidget, TabView, StringModel, HTMLModel, HTMLView, HTMLMathModel, HTMLMathView, LabelModel, LabelView, TextareaModel, TextareaView, TextModel, TextView, PasswordModel, PasswordView, ComboboxModel, ComboboxView, DescriptionStyleModel, DescriptionModel, DescriptionView, LabeledDOMWidgetModel, LabeledDOMWidgetView, FileUploadModel, FileUploadView, version */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "uuid", function() { return _utils__WEBPACK_IMPORTED_MODULE_0__["uuid"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WrappedError", function() { return _utils__WEBPACK_IMPORTED_MODULE_0__["WrappedError"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resolvePromisesDict", function() { return _utils__WEBPACK_IMPORTED_MODULE_0__["resolvePromisesDict"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return _utils__WEBPACK_IMPORTED_MODULE_0__["reject"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "typeset", function() { return _utils__WEBPACK_IMPORTED_MODULE_0__["typeset"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "escape_html", function() { return _utils__WEBPACK_IMPORTED_MODULE_0__["escape_html"]; }); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./version */ "./node_modules/@jupyter-widgets/controls/lib/version.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JUPYTER_CONTROLS_VERSION", function() { return _version__WEBPACK_IMPORTED_MODULE_1__["JUPYTER_CONTROLS_VERSION"]; }); /* harmony import */ var _widget_link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./widget_link */ "./node_modules/@jupyter-widgets/controls/lib/widget_link.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DirectionalLinkModel", function() { return _widget_link__WEBPACK_IMPORTED_MODULE_2__["DirectionalLinkModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LinkModel", function() { return _widget_link__WEBPACK_IMPORTED_MODULE_2__["LinkModel"]; }); /* harmony import */ var _widget_bool__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./widget_bool */ "./node_modules/@jupyter-widgets/controls/lib/widget_bool.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoolModel", function() { return _widget_bool__WEBPACK_IMPORTED_MODULE_3__["BoolModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CheckboxModel", function() { return _widget_bool__WEBPACK_IMPORTED_MODULE_3__["CheckboxModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CheckboxView", function() { return _widget_bool__WEBPACK_IMPORTED_MODULE_3__["CheckboxView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonModel", function() { return _widget_bool__WEBPACK_IMPORTED_MODULE_3__["ToggleButtonModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonView", function() { return _widget_bool__WEBPACK_IMPORTED_MODULE_3__["ToggleButtonView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ValidModel", function() { return _widget_bool__WEBPACK_IMPORTED_MODULE_3__["ValidModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ValidView", function() { return _widget_bool__WEBPACK_IMPORTED_MODULE_3__["ValidView"]; }); /* harmony import */ var _widget_button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./widget_button */ "./node_modules/@jupyter-widgets/controls/lib/widget_button.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ButtonStyleModel", function() { return _widget_button__WEBPACK_IMPORTED_MODULE_4__["ButtonStyleModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ButtonModel", function() { return _widget_button__WEBPACK_IMPORTED_MODULE_4__["ButtonModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ButtonView", function() { return _widget_button__WEBPACK_IMPORTED_MODULE_4__["ButtonView"]; }); /* harmony import */ var _widget_box__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./widget_box */ "./node_modules/@jupyter-widgets/controls/lib/widget_box.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoxModel", function() { return _widget_box__WEBPACK_IMPORTED_MODULE_5__["BoxModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HBoxModel", function() { return _widget_box__WEBPACK_IMPORTED_MODULE_5__["HBoxModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VBoxModel", function() { return _widget_box__WEBPACK_IMPORTED_MODULE_5__["VBoxModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoxView", function() { return _widget_box__WEBPACK_IMPORTED_MODULE_5__["BoxView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HBoxView", function() { return _widget_box__WEBPACK_IMPORTED_MODULE_5__["HBoxView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VBoxView", function() { return _widget_box__WEBPACK_IMPORTED_MODULE_5__["VBoxView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GridBoxView", function() { return _widget_box__WEBPACK_IMPORTED_MODULE_5__["GridBoxView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GridBoxModel", function() { return _widget_box__WEBPACK_IMPORTED_MODULE_5__["GridBoxModel"]; }); /* harmony import */ var _widget_image__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./widget_image */ "./node_modules/@jupyter-widgets/controls/lib/widget_image.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ImageModel", function() { return _widget_image__WEBPACK_IMPORTED_MODULE_6__["ImageModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ImageView", function() { return _widget_image__WEBPACK_IMPORTED_MODULE_6__["ImageView"]; }); /* harmony import */ var _widget_video__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./widget_video */ "./node_modules/@jupyter-widgets/controls/lib/widget_video.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VideoModel", function() { return _widget_video__WEBPACK_IMPORTED_MODULE_7__["VideoModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VideoView", function() { return _widget_video__WEBPACK_IMPORTED_MODULE_7__["VideoView"]; }); /* harmony import */ var _widget_audio__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./widget_audio */ "./node_modules/@jupyter-widgets/controls/lib/widget_audio.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AudioModel", function() { return _widget_audio__WEBPACK_IMPORTED_MODULE_8__["AudioModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AudioView", function() { return _widget_audio__WEBPACK_IMPORTED_MODULE_8__["AudioView"]; }); /* harmony import */ var _widget_color__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./widget_color */ "./node_modules/@jupyter-widgets/controls/lib/widget_color.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ColorPickerModel", function() { return _widget_color__WEBPACK_IMPORTED_MODULE_9__["ColorPickerModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ColorPickerView", function() { return _widget_color__WEBPACK_IMPORTED_MODULE_9__["ColorPickerView"]; }); /* harmony import */ var _widget_date__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./widget_date */ "./node_modules/@jupyter-widgets/controls/lib/widget_date.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "serialize_date", function() { return _widget_date__WEBPACK_IMPORTED_MODULE_10__["serialize_date"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "deserialize_date", function() { return _widget_date__WEBPACK_IMPORTED_MODULE_10__["deserialize_date"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DatePickerModel", function() { return _widget_date__WEBPACK_IMPORTED_MODULE_10__["DatePickerModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DatePickerView", function() { return _widget_date__WEBPACK_IMPORTED_MODULE_10__["DatePickerView"]; }); /* harmony import */ var _widget_int__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./widget_int */ "./node_modules/@jupyter-widgets/controls/lib/widget_int.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["IntModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoundedIntModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["BoundedIntModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SliderStyleModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["SliderStyleModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntSliderModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["IntSliderModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntRangeSliderModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["IntRangeSliderModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BaseIntSliderView", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["BaseIntSliderView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntRangeSliderView", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["IntRangeSliderView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntSliderView", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["IntSliderView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntTextModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["IntTextModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoundedIntTextModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["BoundedIntTextModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntTextView", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["IntTextView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ProgressStyleModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["ProgressStyleModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntProgressModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["IntProgressModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ProgressView", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["ProgressView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PlayModel", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["PlayModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PlayView", function() { return _widget_int__WEBPACK_IMPORTED_MODULE_11__["PlayView"]; }); /* harmony import */ var _widget_float__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./widget_float */ "./node_modules/@jupyter-widgets/controls/lib/widget_float.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatModel", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoundedFloatModel", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["BoundedFloatModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatSliderModel", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatSliderModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatLogSliderModel", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatLogSliderModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatRangeSliderModel", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatRangeSliderModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatSliderView", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatSliderView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatLogSliderView", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatLogSliderView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatRangeSliderView", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatRangeSliderView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatTextModel", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatTextModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoundedFloatTextModel", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["BoundedFloatTextModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatTextView", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatTextView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FloatProgressModel", function() { return _widget_float__WEBPACK_IMPORTED_MODULE_12__["FloatProgressModel"]; }); /* harmony import */ var _widget_controller__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./widget_controller */ "./node_modules/@jupyter-widgets/controls/lib/widget_controller.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ControllerButtonModel", function() { return _widget_controller__WEBPACK_IMPORTED_MODULE_13__["ControllerButtonModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ControllerButtonView", function() { return _widget_controller__WEBPACK_IMPORTED_MODULE_13__["ControllerButtonView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ControllerAxisModel", function() { return _widget_controller__WEBPACK_IMPORTED_MODULE_13__["ControllerAxisModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ControllerAxisView", function() { return _widget_controller__WEBPACK_IMPORTED_MODULE_13__["ControllerAxisView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ControllerModel", function() { return _widget_controller__WEBPACK_IMPORTED_MODULE_13__["ControllerModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ControllerView", function() { return _widget_controller__WEBPACK_IMPORTED_MODULE_13__["ControllerView"]; }); /* harmony import */ var _widget_selection__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./widget_selection */ "./node_modules/@jupyter-widgets/controls/lib/widget_selection.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectionModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectionModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DropdownModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["DropdownModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DropdownView", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["DropdownView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectView", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RadioButtonsModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["RadioButtonsModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RadioButtonsView", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["RadioButtonsView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonsStyleModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["ToggleButtonsStyleModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonsModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["ToggleButtonsModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonsView", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["ToggleButtonsView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectionSliderModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectionSliderModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectionSliderView", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectionSliderView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultipleSelectionModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["MultipleSelectionModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectMultipleModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectMultipleModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectMultipleView", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectMultipleView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectionRangeSliderModel", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectionRangeSliderModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectionRangeSliderView", function() { return _widget_selection__WEBPACK_IMPORTED_MODULE_14__["SelectionRangeSliderView"]; }); /* harmony import */ var _widget_selectioncontainer__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./widget_selectioncontainer */ "./node_modules/@jupyter-widgets/controls/lib/widget_selectioncontainer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectionContainerModel", function() { return _widget_selectioncontainer__WEBPACK_IMPORTED_MODULE_15__["SelectionContainerModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AccordionModel", function() { return _widget_selectioncontainer__WEBPACK_IMPORTED_MODULE_15__["AccordionModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorAccordionWidget", function() { return _widget_selectioncontainer__WEBPACK_IMPORTED_MODULE_15__["JupyterPhosphorAccordionWidget"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AccordionView", function() { return _widget_selectioncontainer__WEBPACK_IMPORTED_MODULE_15__["AccordionView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TabModel", function() { return _widget_selectioncontainer__WEBPACK_IMPORTED_MODULE_15__["TabModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorTabPanelWidget", function() { return _widget_selectioncontainer__WEBPACK_IMPORTED_MODULE_15__["JupyterPhosphorTabPanelWidget"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TabView", function() { return _widget_selectioncontainer__WEBPACK_IMPORTED_MODULE_15__["TabView"]; }); /* harmony import */ var _widget_string__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./widget_string */ "./node_modules/@jupyter-widgets/controls/lib/widget_string.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StringModel", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["StringModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLModel", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["HTMLModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLView", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["HTMLView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLMathModel", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["HTMLMathModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLMathView", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["HTMLMathView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LabelModel", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["LabelModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LabelView", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["LabelView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextareaModel", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["TextareaModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextareaView", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["TextareaView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextModel", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["TextModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextView", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["TextView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PasswordModel", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["PasswordModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PasswordView", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["PasswordView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ComboboxModel", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["ComboboxModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ComboboxView", function() { return _widget_string__WEBPACK_IMPORTED_MODULE_16__["ComboboxView"]; }); /* harmony import */ var _widget_description__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./widget_description */ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DescriptionStyleModel", function() { return _widget_description__WEBPACK_IMPORTED_MODULE_17__["DescriptionStyleModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DescriptionModel", function() { return _widget_description__WEBPACK_IMPORTED_MODULE_17__["DescriptionModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DescriptionView", function() { return _widget_description__WEBPACK_IMPORTED_MODULE_17__["DescriptionView"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LabeledDOMWidgetModel", function() { return _widget_description__WEBPACK_IMPORTED_MODULE_17__["LabeledDOMWidgetModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LabeledDOMWidgetView", function() { return _widget_description__WEBPACK_IMPORTED_MODULE_17__["LabeledDOMWidgetView"]; }); /* harmony import */ var _widget_upload__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./widget_upload */ "./node_modules/@jupyter-widgets/controls/lib/widget_upload.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FileUploadModel", function() { return _widget_upload__WEBPACK_IMPORTED_MODULE_18__["FileUploadModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FileUploadView", function() { return _widget_upload__WEBPACK_IMPORTED_MODULE_18__["FileUploadView"]; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var version = __webpack_require__(/*! ../package.json */ "./node_modules/@jupyter-widgets/controls/package.json").version; /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/phosphor/accordion.js": /*!**************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/phosphor/accordion.js ***! \**************************************************************************/ /*! exports provided: Collapse, Accordion */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Collapse", function() { return Collapse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Accordion", function() { return Accordion; }); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ "./node_modules/@lumino/signaling/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _currentselection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./currentselection */ "./node_modules/@jupyter-widgets/controls/lib/phosphor/currentselection.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * The class name added to Collapse instances. */ var COLLAPSE_CLASS = 'p-Collapse'; /** * The class name added to a Collapse's header. */ var COLLAPSE_HEADER_CLASS = 'p-Collapse-header'; /** * The class name added to a Collapse's contents. */ var COLLAPSE_CONTENTS_CLASS = 'p-Collapse-contents'; /** * The class name added to a Collapse when it is opened */ var COLLAPSE_CLASS_OPEN = 'p-Collapse-open'; /** * A panel that supports a collapsible header, made from the widget's title. * Clicking on the title expands or contracts the widget. */ var Collapse = /** @class */ (function (_super) { __extends(Collapse, _super); function Collapse(options) { var _this = _super.call(this, options) || this; _this._collapseChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__["Signal"](_this); _this.addClass(COLLAPSE_CLASS); _this._header = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"](); _this._header.addClass(COLLAPSE_HEADER_CLASS); _this._header.node.addEventListener('click', _this); // Fontawesome icon for caret var icon = document.createElement('i'); icon.classList.add('fa', 'fa-fw', 'fa-caret-right'); _this._header.node.appendChild(icon); // Label content _this._header.node.appendChild(document.createElement('span')); _this._content = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Panel"](); _this._content.addClass(COLLAPSE_CONTENTS_CLASS); var layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["PanelLayout"](); _this.layout = layout; layout.addWidget(_this._header); layout.addWidget(_this._content); if (options.widget) { _this.widget = options.widget; } _this.collapsed = false; return _this; } Collapse.prototype.dispose = function () { if (this.isDisposed) { return; } _super.prototype.dispose.call(this); this._header = null; this._widget = null; this._content = null; }; Object.defineProperty(Collapse.prototype, "widget", { get: function () { return this._widget; }, set: function (widget) { var oldWidget = this._widget; if (oldWidget) { oldWidget.disposed.disconnect(this._onChildDisposed, this); oldWidget.title.changed.disconnect(this._onTitleChanged, this); oldWidget.parent = null; } this._widget = widget; widget.disposed.connect(this._onChildDisposed, this); widget.title.changed.connect(this._onTitleChanged, this); this._onTitleChanged(widget.title); this._content.addWidget(widget); }, enumerable: true, configurable: true }); Object.defineProperty(Collapse.prototype, "collapsed", { get: function () { return this._collapsed; }, set: function (value) { // TODO: should we have this check here? if (value === this._collapsed) { return; } if (value) { this._collapse(); } else { this._uncollapse(); } }, enumerable: true, configurable: true }); Collapse.prototype.toggle = function () { this.collapsed = !this.collapsed; }; Object.defineProperty(Collapse.prototype, "collapseChanged", { get: function () { return this._collapseChanged; }, enumerable: true, configurable: true }); Collapse.prototype._collapse = function () { this._collapsed = true; if (this._content) { this._content.hide(); } this.removeClass(COLLAPSE_CLASS_OPEN); this._header.node.children[0].classList.add('fa-caret-right'); this._header.node.children[0].classList.remove('fa-caret-down'); this._collapseChanged.emit(void 0); }; Collapse.prototype._uncollapse = function () { this._collapsed = false; if (this._content) { this._content.show(); } this.addClass(COLLAPSE_CLASS_OPEN); this._header.node.children[0].classList.add('fa-caret-down'); this._header.node.children[0].classList.remove('fa-caret-right'); this._collapseChanged.emit(void 0); }; /** * Handle the DOM events for the Collapse widget. * * @param event - The DOM event sent to the panel. * * #### Notes * This method implements the DOM `EventListener` interface and is * called in response to events on the panel's DOM node. It should * not be called directly by user code. */ Collapse.prototype.handleEvent = function (event) { switch (event.type) { case 'click': this._evtClick(event); break; default: break; } }; Collapse.prototype._evtClick = function (event) { this.toggle(); }; /** * Handle the `changed` signal of a title object. */ Collapse.prototype._onTitleChanged = function (sender) { this._header.node.children[1].textContent = this._widget.title.label; }; Collapse.prototype._onChildDisposed = function (sender) { this.dispose(); }; return Collapse; }(_lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"])); /** * The class name added to Accordion instances. */ var ACCORDION_CLASS = 'p-Accordion'; /** * The class name added to an Accordion child. */ var ACCORDION_CHILD_CLASS = 'p-Accordion-child'; var ACCORDION_CHILD_ACTIVE_CLASS = 'p-Accordion-child-active'; /** * A panel that supports a collapsible header, made from the widget's title. * Clicking on the title expands or contracts the widget. */ var Accordion = /** @class */ (function (_super) { __extends(Accordion, _super); function Accordion(options) { var _this = _super.call(this, options) || this; _this._selection = new _currentselection__WEBPACK_IMPORTED_MODULE_3__["Selection"](_this.widgets); _this._selection.selectionChanged.connect(_this._onSelectionChanged, _this); _this.addClass(ACCORDION_CLASS); return _this; } Object.defineProperty(Accordion.prototype, "collapseWidgets", { /** * A read-only sequence of the widgets in the panel. * * #### Notes * This is a read-only property. */ /* get widgets(): ISequence { return new ArraySequence(toArray(map((this.layout as PanelLayout).widgets, (w: Collapse) => w.widget))); } */ get: function () { return this.layout.widgets; }, enumerable: true, configurable: true }); Object.defineProperty(Accordion.prototype, "selection", { get: function () { return this._selection; }, enumerable: true, configurable: true }); Accordion.prototype.indexOf = function (widget) { return _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__["ArrayExt"].findFirstIndex(this.collapseWidgets, function (w) { return w.widget === widget; }); }; /** * Add a widget to the end of the accordion. * * @param widget - The widget to add to the accordion. * * @returns The Collapse widget wrapping the added widget. * * #### Notes * The widget will be wrapped in a CollapsedWidget. */ Accordion.prototype.addWidget = function (widget) { var collapse = this._wrapWidget(widget); collapse.collapsed = true; _super.prototype.addWidget.call(this, collapse); this._selection.adjustSelectionForInsert(this.widgets.length - 1, collapse); return collapse; }; /** * Insert a widget at the specified index. * * @param index - The index at which to insert the widget. * * @param widget - The widget to insert into to the accordion. * * #### Notes * If the widget is already contained in the panel, it will be moved. */ Accordion.prototype.insertWidget = function (index, widget) { var collapse = this._wrapWidget(widget); collapse.collapsed = true; _super.prototype.insertWidget.call(this, index, collapse); this._selection.adjustSelectionForInsert(index, collapse); }; Accordion.prototype.removeWidget = function (widget) { var index = this.indexOf(widget); if (index >= 0) { var collapse = this.collapseWidgets[index]; widget.parent = null; collapse.dispose(); this._selection.adjustSelectionForRemove(index, null); } }; Accordion.prototype._wrapWidget = function (widget) { var collapse = new Collapse({ widget: widget }); collapse.addClass(ACCORDION_CHILD_CLASS); collapse.collapseChanged.connect(this._onCollapseChange, this); return collapse; }; Accordion.prototype._onCollapseChange = function (sender) { if (!sender.collapsed) { this._selection.value = sender; } else if (this._selection.value === sender && sender.collapsed) { this._selection.value = null; } }; Accordion.prototype._onSelectionChanged = function (sender, change) { // Collapse previous widget, open current widget var pv = change.previousValue; var cv = change.currentValue; if (pv) { pv.collapsed = true; pv.removeClass(ACCORDION_CHILD_ACTIVE_CLASS); } if (cv) { cv.collapsed = false; cv.addClass(ACCORDION_CHILD_ACTIVE_CLASS); } }; return Accordion; }(_lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Panel"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/phosphor/currentselection.js": /*!*********************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/phosphor/currentselection.js ***! \*********************************************************************************/ /*! exports provided: Selection */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Selection", function() { return Selection; }); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ "./node_modules/@lumino/signaling/dist/index.es6.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * A variety of convenience methods for maintaining a current selection */ var Selection = /** @class */ (function () { function Selection(sequence, options) { if (options === void 0) { options = {}; } this._array = null; this._value = null; this._previousValue = null; this._selectionChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__["Signal"](this); this._array = sequence; this._insertBehavior = options.insertBehavior || 'select-item-if-needed'; this._removeBehavior = options.removeBehavior || 'select-item-after'; } Object.defineProperty(Selection.prototype, "selectionChanged", { /** * A signal emitted when the current item is changed. * * #### Notes * This signal is emitted when the currently selected item is changed either * through user or programmatic interaction. * * Notably, this signal is not emitted when the index of the current item * changes due to other items being inserted, removed, or moved, but the * current item remains the same. It is only emitted when the actual current * item is changed. */ get: function () { return this._selectionChanged; }, enumerable: true, configurable: true }); /** * Adjust for setting an item. * * This should be called *after* the set. * * @param index - The index set. * @param oldValue - The old value at the index. */ Selection.prototype.adjustSelectionForSet = function (index) { // We just need to send a signal if the currentValue changed. // Get the current index and value. var pi = this.index; var pv = this.value; // Exit early if this doesn't affect the selection if (index !== pi) { return; } this._updateSelectedValue(); var cv = this.value; // The previous item is now null, since it is no longer in the array. this._previousValue = null; // Send signal if there was a change if (pv !== cv) { // Emit the current changed signal. this._selectionChanged.emit({ previousIndex: pi, previousValue: pv, currentIndex: pi, currentValue: cv }); } }; Object.defineProperty(Selection.prototype, "value", { /** * Get the currently selected item. * * #### Notes * This will be `null` if no item is selected. */ get: function () { return this._value; }, /** * Set the currently selected item. * * #### Notes * If the item does not exist in the vector, the currentValue will be set to * `null`. This selects the first entry equal to the desired item. */ set: function (value) { if (value === null) { this.index = null; } else { this.index = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__["ArrayExt"].firstIndexOf(this._array, value); } }, enumerable: true, configurable: true }); Object.defineProperty(Selection.prototype, "index", { /** * Get the index of the currently selected item. * * #### Notes * This will be `null` if no item is selected. */ get: function () { return this._index; }, /** * Set the index of the currently selected tab. * * @param index - The index to select. * * #### Notes * If the value is out of range, the index will be set to `null`, which * indicates no item is selected. */ set: function (index) { // Coerce the value to an index. var i; if (index !== null) { i = Math.floor(index); if (i < 0 || i >= this._array.length) { i = null; } } else { i = null; } // Bail early if the index will not change. if (this._index === i) { return; } // Look up the previous index and item. var pi = this._index; var pv = this._value; // Update the state this._index = i; this._updateSelectedValue(); this._previousValue = pv; // Emit the current changed signal. this._selectionChanged.emit({ previousIndex: pi, previousValue: pv, currentIndex: i, currentValue: this._value }); }, enumerable: true, configurable: true }); Object.defineProperty(Selection.prototype, "insertBehavior", { /** * Get the selection behavior when inserting a tab. */ get: function () { return this._insertBehavior; }, /** * Set the selection behavior when inserting a tab. */ set: function (value) { this._insertBehavior = value; }, enumerable: true, configurable: true }); Object.defineProperty(Selection.prototype, "removeBehavior", { /** * Get the selection behavior when removing a tab. */ get: function () { return this._removeBehavior; }, /** * Set the selection behavior when removing a tab. */ set: function (value) { this._removeBehavior = value; }, enumerable: true, configurable: true }); /** * Adjust the current index for a tab insert operation. * * @param i - The new index of the inserted item. * @param j - The inserted item. * * #### Notes * This method accounts for the tab bar's insertion behavior when adjusting * the current index and emitting the changed signal. This should be called * after the insertion. */ Selection.prototype.adjustSelectionForInsert = function (i, item) { // Lookup commonly used variables. var cv = this._value; var ci = this._index; var bh = this._insertBehavior; // Handle the behavior where the new item is always selected, // or the behavior where the new item is selected if needed. if (bh === 'select-item' || (bh === 'select-item-if-needed' && ci === null)) { this._index = i; this._value = item; this._previousValue = cv; this._selectionChanged.emit({ previousIndex: ci, previousValue: cv, currentIndex: i, currentValue: item }); return; } // Otherwise, silently adjust the current index if needed. if (ci >= i) { this._index++; } }; /** * Adjust the current index for move operation. * * @param i - The previous index of the item. * @param j - The new index of the item. * * #### Notes * This method will not cause the actual current item to change. It silently * adjusts the current index to account for the given move. */ Selection.prototype.adjustSelectionForMove = function (i, j) { if (this._index === i) { this._index = j; } else if (this._index < i && this._index >= j) { this._index++; } else if (this._index > i && this._index <= j) { this._index--; } }; /** * Clear the selection and history. */ Selection.prototype.clearSelection = function () { // Get the current index and item. var pi = this._index; var pv = this._value; // Reset the current index and previous item. this._index = null; this._value = null; this._previousValue = null; // If no item was selected, there's nothing else to do. if (pi === null) { return; } // Emit the current changed signal. this._selectionChanged.emit({ previousIndex: pi, previousValue: pv, currentIndex: this._index, currentValue: this._value }); }; /** * Adjust the current index for an item remove operation. * * @param i - The former index of the removed item. * @param item - The removed item. * * #### Notes * This method accounts for the remove behavior when adjusting the current * index and emitting the changed signal. It should be called after the item * is removed. */ Selection.prototype.adjustSelectionForRemove = function (i, item) { // Lookup commonly used variables. var ci = this._index; var bh = this._removeBehavior; // Silently adjust the index if the current item is not removed. if (ci !== i) { if (ci > i) { this._index--; } return; } // No item gets selected if the vector is empty. if (this._array.length === 0) { // Reset the current index and previous item. this._index = null; this._value = null; this._previousValue = null; this._selectionChanged.emit({ previousIndex: i, previousValue: item, currentIndex: this._index, currentValue: this._value }); return; } // Handle behavior where the next sibling item is selected. if (bh === 'select-item-after') { this._index = Math.min(i, this._array.length - 1); this._updateSelectedValue(); this._previousValue = null; this._selectionChanged.emit({ previousIndex: i, previousValue: item, currentIndex: this._index, currentValue: this._value }); return; } // Handle behavior where the previous sibling item is selected. if (bh === 'select-item-before') { this._index = Math.max(0, i - 1); this._updateSelectedValue(); this._previousValue = null; this._selectionChanged.emit({ previousIndex: i, previousValue: item, currentIndex: this._index, currentValue: this._value }); return; } // Handle behavior where the previous history item is selected. if (bh === 'select-previous-item') { if (this._previousValue) { this.value = this._previousValue; } else { this._index = Math.min(i, this._array.length - 1); this._updateSelectedValue(); } this._previousValue = null; this._selectionChanged.emit({ previousIndex: i, previousValue: item, currentIndex: this._index, currentValue: this.value }); return; } // Otherwise, no item gets selected. this._index = null; this._value = null; this._previousValue = null; this._selectionChanged.emit({ previousIndex: i, previousValue: item, currentIndex: this._index, currentValue: this._value }); }; /** * Set the current value based on the current index. */ Selection.prototype._updateSelectedValue = function () { var i = this._index; this._value = i !== null ? this._array[i] : null; }; return Selection; }()); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/phosphor/tabpanel.js": /*!*************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/phosphor/tabpanel.js ***! \*************************************************************************/ /*! exports provided: EventedPanel, TabPanel */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventedPanel", function() { return EventedPanel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TabPanel", function() { return TabPanel; }); /* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/messaging */ "./node_modules/@lumino/messaging/dist/index.es6.js"); /* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ "./node_modules/@lumino/signaling/dist/index.es6.js"); /* harmony import */ var _lumino_domutils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/domutils */ "./node_modules/@lumino/domutils/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* This file has code derived from PhosphorJS. The license for this PhosphorJS code is: Copyright (c) 2014-2017, PhosphorJS Contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * A panel where visible widgets are stacked atop one another. * * #### Notes * This class provides a convenience wrapper around a [[PanelLayout]]. */ var EventedPanel = /** @class */ (function (_super) { __extends(EventedPanel, _super); function EventedPanel() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._widgetRemoved = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__["Signal"](_this); return _this; } Object.defineProperty(EventedPanel.prototype, "widgetRemoved", { /** * A signal emitted when a widget is removed from the panel. */ get: function () { return this._widgetRemoved; }, enumerable: true, configurable: true }); /** * A message handler invoked on a `'child-removed'` message. */ EventedPanel.prototype.onChildRemoved = function (msg) { this._widgetRemoved.emit(msg.child); }; return EventedPanel; }(_lumino_widgets__WEBPACK_IMPORTED_MODULE_3__["Panel"])); /** * A widget which combines a `TabBar` and a `EventedPanel`. * * #### Notes * This is a simple panel which handles the common case of a tab bar * placed next to a content area. The selected tab controls the widget * which is shown in the content area. * * For use cases which require more control than is provided by this * panel, the `TabBar` widget may be used independently. * * TODO: Support setting the direction?? */ var TabPanel = /** @class */ (function (_super) { __extends(TabPanel, _super); /** * Construct a new tab panel. * * @param options - The options for initializing the tab panel. */ function TabPanel(options) { if (options === void 0) { options = {}; } var _this = _super.call(this) || this; _this._currentChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__["Signal"](_this); _this.addClass('p-TabPanel'); // Create the tab bar and contents panel. _this.tabBar = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_3__["TabBar"](options); _this.tabBar.addClass('p-TabPanel-tabBar'); _this.tabContents = new EventedPanel(); _this.tabContents.addClass('p-TabPanel-tabContents'); // Connect the tab bar signal handlers. _this.tabBar.tabMoved.connect(_this._onTabMoved, _this); _this.tabBar.currentChanged.connect(_this._onCurrentChanged, _this); _this.tabBar.tabCloseRequested.connect(_this._onTabCloseRequested, _this); _this.tabBar.tabActivateRequested.connect(_this._onTabActivateRequested, _this); // Connect the evented panel signal handlers. _this.tabContents.widgetRemoved.connect(_this._onWidgetRemoved, _this); // Create the layout. var layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_3__["PanelLayout"](); // Add the child widgets to the layout. layout.addWidget(_this.tabBar); layout.addWidget(_this.tabContents); // Install the layout on the tab panel. _this.layout = layout; return _this; } Object.defineProperty(TabPanel.prototype, "currentChanged", { /** * A signal emitted when the current tab is changed. * * #### Notes * This signal is emitted when the currently selected tab is changed * either through user or programmatic interaction. * * Notably, this signal is not emitted when the index of the current * tab changes due to tabs being inserted, removed, or moved. It is * only emitted when the actual current tab node is changed. */ get: function () { return this._currentChanged; }, enumerable: true, configurable: true }); Object.defineProperty(TabPanel.prototype, "currentIndex", { /** * Get the index of the currently selected tab. * * #### Notes * This will be `null` if no tab is selected. */ get: function () { var currentIndex = this.tabBar.currentIndex; // Phosphor tab bars have an index of -1 if no tab is selected return (currentIndex === -1 ? null : currentIndex); }, /** * Set the index of the currently selected tab. * * #### Notes * If the index is out of range, it will be set to `null`. */ set: function (value) { this.tabBar.currentIndex = (value === null ? -1 : value); }, enumerable: true, configurable: true }); Object.defineProperty(TabPanel.prototype, "currentWidget", { /** * Get the currently selected widget. * * #### Notes * This will be `null` if there is no selected tab. */ get: function () { var title = this.tabBar.currentTitle; return title ? title.owner : null; }, /** * Set the currently selected widget. * * #### Notes * If the widget is not in the panel, it will be set to `null`. */ set: function (value) { this.tabBar.currentTitle = value ? value.title : null; }, enumerable: true, configurable: true }); Object.defineProperty(TabPanel.prototype, "tabsMovable", { /** * Get the whether the tabs are movable by the user. * * #### Notes * Tabs can always be moved programmatically. */ get: function () { return this.tabBar.tabsMovable; }, /** * Set the whether the tabs are movable by the user. * * #### Notes * Tabs can always be moved programmatically. */ set: function (value) { this.tabBar.tabsMovable = value; }, enumerable: true, configurable: true }); Object.defineProperty(TabPanel.prototype, "widgets", { /** * A read-only array of the widgets in the panel. */ get: function () { return this.tabContents.widgets; }, enumerable: true, configurable: true }); /** * Add a widget to the end of the tab panel. * * @param widget - The widget to add to the tab panel. * * #### Notes * If the widget is already contained in the panel, it will be moved. * * The widget's `title` is used to populate the tab. */ TabPanel.prototype.addWidget = function (widget) { this.insertWidget(this.widgets.length, widget); }; /** * Insert a widget into the tab panel at a specified index. * * @param index - The index at which to insert the widget. * * @param widget - The widget to insert into to the tab panel. * * #### Notes * If the widget is already contained in the panel, it will be moved. * * The widget's `title` is used to populate the tab. */ TabPanel.prototype.insertWidget = function (index, widget) { if (widget !== this.currentWidget) { widget.hide(); } this.tabContents.insertWidget(index, widget); this.tabBar.insertTab(index, widget.title); }; /** * Handle the `currentChanged` signal from the tab bar. */ TabPanel.prototype._onCurrentChanged = function (sender, args) { // Extract the previous and current title from the args. var previousIndex = args.previousIndex, previousTitle = args.previousTitle, currentIndex = args.currentIndex, currentTitle = args.currentTitle; // Extract the widgets from the titles. var previousWidget = previousTitle ? previousTitle.owner : null; var currentWidget = currentTitle ? currentTitle.owner : null; // Hide the previous widget. if (previousWidget) { previousWidget.hide(); } // Show the current widget. if (currentWidget) { currentWidget.show(); } // Emit the `currentChanged` signal for the tab panel. this._currentChanged.emit({ previousIndex: previousIndex, previousWidget: previousWidget, currentIndex: currentIndex, currentWidget: currentWidget }); // Flush the message loop on IE and Edge to prevent flicker. if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_2__["Platform"].IS_EDGE || _lumino_domutils__WEBPACK_IMPORTED_MODULE_2__["Platform"].IS_IE) { _lumino_messaging__WEBPACK_IMPORTED_MODULE_0__["MessageLoop"].flush(); } }; /** * Handle the `tabActivateRequested` signal from the tab bar. */ TabPanel.prototype._onTabActivateRequested = function (sender, args) { args.title.owner.activate(); }; /** * Handle the `tabCloseRequested` signal from the tab bar. */ TabPanel.prototype._onTabCloseRequested = function (sender, args) { args.title.owner.close(); }; /** * Handle the `tabMoved` signal from the tab bar. */ TabPanel.prototype._onTabMoved = function (sender, args) { this.tabContents.insertWidget(args.toIndex, args.title.owner); }; /** * Handle the `widgetRemoved` signal from the stacked panel. */ TabPanel.prototype._onWidgetRemoved = function (sender, widget) { this.tabBar.removeTab(widget.title); }; return TabPanel; }(_lumino_widgets__WEBPACK_IMPORTED_MODULE_3__["Widget"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/utils.js": /*!*************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/utils.js ***! \*************************************************************/ /*! exports provided: uuid, WrappedError, resolvePromisesDict, reject, typeset, escape_html */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return reject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "typeset", function() { return typeset; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "escape_html", function() { return escape_html; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "uuid", function() { return _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["uuid"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WrappedError", function() { return _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["WrappedError"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resolvePromisesDict", function() { return _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["resolvePromisesDict"]; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * Creates a wrappable Promise rejection function. * * Creates a function that returns a Promise.reject with a new WrappedError * that has the provided message and wraps the original error that * caused the promise to reject. */ function reject(message, log) { return function promiseRejection(error) { var wrapped_error = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["WrappedError"](message, error); if (log) { console.error(wrapped_error); } return Promise.reject(wrapped_error); }; } /** * Apply MathJax rendering to an element, and optionally set its text. * * If MathJax is not available, make no changes. * * Parameters * ---------- * element: Node * text: optional string */ function typeset(element, text) { if (text !== void 0) { element.textContent = text; } if (window.MathJax !== void 0) { MathJax.Hub.Queue(['Typeset', MathJax.Hub, element]); } } /** * escape text to HTML */ function escape_html(text) { var esc = document.createElement('div'); esc.textContent = text; return esc.innerHTML; } /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/version.js": /*!***************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/version.js ***! \***************************************************************/ /*! exports provided: JUPYTER_CONTROLS_VERSION */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JUPYTER_CONTROLS_VERSION", function() { return JUPYTER_CONTROLS_VERSION; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * The version of the Jupyter controls widget attribute spec that this package * implements. */ var JUPYTER_CONTROLS_VERSION = '1.5.0'; /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_audio.js": /*!********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_audio.js ***! \********************************************************************/ /*! exports provided: AudioModel, AudioView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AudioModel", function() { return AudioModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AudioView", function() { return AudioView; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var AudioModel = /** @class */ (function (_super) { __extends(AudioModel, _super); function AudioModel() { return _super !== null && _super.apply(this, arguments) || this; } AudioModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_2__["extend"](_super.prototype.defaults.call(this), { _model_name: 'AudioModel', _view_name: 'AudioView', format: 'mp3', autoplay: true, loop: true, controls: true, value: new DataView(new ArrayBuffer(0)) }); }; AudioModel.serializers = __assign(__assign({}, _widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"].serializers), { value: { serialize: function (value) { return new DataView(value.buffer.slice(0)); } } }); return AudioModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"])); var AudioView = /** @class */ (function (_super) { __extends(AudioView, _super); function AudioView() { return _super !== null && _super.apply(this, arguments) || this; } AudioView.prototype.render = function () { /** * Called when view is rendered. */ _super.prototype.render.call(this); this.pWidget.addClass('jupyter-widgets'); this.update(); // Set defaults. }; AudioView.prototype.update = function () { /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ var url; var format = this.model.get('format'); var value = this.model.get('value'); if (format !== 'url') { var blob = new Blob([value], { type: "audio/" + this.model.get('format') }); url = URL.createObjectURL(blob); } else { url = (new TextDecoder('utf-8')).decode(value.buffer); } // Clean up the old objectURL var oldurl = this.el.src; this.el.src = url; if (oldurl && typeof oldurl !== 'string') { URL.revokeObjectURL(oldurl); } // Audio attributes this.el.loop = this.model.get('loop'); this.el.autoplay = this.model.get('autoplay'); this.el.controls = this.model.get('controls'); return _super.prototype.update.call(this); }; AudioView.prototype.remove = function () { if (this.el.src) { URL.revokeObjectURL(this.el.src); } _super.prototype.remove.call(this); }; Object.defineProperty(AudioView.prototype, "tagName", { /** * The default tag name. * * #### Notes * This is a read-only attribute. */ get: function () { // We can't make this an attribute with a default value // since it would be set after it is needed in the // constructor. return 'audio'; }, enumerable: true, configurable: true }); return AudioView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_bool.js": /*!*******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_bool.js ***! \*******************************************************************/ /*! exports provided: BoolModel, CheckboxModel, CheckboxView, ToggleButtonModel, ToggleButtonView, ValidModel, ValidView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoolModel", function() { return BoolModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxModel", function() { return CheckboxModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxView", function() { return CheckboxView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonModel", function() { return ToggleButtonModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonView", function() { return ToggleButtonView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValidModel", function() { return ValidModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValidView", function() { return ValidView; }); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _widget_description__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_description */ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js"); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var BoolModel = /** @class */ (function (_super) { __extends(BoolModel, _super); function BoolModel() { return _super !== null && _super.apply(this, arguments) || this; } BoolModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { value: false, disabled: false, _model_name: 'BoolModel' }); }; return BoolModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDescriptionModel"])); var CheckboxModel = /** @class */ (function (_super) { __extends(CheckboxModel, _super); function CheckboxModel() { return _super !== null && _super.apply(this, arguments) || this; } CheckboxModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { indent: true, _view_name: 'CheckboxView', _model_name: 'CheckboxModel' }); }; return CheckboxModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDescriptionModel"])); var CheckboxView = /** @class */ (function (_super) { __extends(CheckboxView, _super); function CheckboxView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ CheckboxView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-checkbox'); // adding a zero-width space to the label to help // the browser set the baseline correctly this.label.innerHTML = '​'; // label containing the checkbox and description span this.checkboxLabel = document.createElement('label'); this.checkboxLabel.classList.add('widget-label-basic'); this.el.appendChild(this.checkboxLabel); // checkbox this.checkbox = document.createElement('input'); this.checkbox.setAttribute('type', 'checkbox'); this.checkboxLabel.appendChild(this.checkbox); // span to the right of the checkbox that will render the description this.descriptionSpan = document.createElement('span'); this.checkboxLabel.appendChild(this.descriptionSpan); this.listenTo(this.model, 'change:indent', this.updateIndent); this.update(); // Set defaults. this.updateDescription(); this.updateIndent(); }; /** * Overriden from super class * * Update the description span (rather than the label) since * we want the description to the right of the checkbox. */ CheckboxView.prototype.updateDescription = function () { // can be called before the view is fully initialized if (this.checkboxLabel == null) { return; } var description = this.model.get('description'); this.descriptionSpan.innerHTML = description; this.typeset(this.descriptionSpan); this.descriptionSpan.title = description; this.checkbox.title = description; }; /** * Update the visibility of the label in the super class * to provide the optional indent. */ CheckboxView.prototype.updateIndent = function () { var indent = this.model.get('indent'); this.label.style.display = indent ? '' : 'none'; }; CheckboxView.prototype.events = function () { return { 'click input[type="checkbox"]': '_handle_click' }; }; /** * Handles when the checkbox is clicked. * * Calling model.set will trigger all of the other views of the * model to update. */ CheckboxView.prototype._handle_click = function () { var value = this.model.get('value'); this.model.set('value', !value, { updated_view: this }); this.touch(); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ CheckboxView.prototype.update = function (options) { this.checkbox.checked = this.model.get('value'); if (options === undefined || options.updated_view != this) { this.checkbox.disabled = this.model.get('disabled'); } return _super.prototype.update.call(this); }; return CheckboxView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var ToggleButtonModel = /** @class */ (function (_super) { __extends(ToggleButtonModel, _super); function ToggleButtonModel() { return _super !== null && _super.apply(this, arguments) || this; } ToggleButtonModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _view_name: 'ToggleButtonView', _model_name: 'ToggleButtonModel', tooltip: '', icon: '', button_style: '' }); }; return ToggleButtonModel; }(BoolModel)); var ToggleButtonView = /** @class */ (function (_super) { __extends(ToggleButtonView, _super); function ToggleButtonView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ ToggleButtonView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('jupyter-button'); this.el.classList.add('widget-toggle-button'); this.listenTo(this.model, 'change:button_style', this.update_button_style); this.set_button_style(); this.update(); // Set defaults. }; ToggleButtonView.prototype.update_button_style = function () { this.update_mapped_classes(ToggleButtonView.class_map, 'button_style'); }; ToggleButtonView.prototype.set_button_style = function () { this.set_mapped_classes(ToggleButtonView.class_map, 'button_style'); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ ToggleButtonView.prototype.update = function (options) { if (this.model.get('value')) { this.el.classList.add('mod-active'); } else { this.el.classList.remove('mod-active'); } if (options === undefined || options.updated_view !== this) { this.el.disabled = this.model.get('disabled'); this.el.setAttribute('title', this.model.get('tooltip')); var description = this.model.get('description'); var icon = this.model.get('icon'); if (description.trim().length === 0 && icon.trim().length === 0) { this.el.innerHTML = ' '; // Preserve button height } else { this.el.textContent = ''; if (icon.trim().length) { var i = document.createElement('i'); this.el.appendChild(i); i.classList.add('fa'); i.classList.add('fa-' + icon); } this.el.appendChild(document.createTextNode(description)); } } return _super.prototype.update.call(this); }; ToggleButtonView.prototype.events = function () { return { // Dictionary of events and their handlers. 'click': '_handle_click' }; }; /** * Handles and validates user input. * * Calling model.set will trigger all of the other views of the * model to update. */ ToggleButtonView.prototype._handle_click = function (event) { event.preventDefault(); var value = this.model.get('value'); this.model.set('value', !value, { updated_view: this }); this.touch(); }; Object.defineProperty(ToggleButtonView.prototype, "tagName", { /** * The default tag name. * * #### Notes * This is a read-only attribute. */ get: function () { // We can't make this an attribute with a default value // since it would be set after it is needed in the // constructor. return 'button'; }, enumerable: true, configurable: true }); ToggleButtonView.class_map = { primary: ['mod-primary'], success: ['mod-success'], info: ['mod-info'], warning: ['mod-warning'], danger: ['mod-danger'] }; return ToggleButtonView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_2__["DOMWidgetView"])); var ValidModel = /** @class */ (function (_super) { __extends(ValidModel, _super); function ValidModel() { return _super !== null && _super.apply(this, arguments) || this; } ValidModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { readout: 'Invalid', _view_name: 'ValidView', _model_name: 'ValidModel' }); }; return ValidModel; }(BoolModel)); var ValidView = /** @class */ (function (_super) { __extends(ValidView, _super); function ValidView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ ValidView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-valid'); this.el.classList.add('widget-inline-hbox'); this.icon = document.createElement('i'); this.icon.classList.add('fa', 'fa-fw'); this.el.appendChild(this.icon); this.readout = document.createElement('span'); this.readout.classList.add('widget-valid-readout'); this.readout.classList.add('widget-readout'); this.el.appendChild(this.readout); this.update(); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ ValidView.prototype.update = function () { this.el.classList.remove('mod-valid'); this.el.classList.remove('mod-invalid'); this.icon.classList.remove('fa-check'); this.icon.classList.remove('fa-times'); this.readout.textContent = this.model.get('readout'); if (this.model.get('value')) { this.el.classList.add('mod-valid'); this.icon.classList.add('fa-check'); } else { this.el.classList.add('mod-invalid'); this.icon.classList.add('fa-times'); } }; return ValidView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_box.js": /*!******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_box.js ***! \******************************************************************/ /*! exports provided: BoxModel, HBoxModel, VBoxModel, BoxView, HBoxView, VBoxView, GridBoxView, GridBoxModel */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoxModel", function() { return BoxModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HBoxModel", function() { return HBoxModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VBoxModel", function() { return VBoxModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoxView", function() { return BoxView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HBoxView", function() { return HBoxView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VBoxView", function() { return VBoxView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GridBoxView", function() { return GridBoxView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GridBoxModel", function() { return GridBoxModel; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/messaging */ "./node_modules/@lumino/messaging/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_7__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var BoxModel = /** @class */ (function (_super) { __extends(BoxModel, _super); function BoxModel() { return _super !== null && _super.apply(this, arguments) || this; } BoxModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_6__["extend"](_super.prototype.defaults.call(this), { _view_name: 'BoxView', _model_name: 'BoxModel', children: [], box_style: '' }); }; BoxModel.serializers = __assign(__assign({}, _widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"].serializers), { children: { deserialize: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["unpack_models"] } }); return BoxModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"])); var HBoxModel = /** @class */ (function (_super) { __extends(HBoxModel, _super); function HBoxModel() { return _super !== null && _super.apply(this, arguments) || this; } HBoxModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_6__["extend"](_super.prototype.defaults.call(this), { _view_name: 'HBoxView', _model_name: 'HBoxModel', }); }; return HBoxModel; }(BoxModel)); var VBoxModel = /** @class */ (function (_super) { __extends(VBoxModel, _super); function VBoxModel() { return _super !== null && _super.apply(this, arguments) || this; } VBoxModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_6__["extend"](_super.prototype.defaults.call(this), { _view_name: 'VBoxView', _model_name: 'VBoxModel', }); }; return VBoxModel; }(BoxModel)); var BoxView = /** @class */ (function (_super) { __extends(BoxView, _super); function BoxView() { return _super !== null && _super.apply(this, arguments) || this; } BoxView.prototype._createElement = function (tagName) { this.pWidget = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["JupyterPhosphorPanelWidget"]({ view: this }); return this.pWidget.node; }; BoxView.prototype._setElement = function (el) { if (this.el || el !== this.pWidget.node) { // Boxes don't allow setting the element beyond the initial creation. throw new Error('Cannot reset the DOM element.'); } this.el = this.pWidget.node; this.$el = jquery__WEBPACK_IMPORTED_MODULE_7___default()(this.pWidget.node); }; BoxView.prototype.initialize = function (parameters) { _super.prototype.initialize.call(this, parameters); this.children_views = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["ViewList"](this.add_child_model, null, this); this.listenTo(this.model, 'change:children', this.update_children); this.listenTo(this.model, 'change:box_style', this.update_box_style); this.pWidget.addClass('jupyter-widgets'); this.pWidget.addClass('widget-container'); this.pWidget.addClass('widget-box'); }; BoxView.prototype.render = function () { _super.prototype.render.call(this); this.update_children(); this.set_box_style(); }; BoxView.prototype.update_children = function () { this.children_views.update(this.model.get('children')).then(function (views) { // Notify all children that their sizes may have changed. views.forEach(function (view) { _lumino_messaging__WEBPACK_IMPORTED_MODULE_4__["MessageLoop"].postMessage(view.pWidget, _lumino_widgets__WEBPACK_IMPORTED_MODULE_5__["Widget"].ResizeMessage.UnknownSize); }); }); }; BoxView.prototype.update_box_style = function () { this.update_mapped_classes(BoxView.class_map, 'box_style'); }; BoxView.prototype.set_box_style = function () { this.set_mapped_classes(BoxView.class_map, 'box_style'); }; BoxView.prototype.add_child_model = function (model) { var _this = this; // we insert a dummy element so the order is preserved when we add // the rendered content later. var dummy = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_5__["Widget"](); this.pWidget.addWidget(dummy); return this.create_child_view(model).then(function (view) { // replace the dummy widget with the new one. var i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__["ArrayExt"].firstIndexOf(_this.pWidget.widgets, dummy); _this.pWidget.insertWidget(i, view.pWidget); dummy.dispose(); return view; }).catch(Object(_utils__WEBPACK_IMPORTED_MODULE_2__["reject"])('Could not add child view to box', true)); }; BoxView.prototype.remove = function () { this.children_views = null; _super.prototype.remove.call(this); }; BoxView.class_map = { success: ['alert', 'alert-success'], info: ['alert', 'alert-info'], warning: ['alert', 'alert-warning'], danger: ['alert', 'alert-danger'] }; return BoxView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); var HBoxView = /** @class */ (function (_super) { __extends(HBoxView, _super); function HBoxView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor */ HBoxView.prototype.initialize = function (parameters) { _super.prototype.initialize.call(this, parameters); this.pWidget.addClass('widget-hbox'); }; return HBoxView; }(BoxView)); var VBoxView = /** @class */ (function (_super) { __extends(VBoxView, _super); function VBoxView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor */ VBoxView.prototype.initialize = function (parameters) { _super.prototype.initialize.call(this, parameters); this.pWidget.addClass('widget-vbox'); }; return VBoxView; }(BoxView)); var GridBoxView = /** @class */ (function (_super) { __extends(GridBoxView, _super); function GridBoxView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor */ GridBoxView.prototype.initialize = function (parameters) { _super.prototype.initialize.call(this, parameters); this.pWidget.addClass('widget-gridbox'); // display needn't be set to flex and grid this.pWidget.removeClass('widget-box'); }; return GridBoxView; }(BoxView)); var GridBoxModel = /** @class */ (function (_super) { __extends(GridBoxModel, _super); function GridBoxModel() { return _super !== null && _super.apply(this, arguments) || this; } GridBoxModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_6__["extend"](_super.prototype.defaults.call(this), { _view_name: 'GridBoxView', _model_name: 'GridBoxModel', }); }; return GridBoxModel; }(BoxModel)); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_button.js": /*!*********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_button.js ***! \*********************************************************************/ /*! exports provided: ButtonStyleModel, ButtonModel, ButtonView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonStyleModel", function() { return ButtonStyleModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonModel", function() { return ButtonModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonView", function() { return ButtonView; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./version */ "./node_modules/@jupyter-widgets/controls/lib/version.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var ButtonStyleModel = /** @class */ (function (_super) { __extends(ButtonStyleModel, _super); function ButtonStyleModel() { return _super !== null && _super.apply(this, arguments) || this; } ButtonStyleModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _model_name: 'ButtonStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], }); }; ButtonStyleModel.styleProperties = { button_color: { selector: '', attribute: 'background-color', default: null }, font_weight: { selector: '', attribute: 'font-weight', default: '' } }; return ButtonStyleModel; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["StyleModel"])); var ButtonModel = /** @class */ (function (_super) { __extends(ButtonModel, _super); function ButtonModel() { return _super !== null && _super.apply(this, arguments) || this; } ButtonModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { description: '', tooltip: '', disabled: false, icon: '', button_style: '', _view_name: 'ButtonView', _model_name: 'ButtonModel', style: null }); }; return ButtonModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"])); var ButtonView = /** @class */ (function (_super) { __extends(ButtonView, _super); function ButtonView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ ButtonView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('jupyter-button'); this.el.classList.add('widget-button'); this.listenTo(this.model, 'change:button_style', this.update_button_style); this.set_button_style(); this.update(); // Set defaults. }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ ButtonView.prototype.update = function () { this.el.disabled = this.model.get('disabled'); this.el.setAttribute('title', this.model.get('tooltip')); var description = this.model.get('description'); var icon = this.model.get('icon'); if (description.length || icon.length) { this.el.textContent = ''; if (icon.length) { var i = document.createElement('i'); i.classList.add('fa'); i.classList.add('fa-' + icon); if (description.length === 0) { i.classList.add('center'); } this.el.appendChild(i); } this.el.appendChild(document.createTextNode(description)); } return _super.prototype.update.call(this); }; ButtonView.prototype.update_button_style = function () { this.update_mapped_classes(ButtonView.class_map, 'button_style'); }; ButtonView.prototype.set_button_style = function () { this.set_mapped_classes(ButtonView.class_map, 'button_style'); }; /** * Dictionary of events and handlers */ ButtonView.prototype.events = function () { // TODO: return typing not needed in Typescript later than 1.8.x // See http://stackoverflow.com/questions/22077023/why-cant-i-indirectly-return-an-object-literal-to-satisfy-an-index-signature-re and https://github.com/Microsoft/TypeScript/pull/7029 return { 'click': '_handle_click' }; }; /** * Handles when the button is clicked. */ ButtonView.prototype._handle_click = function (event) { event.preventDefault(); this.send({ event: 'click' }); }; Object.defineProperty(ButtonView.prototype, "tagName", { /** * The default tag name. * * #### Notes * This is a read-only attribute. */ get: function () { // We can't make this an attribute with a default value // since it would be set after it is needed in the // constructor. return 'button'; }, enumerable: true, configurable: true }); ButtonView.class_map = { primary: ['mod-primary'], success: ['mod-success'], info: ['mod-info'], warning: ['mod-warning'], danger: ['mod-danger'] }; return ButtonView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_color.js": /*!********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_color.js ***! \********************************************************************/ /*! exports provided: ColorPickerModel, ColorPickerView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPickerModel", function() { return ColorPickerModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPickerView", function() { return ColorPickerView; }); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _widget_description__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_description */ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var ColorPickerModel = /** @class */ (function (_super) { __extends(ColorPickerModel, _super); function ColorPickerModel() { return _super !== null && _super.apply(this, arguments) || this; } ColorPickerModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { value: 'black', concise: false, _model_name: 'ColorPickerModel', _view_name: 'ColorPickerView' }); }; return ColorPickerModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDescriptionModel"])); var ColorPickerView = /** @class */ (function (_super) { __extends(ColorPickerView, _super); function ColorPickerView() { return _super !== null && _super.apply(this, arguments) || this; } ColorPickerView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-colorpicker'); this._color_container = document.createElement('div'); this._color_container.className = 'widget-inline-hbox widget-colorpicker-input'; this.el.appendChild(this._color_container); this._textbox = document.createElement('input'); this._textbox.setAttribute('type', 'text'); this._textbox.id = this.label.htmlFor = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["uuid"])(); this._color_container.appendChild(this._textbox); this._textbox.value = this.model.get('value'); this._colorpicker = document.createElement('input'); this._colorpicker.setAttribute('type', 'color'); this._color_container.appendChild(this._colorpicker); this.listenTo(this.model, 'change:value', this._update_value); this.listenTo(this.model, 'change:concise', this._update_concise); this._update_concise(); this._update_value(); this.update(); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ ColorPickerView.prototype.update = function (options) { if (options === undefined || options.updated_view != this) { var disabled = this.model.get('disabled'); this._textbox.disabled = disabled; this._colorpicker.disabled = disabled; } return _super.prototype.update.call(this); }; ColorPickerView.prototype.events = function () { // Typescript doesn't understand that these functions are called, so we // specifically use them here so it knows they are being used. void this._picker_change; void this._text_change; return { 'change [type="color"]': '_picker_change', 'change [type="text"]': '_text_change' }; }; ColorPickerView.prototype._update_value = function () { var value = this.model.get('value'); this._colorpicker.value = color2hex(value); this._textbox.value = value; }; ColorPickerView.prototype._update_concise = function () { var concise = this.model.get('concise'); if (concise) { this.el.classList.add('concise'); this._textbox.style.display = 'none'; } else { this.el.classList.remove('concise'); this._textbox.style.display = ''; } }; ColorPickerView.prototype._picker_change = function () { this.model.set('value', this._colorpicker.value); this.touch(); }; ColorPickerView.prototype._text_change = function () { var value = this._validate_color(this._textbox.value, this.model.get('value')); this.model.set('value', value); this.touch(); }; ColorPickerView.prototype._validate_color = function (color, fallback) { return color.match(/#[a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?$/) || named_colors[color.toLowerCase()] ? color : fallback; }; return ColorPickerView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var named_colors = { aliceblue: '#f0f8ff', antiquewhite: '#faebd7', aqua: '#00ffff', aquamarine: '#7fffd4', azure: '#f0ffff', beige: '#f5f5dc', bisque: '#ffe4c4', black: '#000000', blanchedalmond: '#ffebcd', blue: '#0000ff', blueviolet: '#8a2be2', brown: '#a52a2a', burlywood: '#deb887', cadetblue: '#5f9ea0', chartreuse: '#7fff00', chocolate: '#d2691e', coral: '#ff7f50', cornflowerblue: '#6495ed', cornsilk: '#fff8dc', crimson: '#dc143c', cyan: '#00ffff', darkblue: '#00008b', darkcyan: '#008b8b', darkgoldenrod: '#b8860b', darkgray: '#a9a9a9', darkgrey: '#a9a9a9', darkgreen: '#006400', darkkhaki: '#bdb76b', darkmagenta: '#8b008b', darkolivegreen: '#556b2f', darkorange: '#ff8c00', darkorchid: '#9932cc', darkred: '#8b0000', darksalmon: '#e9967a', darkseagreen: '#8fbc8f', darkslateblue: '#483d8b', darkslategray: '#2f4f4f', darkslategrey: '#2f4f4f', darkturquoise: '#00ced1', darkviolet: '#9400d3', deeppink: '#ff1493', deepskyblue: '#00bfff', dimgray: '#696969', dimgrey: '#696969', dodgerblue: '#1e90ff', firebrick: '#b22222', floralwhite: '#fffaf0', forestgreen: '#228b22', fuchsia: '#ff00ff', gainsboro: '#dcdcdc', ghostwhite: '#f8f8ff', gold: '#ffd700', goldenrod: '#daa520', gray: '#808080', grey: '#808080', green: '#008000', greenyellow: '#adff2f', honeydew: '#f0fff0', hotpink: '#ff69b4', indianred: '#cd5c5c', indigo: '#4b0082', ivory: '#fffff0', khaki: '#f0e68c', lavender: '#e6e6fa', lavenderblush: '#fff0f5', lawngreen: '#7cfc00', lemonchiffon: '#fffacd', lightblue: '#add8e6', lightcoral: '#f08080', lightcyan: '#e0ffff', lightgoldenrodyellow: '#fafad2', lightgreen: '#90ee90', lightgray: '#d3d3d3', lightgrey: '#d3d3d3', lightpink: '#ffb6c1', lightsalmon: '#ffa07a', lightseagreen: '#20b2aa', lightskyblue: '#87cefa', lightslategray: '#778899', lightslategrey: '#778899', lightsteelblue: '#b0c4de', lightyellow: '#ffffe0', lime: '#00ff00', limegreen: '#32cd32', linen: '#faf0e6', magenta: '#ff00ff', maroon: '#800000', mediumaquamarine: '#66cdaa', mediumblue: '#0000cd', mediumorchid: '#ba55d3', mediumpurple: '#9370db', mediumseagreen: '#3cb371', mediumslateblue: '#7b68ee', mediumspringgreen: '#00fa9a', mediumturquoise: '#48d1cc', mediumvioletred: '#c71585', midnightblue: '#191970', mintcream: '#f5fffa', mistyrose: '#ffe4e1', moccasin: '#ffe4b5', navajowhite: '#ffdead', navy: '#000080', oldlace: '#fdf5e6', olive: '#808000', olivedrab: '#6b8e23', orange: '#ffa500', orangered: '#ff4500', orchid: '#da70d6', palegoldenrod: '#eee8aa', palegreen: '#98fb98', paleturquoise: '#afeeee', palevioletred: '#db7093', papayawhip: '#ffefd5', peachpuff: '#ffdab9', peru: '#cd853f', pink: '#ffc0cb', plum: '#dda0dd', powderblue: '#b0e0e6', purple: '#800080', red: '#ff0000', rosybrown: '#bc8f8f', royalblue: '#4169e1', saddlebrown: '#8b4513', salmon: '#fa8072', sandybrown: '#f4a460', seagreen: '#2e8b57', seashell: '#fff5ee', sienna: '#a0522d', silver: '#c0c0c0', skyblue: '#87ceeb', slateblue: '#6a5acd', slategray: '#708090', slategrey: '#708090', snow: '#fffafa', springgreen: '#00ff7f', steelblue: '#4682b4', tan: '#d2b48c', teal: '#008080', thistle: '#d8bfd8', tomato: '#ff6347', turquoise: '#40e0d0', violet: '#ee82ee', wheat: '#f5deb3', white: '#ffffff', whitesmoke: '#f5f5f5', yellow: '#ffff00', yellowgreen: '#9acd32', }; /* * From a valid html color (named color, 6-digits or 3-digits hex format) * return a 6-digits hexadecimal color #rrggbb. */ function color2hex(color) { return named_colors[color.toLowerCase()] || rgb3_to_rgb6(color); } function rgb3_to_rgb6(rgb) { if (rgb.length === 7) { return rgb; } else { return '#' + rgb.charAt(1) + rgb.charAt(1) + rgb.charAt(2) + rgb.charAt(2) + rgb.charAt(3) + rgb.charAt(3); } } /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_controller.js": /*!*************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_controller.js ***! \*************************************************************************/ /*! exports provided: ControllerButtonModel, ControllerButtonView, ControllerAxisModel, ControllerAxisView, ControllerModel, ControllerView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControllerButtonModel", function() { return ControllerButtonModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControllerButtonView", function() { return ControllerButtonView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControllerAxisModel", function() { return ControllerAxisModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControllerAxisView", function() { return ControllerAxisView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControllerModel", function() { return ControllerModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControllerView", function() { return ControllerView; }); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_6__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var ControllerButtonModel = /** @class */ (function (_super) { __extends(ControllerButtonModel, _super); function ControllerButtonModel() { return _super !== null && _super.apply(this, arguments) || this; } ControllerButtonModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_4__["extend"](_super.prototype.defaults.call(this), { _model_name: 'ControllerButtonModel', _view_name: 'ControllerButtonView', value: 0.0, pressed: false }); }; return ControllerButtonModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDOMWidgetModel"])); /** * Very simple view for a gamepad button. */ var ControllerButtonView = /** @class */ (function (_super) { __extends(ControllerButtonView, _super); function ControllerButtonView() { return _super !== null && _super.apply(this, arguments) || this; } ControllerButtonView.prototype.render = function () { this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-controller-button'); this.el.style.width = 'fit-content'; this.support = document.createElement('div'); this.support.style.position = 'relative'; this.support.style.margin = '1px'; this.support.style.width = '16px'; this.support.style.height = '16px'; this.support.style.border = '1px solid black'; this.support.style.background = 'lightgray'; this.el.appendChild(this.support); this.bar = document.createElement('div'); this.bar.style.position = 'absolute'; this.bar.style.width = '100%'; this.bar.style.bottom = '0px'; this.bar.style.background = 'gray'; this.support.appendChild(this.bar); this.update(); this.label = document.createElement('div'); this.label.textContent = this.model.get('description'); this.label.style.textAlign = 'center'; this.el.appendChild(this.label); }; ControllerButtonView.prototype.update = function () { this.bar.style.height = (100 * this.model.get('value')) + '%'; }; return ControllerButtonView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["DOMWidgetView"])); var ControllerAxisModel = /** @class */ (function (_super) { __extends(ControllerAxisModel, _super); function ControllerAxisModel() { return _super !== null && _super.apply(this, arguments) || this; } ControllerAxisModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_4__["extend"](_super.prototype.defaults.call(this), { _model_name: 'ControllerAxisModel', _view_name: 'ControllerAxisView', value: 0.0 }); }; return ControllerAxisModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDOMWidgetModel"])); /** * Very simple view for a gamepad axis. */ var ControllerAxisView = /** @class */ (function (_super) { __extends(ControllerAxisView, _super); function ControllerAxisView() { return _super !== null && _super.apply(this, arguments) || this; } ControllerAxisView.prototype.render = function () { this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-controller-axis'); this.el.style.width = '16px'; this.el.style.padding = '4px'; this.support = document.createElement('div'); this.support.style.position = 'relative'; this.support.style.margin = '1px'; this.support.style.width = '4px'; this.support.style.height = '64px'; this.support.style.border = '1px solid black'; this.support.style.background = 'lightgray'; this.bullet = document.createElement('div'); this.bullet.style.position = 'absolute'; this.bullet.style.margin = '-3px'; this.bullet.style.boxSizing = 'unset'; this.bullet.style.width = '10px'; this.bullet.style.height = '10px'; this.bullet.style.background = 'gray'; this.label = document.createElement('div'); this.label.textContent = this.model.get('description'); this.label.style.textAlign = 'center'; this.support.appendChild(this.bullet); this.el.appendChild(this.support); this.el.appendChild(this.label); this.update(); }; ControllerAxisView.prototype.update = function () { this.bullet.style.top = (50 * (this.model.get('value') + 1)) + '%'; }; return ControllerAxisView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["DOMWidgetView"])); var ControllerModel = /** @class */ (function (_super) { __extends(ControllerModel, _super); function ControllerModel() { return _super !== null && _super.apply(this, arguments) || this; } ControllerModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_4__["extend"](_super.prototype.defaults.call(this), { _model_name: 'ControllerModel', _view_name: 'ControllerView', index: 0, name: '', mapping: '', connected: false, timestamp: 0, buttons: [], axes: [] }); }; ControllerModel.prototype.initialize = function (attributes, options) { _super.prototype.initialize.call(this, attributes, options); if (navigator.getGamepads === void 0) { // Checks if the browser supports the gamepad API this.readout = 'This browser does not support gamepads.'; console.error(this.readout); } else { // Start the wait loop, and listen to updates of the only // user-provided attribute, the gamepad index. this.readout = 'Connect gamepad and press any button.'; if (this.get('connected')) { // No need to re-create Button and Axis widgets, re-use // the models provided by the backend which may already // be wired to other things. this.update_loop(); } else { // Wait for a gamepad to be connected. this.wait_loop(); } } }; /** * Waits for a gamepad to be connected at the provided index. * Once one is connected, it will start the update loop, which * populates the update of axes and button values. */ ControllerModel.prototype.wait_loop = function () { var index = this.get('index'); var pad = navigator.getGamepads()[index]; if (pad) { var that_1 = this; this.setup(pad).then(function (controls) { that_1.set(controls); that_1.save_changes(); window.requestAnimationFrame(that_1.update_loop.bind(that_1)); }); } else { window.requestAnimationFrame(this.wait_loop.bind(this)); } }; /** * Given a native gamepad object, returns a promise for a dictionary of * controls, of the form * { * buttons: list of Button models, * axes: list of Axis models, * } */ ControllerModel.prototype.setup = function (pad) { // Set up the main gamepad attributes this.set({ name: pad.id, mapping: pad.mapping, connected: pad.connected, timestamp: pad.timestamp }); // Create buttons and axes. When done, start the update loop var that = this; return _utils__WEBPACK_IMPORTED_MODULE_5__["resolvePromisesDict"]({ buttons: Promise.all(pad.buttons.map(function (btn, index) { return that._create_button_model(index); })), axes: Promise.all(pad.axes.map(function (axis, index) { return that._create_axis_model(index); })), }); }; /** * Update axes and buttons values, until the gamepad is disconnected. * When the gamepad is disconnected, this.reset_gamepad is called. */ ControllerModel.prototype.update_loop = function () { var index = this.get('index'); var id = this.get('name'); var pad = navigator.getGamepads()[index]; if (pad && index === pad.index && id === pad.id) { this.set({ timestamp: pad.timestamp, connected: pad.connected }); this.save_changes(); this.get('buttons').forEach(function (model, index) { model.set({ value: pad.buttons[index].value, pressed: pad.buttons[index].pressed }); model.save_changes(); }); this.get('axes').forEach(function (model, index) { model.set('value', pad.axes[index]); model.save_changes(); }); window.requestAnimationFrame(this.update_loop.bind(this)); } else { this.reset_gamepad(); } }; /** * Resets the gamepad attributes, and start the wait_loop. */ ControllerModel.prototype.reset_gamepad = function () { this.get('buttons').forEach(function (button) { button.close(); }); this.get('axes').forEach(function (axis) { axis.close(); }); this.set({ name: '', mapping: '', connected: false, timestamp: 0.0, buttons: [], axes: [] }); this.save_changes(); window.requestAnimationFrame(this.wait_loop.bind(this)); }; /** * Creates a gamepad button widget. */ ControllerModel.prototype._create_button_model = function (index) { return this.widget_manager.new_widget({ model_name: 'ControllerButtonModel', model_module: '@jupyter-widgets/controls', model_module_version: this.get('_model_module_version'), view_name: 'ControllerButtonView', view_module: '@jupyter-widgets/controls', view_module_version: this.get('_view_module_version'), }).then(function (model) { model.set('description', index); return model; }); }; /** * Creates a gamepad axis widget. */ ControllerModel.prototype._create_axis_model = function (index) { return this.widget_manager.new_widget({ model_name: 'ControllerAxisModel', model_module: '@jupyter-widgets/controls', model_module_version: this.get('_model_module_version'), view_name: 'ControllerAxisView', view_module: '@jupyter-widgets/controls', view_module_version: this.get('_view_module_version'), }).then(function (model) { model.set('description', index); return model; }); }; ControllerModel.serializers = __assign(__assign({}, _widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDOMWidgetModel"].serializers), { buttons: { deserialize: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["unpack_models"] }, axes: { deserialize: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["unpack_models"] } }); return ControllerModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDOMWidgetModel"])); /** * A simple view for a gamepad. */ var ControllerView = /** @class */ (function (_super) { __extends(ControllerView, _super); function ControllerView() { return _super !== null && _super.apply(this, arguments) || this; } ControllerView.prototype._createElement = function (tagName) { this.pWidget = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["JupyterPhosphorPanelWidget"]({ view: this }); return this.pWidget.node; }; ControllerView.prototype._setElement = function (el) { if (this.el || el !== this.pWidget.node) { // Boxes don't allow setting the element beyond the initial creation. throw new Error('Cannot reset the DOM element.'); } this.el = this.pWidget.node; this.$el = jquery__WEBPACK_IMPORTED_MODULE_6___default()(this.pWidget.node); }; ControllerView.prototype.initialize = function (parameters) { _super.prototype.initialize.call(this, parameters); this.button_views = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["ViewList"](this.add_button, null, this); this.listenTo(this.model, 'change:buttons', function (model, value) { this.button_views.update(value); }); this.axis_views = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["ViewList"](this.add_axis, null, this); this.listenTo(this.model, 'change:axes', function (model, value) { this.axis_views.update(value); }); this.listenTo(this.model, 'change:name', this.update_label); }; ControllerView.prototype.render = function () { this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-controller'); this.label = document.createElement('div'); this.el.appendChild(this.label); this.axis_box = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Panel"](); this.axis_box.node.style.display = 'flex'; this.pWidget.addWidget(this.axis_box); this.button_box = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Panel"](); this.button_box.node.style.display = 'flex'; this.pWidget.addWidget(this.button_box); this.button_views.update(this.model.get('buttons')); this.axis_views.update(this.model.get('axes')); this.update_label(); }; ControllerView.prototype.update_label = function () { this.label.textContent = this.model.get('name') || this.model.readout; }; ControllerView.prototype.add_button = function (model) { var _this = this; // we insert a dummy element so the order is preserved when we add // the rendered content later. var dummy = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"](); this.button_box.addWidget(dummy); return this.create_child_view(model).then(function (view) { // replace the dummy widget with the new one. var i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__["ArrayExt"].firstIndexOf(_this.button_box.widgets, dummy); _this.button_box.insertWidget(i, view.pWidget); dummy.dispose(); return view; }).catch(_utils__WEBPACK_IMPORTED_MODULE_5__["reject"]('Could not add child button view to controller', true)); }; ControllerView.prototype.add_axis = function (model) { var _this = this; // we insert a dummy element so the order is preserved when we add // the rendered content later. var dummy = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"](); this.axis_box.addWidget(dummy); return this.create_child_view(model).then(function (view) { // replace the dummy widget with the new one. var i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_3__["ArrayExt"].firstIndexOf(_this.axis_box.widgets, dummy); _this.axis_box.insertWidget(i, view.pWidget); dummy.dispose(); return view; }).catch(_utils__WEBPACK_IMPORTED_MODULE_5__["reject"]('Could not add child axis view to controller', true)); }; ControllerView.prototype.remove = function () { _super.prototype.remove.call(this); this.button_views.remove(); this.axis_views.remove(); }; return ControllerView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js": /*!*******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_core.js ***! \*******************************************************************/ /*! exports provided: CoreWidgetModel, CoreDOMWidgetModel, CoreDescriptionModel */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CoreWidgetModel", function() { return CoreWidgetModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CoreDOMWidgetModel", function() { return CoreDOMWidgetModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CoreDescriptionModel", function() { return CoreDescriptionModel; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _widget_description__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_description */ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js"); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./version */ "./node_modules/@jupyter-widgets/controls/lib/version.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); // widget_core implements some common patterns for the core widget collection // that are not to be used directly by third-party widget authors. var CoreWidgetModel = /** @class */ (function (_super) { __extends(CoreWidgetModel, _super); function CoreWidgetModel() { return _super !== null && _super.apply(this, arguments) || this; } CoreWidgetModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _model_name: 'CoreWidgetModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], _model_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], }); }; return CoreWidgetModel; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["WidgetModel"])); var CoreDOMWidgetModel = /** @class */ (function (_super) { __extends(CoreDOMWidgetModel, _super); function CoreDOMWidgetModel() { return _super !== null && _super.apply(this, arguments) || this; } CoreDOMWidgetModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _model_name: 'CoreDOMWidgetModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], _model_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], }); }; return CoreDOMWidgetModel; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetModel"])); var CoreDescriptionModel = /** @class */ (function (_super) { __extends(CoreDescriptionModel, _super); function CoreDescriptionModel() { return _super !== null && _super.apply(this, arguments) || this; } CoreDescriptionModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _model_name: 'CoreDescriptionModel', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], _model_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], }); }; return CoreDescriptionModel; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionModel"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_date.js": /*!*******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_date.js ***! \*******************************************************************/ /*! exports provided: serialize_date, deserialize_date, DatePickerModel, DatePickerView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serialize_date", function() { return serialize_date; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deserialize_date", function() { return deserialize_date; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DatePickerModel", function() { return DatePickerModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DatePickerView", function() { return DatePickerView; }); /* harmony import */ var _widget_description__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_description */ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js"); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function serialize_date(value) { if (value === null) { return null; } else { return { year: value.getUTCFullYear(), month: value.getUTCMonth(), date: value.getUTCDate() }; } } function deserialize_date(value) { if (value === null) { return null; } else { var date = new Date(); date.setUTCFullYear(value.year, value.month, value.date); date.setUTCHours(0, 0, 0, 0); return date; } } var DatePickerModel = /** @class */ (function (_super) { __extends(DatePickerModel, _super); function DatePickerModel() { return _super !== null && _super.apply(this, arguments) || this; } DatePickerModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { value: null, _model_name: 'DatePickerModel', _view_name: 'DatePickerView' }); }; DatePickerModel.serializers = __assign(__assign({}, _widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDescriptionModel"].serializers), { value: { serialize: serialize_date, deserialize: deserialize_date } }); return DatePickerModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDescriptionModel"])); var DatePickerView = /** @class */ (function (_super) { __extends(DatePickerView, _super); function DatePickerView() { return _super !== null && _super.apply(this, arguments) || this; } DatePickerView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-datepicker'); this._datepicker = document.createElement('input'); this._datepicker.setAttribute('type', 'date'); this._datepicker.id = this.label.htmlFor = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["uuid"])(); this.el.appendChild(this._datepicker); this.listenTo(this.model, 'change:value', this._update_value); this._update_value(); this.update(); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ DatePickerView.prototype.update = function (options) { if (options === undefined || options.updated_view !== this) { this._datepicker.disabled = this.model.get('disabled'); } return _super.prototype.update.call(this); }; DatePickerView.prototype.events = function () { // Typescript doesn't understand that these functions are called, so we // specifically use them here so it knows they are being used. void this._picker_change; void this._picker_focusout; return { 'change [type="date"]': '_picker_change', 'focusout [type="date"]': '_picker_focusout' }; }; DatePickerView.prototype._update_value = function () { var value = this.model.get('value'); this._datepicker.valueAsDate = value; }; DatePickerView.prototype._picker_change = function () { if (!this._datepicker.validity.badInput) { this.model.set('value', this._datepicker.valueAsDate); this.touch(); } }; DatePickerView.prototype._picker_focusout = function () { if (this._datepicker.validity.badInput) { this.model.set('value', null); this.touch(); } }; return DatePickerView; }(_widget_description__WEBPACK_IMPORTED_MODULE_0__["DescriptionView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js": /*!**************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_description.js ***! \**************************************************************************/ /*! exports provided: DescriptionStyleModel, DescriptionModel, DescriptionView, LabeledDOMWidgetModel, LabeledDOMWidgetView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DescriptionStyleModel", function() { return DescriptionStyleModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DescriptionModel", function() { return DescriptionModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DescriptionView", function() { return DescriptionView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LabeledDOMWidgetModel", function() { return LabeledDOMWidgetModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LabeledDOMWidgetView", function() { return LabeledDOMWidgetView; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./version */ "./node_modules/@jupyter-widgets/controls/lib/version.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var DescriptionStyleModel = /** @class */ (function (_super) { __extends(DescriptionStyleModel, _super); function DescriptionStyleModel() { return _super !== null && _super.apply(this, arguments) || this; } DescriptionStyleModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'DescriptionStyleModel', _model_module: '@jupyter-widgets/controls', _model_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"] }); }; DescriptionStyleModel.styleProperties = { description_width: { selector: '.widget-label', attribute: 'width', default: null }, }; return DescriptionStyleModel; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["StyleModel"])); var DescriptionModel = /** @class */ (function (_super) { __extends(DescriptionModel, _super); function DescriptionModel() { return _super !== null && _super.apply(this, arguments) || this; } DescriptionModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'DescriptionModel', _view_name: 'DescriptionView', _view_module: '@jupyter-widgets/controls', _model_module: '@jupyter-widgets/controls', _view_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], _model_module_version: _version__WEBPACK_IMPORTED_MODULE_2__["JUPYTER_CONTROLS_VERSION"], description: '', description_tooltip: null }); }; return DescriptionModel; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetModel"])); var DescriptionView = /** @class */ (function (_super) { __extends(DescriptionView, _super); function DescriptionView() { return _super !== null && _super.apply(this, arguments) || this; } DescriptionView.prototype.render = function () { this.label = document.createElement('label'); this.el.appendChild(this.label); this.label.className = 'widget-label'; this.label.style.display = 'none'; this.listenTo(this.model, 'change:description', this.updateDescription); this.listenTo(this.model, 'change:description_tooltip', this.updateDescription); this.updateDescription(); }; DescriptionView.prototype.typeset = function (element, text) { this.displayed.then(function () { return Object(_utils__WEBPACK_IMPORTED_MODULE_1__["typeset"])(element, text); }); }; DescriptionView.prototype.updateDescription = function () { var description = this.model.get('description'); var description_tooltip = this.model.get('description_tooltip'); if (description_tooltip === null) { description_tooltip = description; } if (description.length === 0) { this.label.style.display = 'none'; } else { this.label.innerHTML = description; this.typeset(this.label); this.label.style.display = ''; } this.label.title = description_tooltip; }; return DescriptionView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); /** * For backwards compatibility with jupyter-js-widgets 2.x. * * Use DescriptionModel instead. */ var LabeledDOMWidgetModel = /** @class */ (function (_super) { __extends(LabeledDOMWidgetModel, _super); function LabeledDOMWidgetModel() { return _super !== null && _super.apply(this, arguments) || this; } return LabeledDOMWidgetModel; }(DescriptionModel)); /** * For backwards compatibility with jupyter-js-widgets 2.x. * * Use DescriptionView instead. */ var LabeledDOMWidgetView = /** @class */ (function (_super) { __extends(LabeledDOMWidgetView, _super); function LabeledDOMWidgetView() { return _super !== null && _super.apply(this, arguments) || this; } return LabeledDOMWidgetView; }(DescriptionView)); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_float.js": /*!********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_float.js ***! \********************************************************************/ /*! exports provided: FloatModel, BoundedFloatModel, FloatSliderModel, FloatLogSliderModel, FloatRangeSliderModel, FloatSliderView, FloatLogSliderView, FloatRangeSliderView, FloatTextModel, BoundedFloatTextModel, FloatTextView, FloatProgressModel */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatModel", function() { return FloatModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundedFloatModel", function() { return BoundedFloatModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatSliderModel", function() { return FloatSliderModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatLogSliderModel", function() { return FloatLogSliderModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatRangeSliderModel", function() { return FloatRangeSliderModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatSliderView", function() { return FloatSliderView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatLogSliderView", function() { return FloatLogSliderView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatRangeSliderView", function() { return FloatRangeSliderView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatTextModel", function() { return FloatTextModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundedFloatTextModel", function() { return BoundedFloatTextModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatTextView", function() { return FloatTextView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FloatProgressModel", function() { return FloatProgressModel; }); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); /* harmony import */ var _widget_int__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./widget_int */ "./node_modules/@jupyter-widgets/controls/lib/widget_int.js"); /* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! d3-format */ "./node_modules/d3-format/src/index.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var FloatModel = /** @class */ (function (_super) { __extends(FloatModel, _super); function FloatModel() { return _super !== null && _super.apply(this, arguments) || this; } FloatModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_1__["extend"](_super.prototype.defaults.call(this), { _model_name: 'FloatModel', value: 0, }); }; return FloatModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDescriptionModel"])); var BoundedFloatModel = /** @class */ (function (_super) { __extends(BoundedFloatModel, _super); function BoundedFloatModel() { return _super !== null && _super.apply(this, arguments) || this; } BoundedFloatModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_1__["extend"](_super.prototype.defaults.call(this), { _model_name: 'BoundedFloatModel', max: 100.0, min: 0.0 }); }; return BoundedFloatModel; }(FloatModel)); var FloatSliderModel = /** @class */ (function (_super) { __extends(FloatSliderModel, _super); function FloatSliderModel() { return _super !== null && _super.apply(this, arguments) || this; } FloatSliderModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_1__["extend"](_super.prototype.defaults.call(this), { _model_name: 'FloatSliderModel', _view_name: 'FloatSliderView', step: 1.0, orientation: 'horizontal', _range: false, readout: true, readout_format: '.2f', slider_color: null, continuous_update: true, disabled: false, }); }; FloatSliderModel.prototype.initialize = function (attributes, options) { _super.prototype.initialize.call(this, attributes, options); this.on('change:readout_format', this.update_readout_format, this); this.update_readout_format(); }; FloatSliderModel.prototype.update_readout_format = function () { this.readout_formatter = Object(d3_format__WEBPACK_IMPORTED_MODULE_3__["format"])(this.get('readout_format')); }; return FloatSliderModel; }(BoundedFloatModel)); var FloatLogSliderModel = /** @class */ (function (_super) { __extends(FloatLogSliderModel, _super); function FloatLogSliderModel() { return _super !== null && _super.apply(this, arguments) || this; } FloatLogSliderModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_1__["extend"](_super.prototype.defaults.call(this), { _model_name: 'FloatLogSliderModel', _view_name: 'FloatLogSliderView', step: 0.1, orientation: 'horizontal', _range: false, readout: true, readout_format: '.3g', slider_color: null, continuous_update: true, disabled: false, base: 10., value: 1.0, min: 0, max: 4 }); }; FloatLogSliderModel.prototype.initialize = function (attributes, options) { _super.prototype.initialize.call(this, attributes, options); this.on('change:readout_format', this.update_readout_format, this); this.update_readout_format(); }; FloatLogSliderModel.prototype.update_readout_format = function () { this.readout_formatter = Object(d3_format__WEBPACK_IMPORTED_MODULE_3__["format"])(this.get('readout_format')); }; return FloatLogSliderModel; }(BoundedFloatModel)); var FloatRangeSliderModel = /** @class */ (function (_super) { __extends(FloatRangeSliderModel, _super); function FloatRangeSliderModel() { return _super !== null && _super.apply(this, arguments) || this; } return FloatRangeSliderModel; }(FloatSliderModel)); var FloatSliderView = /** @class */ (function (_super) { __extends(FloatSliderView, _super); function FloatSliderView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._parse_value = parseFloat; return _this; } /** * Validate the value of the slider before sending it to the back-end * and applying it to the other views on the page. */ FloatSliderView.prototype._validate_slide_value = function (x) { return x; }; return FloatSliderView; }(_widget_int__WEBPACK_IMPORTED_MODULE_2__["IntSliderView"])); var FloatLogSliderView = /** @class */ (function (_super) { __extends(FloatLogSliderView, _super); function FloatLogSliderView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._parse_value = parseFloat; return _this; } FloatLogSliderView.prototype.update = function (options) { _super.prototype.update.call(this, options); var min = this.model.get('min'); var max = this.model.get('max'); var value = this.model.get('value'); var base = this.model.get('base'); var log_value = Math.log(value) / Math.log(base); if (log_value > max) { log_value = max; } else if (log_value < min) { log_value = min; } this.$slider.slider('option', 'value', log_value); this.readout.textContent = this.valueToString(value); if (this.model.get('value') !== value) { this.model.set('value', value, { updated_view: this }); this.touch(); } }; /** * Write value to a string */ FloatLogSliderView.prototype.valueToString = function (value) { var format = this.model.readout_formatter; return format(value); }; /** * Parse value from a string */ FloatLogSliderView.prototype.stringToValue = function (text) { return this._parse_value(text); }; /** * this handles the entry of text into the contentEditable label first, the * value is checked if it contains a parseable value then it is clamped * within the min-max range of the slider finally, the model is updated if * the value is to be changed * * if any of these conditions are not met, the text is reset */ FloatLogSliderView.prototype.handleTextChange = function () { var value = this.stringToValue(this.readout.textContent); var vmin = this.model.get('min'); var vmax = this.model.get('max'); var base = this.model.get('base'); if (isNaN(value)) { this.readout.textContent = this.valueToString(this.model.get('value')); } else { value = Math.max(Math.min(value, Math.pow(base, vmax)), Math.pow(base, vmin)); if (value !== this.model.get('value')) { this.readout.textContent = this.valueToString(value); this.model.set('value', value, { updated_view: this }); this.touch(); } else { this.readout.textContent = this.valueToString(this.model.get('value')); } } }; /** * Called when the slider value is changing. */ FloatLogSliderView.prototype.handleSliderChange = function (e, ui) { var base = this.model.get('base'); var actual_value = Math.pow(base, this._validate_slide_value(ui.value)); this.readout.textContent = this.valueToString(actual_value); // Only persist the value while sliding if the continuous_update // trait is set to true. if (this.model.get('continuous_update')) { this.handleSliderChanged(e, ui); } }; /** * Called when the slider value has changed. * * Calling model.set will trigger all of the other views of the * model to update. */ FloatLogSliderView.prototype.handleSliderChanged = function (e, ui) { var base = this.model.get('base'); var actual_value = Math.pow(base, this._validate_slide_value(ui.value)); this.model.set('value', actual_value, { updated_view: this }); this.touch(); }; FloatLogSliderView.prototype._validate_slide_value = function (x) { return x; }; return FloatLogSliderView; }(_widget_int__WEBPACK_IMPORTED_MODULE_2__["BaseIntSliderView"])); var FloatRangeSliderView = /** @class */ (function (_super) { __extends(FloatRangeSliderView, _super); function FloatRangeSliderView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._parse_value = parseFloat; // matches: whitespace?, float, whitespace?, (hyphen, colon, or en-dash), whitespace?, float _this._range_regex = /^\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][-:]?\d+)?)\s*[-:–]\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)/; return _this; } /** * Validate the value of the slider before sending it to the back-end * and applying it to the other views on the page. */ FloatRangeSliderView.prototype._validate_slide_value = function (x) { return x; }; return FloatRangeSliderView; }(_widget_int__WEBPACK_IMPORTED_MODULE_2__["IntRangeSliderView"])); var FloatTextModel = /** @class */ (function (_super) { __extends(FloatTextModel, _super); function FloatTextModel() { return _super !== null && _super.apply(this, arguments) || this; } FloatTextModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_1__["extend"](_super.prototype.defaults.call(this), { _model_name: 'FloatTextModel', _view_name: 'FloatTextView', disabled: false, continuous_update: false, }); }; return FloatTextModel; }(FloatModel)); var BoundedFloatTextModel = /** @class */ (function (_super) { __extends(BoundedFloatTextModel, _super); function BoundedFloatTextModel() { return _super !== null && _super.apply(this, arguments) || this; } BoundedFloatTextModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_1__["extend"](_super.prototype.defaults.call(this), { _model_name: 'BoundedFloatTextModel', _view_name: 'FloatTextView', disabled: false, continuous_update: false, step: 0.1 }); }; return BoundedFloatTextModel; }(BoundedFloatModel)); var FloatTextView = /** @class */ (function (_super) { __extends(FloatTextView, _super); function FloatTextView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._parse_value = parseFloat; _this._default_step = 'any'; return _this; } /** * Handle key press */ FloatTextView.prototype.handleKeypress = function (e) { // Overwrite IntTextView's handleKeypress // which prevents decimal points. e.stopPropagation(); }; /** * Handle key up */ FloatTextView.prototype.handleKeyUp = function (e) { // Overwrite IntTextView's handleKeyUp // which prevents decimal points. }; return FloatTextView; }(_widget_int__WEBPACK_IMPORTED_MODULE_2__["IntTextView"])); var FloatProgressModel = /** @class */ (function (_super) { __extends(FloatProgressModel, _super); function FloatProgressModel() { return _super !== null && _super.apply(this, arguments) || this; } FloatProgressModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_1__["extend"](_super.prototype.defaults.call(this), { _model_name: 'FloatProgressModel', _view_name: 'ProgressView', orientation: 'horizontal', bar_style: '', style: null }); }; return FloatProgressModel; }(BoundedFloatModel)); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_image.js": /*!********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_image.js ***! \********************************************************************/ /*! exports provided: ImageModel, ImageView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageModel", function() { return ImageModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageView", function() { return ImageView; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var ImageModel = /** @class */ (function (_super) { __extends(ImageModel, _super); function ImageModel() { return _super !== null && _super.apply(this, arguments) || this; } ImageModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_2__["extend"](_super.prototype.defaults.call(this), { _model_name: 'ImageModel', _view_name: 'ImageView', format: 'png', width: '', height: '', value: new DataView(new ArrayBuffer(0)) }); }; ImageModel.serializers = __assign(__assign({}, _widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"].serializers), { value: { serialize: function (value) { return new DataView(value.buffer.slice(0)); } } }); return ImageModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"])); var ImageView = /** @class */ (function (_super) { __extends(ImageView, _super); function ImageView() { return _super !== null && _super.apply(this, arguments) || this; } ImageView.prototype.render = function () { /** * Called when view is rendered. */ _super.prototype.render.call(this); this.pWidget.addClass('jupyter-widgets'); this.pWidget.addClass('widget-image'); this.update(); // Set defaults. }; ImageView.prototype.update = function () { /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ var url; var format = this.model.get('format'); var value = this.model.get('value'); if (format !== 'url') { var blob = new Blob([value], { type: "image/" + this.model.get('format') }); url = URL.createObjectURL(blob); } else { url = (new TextDecoder('utf-8')).decode(value.buffer); } // Clean up the old objectURL var oldurl = this.el.src; this.el.src = url; if (oldurl && typeof oldurl !== 'string') { URL.revokeObjectURL(oldurl); } var width = this.model.get('width'); if (width !== undefined && width.length > 0) { this.el.setAttribute('width', width); } else { this.el.removeAttribute('width'); } var height = this.model.get('height'); if (height !== undefined && height.length > 0) { this.el.setAttribute('height', height); } else { this.el.removeAttribute('height'); } return _super.prototype.update.call(this); }; ImageView.prototype.remove = function () { if (this.el.src) { URL.revokeObjectURL(this.el.src); } _super.prototype.remove.call(this); }; Object.defineProperty(ImageView.prototype, "tagName", { /** * The default tag name. * * #### Notes * This is a read-only attribute. */ get: function () { // We can't make this an attribute with a default value // since it would be set after it is needed in the // constructor. return 'img'; }, enumerable: true, configurable: true }); return ImageView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_int.js": /*!******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_int.js ***! \******************************************************************/ /*! exports provided: IntModel, BoundedIntModel, SliderStyleModel, IntSliderModel, IntRangeSliderModel, BaseIntSliderView, IntRangeSliderView, IntSliderView, IntTextModel, BoundedIntTextModel, IntTextView, ProgressStyleModel, IntProgressModel, ProgressView, PlayModel, PlayView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntModel", function() { return IntModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundedIntModel", function() { return BoundedIntModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SliderStyleModel", function() { return SliderStyleModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntSliderModel", function() { return IntSliderModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntRangeSliderModel", function() { return IntRangeSliderModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseIntSliderView", function() { return BaseIntSliderView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntRangeSliderView", function() { return IntRangeSliderView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntSliderView", function() { return IntSliderView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntTextModel", function() { return IntTextModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundedIntTextModel", function() { return BoundedIntTextModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntTextView", function() { return IntTextView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProgressStyleModel", function() { return ProgressStyleModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntProgressModel", function() { return IntProgressModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProgressView", function() { return ProgressView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayModel", function() { return PlayModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlayView", function() { return PlayView; }); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _widget_description__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_description */ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js"); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! d3-format */ "./node_modules/d3-format/src/index.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var jquery_ui_ui_widgets_slider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! jquery-ui/ui/widgets/slider */ "./node_modules/jquery-ui/ui/widgets/slider.js"); /* harmony import */ var jquery_ui_ui_widgets_slider__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(jquery_ui_ui_widgets_slider__WEBPACK_IMPORTED_MODULE_7__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var IntModel = /** @class */ (function (_super) { __extends(IntModel, _super); function IntModel() { return _super !== null && _super.apply(this, arguments) || this; } IntModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_5__["extend"](_super.prototype.defaults.call(this), { _model_name: 'IntModel', value: 0, }); }; return IntModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDescriptionModel"])); var BoundedIntModel = /** @class */ (function (_super) { __extends(BoundedIntModel, _super); function BoundedIntModel() { return _super !== null && _super.apply(this, arguments) || this; } BoundedIntModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_5__["extend"](_super.prototype.defaults.call(this), { _model_name: 'BoundedIntModel', max: 100, min: 0 }); }; return BoundedIntModel; }(IntModel)); var SliderStyleModel = /** @class */ (function (_super) { __extends(SliderStyleModel, _super); function SliderStyleModel() { return _super !== null && _super.apply(this, arguments) || this; } SliderStyleModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'SliderStyleModel' }); }; SliderStyleModel.styleProperties = __assign(__assign({}, _widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionStyleModel"].styleProperties), { handle_color: { selector: '.ui-slider-handle', attribute: 'background-color', default: null } }); return SliderStyleModel; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionStyleModel"])); var IntSliderModel = /** @class */ (function (_super) { __extends(IntSliderModel, _super); function IntSliderModel() { return _super !== null && _super.apply(this, arguments) || this; } IntSliderModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_5__["extend"](_super.prototype.defaults.call(this), { _model_name: 'IntSliderModel', _view_name: 'IntSliderView', step: 1, orientation: 'horizontal', readout: true, readout_format: 'd', continuous_update: true, style: null, disabled: false, }); }; IntSliderModel.prototype.initialize = function (attributes, options) { _super.prototype.initialize.call(this, attributes, options); this.on('change:readout_format', this.update_readout_format, this); this.update_readout_format(); }; IntSliderModel.prototype.update_readout_format = function () { this.readout_formatter = Object(d3_format__WEBPACK_IMPORTED_MODULE_4__["format"])(this.get('readout_format')); }; return IntSliderModel; }(BoundedIntModel)); var IntRangeSliderModel = /** @class */ (function (_super) { __extends(IntRangeSliderModel, _super); function IntRangeSliderModel() { return _super !== null && _super.apply(this, arguments) || this; } return IntRangeSliderModel; }(IntSliderModel)); var BaseIntSliderView = /** @class */ (function (_super) { __extends(BaseIntSliderView, _super); function BaseIntSliderView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._parse_value = parseInt; return _this; } BaseIntSliderView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-slider'); this.el.classList.add('widget-hslider'); (this.$slider = jquery__WEBPACK_IMPORTED_MODULE_6___default()('
')) .slider({ slide: this.handleSliderChange.bind(this), stop: this.handleSliderChanged.bind(this) }) .addClass('slider'); // Put the slider in a container this.slider_container = document.createElement('div'); this.slider_container.classList.add('slider-container'); this.slider_container.appendChild(this.$slider[0]); this.el.appendChild(this.slider_container); this.readout = document.createElement('div'); this.el.appendChild(this.readout); this.readout.classList.add('widget-readout'); this.readout.contentEditable = 'true'; this.readout.style.display = 'none'; // Set defaults. this.update(); }; BaseIntSliderView.prototype.update = function (options) { /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ if (options === undefined || options.updated_view !== this) { // JQuery slider option keys. These keys happen to have a // one-to-one mapping with the corresponding keys of the model. var jquery_slider_keys = ['step', 'disabled']; var that_1 = this; that_1.$slider.slider({}); jquery_slider_keys.forEach(function (key) { var model_value = that_1.model.get(key); if (model_value !== undefined) { that_1.$slider.slider('option', key, model_value); } }); if (this.model.get('disabled')) { this.readout.contentEditable = 'false'; } else { this.readout.contentEditable = 'true'; } var max = this.model.get('max'); var min = this.model.get('min'); if (min <= max) { if (max !== undefined) { this.$slider.slider('option', 'max', max); } if (min !== undefined) { this.$slider.slider('option', 'min', min); } } // WORKAROUND FOR JQUERY SLIDER BUG. // The horizontal position of the slider handle // depends on the value of the slider at the time // of orientation change. Before applying the new // workaround, we set the value to the minimum to // make sure that the horizontal placement of the // handle in the vertical slider is always // consistent. var orientation_1 = this.model.get('orientation'); this.$slider.slider('option', 'orientation', orientation_1); // Use the right CSS classes for vertical & horizontal sliders if (orientation_1 === 'vertical') { this.el.classList.remove('widget-hslider'); this.el.classList.add('widget-vslider'); this.el.classList.remove('widget-inline-hbox'); this.el.classList.add('widget-inline-vbox'); } else { this.el.classList.remove('widget-vslider'); this.el.classList.add('widget-hslider'); this.el.classList.remove('widget-inline-vbox'); this.el.classList.add('widget-inline-hbox'); } var readout = this.model.get('readout'); if (readout) { this.readout.style.display = ''; this.displayed.then(function () { if (that_1.readout_overflow()) { that_1.readout.classList.add('overflow'); } else { that_1.readout.classList.remove('overflow'); } }); } else { this.readout.style.display = 'none'; } } return _super.prototype.update.call(this); }; /** * Returns true if the readout box content overflows. */ BaseIntSliderView.prototype.readout_overflow = function () { return this.readout.scrollWidth > this.readout.clientWidth; }; BaseIntSliderView.prototype.events = function () { return { // Dictionary of events and their handlers. 'slide': 'handleSliderChange', 'slidestop': 'handleSliderChanged', 'blur [contentEditable=true]': 'handleTextChange', 'keydown [contentEditable=true]': 'handleKeyDown' }; }; BaseIntSliderView.prototype.handleKeyDown = function (e) { if (e.keyCode === 13) { /* keyboard keycodes `enter` */ e.preventDefault(); this.handleTextChange(); } }; /** * Validate the value of the slider before sending it to the back-end * and applying it to the other views on the page. */ BaseIntSliderView.prototype._validate_slide_value = function (x) { return Math.floor(x); }; return BaseIntSliderView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var IntRangeSliderView = /** @class */ (function (_super) { __extends(IntRangeSliderView, _super); function IntRangeSliderView() { var _this = _super !== null && _super.apply(this, arguments) || this; // range numbers can be separated by a hyphen, colon, or an en-dash _this._range_regex = /^\s*([+-]?\d+)\s*[-:–]\s*([+-]?\d+)/; return _this; } IntRangeSliderView.prototype.update = function (options) { _super.prototype.update.call(this, options); this.$slider.slider('option', 'range', true); // values for the range case are validated python-side in // _Bounded{Int,Float}RangeWidget._validate var value = this.model.get('value'); this.$slider.slider('option', 'values', value.slice()); this.readout.textContent = this.valueToString(value); if (this.model.get('value') !== value) { this.model.set('value', value, { updated_view: this }); this.touch(); } }; /** * Write value to a string */ IntRangeSliderView.prototype.valueToString = function (value) { var format = this.model.readout_formatter; return value.map(function (v) { return format(v); }).join(' – '); }; /** * Parse value from a string */ IntRangeSliderView.prototype.stringToValue = function (text) { // ranges can be expressed either 'val-val' or 'val:val' (+spaces) var match = this._range_regex.exec(text); if (match) { return [this._parse_value(match[1]), this._parse_value(match[2])]; } else { return null; } }; /** * this handles the entry of text into the contentEditable label first, the * value is checked if it contains a parseable value then it is clamped * within the min-max range of the slider finally, the model is updated if * the value is to be changed * * if any of these conditions are not met, the text is reset */ IntRangeSliderView.prototype.handleTextChange = function () { var value = this.stringToValue(this.readout.textContent); var vmin = this.model.get('min'); var vmax = this.model.get('max'); // reject input where NaN or lower > upper if (value === null || isNaN(value[0]) || isNaN(value[1]) || (value[0] > value[1])) { this.readout.textContent = this.valueToString(this.model.get('value')); } else { // clamp to range value = [Math.max(Math.min(value[0], vmax), vmin), Math.max(Math.min(value[1], vmax), vmin)]; if ((value[0] !== this.model.get('value')[0]) || (value[1] !== this.model.get('value')[1])) { this.readout.textContent = this.valueToString(value); this.model.set('value', value, { updated_view: this }); this.touch(); } else { this.readout.textContent = this.valueToString(this.model.get('value')); } } }; /** * Called when the slider value is changing. */ IntRangeSliderView.prototype.handleSliderChange = function (e, ui) { var actual_value = ui.values.map(this._validate_slide_value); this.readout.textContent = this.valueToString(actual_value); // Only persist the value while sliding if the continuous_update // trait is set to true. if (this.model.get('continuous_update')) { this.handleSliderChanged(e, ui); } }; /** * Called when the slider value has changed. * * Calling model.set will trigger all of the other views of the * model to update. */ IntRangeSliderView.prototype.handleSliderChanged = function (e, ui) { var actual_value = ui.values.map(this._validate_slide_value); this.model.set('value', actual_value, { updated_view: this }); this.touch(); }; return IntRangeSliderView; }(BaseIntSliderView)); var IntSliderView = /** @class */ (function (_super) { __extends(IntSliderView, _super); function IntSliderView() { return _super !== null && _super.apply(this, arguments) || this; } IntSliderView.prototype.update = function (options) { _super.prototype.update.call(this, options); var min = this.model.get('min'); var max = this.model.get('max'); var value = this.model.get('value'); if (value > max) { value = max; } else if (value < min) { value = min; } this.$slider.slider('option', 'value', value); this.readout.textContent = this.valueToString(value); if (this.model.get('value') !== value) { this.model.set('value', value, { updated_view: this }); this.touch(); } }; /** * Write value to a string */ IntSliderView.prototype.valueToString = function (value) { var format = this.model.readout_formatter; return format(value); }; /** * Parse value from a string */ IntSliderView.prototype.stringToValue = function (text) { return this._parse_value(text); }; /** * this handles the entry of text into the contentEditable label first, the * value is checked if it contains a parseable value then it is clamped * within the min-max range of the slider finally, the model is updated if * the value is to be changed * * if any of these conditions are not met, the text is reset */ IntSliderView.prototype.handleTextChange = function () { var value = this.stringToValue(this.readout.textContent); var vmin = this.model.get('min'); var vmax = this.model.get('max'); if (isNaN(value)) { this.readout.textContent = this.valueToString(this.model.get('value')); } else { value = Math.max(Math.min(value, vmax), vmin); if (value !== this.model.get('value')) { this.readout.textContent = this.valueToString(value); this.model.set('value', value, { updated_view: this }); this.touch(); } else { this.readout.textContent = this.valueToString(this.model.get('value')); } } }; /** * Called when the slider value is changing. */ IntSliderView.prototype.handleSliderChange = function (e, ui) { var actual_value = this._validate_slide_value(ui.value); this.readout.textContent = this.valueToString(actual_value); // Only persist the value while sliding if the continuous_update // trait is set to true. if (this.model.get('continuous_update')) { this.handleSliderChanged(e, ui); } }; /** * Called when the slider value has changed. * * Calling model.set will trigger all of the other views of the * model to update. */ IntSliderView.prototype.handleSliderChanged = function (e, ui) { var actual_value = this._validate_slide_value(ui.value); this.model.set('value', actual_value, { updated_view: this }); this.touch(); }; return IntSliderView; }(BaseIntSliderView)); var IntTextModel = /** @class */ (function (_super) { __extends(IntTextModel, _super); function IntTextModel() { return _super !== null && _super.apply(this, arguments) || this; } IntTextModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_5__["extend"](_super.prototype.defaults.call(this), { _model_name: 'IntTextModel', _view_name: 'IntTextView', disabled: false, continuous_update: false, }); }; return IntTextModel; }(IntModel)); var BoundedIntTextModel = /** @class */ (function (_super) { __extends(BoundedIntTextModel, _super); function BoundedIntTextModel() { return _super !== null && _super.apply(this, arguments) || this; } BoundedIntTextModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_5__["extend"](_super.prototype.defaults.call(this), { _model_name: 'BoundedIntTextModel', _view_name: 'IntTextView', disabled: false, continuous_update: false, step: 1, }); }; return BoundedIntTextModel; }(BoundedIntModel)); var IntTextView = /** @class */ (function (_super) { __extends(IntTextView, _super); function IntTextView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._parse_value = parseInt; _this._default_step = '1'; return _this; } IntTextView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-text'); this.textbox = document.createElement('input'); this.textbox.type = 'number'; this.textbox.required = true; this.textbox.id = this.label.htmlFor = Object(_utils__WEBPACK_IMPORTED_MODULE_3__["uuid"])(); this.el.appendChild(this.textbox); this.update(); // Set defaults. }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ IntTextView.prototype.update = function (options) { if (options === undefined || options.updated_view !== this) { var value = this.model.get('value'); if (this._parse_value(this.textbox.value) !== value) { this.textbox.value = value.toString(); } if (this.model.get('min') !== undefined) { this.textbox.min = this.model.get('min'); } if (this.model.get('max') !== undefined) { this.textbox.max = this.model.get('max'); } if (this.model.get('step') !== undefined && this.model.get('step') !== null) { this.textbox.step = this.model.get('step'); } else { this.textbox.step = this._default_step; } this.textbox.disabled = this.model.get('disabled'); } return _super.prototype.update.call(this); }; IntTextView.prototype.events = function () { return { 'keydown input': 'handleKeyDown', 'keypress input': 'handleKeypress', 'keyup input': 'handleKeyUp', 'input input': 'handleChanging', 'change input': 'handleChanged' }; }; /** * Handle key down * * Stop propagation so the event isn't sent to the application. */ IntTextView.prototype.handleKeyDown = function (e) { e.stopPropagation(); }; /** * Handles key press */ IntTextView.prototype.handleKeypress = function (e) { if (/[e,. ]/.test(String.fromCharCode(e.keyCode))) { e.preventDefault(); } }; /** * Handle key up */ IntTextView.prototype.handleKeyUp = function (e) { if (e.altKey || e.ctrlKey) { return; } var target = e.target; /* remove invalid characters */ var value = target.value; value = value.replace(/[e,.\s]/g, ""); if (value.length >= 1) { var subvalue = value.substr(1); value = value[0] + subvalue.replace(/[+-]/g, ""); } if (target.value != value) { e.preventDefault(); target.value = value; } }; /** * Call the submit handler if continuous update is true and we are not * obviously incomplete. */ IntTextView.prototype.handleChanging = function (e) { var target = e.target; var trimmed = target.value.trim(); if (trimmed === '' || (['-', '-.', '.', '+.', '+'].indexOf(trimmed) >= 0)) { // incomplete number return; } if (this.model.get('continuous_update')) { this.handleChanged(e); } }; /** * Applies validated input. */ IntTextView.prototype.handleChanged = function (e) { var target = e.target; var numericalValue = this._parse_value(target.value); // If parse failed, reset value to value stored in model. if (isNaN(numericalValue)) { target.value = this.model.get('value'); } else { // Handle both the unbounded and bounded case by // checking to see if the max/min properties are defined var boundedValue = numericalValue; if (this.model.get('max') !== undefined) { boundedValue = Math.min(this.model.get('max'), boundedValue); } if (this.model.get('min') !== undefined) { boundedValue = Math.max(this.model.get('min'), boundedValue); } if (boundedValue !== numericalValue) { target.value = boundedValue; numericalValue = boundedValue; } // Apply the value if it has changed. if (numericalValue !== this.model.get('value')) { this.model.set('value', numericalValue, { updated_view: this }); this.touch(); } } }; return IntTextView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var ProgressStyleModel = /** @class */ (function (_super) { __extends(ProgressStyleModel, _super); function ProgressStyleModel() { return _super !== null && _super.apply(this, arguments) || this; } ProgressStyleModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'ProgressStyleModel' }); }; ProgressStyleModel.styleProperties = __assign(__assign({}, _widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionStyleModel"].styleProperties), { bar_color: { selector: '.progress-bar', attribute: 'background-color', default: null } }); return ProgressStyleModel; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionStyleModel"])); var IntProgressModel = /** @class */ (function (_super) { __extends(IntProgressModel, _super); function IntProgressModel() { return _super !== null && _super.apply(this, arguments) || this; } IntProgressModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_5__["extend"](_super.prototype.defaults.call(this), { _model_name: 'IntProgressModel', _view_name: 'ProgressView', orientation: 'horizontal', bar_style: '', style: null }); }; return IntProgressModel; }(BoundedIntModel)); var ProgressView = /** @class */ (function (_super) { __extends(ProgressView, _super); function ProgressView() { return _super !== null && _super.apply(this, arguments) || this; } ProgressView.prototype.initialize = function (parameters) { _super.prototype.initialize.call(this, parameters); this.listenTo(this.model, 'change:bar_style', this.update_bar_style); this.pWidget.addClass('jupyter-widgets'); }; ProgressView.prototype.render = function () { _super.prototype.render.call(this); var orientation = this.model.get('orientation'); var className = orientation === 'horizontal' ? 'widget-hprogress' : 'widget-vprogress'; this.el.classList.add(className); this.progress = document.createElement('div'); this.progress.classList.add('progress'); this.progress.style.position = 'relative'; this.el.appendChild(this.progress); this.bar = document.createElement('div'); this.bar.classList.add('progress-bar'); this.bar.style.position = 'absolute'; this.bar.style.bottom = '0px'; this.bar.style.left = '0px'; this.progress.appendChild(this.bar); // Set defaults. this.update(); this.set_bar_style(); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ ProgressView.prototype.update = function () { var value = this.model.get('value'); var max = this.model.get('max'); var min = this.model.get('min'); var orientation = this.model.get('orientation'); var percent = 100.0 * (value - min) / (max - min); if (orientation === 'horizontal') { this.el.classList.remove('widget-inline-vbox'); this.el.classList.remove('widget-vprogress'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-hprogress'); this.bar.style.width = percent + '%'; this.bar.style.height = '100%'; } else { this.el.classList.remove('widget-inline-hbox'); this.el.classList.remove('widget-hprogress'); this.el.classList.add('widget-inline-vbox'); this.el.classList.add('widget-vprogress'); this.bar.style.width = '100%'; this.bar.style.height = percent + '%'; } return _super.prototype.update.call(this); }; ProgressView.prototype.update_bar_style = function () { this.update_mapped_classes(ProgressView.class_map, 'bar_style', this.bar); }; ProgressView.prototype.set_bar_style = function () { this.set_mapped_classes(ProgressView.class_map, 'bar_style', this.bar); }; ProgressView.class_map = { success: ['progress-bar-success'], info: ['progress-bar-info'], warning: ['progress-bar-warning'], danger: ['progress-bar-danger'] }; return ProgressView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var PlayModel = /** @class */ (function (_super) { __extends(PlayModel, _super); function PlayModel() { return _super !== null && _super.apply(this, arguments) || this; } PlayModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_5__["extend"](_super.prototype.defaults.call(this), { _model_name: 'PlayModel', _view_name: 'PlayView', _playing: false, _repeat: false, show_repeat: true, interval: 100, step: 1, disabled: false, }); }; PlayModel.prototype.initialize = function (attributes, options) { _super.prototype.initialize.call(this, attributes, options); }; PlayModel.prototype.loop = function () { if (this.get('_playing')) { var next_value = this.get('value') + this.get('step'); if (next_value <= this.get('max')) { this.set('value', next_value); this.schedule_next(); } else { if (this.get('_repeat')) { this.set('value', this.get('min')); this.schedule_next(); } else { this.set('_playing', false); } } this.save_changes(); } }; PlayModel.prototype.schedule_next = function () { window.setTimeout(this.loop.bind(this), this.get('interval')); }; PlayModel.prototype.stop = function () { this.set('_playing', false); this.set('value', this.get('min')); this.save_changes(); }; PlayModel.prototype.pause = function () { this.set('_playing', false); this.save_changes(); }; PlayModel.prototype.play = function () { this.set('_playing', true); if (this.get('value') == this.get('max')) { // if the value is at the end, reset if first, and then schedule the next this.set('value', this.get('min')); this.schedule_next(); this.save_changes(); } else { // otherwise directly start with the next value // loop will call save_changes in this case this.loop(); } }; PlayModel.prototype.repeat = function () { this.set('_repeat', !this.get('_repeat')); this.save_changes(); }; return PlayModel; }(BoundedIntModel)); var PlayView = /** @class */ (function (_super) { __extends(PlayView, _super); function PlayView() { return _super !== null && _super.apply(this, arguments) || this; } PlayView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-play'); this.playButton = document.createElement('button'); this.pauseButton = document.createElement('button'); this.stopButton = document.createElement('button'); this.repeatButton = document.createElement('button'); this.playButton.className = 'jupyter-button'; this.pauseButton.className = 'jupyter-button'; this.stopButton.className = 'jupyter-button'; this.repeatButton.className = 'jupyter-button'; this.el.appendChild(this.playButton); // Toggle button with playing this.el.appendChild(this.pauseButton); // Disable if not playing this.el.appendChild(this.stopButton); // Disable if not playing this.el.appendChild(this.repeatButton); // Always enabled, but may be hidden var playIcon = document.createElement('i'); playIcon.className = 'fa fa-play'; this.playButton.appendChild(playIcon); var pauseIcon = document.createElement('i'); pauseIcon.className = 'fa fa-pause'; this.pauseButton.appendChild(pauseIcon); var stopIcon = document.createElement('i'); stopIcon.className = 'fa fa-stop'; this.stopButton.appendChild(stopIcon); var repeatIcon = document.createElement('i'); repeatIcon.className = 'fa fa-retweet'; this.repeatButton.appendChild(repeatIcon); this.playButton.onclick = this.model.play.bind(this.model); this.pauseButton.onclick = this.model.pause.bind(this.model); this.stopButton.onclick = this.model.stop.bind(this.model); this.repeatButton.onclick = this.model.repeat.bind(this.model); this.listenTo(this.model, 'change:_playing', this.update_playing); this.listenTo(this.model, 'change:_repeat', this.update_repeat); this.listenTo(this.model, 'change:show_repeat', this.update_repeat); this.update_playing(); this.update_repeat(); this.update(); }; PlayView.prototype.update = function () { var disabled = this.model.get('disabled'); this.playButton.disabled = disabled; this.pauseButton.disabled = disabled; this.stopButton.disabled = disabled; this.repeatButton.disabled = disabled; this.update_playing(); }; PlayView.prototype.update_playing = function () { var playing = this.model.get('_playing'); var disabled = this.model.get('disabled'); if (playing) { if (!disabled) { this.pauseButton.disabled = false; } this.playButton.classList.add('mod-active'); } else { if (!disabled) { this.pauseButton.disabled = true; } this.playButton.classList.remove('mod-active'); } }; PlayView.prototype.update_repeat = function () { var repeat = this.model.get('_repeat'); this.repeatButton.style.display = this.model.get('show_repeat') ? this.playButton.style.display : 'none'; if (repeat) { this.repeatButton.classList.add('mod-active'); } else { this.repeatButton.classList.remove('mod-active'); } }; return PlayView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_2__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_link.js": /*!*******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_link.js ***! \*******************************************************************/ /*! exports provided: DirectionalLinkModel, LinkModel */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DirectionalLinkModel", function() { return DirectionalLinkModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LinkModel", function() { return LinkModel; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var DirectionalLinkModel = /** @class */ (function (_super) { __extends(DirectionalLinkModel, _super); function DirectionalLinkModel() { return _super !== null && _super.apply(this, arguments) || this; } DirectionalLinkModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_2__["extend"](_super.prototype.defaults.call(this), { target: undefined, source: undefined, _model_name: 'DirectionalLinkModel' }); }; DirectionalLinkModel.prototype.initialize = function (attributes, options) { _super.prototype.initialize.call(this, attributes, options); this.on('change', this.updateBindings, this); this.updateBindings(); }; DirectionalLinkModel.prototype.updateValue = function (sourceModel, sourceAttr, targetModel, targetAttr) { if (this._updating) { return; } this._updating = true; try { if (targetModel) { targetModel.set(targetAttr, sourceModel.get(sourceAttr)); targetModel.save_changes(); } } finally { this._updating = false; } }; DirectionalLinkModel.prototype.updateBindings = function () { var _a, _b; var _this = this; this.cleanup(); _a = this.get('source') || [null, null], this.sourceModel = _a[0], this.sourceAttr = _a[1]; _b = this.get('target') || [null, null], this.targetModel = _b[0], this.targetAttr = _b[1]; if (this.sourceModel) { this.listenTo(this.sourceModel, 'change:' + this.sourceAttr, function () { _this.updateValue(_this.sourceModel, _this.sourceAttr, _this.targetModel, _this.targetAttr); }); this.updateValue(this.sourceModel, this.sourceAttr, this.targetModel, this.targetAttr); this.listenToOnce(this.sourceModel, 'destroy', this.cleanup); } if (this.targetModel) { this.listenToOnce(this.targetModel, 'destroy', this.cleanup); } }; DirectionalLinkModel.prototype.cleanup = function () { // Stop listening to 'change' and 'destroy' events of the source and target if (this.sourceModel) { this.stopListening(this.sourceModel, 'change:' + this.sourceAttr, null); this.stopListening(this.sourceModel, 'destroy', null); } if (this.targetModel) { this.stopListening(this.targetModel, 'destroy', null); } }; DirectionalLinkModel.serializers = __assign(__assign({}, _widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreWidgetModel"].serializers), { target: { deserialize: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["unpack_models"] }, source: { deserialize: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["unpack_models"] } }); return DirectionalLinkModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreWidgetModel"])); var LinkModel = /** @class */ (function (_super) { __extends(LinkModel, _super); function LinkModel() { return _super !== null && _super.apply(this, arguments) || this; } LinkModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_2__["extend"](_super.prototype.defaults.call(this), { _model_name: 'LinkModel' }); }; LinkModel.prototype.updateBindings = function () { var _this = this; _super.prototype.updateBindings.call(this); if (this.targetModel) { this.listenTo(this.targetModel, 'change:' + this.targetAttr, function () { _this.updateValue(_this.targetModel, _this.targetAttr, _this.sourceModel, _this.sourceAttr); }); } }; LinkModel.prototype.cleanup = function () { _super.prototype.cleanup.call(this); if (this.targetModel) { this.stopListening(this.targetModel, 'change:' + this.targetAttr, null); } }; return LinkModel; }(DirectionalLinkModel)); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_selection.js": /*!************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_selection.js ***! \************************************************************************/ /*! exports provided: SelectionModel, DropdownModel, DropdownView, SelectModel, SelectView, RadioButtonsModel, RadioButtonsView, ToggleButtonsStyleModel, ToggleButtonsModel, ToggleButtonsView, SelectionSliderModel, SelectionSliderView, MultipleSelectionModel, SelectMultipleModel, SelectMultipleView, SelectionRangeSliderModel, SelectionRangeSliderView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionModel", function() { return SelectionModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DropdownModel", function() { return DropdownModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DropdownView", function() { return DropdownView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectModel", function() { return SelectModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectView", function() { return SelectView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RadioButtonsModel", function() { return RadioButtonsModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RadioButtonsView", function() { return RadioButtonsView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonsStyleModel", function() { return ToggleButtonsStyleModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonsModel", function() { return ToggleButtonsModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ToggleButtonsView", function() { return ToggleButtonsView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionSliderModel", function() { return SelectionSliderModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionSliderView", function() { return SelectionSliderView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultipleSelectionModel", function() { return MultipleSelectionModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectMultipleModel", function() { return SelectMultipleModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectMultipleView", function() { return SelectMultipleView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRangeSliderModel", function() { return SelectionRangeSliderModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRangeSliderView", function() { return SelectionRangeSliderView; }); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _widget_description__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_description */ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_4__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var SelectionModel = /** @class */ (function (_super) { __extends(SelectionModel, _super); function SelectionModel() { return _super !== null && _super.apply(this, arguments) || this; } SelectionModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'SelectionModel', index: '', _options_labels: [], disabled: false }); }; return SelectionModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDescriptionModel"])); var DropdownModel = /** @class */ (function (_super) { __extends(DropdownModel, _super); function DropdownModel() { return _super !== null && _super.apply(this, arguments) || this; } DropdownModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'DropdownModel', _view_name: 'DropdownView', button_style: '' }); }; return DropdownModel; }(SelectionModel)); // TODO: Make a phosphor dropdown control, wrapped in DropdownView. Also, fix // bugs in keyboard handling. See // https://github.com/jupyter-widgets/ipywidgets/issues/1055 and // https://github.com/jupyter-widgets/ipywidgets/issues/1049 // For now, we subclass SelectView to provide DropdownView // For the old code, see commit f68bfbc566f3a78a8f3350b438db8ed523ce3642 var DropdownView = /** @class */ (function (_super) { __extends(DropdownView, _super); function DropdownView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor. */ DropdownView.prototype.initialize = function (parameters) { var _this = this; _super.prototype.initialize.call(this, parameters); this.listenTo(this.model, 'change:_options_labels', function () { return _this._updateOptions(); }); }; /** * Called when view is rendered. */ DropdownView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-dropdown'); this.listbox = document.createElement('select'); this.listbox.id = this.label.htmlFor = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["uuid"])(); this.el.appendChild(this.listbox); this._updateOptions(); this.update(); }; /** * Update the contents of this view */ DropdownView.prototype.update = function () { // Disable listbox if needed this.listbox.disabled = this.model.get('disabled'); // Select the correct element var index = this.model.get('index'); this.listbox.selectedIndex = index === null ? -1 : index; return _super.prototype.update.call(this); }; DropdownView.prototype._updateOptions = function () { this.listbox.textContent = ''; var items = this.model.get('_options_labels'); for (var i = 0; i < items.length; i++) { var item = items[i]; var option = document.createElement('option'); option.textContent = item.replace(/ /g, '\xa0'); // space ->   option.setAttribute('data-value', encodeURIComponent(item)); option.value = item; this.listbox.appendChild(option); } }; DropdownView.prototype.events = function () { return { 'change select': '_handle_change' }; }; /** * Handle when a new value is selected. */ DropdownView.prototype._handle_change = function () { this.model.set('index', this.listbox.selectedIndex === -1 ? null : this.listbox.selectedIndex); this.touch(); }; return DropdownView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var SelectModel = /** @class */ (function (_super) { __extends(SelectModel, _super); function SelectModel() { return _super !== null && _super.apply(this, arguments) || this; } SelectModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'SelectModel', _view_name: 'SelectView', rows: 5 }); }; return SelectModel; }(SelectionModel)); var SelectView = /** @class */ (function (_super) { __extends(SelectView, _super); function SelectView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor. */ SelectView.prototype.initialize = function (parameters) { var _this = this; _super.prototype.initialize.call(this, parameters); this.listenTo(this.model, 'change:_options_labels', function () { return _this._updateOptions(); }); this.listenTo(this.model, 'change:index', function (model, value, options) { return _this.updateSelection(options); }); // Create listbox here so that subclasses can modify it before it is populated in render() this.listbox = document.createElement('select'); }; /** * Called when view is rendered. */ SelectView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-select'); this.listbox.id = this.label.htmlFor = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["uuid"])(); this.el.appendChild(this.listbox); this._updateOptions(); this.update(); this.updateSelection(); }; /** * Update the contents of this view */ SelectView.prototype.update = function () { _super.prototype.update.call(this); this.listbox.disabled = this.model.get('disabled'); var rows = this.model.get('rows'); if (rows === null) { rows = ''; } this.listbox.setAttribute('size', rows); }; SelectView.prototype.updateSelection = function (options) { if (options === void 0) { options = {}; } if (options.updated_view === this) { return; } var index = this.model.get('index'); this.listbox.selectedIndex = index === null ? -1 : index; }; SelectView.prototype._updateOptions = function () { this.listbox.textContent = ''; var items = this.model.get('_options_labels'); for (var i = 0; i < items.length; i++) { var item = items[i]; var option = document.createElement('option'); option.textContent = item.replace(/ /g, '\xa0'); // space ->   option.setAttribute('data-value', encodeURIComponent(item)); option.value = item; this.listbox.appendChild(option); } }; SelectView.prototype.events = function () { return { 'change select': '_handle_change' }; }; /** * Handle when a new value is selected. */ SelectView.prototype._handle_change = function () { this.model.set('index', this.listbox.selectedIndex, { updated_view: this }); this.touch(); }; return SelectView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var RadioButtonsModel = /** @class */ (function (_super) { __extends(RadioButtonsModel, _super); function RadioButtonsModel() { return _super !== null && _super.apply(this, arguments) || this; } RadioButtonsModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'RadioButtonsModel', _view_name: 'RadioButtonsView', tooltips: [], icons: [], button_style: '' }); }; return RadioButtonsModel; }(SelectionModel)); var RadioButtonsView = /** @class */ (function (_super) { __extends(RadioButtonsView, _super); function RadioButtonsView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ RadioButtonsView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-radio'); this.container = document.createElement('div'); this.el.appendChild(this.container); this.container.classList.add('widget-radio-box'); this.update(); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ RadioButtonsView.prototype.update = function (options) { var view = this; var items = this.model.get('_options_labels'); var radios = underscore__WEBPACK_IMPORTED_MODULE_3__["pluck"](this.container.querySelectorAll('input[type="radio"]'), 'value'); var stale = items.length != radios.length; if (!stale) { for (var i = 0, len = items.length; i < len; ++i) { if (radios[i] !== items[i]) { stale = true; break; } } } if (stale && (options === undefined || options.updated_view !== this)) { // Add items to the DOM. this.container.textContent = ''; items.forEach(function (item, index) { var label = document.createElement('label'); label.textContent = item; view.container.appendChild(label); var radio = document.createElement('input'); radio.setAttribute('type', 'radio'); radio.value = index.toString(); radio.setAttribute('data-value', encodeURIComponent(item)); label.appendChild(radio); }); } items.forEach(function (item, index) { var item_query = 'input[data-value="' + encodeURIComponent(item) + '"]'; var radio = view.container.querySelectorAll(item_query); if (radio.length > 0) { var radio_el = radio[0]; radio_el.checked = view.model.get('index') === index; radio_el.disabled = view.model.get('disabled'); } }); // Schedule adjustPadding asynchronously to // allow dom elements to be created properly setTimeout(this.adjustPadding, 0, this); return _super.prototype.update.call(this, options); }; /** * Adjust Padding to Multiple of Line Height * * Adjust margins so that the overall height * is a multiple of a single line height. * * This widget needs it because radio options * are spaced tighter than individual widgets * yet we would like the full widget line up properly * when displayed side-by-side with other widgets. */ RadioButtonsView.prototype.adjustPadding = function (e) { // Vertical margins on a widget var elStyles = window.getComputedStyle(e.el); var margins = parseInt(elStyles.marginTop, 10) + parseInt(elStyles.marginBottom, 10); // Total spaces taken by a single-line widget var lineHeight = e.label.offsetHeight + margins; // Current adjustment value on this widget var cStyles = window.getComputedStyle(e.container); var containerMargin = parseInt(cStyles.marginBottom); // How far we are off from a multiple of single windget lines var diff = (e.el.offsetHeight + margins - containerMargin) % lineHeight; // Apply the new adjustment var extraMargin = diff == 0 ? 0 : (lineHeight - diff); e.container.style.marginBottom = extraMargin + 'px'; }; RadioButtonsView.prototype.events = function () { return { 'click input[type="radio"]': '_handle_click' }; }; /** * Handle when a value is clicked. * * Calling model.set will trigger all of the other views of the * model to update. */ RadioButtonsView.prototype._handle_click = function (event) { var target = event.target; this.model.set('index', parseInt(target.value), { updated_view: this }); this.touch(); }; return RadioButtonsView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var ToggleButtonsStyleModel = /** @class */ (function (_super) { __extends(ToggleButtonsStyleModel, _super); function ToggleButtonsStyleModel() { return _super !== null && _super.apply(this, arguments) || this; } ToggleButtonsStyleModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _model_name: 'ToggleButtonsStyleModel', }); }; ToggleButtonsStyleModel.styleProperties = __assign(__assign({}, _widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionStyleModel"].styleProperties), { button_width: { selector: '.widget-toggle-button', attribute: 'width', default: null }, font_weight: { selector: '.widget-toggle-button', attribute: 'font-weight', default: '' } }); return ToggleButtonsStyleModel; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionStyleModel"])); var ToggleButtonsModel = /** @class */ (function (_super) { __extends(ToggleButtonsModel, _super); function ToggleButtonsModel() { return _super !== null && _super.apply(this, arguments) || this; } ToggleButtonsModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'ToggleButtonsModel', _view_name: 'ToggleButtonsView' }); }; return ToggleButtonsModel; }(SelectionModel)); var ToggleButtonsView = /** @class */ (function (_super) { __extends(ToggleButtonsView, _super); function ToggleButtonsView() { return _super !== null && _super.apply(this, arguments) || this; } ToggleButtonsView.prototype.initialize = function (options) { this._css_state = {}; _super.prototype.initialize.call(this, options); this.listenTo(this.model, 'change:button_style', this.update_button_style); }; /** * Called when view is rendered. */ ToggleButtonsView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-toggle-buttons'); this.buttongroup = document.createElement('div'); this.el.appendChild(this.buttongroup); this.update(); this.set_button_style(); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ ToggleButtonsView.prototype.update = function (options) { var view = this; var items = this.model.get('_options_labels'); var icons = this.model.get('icons') || []; var previous_icons = this.model.previous('icons') || []; var previous_bstyle = ToggleButtonsView.classMap[this.model.previous('button_style')] || ''; var tooltips = view.model.get('tooltips') || []; var disabled = this.model.get('disabled'); var buttons = this.buttongroup.querySelectorAll('button'); var values = underscore__WEBPACK_IMPORTED_MODULE_3__["pluck"](buttons, 'value'); var stale = false; for (var i = 0, len = items.length; i < len; ++i) { if (values[i] !== items[i] || icons[i] !== previous_icons[i]) { stale = true; break; } } if (stale && (options === undefined || options.updated_view !== this)) { // Add items to the DOM. this.buttongroup.textContent = ''; items.forEach(function (item, index) { var item_html; var empty = item.trim().length === 0 && (!icons[index] || icons[index].trim().length === 0); if (empty) { item_html = ' '; } else { item_html = _utils__WEBPACK_IMPORTED_MODULE_2__["escape_html"](item); } var icon = document.createElement('i'); var button = document.createElement('button'); if (icons[index]) { icon.className = 'fa fa-' + icons[index]; } button.setAttribute('type', 'button'); button.className = 'widget-toggle-button jupyter-button'; if (previous_bstyle) { button.classList.add(previous_bstyle); } button.innerHTML = item_html; button.setAttribute('data-value', encodeURIComponent(item)); button.setAttribute('value', index.toString()); button.appendChild(icon); button.disabled = disabled; if (tooltips[index]) { button.setAttribute('title', tooltips[index]); } view.update_style_traits(button); view.buttongroup.appendChild(button); }); } // Select active button. items.forEach(function (item, index) { var item_query = '[data-value="' + encodeURIComponent(item) + '"]'; var button = view.buttongroup.querySelector(item_query); if (view.model.get('index') === index) { button.classList.add('mod-active'); } else { button.classList.remove('mod-active'); } }); this.stylePromise.then(function (style) { if (style) { style.style(); } }); return _super.prototype.update.call(this, options); }; ToggleButtonsView.prototype.update_style_traits = function (button) { for (var name_1 in this._css_state) { if (this._css_state.hasOwnProperty(name_1)) { if (name_1 === 'margin') { this.buttongroup.style[name_1] = this._css_state[name_1]; } else if (name_1 !== 'width') { if (button) { button.style[name_1] = this._css_state[name_1]; } else { var buttons = this.buttongroup .querySelectorAll('button'); if (buttons.length) { (buttons[0]).style[name_1] = this._css_state[name_1]; } } } } } }; ToggleButtonsView.prototype.update_button_style = function () { var buttons = this.buttongroup.querySelectorAll('button'); for (var i = 0; i < buttons.length; i++) { this.update_mapped_classes(ToggleButtonsView.classMap, 'button_style', buttons[i]); } }; ToggleButtonsView.prototype.set_button_style = function () { var buttons = this.buttongroup.querySelectorAll('button'); for (var i = 0; i < buttons.length; i++) { this.set_mapped_classes(ToggleButtonsView.classMap, 'button_style', buttons[i]); } }; ToggleButtonsView.prototype.events = function () { return { 'click button': '_handle_click' }; }; /** * Handle when a value is clicked. * * Calling model.set will trigger all of the other views of the * model to update. */ ToggleButtonsView.prototype._handle_click = function (event) { var target = event.target; this.model.set('index', parseInt(target.value, 10), { updated_view: this }); this.touch(); // We also send a clicked event, since the value is only set if it changed. // See https://github.com/jupyter-widgets/ipywidgets/issues/763 this.send({ event: 'click' }); }; return ToggleButtonsView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); (function (ToggleButtonsView) { ToggleButtonsView.classMap = { primary: ['mod-primary'], success: ['mod-success'], info: ['mod-info'], warning: ['mod-warning'], danger: ['mod-danger'] }; })(ToggleButtonsView || (ToggleButtonsView = {})); var SelectionSliderModel = /** @class */ (function (_super) { __extends(SelectionSliderModel, _super); function SelectionSliderModel() { return _super !== null && _super.apply(this, arguments) || this; } SelectionSliderModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'SelectionSliderModel', _view_name: 'SelectionSliderView', orientation: 'horizontal', readout: true, continuous_update: true }); }; return SelectionSliderModel; }(SelectionModel)); var SelectionSliderView = /** @class */ (function (_super) { __extends(SelectionSliderView, _super); function SelectionSliderView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ SelectionSliderView.prototype.render = function () { var _this = this; _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-hslider'); this.el.classList.add('widget-slider'); (this.$slider = jquery__WEBPACK_IMPORTED_MODULE_4___default()('
')) .slider({ slide: this.handleSliderChange.bind(this), stop: this.handleSliderChanged.bind(this) }) .addClass('slider'); // Put the slider in a container this.slider_container = document.createElement('div'); this.slider_container.classList.add('slider-container'); this.slider_container.appendChild(this.$slider[0]); this.el.appendChild(this.slider_container); this.readout = document.createElement('div'); this.el.appendChild(this.readout); this.readout.classList.add('widget-readout'); this.readout.style.display = 'none'; this.listenTo(this.model, 'change:slider_color', function (sender, value) { _this.$slider.find('a').css('background', value); }); this.$slider.find('a').css('background', this.model.get('slider_color')); // Set defaults. this.update(); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ SelectionSliderView.prototype.update = function (options) { if (options === undefined || options.updated_view !== this) { var labels = this.model.get('_options_labels'); var max = labels.length - 1; var min = 0; this.$slider.slider('option', 'step', 1); this.$slider.slider('option', 'max', max); this.$slider.slider('option', 'min', min); // WORKAROUND FOR JQUERY SLIDER BUG. // The horizontal position of the slider handle // depends on the value of the slider at the time // of orientation change. Before applying the new // workaround, we set the value to the minimum to // make sure that the horizontal placement of the // handle in the vertical slider is always // consistent. var orientation_1 = this.model.get('orientation'); this.$slider.slider('option', 'value', min); this.$slider.slider('option', 'orientation', orientation_1); var disabled = this.model.get('disabled'); this.$slider.slider('option', 'disabled', disabled); if (disabled) { this.readout.contentEditable = 'false'; } else { this.readout.contentEditable = 'true'; } // Use the right CSS classes for vertical & horizontal sliders if (orientation_1 === 'vertical') { this.el.classList.remove('widget-hslider'); this.el.classList.remove('widget-inline-hbox'); this.el.classList.add('widget-vslider'); this.el.classList.add('widget-inline-vbox'); } else { this.el.classList.remove('widget-vslider'); this.el.classList.remove('widget-inline-vbox'); this.el.classList.add('widget-hslider'); this.el.classList.add('widget-inline-hbox'); } var readout = this.model.get('readout'); if (readout) { // this.$readout.show(); this.readout.style.display = ''; } else { // this.$readout.hide(); this.readout.style.display = 'none'; } this.updateSelection(); } return _super.prototype.update.call(this, options); }; SelectionSliderView.prototype.events = function () { return { 'slide': 'handleSliderChange', 'slidestop': 'handleSliderChanged' }; }; SelectionSliderView.prototype.updateSelection = function () { var index = this.model.get('index'); this.$slider.slider('option', 'value', index); this.updateReadout(index); }; SelectionSliderView.prototype.updateReadout = function (index) { var value = this.model.get('_options_labels')[index]; this.readout.textContent = value; }; /** * Called when the slider value is changing. */ SelectionSliderView.prototype.handleSliderChange = function (e, ui) { this.updateReadout(ui.value); // Only persist the value while sliding if the continuous_update // trait is set to true. if (this.model.get('continuous_update')) { this.handleSliderChanged(e, ui); } }; /** * Called when the slider value has changed. * * Calling model.set will trigger all of the other views of the * model to update. */ SelectionSliderView.prototype.handleSliderChanged = function (e, ui) { this.updateReadout(ui.value); this.model.set('index', ui.value, { updated_view: this }); this.touch(); }; return SelectionSliderView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var MultipleSelectionModel = /** @class */ (function (_super) { __extends(MultipleSelectionModel, _super); function MultipleSelectionModel() { return _super !== null && _super.apply(this, arguments) || this; } MultipleSelectionModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'MultipleSelectionModel' }); }; return MultipleSelectionModel; }(SelectionModel)); var SelectMultipleModel = /** @class */ (function (_super) { __extends(SelectMultipleModel, _super); function SelectMultipleModel() { return _super !== null && _super.apply(this, arguments) || this; } SelectMultipleModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'SelectMultipleModel', _view_name: 'SelectMultipleView', rows: null }); }; return SelectMultipleModel; }(MultipleSelectionModel)); var SelectMultipleView = /** @class */ (function (_super) { __extends(SelectMultipleView, _super); function SelectMultipleView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Public constructor. */ SelectMultipleView.prototype.initialize = function (parameters) { _super.prototype.initialize.call(this, parameters); this.listbox.multiple = true; }; /** * Called when view is rendered. */ SelectMultipleView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('widget-select-multiple'); }; SelectMultipleView.prototype.updateSelection = function (options) { if (options === void 0) { options = {}; } if (options.updated_view === this) { return; } var selected = this.model.get('index') || []; var listboxOptions = this.listbox.options; // Clear the selection this.listbox.selectedIndex = -1; // Select the appropriate options selected.forEach(function (i) { listboxOptions[i].selected = true; }); }; /** * Handle when a new value is selected. */ SelectMultipleView.prototype._handle_change = function () { var index = Array.prototype.map .call(this.listbox.selectedOptions || [], function (option) { return option.index; }); this.model.set('index', index, { updated_view: this }); this.touch(); }; return SelectMultipleView; }(SelectView)); var SelectionRangeSliderModel = /** @class */ (function (_super) { __extends(SelectionRangeSliderModel, _super); function SelectionRangeSliderModel() { return _super !== null && _super.apply(this, arguments) || this; } SelectionRangeSliderModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'SelectionSliderModel', _view_name: 'SelectionSliderView', orientation: 'horizontal', readout: true, continuous_update: true }); }; return SelectionRangeSliderModel; }(MultipleSelectionModel)); var SelectionRangeSliderView = /** @class */ (function (_super) { __extends(SelectionRangeSliderView, _super); function SelectionRangeSliderView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ SelectionRangeSliderView.prototype.render = function () { _super.prototype.render.call(this); this.$slider.slider('option', 'range', true); }; SelectionRangeSliderView.prototype.updateSelection = function () { var index = this.model.get('index'); this.$slider.slider('option', 'values', index.slice()); this.updateReadout(index); }; SelectionRangeSliderView.prototype.updateReadout = function (index) { var labels = this.model.get('_options_labels'); var minValue = labels[index[0]]; var maxValue = labels[index[1]]; this.readout.textContent = minValue + "-" + maxValue; }; /** * Called when the slider value is changing. */ SelectionRangeSliderView.prototype.handleSliderChange = function (e, ui) { this.updateReadout(ui.values); // Only persist the value while sliding if the continuous_update // trait is set to true. if (this.model.get('continuous_update')) { this.handleSliderChanged(e, ui); } }; /** * Called when the slider value has changed. * * Calling model.set will trigger all of the other views of the * model to update. */ SelectionRangeSliderView.prototype.handleSliderChanged = function (e, ui) { // The jqueryui documentation indicates ui.values doesn't exist on the slidestop event, // but it appears that it actually does: https://github.com/jquery/jquery-ui/blob/ae31f2b3b478975f70526bdf3299464b9afa8bb1/ui/widgets/slider.js#L313 this.updateReadout(ui.values); this.model.set('index', ui.values.slice(), { updated_view: this }); this.touch(); }; return SelectionRangeSliderView; }(SelectionSliderView)); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_selectioncontainer.js": /*!*********************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_selectioncontainer.js ***! \*********************************************************************************/ /*! exports provided: SelectionContainerModel, AccordionModel, JupyterPhosphorAccordionWidget, AccordionView, TabModel, JupyterPhosphorTabPanelWidget, TabView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionContainerModel", function() { return SelectionContainerModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AccordionModel", function() { return AccordionModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorAccordionWidget", function() { return JupyterPhosphorAccordionWidget; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AccordionView", function() { return AccordionView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TabModel", function() { return TabModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorTabPanelWidget", function() { return JupyterPhosphorTabPanelWidget; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TabView", function() { return TabView; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _widget_box__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_box */ "./node_modules/@jupyter-widgets/controls/lib/widget_box.js"); /* harmony import */ var _phosphor_tabpanel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./phosphor/tabpanel */ "./node_modules/@jupyter-widgets/controls/lib/phosphor/tabpanel.js"); /* harmony import */ var _phosphor_accordion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./phosphor/accordion */ "./node_modules/@jupyter-widgets/controls/lib/phosphor/accordion.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/messaging */ "./node_modules/@lumino/messaging/dist/index.es6.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_9__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SelectionContainerModel = /** @class */ (function (_super) { __extends(SelectionContainerModel, _super); function SelectionContainerModel() { return _super !== null && _super.apply(this, arguments) || this; } SelectionContainerModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_7__["extend"](_super.prototype.defaults.call(this), { _model_name: 'SelectionContainerModel', selected_index: 0, _titles: {} }); }; return SelectionContainerModel; }(_widget_box__WEBPACK_IMPORTED_MODULE_1__["BoxModel"])); var AccordionModel = /** @class */ (function (_super) { __extends(AccordionModel, _super); function AccordionModel() { return _super !== null && _super.apply(this, arguments) || this; } AccordionModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_7__["extend"](_super.prototype.defaults.call(this), { _model_name: 'AccordionModel', _view_name: 'AccordionView' }); }; return AccordionModel; }(SelectionContainerModel)); // We implement our own tab widget since Phoshpor's TabPanel uses an absolute // positioning BoxLayout, but we want a more an html/css-based Panel layout. var JupyterPhosphorAccordionWidget = /** @class */ (function (_super) { __extends(JupyterPhosphorAccordionWidget, _super); function JupyterPhosphorAccordionWidget(options) { var _this = this; var view = options.view; delete options.view; _this = _super.call(this, options) || this; _this._view = view; return _this; } /** * Process the phosphor message. * * Any custom phosphor widget used inside a Jupyter widget should override * the processMessage function like this. */ JupyterPhosphorAccordionWidget.prototype.processMessage = function (msg) { _super.prototype.processMessage.call(this, msg); this._view.processPhosphorMessage(msg); }; /** * Dispose the widget. * * This causes the view to be destroyed as well with 'remove' */ JupyterPhosphorAccordionWidget.prototype.dispose = function () { if (this.isDisposed) { return; } _super.prototype.dispose.call(this); if (this._view) { this._view.remove(); } this._view = null; }; return JupyterPhosphorAccordionWidget; }(_phosphor_accordion__WEBPACK_IMPORTED_MODULE_3__["Accordion"])); var AccordionView = /** @class */ (function (_super) { __extends(AccordionView, _super); function AccordionView() { return _super !== null && _super.apply(this, arguments) || this; } AccordionView.prototype._createElement = function (tagName) { this.pWidget = new JupyterPhosphorAccordionWidget({ view: this }); return this.pWidget.node; }; AccordionView.prototype._setElement = function (el) { if (this.el || el !== this.pWidget.node) { // Accordions don't allow setting the element beyond the initial creation. throw new Error('Cannot reset the DOM element.'); } this.el = this.pWidget.node; this.$el = jquery__WEBPACK_IMPORTED_MODULE_9___default()(this.pWidget.node); }; AccordionView.prototype.initialize = function (parameters) { var _this = this; _super.prototype.initialize.call(this, parameters); this.children_views = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["ViewList"](this.add_child_view, this.remove_child_view, this); this.listenTo(this.model, 'change:children', function () { return _this.updateChildren(); }); this.listenTo(this.model, 'change:selected_index', function () { return _this.update_selected_index(); }); this.listenTo(this.model, 'change:_titles', function () { return _this.update_titles(); }); }; /** * Called when view is rendered. */ AccordionView.prototype.render = function () { var _this = this; _super.prototype.render.call(this); var accordion = this.pWidget; accordion.addClass('jupyter-widgets'); accordion.addClass('widget-accordion'); accordion.addClass('widget-container'); accordion.selection.selectionChanged.connect(function (sender) { if (!_this.updatingChildren) { _this.model.set('selected_index', accordion.selection.index); _this.touch(); } }); this.children_views.update(this.model.get('children')); this.update_titles(); this.update_selected_index(); }; /** * Update children */ AccordionView.prototype.updateChildren = function () { // While we are updating, the index may not be valid, so deselect the // tabs before updating so we don't get spurious changes in the index, // which would then set off another sync cycle. this.updatingChildren = true; this.pWidget.selection.index = null; this.children_views.update(this.model.get('children')); this.update_selected_index(); this.updatingChildren = false; }; /** * Set header titles */ AccordionView.prototype.update_titles = function () { var collapsed = this.pWidget.collapseWidgets; var titles = this.model.get('_titles'); for (var i = 0; i < collapsed.length; i++) { if (titles[i] !== void 0) { collapsed[i].widget.title.label = titles[i]; } } }; /** * Make the rendering and selected index consistent. */ AccordionView.prototype.update_selected_index = function () { this.pWidget.selection.index = this.model.get('selected_index'); }; /** * Called when a child is removed from children list. */ AccordionView.prototype.remove_child_view = function (view) { this.pWidget.removeWidget(view.pWidget); view.remove(); }; /** * Called when a child is added to children list. */ AccordionView.prototype.add_child_view = function (model, index) { // Placeholder widget to keep our position in the tab panel while we create the view. var accordion = this.pWidget; var placeholder = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"](); placeholder.title.label = this.model.get('_titles')[index] || ''; accordion.addWidget(placeholder); return this.create_child_view(model).then(function (view) { var widget = view.pWidget; widget.title.label = placeholder.title.label; var collapse = accordion.collapseWidgets[accordion.indexOf(placeholder)]; collapse.widget = widget; placeholder.dispose(); return view; }).catch(_utils__WEBPACK_IMPORTED_MODULE_8__["reject"]('Could not add child view to box', true)); }; AccordionView.prototype.remove = function () { this.children_views = null; _super.prototype.remove.call(this); }; return AccordionView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); var TabModel = /** @class */ (function (_super) { __extends(TabModel, _super); function TabModel() { return _super !== null && _super.apply(this, arguments) || this; } TabModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_7__["extend"](_super.prototype.defaults.call(this), { _model_name: 'TabModel', _view_name: 'TabView' }); }; return TabModel; }(SelectionContainerModel)); // We implement our own tab widget since Phoshpor's TabPanel uses an absolute // positioning BoxLayout, but we want a more an html/css-based Panel layout. var JupyterPhosphorTabPanelWidget = /** @class */ (function (_super) { __extends(JupyterPhosphorTabPanelWidget, _super); function JupyterPhosphorTabPanelWidget(options) { var _this = this; var view = options.view; delete options.view; _this = _super.call(this, options) || this; _this._view = view; // We want the view's messages to be the messages the tabContents panel // gets. _lumino_messaging__WEBPACK_IMPORTED_MODULE_6__["MessageLoop"].installMessageHook(_this.tabContents, function (handler, msg) { // There may be times when we want the view's handler to be called // *after* the message has been processed by the widget, in which // case we'll need to revisit using a message hook. _this._view.processPhosphorMessage(msg); return true; }); return _this; } /** * Dispose the widget. * * This causes the view to be destroyed as well with 'remove' */ JupyterPhosphorTabPanelWidget.prototype.dispose = function () { if (this.isDisposed) { return; } _super.prototype.dispose.call(this); if (this._view) { this._view.remove(); } this._view = null; }; return JupyterPhosphorTabPanelWidget; }(_phosphor_tabpanel__WEBPACK_IMPORTED_MODULE_2__["TabPanel"])); var TabView = /** @class */ (function (_super) { __extends(TabView, _super); function TabView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.updatingTabs = false; return _this; } TabView.prototype._createElement = function (tagName) { this.pWidget = new JupyterPhosphorTabPanelWidget({ view: this, }); return this.pWidget.node; }; TabView.prototype._setElement = function (el) { if (this.el || el !== this.pWidget.node) { // TabViews don't allow setting the element beyond the initial creation. throw new Error('Cannot reset the DOM element.'); } this.el = this.pWidget.node; this.$el = jquery__WEBPACK_IMPORTED_MODULE_9___default()(this.pWidget.node); }; /** * Public constructor. */ TabView.prototype.initialize = function (parameters) { var _this = this; _super.prototype.initialize.call(this, parameters); this.childrenViews = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["ViewList"](this.addChildView, function (view) { view.remove(); }, this); this.listenTo(this.model, 'change:children', function () { return _this.updateTabs(); }); this.listenTo(this.model, 'change:_titles', function () { return _this.updateTitles(); }); }; /** * Called when view is rendered. */ TabView.prototype.render = function () { _super.prototype.render.call(this); var tabs = this.pWidget; tabs.addClass('jupyter-widgets'); tabs.addClass('widget-container'); tabs.addClass('widget-tab'); tabs.tabsMovable = true; tabs.tabBar.insertBehavior = 'none'; // needed for insert behavior, see below. tabs.tabBar.currentChanged.connect(this._onTabChanged, this); tabs.tabBar.tabMoved.connect(this._onTabMoved, this); tabs.tabBar.addClass('widget-tab-bar'); tabs.tabContents.addClass('widget-tab-contents'); // TODO: expose this option in python tabs.tabBar.tabsMovable = false; this.updateTabs(); this.update(); }; /** * Render tab views based on the current model's children. */ TabView.prototype.updateTabs = function () { // While we are updating, the index may not be valid, so deselect the // tabs before updating so we don't get spurious changes in the index, // which would then set off another sync cycle. this.updatingTabs = true; this.pWidget.currentIndex = null; this.childrenViews.update(this.model.get('children')); this.pWidget.currentIndex = this.model.get('selected_index'); this.updatingTabs = false; }; /** * Called when a child is added to children list. */ TabView.prototype.addChildView = function (model, index) { // Placeholder widget to keep our position in the tab panel while we create the view. var label = this.model.get('_titles')[index] || ''; var tabs = this.pWidget; var placeholder = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"](); placeholder.title.label = label; tabs.addWidget(placeholder); return this.create_child_view(model).then(function (view) { var widget = view.pWidget; widget.title.label = placeholder.title.label; widget.title.closable = false; var i = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__["ArrayExt"].firstIndexOf(tabs.widgets, placeholder); // insert after placeholder so that if placholder is selected, the // real widget will be selected now (this depends on the tab bar // insert behavior) tabs.insertWidget(i + 1, widget); placeholder.dispose(); return view; }).catch(_utils__WEBPACK_IMPORTED_MODULE_8__["reject"]('Could not add child view to box', true)); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ TabView.prototype.update = function () { // Update the selected index in the overall update method because it // should be run after the tabs have been updated. Otherwise the // selected index may not be a valid tab in the tab bar. this.updateSelectedIndex(); return _super.prototype.update.call(this); }; /** * Updates the tab page titles. */ TabView.prototype.updateTitles = function () { var titles = this.model.get('_titles') || {}; Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__["each"])(this.pWidget.widgets, function (widget, i) { widget.title.label = titles[i] || ''; }); }; /** * Updates the selected index. */ TabView.prototype.updateSelectedIndex = function () { this.pWidget.currentIndex = this.model.get('selected_index'); }; TabView.prototype.remove = function () { this.childrenViews = null; _super.prototype.remove.call(this); }; TabView.prototype._onTabChanged = function (sender, args) { if (!this.updatingTabs) { var i = args.currentIndex; this.model.set('selected_index', i === -1 ? null : i); this.touch(); } }; /** * Handle the `tabMoved` signal from the tab bar. */ TabView.prototype._onTabMoved = function (sender, args) { var children = this.model.get('children').slice(); _lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__["ArrayExt"].move(children, args.fromIndex, args.toIndex); this.model.set('children', children); this.touch(); }; return TabView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_string.js": /*!*********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_string.js ***! \*********************************************************************/ /*! exports provided: StringModel, HTMLModel, HTMLView, HTMLMathModel, HTMLMathView, LabelModel, LabelView, TextareaModel, TextareaView, TextModel, TextView, PasswordModel, PasswordView, ComboboxModel, ComboboxView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringModel", function() { return StringModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTMLModel", function() { return HTMLModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTMLView", function() { return HTMLView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTMLMathModel", function() { return HTMLMathModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTMLMathView", function() { return HTMLMathView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LabelModel", function() { return LabelModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LabelView", function() { return LabelView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextareaModel", function() { return TextareaModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextareaView", function() { return TextareaView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextModel", function() { return TextModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextView", function() { return TextView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PasswordModel", function() { return PasswordModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PasswordView", function() { return PasswordView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComboboxModel", function() { return ComboboxModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComboboxView", function() { return ComboboxView; }); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _widget_description__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_description */ "./node_modules/@jupyter-widgets/controls/lib/widget_description.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@jupyter-widgets/controls/lib/utils.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; /** * Class name for a combobox with an invlid value. */ var INVALID_VALUE_CLASS = 'jpwidgets-invalidComboValue'; var StringModel = /** @class */ (function (_super) { __extends(StringModel, _super); function StringModel() { return _super !== null && _super.apply(this, arguments) || this; } StringModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { value: '', disabled: false, placeholder: '\u200b', _model_name: 'StringModel' }); }; return StringModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDescriptionModel"])); var HTMLModel = /** @class */ (function (_super) { __extends(HTMLModel, _super); function HTMLModel() { return _super !== null && _super.apply(this, arguments) || this; } HTMLModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _view_name: 'HTMLView', _model_name: 'HTMLModel' }); }; return HTMLModel; }(StringModel)); var HTMLView = /** @class */ (function (_super) { __extends(HTMLView, _super); function HTMLView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ HTMLView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-html'); this.content = document.createElement('div'); this.content.classList.add('widget-html-content'); this.el.appendChild(this.content); this.update(); // Set defaults. }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ HTMLView.prototype.update = function () { this.content.innerHTML = this.model.get('value'); return _super.prototype.update.call(this); }; return HTMLView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var HTMLMathModel = /** @class */ (function (_super) { __extends(HTMLMathModel, _super); function HTMLMathModel() { return _super !== null && _super.apply(this, arguments) || this; } HTMLMathModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _view_name: 'HTMLMathView', _model_name: 'HTMLMathModel' }); }; return HTMLMathModel; }(StringModel)); var HTMLMathView = /** @class */ (function (_super) { __extends(HTMLMathView, _super); function HTMLMathView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ HTMLMathView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-htmlmath'); this.content = document.createElement('div'); this.content.classList.add('widget-htmlmath-content'); this.el.appendChild(this.content); this.update(); // Set defaults. }; /** * Update the contents of this view */ HTMLMathView.prototype.update = function () { this.content.innerHTML = this.model.get('value'); this.typeset(this.content); return _super.prototype.update.call(this); }; return HTMLMathView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var LabelModel = /** @class */ (function (_super) { __extends(LabelModel, _super); function LabelModel() { return _super !== null && _super.apply(this, arguments) || this; } LabelModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _view_name: 'LabelView', _model_name: 'LabelModel' }); }; return LabelModel; }(StringModel)); var LabelView = /** @class */ (function (_super) { __extends(LabelView, _super); function LabelView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ LabelView.prototype.render = function () { _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-label'); this.update(); // Set defaults. }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ LabelView.prototype.update = function () { this.typeset(this.el, this.model.get('value')); return _super.prototype.update.call(this); }; return LabelView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var TextareaModel = /** @class */ (function (_super) { __extends(TextareaModel, _super); function TextareaModel() { return _super !== null && _super.apply(this, arguments) || this; } TextareaModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _view_name: 'TextareaView', _model_name: 'TextareaModel', rows: null, continuous_update: true, }); }; return TextareaModel; }(StringModel)); var TextareaView = /** @class */ (function (_super) { __extends(TextareaView, _super); function TextareaView() { return _super !== null && _super.apply(this, arguments) || this; } /** * Called when view is rendered. */ TextareaView.prototype.render = function () { var _this = this; _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-textarea'); this.textbox = document.createElement('textarea'); this.textbox.setAttribute('rows', '5'); this.textbox.id = this.label.htmlFor = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["uuid"])(); this.el.appendChild(this.textbox); this.update(); // Set defaults. this.listenTo(this.model, 'change:placeholder', function (model, value, options) { _this.update_placeholder(value); }); this.update_placeholder(); }; TextareaView.prototype.update_placeholder = function (value) { value = value || this.model.get('placeholder'); this.textbox.setAttribute('placeholder', value.toString()); }; /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ TextareaView.prototype.update = function (options) { if (options === undefined || options.updated_view != this) { this.textbox.value = this.model.get('value'); var rows = this.model.get('rows'); if (rows === null) { rows = ''; } this.textbox.setAttribute('rows', rows); this.textbox.disabled = this.model.get('disabled'); } return _super.prototype.update.call(this); }; TextareaView.prototype.events = function () { return { 'keydown input': 'handleKeyDown', 'keypress input': 'handleKeypress', 'input textarea': 'handleChanging', 'change textarea': 'handleChanged' }; }; /** * Handle key down * * Stop propagation so the event isn't sent to the application. */ TextareaView.prototype.handleKeyDown = function (e) { e.stopPropagation(); }; /** * Handles key press * * Stop propagation so the keypress isn't sent to the application. */ TextareaView.prototype.handleKeypress = function (e) { e.stopPropagation(); }; /** * Triggered on input change */ TextareaView.prototype.handleChanging = function (e) { if (this.model.get('continuous_update')) { this.handleChanged(e); } }; /** * Sync the value with the kernel. * * @param e Event */ TextareaView.prototype.handleChanged = function (e) { var target = e.target; this.model.set('value', target.value, { updated_view: this }); this.touch(); }; return TextareaView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var TextModel = /** @class */ (function (_super) { __extends(TextModel, _super); function TextModel() { return _super !== null && _super.apply(this, arguments) || this; } TextModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _view_name: 'TextView', _model_name: 'TextModel', continuous_update: true, }); }; return TextModel; }(StringModel)); var TextView = /** @class */ (function (_super) { __extends(TextView, _super); function TextView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.inputType = 'text'; return _this; } /** * Called when view is rendered. */ TextView.prototype.render = function () { var _this = this; _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-inline-hbox'); this.el.classList.add('widget-text'); this.textbox = document.createElement('input'); this.textbox.setAttribute('type', this.inputType); this.textbox.id = this.label.htmlFor = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["uuid"])(); this.el.appendChild(this.textbox); this.update(); // Set defaults. this.listenTo(this.model, 'change:placeholder', function (model, value, options) { _this.update_placeholder(value); }); this.listenTo(this.model, 'change:description_tooltip', this.update_title); this.listenTo(this.model, 'change:description', this.update_title); this.update_placeholder(); this.update_title(); }; TextView.prototype.update_placeholder = function (value) { this.textbox.setAttribute('placeholder', value || this.model.get('placeholder')); }; TextView.prototype.update_title = function () { var title = this.model.get('description_tooltip'); if (!title) { this.textbox.removeAttribute('title'); } else if (this.model.get('description').length === 0) { this.textbox.setAttribute('title', title); } }; TextView.prototype.update = function (options) { /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ if (options === undefined || options.updated_view !== this) { if (this.textbox.value !== this.model.get('value')) { this.textbox.value = this.model.get('value'); } this.textbox.disabled = this.model.get('disabled'); } return _super.prototype.update.call(this); }; TextView.prototype.events = function () { return { 'keydown input': 'handleKeyDown', 'keypress input': 'handleKeypress', 'input input': 'handleChanging', 'change input': 'handleChanged' }; }; /** * Handle key down * * Stop propagation so the keypress isn't sent to the application. */ TextView.prototype.handleKeyDown = function (e) { e.stopPropagation(); }; /** * Handles text submission */ TextView.prototype.handleKeypress = function (e) { e.stopPropagation(); // The submit message is deprecated in widgets 7 if (e.keyCode === 13) { // Return key this.send({ event: 'submit' }); } }; /** * Handles user input. * * Calling model.set will trigger all of the other views of the * model to update. */ TextView.prototype.handleChanging = function (e) { if (this.model.get('continuous_update')) { this.handleChanged(e); } }; /** * Handles user input. * * Calling model.set will trigger all of the other views of the * model to update. */ TextView.prototype.handleChanged = function (e) { var target = e.target; this.model.set('value', target.value, { updated_view: this }); this.touch(); }; return TextView; }(_widget_description__WEBPACK_IMPORTED_MODULE_1__["DescriptionView"])); var PasswordModel = /** @class */ (function (_super) { __extends(PasswordModel, _super); function PasswordModel() { return _super !== null && _super.apply(this, arguments) || this; } PasswordModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_3__["extend"](_super.prototype.defaults.call(this), { _view_name: 'PasswordView', _model_name: 'PasswordModel' }); }; return PasswordModel; }(TextModel)); var PasswordView = /** @class */ (function (_super) { __extends(PasswordView, _super); function PasswordView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.inputType = 'password'; return _this; } return PasswordView; }(TextView)); /** * Combobox widget model class. */ var ComboboxModel = /** @class */ (function (_super) { __extends(ComboboxModel, _super); function ComboboxModel() { return _super !== null && _super.apply(this, arguments) || this; } ComboboxModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'ComboboxModel', _view_name: 'ComboboxView', options: [], ensure_options: false }); }; return ComboboxModel; }(TextModel)); /** * Combobox widget view class. */ var ComboboxView = /** @class */ (function (_super) { __extends(ComboboxView, _super); function ComboboxView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.isInitialRender = true; return _this; } ComboboxView.prototype.render = function () { this.datalist = document.createElement('datalist'); this.datalist.id = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["uuid"])(); _super.prototype.render.call(this); this.textbox.setAttribute('list', this.datalist.id); this.el.appendChild(this.datalist); }; ComboboxView.prototype.update = function (options) { _super.prototype.update.call(this, options); if (!this.datalist) { return; } var valid = this.isValid(this.model.get('value')); this.highlightValidState(valid); // Check if we need to update options if ((options !== undefined && options.updated_view) || (!this.model.hasChanged('options') && !this.isInitialRender)) { // Value update only, keep current options return; } this.isInitialRender = false; var opts = this.model.get('options'); var optLines = opts.map(function (o) { return ""; }); this.datalist.innerHTML = optLines.join('\n'); }; ComboboxView.prototype.isValid = function (value) { if (true === this.model.get('ensure_option')) { var options = this.model.get('options'); if (options.indexOf(value) === -1) { return false; } } return true; }; ComboboxView.prototype.handleChanging = function (e) { // Override to validate value var target = e.target; var valid = this.isValid(target.value); this.highlightValidState(valid); if (valid) { _super.prototype.handleChanging.call(this, e); } }; ComboboxView.prototype.handleChanged = function (e) { // Override to validate value var target = e.target; var valid = this.isValid(target.value); this.highlightValidState(valid); if (valid) { _super.prototype.handleChanged.call(this, e); } }; ComboboxView.prototype.highlightValidState = function (valid) { this.textbox.classList.toggle(INVALID_VALUE_CLASS, !valid); }; return ComboboxView; }(TextView)); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_upload.js": /*!*********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_upload.js ***! \*********************************************************************/ /*! exports provided: FileUploadModel, FileUploadView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FileUploadModel", function() { return FileUploadModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FileUploadView", function() { return FileUploadView; }); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; var FileUploadModel = /** @class */ (function (_super) { __extends(FileUploadModel, _super); function FileUploadModel() { return _super !== null && _super.apply(this, arguments) || this; } FileUploadModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_2__["extend"](_super.prototype.defaults.call(this), { _model_name: 'FileUploadModel', _view_name: 'FileUploadView', _counter: 0, accept: '', description: 'Upload', tooltip: '', disabled: false, icon: 'upload', button_style: '', multiple: false, metadata: [], data: [], error: '', style: null }); }; FileUploadModel.serializers = __assign(__assign({}, _widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDOMWidgetModel"].serializers), { data: { serialize: function (buffers) { return __spreadArrays(buffers); } } }); return FileUploadModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_0__["CoreDOMWidgetModel"])); var FileUploadView = /** @class */ (function (_super) { __extends(FileUploadView, _super); function FileUploadView() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(FileUploadView.prototype, "tagName", { get: function () { return 'button'; }, enumerable: true, configurable: true }); FileUploadView.prototype.render = function () { var _this = this; _super.prototype.render.call(this); this.el.classList.add('jupyter-widgets'); this.el.classList.add('widget-upload'); this.el.classList.add('jupyter-button'); this.fileInput = document.createElement('input'); this.fileInput.type = 'file'; this.fileInput.style.display = 'none'; this.el.appendChild(this.fileInput); this.el.addEventListener('click', function () { _this.fileInput.click(); }); this.fileInput.addEventListener('click', function () { _this.fileInput.value = ''; }); this.fileInput.addEventListener('change', function () { var promisesFile = []; Array.from(_this.fileInput.files).forEach(function (file) { promisesFile.push(new Promise(function (resolve, reject) { var metadata = { name: file.name, type: file.type, size: file.size, lastModified: file.lastModified, }; _this.fileReader = new FileReader(); _this.fileReader.onload = function (event) { var buffer = event.target.result; resolve({ buffer: buffer, metadata: metadata, error: '', }); }; _this.fileReader.onerror = function () { reject(); }; _this.fileReader.onabort = _this.fileReader.onerror; _this.fileReader.readAsArrayBuffer(file); })); }); Promise.all(promisesFile) .then(function (contents) { var metadata = []; var li_buffer = []; contents.forEach(function (c) { metadata.push(c.metadata); li_buffer.push(c.buffer); }); var counter = _this.model.get('_counter'); _this.model.set({ _counter: counter + contents.length, metadata: metadata, data: li_buffer, error: '', }); _this.touch(); }) .catch(function (err) { console.error('error in file upload: %o', err); _this.model.set({ error: err, }); _this.touch(); }); }); this.listenTo(this.model, 'change:button_style', this.update_button_style); this.set_button_style(); this.update(); // Set defaults. }; FileUploadView.prototype.update = function () { this.el.disabled = this.model.get('disabled'); this.el.setAttribute('title', this.model.get('tooltip')); var description = this.model.get('description') + " (" + this.model.get('_counter') + ")"; var icon = this.model.get('icon'); if (description.length || icon.length) { this.el.textContent = ''; if (icon.length) { var i = document.createElement('i'); i.classList.add('fa'); i.classList.add('fa-' + icon); if (description.length === 0) { i.classList.add('center'); } this.el.appendChild(i); } this.el.appendChild(document.createTextNode(description)); } this.fileInput.accept = this.model.get('accept'); this.fileInput.multiple = this.model.get('multiple'); return _super.prototype.update.call(this); }; FileUploadView.prototype.update_button_style = function () { this.update_mapped_classes(FileUploadView.class_map, 'button_style', this.el); }; FileUploadView.prototype.set_button_style = function () { this.set_mapped_classes(FileUploadView.class_map, 'button_style', this.el); }; FileUploadView.class_map = { primary: ['mod-primary'], success: ['mod-success'], info: ['mod-info'], warning: ['mod-warning'], danger: ['mod-danger'] }; return FileUploadView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/lib/widget_video.js": /*!********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/lib/widget_video.js ***! \********************************************************************/ /*! exports provided: VideoModel, VideoView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VideoModel", function() { return VideoModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VideoView", function() { return VideoView; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _widget_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget_core */ "./node_modules/@jupyter-widgets/controls/lib/widget_core.js"); /* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var VideoModel = /** @class */ (function (_super) { __extends(VideoModel, _super); function VideoModel() { return _super !== null && _super.apply(this, arguments) || this; } VideoModel.prototype.defaults = function () { return underscore__WEBPACK_IMPORTED_MODULE_2__["extend"](_super.prototype.defaults.call(this), { _model_name: 'VideoModel', _view_name: 'VideoView', format: 'mp4', width: '', height: '', autoplay: true, loop: true, controls: true, value: new DataView(new ArrayBuffer(0)) }); }; VideoModel.serializers = __assign(__assign({}, _widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"].serializers), { value: { serialize: function (value) { return new DataView(value.buffer.slice(0)); } } }); return VideoModel; }(_widget_core__WEBPACK_IMPORTED_MODULE_1__["CoreDOMWidgetModel"])); var VideoView = /** @class */ (function (_super) { __extends(VideoView, _super); function VideoView() { return _super !== null && _super.apply(this, arguments) || this; } VideoView.prototype.render = function () { /** * Called when view is rendered. */ _super.prototype.render.call(this); this.pWidget.addClass('jupyter-widgets'); this.pWidget.addClass('widget-image'); this.update(); // Set defaults. }; VideoView.prototype.update = function () { /** * Update the contents of this view * * Called when the model is changed. The model may have been * changed by another view or by a state update from the back-end. */ var url; var format = this.model.get('format'); var value = this.model.get('value'); if (format !== 'url') { var blob = new Blob([value], { type: "video/" + this.model.get('format') }); url = URL.createObjectURL(blob); } else { url = (new TextDecoder('utf-8')).decode(value.buffer); } // Clean up the old objectURL var oldurl = this.el.src; this.el.src = url; if (oldurl && typeof oldurl !== 'string') { URL.revokeObjectURL(oldurl); } // Height and width var width = this.model.get('width'); if (width !== undefined && width.length > 0) { this.el.setAttribute('width', width); } else { this.el.removeAttribute('width'); } var height = this.model.get('height'); if (height !== undefined && height.length > 0) { this.el.setAttribute('height', height); } else { this.el.removeAttribute('height'); } // Video attributes this.el.loop = this.model.get('loop'); this.el.autoplay = this.model.get('autoplay'); this.el.controls = this.model.get('controls'); return _super.prototype.update.call(this); }; VideoView.prototype.remove = function () { if (this.el.src) { URL.revokeObjectURL(this.el.src); } _super.prototype.remove.call(this); }; Object.defineProperty(VideoView.prototype, "tagName", { /** * The default tag name. * * #### Notes * This is a read-only attribute. */ get: function () { // We can't make this an attribute with a default value // since it would be set after it is needed in the // constructor. return 'video'; }, enumerable: true, configurable: true }); return VideoView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/controls/package.json": /*!*************************************************************!*\ !*** ./node_modules/@jupyter-widgets/controls/package.json ***! \*************************************************************/ /*! exports provided: _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _shasum, _spec, _where, author, bugs, bundleDependencies, dependencies, deprecated, description, devDependencies, files, gitHead, homepage, license, main, name, repository, scripts, typings, version, default */ /***/ (function(module) { module.exports = JSON.parse("{\"_from\":\"@jupyter-widgets/controls@^3.0.0\",\"_id\":\"@jupyter-widgets/controls@3.1.0\",\"_inBundle\":false,\"_integrity\":\"sha512-8LtaeGezpaCmbcakwvgWL2pgqfBzOKinMrljUqoGPSVSdBHYlAhvaFrO6rJuUbj8oYAczadN29X/ptGhzuq0tQ==\",\"_location\":\"/@jupyter-widgets/controls\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"@jupyter-widgets/controls@^3.0.0\",\"name\":\"@jupyter-widgets/controls\",\"escapedName\":\"@jupyter-widgets%2fcontrols\",\"scope\":\"@jupyter-widgets\",\"rawSpec\":\"^3.0.0\",\"saveSpec\":null,\"fetchSpec\":\"^3.0.0\"},\"_requiredBy\":[\"#DEV:/\",\"/@jupyter-widgets/html-manager\",\"/@jupyter-widgets/jupyterlab-manager\"],\"_resolved\":\"https://registry.npmjs.org/@jupyter-widgets/controls/-/controls-3.1.0.tgz\",\"_shasum\":\"c9784c6f0e9ba24cc5b0a38bfce72970861d9691\",\"_spec\":\"@jupyter-widgets/controls@^3.0.0\",\"_where\":\"T:\\\\Github\\\\thebe\",\"author\":{\"name\":\"Project Jupyter\"},\"bugs\":{\"url\":\"https://github.com/jupyter-widgets/ipywidgets/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"@jupyter-widgets/base\":\"^4.1.0\",\"@lumino/algorithm\":\"^1.1.0\",\"@lumino/domutils\":\"^1.1.0\",\"@lumino/messaging\":\"^1.2.1\",\"@lumino/signaling\":\"^1.2.0\",\"@lumino/widgets\":\"^1.3.0\",\"d3-format\":\"^1.3.0\",\"jquery\":\"^3.1.1\",\"jquery-ui\":\"^1.12.1\",\"underscore\":\"^1.8.3\"},\"deprecated\":false,\"description\":\"Jupyter interactive widgets\",\"devDependencies\":{\"@jupyterlab/services\":\"^6.0.0\",\"@types/d3-format\":\"^1.3.1\",\"@types/expect.js\":\"^0.3.29\",\"@types/mathjax\":\"^0.0.35\",\"@types/mocha\":\"^5.2.7\",\"@types/node\":\"^12.0.10\",\"chai\":\"^4.0.0\",\"css-loader\":\"^3.4.0\",\"expect.js\":\"^0.3.1\",\"file-loader\":\"^5.0.2\",\"istanbul-instrumenter-loader\":\"^3.0.1\",\"karma\":\"^4.1.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-coverage\":\"^1.1.2\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-ie-launcher\":\"^1.0.0\",\"karma-mocha\":\"^1.3.0\",\"karma-mocha-reporter\":\"^2.2.5\",\"karma-webpack\":\"^4.0.2\",\"mocha\":\"^6.1.4\",\"npm-run-all\":\"^4.1.5\",\"postcss-cli\":\"^6.1.2\",\"postcss-cssnext\":\"^3.1.0\",\"postcss-import\":\"^12.0.1\",\"postcss-loader\":\"^3.0.0\",\"rimraf\":\"^2.6.1\",\"sinon\":\"^7.3.2\",\"sinon-chai\":\"^3.3.0\",\"style-loader\":\"^1.1.2\",\"tslint\":\"^5.20.1\",\"typescript\":\"~3.7.4\",\"url-loader\":\"^3.0.0\",\"webpack\":\"^4.41.5\"},\"files\":[\"lib/**/*.d.ts\",\"lib/**/*.js\",\"css/*.css\",\"dist/\"],\"gitHead\":\"80a98429a4c9a0e88aeff9c8b873268785b3e033\",\"homepage\":\"https://github.com/jupyter-widgets/ipywidgets#readme\",\"license\":\"BSD-3-Clause\",\"main\":\"lib/index.js\",\"name\":\"@jupyter-widgets/controls\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/jupyter-widgets/ipywidgets.git\"},\"scripts\":{\"build\":\"npm run build:src && npm run build:css\",\"build:css\":\"postcss --use postcss-import --use postcss-cssnext -o css/widgets.built.css css/widgets.css\",\"build:src\":\"tsc\",\"build:test\":\"tsc --project test && webpack --config test/webpack.conf.js\",\"clean\":\"npm run clean:src\",\"clean:src\":\"rimraf lib && rimraf tsconfig.tsbuildinfo\",\"lint\":\"tslint --project tslint.json --format stylish\",\"prepublish\":\"npm run clean && npm run build\",\"test\":\"npm run test:unit\",\"test:coverage\":\"npm run build:test && webpack --config test/webpack-cov.conf.js && karma start test/karma-cov.conf.js\",\"test:unit\":\"npm run test:unit:firefox && npm run test:unit:chrome\",\"test:unit:chrome\":\"npm run test:unit:default -- --browsers=Chrome\",\"test:unit:default\":\"npm run build:test && karma start test/karma.conf.js --log-level debug\",\"test:unit:firefox\":\"npm run test:unit:default -- --browsers=Firefox\",\"test:unit:firefox:headless\":\"npm run test:unit:default -- --browsers=FirefoxHeadless\",\"test:unit:ie\":\"npm run test:unit:default -- --browsers=IE\"},\"typings\":\"lib/index.d.ts\",\"version\":\"3.1.0\"}"); /***/ }), /***/ "./node_modules/@jupyter-widgets/html-manager/css/output.css": /*!*******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/html-manager/css/output.css ***! \*******************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _css_loader_dist_cjs_js_output_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../../css-loader/dist/cjs.js!./output.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/@jupyter-widgets/html-manager/css/output.css"); var options = {}; options.insert = "head"; options.singleton = false; var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_output_css__WEBPACK_IMPORTED_MODULE_1__["default"], options); /* harmony default export */ __webpack_exports__["default"] = (_css_loader_dist_cjs_js_output_css__WEBPACK_IMPORTED_MODULE_1__["default"].locals || {}); /***/ }), /***/ "./node_modules/@jupyter-widgets/html-manager/lib/htmlmanager.js": /*!***********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/html-manager/lib/htmlmanager.js ***! \***********************************************************************/ /*! exports provided: HTMLManager */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTMLManager", function() { return HTMLManager; }); /* harmony import */ var _jupyter_widgets_controls__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/controls */ "./node_modules/@jupyter-widgets/controls/lib/index.js"); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _output__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./output */ "./node_modules/@jupyter-widgets/html-manager/lib/output.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/rendermime */ "./node_modules/@jupyterlab/rendermime/lib/index.js"); /* harmony import */ var _output_renderers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./output_renderers */ "./node_modules/@jupyter-widgets/html-manager/lib/output_renderers.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. class HTMLManager extends _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__["ManagerBase"] { constructor(options) { super(); this.loader = options && options.loader; this.renderMime = new _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_4__["RenderMimeRegistry"]({ initialFactories: _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_4__["standardRendererFactories"] }); this.renderMime.addFactory({ safe: false, mimeTypes: [_output_renderers__WEBPACK_IMPORTED_MODULE_5__["WIDGET_MIMETYPE"]], createRenderer: (options) => new _output_renderers__WEBPACK_IMPORTED_MODULE_5__["WidgetRenderer"](options, this) }, 0); } /** * Display the specified view. Element where the view is displayed * is specified in the `options.el` argument. */ display_view(msg, view, options) { return Promise.resolve(view).then((view) => { _lumino_widgets__WEBPACK_IMPORTED_MODULE_3__["Widget"].attach(view.pWidget, options.el); view.on('remove', () => { console.log('View removed', view); }); return view; }); } /** * Placeholder implementation for _get_comm_info. */ _get_comm_info() { return Promise.resolve({}); } /** * Placeholder implementation for _create_comm. */ _create_comm(comm_target_name, model_id, data, metadata, buffers) { return Promise.resolve({ on_close: () => { return; }, on_msg: () => { return; }, close: () => { return; } }); } /** * Load a class and return a promise to the loaded object. */ loadClass(className, moduleName, moduleVersion) { return new Promise((resolve, reject) => { if (moduleName === '@jupyter-widgets/base') { resolve(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_1__); } else if (moduleName === '@jupyter-widgets/controls') { resolve(_jupyter_widgets_controls__WEBPACK_IMPORTED_MODULE_0__); } else if (moduleName === '@jupyter-widgets/output') { resolve(_output__WEBPACK_IMPORTED_MODULE_2__); } else if (this.loader !== undefined) { resolve(this.loader(moduleName, moduleVersion)); } else { reject(`Could not load module ${moduleName}@${moduleVersion}`); } }).then((module) => { if (module[className]) { return module[className]; } else { return Promise.reject(`Class ${className} not found in module ${moduleName}@${moduleVersion}`); } }); } } /***/ }), /***/ "./node_modules/@jupyter-widgets/html-manager/lib/index.js": /*!*****************************************************************!*\ !*** ./node_modules/@jupyter-widgets/html-manager/lib/index.js ***! \*****************************************************************/ /*! exports provided: HTMLManager, requireLoader, version, generateEmbedScript */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generateEmbedScript", function() { return generateEmbedScript; }); /* harmony import */ var _htmlmanager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./htmlmanager */ "./node_modules/@jupyter-widgets/html-manager/lib/htmlmanager.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTMLManager", function() { return _htmlmanager__WEBPACK_IMPORTED_MODULE_0__["HTMLManager"]; }); /* harmony import */ var _libembed_amd__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./libembed-amd */ "./node_modules/@jupyter-widgets/html-manager/lib/libembed-amd.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "requireLoader", function() { return _libembed_amd__WEBPACK_IMPORTED_MODULE_1__["requireLoader"]; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. const version = __webpack_require__(/*! ../package.json */ "./node_modules/@jupyter-widgets/html-manager/package.json").version; function generateEmbedScript(widgetState, imageDataUrl) { return ` `; } /***/ }), /***/ "./node_modules/@jupyter-widgets/html-manager/lib/libembed-amd.js": /*!************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/html-manager/lib/libembed-amd.js ***! \************************************************************************/ /*! exports provided: requireLoader, renderWidgets */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "requireLoader", function() { return requireLoader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderWidgets", function() { return renderWidgets; }); /* harmony import */ var _libembed__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./libembed */ "./node_modules/@jupyter-widgets/html-manager/lib/libembed.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. let cdn = 'https://unpkg.com/'; // find the data-cdn for any script tag, assuming it is only used for embed-amd.js const scripts = document.getElementsByTagName('script'); Array.prototype.forEach.call(scripts, (script) => { cdn = script.getAttribute('data-jupyter-widgets-cdn') || cdn; }); /** * Load a package using requirejs and return a promise * * @param pkg Package name or names to load */ let requirePromise = function (pkg) { return new Promise((resolve, reject) => { let require = window.requirejs; if (require === undefined) { reject("Requirejs is needed, please ensure it is loaded on the page."); } else { require(pkg, resolve, reject); } }); }; function moduleNameToCDNUrl(moduleName, moduleVersion) { let packageName = moduleName; let fileName = 'index'; // default filename // if a '/' is present, like 'foo/bar', packageName is changed to 'foo', and path to 'bar' // We first find the first '/' let index = moduleName.indexOf('/'); if ((index != -1) && (moduleName[0] == '@')) { // if we have a namespace, it's a different story // @foo/bar/baz should translate to @foo/bar and baz // so we find the 2nd '/' index = moduleName.indexOf('/', index + 1); } if (index != -1) { fileName = moduleName.substr(index + 1); packageName = moduleName.substr(0, index); } return `${cdn}${packageName}@${moduleVersion}/dist/${fileName}`; } /** * Load an amd module locally and fall back to specified CDN if unavailable. * * @param moduleName The name of the module to load.. * @param version The semver range for the module, if loaded from a CDN. * * By default, the CDN service used is unpkg.com. However, this default can be * overriden by specifying another URL via the HTML attribute * "data-jupyter-widgets-cdn" on a script tag of the page. * * The semver range is only used with the CDN. */ function requireLoader(moduleName, moduleVersion) { return requirePromise([`${moduleName}`]).catch((err) => { let failedId = err.requireModules && err.requireModules[0]; if (failedId) { console.log(`Falling back to ${cdn} for ${moduleName}@${moduleVersion}`); let require = window.requirejs; if (require === undefined) { throw new Error("Requirejs is needed, please ensure it is loaded on the page."); } const conf = { paths: {} }; conf.paths[moduleName] = moduleNameToCDNUrl(moduleName, moduleVersion); require.undef(failedId); require.config(conf); return requirePromise([`${moduleName}`]); } }); } /** * Render widgets in a given element. * * @param element (default document.documentElement) The element containing widget state and views. * @param loader (default requireLoader) The function used to look up the modules containing * the widgets' models and views classes. (The default loader looks them up on unpkg.com) */ function renderWidgets(element = document.documentElement, loader = requireLoader) { requirePromise(['@jupyter-widgets/html-manager']).then((htmlmanager) => { let managerFactory = () => { return new htmlmanager.HTMLManager({ loader: loader }); }; _libembed__WEBPACK_IMPORTED_MODULE_0__["renderWidgets"](managerFactory, element); }); } /***/ }), /***/ "./node_modules/@jupyter-widgets/html-manager/lib/libembed.js": /*!********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/html-manager/lib/libembed.js ***! \********************************************************************/ /*! exports provided: renderWidgets */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderWidgets", function() { return renderWidgets; }); /* harmony import */ var font_awesome_css_font_awesome_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! font-awesome/css/font-awesome.css */ "./src/emptyshim.js"); /* harmony import */ var font_awesome_css_font_awesome_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(font_awesome_css_font_awesome_css__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _lumino_widgets_style_index_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/widgets/style/index.css */ "./node_modules/@lumino/widgets/style/index.css"); /* harmony import */ var _jupyter_widgets_controls_css_widgets_base_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyter-widgets/controls/css/widgets-base.css */ "./node_modules/@jupyter-widgets/controls/css/widgets-base.css"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. __webpack_require__.p = window.__jupyter_widgets_assets_path__ || __webpack_require__.p; // If lab variables are not found, we set them (we don't want to reset the variables if they are already defined) if (getComputedStyle(document.documentElement).getPropertyValue('--jp-layout-color0') === '') { __webpack_require__(/*! @jupyter-widgets/controls/css/labvariables.css */ "./node_modules/@jupyter-widgets/controls/css/labvariables.css"); } // Load json schema validator var Ajv = __webpack_require__(/*! ajv */ "./node_modules/ajv/lib/ajv.js"); var widget_state_schema = __webpack_require__(/*! @jupyter-widgets/schema */ "./node_modules/@jupyter-widgets/schema/index.js").v2.state; var widget_view_schema = __webpack_require__(/*! @jupyter-widgets/schema */ "./node_modules/@jupyter-widgets/schema/index.js").v2.view; let ajv = new Ajv(); let model_validate = ajv.compile(widget_state_schema); let view_validate = ajv.compile(widget_view_schema); /** * Render the inline widgets inside a DOM element. * * @param managerFactory A function that returns a new HTMLManager * @param element (default document.documentElement) The document element in which to process for widget state. */ function renderWidgets(managerFactory, element = document.documentElement) { let tags = element.querySelectorAll('script[type="application/vnd.jupyter.widget-state+json"]'); for (let i = 0; i != tags.length; ++i) { renderManager(element, JSON.parse(tags[i].innerHTML), managerFactory); } } /** * Create a widget manager for a given widget state. * * @param element The DOM element to search for widget view state script tags * @param widgetState The widget manager state * * #### Notes * * Widget view state should be in script tags with type * "application/vnd.jupyter.widget-view+json". Any such script tag containing a * model id the manager knows about is replaced with a rendered view. * Additionally, if the script tag has a prior img sibling with class * 'jupyter-widget', then that img tag is deleted. */ function renderManager(element, widgetState, managerFactory) { let valid = model_validate(widgetState); if (!valid) { console.error('Model state has errors.', model_validate.errors); } let manager = managerFactory(); manager.set_state(widgetState).then(function (models) { let tags = element.querySelectorAll('script[type="application/vnd.jupyter.widget-view+json"]'); for (let i = 0; i != tags.length; ++i) { let viewtag = tags[i]; let widgetViewObject = JSON.parse(viewtag.innerHTML); let valid = view_validate(widgetViewObject); if (!valid) { console.error('View state has errors.', view_validate.errors); } let model_id = widgetViewObject.model_id; // Find the model id in the models. We should use .find, but IE // doesn't support .find let model = models.filter((item) => { return item.model_id == model_id; })[0]; if (model !== undefined) { let prev = viewtag.previousElementSibling; if (prev && prev.tagName === 'img' && prev.classList.contains('jupyter-widget')) { viewtag.parentElement.removeChild(prev); } let widgetTag = document.createElement('div'); widgetTag.className = 'widget-subarea'; viewtag.parentElement.insertBefore(widgetTag, viewtag); manager.display_model(undefined, model, { el: widgetTag }); } } }); } /***/ }), /***/ "./node_modules/@jupyter-widgets/html-manager/lib/output.js": /*!******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/html-manager/lib/output.js ***! \******************************************************************/ /*! exports provided: OutputModel, OutputView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputModel", function() { return OutputModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputView", function() { return OutputView; }); /* harmony import */ var _jupyter_widgets_output__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/output */ "./node_modules/@jupyter-widgets/output/lib/index.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/outputarea */ "./node_modules/@jupyterlab/outputarea/lib/index.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _css_output_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../css/output.css */ "./node_modules/@jupyter-widgets/html-manager/css/output.css"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. class OutputModel extends _jupyter_widgets_output__WEBPACK_IMPORTED_MODULE_0__["OutputModel"] { defaults() { return Object.assign(Object.assign({}, super.defaults()), { msg_id: '', outputs: [] }); } initialize(attributes, options) { super.initialize(attributes, options); this._outputs = new _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_2__["OutputAreaModel"]({ trusted: true }); this.listenTo(this, 'change:outputs', this.setOutputs); this.setOutputs(); } get outputs() { return this._outputs; } clear_output(wait = false) { this._outputs.clear(wait); } setOutputs(model, value, options) { if (!(options && options.newMessage)) { // fromJSON does not clear the existing output this.clear_output(); // fromJSON does not copy the message, so we make a deep copy this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get('outputs')))); } } } class OutputView extends _jupyter_widgets_output__WEBPACK_IMPORTED_MODULE_0__["OutputView"] { _createElement(tagName) { this.pWidget = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__["Panel"](); return this.pWidget.node; } _setElement(el) { if (this.el || el !== this.pWidget.node) { // Boxes don't allow setting the element beyond the initial creation. throw new Error('Cannot reset the DOM element.'); } this.el = this.pWidget.node; this.$el = jquery__WEBPACK_IMPORTED_MODULE_3___default()(this.pWidget.node); } render() { const manager = this.model.widget_manager; const rendermime = manager.renderMime; this._outputView = new _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_2__["OutputArea"]({ rendermime: rendermime, model: this.model.outputs }); this.pWidget.insertWidget(0, this._outputView); this.pWidget.addClass('jupyter-widgets'); this.pWidget.addClass('widget-output'); this.update(); } } /***/ }), /***/ "./node_modules/@jupyter-widgets/html-manager/lib/output_renderers.js": /*!****************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/html-manager/lib/output_renderers.js ***! \****************************************************************************/ /*! exports provided: WIDGET_MIMETYPE, WidgetRenderer */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WIDGET_MIMETYPE", function() { return WIDGET_MIMETYPE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WidgetRenderer", function() { return WidgetRenderer; }); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json'; // Renderer to allow the output widget to render sub-widgets class WidgetRenderer extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__["Widget"] { constructor(options, manager) { super(); this.mimeType = options.mimeType; this._manager = manager; } async renderModel(model) { const source = model.data[this.mimeType]; const modelPromise = this._manager.get_model(source.model_id); if (modelPromise) { try { let wModel = await modelPromise; await this._manager.display_model(null, wModel, { el: this.node }); } catch (err) { console.log('Error displaying widget'); console.log(err); this.node.textContent = 'Error displaying widget'; this.addClass('jupyter-widgets'); } } else { this.node.textContent = 'Error creating widget: could not find model'; this.addClass('jupyter-widgets'); return Promise.resolve(); } } } /***/ }), /***/ "./node_modules/@jupyter-widgets/html-manager/package.json": /*!*****************************************************************!*\ !*** ./node_modules/@jupyter-widgets/html-manager/package.json ***! \*****************************************************************/ /*! exports provided: _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _shasum, _spec, _where, author, bugs, bundleDependencies, dependencies, deprecated, description, devDependencies, files, gitHead, homepage, license, main, name, repository, scripts, typings, version, default */ /***/ (function(module) { module.exports = JSON.parse("{\"_from\":\"@jupyter-widgets/html-manager@^0.20.0\",\"_id\":\"@jupyter-widgets/html-manager@0.20.1\",\"_inBundle\":false,\"_integrity\":\"sha512-qg1lf75Cyqnl9L1fxJQ3JW5nYyQ8hv+r1q5wZgb//dc/E2eOu1+ojGlfnCzLGcLRssQ7h5Ui40OZQPaVk2QLEQ==\",\"_location\":\"/@jupyter-widgets/html-manager\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"@jupyter-widgets/html-manager@^0.20.0\",\"name\":\"@jupyter-widgets/html-manager\",\"escapedName\":\"@jupyter-widgets%2fhtml-manager\",\"scope\":\"@jupyter-widgets\",\"rawSpec\":\"^0.20.0\",\"saveSpec\":null,\"fetchSpec\":\"^0.20.0\"},\"_requiredBy\":[\"#DEV:/\"],\"_resolved\":\"https://registry.npmjs.org/@jupyter-widgets/html-manager/-/html-manager-0.20.1.tgz\",\"_shasum\":\"c8b545b207e654ee52c8dfc1237c9df0b8cc7658\",\"_spec\":\"@jupyter-widgets/html-manager@^0.20.0\",\"_where\":\"T:\\\\Github\\\\thebe\",\"author\":{\"name\":\"Jupyter Project\"},\"bugs\":{\"url\":\"https://github.com/jupyter-widgets/ipywidgets/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"@jupyter-widgets/base\":\"^4.1.0\",\"@jupyter-widgets/controls\":\"^3.1.0\",\"@jupyter-widgets/output\":\"^4.1.0\",\"@jupyter-widgets/schema\":\"^0.4.1\",\"@jupyterlab/outputarea\":\"^3.0.0\",\"@jupyterlab/rendermime\":\"^3.0.0\",\"@jupyterlab/rendermime-interfaces\":\"^3.0.0\",\"@lumino/widgets\":\"^1.6.0\",\"ajv\":\"^6.10.0\",\"font-awesome\":\"^4.7.0\",\"jquery\":\"^3.1.1\"},\"deprecated\":false,\"description\":\"Standalone package for rendering Jupyter widgets outside notebooks\",\"devDependencies\":{\"@types/mocha\":\"^5.2.7\",\"@types/requirejs\":\"^2.1.31\",\"chai\":\"^4.0.0\",\"css-loader\":\"^3.4.0\",\"file-loader\":\"^5.0.2\",\"karma\":\"^4.1.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-ie-launcher\":\"^1.0.0\",\"karma-mocha\":\"^1.3.0\",\"karma-mocha-reporter\":\"^2.2.5\",\"mocha\":\"^6.1.4\",\"rimraf\":\"^2.6.1\",\"style-loader\":\"^1.1.2\",\"tslint\":\"^5.20.1\",\"typescript\":\"~3.7.4\",\"url-loader\":\"^3.0.0\",\"webpack\":\"^4.41.5\",\"webpack-cli\":\"^3.3.4\"},\"files\":[\"lib/**/*.d.ts\",\"lib/**/*.js\",\"dist/\",\"css/*.css\"],\"gitHead\":\"80a98429a4c9a0e88aeff9c8b873268785b3e033\",\"homepage\":\"https://github.com/jupyter-widgets/ipywidgets#readme\",\"license\":\"BSD-3-Clause\",\"main\":\"lib/index.js\",\"name\":\"@jupyter-widgets/html-manager\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/jupyter-widgets/ipywidgets.git\"},\"scripts\":{\"build\":\"npm run build:src && webpack && npm run build:embed-amd\",\"build:embed-amd\":\"node scripts/concat-amd-build.js && rimraf dist/amd\",\"build:src\":\"tsc\",\"build:test\":\"tsc --project test && webpack --config test/webpack.conf.js\",\"clean\":\"rimraf lib && rimraf tsconfig.tsbuildinfo && rimraf dist\",\"lint\":\"tslint --project tslint.json --format stylish\",\"prepublish\":\"npm run clean && npm run build\",\"test\":\"npm run test:unit\",\"test:unit\":\"npm run test:unit:firefox && npm run test:unit:chrome\",\"test:unit:chrome\":\"npm run test:unit:default -- --browsers=Chrome\",\"test:unit:default\":\"npm run build:test && karma start test/karma.conf.js --log-level debug --browsers=Firefox\",\"test:unit:firefox\":\"npm run test:unit:default -- --browsers=Firefox\",\"test:unit:firefox:headless\":\"npm run test:unit:default -- --browsers=FirefoxHeadless\"},\"typings\":\"lib/index.d.ts\",\"version\":\"0.20.1\"}"); /***/ }), /***/ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/index.js": /*!***********************************************************************!*\ !*** ./node_modules/@jupyter-widgets/jupyterlab-manager/lib/index.js ***! \***********************************************************************/ /*! exports provided: default, registerWidgetManager, WidgetManager, WidgetRenderer, output */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./plugin */ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/plugin.js"); /* harmony import */ var _output__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./output */ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/output.js"); /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "output", function() { return _output__WEBPACK_IMPORTED_MODULE_1__; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "registerWidgetManager", function() { return _plugin__WEBPACK_IMPORTED_MODULE_0__["registerWidgetManager"]; }); /* harmony import */ var _manager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./manager */ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/manager.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WidgetManager", function() { return _manager__WEBPACK_IMPORTED_MODULE_2__["WidgetManager"]; }); /* harmony import */ var _renderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./renderer */ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/renderer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WidgetRenderer", function() { return _renderer__WEBPACK_IMPORTED_MODULE_3__["WidgetRenderer"]; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /* harmony default export */ __webpack_exports__["default"] = (_plugin__WEBPACK_IMPORTED_MODULE_0__["default"]); /***/ }), /***/ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/manager.js": /*!*************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/jupyterlab-manager/lib/manager.js ***! \*************************************************************************/ /*! exports provided: WIDGET_VIEW_MIMETYPE, WIDGET_STATE_MIMETYPE, BackboneViewWrapper, WidgetManager */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WIDGET_VIEW_MIMETYPE", function() { return WIDGET_VIEW_MIMETYPE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WIDGET_STATE_MIMETYPE", function() { return WIDGET_STATE_MIMETYPE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BackboneViewWrapper", function() { return BackboneViewWrapper; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WidgetManager", function() { return WidgetManager; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/signaling */ "./node_modules/@lumino/signaling/dist/index.es6.js"); /* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! semver */ "./node_modules/semver/semver.js"); /* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _semvercache__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./semvercache */ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/semvercache.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * The mime type for a widget view. */ const WIDGET_VIEW_MIMETYPE = 'application/vnd.jupyter.widget-view+json'; /** * The mime type for widget state data. */ const WIDGET_STATE_MIMETYPE = 'application/vnd.jupyter.widget-state+json'; /** * The class name added to an BackboneViewWrapper widget. */ const BACKBONEVIEWWRAPPER_CLASS = 'jp-BackboneViewWrapper'; class BackboneViewWrapper extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__["Widget"] { /** * Construct a new `Backbone` wrapper widget. * * @param view - The `Backbone.View` instance being wrapped. */ constructor(view) { super(); this._view = null; this._view = view; view.on('remove', () => { this.dispose(); }); this.addClass(BACKBONEVIEWWRAPPER_CLASS); this.node.appendChild(view.el); } onAfterAttach(msg) { this._view.trigger('displayed'); } dispose() { this._view = null; super.dispose(); } } /** * A widget manager that returns phosphor widgets. */ class WidgetManager extends _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["ManagerBase"] { constructor(context, rendermime, settings) { var _a, _b; super(); this._registry = new _semvercache__WEBPACK_IMPORTED_MODULE_4__["SemVerCache"](); this._restored = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_2__["Signal"](this); this._restoredStatus = false; this._initialRestoredStatus = false; this._modelsSync = new Map(); this._onUnhandledIOPubMessage = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_2__["Signal"](this); this._context = context; this._rendermime = rendermime; // Set _handleCommOpen so `this` is captured. this._handleCommOpen = async (comm, msg) => { let oldComm = new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["shims"].services.Comm(comm); await this.handle_comm_open(oldComm, msg); }; context.sessionContext.kernelChanged.connect((sender, args) => { this._handleKernelChanged(args); }); context.sessionContext.statusChanged.connect((sender, args) => { this._handleKernelStatusChange(args); }); context.sessionContext.connectionStatusChanged.connect((sender, args) => { this._handleKernelConnectionStatusChange(args); }); if ((_a = context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) { this._handleKernelChanged({ name: 'kernel', oldValue: null, newValue: (_b = context.sessionContext.session) === null || _b === void 0 ? void 0 : _b.kernel }); } this.restoreWidgets(this._context.model); this._settings = settings; context.saveState.connect((sender, saveState) => { if (saveState === 'started' && settings.saveState) { this._saveState(); } }); } /** * Save the widget state to the context model. */ _saveState() { const state = this.get_state_sync({ drop_defaults: true }); this._context.model.metadata.set('widgets', { 'application/vnd.jupyter.widget-state+json': state }); } /** * Default callback handler to emit unhandled kernel messages. */ callbacks(view) { return { iopub: { output: (msg) => { this._onUnhandledIOPubMessage.emit(msg); } } }; } /** * Register a new kernel */ _handleKernelChanged({ oldValue, newValue }) { if (oldValue) { oldValue.removeCommTarget(this.comm_target_name, this._handleCommOpen); } if (newValue) { newValue.registerCommTarget(this.comm_target_name, this._handleCommOpen); } } _handleKernelConnectionStatusChange(status) { if (status === 'connected') { // Only restore if our initial restore at construction is finished if (this._initialRestoredStatus) { // We only want to restore widgets from the kernel, not ones saved in the notebook. this.restoreWidgets(this._context.model, { loadKernel: true, loadNotebook: false }); } } } _handleKernelStatusChange(status) { if (status === 'restarting') { this.disconnect(); } } /** * Restore widgets from kernel and saved state. */ async restoreWidgets(notebook, { loadKernel, loadNotebook } = { loadKernel: true, loadNotebook: true }) { if (loadKernel) { await this._loadFromKernel(); } if (loadNotebook) { await this._loadFromNotebook(notebook); } this._restoredStatus = true; this._initialRestoredStatus = true; this._restored.emit(); } /** * Disconnect the widget manager from the kernel, setting each model's comm * as dead. */ disconnect() { super.disconnect(); this._restoredStatus = false; } async _loadFromKernel() { var _a; if (!this.context.sessionContext) { return; } await this.context.sessionContext.ready; if (((_a = this.context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel.handleComms) === false) { return; } return super._loadFromKernel(); } /** * Load widget state from notebook metadata */ async _loadFromNotebook(notebook) { const widget_md = notebook.metadata.get('widgets'); // Restore any widgets from saved state that are not live if (widget_md && widget_md[WIDGET_STATE_MIMETYPE]) { let state = widget_md[WIDGET_STATE_MIMETYPE]; state = this.filterExistingModelState(state); await this.set_state(state); } } /** * Return a phosphor widget representing the view */ async display_view(msg, view, options) { return view.pWidget || new BackboneViewWrapper(view); } /** * Create a comm. */ async _create_comm(target_name, model_id, data, metadata, buffers) { var _a; let kernel = (_a = this._context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel; if (!kernel) { throw new Error('No current kernel'); } let comm = kernel.createComm(target_name, model_id); if (data || metadata) { comm.open(data, metadata, buffers); } return new _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["shims"].services.Comm(comm); } /** * Get the currently-registered comms. */ async _get_comm_info() { var _a; let kernel = (_a = this._context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel; if (!kernel) { throw new Error('No current kernel'); } const reply = await kernel.requestCommInfo({ target_name: this.comm_target_name }); if (reply.content.status === 'ok') { return reply.content.comms; } else { return {}; } } /** * Get whether the manager is disposed. * * #### Notes * This is a read-only property. */ get isDisposed() { return this._context === null; } /** * Dispose the resources held by the manager. */ dispose() { if (this.isDisposed) { return; } if (this._commRegistration) { this._commRegistration.dispose(); } this._context = null; } /** * Resolve a URL relative to the current notebook location. */ async resolveUrl(url) { const partial = await this.context.urlResolver.resolveUrl(url); return this.context.urlResolver.getDownloadUrl(partial); } /** * Load a class and return a promise to the loaded object. */ async loadClass(className, moduleName, moduleVersion) { // Special-case the Jupyter base and controls packages. If we have just a // plain version, with no indication of the compatible range, prepend a ^ to // get all compatible versions. We may eventually apply this logic to all // widget modules. See issues #2006 and #2017 for more discussion. if ((moduleName === '@jupyter-widgets/base' || moduleName === '@jupyter-widgets/controls') && Object(semver__WEBPACK_IMPORTED_MODULE_3__["valid"])(moduleVersion)) { moduleVersion = `^${moduleVersion}`; } const mod = this._registry.get(moduleName, moduleVersion); if (!mod) { throw new Error(`Module ${moduleName}, semver range ${moduleVersion} is not registered as a widget module`); } let module; if (typeof mod === 'function') { module = await mod(); } else { module = await mod; } const cls = module[className]; if (!cls) { throw new Error(`Class ${className} not found in module ${moduleName}`); } return cls; } get context() { return this._context; } get rendermime() { return this._rendermime; } /** * A signal emitted when state is restored to the widget manager. * * #### Notes * This indicates that previously-unavailable widget models might be available now. */ get restored() { return this._restored; } /** * Whether the state has been restored yet or not. */ get restoredStatus() { return this._restoredStatus; } /** * A signal emitted for unhandled iopub kernel messages. * */ get onUnhandledIOPubMessage() { return this._onUnhandledIOPubMessage; } register(data) { this._registry.set(data.name, data.version, data.exports); } /** * Get a model * * #### Notes * Unlike super.get_model(), this implementation always returns a promise and * never returns undefined. The promise will reject if the model is not found. */ async get_model(model_id) { const modelPromise = super.get_model(model_id); if (modelPromise === undefined) { throw new Error('widget model not found'); } return modelPromise; } /** * Register a widget model. */ register_model(model_id, modelPromise) { super.register_model(model_id, modelPromise); // Update the synchronous model map modelPromise.then(model => { this._modelsSync.set(model_id, model); model.once('comm:close', () => { this._modelsSync.delete(model_id); }); }); this.setDirty(); } /** * Close all widgets and empty the widget state. * @return Promise that resolves when the widget state is cleared. */ async clear_state() { await super.clear_state(); this._modelsSync = new Map(); this.setDirty(); } /** * Synchronously get the state of the live widgets in the widget manager. * * This includes all of the live widget models, and follows the format given in * the @jupyter-widgets/schema package. * * @param options - The options for what state to return. * @returns Promise for a state dictionary */ get_state_sync(options = {}) { const models = []; for (let model of this._modelsSync.values()) { if (model.comm_live) { models.push(model); } } return Object(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["serialize_state"])(models, options); } /** * Set the dirty state of the notebook model if applicable. * * TODO: perhaps should also set dirty when any model changes any data */ setDirty() { if (this._settings.saveState) { this._context.model.dirty = true; } } } /***/ }), /***/ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/output.js": /*!************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/jupyterlab-manager/lib/output.js ***! \************************************************************************/ /*! exports provided: OUTPUT_WIDGET_VERSION, OutputModel, JupyterPhosphorPanelWidget, OutputView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OUTPUT_WIDGET_VERSION", function() { return OUTPUT_WIDGET_VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputModel", function() { return OutputModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JupyterPhosphorPanelWidget", function() { return JupyterPhosphorPanelWidget; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputView", function() { return OutputView; }); /* harmony import */ var _jupyter_widgets_output__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/output */ "./node_modules/@jupyter-widgets/output/lib/index.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/outputarea */ "./node_modules/@jupyterlab/outputarea/lib/index.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_3__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. const OUTPUT_WIDGET_VERSION = _jupyter_widgets_output__WEBPACK_IMPORTED_MODULE_0__["OUTPUT_WIDGET_VERSION"]; class OutputModel extends _jupyter_widgets_output__WEBPACK_IMPORTED_MODULE_0__["OutputModel"] { defaults() { return Object.assign(Object.assign({}, super.defaults()), { msg_id: '', outputs: [] }); } initialize(attributes, options) { super.initialize(attributes, options); // The output area model is trusted since widgets are only rendered in trusted contexts. this._outputs = new _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_2__["OutputAreaModel"]({ trusted: true }); this._msgHook = (msg) => { this.add(msg); return false; }; this.widget_manager.context.sessionContext.kernelChanged.connect((sender, args) => { this._handleKernelChanged(args); }); this.listenTo(this, 'change:msg_id', this.reset_msg_id); this.listenTo(this, 'change:outputs', this.setOutputs); this.setOutputs(); } /** * Register a new kernel */ _handleKernelChanged({ oldValue }) { const msgId = this.get('msg_id'); if (msgId && oldValue) { oldValue.removeMessageHook(msgId, this._msgHook); this.set('msg_id', null); } } /** * Reset the message id. */ reset_msg_id() { const kernel = this.widget_manager.context.sessionContext.session.kernel; const msgId = this.get('msg_id'); const oldMsgId = this.previous('msg_id'); // Clear any old handler. if (oldMsgId && kernel) { kernel.removeMessageHook(oldMsgId, this._msgHook); } // Register any new handler. if (msgId && kernel) { kernel.registerMessageHook(msgId, this._msgHook); } } add(msg) { let msgType = msg.header.msg_type; switch (msgType) { case 'execute_result': case 'display_data': case 'stream': case 'error': let model = msg.content; model.output_type = msgType; this._outputs.add(model); break; case 'clear_output': this.clear_output(msg.content.wait); break; default: break; } this.set('outputs', this._outputs.toJSON(), { newMessage: true }); this.save_changes(); } clear_output(wait = false) { this._outputs.clear(wait); } get outputs() { return this._outputs; } setOutputs(model, value, options) { if (!(options && options.newMessage)) { // fromJSON does not clear the existing output this.clear_output(); // fromJSON does not copy the message, so we make a deep copy this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get('outputs')))); } } } class JupyterPhosphorPanelWidget extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__["Panel"] { constructor(options) { let view = options.view; delete options.view; super(options); this._view = view; } /** * Process the phosphor message. * * Any custom phosphor widget used inside a Jupyter widget should override * the processMessage function like this. */ processMessage(msg) { super.processMessage(msg); this._view.processPhosphorMessage(msg); } /** * Dispose the widget. * * This causes the view to be destroyed as well with 'remove' */ dispose() { if (this.isDisposed) { return; } super.dispose(); if (this._view) { this._view.remove(); } this._view = null; } } class OutputView extends _jupyter_widgets_output__WEBPACK_IMPORTED_MODULE_0__["OutputView"] { _createElement(tagName) { this.pWidget = new JupyterPhosphorPanelWidget({ view: this }); return this.pWidget.node; } _setElement(el) { if (this.el || el !== this.pWidget.node) { // Boxes don't allow setting the element beyond the initial creation. throw new Error('Cannot reset the DOM element.'); } this.el = this.pWidget.node; this.$el = jquery__WEBPACK_IMPORTED_MODULE_3___default()(this.pWidget.node); } /** * Called when view is rendered. */ render() { super.render(); this._outputView = new _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_2__["OutputArea"]({ rendermime: this.model.widget_manager.rendermime, contentFactory: _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_2__["OutputArea"].defaultContentFactory, model: this.model.outputs }); // TODO: why is this a readonly property now? // this._outputView.model = this.model.outputs; // TODO: why is this on the model now? // this._outputView.trusted = true; this.pWidget.insertWidget(0, this._outputView); this.pWidget.addClass('jupyter-widgets'); this.pWidget.addClass('widget-output'); this.update(); // Set defaults. } remove() { this._outputView.dispose(); return super.remove(); } } /***/ }), /***/ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/plugin.js": /*!************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/jupyterlab-manager/lib/plugin.js ***! \************************************************************************/ /*! exports provided: registerWidgetManager, default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerWidgetManager", function() { return registerWidgetManager; }); /* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/settingregistry */ "./node_modules/@jupyterlab/settingregistry/lib/index.js"); /* harmony import */ var _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/notebook */ "./node_modules/@jupyterlab/notebook/lib/index.js"); /* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/mainmenu */ "./node_modules/@jupyterlab/mainmenu/lib/index.js"); /* harmony import */ var _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/rendermime */ "./node_modules/@jupyterlab/rendermime/lib/index.js"); /* harmony import */ var _jupyterlab_logconsole__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/logconsole */ "./node_modules/@jupyterlab/logconsole/lib/index.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/disposable */ "./node_modules/@lumino/disposable/dist/index.es6.js"); /* harmony import */ var _lumino_properties__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @lumino/properties */ "./node_modules/@lumino/properties/dist/index.es6.js"); /* harmony import */ var _renderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./renderer */ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/renderer.js"); /* harmony import */ var _manager__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./manager */ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/manager.js"); /* harmony import */ var _output__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./output */ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/output.js"); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); /* harmony import */ var _jupyter_widgets_controls_lib_version__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @jupyter-widgets/controls/lib/version */ "./node_modules/@jupyter-widgets/controls/lib/version.js"); /* harmony import */ var _jupyter_widgets_base_css_index_css__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @jupyter-widgets/base/css/index.css */ "./node_modules/@jupyter-widgets/base/css/index.css"); /* harmony import */ var _jupyter_widgets_controls_css_widgets_base_css__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @jupyter-widgets/controls/css/widgets-base.css */ "./node_modules/@jupyter-widgets/controls/css/widgets-base.css"); /* harmony import */ var _jupyterlab_services__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @jupyterlab/services */ "./node_modules/@jupyterlab/services/lib/index.js"); /* harmony import */ var _jupyterlab_services__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_services__WEBPACK_IMPORTED_MODULE_15__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. // We import only the version from the specific module in controls so that the // controls code can be split and dynamically loaded in webpack. const WIDGET_REGISTRY = []; /** * The cached settings. */ const SETTINGS = { saveState: false }; /** * Iterate through all widget renderers in a notebook. */ function* widgetRenderers(nb) { for (let cell of nb.widgets) { if (cell.model.type === 'code') { for (let codecell of cell.outputArea.widgets) { for (let output of Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__["toArray"])(codecell.children())) { if (output instanceof _renderer__WEBPACK_IMPORTED_MODULE_8__["WidgetRenderer"]) { yield output; } } } } } } /** * Iterate through all matching linked output views */ function* outputViews(app, path) { let linkedViews = Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__["filter"])(app.shell.widgets(), w => w.id.startsWith('LinkedOutputView-') && w.path === path); for (let view of Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__["toArray"])(linkedViews)) { for (let outputs of Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__["toArray"])(view.children())) { for (let output of Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__["toArray"])(outputs.children())) { if (output instanceof _renderer__WEBPACK_IMPORTED_MODULE_8__["WidgetRenderer"]) { yield output; } } } } } function* chain(...args) { for (let it of args) { yield* it; } } function registerWidgetManager(context, rendermime, renderers) { let wManager = Private.widgetManagerProperty.get(context); if (!wManager) { wManager = new _manager__WEBPACK_IMPORTED_MODULE_9__["WidgetManager"](context, rendermime, SETTINGS); WIDGET_REGISTRY.forEach(data => wManager.register(data)); Private.widgetManagerProperty.set(context, wManager); } for (let r of renderers) { r.manager = wManager; } // Replace the placeholder widget renderer with one bound to this widget // manager. rendermime.removeMimeType(_manager__WEBPACK_IMPORTED_MODULE_9__["WIDGET_VIEW_MIMETYPE"]); rendermime.addFactory({ safe: false, mimeTypes: [_manager__WEBPACK_IMPORTED_MODULE_9__["WIDGET_VIEW_MIMETYPE"]], createRenderer: (options) => new _renderer__WEBPACK_IMPORTED_MODULE_8__["WidgetRenderer"](options, wManager) }, 0); return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_6__["DisposableDelegate"](() => { if (rendermime) { rendermime.removeMimeType(_manager__WEBPACK_IMPORTED_MODULE_9__["WIDGET_VIEW_MIMETYPE"]); } wManager.dispose(); }); } /** * The widget manager provider. */ const plugin = { id: '@jupyter-widgets/jupyterlab-manager:plugin', requires: [_jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_3__["IRenderMimeRegistry"], _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_0__["ISettingRegistry"]], optional: [_jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_1__["INotebookTracker"], _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_2__["IMainMenu"], _jupyterlab_logconsole__WEBPACK_IMPORTED_MODULE_4__["ILoggerRegistry"]], provides: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["IJupyterWidgetRegistry"], activate: activateWidgetExtension, autoStart: true }; /* harmony default export */ __webpack_exports__["default"] = (plugin); function updateSettings(settings) { SETTINGS.saveState = settings.get('saveState').composite; } /** * Activate the widget extension. */ function activateWidgetExtension(app, rendermime, settingRegistry, tracker, menu, loggerRegistry) { const { commands } = app; const bindUnhandledIOPubMessageSignal = (nb) => { if (!loggerRegistry) { return; } const wManager = Private.widgetManagerProperty.get(nb.context); if (wManager) { wManager.onUnhandledIOPubMessage.connect((sender, msg) => { const logger = loggerRegistry.getLogger(nb.context.path); let level = 'warning'; if (_jupyterlab_services__WEBPACK_IMPORTED_MODULE_15__["KernelMessage"].isErrorMsg(msg) || (_jupyterlab_services__WEBPACK_IMPORTED_MODULE_15__["KernelMessage"].isStreamMsg(msg) && msg.content.name === 'stderr')) { level = 'error'; } const data = Object.assign(Object.assign({}, msg.content), { output_type: msg.header.msg_type }); logger.rendermime = nb.content.rendermime; logger.log({ type: 'output', data, level }); }); } }; settingRegistry.load(plugin.id).then((settings) => { settings.changed.connect(updateSettings); updateSettings(settings); }).catch((reason) => { console.error(reason.message); }); // Add a placeholder widget renderer. rendermime.addFactory({ safe: false, mimeTypes: [_manager__WEBPACK_IMPORTED_MODULE_9__["WIDGET_VIEW_MIMETYPE"]], createRenderer: options => new _renderer__WEBPACK_IMPORTED_MODULE_8__["WidgetRenderer"](options) }, 0); if (tracker) { tracker.forEach(panel => { registerWidgetManager(panel.context, panel.content.rendermime, chain(widgetRenderers(panel.content), outputViews(app, panel.context.path))); bindUnhandledIOPubMessageSignal(panel); }); tracker.widgetAdded.connect((sender, panel) => { registerWidgetManager(panel.context, panel.content.rendermime, chain(widgetRenderers(panel.content), outputViews(app, panel.context.path))); bindUnhandledIOPubMessageSignal(panel); }); } // Add a command for creating a new Markdown file. commands.addCommand('@jupyter-widgets/jupyterlab-manager:saveWidgetState', { label: 'Save Widget State Automatically', execute: args => { return settingRegistry .set(plugin.id, 'saveState', !SETTINGS.saveState) .catch((reason) => { console.error(`Failed to set ${plugin.id}: ${reason.message}`); }); }, isToggled: () => SETTINGS.saveState }); if (menu) { menu.settingsMenu.addGroup([ { command: '@jupyter-widgets/jupyterlab-manager:saveWidgetState' } ]); } WIDGET_REGISTRY.push({ name: '@jupyter-widgets/base', version: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["JUPYTER_WIDGETS_VERSION"], exports: { WidgetModel: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["WidgetModel"], WidgetView: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["WidgetView"], DOMWidgetView: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["DOMWidgetView"], DOMWidgetModel: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["DOMWidgetModel"], LayoutModel: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["LayoutModel"], LayoutView: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["LayoutView"], StyleModel: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["StyleModel"], StyleView: _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_11__["StyleView"] } }); WIDGET_REGISTRY.push({ name: '@jupyter-widgets/controls', version: _jupyter_widgets_controls_lib_version__WEBPACK_IMPORTED_MODULE_12__["JUPYTER_CONTROLS_VERSION"], exports: () => { return new Promise((resolve, reject) => { Promise.resolve(/*! require.ensure */).then(((require) => { resolve(__webpack_require__(/*! @jupyter-widgets/controls */ "./node_modules/@jupyter-widgets/controls/lib/index.js")); }).bind(null, __webpack_require__)).catch((err) => { reject(err); }); }); } }); WIDGET_REGISTRY.push({ name: '@jupyter-widgets/output', version: _output__WEBPACK_IMPORTED_MODULE_10__["OUTPUT_WIDGET_VERSION"], exports: { OutputModel: _output__WEBPACK_IMPORTED_MODULE_10__["OutputModel"], OutputView: _output__WEBPACK_IMPORTED_MODULE_10__["OutputView"] } }); return { registerWidget(data) { WIDGET_REGISTRY.push(data); } }; } var Private; (function (Private) { /** * A private attached property for a widget manager. */ Private.widgetManagerProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_7__["AttachedProperty"]({ name: 'widgetManager', create: () => undefined }); })(Private || (Private = {})); /***/ }), /***/ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/renderer.js": /*!**************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/jupyterlab-manager/lib/renderer.js ***! \**************************************************************************/ /*! exports provided: WidgetRenderer */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WidgetRenderer", function() { return WidgetRenderer; }); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * A renderer for widgets. */ class WidgetRenderer extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__["Panel"] { constructor(options, manager) { super(); this._manager = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["PromiseDelegate"](); this._rerenderMimeModel = null; this.mimeType = options.mimeType; if (manager) { this.manager = manager; } } /** * The widget manager. */ set manager(value) { value.restored.connect(this._rerender, this); this._manager.resolve(value); } async renderModel(model) { const source = model.data[this.mimeType]; // Let's be optimistic, and hope the widget state will come later. this.node.textContent = 'Loading widget...'; this.addClass('jupyter-widgets'); const manager = await this._manager.promise; // If there is no model id, the view was removed, so hide the node. if (source.model_id === '') { this.hide(); return Promise.resolve(); } let wModel; try { wModel = await manager.get_model(source.model_id); } catch (err) { if (manager.restoredStatus) { // The manager has been restored, so this error won't be going away. this.node.textContent = 'Error displaying widget: model not found'; this.addClass('jupyter-widgets'); console.error(err); return; } // Store the model for a possible rerender this._rerenderMimeModel = model; return; } // Successful getting the model, so we don't need to try to rerender. this._rerenderMimeModel = null; let widget; try { widget = await manager.display_model(undefined, wModel, undefined); } catch (err) { this.node.textContent = 'Error displaying widget'; this.addClass('jupyter-widgets'); console.error(err); return; } // Clear any previous loading message. this.node.textContent = ''; this.addWidget(widget); // When the widget is disposed, hide this container and make sure we // change the output model to reflect the view was closed. widget.disposed.connect(() => { this.hide(); source.model_id = ''; }); } /** * Get whether the manager is disposed. * * #### Notes * This is a read-only property. */ get isDisposed() { return this._manager === null; } /** * Dispose the resources held by the manager. */ dispose() { if (this.isDisposed) { return; } super.dispose(); this._manager = null; } _rerender() { if (this._rerenderMimeModel) { // Clear the error message this.node.textContent = ''; this.removeClass('jupyter-widgets'); // Attempt to rerender. this.renderModel(this._rerenderMimeModel); } } } /***/ }), /***/ "./node_modules/@jupyter-widgets/jupyterlab-manager/lib/semvercache.js": /*!*****************************************************************************!*\ !*** ./node_modules/@jupyter-widgets/jupyterlab-manager/lib/semvercache.js ***! \*****************************************************************************/ /*! exports provided: SemVerCache */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemVerCache", function() { return SemVerCache; }); /* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! semver */ "./node_modules/semver/semver.js"); /* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_0__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * A cache using semver ranges to retrieve values. */ class SemVerCache { constructor() { this._cache = Object.create(null); } set(key, version, object) { if (!(key in this._cache)) { this._cache[key] = Object.create(null); } if (!(version in this._cache[key])) { this._cache[key][version] = object; } else { throw `Version ${version} of key ${key} already registered.`; } } get(key, semver) { if (key in this._cache) { let versions = this._cache[key]; let best = Object(semver__WEBPACK_IMPORTED_MODULE_0__["maxSatisfying"])(Object.keys(versions), semver); return versions[best]; } } } /***/ }), /***/ "./node_modules/@jupyter-widgets/output/lib/index.js": /*!***********************************************************!*\ !*** ./node_modules/@jupyter-widgets/output/lib/index.js ***! \***********************************************************/ /*! exports provided: OUTPUT_WIDGET_VERSION, OutputModel, OutputView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _output__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./output */ "./node_modules/@jupyter-widgets/output/lib/output.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OUTPUT_WIDGET_VERSION", function() { return _output__WEBPACK_IMPORTED_MODULE_0__["OUTPUT_WIDGET_VERSION"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OutputModel", function() { return _output__WEBPACK_IMPORTED_MODULE_0__["OutputModel"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OutputView", function() { return _output__WEBPACK_IMPORTED_MODULE_0__["OutputView"]; }); /***/ }), /***/ "./node_modules/@jupyter-widgets/output/lib/output.js": /*!************************************************************!*\ !*** ./node_modules/@jupyter-widgets/output/lib/output.js ***! \************************************************************/ /*! exports provided: OUTPUT_WIDGET_VERSION, OutputModel, OutputView */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OUTPUT_WIDGET_VERSION", function() { return OUTPUT_WIDGET_VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputModel", function() { return OutputModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputView", function() { return OutputView; }); /* harmony import */ var _jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyter-widgets/base */ "./node_modules/@jupyter-widgets/base/lib/index.js"); var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (undefined && undefined.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var OUTPUT_WIDGET_VERSION = '1.0.0'; var OutputModel = /** @class */ (function (_super) { __extends(OutputModel, _super); function OutputModel() { return _super !== null && _super.apply(this, arguments) || this; } OutputModel.prototype.defaults = function () { return __assign(__assign({}, _super.prototype.defaults.call(this)), { _model_name: 'OutputModel', _view_name: 'OutputView', _model_module: '@jupyter-widgets/output', _view_module: '@jupyter-widgets/output', _model_module_version: OUTPUT_WIDGET_VERSION, _view_module_version: OUTPUT_WIDGET_VERSION }); }; return OutputModel; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetModel"])); var OutputView = /** @class */ (function (_super) { __extends(OutputView, _super); function OutputView() { return _super !== null && _super.apply(this, arguments) || this; } return OutputView; }(_jupyter_widgets_base__WEBPACK_IMPORTED_MODULE_0__["DOMWidgetView"])); /***/ }), /***/ "./node_modules/@jupyter-widgets/schema/index.js": /*!*******************************************************!*\ !*** ./node_modules/@jupyter-widgets/schema/index.js ***! \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = { v1: { state: __webpack_require__(/*! ./v1/state.schema.json */ "./node_modules/@jupyter-widgets/schema/v1/state.schema.json"), view: __webpack_require__(/*! ./v1/view.schema.json */ "./node_modules/@jupyter-widgets/schema/v1/view.schema.json") }, v2: { state: __webpack_require__(/*! ./v2/state.schema.json */ "./node_modules/@jupyter-widgets/schema/v2/state.schema.json"), view: __webpack_require__(/*! ./v2/view.schema.json */ "./node_modules/@jupyter-widgets/schema/v2/view.schema.json") }, }; /***/ }), /***/ "./node_modules/@jupyter-widgets/schema/v1/state.schema.json": /*!*******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/schema/v1/state.schema.json ***! \*******************************************************************/ /*! exports provided: $schema, description, type, properties, required, additionalProperties, default */ /***/ (function(module) { module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"description\":\"Jupyter Interactive Widget State JSON schema.\",\"type\":\"object\",\"properties\":{\"version_major\":{\"description\":\"Format version (major)\",\"type\":\"number\",\"minimum\":1,\"maximum\":1},\"version_minor\":{\"description\":\"Format version (minor)\",\"type\":\"number\"},\"state\":{\"description\":\"Model State for All Widget Models\",\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\",\"properties\":{\"model_name\":{\"description\":\"Name of the JavaScript class holding the model implementation\",\"type\":\"string\"},\"model_module\":{\"description\":\"Name of the JavaScript module holding the model implementation\",\"type\":\"string\"},\"model_module_version\":{\"description\":\"Semver range for the JavaScript module holding the model implementation\",\"type\":\"string\"},\"state\":{\"description\":\"Serialized state of the model\",\"type\":\"object\",\"additional_properties\":true}},\"required\":[\"model_name\",\"model_module\",\"state\"],\"additionalProperties\":false}}},\"required\":[\"version_major\",\"version_minor\",\"state\"],\"additionalProperties\":false}"); /***/ }), /***/ "./node_modules/@jupyter-widgets/schema/v1/view.schema.json": /*!******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/schema/v1/view.schema.json ***! \******************************************************************/ /*! exports provided: $schema, description, type, properties, required, additionalProperties, default */ /***/ (function(module) { module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"description\":\"Jupyter Interactive Widget View JSON schema.\",\"type\":\"object\",\"properties\":{\"version_major\":{\"description\":\"Format version (major)\",\"type\":\"number\",\"minimum\":1,\"maximum\":1},\"version_minor\":{\"description\":\"Format version (minor)\",\"type\":\"number\"},\"model_id\":{\"description\":\"Unique identifier of the widget model to be displayed\",\"type\":\"string\"}},\"required\":[\"model_id\"],\"additionalProperties\":false}"); /***/ }), /***/ "./node_modules/@jupyter-widgets/schema/v2/state.schema.json": /*!*******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/schema/v2/state.schema.json ***! \*******************************************************************/ /*! exports provided: $schema, description, type, properties, required, default */ /***/ (function(module) { module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"description\":\"Jupyter Interactive Widget State JSON schema.\",\"type\":\"object\",\"properties\":{\"version_major\":{\"description\":\"Format version (major)\",\"type\":\"number\",\"minimum\":2,\"maximum\":2},\"version_minor\":{\"description\":\"Format version (minor)\",\"type\":\"number\",\"minimum\":0,\"maximum\":0},\"state\":{\"description\":\"Model State for All Widget Models - keys are model ids, values are model state\",\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\",\"properties\":{\"model_name\":{\"description\":\"Name of the JavaScript class holding the model implementation\",\"type\":\"string\"},\"model_module\":{\"description\":\"Name of the JavaScript module holding the model implementation\",\"type\":\"string\"},\"model_module_version\":{\"description\":\"Semver range for the JavaScript module holding the model implementation\",\"type\":\"string\"},\"state\":{\"description\":\"Serialized state of the model\",\"type\":\"object\"},\"buffers\":{\"description\":\"Binary buffers in the state\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"path\":{\"description\":\"A path for a binary buffer value.\",\"type\":\"array\",\"items\":{\"description\":\"An object key or array index\",\"type\":[\"string\",\"number\"]}},\"data\":{\"description\":\"A binary buffer encoded as specified in the 'encoding' property\",\"type\":\"string\"},\"encoding\":{\"description\":\"The encoding of the buffer data\",\"type\":\"string\",\"oneOf\":[{\"const\":\"hex\",\"description\":\"Base 16 encoding, as specified in RFC 4648, section 8 (https://tools.ietf.org/html/rfc4648#section-8)\"},{\"const\":\"base64\",\"description\":\"Base 64 encoding, as specified in RFC 4648, section 4 (https://tools.ietf.org/html/rfc4648#section-4)\"}]}},\"required\":[\"path\",\"data\",\"encoding\"]}}},\"required\":[\"model_name\",\"model_module\",\"state\"]}}},\"required\":[\"version_major\",\"version_minor\",\"state\"]}"); /***/ }), /***/ "./node_modules/@jupyter-widgets/schema/v2/view.schema.json": /*!******************************************************************!*\ !*** ./node_modules/@jupyter-widgets/schema/v2/view.schema.json ***! \******************************************************************/ /*! exports provided: $schema, description, type, properties, required, default */ /***/ (function(module) { module.exports = JSON.parse("{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"description\":\"Jupyter Interactive Widget View JSON schema.\",\"type\":\"object\",\"properties\":{\"version_major\":{\"description\":\"Format version (major)\",\"type\":\"number\",\"minimum\":2,\"maximum\":2},\"version_minor\":{\"description\":\"Format version (minor)\",\"type\":\"number\"},\"model_id\":{\"description\":\"Unique identifier of the widget model to be displayed\",\"type\":\"string\"}},\"required\":[\"model_id\"]}"); /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/clipboard.js": /*!************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/clipboard.js ***! \************************************************************/ /*! exports provided: Clipboard */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Clipboard", function() { return Clipboard; }); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * The clipboard interface. */ var Clipboard; (function (Clipboard) { /** * Get the application clipboard instance. */ function getInstance() { return Private.instance; } Clipboard.getInstance = getInstance; /** * Set the application clipboard instance. */ function setInstance(value) { Private.instance = value; } Clipboard.setInstance = setInstance; /** * Copy text to the system clipboard. * * #### Notes * This can only be called in response to a user input event. */ function copyToSystem(clipboardData) { const node = document.body; const handler = (event) => { const data = event.clipboardData || window.clipboardData; if (typeof clipboardData === 'string') { data.setData('text', clipboardData); } else { clipboardData.types().map((mimeType) => { data.setData(mimeType, clipboardData.getData(mimeType)); }); } event.preventDefault(); node.removeEventListener('copy', handler); }; node.addEventListener('copy', handler); generateEvent(node); } Clipboard.copyToSystem = copyToSystem; /** * Generate a clipboard event on a node. * * @param node - The element on which to generate the event. * * @param type - The type of event to generate. * `'paste'` events cannot be programmatically generated. * * #### Notes * This can only be called in response to a user input event. */ function generateEvent(node, type = 'copy') { // http://stackoverflow.com/a/5210367 // Identify selected text. let sel = window.getSelection(); // Save the current selection. const savedRanges = []; for (let i = 0, len = (sel === null || sel === void 0 ? void 0 : sel.rangeCount) || 0; i < len; ++i) { savedRanges[i] = sel.getRangeAt(i).cloneRange(); } // Select the node content. const range = document.createRange(); range.selectNodeContents(node); if (sel) { sel.removeAllRanges(); sel.addRange(range); } // Execute the command. document.execCommand(type); // Restore the previous selection. sel = window.getSelection(); if (sel) { sel.removeAllRanges(); for (let i = 0, len = savedRanges.length; i < len; ++i) { sel.addRange(savedRanges[i]); } } } Clipboard.generateEvent = generateEvent; })(Clipboard || (Clipboard = {})); /** * The namespace for module private data. */ var Private; (function (Private) { /** * The application clipboard instance. */ Private.instance = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["MimeData"](); })(Private || (Private = {})); //# sourceMappingURL=clipboard.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/collapse.js": /*!***********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/collapse.js ***! \***********************************************************/ /*! exports provided: Collapse */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Collapse", function() { return Collapse; }); /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/ui-components */ "./node_modules/@jupyterlab/ui-components/lib/index.js"); /* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ "./node_modules/@lumino/signaling/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * A panel that supports a collapsible header made from the widget's title. * Clicking on the title expands or contracts the widget. */ class Collapse extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"] { constructor(options) { super(options); this._collapseChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__["Signal"](this); const { widget, collapsed = true } = options; this.addClass('jp-Collapse'); this._header = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"](); this._header.addClass('jp-Collapse-header'); this._content = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Panel"](); this._content.addClass('jp-Collapse-contents'); const layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["PanelLayout"](); this.layout = layout; layout.addWidget(this._header); layout.addWidget(this._content); this.widget = widget; this.collapsed = collapsed; } /** * The widget inside the collapse panel. */ get widget() { return this._widget; } set widget(widget) { const oldWidget = this._widget; if (oldWidget) { oldWidget.title.changed.disconnect(this._onTitleChanged, this); oldWidget.parent = null; } this._widget = widget; widget.title.changed.connect(this._onTitleChanged, this); this._onTitleChanged(widget.title); this._content.addWidget(widget); } /** * The collapsed state of the panel. */ get collapsed() { return this._collapsed; } set collapsed(value) { if (value === this._collapsed) { return; } if (value) { this._collapse(); } else { this._uncollapse(); } } /** * A signal for when the widget collapse state changes. */ get collapseChanged() { return this._collapseChanged; } /** * Toggle the collapse state of the panel. */ toggle() { this.collapsed = !this.collapsed; } /** * Dispose the widget. */ dispose() { if (this.isDisposed) { return; } // Delete references we explicitly hold to other widgets. this._header = null; this._widget = null; this._content = null; super.dispose(); } /** * Handle the DOM events for the Collapse widget. * * @param event - The DOM event sent to the panel. * * #### Notes * This method implements the DOM `EventListener` interface and is * called in response to events on the panel's DOM node. It should * not be called directly by user code. */ handleEvent(event) { switch (event.type) { case 'click': this._evtClick(event); break; default: break; } } onAfterAttach(msg) { this._header.node.addEventListener('click', this); } onBeforeDetach(msg) { this._header.node.removeEventListener('click', this); } _collapse() { this._collapsed = true; if (this._content) { this._content.hide(); } this._setHeader(); this._collapseChanged.emit(void 0); } _uncollapse() { this._collapsed = false; if (this._content) { this._content.show(); } this._setHeader(); this._collapseChanged.emit(void 0); } _evtClick(event) { this.toggle(); } /** * Handle the `changed` signal of a title object. */ _onTitleChanged(sender) { this._setHeader(); } _setHeader() { (this._collapsed ? _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__["caretUpIcon"] : _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__["caretDownIcon"]).element({ container: this._header.node, label: this._widget.title.label, elementPosition: 'right', height: '28px' }); } } //# sourceMappingURL=collapse.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/commandlinker.js": /*!****************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/commandlinker.js ***! \****************************************************************/ /*! exports provided: CommandLinker */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommandLinker", function() { return CommandLinker; }); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__); /* ----------------------------------------------------------------------------- | Copyright (c) Jupyter Development Team. | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ /** * The command data attribute added to nodes that are connected. */ const COMMAND_ATTR = 'commandlinker-command'; /** * The args data attribute added to nodes that are connected. */ const ARGS_ATTR = 'commandlinker-args'; /** * A static class that provides helper methods to generate clickable nodes that * execute registered commands with pre-populated arguments. */ class CommandLinker { /** * Instantiate a new command linker. */ constructor(options) { this._isDisposed = false; this._commands = options.commands; document.body.addEventListener('click', this); } /** * Test whether the linker is disposed. */ get isDisposed() { return this._isDisposed; } /** * Dispose of the resources held by the linker. */ dispose() { if (this.isDisposed) { return; } this._isDisposed = true; document.body.removeEventListener('click', this); } /** * Connect a command/argument pair to a given node so that when it is clicked, * the command will execute. * * @param node - The node being connected. * * @param command - The command ID to execute upon click. * * @param args - The arguments with which to invoke the command. * * @returns The same node that was passed in, after it has been connected. * * #### Notes * Only `click` events will execute the command on a connected node. So, there * are two considerations that are relevant: * 1. If a node is connected, the default click action will be prevented. * 2. The `HTMLElement` passed in should be clickable. */ connectNode(node, command, args) { node.setAttribute(`data-${COMMAND_ATTR}`, command); if (args !== void 0) { node.setAttribute(`data-${ARGS_ATTR}`, JSON.stringify(args)); } return node; } /** * Disconnect a node that has been connected to execute a command on click. * * @param node - The node being disconnected. * * @returns The same node that was passed in, after it has been disconnected. * * #### Notes * This method is safe to call multiple times and is safe to call on nodes * that were never connected. * * This method can be called on rendered virtual DOM nodes that were populated * using the `populateVNodeDataset` method in order to disconnect them from * executing their command/argument pair. */ disconnectNode(node) { node.removeAttribute(`data-${COMMAND_ATTR}`); node.removeAttribute(`data-${ARGS_ATTR}`); return node; } /** * Handle the DOM events for the command linker helper class. * * @param event - The DOM event sent to the class. * * #### Notes * This method implements the DOM `EventListener` interface and is * called in response to events on the panel's DOM node. It should * not be called directly by user code. */ handleEvent(event) { switch (event.type) { case 'click': this._evtClick(event); break; default: return; } } /** * Populate the `dataset` attribute within the collection of attributes used * to instantiate a virtual DOM node with the values necessary for its * rendered DOM node to respond to clicks by executing a command/argument * pair. * * @param command - The command ID to execute upon click. * * @param args - The arguments with which to invoke the command. * * @returns A `dataset` collection for use within virtual node attributes. * * #### Notes * The return value can be used on its own as the value for the `dataset` * attribute of a virtual element, or it can be added to an existing `dataset` * as in the example below. * * #### Example * ```typescript * let command = 'some:command-id'; * let args = { alpha: 'beta' }; * let anchor = h.a({ * className: 'some-class', * dataset: { * foo: '1', * bar: '2', * ../...linker.populateVNodeDataset(command, args) * } * }, 'some text'); * ``` */ populateVNodeDataset(command, args) { let dataset; if (args !== void 0) { dataset = { [ARGS_ATTR]: JSON.stringify(args), [COMMAND_ATTR]: command }; } else { dataset = { [COMMAND_ATTR]: command }; } return dataset; } /** * The global click handler that deploys commands/argument pairs that are * attached to the node being clicked. */ _evtClick(event) { let target = event.target; while (target && target.parentElement) { if (target.hasAttribute(`data-${COMMAND_ATTR}`)) { event.preventDefault(); const command = target.getAttribute(`data-${COMMAND_ATTR}`); if (!command) { return; } const argsValue = target.getAttribute(`data-${ARGS_ATTR}`); let args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["JSONExt"].emptyObject; if (argsValue) { args = JSON.parse(argsValue); } void this._commands.execute(command, args); return; } target = target.parentElement; } } } //# sourceMappingURL=commandlinker.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/commandpalette.js": /*!*****************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/commandpalette.js ***! \*****************************************************************/ /*! exports provided: ICommandPalette, ModalCommandPalette */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ICommandPalette", function() { return ICommandPalette; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ModalCommandPalette", function() { return ModalCommandPalette; }); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/ui-components */ "./node_modules/@jupyterlab/ui-components/lib/index.js"); /* ----------------------------------------------------------------------------- | Copyright (c) Jupyter Development Team. | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ /* tslint:disable */ /** * The command palette token. */ const ICommandPalette = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["Token"]('@jupyterlab/apputils:ICommandPalette'); /** * Class name identifying the input group with search icon. */ const SEARCH_ICON_GROUP_CLASS = 'jp-SearchIconGroup'; /** * Wrap the command palette in a modal to make it more usable. */ class ModalCommandPalette extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__["Panel"] { constructor(options) { super(); this.addClass('jp-ModalCommandPalette'); this.id = 'modal-command-palette'; this.palette = options.commandPalette; this._commandPalette.commands.commandExecuted.connect(() => { if (this.isAttached && this.isVisible) { this.hideAndReset(); } }); // required to properly receive blur and focus events; // selection of items with mouse may not work without this. this.node.tabIndex = 0; } get palette() { return this._commandPalette; } set palette(value) { this._commandPalette = value; if (!this.searchIconGroup) { this._commandPalette.inputNode.insertAdjacentElement('afterend', this.createSearchIconGroup()); } this.addWidget(value); this.hideAndReset(); } attach() { _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__["Widget"].attach(this, document.body); } detach() { _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__["Widget"].detach(this); } /** * Hide the modal command palette and reset its search. */ hideAndReset() { this.hide(); this._commandPalette.inputNode.value = ''; this._commandPalette.refresh(); } /** * Handle incoming events. */ handleEvent(event) { switch (event.type) { case 'keydown': this._evtKeydown(event); break; case 'blur': { // if the focus shifted outside of this DOM element, hide and reset. if ( // focus went away from child element this.node.contains(event.target) && // and it did NOT go to another child element but someplace else !this.node.contains(event.relatedTarget)) { event.stopPropagation(); this.hideAndReset(); } break; } case 'contextmenu': event.preventDefault(); event.stopPropagation(); break; default: break; } } /** * Find the element with search icon group. */ get searchIconGroup() { return this._commandPalette.node.getElementsByClassName(SEARCH_ICON_GROUP_CLASS)[0]; } /** * Create element with search icon group. */ createSearchIconGroup() { const inputGroup = document.createElement('div'); inputGroup.classList.add(SEARCH_ICON_GROUP_CLASS); _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__["searchIcon"].render(inputGroup); return inputGroup; } /** * A message handler invoked on an `'after-attach'` message. */ onAfterAttach(msg) { this.node.addEventListener('keydown', this, true); this.node.addEventListener('contextmenu', this, true); } /** * A message handler invoked on an `'after-detach'` message. */ onAfterDetach(msg) { this.node.removeEventListener('keydown', this, true); this.node.removeEventListener('contextmenu', this, true); } onBeforeHide(msg) { document.removeEventListener('blur', this, true); } onAfterShow(msg) { document.addEventListener('blur', this, true); } /** * A message handler invoked on an `'activate-request'` message. */ onActivateRequest(msg) { if (this.isAttached) { this.show(); this._commandPalette.activate(); } } /** * Handle the `'keydown'` event for the widget. */ _evtKeydown(event) { // Check for escape key switch (event.keyCode) { case 27: // Escape. event.stopPropagation(); event.preventDefault(); this.hideAndReset(); break; default: break; } } } //# sourceMappingURL=commandpalette.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/dialog.js": /*!*********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/dialog.js ***! \*********************************************************/ /*! exports provided: showDialog, showErrorMessage, Dialog */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showDialog", function() { return showDialog; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showErrorMessage", function() { return showErrorMessage; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Dialog", function() { return Dialog; }); /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/ui-components */ "./node_modules/@jupyterlab/ui-components/lib/index.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/messaging */ "./node_modules/@lumino/messaging/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _styling__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./styling */ "./node_modules/@jupyterlab/apputils/lib/styling.js"); /* harmony import */ var _vdom__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vdom */ "./node_modules/@jupyterlab/apputils/lib/vdom.js"); /* harmony import */ var _widgettracker__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./widgettracker */ "./node_modules/@jupyterlab/apputils/lib/widgettracker.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * Create and show a dialog. * * @param options - The dialog setup options. * * @returns A promise that resolves with whether the dialog was accepted. */ function showDialog(options = {}) { const dialog = new Dialog(options); return dialog.launch(); } /** * Show an error message dialog. * * @param title - The title of the dialog box. * * @param error - the error to show in the dialog body (either a string * or an object with a string `message` property). */ function showErrorMessage(title, error, buttons = [ Dialog.okButton({ label: 'Dismiss' }) ]) { console.warn('Showing error:', error); // Cache promises to prevent multiple copies of identical dialogs showing // to the user. const body = typeof error === 'string' ? error : error.message; const key = title + '----' + body; const promise = Private.errorMessagePromiseCache.get(key); if (promise) { return promise; } else { const dialogPromise = showDialog({ title: title, body: body, buttons: buttons }).then(() => { Private.errorMessagePromiseCache.delete(key); }, error => { // TODO: Use .finally() above when supported Private.errorMessagePromiseCache.delete(key); throw error; }); Private.errorMessagePromiseCache.set(key, dialogPromise); return dialogPromise; } } /** * A modal dialog widget. */ class Dialog extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"] { /** * Create a dialog panel instance. * * @param options - The dialog setup options. */ constructor(options = {}) { super(); this._focusNodeSelector = ''; this.addClass('jp-Dialog'); const normalized = Private.handleOptions(options); const renderer = normalized.renderer; this._host = normalized.host; this._defaultButton = normalized.defaultButton; this._buttons = normalized.buttons; this._hasClose = normalized.hasClose; this._buttonNodes = Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_1__["toArray"])(Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_1__["map"])(this._buttons, button => { return renderer.createButtonNode(button); })); this._lastMouseDownInDialog = false; const layout = (this.layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["PanelLayout"]()); const content = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Panel"](); content.addClass('jp-Dialog-content'); if (typeof options.body === 'string') { content.addClass('jp-Dialog-content-small'); } layout.addWidget(content); this._body = normalized.body; const header = renderer.createHeader(normalized.title, () => this.reject(), options); const body = renderer.createBody(normalized.body); const footer = renderer.createFooter(this._buttonNodes); content.addWidget(header); content.addWidget(body); content.addWidget(footer); this._primary = this._buttonNodes[this._defaultButton]; this._focusNodeSelector = options.focusNodeSelector; // Add new dialogs to the tracker. void Dialog.tracker.add(this); } /** * Dispose of the resources used by the dialog. */ dispose() { const promise = this._promise; if (promise) { this._promise = null; promise.reject(void 0); _lumino_algorithm__WEBPACK_IMPORTED_MODULE_1__["ArrayExt"].removeFirstOf(Private.launchQueue, promise.promise); } super.dispose(); } /** * Launch the dialog as a modal window. * * @returns a promise that resolves with the result of the dialog. */ launch() { // Return the existing dialog if already open. if (this._promise) { return this._promise.promise; } const promise = (this._promise = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__["PromiseDelegate"]()); const promises = Promise.all(Private.launchQueue); Private.launchQueue.push(this._promise.promise); return promises.then(() => { // Do not show Dialog if it was disposed of before it was at the front of the launch queue if (!this._promise) { return Promise.resolve({ button: Dialog.cancelButton(), value: null }); } _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"].attach(this, this._host); return promise.promise; }); } /** * Resolve the current dialog. * * @param index - An optional index to the button to resolve. * * #### Notes * Will default to the defaultIndex. * Will resolve the current `show()` with the button value. * Will be a no-op if the dialog is not shown. */ resolve(index) { if (!this._promise) { return; } if (index === undefined) { index = this._defaultButton; } this._resolve(this._buttons[index]); } /** * Reject the current dialog with a default reject value. * * #### Notes * Will be a no-op if the dialog is not shown. */ reject() { if (!this._promise) { return; } this._resolve(Dialog.cancelButton()); } /** * Handle the DOM events for the directory listing. * * @param event - The DOM event sent to the widget. * * #### Notes * This method implements the DOM `EventListener` interface and is * called in response to events on the panel's DOM node. It should * not be called directly by user code. */ handleEvent(event) { switch (event.type) { case 'keydown': this._evtKeydown(event); break; case 'mousedown': this._evtMouseDown(event); break; case 'click': this._evtClick(event); break; case 'focus': this._evtFocus(event); break; case 'contextmenu': event.preventDefault(); event.stopPropagation(); break; default: break; } } /** * A message handler invoked on an `'after-attach'` message. */ onAfterAttach(msg) { const node = this.node; node.addEventListener('keydown', this, true); node.addEventListener('contextmenu', this, true); node.addEventListener('click', this, true); document.addEventListener('mousedown', this, true); document.addEventListener('focus', this, true); this._first = Private.findFirstFocusable(this.node); this._original = document.activeElement; if (this._focusNodeSelector) { const body = this.node.querySelector('.jp-Dialog-body'); const el = body === null || body === void 0 ? void 0 : body.querySelector(this._focusNodeSelector); if (el) { this._primary = el; } } this._primary.focus(); } /** * A message handler invoked on an `'after-detach'` message. */ onAfterDetach(msg) { const node = this.node; node.removeEventListener('keydown', this, true); node.removeEventListener('contextmenu', this, true); node.removeEventListener('click', this, true); document.removeEventListener('focus', this, true); document.removeEventListener('mousedown', this, true); this._original.focus(); } /** * A message handler invoked on a `'close-request'` message. */ onCloseRequest(msg) { if (this._promise) { this.reject(); } super.onCloseRequest(msg); } /** * Handle the `'click'` event for a dialog button. * * @param event - The DOM event sent to the widget */ _evtClick(event) { const content = this.node.getElementsByClassName('jp-Dialog-content')[0]; if (!content.contains(event.target)) { event.stopPropagation(); event.preventDefault(); if (this._hasClose && !this._lastMouseDownInDialog) { this.reject(); } return; } for (const buttonNode of this._buttonNodes) { if (buttonNode.contains(event.target)) { const index = this._buttonNodes.indexOf(buttonNode); this.resolve(index); } } } /** * Handle the `'keydown'` event for the widget. * * @param event - The DOM event sent to the widget */ _evtKeydown(event) { // Check for escape key switch (event.keyCode) { case 27: // Escape. event.stopPropagation(); event.preventDefault(); if (this._hasClose) { this.reject(); } break; case 37: { // Left arrow const activeEl = document.activeElement; if (activeEl instanceof HTMLButtonElement) { let idx = this._buttonNodes.indexOf(activeEl) - 1; // Handle a left arrows on the first button if (idx < 0) { idx = this._buttonNodes.length - 1; } const node = this._buttonNodes[idx]; event.stopPropagation(); event.preventDefault(); node.focus(); } break; } case 39: { // Right arrow const activeEl = document.activeElement; if (activeEl instanceof HTMLButtonElement) { let idx = this._buttonNodes.indexOf(activeEl) + 1; // Handle a right arrows on the last button if (idx == this._buttons.length) { idx = 0; } const node = this._buttonNodes[idx]; event.stopPropagation(); event.preventDefault(); node.focus(); } break; } case 9: { // Tab. // Handle a tab on the last button. const node = this._buttonNodes[this._buttons.length - 1]; if (document.activeElement === node && !event.shiftKey) { event.stopPropagation(); event.preventDefault(); this._first.focus(); } break; } case 13: { // Enter. event.stopPropagation(); event.preventDefault(); const activeEl = document.activeElement; let index; if (activeEl instanceof HTMLButtonElement) { index = this._buttonNodes.indexOf(activeEl); } this.resolve(index); break; } default: break; } } /** * Handle the `'focus'` event for the widget. * * @param event - The DOM event sent to the widget */ _evtFocus(event) { const target = event.target; if (!this.node.contains(target)) { event.stopPropagation(); this._buttonNodes[this._defaultButton].focus(); } } /** * Handle the `'mousedown'` event for the widget. * * @param event - The DOM event sent to the widget */ _evtMouseDown(event) { const content = this.node.getElementsByClassName('jp-Dialog-content')[0]; const target = event.target; this._lastMouseDownInDialog = content.contains(target); } /** * Resolve a button item. */ _resolve(button) { // Prevent loopback. const promise = this._promise; if (!promise) { this.dispose(); return; } this._promise = null; _lumino_algorithm__WEBPACK_IMPORTED_MODULE_1__["ArrayExt"].removeFirstOf(Private.launchQueue, promise.promise); const body = this._body; let value = null; if (button.accept && body instanceof _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"] && typeof body.getValue === 'function') { value = body.getValue(); } this.dispose(); promise.resolve({ button, value }); } } /** * The namespace for Dialog class statics. */ (function (Dialog) { /** * Create a button item. */ function createButton(value) { value.accept = value.accept !== false; const defaultLabel = value.accept ? 'OK' : 'Cancel'; return { label: value.label || defaultLabel, iconClass: value.iconClass || '', iconLabel: value.iconLabel || '', caption: value.caption || '', className: value.className || '', accept: value.accept, actions: value.actions || [], displayType: value.displayType || 'default' }; } Dialog.createButton = createButton; /** * Create a reject button. */ function cancelButton(options = {}) { options.accept = false; return createButton(options); } Dialog.cancelButton = cancelButton; /** * Create an accept button. */ function okButton(options = {}) { options.accept = true; return createButton(options); } Dialog.okButton = okButton; /** * Create a warn button. */ function warnButton(options = {}) { options.displayType = 'warn'; return createButton(options); } Dialog.warnButton = warnButton; /** * Disposes all dialog instances. * * #### Notes * This function should only be used in tests or cases where application state * may be discarded. */ function flush() { Dialog.tracker.forEach(dialog => { dialog.dispose(); }); } Dialog.flush = flush; /** * The default implementation of a dialog renderer. */ class Renderer { /** * Create the header of the dialog. * * @param title - The title of the dialog. * * @returns A widget for the dialog header. */ createHeader(title, reject = () => { /* empty */ }, options = {}) { let header; const handleMouseDown = (event) => { // Fire action only when left button is pressed. if (event.button === 0) { event.preventDefault(); reject(); } }; const handleKeyDown = (event) => { const { key } = event; if (key === 'Enter' || key === ' ') { reject(); } }; if (typeof title === 'string') { header = _vdom__WEBPACK_IMPORTED_MODULE_7__["ReactWidget"].create(react__WEBPACK_IMPORTED_MODULE_5__["createElement"](react__WEBPACK_IMPORTED_MODULE_5__["Fragment"], null, title, options.hasClose && (react__WEBPACK_IMPORTED_MODULE_5__["createElement"](_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__["Button"], { className: "jp-Dialog-close-button", onMouseDown: handleMouseDown, onKeyDown: handleKeyDown, title: "Cancel", minimal: true }, react__WEBPACK_IMPORTED_MODULE_5__["createElement"](_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__["LabIcon"].resolveReact, { icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__["closeIcon"], iconClass: "jp-Icon", className: "jp-ToolbarButtonComponent-icon", tag: "span" }))))); } else { header = _vdom__WEBPACK_IMPORTED_MODULE_7__["ReactWidget"].create(title); } header.addClass('jp-Dialog-header'); _styling__WEBPACK_IMPORTED_MODULE_6__["Styling"].styleNode(header.node); return header; } /** * Create the body of the dialog. * * @param value - The input value for the body. * * @returns A widget for the body. */ createBody(value) { let body; if (typeof value === 'string') { body = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"]({ node: document.createElement('span') }); body.node.textContent = value; } else if (value instanceof _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"]) { body = value; } else { body = _vdom__WEBPACK_IMPORTED_MODULE_7__["ReactWidget"].create(value); // Immediately update the body even though it has not yet attached in // order to trigger a render of the DOM nodes from the React element. _lumino_messaging__WEBPACK_IMPORTED_MODULE_3__["MessageLoop"].sendMessage(body, _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"].Msg.UpdateRequest); } body.addClass('jp-Dialog-body'); _styling__WEBPACK_IMPORTED_MODULE_6__["Styling"].styleNode(body.node); return body; } /** * Create the footer of the dialog. * * @param buttonNodes - The buttons nodes to add to the footer. * * @returns A widget for the footer. */ createFooter(buttons) { const footer = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__["Widget"](); footer.addClass('jp-Dialog-footer'); Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_1__["each"])(buttons, button => { footer.node.appendChild(button); }); _styling__WEBPACK_IMPORTED_MODULE_6__["Styling"].styleNode(footer.node); return footer; } /** * Create a button node for the dialog. * * @param button - The button data. * * @returns A node for the button. */ createButtonNode(button) { const e = document.createElement('button'); e.className = this.createItemClass(button); e.appendChild(this.renderIcon(button)); e.appendChild(this.renderLabel(button)); return e; } /** * Create the class name for the button. * * @param data - The data to use for the class name. * * @returns The full class name for the button. */ createItemClass(data) { // Setup the initial class name. let name = 'jp-Dialog-button'; // Add the other state classes. if (data.accept) { name += ' jp-mod-accept'; } else { name += ' jp-mod-reject'; } if (data.displayType === 'warn') { name += ' jp-mod-warn'; } // Add the extra class. const extra = data.className; if (extra) { name += ` ${extra}`; } // Return the complete class name. return name; } /** * Render an icon element for a dialog item. * * @param data - The data to use for rendering the icon. * * @returns An HTML element representing the icon. */ renderIcon(data) { const e = document.createElement('div'); e.className = this.createIconClass(data); e.appendChild(document.createTextNode(data.iconLabel)); return e; } /** * Create the class name for the button icon. * * @param data - The data to use for the class name. * * @returns The full class name for the item icon. */ createIconClass(data) { const name = 'jp-Dialog-buttonIcon'; const extra = data.iconClass; return extra ? `${name} ${extra}` : name; } /** * Render the label element for a button. * * @param data - The data to use for rendering the label. * * @returns An HTML element representing the item label. */ renderLabel(data) { const e = document.createElement('div'); e.className = 'jp-Dialog-buttonLabel'; e.title = data.caption; e.appendChild(document.createTextNode(data.label)); return e; } } Dialog.Renderer = Renderer; /** * The default renderer instance. */ Dialog.defaultRenderer = new Renderer(); /** * The dialog widget tracker. */ Dialog.tracker = new _widgettracker__WEBPACK_IMPORTED_MODULE_8__["WidgetTracker"]({ namespace: '@jupyterlab/apputils:Dialog' }); })(Dialog || (Dialog = {})); /** * The namespace for module private data. */ var Private; (function (Private) { /** * The queue for launching dialogs. */ Private.launchQueue = []; Private.errorMessagePromiseCache = new Map(); /** * Handle the input options for a dialog. * * @param options - The input options. * * @returns A new options object with defaults applied. */ function handleOptions(options = {}) { var _a, _b, _c, _d, _e, _f, _g, _h; const buttons = (_a = options.buttons) !== null && _a !== void 0 ? _a : [ Dialog.cancelButton(), Dialog.okButton() ]; return { title: (_b = options.title) !== null && _b !== void 0 ? _b : '', body: (_c = options.body) !== null && _c !== void 0 ? _c : '', host: (_d = options.host) !== null && _d !== void 0 ? _d : document.body, buttons, defaultButton: (_e = options.defaultButton) !== null && _e !== void 0 ? _e : buttons.length - 1, renderer: (_f = options.renderer) !== null && _f !== void 0 ? _f : Dialog.defaultRenderer, focusNodeSelector: (_g = options.focusNodeSelector) !== null && _g !== void 0 ? _g : '', hasClose: (_h = options.hasClose) !== null && _h !== void 0 ? _h : true }; } Private.handleOptions = handleOptions; /** * Find the first focusable item in the dialog. */ function findFirstFocusable(node) { const candidateSelectors = [ 'input', 'select', 'a[href]', 'textarea', 'button', '[tabindex]' ].join(','); return node.querySelectorAll(candidateSelectors)[0]; } Private.findFirstFocusable = findFirstFocusable; })(Private || (Private = {})); //# sourceMappingURL=dialog.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/domutils.js": /*!***********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/domutils.js ***! \***********************************************************/ /*! exports provided: DOMUtils */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMUtils", function() { return DOMUtils; }); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _lumino_domutils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/domutils */ "./node_modules/@lumino/domutils/dist/index.es6.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * The namespace for DOM utilities. */ var DOMUtils; (function (DOMUtils) { /** * Get the index of the node at a client position, or `-1`. */ function hitTestNodes(nodes, x, y) { return _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__["ArrayExt"].findFirstIndex(nodes, node => { return _lumino_domutils__WEBPACK_IMPORTED_MODULE_2__["ElementExt"].hitTest(node, x, y); }); } DOMUtils.hitTestNodes = hitTestNodes; /** * Find the first element matching a class name. */ function findElement(parent, className) { return parent.querySelector(`.${className}`); } DOMUtils.findElement = findElement; /** * Find the first element matching a class name. */ function findElements(parent, className) { return parent.getElementsByClassName(className); } DOMUtils.findElements = findElements; /** * Create a DOM id with prefix "id-" to solve bug for UUIDs beginning with numbers. */ function createDomID() { return `id-${_lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__["UUID"].uuid4()}`; } DOMUtils.createDomID = createDomID; })(DOMUtils || (DOMUtils = {})); //# sourceMappingURL=domutils.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/hoverbox.js": /*!***********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/hoverbox.js ***! \***********************************************************/ /*! exports provided: HoverBox */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HoverBox", function() { return HoverBox; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * The class name added to all hover boxes. */ const HOVERBOX_CLASS = 'jp-HoverBox'; /** * The class name added to a hovering node that is scrolled out of view. */ const OUTOFVIEW_CLASS = 'jp-mod-outofview'; /** * A namespace for `HoverBox` members. */ var HoverBox; (function (HoverBox) { /** * Set the visible dimensions of a hovering box anchored to an editor cursor. * * @param options - The hover box geometry calculation options. */ function setGeometry(options) { const { anchor, host, node, privilege } = options; // Add hover box class if it does not exist. node.classList.add(HOVERBOX_CLASS); // Hide the hover box before querying the DOM for the anchor coordinates. node.classList.add(OUTOFVIEW_CLASS); // If the current coordinates are not visible, bail. if (!host.contains(document.elementFromPoint(anchor.left, anchor.top))) { return; } // Clear any previously set max-height. node.style.maxHeight = ''; // Clear any programmatically set margin-top. node.style.marginTop = ''; // Make sure the node is visible so that its dimensions can be queried. node.classList.remove(OUTOFVIEW_CLASS); const style = options.style || window.getComputedStyle(node); const innerHeight = window.innerHeight; const spaceAbove = anchor.top; const spaceBelow = innerHeight - anchor.bottom; const marginTop = parseInt(style.marginTop, 10) || 0; const minHeight = parseInt(style.minHeight, 10) || options.minHeight; let maxHeight = parseInt(style.maxHeight, 10) || options.maxHeight; // Determine whether to render above or below; check privilege. const renderBelow = privilege === 'forceAbove' ? false : privilege === 'forceBelow' ? true : privilege === 'above' ? spaceAbove < maxHeight && spaceAbove < spaceBelow : spaceBelow >= maxHeight || spaceBelow >= spaceAbove; if (renderBelow) { maxHeight = Math.min(spaceBelow - marginTop, maxHeight); } else { maxHeight = Math.min(spaceAbove, maxHeight); // If the box renders above the text, its top margin is irrelevant. node.style.marginTop = '0px'; } node.style.maxHeight = `${maxHeight}px`; // Make sure the box ought to be visible. const withinBounds = maxHeight > minHeight && (spaceBelow >= minHeight || spaceAbove >= minHeight); if (!withinBounds) { node.classList.add(OUTOFVIEW_CLASS); return; } // Position the box vertically. const offsetAbove = (options.offset && options.offset.vertical && options.offset.vertical.above) || 0; const offsetBelow = (options.offset && options.offset.vertical && options.offset.vertical.below) || 0; const top = renderBelow ? innerHeight - spaceBelow + offsetBelow : spaceAbove - node.getBoundingClientRect().height + offsetAbove; node.style.top = `${Math.floor(top)}px`; // Position the box horizontally. const offsetHorizontal = (options.offset && options.offset.horizontal) || 0; let left = anchor.left + offsetHorizontal; node.style.left = `${Math.ceil(left)}px`; node.style.width = 'auto'; // Expand the menu width by the scrollbar size, if present. if (node.scrollHeight >= maxHeight) { node.style.width = `${2 * node.offsetWidth - node.clientWidth}`; node.scrollTop = 0; } // Move left to fit in the window. const right = node.getBoundingClientRect().right; if (right > window.innerWidth) { left -= right - window.innerWidth; node.style.left = `${Math.ceil(left)}px`; } } HoverBox.setGeometry = setGeometry; })(HoverBox || (HoverBox = {})); //# sourceMappingURL=hoverbox.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/iframe.js": /*!*********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/iframe.js ***! \*********************************************************/ /*! exports provided: IFrame */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IFrame", function() { return IFrame; }); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * A phosphor widget which wraps an IFrame. */ class IFrame extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__["Widget"] { /** * Create a new IFrame widget. */ constructor(options = {}) { super({ node: Private.createNode() }); this._sandbox = []; this.addClass('jp-IFrame'); this.sandbox = options.sandbox || []; this.referrerPolicy = options.referrerPolicy || 'no-referrer'; } /** * Referrer policy for the iframe. * * #### Notes * By default, `no-referrer` is chosen. * * For more information, see * https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy */ get referrerPolicy() { return this._referrerPolicy; } set referrerPolicy(value) { if (this._referrerPolicy === value) { return; } this._referrerPolicy = value; const iframe = this.node.querySelector('iframe'); iframe.setAttribute('referrerpolicy', value); } /** * Exceptions to the sandboxing. * * #### Notes * By default, all sandboxing security policies are enabled. * This setting allows the user to selectively disable these * policies. This should be done with care, as it can * introduce security risks, and possibly allow malicious * sites to execute code in a JupyterLab session. * * For more information, see * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe */ get sandbox() { return this._sandbox.slice(); } set sandbox(values) { this._sandbox = values.slice(); const iframe = this.node.querySelector('iframe'); const exceptions = values.length ? values.join(' ') : ''; iframe.setAttribute('sandbox', exceptions); } /** * The url of the IFrame. */ get url() { return this.node.querySelector('iframe').getAttribute('src') || ''; } set url(url) { this.node.querySelector('iframe').setAttribute('src', url); } } /** * A namespace for private data. */ var Private; (function (Private) { /** * Create the main content node of an iframe widget. */ function createNode() { const node = document.createElement('div'); const iframe = document.createElement('iframe'); iframe.setAttribute('sandbox', ''); iframe.style.height = '100%'; iframe.style.width = '100%'; node.appendChild(iframe); return node; } Private.createNode = createNode; })(Private || (Private = {})); //# sourceMappingURL=iframe.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/index.js": /*!********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/index.js ***! \********************************************************/ /*! exports provided: Clipboard, Collapse, CommandLinker, ICommandPalette, ModalCommandPalette, showDialog, showErrorMessage, Dialog, DOMUtils, HoverBox, IFrame, InputDialog, MainAreaWidget, MenuFactory, Printing, Sanitizer, defaultSanitizer, FilterBox, FilenameSearcher, SessionContext, sessionContextDialogs, Spinner, ISplashScreen, Styling, ThemeManager, ISessionContextDialogs, IThemeManager, ISanitizer, IToolbarWidgetRegistry, createToolbarFactory, ToolbarWidgetRegistry, createDefaultFactory, Toolbar, ReactiveToolbar, ToolbarButtonComponent, addToolbarButtonClass, ToolbarButton, CommandToolbarButtonComponent, addCommandToolbarButtonClass, CommandToolbarButton, ReactWidget, VDomRenderer, UseSignal, VDomModel, WidgetTracker, IWindowResolver, WindowResolver, translateKernelStatuses */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _clipboard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./clipboard */ "./node_modules/@jupyterlab/apputils/lib/clipboard.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Clipboard", function() { return _clipboard__WEBPACK_IMPORTED_MODULE_0__["Clipboard"]; }); /* harmony import */ var _collapse__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./collapse */ "./node_modules/@jupyterlab/apputils/lib/collapse.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Collapse", function() { return _collapse__WEBPACK_IMPORTED_MODULE_1__["Collapse"]; }); /* harmony import */ var _commandlinker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commandlinker */ "./node_modules/@jupyterlab/apputils/lib/commandlinker.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandLinker", function() { return _commandlinker__WEBPACK_IMPORTED_MODULE_2__["CommandLinker"]; }); /* harmony import */ var _commandpalette__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./commandpalette */ "./node_modules/@jupyterlab/apputils/lib/commandpalette.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ICommandPalette", function() { return _commandpalette__WEBPACK_IMPORTED_MODULE_3__["ICommandPalette"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ModalCommandPalette", function() { return _commandpalette__WEBPACK_IMPORTED_MODULE_3__["ModalCommandPalette"]; }); /* harmony import */ var _dialog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dialog */ "./node_modules/@jupyterlab/apputils/lib/dialog.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "showDialog", function() { return _dialog__WEBPACK_IMPORTED_MODULE_4__["showDialog"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "showErrorMessage", function() { return _dialog__WEBPACK_IMPORTED_MODULE_4__["showErrorMessage"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Dialog", function() { return _dialog__WEBPACK_IMPORTED_MODULE_4__["Dialog"]; }); /* harmony import */ var _domutils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./domutils */ "./node_modules/@jupyterlab/apputils/lib/domutils.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DOMUtils", function() { return _domutils__WEBPACK_IMPORTED_MODULE_5__["DOMUtils"]; }); /* harmony import */ var _hoverbox__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./hoverbox */ "./node_modules/@jupyterlab/apputils/lib/hoverbox.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HoverBox", function() { return _hoverbox__WEBPACK_IMPORTED_MODULE_6__["HoverBox"]; }); /* harmony import */ var _iframe__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./iframe */ "./node_modules/@jupyterlab/apputils/lib/iframe.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IFrame", function() { return _iframe__WEBPACK_IMPORTED_MODULE_7__["IFrame"]; }); /* harmony import */ var _inputdialog__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./inputdialog */ "./node_modules/@jupyterlab/apputils/lib/inputdialog.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InputDialog", function() { return _inputdialog__WEBPACK_IMPORTED_MODULE_8__["InputDialog"]; }); /* harmony import */ var _mainareawidget__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./mainareawidget */ "./node_modules/@jupyterlab/apputils/lib/mainareawidget.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MainAreaWidget", function() { return _mainareawidget__WEBPACK_IMPORTED_MODULE_9__["MainAreaWidget"]; }); /* harmony import */ var _menufactory__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./menufactory */ "./node_modules/@jupyterlab/apputils/lib/menufactory.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MenuFactory", function() { return _menufactory__WEBPACK_IMPORTED_MODULE_10__["MenuFactory"]; }); /* harmony import */ var _printing__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./printing */ "./node_modules/@jupyterlab/apputils/lib/printing.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Printing", function() { return _printing__WEBPACK_IMPORTED_MODULE_11__["Printing"]; }); /* harmony import */ var _sanitizer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./sanitizer */ "./node_modules/@jupyterlab/apputils/lib/sanitizer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Sanitizer", function() { return _sanitizer__WEBPACK_IMPORTED_MODULE_12__["Sanitizer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultSanitizer", function() { return _sanitizer__WEBPACK_IMPORTED_MODULE_12__["defaultSanitizer"]; }); /* harmony import */ var _search__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./search */ "./node_modules/@jupyterlab/apputils/lib/search.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FilterBox", function() { return _search__WEBPACK_IMPORTED_MODULE_13__["FilterBox"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FilenameSearcher", function() { return _search__WEBPACK_IMPORTED_MODULE_13__["FilenameSearcher"]; }); /* harmony import */ var _sessioncontext__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sessioncontext */ "./node_modules/@jupyterlab/apputils/lib/sessioncontext.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SessionContext", function() { return _sessioncontext__WEBPACK_IMPORTED_MODULE_14__["SessionContext"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sessionContextDialogs", function() { return _sessioncontext__WEBPACK_IMPORTED_MODULE_14__["sessionContextDialogs"]; }); /* harmony import */ var _spinner__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./spinner */ "./node_modules/@jupyterlab/apputils/lib/spinner.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Spinner", function() { return _spinner__WEBPACK_IMPORTED_MODULE_15__["Spinner"]; }); /* harmony import */ var _splash__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./splash */ "./node_modules/@jupyterlab/apputils/lib/splash.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ISplashScreen", function() { return _splash__WEBPACK_IMPORTED_MODULE_16__["ISplashScreen"]; }); /* harmony import */ var _styling__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./styling */ "./node_modules/@jupyterlab/apputils/lib/styling.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Styling", function() { return _styling__WEBPACK_IMPORTED_MODULE_17__["Styling"]; }); /* harmony import */ var _thememanager__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./thememanager */ "./node_modules/@jupyterlab/apputils/lib/thememanager.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ThemeManager", function() { return _thememanager__WEBPACK_IMPORTED_MODULE_18__["ThemeManager"]; }); /* harmony import */ var _tokens__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./tokens */ "./node_modules/@jupyterlab/apputils/lib/tokens.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ISessionContextDialogs", function() { return _tokens__WEBPACK_IMPORTED_MODULE_19__["ISessionContextDialogs"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IThemeManager", function() { return _tokens__WEBPACK_IMPORTED_MODULE_19__["IThemeManager"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ISanitizer", function() { return _tokens__WEBPACK_IMPORTED_MODULE_19__["ISanitizer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IToolbarWidgetRegistry", function() { return _tokens__WEBPACK_IMPORTED_MODULE_19__["IToolbarWidgetRegistry"]; }); /* harmony import */ var _toolbar__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./toolbar */ "./node_modules/@jupyterlab/apputils/lib/toolbar/index.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createToolbarFactory", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["createToolbarFactory"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToolbarWidgetRegistry", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["ToolbarWidgetRegistry"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createDefaultFactory", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["createDefaultFactory"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Toolbar", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["Toolbar"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ReactiveToolbar", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["ReactiveToolbar"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToolbarButtonComponent", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["ToolbarButtonComponent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addToolbarButtonClass", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["addToolbarButtonClass"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToolbarButton", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["ToolbarButton"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandToolbarButtonComponent", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["CommandToolbarButtonComponent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addCommandToolbarButtonClass", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["addCommandToolbarButtonClass"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandToolbarButton", function() { return _toolbar__WEBPACK_IMPORTED_MODULE_20__["CommandToolbarButton"]; }); /* harmony import */ var _vdom__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./vdom */ "./node_modules/@jupyterlab/apputils/lib/vdom.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ReactWidget", function() { return _vdom__WEBPACK_IMPORTED_MODULE_21__["ReactWidget"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VDomRenderer", function() { return _vdom__WEBPACK_IMPORTED_MODULE_21__["VDomRenderer"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UseSignal", function() { return _vdom__WEBPACK_IMPORTED_MODULE_21__["UseSignal"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VDomModel", function() { return _vdom__WEBPACK_IMPORTED_MODULE_21__["VDomModel"]; }); /* harmony import */ var _widgettracker__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./widgettracker */ "./node_modules/@jupyterlab/apputils/lib/widgettracker.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WidgetTracker", function() { return _widgettracker__WEBPACK_IMPORTED_MODULE_22__["WidgetTracker"]; }); /* harmony import */ var _windowresolver__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./windowresolver */ "./node_modules/@jupyterlab/apputils/lib/windowresolver.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IWindowResolver", function() { return _windowresolver__WEBPACK_IMPORTED_MODULE_23__["IWindowResolver"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WindowResolver", function() { return _windowresolver__WEBPACK_IMPORTED_MODULE_23__["WindowResolver"]; }); /* harmony import */ var _kernelstatuses__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./kernelstatuses */ "./node_modules/@jupyterlab/apputils/lib/kernelstatuses.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "translateKernelStatuses", function() { return _kernelstatuses__WEBPACK_IMPORTED_MODULE_24__["translateKernelStatuses"]; }); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * @packageDocumentation * @module apputils */ //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/inputdialog.js": /*!**************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/inputdialog.js ***! \**************************************************************/ /*! exports provided: InputDialog */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InputDialog", function() { return InputDialog; }); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dialog */ "./node_modules/@jupyterlab/apputils/lib/dialog.js"); /* harmony import */ var _styling__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./styling */ "./node_modules/@jupyterlab/apputils/lib/styling.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. const INPUT_DIALOG_CLASS = 'jp-Input-Dialog'; const INPUT_BOOLEAN_DIALOG_CLASS = 'jp-Input-Boolean-Dialog'; /** * Namespace for input dialogs */ var InputDialog; (function (InputDialog) { /** * Create and show a input dialog for a boolean. * * @param options - The dialog setup options. * * @returns A promise that resolves with whether the dialog was accepted */ function getBoolean(options) { return Object(_dialog__WEBPACK_IMPORTED_MODULE_1__["showDialog"])(Object.assign(Object.assign({}, options), { body: new InputBooleanDialog(options), buttons: [ _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].cancelButton({ label: options.cancelLabel }), _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].okButton({ label: options.okLabel }) ], focusNodeSelector: 'input' })); } InputDialog.getBoolean = getBoolean; /** * Create and show a input dialog for a number. * * @param options - The dialog setup options. * * @returns A promise that resolves with whether the dialog was accepted */ function getNumber(options) { return Object(_dialog__WEBPACK_IMPORTED_MODULE_1__["showDialog"])(Object.assign(Object.assign({}, options), { body: new InputNumberDialog(options), buttons: [ _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].cancelButton({ label: options.cancelLabel }), _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].okButton({ label: options.okLabel }) ], focusNodeSelector: 'input' })); } InputDialog.getNumber = getNumber; /** * Create and show a input dialog for a choice. * * @param options - The dialog setup options. * * @returns A promise that resolves with whether the dialog was accepted */ function getItem(options) { return Object(_dialog__WEBPACK_IMPORTED_MODULE_1__["showDialog"])(Object.assign(Object.assign({}, options), { body: new InputItemsDialog(options), buttons: [ _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].cancelButton({ label: options.cancelLabel }), _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].okButton({ label: options.okLabel }) ], focusNodeSelector: options.editable ? 'input' : 'select' })); } InputDialog.getItem = getItem; /** * Create and show a input dialog for a text. * * @param options - The dialog setup options. * * @returns A promise that resolves with whether the dialog was accepted */ function getText(options) { return Object(_dialog__WEBPACK_IMPORTED_MODULE_1__["showDialog"])(Object.assign(Object.assign({}, options), { body: new InputTextDialog(options), buttons: [ _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].cancelButton({ label: options.cancelLabel }), _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].okButton({ label: options.okLabel }) ], focusNodeSelector: 'input' })); } InputDialog.getText = getText; /** * Create and show a input dialog for a password. * * @param options - The dialog setup options. * * @returns A promise that resolves with whether the dialog was accepted */ function getPassword(options) { return Object(_dialog__WEBPACK_IMPORTED_MODULE_1__["showDialog"])(Object.assign(Object.assign({}, options), { body: new InputPasswordDialog(options), buttons: [ _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].cancelButton({ label: options.cancelLabel }), _dialog__WEBPACK_IMPORTED_MODULE_1__["Dialog"].okButton({ label: options.okLabel }) ], focusNodeSelector: 'input' })); } InputDialog.getPassword = getPassword; })(InputDialog || (InputDialog = {})); /** * Base widget for input dialog body */ class InputDialogBase extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__["Widget"] { /** * InputDialog constructor * * @param label Input field label */ constructor(label) { super(); this.addClass(INPUT_DIALOG_CLASS); this._input = document.createElement('input'); this._input.classList.add('jp-mod-styled'); this._input.id = 'jp-dialog-input-id'; if (label !== undefined) { const labelElement = document.createElement('label'); labelElement.textContent = label; labelElement.htmlFor = this._input.id; // Initialize the node this.node.appendChild(labelElement); } this.node.appendChild(this._input); } } /** * Widget body for input boolean dialog */ class InputBooleanDialog extends InputDialogBase { /** * InputBooleanDialog constructor * * @param options Constructor options */ constructor(options) { super(options.label); this.addClass(INPUT_BOOLEAN_DIALOG_CLASS); this._input.type = 'checkbox'; this._input.checked = options.value ? true : false; } /** * Get the text specified by the user */ getValue() { return this._input.checked; } } /** * Widget body for input number dialog */ class InputNumberDialog extends InputDialogBase { /** * InputNumberDialog constructor * * @param options Constructor options */ constructor(options) { super(options.label); this._input.type = 'number'; this._input.value = options.value ? options.value.toString() : '0'; } /** * Get the number specified by the user. */ getValue() { if (this._input.value) { return Number(this._input.value); } else { return Number.NaN; } } } /** * Widget body for input text dialog */ class InputTextDialog extends InputDialogBase { /** * InputTextDialog constructor * * @param options Constructor options */ constructor(options) { super(options.label); this._input.type = 'text'; this._input.value = options.text ? options.text : ''; if (options.placeholder) { this._input.placeholder = options.placeholder; } } /** * Get the text specified by the user */ getValue() { return this._input.value; } } /** * Widget body for input password dialog */ class InputPasswordDialog extends InputDialogBase { /** * InputPasswordDialog constructor * * @param options Constructor options */ constructor(options) { super(options.label); this._input.type = 'password'; this._input.value = options.text ? options.text : ''; if (options.placeholder) { this._input.placeholder = options.placeholder; } } /** * Get the text specified by the user */ getValue() { return this._input.value; } } /** * Widget body for input list dialog */ class InputItemsDialog extends InputDialogBase { /** * InputItemsDialog constructor * * @param options Constructor options */ constructor(options) { super(options.label); this._editable = options.editable || false; let current = options.current || 0; let defaultIndex; if (typeof current === 'number') { defaultIndex = Math.max(0, Math.min(current, options.items.length - 1)); current = ''; } this._list = document.createElement('select'); options.items.forEach((item, index) => { const option = document.createElement('option'); if (index === defaultIndex) { option.selected = true; current = item; } option.value = item; option.textContent = item; this._list.appendChild(option); }); if (options.editable) { /* Use of list and datalist */ const data = document.createElement('datalist'); data.id = 'input-dialog-items'; data.appendChild(this._list); this._input.type = 'list'; this._input.value = current; this._input.setAttribute('list', data.id); if (options.placeholder) { this._input.placeholder = options.placeholder; } this.node.appendChild(data); } else { /* Use select directly */ this._input.remove(); this.node.appendChild(_styling__WEBPACK_IMPORTED_MODULE_2__["Styling"].wrapSelect(this._list)); } } /** * Get the user choice */ getValue() { if (this._editable) { return this._input.value; } else { return this._list.value; } } } //# sourceMappingURL=inputdialog.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/kernelstatuses.js": /*!*****************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/kernelstatuses.js ***! \*****************************************************************/ /*! exports provided: translateKernelStatuses */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "translateKernelStatuses", function() { return translateKernelStatuses; }); /* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/translation */ "./node_modules/@jupyterlab/translation/lib/index.js"); /** * Helper function to translate kernel statuses mapping by using * input translator. * * @param translator - - Language translator. * @return The translated kernel status mapping. */ function translateKernelStatuses(translator) { translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__["nullTranslator"]; const trans = translator.load('jupyterlab'); const translated = { unknown: trans.__('Unknown'), starting: trans.__('Starting'), idle: trans.__('Idle'), busy: trans.__('Busy'), terminating: trans.__('Terminating'), restarting: trans.__('Restarting'), autorestarting: trans.__('Autorestarting'), dead: trans.__('Dead'), connected: trans.__('Connected'), connecting: trans.__('Connecting'), disconnected: trans.__('Disconnected'), initializing: trans.__('Initializing'), '': '' }; return translated; } //# sourceMappingURL=kernelstatuses.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/mainareawidget.js": /*!*****************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/mainareawidget.js ***! \*****************************************************************/ /*! exports provided: MainAreaWidget */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MainAreaWidget", function() { return MainAreaWidget; }); /* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/translation */ "./node_modules/@jupyterlab/translation/lib/index.js"); /* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/messaging */ "./node_modules/@lumino/messaging/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _domutils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./domutils */ "./node_modules/@jupyterlab/apputils/lib/domutils.js"); /* harmony import */ var _printing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./printing */ "./node_modules/@jupyterlab/apputils/lib/printing.js"); /* harmony import */ var _spinner__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./spinner */ "./node_modules/@jupyterlab/apputils/lib/spinner.js"); /* harmony import */ var _toolbar__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./toolbar */ "./node_modules/@jupyterlab/apputils/lib/toolbar/index.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * A flag to indicate that event handlers are caught in the capture phase. */ const USE_CAPTURE = true; /** * A widget meant to be contained in the JupyterLab main area. * * #### Notes * Mirrors all of the `title` attributes of the content. * This widget is `closable` by default. * This widget is automatically disposed when closed. * This widget ensures its own focus when activated. */ class MainAreaWidget extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"] { /** * Construct a new main area widget. * * @param options - The options for initializing the widget. */ constructor(options) { super(options); this._changeGuard = false; this._spinner = new _spinner__WEBPACK_IMPORTED_MODULE_5__["Spinner"](); this._isRevealed = false; this._evtMouseDown = () => { if (!this.node.contains(document.activeElement)) { this._focusContent(); } }; this.addClass('jp-MainAreaWidget'); // Set contain=strict to avoid many forced layout rendering while adding cells. // Don't forget to remove the CSS class when your remove the spinner to allow // the content to be rendered. // @see https://github.com/jupyterlab/jupyterlab/issues/9381 this.addClass('jp-MainAreaWidget-ContainStrict'); this.id = _domutils__WEBPACK_IMPORTED_MODULE_3__["DOMUtils"].createDomID(); const trans = (options.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__["nullTranslator"]).load('jupyterlab'); const content = (this._content = options.content); content.node.setAttribute('role', 'region'); content.node.setAttribute('aria-label', trans.__('notebook content')); const toolbar = (this._toolbar = options.toolbar || new _toolbar__WEBPACK_IMPORTED_MODULE_6__["ReactiveToolbar"]()); toolbar.node.setAttribute('role', 'navigation'); toolbar.node.setAttribute('aria-label', trans.__('notebook actions')); const contentHeader = (this._contentHeader = options.contentHeader || new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["BoxPanel"]({ direction: 'top-to-bottom', spacing: 0 })); const layout = (this.layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["BoxLayout"]({ spacing: 0 })); layout.direction = 'top-to-bottom'; _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["BoxLayout"].setStretch(toolbar, 0); _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["BoxLayout"].setStretch(contentHeader, 0); _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["BoxLayout"].setStretch(content, 1); layout.addWidget(toolbar); layout.addWidget(contentHeader); layout.addWidget(content); if (!content.id) { content.id = _domutils__WEBPACK_IMPORTED_MODULE_3__["DOMUtils"].createDomID(); } content.node.tabIndex = 0; this._updateTitle(); content.title.changed.connect(this._updateTitle, this); this.title.closable = true; this.title.changed.connect(this._updateContentTitle, this); if (options.reveal) { this.node.appendChild(this._spinner.node); this._revealed = options.reveal .then(() => { if (content.isDisposed) { this.dispose(); return; } content.disposed.connect(() => this.dispose()); const active = document.activeElement === this._spinner.node; this._disposeSpinner(); this._isRevealed = true; if (active) { this._focusContent(); } }) .catch(e => { // Show a revealed promise error. const error = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"](); error.addClass('jp-MainAreaWidget-error'); // Show the error to the user. const pre = document.createElement('pre'); pre.textContent = String(e); error.node.appendChild(pre); _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["BoxLayout"].setStretch(error, 1); this._disposeSpinner(); content.dispose(); this._content = null; toolbar.dispose(); this._toolbar = null; layout.addWidget(error); this._isRevealed = true; throw error; }); } else { // Handle no reveal promise. this._spinner.dispose(); this.removeClass('jp-MainAreaWidget-ContainStrict'); content.disposed.connect(() => this.dispose()); this._isRevealed = true; this._revealed = Promise.resolve(undefined); } } /** * Print method. Deferred to content. */ [_printing__WEBPACK_IMPORTED_MODULE_4__["Printing"].symbol]() { if (!this._content) { return null; } return _printing__WEBPACK_IMPORTED_MODULE_4__["Printing"].getPrintFunction(this._content); } /** * The content hosted by the widget. */ get content() { return this._content; } /** * The toolbar hosted by the widget. */ get toolbar() { return this._toolbar; } /** * A panel for widgets that sit between the toolbar and the content. * Imagine a formatting toolbar, notification headers, etc. */ get contentHeader() { return this._contentHeader; } /** * Whether the content widget or an error is revealed. */ get isRevealed() { return this._isRevealed; } /** * A promise that resolves when the widget is revealed. */ get revealed() { return this._revealed; } /** * Handle `'activate-request'` messages. */ onActivateRequest(msg) { if (this._isRevealed) { this._focusContent(); } else { this._spinner.node.focus(); } } /** * Handle `after-attach` messages for the widget. */ onAfterAttach(msg) { super.onAfterAttach(msg); // Focus content in capture phase to ensure relevant commands operate on the // current main area widget. // Add the event listener directly instead of using `handleEvent` in order // to save sub-classes from needing to reason about calling it as well. this.node.addEventListener('mousedown', this._evtMouseDown, USE_CAPTURE); } /** * Handle `before-detach` messages for the widget. */ onBeforeDetach(msg) { this.node.removeEventListener('mousedown', this._evtMouseDown, USE_CAPTURE); super.onBeforeDetach(msg); } /** * Handle `'close-request'` messages. */ onCloseRequest(msg) { this.dispose(); } /** * Handle `'update-request'` messages by forwarding them to the content. */ onUpdateRequest(msg) { if (this._content) { _lumino_messaging__WEBPACK_IMPORTED_MODULE_1__["MessageLoop"].sendMessage(this._content, msg); } } _disposeSpinner() { this.node.removeChild(this._spinner.node); this._spinner.dispose(); this.removeClass('jp-MainAreaWidget-ContainStrict'); } /** * Update the title based on the attributes of the child widget. */ _updateTitle() { if (this._changeGuard || !this.content) { return; } this._changeGuard = true; const content = this.content; this.title.label = content.title.label; this.title.mnemonic = content.title.mnemonic; this.title.icon = content.title.icon; this.title.iconClass = content.title.iconClass; this.title.iconLabel = content.title.iconLabel; this.title.caption = content.title.caption; this.title.className = content.title.className; this.title.dataset = content.title.dataset; this._changeGuard = false; } /** * Update the content title based on attributes of the main widget. */ _updateContentTitle() { if (this._changeGuard || !this.content) { return; } this._changeGuard = true; const content = this.content; content.title.label = this.title.label; content.title.mnemonic = this.title.mnemonic; content.title.icon = this.title.icon; content.title.iconClass = this.title.iconClass; content.title.iconLabel = this.title.iconLabel; content.title.caption = this.title.caption; content.title.className = this.title.className; content.title.dataset = this.title.dataset; this._changeGuard = false; } /** * Give focus to the content. */ _focusContent() { if (!this.content) { return; } // Focus the content node if we aren't already focused on it or a // descendent. if (!this.content.node.contains(document.activeElement)) { this.content.node.focus(); } // Activate the content asynchronously (which may change the focus). this.content.activate(); } } //# sourceMappingURL=mainareawidget.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/menufactory.js": /*!**************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/menufactory.js ***! \**************************************************************/ /*! exports provided: MenuFactory */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MenuFactory", function() { return MenuFactory; }); /* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/coreutils */ "./node_modules/@jupyterlab/coreutils/lib/index.js"); /* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/ui-components */ "./node_modules/@jupyterlab/ui-components/lib/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__); var __rest = (undefined && undefined.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; /** * Helper functions to build a menu from the settings */ var MenuFactory; (function (MenuFactory) { /** * Create menus from their description * * @param data Menubar description * @param menuFactory Factory for empty menu */ function createMenus(data, menuFactory) { return data .filter(item => !item.disabled) .sort((a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : Infinity) - ((_b = b.rank) !== null && _b !== void 0 ? _b : Infinity); }) .map(menuItem => { return dataToMenu(menuItem, menuFactory); }); } MenuFactory.createMenus = createMenus; /** * Convert a menu description in a JupyterLabMenu object * * @param item Menu description * @param menuFactory Empty menu factory * @returns The menu widget */ function dataToMenu(item, menuFactory) { var _a, _b; const menu = menuFactory(item); menu.id = item.id; // Set the label in case the menu factory did not. if (!menu.title.label) { menu.title.label = (_a = item.label) !== null && _a !== void 0 ? _a : _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__["Text"].titleCase(menu.id.trim()); } if (item.icon) { menu.title.icon = _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["LabIcon"].resolve({ icon: item.icon }); } if (item.mnemonic !== undefined) { menu.title.mnemonic = item.mnemonic; } (_b = item.items) === null || _b === void 0 ? void 0 : _b.filter(item => !item.disabled).sort((a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : Infinity) - ((_b = b.rank) !== null && _b !== void 0 ? _b : Infinity); }).map(item => { addItem(item, menu, menuFactory); }); return menu; } /** * Convert an item description in a context menu item object * * @param item Context menu item * @param menu Context menu to populate * @param menuFactory Empty menu factory */ function addContextItem(item, menu, menuFactory) { const { submenu } = item, newItem = __rest(item, ["submenu"]); // Commands may not have been registered yet; so we don't force it to exist menu.addItem(Object.assign(Object.assign({}, newItem), { submenu: submenu ? dataToMenu(submenu, menuFactory) : null })); } MenuFactory.addContextItem = addContextItem; /** * Convert an item description in a menu item object * * @param item Menu item * @param menu Menu to populate * @param menuFactory Empty menu factory */ function addItem(item, menu, menuFactory) { const { submenu } = item, newItem = __rest(item, ["submenu"]); // Commands may not have been registered yet; so we don't force it to exist menu.addItem(Object.assign(Object.assign({}, newItem), { submenu: submenu ? dataToMenu(submenu, menuFactory) : null })); } /** * Update an existing list of menu and returns * the new elements. * * #### Note * New elements are added to the current menu list. * * @param menus Current menus * @param data New description to take into account * @param menuFactory Empty menu factory * @returns Newly created menus */ function updateMenus(menus, data, menuFactory) { const newMenus = []; data.forEach(item => { const menu = menus.find(menu => menu.id === item.id); if (menu) { mergeMenus(item, menu, menuFactory); } else { if (!item.disabled) { newMenus.push(dataToMenu(item, menuFactory)); } } }); menus.push(...newMenus); return newMenus; } MenuFactory.updateMenus = updateMenus; function mergeMenus(item, menu, menuFactory) { var _a; if (item.disabled) { menu.dispose(); } else { (_a = item.items) === null || _a === void 0 ? void 0 : _a.forEach(entry => { var _a, _b; const existingItem = menu === null || menu === void 0 ? void 0 : menu.items.find((i, idx) => { var _a, _b, _c; return i.type === entry.type && i.command === ((_a = entry.command) !== null && _a !== void 0 ? _a : '') && ((_b = i.submenu) === null || _b === void 0 ? void 0 : _b.id) === ((_c = entry.submenu) === null || _c === void 0 ? void 0 : _c.id); }); if (existingItem && entry.type !== 'separator') { if (entry.disabled) { menu.removeItem(existingItem); } else { switch ((_a = entry.type) !== null && _a !== void 0 ? _a : 'command') { case 'command': if (entry.command) { if (!_lumino_coreutils__WEBPACK_IMPORTED_MODULE_2__["JSONExt"].deepEqual(existingItem.args, (_b = entry.args) !== null && _b !== void 0 ? _b : {})) { addItem(entry, menu, menuFactory); } } break; case 'submenu': if (entry.submenu) { mergeMenus(entry.submenu, existingItem.submenu, menuFactory); } } } } else { addItem(entry, menu, menuFactory); } }); } } })(MenuFactory || (MenuFactory = {})); //# sourceMappingURL=menufactory.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/printing.js": /*!***********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/printing.js ***! \***********************************************************/ /*! exports provided: Printing */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Printing", function() { return Printing; }); /* harmony import */ var _jupyterlab_services__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/services */ "./node_modules/@jupyterlab/services/lib/index.js"); /* harmony import */ var _jupyterlab_services__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_services__WEBPACK_IMPORTED_MODULE_0__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * Any object is "printable" if it implements the `IPrintable` interface. * * To do this it, it must have a method called `Printing.symbol` which returns either a function * to print the object or null if it cannot be printed. * * One way of printing is to use the `printWidget` function, which creates a hidden iframe * and copies the DOM nodes from your widget to that iframe and printing just that iframe. * * Another way to print is to use the `printURL` function, which takes a URL and prints that page. */ var Printing; (function (Printing) { /** * Symbol to use for a method that returns a function to print an object. */ Printing.symbol = Symbol('printable'); /** * Returns whether an object implements a print method. */ function isPrintable(a) { if (typeof a !== 'object' || !a) { return false; } return Printing.symbol in a; } Printing.isPrintable = isPrintable; /** * Returns the print function for an object, or null if it does not provide a handler. */ function getPrintFunction(val) { if (isPrintable(val)) { return val[Printing.symbol](); } return null; } Printing.getPrintFunction = getPrintFunction; /** * Prints a widget by copying it's DOM node * to a hidden iframe and printing that iframe. */ function printWidget(widget) { return printContent(widget.node); } Printing.printWidget = printWidget; /** * Prints a URL by loading it into an iframe. * * @param url URL to load into an iframe. */ async function printURL(url) { const settings = _jupyterlab_services__WEBPACK_IMPORTED_MODULE_0__["ServerConnection"].makeSettings(); const text = await (await _jupyterlab_services__WEBPACK_IMPORTED_MODULE_0__["ServerConnection"].makeRequest(url, {}, settings)).text(); return printContent(text); } Printing.printURL = printURL; /** * Prints a URL or an element in an iframe and then removes the iframe after printing. */ async function printContent(textOrEl) { const isText = typeof textOrEl === 'string'; const iframe = createIFrame(); const parent = window.document.body; parent.appendChild(iframe); if (isText) { iframe.srcdoc = textOrEl; await resolveWhenLoaded(iframe); } else { iframe.src = 'about:blank'; await resolveWhenLoaded(iframe); setIFrameNode(iframe, textOrEl); } const printed = resolveAfterEvent(); launchPrint(iframe.contentWindow); // Once the print dialog has been dismissed, we regain event handling, // and it should be safe to discard the hidden iframe. await printed; parent.removeChild(iframe); } /** * Creates a new hidden iframe and appends it to the document * * Modified from * https://github.com/joseluisq/printd/blob/eb7948d602583c055ab6dee3ee294b6a421da4b6/src/index.ts#L24 */ function createIFrame() { const el = window.document.createElement('iframe'); // We need both allow-modals and allow-same-origin to be able to // call print in the iframe. // We intentionally do not allow scripts: // https://github.com/jupyterlab/jupyterlab/pull/5850#pullrequestreview-230899790 el.setAttribute('sandbox', 'allow-modals allow-same-origin'); const css = 'visibility:hidden;width:0;height:0;position:absolute;z-index:-9999;bottom:0;'; el.setAttribute('style', css); el.setAttribute('width', '0'); el.setAttribute('height', '0'); return el; } /** * Copies a node from the base document to the iframe. */ function setIFrameNode(iframe, node) { iframe.contentDocument.body.appendChild(node.cloneNode(true)); iframe.contentDocument.close(); } /** * Promise that resolves when all resources are loaded in the window. */ function resolveWhenLoaded(iframe) { return new Promise(resolve => { iframe.onload = () => resolve(); }); } /** * A promise that resolves after the next mousedown, mousemove, or * keydown event. We use this as a proxy for determining when the * main window has regained control after the print dialog is removed. * * We can't use the usual window.onafterprint handler because we * disallow Javascript execution in the print iframe. */ function resolveAfterEvent() { return new Promise(resolve => { const onEvent = () => { document.removeEventListener('mousemove', onEvent, true); document.removeEventListener('mousedown', onEvent, true); document.removeEventListener('keydown', onEvent, true); resolve(); }; document.addEventListener('mousemove', onEvent, true); document.addEventListener('mousedown', onEvent, true); document.addEventListener('keydown', onEvent, true); }); } /** * Prints a content window. */ function launchPrint(contentWindow) { const result = contentWindow.document.execCommand('print', false); // execCommand won't work in firefox so we call the `print` method instead if it fails // https://github.com/joseluisq/printd/blob/eb7948d602583c055ab6dee3ee294b6a421da4b6/src/index.ts#L148 if (!result) { contentWindow.print(); } } })(Printing || (Printing = {})); //# sourceMappingURL=printing.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/sanitizer.js": /*!************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/sanitizer.js ***! \************************************************************/ /*! exports provided: Sanitizer, defaultSanitizer */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Sanitizer", function() { return Sanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultSanitizer", function() { return defaultSanitizer; }); /* harmony import */ var sanitize_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! sanitize-html */ "./node_modules/sanitize-html/index.js"); /* harmony import */ var sanitize_html__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sanitize_html__WEBPACK_IMPORTED_MODULE_0__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. // sanitize-html uses the url package, so we depend on a standalone version of // it which acts as a polyfill for browsers. /** * Helper class that contains regular expressions for inline CSS style validation. * * Which properties (and values) to allow is largely based on the Google Caja project: * https://github.com/google/caja * * The regular expressions are largly based on the syntax definition found at * https://developer.mozilla.org/en-US/docs/Web/CSS. */ class CssProp { static reg(r) { return new RegExp('^' + r + '$', 'i'); } } /* * Numeric base expressions used to help build more complex regular expressions */ CssProp.N = { integer: `[+-]?[0-9]+`, integer_pos: `[+]?[0-9]+`, integer_zero_ff: `([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`, number: `[+-]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?`, number_pos: `[+]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?`, number_zero_hundred: `[+]?(([0-9]|[1-9][0-9])([.][0-9]+)?|100)`, number_zero_one: `[+]?(1([.][0]+)?|0?([.][0-9]+)?)` }; /* * Base expressions of common CSS syntax elements */ CssProp.B = { angle: `(${CssProp.N.number}(deg|rad|grad|turn)|0)`, frequency: `${CssProp.N.number}(Hz|kHz)`, ident: String.raw `-?([_a-z]|[\xA0-\xFF]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\xA0-\xFF]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*`, len_or_perc: `(0|${CssProp.N.number}(px|em|rem|ex|in|cm|mm|pt|pc|%))`, length: `(${CssProp.N.number}(px|em|rem|ex|in|cm|mm|pt|pc)|0)`, length_pos: `(${CssProp.N.number_pos}(px|em|rem|ex|in|cm|mm|pt|pc)|0)`, percentage: `${CssProp.N.number}%`, percentage_pos: `${CssProp.N.number_pos}%`, percentage_zero_hundred: `${CssProp.N.number_zero_hundred}%`, string: String.raw `(\"([^\n\r\f\\"]|\\\n|\r\n|\r|\f|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*\")|(\'([^\n\r\f\\']|\\\n|\r\n|\r|\f|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*\')`, time: `${CssProp.N.number}(s|ms)`, url: `url\\(.*?\\)`, z_index: `[+-]?[0-9]{1,7}` }; /* * Atomic (i.e. not dependant on other regular expressions) sub RegEx segments */ CssProp.A = { absolute_size: `xx-small|x-small|small|medium|large|x-large|xx-large`, attachment: `scroll|fixed|local`, bg_origin: `border-box|padding-box|content-box`, border_style: `none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset`, box: `border-box|padding-box|content-box`, display_inside: `auto|block|table|flex|grid`, display_outside: `block-level|inline-level|none|table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption`, ending_shape: `circle|ellipse`, generic_family: `serif|sans-serif|cursive|fantasy|monospace`, generic_voice: `male|female|child`, relative_size: `smaller|larger`, repeat_style: `repeat-x|repeat-y|((?:repeat|space|round|no-repeat)(?:\\s*(?:repeat|space|round|no-repeat))?)`, side_or_corner: `(left|right)?\\s*(top|bottom)?`, single_animation_direction: `normal|reverse|alternate|alternate-reverse`, single_animation_fill_mode: `none|forwards|backwards|both`, single_animation_play_state: `running|paused` }; /* * Color definition sub expressions */ CssProp._COLOR = { hex: `\\#(0x)?[0-9a-f]+`, name: `aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|transparent|violet|wheat|white|whitesmoke|yellow|yellowgreen`, rgb: String.raw `rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)`, rgba: String.raw `rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(${CssProp.N.integer_zero_ff}|${CssProp.N.number_zero_one}|${CssProp.B.percentage_zero_hundred})\s*\)` }; /* * Compound (i.e. dependant on other (sub) regular expressions) sub RegEx segments */ CssProp._C = { alpha: `${CssProp.N.integer_zero_ff}|${CssProp.N.number_zero_one}|${CssProp.B.percentage_zero_hundred}`, alphavalue: CssProp.N.number_zero_one, bg_position: `((${CssProp.B.len_or_perc}|left|center|right|top|bottom)\\s*){1,4}`, bg_size: `(${CssProp.B.length_pos}|${CssProp.B.percentage}|auto){1,2}|cover|contain`, border_width: `thin|medium|thick|${CssProp.B.length}`, bottom: `${CssProp.B.length}|auto`, color: `${CssProp._COLOR.hex}|${CssProp._COLOR.rgb}|${CssProp._COLOR.rgba}|${CssProp._COLOR.name}`, color_stop_length: `(${CssProp.B.len_or_perc}\\s*){1,2}`, linear_color_hint: `${CssProp.B.len_or_perc}`, family_name: `${CssProp.B.string}|(${CssProp.B.ident}\\s*)+`, image_decl: CssProp.B.url, left: `${CssProp.B.length}|auto`, loose_quotable_words: `(${CssProp.B.ident})+`, margin_width: `${CssProp.B.len_or_perc}|auto`, padding_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`, page_url: CssProp.B.url, position: `((${CssProp.B.len_or_perc}|left|center|right|top|bottom)\\s*){1,4}`, right: `${CssProp.B.length}|auto`, shadow: '', size: `closest-side|farthest-side|closest-corner|farthest-corner|${CssProp.B.length}|(${CssProp.B.len_or_perc})\\s+(${CssProp.B.len_or_perc})`, top: `${CssProp.B.length}|auto` }; CssProp._C1 = { image_list: `image\\(\\s*(${CssProp.B.url})*\\s*(${CssProp.B.url}|${CssProp._C.color})\\s*\\)`, linear_color_stop: `(${CssProp._C.color})(\\s*${CssProp._C.color_stop_length})?`, shadow: `((${CssProp._C.color})\\s+((${CssProp.B.length})\\s*){2,4}(\s+inset)?)|((inset\\s+)?((${CssProp.B.length})\\s*){2,4}\\s*(${CssProp._C.color})?)` }; CssProp._C2 = { color_stop_list: `((${CssProp._C1.linear_color_stop})(\\s*(${CssProp._C.linear_color_hint}))?\\s*,\\s*)+(${CssProp._C1.linear_color_stop})`, shape: `rect\\(\\s*(${CssProp._C.top})\\s*,\\s*(${CssProp._C.right})\\s*,\\s*(${CssProp._C.bottom})\\s*,\\s*(${CssProp._C.left})\\s*\\)` }; CssProp._C3 = { linear_gradient: `linear-gradient\\((((${CssProp.B.angle})|to\\s+(${CssProp.A.side_or_corner}))\\s*,\\s*)?\\s*(${CssProp._C2.color_stop_list})\\s*\\)`, radial_gradient: `radial-gradient\\(((((${CssProp.A.ending_shape})|(${CssProp._C.size}))\\s*)*\\s*(at\\s+${CssProp._C.position})?\\s*,\\s*)?\\s*(${CssProp._C2.color_stop_list})\\s*\\)` }; CssProp._C4 = { image: `${CssProp.B.url}|${CssProp._C3.linear_gradient}|${CssProp._C3.radial_gradient}|${CssProp._C1.image_list}`, bg_image: `(${CssProp.B.url}|${CssProp._C3.linear_gradient}|${CssProp._C3.radial_gradient}|${CssProp._C1.image_list})|none` }; CssProp.C = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, CssProp._C), CssProp._C1), CssProp._C2), CssProp._C3), CssProp._C4); /* * Property value regular expressions not dependant on other sub expressions */ CssProp.AP = { border_collapse: `collapse|separate`, box: `normal|none|contents`, box_sizing: `content-box|padding-box|border-box`, caption_side: `top|bottom`, clear: `none|left|right|both`, direction: `ltr|rtl`, empty_cells: `show|hide`, float: `left|right|none`, font_stretch: `normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded`, font_style: `normal|italic|oblique`, font_variant: `normal|small-caps`, font_weight: `normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900`, list_style_position: `inside|outside`, list_style_type: `disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-latin|upper-latin|armenian|georgian|lower-alpha|upper-alpha|none`, overflow: `visible|hidden|scroll|auto`, overflow_wrap: `normal|break-word`, overflow_x: `visible|hidden|scroll|auto|no-display|no-content`, page_break_after: `auto|always|avoid|left|right`, page_break_before: `auto|always|avoid|left|right`, page_break_inside: `avoid|auto`, position: `static|relative|absolute`, resize: `none|both|horizontal|vertical`, speak: `normal|none|spell-out`, speak_header: `once|always`, speak_numeral: `digits|continuous`, speak_punctuation: `code|none`, table_layout: `auto|fixed`, text_align: `left|right|center|justify`, text_decoration: `none|((underline|overline|line-through|blink)\\s*)+`, text_transform: `capitalize|uppercase|lowercase|none`, text_wrap: `normal|unrestricted|none|suppress`, unicode_bidi: `normal|embed|bidi-override`, visibility: `visible|hidden|collapse`, white_space: `normal|pre|nowrap|pre-wrap|pre-line`, word_break: `normal|keep-all|break-all` }; /* * Compound propertiy value regular expressions (i.e. dependant on other sub expressions) */ CssProp._CP = { background_attachment: `${CssProp.A.attachment}(,\\s*${CssProp.A.attachment})*`, background_color: CssProp.C.color, background_origin: `${CssProp.A.box}(,\\s*${CssProp.A.box})*`, background_repeat: `${CssProp.A.repeat_style}(,\\s*${CssProp.A.repeat_style})*`, border: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\s*){1,3}`, border_radius: `((${CssProp.B.len_or_perc})\\s*){1,4}(\\/\\s*((${CssProp.B.len_or_perc})\\s*){1,4})?`, border_spacing: `${CssProp.B.length}\\s*(${CssProp.B.length})?`, border_top_color: CssProp.C.color, border_top_style: CssProp.A.border_style, border_width: `((${CssProp.C.border_width})\\s*){1,4}`, color: CssProp.C.color, cursor: `(${CssProp.B.url}(\\s*,\\s*)?)*(auto|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|w-resize|text|wait|help|progress|all-scroll|col-resize|hand|no-drop|not-allowed|row-resize|vertical-text)`, display: `inline|block|list-item|run-in|inline-list-item|inline-block|table|inline-table|table-cell|table-caption|flex|inline-flex|grid|inline-grid|${CssProp.A.display_inside}|${CssProp.A.display_outside}|inherit|inline-box|inline-stack`, display_outside: CssProp.A.display_outside, elevation: `${CssProp.B.angle}|below|level|above|higher|lower`, font_family: `(${CssProp.C.family_name}|${CssProp.A.generic_family})(,\\s*(${CssProp.C.family_name}|${CssProp.A.generic_family}))*`, height: `${CssProp.B.length}|${CssProp.B.percentage}|auto`, letter_spacing: `normal|${CssProp.B.length}`, list_style_image: `${CssProp.C.image}|none`, margin_right: CssProp.C.margin_width, max_height: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|none|auto`, min_height: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto`, opacity: CssProp.C.alphavalue, outline_color: `${CssProp.C.color}|invert`, outline_width: CssProp.C.border_width, padding: `((${CssProp.C.padding_width})\\s*){1,4}`, padding_top: CssProp.C.padding_width, pitch_range: CssProp.N.number, right: `${CssProp.B.length}|${CssProp.B.percentage}|auto`, stress: CssProp.N.number, text_indent: `${CssProp.B.length}|${CssProp.B.percentage}`, text_shadow: `none|${CssProp.C.shadow}(,\\s*(${CssProp.C.shadow}))*`, volume: `${CssProp.N.number_pos}|${CssProp.B.percentage_pos}|silent|x-soft|soft|medium|loud|x-loud`, word_wrap: CssProp.AP.overflow_wrap, zoom: `normal|${CssProp.N.number_pos}|${CssProp.B.percentage_pos}`, backface_visibility: CssProp.AP.visibility, background_clip: `${CssProp.A.box}(,\\s*(${CssProp.A.box}))*`, background_position: `${CssProp.C.bg_position}(,\\s*(${CssProp.C.bg_position}))*`, border_bottom_color: CssProp.C.color, border_bottom_style: CssProp.A.border_style, border_color: `((${CssProp.C.color})\\s*){1,4}`, border_left_color: CssProp.C.color, border_right_color: CssProp.C.color, border_style: `((${CssProp.A.border_style})\\s*){1,4}`, border_top_left_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`, border_top_width: CssProp.C.border_width, box_shadow: `none|${CssProp.C.shadow}(,\\s*(${CssProp.C.shadow}))*`, clip: `${CssProp.C.shape}|auto`, display_inside: CssProp.A.display_inside, font_size: `${CssProp.A.absolute_size}|${CssProp.A.relative_size}|${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`, line_height: `normal|${CssProp.N.number_pos}|${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`, margin_left: CssProp.C.margin_width, max_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|none|auto`, outline_style: CssProp.A.border_style, padding_bottom: CssProp.C.padding_width, padding_right: CssProp.C.padding_width, perspective: `none|${CssProp.B.length}`, richness: CssProp.N.number, text_overflow: `((clip|ellipsis|${CssProp.B.string})\\s*){1,2}`, top: `${CssProp.B.length}|${CssProp.B.percentage}|auto`, width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto`, z_index: `auto|${CssProp.B.z_index}`, // Simplified background background: `(((${CssProp.C.bg_position}\\s*(\\/\\s*${CssProp.C.bg_size})?)|(${CssProp.A.repeat_style})|(${CssProp.A.attachment})|(${CssProp.A.bg_origin})|(${CssProp.C.bg_image})|(${CssProp.C.color}))\\s*)+`, background_size: `${CssProp.C.bg_size}(,\\s*${CssProp.C.bg_size})*`, border_bottom_left_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`, border_bottom_width: CssProp.C.border_width, border_left_style: CssProp.A.border_style, border_right_style: CssProp.A.border_style, border_top: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\s*){1,3}`, bottom: `${CssProp.B.len_or_perc}|auto`, list_style: `((${CssProp.AP.list_style_type}|${CssProp.AP.list_style_position}|${CssProp.C.image}|none})\\s*){1,3}`, margin_top: CssProp.C.margin_width, outline: `((${CssProp.C.color}|invert|${CssProp.A.border_style}|${CssProp.C.border_width})\\s*){1,3}`, overflow_y: CssProp.AP.overflow_x, pitch: `${CssProp.B.frequency}|x-low|low|medium|high|x-high`, vertical_align: `baseline|sub|super|top|text-top|middle|bottom|text-bottom|${CssProp.B.len_or_perc}`, word_spacing: `normal|${CssProp.B.length}`, background_image: `${CssProp.C.bg_image}(,\\s*${CssProp.C.bg_image})*`, border_bottom_right_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`, border_left_width: CssProp.C.border_width, border_right_width: CssProp.C.border_width, left: `${CssProp.B.len_or_perc}|auto`, margin_bottom: CssProp.C.margin_width, pause_after: `${CssProp.B.time}|${CssProp.B.percentage}`, speech_rate: `${CssProp.N.number}|x-slow|slow|medium|fast|x-fast|faster|slower`, transition_duration: `${CssProp.B.time}(,\\s*${CssProp.B.time})*`, border_bottom: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\s*){1,3}`, border_right: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\s*){1,3}`, margin: `((${CssProp.C.margin_width})\\s*){1,4}`, padding_left: CssProp.C.padding_width, border_left: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\s*){1,3}`, quotes: `(${CssProp.B.string}\\s*${CssProp.B.string})+|none`, border_top_right_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`, min_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto` }; CssProp._CP1 = { font: `(((((${CssProp.AP.font_style}|${CssProp.AP.font_variant}|${CssProp.AP.font_weight})\\s*){1,3})?\\s*(${CssProp._CP.font_size})\\s*(\\/\\s*(${CssProp._CP.line_height}))?\\s+(${CssProp._CP.font_family}))|caption|icon|menu|message-box|small-caption|status-bar)` }; CssProp.CP = Object.assign(Object.assign({}, CssProp._CP), CssProp._CP1); // CSS Property value validation regular expressions for use with sanitize-html CssProp.BORDER_COLLAPSE = CssProp.reg(CssProp.AP.border_collapse); CssProp.BOX = CssProp.reg(CssProp.AP.box); CssProp.BOX_SIZING = CssProp.reg(CssProp.AP.box_sizing); CssProp.CAPTION_SIDE = CssProp.reg(CssProp.AP.caption_side); CssProp.CLEAR = CssProp.reg(CssProp.AP.clear); CssProp.DIRECTION = CssProp.reg(CssProp.AP.direction); CssProp.EMPTY_CELLS = CssProp.reg(CssProp.AP.empty_cells); CssProp.FLOAT = CssProp.reg(CssProp.AP.float); CssProp.FONT_STRETCH = CssProp.reg(CssProp.AP.font_stretch); CssProp.FONT_STYLE = CssProp.reg(CssProp.AP.font_style); CssProp.FONT_VARIANT = CssProp.reg(CssProp.AP.font_variant); CssProp.FONT_WEIGHT = CssProp.reg(CssProp.AP.font_weight); CssProp.LIST_STYLE_POSITION = CssProp.reg(CssProp.AP.list_style_position); CssProp.LIST_STYLE_TYPE = CssProp.reg(CssProp.AP.list_style_type); CssProp.OVERFLOW = CssProp.reg(CssProp.AP.overflow); CssProp.OVERFLOW_WRAP = CssProp.reg(CssProp.AP.overflow_wrap); CssProp.OVERFLOW_X = CssProp.reg(CssProp.AP.overflow_x); CssProp.PAGE_BREAK_AFTER = CssProp.reg(CssProp.AP.page_break_after); CssProp.PAGE_BREAK_BEFORE = CssProp.reg(CssProp.AP.page_break_before); CssProp.PAGE_BREAK_INSIDE = CssProp.reg(CssProp.AP.page_break_inside); CssProp.POSITION = CssProp.reg(CssProp.AP.position); CssProp.RESIZE = CssProp.reg(CssProp.AP.resize); CssProp.SPEAK = CssProp.reg(CssProp.AP.speak); CssProp.SPEAK_HEADER = CssProp.reg(CssProp.AP.speak_header); CssProp.SPEAK_NUMERAL = CssProp.reg(CssProp.AP.speak_numeral); CssProp.SPEAK_PUNCTUATION = CssProp.reg(CssProp.AP.speak_punctuation); CssProp.TABLE_LAYOUT = CssProp.reg(CssProp.AP.table_layout); CssProp.TEXT_ALIGN = CssProp.reg(CssProp.AP.text_align); CssProp.TEXT_DECORATION = CssProp.reg(CssProp.AP.text_decoration); CssProp.TEXT_TRANSFORM = CssProp.reg(CssProp.AP.text_transform); CssProp.TEXT_WRAP = CssProp.reg(CssProp.AP.text_wrap); CssProp.UNICODE_BIDI = CssProp.reg(CssProp.AP.unicode_bidi); CssProp.VISIBILITY = CssProp.reg(CssProp.AP.visibility); CssProp.WHITE_SPACE = CssProp.reg(CssProp.AP.white_space); CssProp.WORD_BREAK = CssProp.reg(CssProp.AP.word_break); CssProp.BACKGROUND_ATTACHMENT = CssProp.reg(CssProp.CP.background_attachment); CssProp.BACKGROUND_COLOR = CssProp.reg(CssProp.CP.background_color); CssProp.BACKGROUND_ORIGIN = CssProp.reg(CssProp.CP.background_origin); CssProp.BACKGROUND_REPEAT = CssProp.reg(CssProp.CP.background_repeat); CssProp.BORDER = CssProp.reg(CssProp.CP.border); CssProp.BORDER_RADIUS = CssProp.reg(CssProp.CP.border_radius); CssProp.BORDER_SPACING = CssProp.reg(CssProp.CP.border_spacing); CssProp.BORDER_TOP_COLOR = CssProp.reg(CssProp.CP.border_top_color); CssProp.BORDER_TOP_STYLE = CssProp.reg(CssProp.CP.border_top_style); CssProp.BORDER_WIDTH = CssProp.reg(CssProp.CP.border_width); CssProp.COLOR = CssProp.reg(CssProp.CP.color); CssProp.CURSOR = CssProp.reg(CssProp.CP.cursor); CssProp.DISPLAY = CssProp.reg(CssProp.CP.display); CssProp.DISPLAY_OUTSIDE = CssProp.reg(CssProp.CP.display_outside); CssProp.ELEVATION = CssProp.reg(CssProp.CP.elevation); CssProp.FONT_FAMILY = CssProp.reg(CssProp.CP.font_family); CssProp.HEIGHT = CssProp.reg(CssProp.CP.height); CssProp.LETTER_SPACING = CssProp.reg(CssProp.CP.letter_spacing); CssProp.LIST_STYLE_IMAGE = CssProp.reg(CssProp.CP.list_style_image); CssProp.MARGIN_RIGHT = CssProp.reg(CssProp.CP.margin_right); CssProp.MAX_HEIGHT = CssProp.reg(CssProp.CP.max_height); CssProp.MIN_HEIGHT = CssProp.reg(CssProp.CP.min_height); CssProp.OPACITY = CssProp.reg(CssProp.CP.opacity); CssProp.OUTLINE_COLOR = CssProp.reg(CssProp.CP.outline_color); CssProp.OUTLINE_WIDTH = CssProp.reg(CssProp.CP.outline_width); CssProp.PADDING = CssProp.reg(CssProp.CP.padding); CssProp.PADDING_TOP = CssProp.reg(CssProp.CP.padding_top); CssProp.PITCH_RANGE = CssProp.reg(CssProp.CP.pitch_range); CssProp.RIGHT = CssProp.reg(CssProp.CP.right); CssProp.STRESS = CssProp.reg(CssProp.CP.stress); CssProp.TEXT_INDENT = CssProp.reg(CssProp.CP.text_indent); CssProp.TEXT_SHADOW = CssProp.reg(CssProp.CP.text_shadow); CssProp.VOLUME = CssProp.reg(CssProp.CP.volume); CssProp.WORD_WRAP = CssProp.reg(CssProp.CP.word_wrap); CssProp.ZOOM = CssProp.reg(CssProp.CP.zoom); CssProp.BACKFACE_VISIBILITY = CssProp.reg(CssProp.CP.backface_visibility); CssProp.BACKGROUND_CLIP = CssProp.reg(CssProp.CP.background_clip); CssProp.BACKGROUND_POSITION = CssProp.reg(CssProp.CP.background_position); CssProp.BORDER_BOTTOM_COLOR = CssProp.reg(CssProp.CP.border_bottom_color); CssProp.BORDER_BOTTOM_STYLE = CssProp.reg(CssProp.CP.border_bottom_style); CssProp.BORDER_COLOR = CssProp.reg(CssProp.CP.border_color); CssProp.BORDER_LEFT_COLOR = CssProp.reg(CssProp.CP.border_left_color); CssProp.BORDER_RIGHT_COLOR = CssProp.reg(CssProp.CP.border_right_color); CssProp.BORDER_STYLE = CssProp.reg(CssProp.CP.border_style); CssProp.BORDER_TOP_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_top_left_radius); CssProp.BORDER_TOP_WIDTH = CssProp.reg(CssProp.CP.border_top_width); CssProp.BOX_SHADOW = CssProp.reg(CssProp.CP.box_shadow); CssProp.CLIP = CssProp.reg(CssProp.CP.clip); CssProp.DISPLAY_INSIDE = CssProp.reg(CssProp.CP.display_inside); CssProp.FONT_SIZE = CssProp.reg(CssProp.CP.font_size); CssProp.LINE_HEIGHT = CssProp.reg(CssProp.CP.line_height); CssProp.MARGIN_LEFT = CssProp.reg(CssProp.CP.margin_left); CssProp.MAX_WIDTH = CssProp.reg(CssProp.CP.max_width); CssProp.OUTLINE_STYLE = CssProp.reg(CssProp.CP.outline_style); CssProp.PADDING_BOTTOM = CssProp.reg(CssProp.CP.padding_bottom); CssProp.PADDING_RIGHT = CssProp.reg(CssProp.CP.padding_right); CssProp.PERSPECTIVE = CssProp.reg(CssProp.CP.perspective); CssProp.RICHNESS = CssProp.reg(CssProp.CP.richness); CssProp.TEXT_OVERFLOW = CssProp.reg(CssProp.CP.text_overflow); CssProp.TOP = CssProp.reg(CssProp.CP.top); CssProp.WIDTH = CssProp.reg(CssProp.CP.width); CssProp.Z_INDEX = CssProp.reg(CssProp.CP.z_index); CssProp.BACKGROUND = CssProp.reg(CssProp.CP.background); CssProp.BACKGROUND_SIZE = CssProp.reg(CssProp.CP.background_size); CssProp.BORDER_BOTTOM_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_left_radius); CssProp.BORDER_BOTTOM_WIDTH = CssProp.reg(CssProp.CP.border_bottom_width); CssProp.BORDER_LEFT_STYLE = CssProp.reg(CssProp.CP.border_left_style); CssProp.BORDER_RIGHT_STYLE = CssProp.reg(CssProp.CP.border_right_style); CssProp.BORDER_TOP = CssProp.reg(CssProp.CP.border_top); CssProp.BOTTOM = CssProp.reg(CssProp.CP.bottom); CssProp.LIST_STYLE = CssProp.reg(CssProp.CP.list_style); CssProp.MARGIN_TOP = CssProp.reg(CssProp.CP.margin_top); CssProp.OUTLINE = CssProp.reg(CssProp.CP.outline); CssProp.OVERFLOW_Y = CssProp.reg(CssProp.CP.overflow_y); CssProp.PITCH = CssProp.reg(CssProp.CP.pitch); CssProp.VERTICAL_ALIGN = CssProp.reg(CssProp.CP.vertical_align); CssProp.WORD_SPACING = CssProp.reg(CssProp.CP.word_spacing); CssProp.BACKGROUND_IMAGE = CssProp.reg(CssProp.CP.background_image); CssProp.BORDER_BOTTOM_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_right_radius); CssProp.BORDER_LEFT_WIDTH = CssProp.reg(CssProp.CP.border_left_width); CssProp.BORDER_RIGHT_WIDTH = CssProp.reg(CssProp.CP.border_right_width); CssProp.LEFT = CssProp.reg(CssProp.CP.left); CssProp.MARGIN_BOTTOM = CssProp.reg(CssProp.CP.margin_bottom); CssProp.PAUSE_AFTER = CssProp.reg(CssProp.CP.pause_after); CssProp.SPEECH_RATE = CssProp.reg(CssProp.CP.speech_rate); CssProp.TRANSITION_DURATION = CssProp.reg(CssProp.CP.transition_duration); CssProp.BORDER_BOTTOM = CssProp.reg(CssProp.CP.border_bottom); CssProp.BORDER_RIGHT = CssProp.reg(CssProp.CP.border_right); CssProp.MARGIN = CssProp.reg(CssProp.CP.margin); CssProp.PADDING_LEFT = CssProp.reg(CssProp.CP.padding_left); CssProp.BORDER_LEFT = CssProp.reg(CssProp.CP.border_left); CssProp.FONT = CssProp.reg(CssProp.CP.font); CssProp.QUOTES = CssProp.reg(CssProp.CP.quotes); CssProp.BORDER_TOP_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_top_right_radius); CssProp.MIN_WIDTH = CssProp.reg(CssProp.CP.min_width); /** * A class to sanitize HTML strings. */ class Sanitizer { constructor() { this._options = { // HTML tags that are allowed to be used. Tags were extracted from Google Caja allowedTags: [ 'a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blockquote', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'colspan', 'command', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i', // 'iframe' is allowed by Google Caja, but disallowed by default by sanitize-html // , 'iframe' 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'map', 'mark', 'menu', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'pre', 'progress', 'q', 'rowspan', 's', 'samp', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr' ], // Attributes that HTML tags are allowed to have, extracted from Google Caja. // See https://github.com/jupyterlab/jupyterlab/issues/1812#issuecomment-285848435 allowedAttributes: { '*': [ 'class', 'dir', 'draggable', 'hidden', 'id', 'inert', 'itemprop', 'itemref', 'itemscope', 'lang', 'spellcheck', 'style', 'title', 'translate' ], // 'rel' and 'target' were *not* allowed by Google Caja a: [ 'accesskey', 'coords', 'href', 'hreflang', 'name', 'rel', 'shape', 'tabindex', 'target', 'type' ], area: [ 'accesskey', 'alt', 'coords', 'href', 'nohref', 'shape', 'tabindex' ], // 'autoplay' was *not* allowed by Google Caja audio: [ 'autoplay', 'controls', 'loop', 'mediagroup', 'muted', 'preload', 'src' ], bdo: ['dir'], blockquote: ['cite'], br: ['clear'], button: [ 'accesskey', 'data-commandlinker-args', 'data-commandlinker-command', 'disabled', 'name', 'tabindex', 'type', 'value' ], canvas: ['height', 'width'], caption: ['align'], col: ['align', 'char', 'charoff', 'span', 'valign', 'width'], colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'], command: [ 'checked', 'command', 'disabled', 'icon', 'label', 'radiogroup', 'type' ], data: ['value'], del: ['cite', 'datetime'], details: ['open'], dir: ['compact'], div: ['align'], dl: ['compact'], fieldset: ['disabled'], font: ['color', 'face', 'size'], form: [ 'accept', 'autocomplete', 'enctype', 'method', 'name', 'novalidate' ], h1: ['align'], h2: ['align'], h3: ['align'], h4: ['align'], h5: ['align'], h6: ['align'], hr: ['align', 'noshade', 'size', 'width'], iframe: [ 'align', 'frameborder', 'height', 'marginheight', 'marginwidth', 'width' ], img: [ 'align', 'alt', 'border', 'height', 'hspace', 'ismap', 'name', 'src', 'usemap', 'vspace', 'width' ], input: [ 'accept', 'accesskey', 'align', 'alt', 'autocomplete', 'checked', 'disabled', 'inputmode', 'ismap', 'list', 'max', 'maxlength', 'min', 'multiple', 'name', 'placeholder', 'readonly', 'required', 'size', 'src', 'step', 'tabindex', 'type', 'usemap', 'value' ], ins: ['cite', 'datetime'], label: ['accesskey', 'for'], legend: ['accesskey', 'align'], li: ['type', 'value'], map: ['name'], menu: ['compact', 'label', 'type'], meter: ['high', 'low', 'max', 'min', 'value'], ol: ['compact', 'reversed', 'start', 'type'], optgroup: ['disabled', 'label'], option: ['disabled', 'label', 'selected', 'value'], output: ['for', 'name'], p: ['align'], pre: ['width'], progress: ['max', 'min', 'value'], q: ['cite'], select: [ 'autocomplete', 'disabled', 'multiple', 'name', 'required', 'size', 'tabindex' ], source: ['type'], table: [ 'align', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'frame', 'rules', 'summary', 'width' ], tbody: ['align', 'char', 'charoff', 'valign'], td: [ 'abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'colspan', 'headers', 'height', 'nowrap', 'rowspan', 'scope', 'valign', 'width' ], textarea: [ 'accesskey', 'autocomplete', 'cols', 'disabled', 'inputmode', 'name', 'placeholder', 'readonly', 'required', 'rows', 'tabindex', 'wrap' ], tfoot: ['align', 'char', 'charoff', 'valign'], th: [ 'abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'colspan', 'headers', 'height', 'nowrap', 'rowspan', 'scope', 'valign', 'width' ], thead: ['align', 'char', 'charoff', 'valign'], tr: ['align', 'bgcolor', 'char', 'charoff', 'valign'], track: ['default', 'kind', 'label', 'srclang'], ul: ['compact', 'type'], video: [ 'autoplay', 'controls', 'height', 'loop', 'mediagroup', 'muted', 'poster', 'preload', 'src', 'width' ] }, // Inline CSS styles that HTML tags may have (and their allowed values) allowedStyles: { // To simplify the data, all styles are allowed on all tags that allow the style attribute '*': { 'backface-visibility': [CssProp.BACKFACE_VISIBILITY], background: [CssProp.BACKGROUND], 'background-attachment': [CssProp.BACKGROUND_ATTACHMENT], 'background-clip': [CssProp.BACKGROUND_CLIP], 'background-color': [CssProp.BACKGROUND_COLOR], 'background-image': [CssProp.BACKGROUND_IMAGE], 'background-origin': [CssProp.BACKGROUND_ORIGIN], 'background-position': [CssProp.BACKGROUND_POSITION], 'background-repeat': [CssProp.BACKGROUND_REPEAT], 'background-size': [CssProp.BACKGROUND_SIZE], border: [CssProp.BORDER], 'border-bottom': [CssProp.BORDER_BOTTOM], 'border-bottom-color': [CssProp.BORDER_BOTTOM_COLOR], 'border-bottom-left-radius': [CssProp.BORDER_BOTTOM_LEFT_RADIUS], 'border-bottom-right-radius': [CssProp.BORDER_BOTTOM_RIGHT_RADIUS], 'border-bottom-style': [CssProp.BORDER_BOTTOM_STYLE], 'border-bottom-width': [CssProp.BORDER_BOTTOM_WIDTH], 'border-collapse': [CssProp.BORDER_COLLAPSE], 'border-color': [CssProp.BORDER_COLOR], 'border-left': [CssProp.BORDER_LEFT], 'border-left-color': [CssProp.BORDER_LEFT_COLOR], 'border-left-style': [CssProp.BORDER_LEFT_STYLE], 'border-left-width': [CssProp.BORDER_LEFT_WIDTH], 'border-radius': [CssProp.BORDER_RADIUS], 'border-right': [CssProp.BORDER_RIGHT], 'border-right-color': [CssProp.BORDER_RIGHT_COLOR], 'border-right-style': [CssProp.BORDER_RIGHT_STYLE], 'border-right-width': [CssProp.BORDER_RIGHT_WIDTH], 'border-spacing': [CssProp.BORDER_SPACING], 'border-style': [CssProp.BORDER_STYLE], 'border-top': [CssProp.BORDER_TOP], 'border-top-color': [CssProp.BORDER_TOP_COLOR], 'border-top-left-radius': [CssProp.BORDER_TOP_LEFT_RADIUS], 'border-top-right-radius': [CssProp.BORDER_TOP_RIGHT_RADIUS], 'border-top-style': [CssProp.BORDER_TOP_STYLE], 'border-top-width': [CssProp.BORDER_TOP_WIDTH], 'border-width': [CssProp.BORDER_WIDTH], bottom: [CssProp.BOTTOM], box: [CssProp.BOX], 'box-shadow': [CssProp.BOX_SHADOW], 'box-sizing': [CssProp.BOX_SIZING], 'caption-side': [CssProp.CAPTION_SIDE], clear: [CssProp.CLEAR], clip: [CssProp.CLIP], color: [CssProp.COLOR], cursor: [CssProp.CURSOR], direction: [CssProp.DIRECTION], display: [CssProp.DISPLAY], 'display-inside': [CssProp.DISPLAY_INSIDE], 'display-outside': [CssProp.DISPLAY_OUTSIDE], elevation: [CssProp.ELEVATION], 'empty-cells': [CssProp.EMPTY_CELLS], float: [CssProp.FLOAT], font: [CssProp.FONT], 'font-family': [CssProp.FONT_FAMILY], 'font-size': [CssProp.FONT_SIZE], 'font-stretch': [CssProp.FONT_STRETCH], 'font-style': [CssProp.FONT_STYLE], 'font-variant': [CssProp.FONT_VARIANT], 'font-weight': [CssProp.FONT_WEIGHT], height: [CssProp.HEIGHT], left: [CssProp.LEFT], 'letter-spacing': [CssProp.LETTER_SPACING], 'line-height': [CssProp.LINE_HEIGHT], 'list-style': [CssProp.LIST_STYLE], 'list-style-image': [CssProp.LIST_STYLE_IMAGE], 'list-style-position': [CssProp.LIST_STYLE_POSITION], 'list-style-type': [CssProp.LIST_STYLE_TYPE], margin: [CssProp.MARGIN], 'margin-bottom': [CssProp.MARGIN_BOTTOM], 'margin-left': [CssProp.MARGIN_LEFT], 'margin-right': [CssProp.MARGIN_RIGHT], 'margin-top': [CssProp.MARGIN_TOP], 'max-height': [CssProp.MAX_HEIGHT], 'max-width': [CssProp.MAX_WIDTH], 'min-height': [CssProp.MIN_HEIGHT], 'min-width': [CssProp.MIN_WIDTH], opacity: [CssProp.OPACITY], outline: [CssProp.OUTLINE], 'outline-color': [CssProp.OUTLINE_COLOR], 'outline-style': [CssProp.OUTLINE_STYLE], 'outline-width': [CssProp.OUTLINE_WIDTH], overflow: [CssProp.OVERFLOW], 'overflow-wrap': [CssProp.OVERFLOW_WRAP], 'overflow-x': [CssProp.OVERFLOW_X], 'overflow-y': [CssProp.OVERFLOW_Y], padding: [CssProp.PADDING], 'padding-bottom': [CssProp.PADDING_BOTTOM], 'padding-left': [CssProp.PADDING_LEFT], 'padding-right': [CssProp.PADDING_RIGHT], 'padding-top': [CssProp.PADDING_TOP], 'page-break-after': [CssProp.PAGE_BREAK_AFTER], 'page-break-before': [CssProp.PAGE_BREAK_BEFORE], 'page-break-inside': [CssProp.PAGE_BREAK_INSIDE], 'pause-after': [CssProp.PAUSE_AFTER], perspective: [CssProp.PERSPECTIVE], pitch: [CssProp.PITCH], 'pitch-range': [CssProp.PITCH_RANGE], position: [CssProp.POSITION], quotes: [CssProp.QUOTES], resize: [CssProp.RESIZE], richness: [CssProp.RICHNESS], right: [CssProp.RIGHT], speak: [CssProp.SPEAK], 'speak-header': [CssProp.SPEAK_HEADER], 'speak-numeral': [CssProp.SPEAK_NUMERAL], 'speak-punctuation': [CssProp.SPEAK_PUNCTUATION], 'speech-rate': [CssProp.SPEECH_RATE], stress: [CssProp.STRESS], 'table-layout': [CssProp.TABLE_LAYOUT], 'text-align': [CssProp.TEXT_ALIGN], 'text-decoration': [CssProp.TEXT_DECORATION], 'text-indent': [CssProp.TEXT_INDENT], 'text-overflow': [CssProp.TEXT_OVERFLOW], 'text-shadow': [CssProp.TEXT_SHADOW], 'text-transform': [CssProp.TEXT_TRANSFORM], 'text-wrap': [CssProp.TEXT_WRAP], top: [CssProp.TOP], 'unicode-bidi': [CssProp.UNICODE_BIDI], 'vertical-align': [CssProp.VERTICAL_ALIGN], visibility: [CssProp.VISIBILITY], volume: [CssProp.VOLUME], 'white-space': [CssProp.WHITE_SPACE], width: [CssProp.WIDTH], 'word-break': [CssProp.WORD_BREAK], 'word-spacing': [CssProp.WORD_SPACING], 'word-wrap': [CssProp.WORD_WRAP], 'z-index': [CssProp.Z_INDEX], zoom: [CssProp.ZOOM] } }, transformTags: { // Set the "rel" attribute for tags to "nofollow". a: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default.a.simpleTransform('a', { rel: 'nofollow' }), // Set the "disabled" attribute for tags. input: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default.a.simpleTransform('input', { disabled: 'disabled' }) }, allowedSchemesByTag: { // Allow 'attachment:' img src (used for markdown cell attachments). img: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default.a.defaults.allowedSchemes.concat(['attachment']) }, // Override of the default option, so we can skip 'src' attribute validation. // 'src' Attributes are validated to be URIs, which does not allow for embedded (image) data. // Since embedded data is no longer deemed to be a threat, validation can be skipped. // See https://github.com/jupyterlab/jupyterlab/issues/5183 allowedSchemesAppliedToAttributes: ['href', 'cite'] }; } /** * Sanitize an HTML string. * * @param dirty - The dirty text. * * @param options - The optional sanitization options. * * @returns The sanitized string. */ sanitize(dirty, options) { return sanitize_html__WEBPACK_IMPORTED_MODULE_0___default()(dirty, Object.assign(Object.assign({}, this._options), (options || {}))); } } /** * The default instance of an `ISanitizer` meant for use by user code. */ const defaultSanitizer = new Sanitizer(); //# sourceMappingURL=sanitizer.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/search.js": /*!*********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/search.js ***! \*********************************************************/ /*! exports provided: FilterBox, FilenameSearcher */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FilterBox", function() { return FilterBox; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FilenameSearcher", function() { return FilenameSearcher; }); /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/ui-components */ "./node_modules/@jupyterlab/ui-components/lib/index.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _vdom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./vdom */ "./node_modules/@jupyterlab/apputils/lib/vdom.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * Perform a fuzzy search on a single item. */ function fuzzySearch(source, query) { // Set up the match score and indices array. let score = Infinity; let indices = null; // The regex for search word boundaries const rgx = /\b\w/g; let continueSearch = true; // Search the source by word boundary. while (continueSearch) { // Find the next word boundary in the source. let rgxMatch = rgx.exec(source); // Break if there is no more source context. if (!rgxMatch) { break; } // Run the string match on the relevant substring. let match = _lumino_algorithm__WEBPACK_IMPORTED_MODULE_1__["StringExt"].matchSumOfDeltas(source, query, rgxMatch.index); // Break if there is no match. if (!match) { break; } // Update the match if the score is better. if (match && match.score <= score) { score = match.score; indices = match.indices; } } // Bail if there was no match. if (!indices || score === Infinity) { return null; } // Handle a split match. return { score, indices }; } const FilterBox = (props) => { const [filter, setFilter] = Object(react__WEBPACK_IMPORTED_MODULE_2__["useState"])(''); if (props.forceRefresh) { Object(react__WEBPACK_IMPORTED_MODULE_2__["useEffect"])(() => { props.updateFilter((item) => { return true; }); }, []); } /** * Handler for search input changes. */ const handleChange = (e) => { const target = e.target; setFilter(target.value); props.updateFilter((item) => { if (props.useFuzzyFilter) { // Run the fuzzy search for the item and query. const query = target.value.toLowerCase(); let score = fuzzySearch(item, query); // Ignore the item if it is not a match. if (!score) { return false; } return true; } const i = item.indexOf(target.value); if (i === -1) { return false; } return true; }); }; return (react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__["InputGroup"], { type: "text", rightIcon: "ui-components:search", placeholder: props.placeholder, onChange: handleChange, className: "jp-FilterBox", value: filter })); }; /** * A widget which hosts a input textbox to filter on file names. */ const FilenameSearcher = (props) => { return _vdom__WEBPACK_IMPORTED_MODULE_3__["ReactWidget"].create(react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(FilterBox, { updateFilter: props.updateFilter, useFuzzyFilter: props.useFuzzyFilter, placeholder: props.placeholder, forceRefresh: props.forceRefresh })); }; //# sourceMappingURL=search.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/sessioncontext.js": /*!*****************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/sessioncontext.js ***! \*****************************************************************/ /*! exports provided: SessionContext, sessionContextDialogs */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SessionContext", function() { return SessionContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sessionContextDialogs", function() { return sessionContextDialogs; }); /* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/coreutils */ "./node_modules/@jupyterlab/coreutils/lib/index.js"); /* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/translation */ "./node_modules/@jupyterlab/translation/lib/index.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/signaling */ "./node_modules/@lumino/signaling/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var _dialog__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./dialog */ "./node_modules/@jupyterlab/apputils/lib/dialog.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * The default implementation for a session context object. */ class SessionContext { /** * Construct a new session context. */ constructor(options) { var _a, _b, _c, _d; this._path = ''; this._name = ''; this._type = ''; this._prevKernelName = ''; this._isDisposed = false; this._disposed = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); this._session = null; this._ready = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["PromiseDelegate"](); this._initializing = false; this._initStarted = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["PromiseDelegate"](); this._initPromise = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["PromiseDelegate"](); this._isReady = false; this._isTerminating = false; this._isRestarting = false; this._kernelChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); this._sessionChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); this._statusChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); this._connectionStatusChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); this._pendingInput = false; this._iopubMessage = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); this._unhandledMessage = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); this._propertyChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); this._dialog = null; this._busyDisposable = null; this._pendingKernelName = ''; this._pendingSessionRequest = ''; this.sessionManager = options.sessionManager; this.specsManager = options.specsManager; this.translator = options.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__["nullTranslator"]; this._trans = this.translator.load('jupyterlab'); this._path = (_a = options.path) !== null && _a !== void 0 ? _a : _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["UUID"].uuid4(); this._type = (_b = options.type) !== null && _b !== void 0 ? _b : ''; this._name = (_c = options.name) !== null && _c !== void 0 ? _c : ''; this._setBusy = options.setBusy; this._kernelPreference = (_d = options.kernelPreference) !== null && _d !== void 0 ? _d : {}; } /** * The current session connection. */ get session() { var _a; return (_a = this._session) !== null && _a !== void 0 ? _a : null; } /** * The session path. * * #### Notes * Typically `.session.path` should be used. This attribute is useful if * there is no current session. */ get path() { return this._path; } /** * The session type. * * #### Notes * Typically `.session.type` should be used. This attribute is useful if * there is no current session. */ get type() { return this._type; } /** * The session name. * * #### Notes * Typically `.session.name` should be used. This attribute is useful if * there is no current session. */ get name() { return this._name; } /** * A signal emitted when the kernel connection changes, proxied from the session connection. */ get kernelChanged() { return this._kernelChanged; } /** * A signal emitted when the session connection changes. */ get sessionChanged() { return this._sessionChanged; } /** * A signal emitted when the kernel status changes, proxied from the kernel. */ get statusChanged() { return this._statusChanged; } /** * A flag indicating if the session has ending input, proxied from the kernel. */ get pendingInput() { return this._pendingInput; } /** * A signal emitted when the kernel status changes, proxied from the kernel. */ get connectionStatusChanged() { return this._connectionStatusChanged; } /** * A signal emitted for iopub kernel messages, proxied from the kernel. */ get iopubMessage() { return this._iopubMessage; } /** * A signal emitted for an unhandled kernel message, proxied from the kernel. */ get unhandledMessage() { return this._unhandledMessage; } /** * A signal emitted when a session property changes, proxied from the current session. */ get propertyChanged() { return this._propertyChanged; } /** * The kernel preference of this client session. * * This is used when selecting a new kernel, and should reflect the sort of * kernel the activity prefers. */ get kernelPreference() { return this._kernelPreference; } set kernelPreference(value) { this._kernelPreference = value; } /** * Whether the context is ready. */ get isReady() { return this._isReady; } /** * A promise that is fulfilled when the context is ready. */ get ready() { return this._ready.promise; } /** * Whether the context is terminating. */ get isTerminating() { return this._isTerminating; } /** * Whether the context is restarting. */ get isRestarting() { return this._isRestarting; } /** * Whether the kernel is "No Kernel" or not. * * #### Notes * As the displayed name is translated, this can be used directly. */ get hasNoKernel() { return this.kernelDisplayName === this.noKernelName; } /** * The display name of the current kernel, or a sensible alternative. * * #### Notes * This is a convenience function to have a consistent sensible name for the * kernel. */ get kernelDisplayName() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; const kernel = (_a = this.session) === null || _a === void 0 ? void 0 : _a.kernel; if (this._pendingKernelName === this.noKernelName) { return this.noKernelName; } if (!kernel && !this.isReady && this.kernelPreference.canStart !== false && this.kernelPreference.shouldStart !== false) { let name = this._pendingKernelName || SessionContext.getDefaultKernel({ specs: this.specsManager.specs, sessions: this.sessionManager.running(), preference: this.kernelPreference }) || ''; if (name) { name = (_d = (_c = (_b = this.specsManager.specs) === null || _b === void 0 ? void 0 : _b.kernelspecs[name]) === null || _c === void 0 ? void 0 : _c.display_name) !== null && _d !== void 0 ? _d : name; return name; } return this.noKernelName; } if (this._pendingKernelName) { return ((_g = (_f = (_e = this.specsManager.specs) === null || _e === void 0 ? void 0 : _e.kernelspecs[this._pendingKernelName]) === null || _f === void 0 ? void 0 : _f.display_name) !== null && _g !== void 0 ? _g : this._pendingKernelName); } if (!kernel) { return this.noKernelName; } return ((_k = (_j = (_h = this.specsManager.specs) === null || _h === void 0 ? void 0 : _h.kernelspecs[kernel.name]) === null || _j === void 0 ? void 0 : _j.display_name) !== null && _k !== void 0 ? _k : kernel.name); } /** * A sensible status to display * * #### Notes * This combines the status and connection status into a single status for * the user. */ get kernelDisplayStatus() { var _a, _b; const kernel = (_a = this.session) === null || _a === void 0 ? void 0 : _a.kernel; if (this._isTerminating) { return 'terminating'; } if (this._isRestarting) { return 'restarting'; } if (this._pendingKernelName === this.noKernelName) { return 'unknown'; } if (!kernel && this._pendingKernelName) { return 'initializing'; } if (!kernel && !this.isReady && this.kernelPreference.canStart !== false && this.kernelPreference.shouldStart !== false) { return 'initializing'; } return ((_b = ((kernel === null || kernel === void 0 ? void 0 : kernel.connectionStatus) === 'connected' ? kernel === null || kernel === void 0 ? void 0 : kernel.status : kernel === null || kernel === void 0 ? void 0 : kernel.connectionStatus)) !== null && _b !== void 0 ? _b : 'unknown'); } /** * The name of the previously started kernel. */ get prevKernelName() { return this._prevKernelName; } /** * Test whether the context is disposed. */ get isDisposed() { return this._isDisposed; } /** * A signal emitted when the poll is disposed. */ get disposed() { return this._disposed; } /** * Get the constant displayed name for "No Kernel" */ get noKernelName() { return this._trans.__('No Kernel'); } /** * Dispose of the resources held by the context. */ dispose() { if (this._isDisposed) { return; } this._isDisposed = true; this._disposed.emit(); if (this._session) { if (this.kernelPreference.shutdownOnDispose) { // Fire and forget the session shutdown request this.sessionManager.shutdown(this._session.id).catch(reason => { console.error(`Kernel not shut down ${reason}`); }); } // Dispose the session connection this._session.dispose(); this._session = null; } if (this._dialog) { this._dialog.dispose(); } if (this._busyDisposable) { this._busyDisposable.dispose(); this._busyDisposable = null; } _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"].clearData(this); } /** * Restart the current Kernel. * * @returns A promise that resolves when the kernel is restarted. */ async restartKernel() { var _a, _b, _c, _d, _e, _f; const kernel = ((_a = this.session) === null || _a === void 0 ? void 0 : _a.kernel) || null; if (this._isRestarting) { return; } this._isRestarting = true; this._isReady = false; this._statusChanged.emit('restarting'); try { await ((_c = (_b = this.session) === null || _b === void 0 ? void 0 : _b.kernel) === null || _c === void 0 ? void 0 : _c.restart()); this._isReady = true; } catch (e) { console.error(e); } this._isRestarting = false; this._statusChanged.emit(((_e = (_d = this.session) === null || _d === void 0 ? void 0 : _d.kernel) === null || _e === void 0 ? void 0 : _e.status) || 'unknown'); this._kernelChanged.emit({ name: 'kernel', oldValue: kernel, newValue: ((_f = this.session) === null || _f === void 0 ? void 0 : _f.kernel) || null }); } /** * Change the current kernel associated with the session. */ async changeKernel(options = {}) { if (this.isDisposed) { throw new Error('Disposed'); } // Wait for the initialization method to try // and start its kernel first to ensure consistent // ordering. await this._initStarted.promise; return this._changeKernel(options); } /** * Kill the kernel and shutdown the session. * * @returns A promise that resolves when the session is shut down. */ async shutdown() { if (this.isDisposed || !this._initializing) { return; } await this._initStarted.promise; this._pendingSessionRequest = ''; this._pendingKernelName = this.noKernelName; return this._shutdownSession(); } /** * Initialize the session context * * @returns A promise that resolves with whether to ask the user to select a kernel. * * #### Notes * If a server session exists on the current path, we will connect to it. * If preferences include disabling `canStart` or `shouldStart`, no * server session will be started. * If a kernel id is given, we attempt to start a session with that id. * If a default kernel is available, we connect to it. * Otherwise we ask the user to select a kernel. */ async initialize() { if (this._initializing) { return this._initPromise.promise; } this._initializing = true; const needsSelection = await this._initialize(); if (!needsSelection) { this._isReady = true; this._ready.resolve(undefined); } if (!this._pendingSessionRequest) { this._initStarted.resolve(void 0); } this._initPromise.resolve(needsSelection); return needsSelection; } /** * Inner initialize function that doesn't handle promises. * This makes it easier to consolidate promise handling logic. */ async _initialize() { const manager = this.sessionManager; await manager.ready; await manager.refreshRunning(); const model = Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["find"])(manager.running(), item => { return item.path === this._path; }); if (model) { try { const session = manager.connectTo({ model }); this._handleNewSession(session); } catch (err) { void this._handleSessionError(err); return Promise.reject(err); } } return await this._startIfNecessary(); } /** * Shut down the current session. */ async _shutdownSession() { var _a; const session = this._session; // Capture starting values in case an error is raised. const isTerminating = this._isTerminating; const isReady = this._isReady; this._isTerminating = true; this._isReady = false; this._statusChanged.emit('terminating'); try { await (session === null || session === void 0 ? void 0 : session.shutdown()); this._isTerminating = false; session === null || session === void 0 ? void 0 : session.dispose(); this._session = null; const kernel = (session === null || session === void 0 ? void 0 : session.kernel) || null; this._statusChanged.emit('unknown'); this._kernelChanged.emit({ name: 'kernel', oldValue: kernel, newValue: null }); this._sessionChanged.emit({ name: 'session', oldValue: session, newValue: null }); } catch (err) { this._isTerminating = isTerminating; this._isReady = isReady; const status = (_a = session === null || session === void 0 ? void 0 : session.kernel) === null || _a === void 0 ? void 0 : _a.status; if (status === undefined) { this._statusChanged.emit('unknown'); } else { this._statusChanged.emit(status); } throw err; } return; } /** * Start the session if necessary. * * @returns Whether to ask the user to pick a kernel. */ async _startIfNecessary() { var _a; const preference = this.kernelPreference; if (this.isDisposed || ((_a = this.session) === null || _a === void 0 ? void 0 : _a.kernel) || preference.shouldStart === false || preference.canStart === false) { // Not necessary to start a kernel return false; } let options; if (preference.id) { options = { id: preference.id }; } else { const name = SessionContext.getDefaultKernel({ specs: this.specsManager.specs, sessions: this.sessionManager.running(), preference }); if (name) { options = { name }; } } if (options) { try { await this._changeKernel(options); return false; } catch (err) { /* no-op */ } } // Always fall back to selecting a kernel return true; } /** * Change the kernel. */ async _changeKernel(model = {}, isInit = false) { if (model.name) { this._pendingKernelName = model.name; } if (!this._session) { this._kernelChanged.emit({ name: 'kernel', oldValue: null, newValue: null }); } // Guarantee that the initialized kernel // will be started first. if (!this._pendingSessionRequest) { this._initStarted.resolve(void 0); } // If we already have a session, just change the kernel. if (this._session && !this._isTerminating) { try { await this._session.changeKernel(model); return this._session.kernel; } catch (err) { void this._handleSessionError(err); throw err; } } // Use a UUID for the path to overcome a race condition on the server // where it will re-use a session for a given path but only after // the kernel finishes starting. // We later switch to the real path below. // Use the correct directory so the kernel will be started in that directory. const dirName = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__["PathExt"].dirname(this._path); const requestId = (this._pendingSessionRequest = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__["PathExt"].join(dirName, _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["UUID"].uuid4())); try { this._statusChanged.emit('starting'); const session = await this.sessionManager.startNew({ path: requestId, type: this._type, name: this._name, kernel: model }); // Handle a preempt. if (this._pendingSessionRequest !== session.path) { await session.shutdown(); session.dispose(); return null; } // Change to the real path. await session.setPath(this._path); // Update the name in case it has changed since we launched the session. await session.setName(this._name); if (this._session && !this._isTerminating) { await this._shutdownSession(); } return this._handleNewSession(session); } catch (err) { void this._handleSessionError(err); throw err; } } /** * Handle a new session object. */ _handleNewSession(session) { var _a, _b, _c; if (this.isDisposed) { throw Error('Disposed'); } if (!this._isReady) { this._isReady = true; this._ready.resolve(undefined); } if (this._session) { this._session.dispose(); } this._session = session; this._pendingKernelName = ''; if (session) { this._prevKernelName = (_b = (_a = session.kernel) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : ''; session.disposed.connect(this._onSessionDisposed, this); session.propertyChanged.connect(this._onPropertyChanged, this); session.kernelChanged.connect(this._onKernelChanged, this); session.statusChanged.connect(this._onStatusChanged, this); session.connectionStatusChanged.connect(this._onConnectionStatusChanged, this); session.pendingInput.connect(this._onPendingInput, this); session.iopubMessage.connect(this._onIopubMessage, this); session.unhandledMessage.connect(this._onUnhandledMessage, this); if (session.path !== this._path) { this._onPropertyChanged(session, 'path'); } if (session.name !== this._name) { this._onPropertyChanged(session, 'name'); } if (session.type !== this._type) { this._onPropertyChanged(session, 'type'); } } // Any existing session/kernel connection was disposed above when the session was // disposed, so the oldValue should be null. this._sessionChanged.emit({ name: 'session', oldValue: null, newValue: session }); this._kernelChanged.emit({ oldValue: null, newValue: (session === null || session === void 0 ? void 0 : session.kernel) || null, name: 'kernel' }); this._statusChanged.emit(((_c = session === null || session === void 0 ? void 0 : session.kernel) === null || _c === void 0 ? void 0 : _c.status) || 'unknown'); return (session === null || session === void 0 ? void 0 : session.kernel) || null; } /** * Handle an error in session startup. */ async _handleSessionError(err) { this._handleNewSession(null); let traceback = ''; let message = ''; try { traceback = err.traceback; message = err.message; } catch (err) { // no-op } await this._displayKernelError(message, traceback); } /** * Display kernel error */ async _displayKernelError(message, traceback) { const body = (react__WEBPACK_IMPORTED_MODULE_6__["createElement"]("div", null, message && react__WEBPACK_IMPORTED_MODULE_6__["createElement"]("pre", null, message), traceback && (react__WEBPACK_IMPORTED_MODULE_6__["createElement"]("details", { className: "jp-mod-wide" }, react__WEBPACK_IMPORTED_MODULE_6__["createElement"]("pre", null, traceback))))); const dialog = (this._dialog = new _dialog__WEBPACK_IMPORTED_MODULE_7__["Dialog"]({ title: this._trans.__('Error Starting Kernel'), body, buttons: [_dialog__WEBPACK_IMPORTED_MODULE_7__["Dialog"].okButton()] })); await dialog.launch(); this._dialog = null; } /** * Handle a session termination. */ _onSessionDisposed() { if (this._session) { const oldValue = this._session; this._session = null; const newValue = this._session; this._sessionChanged.emit({ name: 'session', oldValue, newValue }); } } /** * Handle a change to a session property. */ _onPropertyChanged(sender, property) { switch (property) { case 'path': this._path = sender.path; break; case 'name': this._name = sender.name; break; case 'type': this._type = sender.type; break; default: throw new Error(`unrecognized property ${property}`); } this._propertyChanged.emit(property); } /** * Handle a change to the kernel. */ _onKernelChanged(sender, args) { this._kernelChanged.emit(args); } /** * Handle a change to the session status. */ _onStatusChanged(sender, status) { var _a; if (status === 'dead') { const model = (_a = sender.kernel) === null || _a === void 0 ? void 0 : _a.model; if (model === null || model === void 0 ? void 0 : model.reason) { const traceback = model.traceback || ''; void this._displayKernelError(model.reason, traceback); } } // Set that this kernel is busy, if we haven't already // If we have already, and now we aren't busy, dispose // of the busy disposable. if (this._setBusy) { if (status === 'busy') { if (!this._busyDisposable) { this._busyDisposable = this._setBusy(); } } else { if (this._busyDisposable) { this._busyDisposable.dispose(); this._busyDisposable = null; } } } // Proxy the signal this._statusChanged.emit(status); } /** * Handle a change to the session status. */ _onConnectionStatusChanged(sender, status) { // Proxy the signal this._connectionStatusChanged.emit(status); } /** * Handle a change to the pending input. */ _onPendingInput(sender, value) { // Set the signal value this._pendingInput = value; } /** * Handle an iopub message. */ _onIopubMessage(sender, message) { if (message.header.msg_type === 'shutdown_reply') { this.session.kernel.removeInputGuard(); } this._iopubMessage.emit(message); } /** * Handle an unhandled message. */ _onUnhandledMessage(sender, message) { this._unhandledMessage.emit(message); } } /** * A namespace for `SessionContext` statics. */ (function (SessionContext) { /** * Get the default kernel name given select options. */ function getDefaultKernel(options) { return Private.getDefaultKernel(options); } SessionContext.getDefaultKernel = getDefaultKernel; })(SessionContext || (SessionContext = {})); /** * The default implementation of the client session dialog provider. */ const sessionContextDialogs = { /** * Select a kernel for the session. */ async selectKernel(sessionContext, translator) { if (sessionContext.isDisposed) { return Promise.resolve(); } translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__["nullTranslator"]; const trans = translator.load('jupyterlab'); // If there is no existing kernel, offer the option // to keep no kernel. let label = trans.__('Cancel'); if (sessionContext.hasNoKernel) { label = sessionContext.kernelDisplayName; } const buttons = [ _dialog__WEBPACK_IMPORTED_MODULE_7__["Dialog"].cancelButton({ label }), _dialog__WEBPACK_IMPORTED_MODULE_7__["Dialog"].okButton({ label: trans.__('Select') }) ]; const dialog = new _dialog__WEBPACK_IMPORTED_MODULE_7__["Dialog"]({ title: trans.__('Select Kernel'), body: new Private.KernelSelector(sessionContext, translator), buttons }); const result = await dialog.launch(); if (sessionContext.isDisposed || !result.button.accept) { return; } const model = result.value; if (model === null && !sessionContext.hasNoKernel) { return sessionContext.shutdown(); } if (model) { await sessionContext.changeKernel(model); } }, /** * Restart the session. * * @returns A promise that resolves with whether the kernel has restarted. * * #### Notes * If there is a running kernel, present a dialog. * If there is no kernel, we start a kernel with the last run * kernel name and resolves with `true`. */ async restart(sessionContext, translator) { var _a; translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__["nullTranslator"]; const trans = translator.load('jupyterlab'); await sessionContext.initialize(); if (sessionContext.isDisposed) { throw new Error('session already disposed'); } const kernel = (_a = sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel; if (!kernel && sessionContext.prevKernelName) { await sessionContext.changeKernel({ name: sessionContext.prevKernelName }); return true; } // Bail if there is no previous kernel to start. if (!kernel) { throw new Error('No kernel to restart'); } const restartBtn = _dialog__WEBPACK_IMPORTED_MODULE_7__["Dialog"].warnButton({ label: 'Restart' }); const result = await Object(_dialog__WEBPACK_IMPORTED_MODULE_7__["showDialog"])({ title: trans.__('Restart Kernel?'), body: trans.__('Do you want to restart the current kernel? All variables will be lost.'), buttons: [_dialog__WEBPACK_IMPORTED_MODULE_7__["Dialog"].cancelButton(), restartBtn] }); if (kernel.isDisposed) { return false; } if (result.button.accept) { await sessionContext.restartKernel(); return true; } return false; } }; /** * The namespace for module private data. */ var Private; (function (Private) { /** * A widget that provides a kernel selection. */ class KernelSelector extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_5__["Widget"] { /** * Create a new kernel selector widget. */ constructor(sessionContext, translator) { super({ node: createSelectorNode(sessionContext, translator) }); } /** * Get the value of the kernel selector widget. */ getValue() { const selector = this.node.querySelector('select'); return JSON.parse(selector.value); } } Private.KernelSelector = KernelSelector; /** * Create a node for a kernel selector widget. */ function createSelectorNode(sessionContext, translator) { // Create the dialog body. translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__["nullTranslator"]; const trans = translator.load('jupyterlab'); const body = document.createElement('div'); const text = document.createElement('label'); text.textContent = `${trans.__('Select kernel for:')} "${sessionContext.name}"`; body.appendChild(text); const options = getKernelSearch(sessionContext); const selector = document.createElement('select'); populateKernelSelect(selector, options, translator, !sessionContext.hasNoKernel ? sessionContext.kernelDisplayName : null); body.appendChild(selector); return body; } /** * Get the default kernel name given select options. */ function getDefaultKernel(options) { var _a; const { specs, preference } = options; const { name, language, shouldStart, canStart, autoStartDefault } = preference; if (!specs || shouldStart === false || canStart === false) { return null; } const defaultName = autoStartDefault ? specs.default : null; if (!name && !language) { return defaultName; } // Look for an exact match of a spec name. for (const specName in specs.kernelspecs) { if (specName === name) { return name; } } // Bail if there is no language. if (!language) { return defaultName; } // Check for a single kernel matching the language. const matches = []; for (const specName in specs.kernelspecs) { const kernelLanguage = (_a = specs.kernelspecs[specName]) === null || _a === void 0 ? void 0 : _a.language; if (language === kernelLanguage) { matches.push(specName); } } if (matches.length === 1) { const specName = matches[0]; console.warn('No exact match found for ' + specName + ', using kernel ' + specName + ' that matches ' + 'language=' + language); return specName; } // No matches found. return defaultName; } Private.getDefaultKernel = getDefaultKernel; /** * Populate a kernel select node for the session. */ function populateKernelSelect(node, options, translator, currentKernelDisplayName = null) { while (node.firstChild) { node.removeChild(node.firstChild); } const { preference, sessions, specs } = options; const { name, id, language, canStart, shouldStart } = preference; translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__["nullTranslator"]; const trans = translator.load('jupyterlab'); if (!specs || canStart === false) { node.appendChild(optionForNone(translator)); node.value = 'null'; node.disabled = true; return; } node.disabled = false; // Create mappings of display names and languages for kernel name. const displayNames = Object.create(null); const languages = Object.create(null); for (const name in specs.kernelspecs) { const spec = specs.kernelspecs[name]; displayNames[name] = spec.display_name; languages[name] = spec.language; } // Handle a kernel by name. const names = []; if (name && name in specs.kernelspecs) { names.push(name); } // Then look by language. if (language) { for (const specName in specs.kernelspecs) { if (name !== specName && languages[specName] === language) { names.push(specName); } } } // Use the default kernel if no kernels were found. if (!names.length) { names.push(specs.default); } // Handle a preferred kernels in order of display name. const preferred = document.createElement('optgroup'); preferred.label = trans.__('Start Preferred Kernel'); names.sort((a, b) => displayNames[a].localeCompare(displayNames[b])); for (const name of names) { preferred.appendChild(optionForName(name, displayNames[name])); } if (preferred.firstChild) { node.appendChild(preferred); } // Add an option for no kernel node.appendChild(optionForNone()); const other = document.createElement('optgroup'); other.label = trans.__('Start Other Kernel'); // Add the rest of the kernel names in alphabetical order. const otherNames = []; for (const specName in specs.kernelspecs) { if (names.indexOf(specName) !== -1) { continue; } otherNames.push(specName); } otherNames.sort((a, b) => displayNames[a].localeCompare(displayNames[b])); for (const otherName of otherNames) { other.appendChild(optionForName(otherName, displayNames[otherName])); } // Add a separator option if there were any other names. if (otherNames.length) { node.appendChild(other); } // Handle the default value. if (shouldStart === false) { node.value = 'null'; } else { let selectedIndex = 0; if (currentKernelDisplayName) { // Select current kernel by default. selectedIndex = [...node.options].findIndex(option => option.text === currentKernelDisplayName); selectedIndex = Math.max(selectedIndex, 0); } node.selectedIndex = selectedIndex; } // Bail if there are no sessions. if (!sessions) { return; } // Add the sessions using the preferred language first. const matchingSessions = []; const otherSessions = []; Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["each"])(sessions, session => { var _a; if (language && session.kernel && languages[session.kernel.name] === language && session.kernel.id !== id) { matchingSessions.push(session); } else if (((_a = session.kernel) === null || _a === void 0 ? void 0 : _a.id) !== id) { otherSessions.push(session); } }); const matching = document.createElement('optgroup'); matching.label = trans.__('Use Kernel from Preferred Session'); node.appendChild(matching); if (matchingSessions.length) { matchingSessions.sort((a, b) => { return a.path.localeCompare(b.path); }); Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["each"])(matchingSessions, session => { const name = session.kernel ? displayNames[session.kernel.name] : ''; matching.appendChild(optionForSession(session, name, translator)); }); } const otherSessionsNode = document.createElement('optgroup'); otherSessionsNode.label = trans.__('Use Kernel from Other Session'); node.appendChild(otherSessionsNode); if (otherSessions.length) { otherSessions.sort((a, b) => { return a.path.localeCompare(b.path); }); Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["each"])(otherSessions, session => { const name = session.kernel ? displayNames[session.kernel.name] || session.kernel.name : ''; otherSessionsNode.appendChild(optionForSession(session, name, translator)); }); } } Private.populateKernelSelect = populateKernelSelect; /** * Get the kernel search options given a session context and session manager. */ function getKernelSearch(sessionContext) { return { specs: sessionContext.specsManager.specs, sessions: sessionContext.sessionManager.running(), preference: sessionContext.kernelPreference }; } /** * Create an option element for a kernel name. */ function optionForName(name, displayName) { const option = document.createElement('option'); option.text = displayName; option.value = JSON.stringify({ name }); return option; } /** * Create an option for no kernel. */ function optionForNone(translator) { translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__["nullTranslator"]; const trans = translator.load('jupyterlab'); const group = document.createElement('optgroup'); group.label = trans.__('Use No Kernel'); const option = document.createElement('option'); option.text = trans.__('No Kernel'); option.value = 'null'; group.appendChild(option); return group; } /** * Create an option element for a session. */ function optionForSession(session, displayName, translator) { var _a, _b; translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__["nullTranslator"]; const trans = translator.load('jupyterlab'); const option = document.createElement('option'); const sessionName = session.name || _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__["PathExt"].basename(session.path); option.text = sessionName; option.value = JSON.stringify({ id: (_a = session.kernel) === null || _a === void 0 ? void 0 : _a.id }); option.title = `${trans.__('Path:')} ${session.path}\n` + `${trans.__('Name:')} ${sessionName}\n` + `${trans.__('Kernel Name:')} ${displayName}\n` + `${trans.__('Kernel Id:')} ${(_b = session.kernel) === null || _b === void 0 ? void 0 : _b.id}`; return option; } })(Private || (Private = {})); //# sourceMappingURL=sessioncontext.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/spinner.js": /*!**********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/spinner.js ***! \**********************************************************/ /*! exports provided: Spinner */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Spinner", function() { return Spinner; }); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* ----------------------------------------------------------------------------- | Copyright (c) Jupyter Development Team. | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ /** * The spinner class. */ class Spinner extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__["Widget"] { /** * Construct a spinner widget. */ constructor() { super(); this.addClass('jp-Spinner'); this.node.tabIndex = -1; const content = document.createElement('div'); content.className = 'jp-SpinnerContent'; this.node.appendChild(content); } /** * Handle `'activate-request'` messages. */ onActivateRequest(msg) { this.node.focus(); } } //# sourceMappingURL=spinner.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/splash.js": /*!*********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/splash.js ***! \*********************************************************/ /*! exports provided: ISplashScreen */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ISplashScreen", function() { return ISplashScreen; }); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /* tslint:disable */ /** * The main menu token. */ const ISplashScreen = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["Token"]('@jupyterlab/apputils:ISplashScreen'); //# sourceMappingURL=splash.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/styling.js": /*!**********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/styling.js ***! \**********************************************************/ /*! exports provided: Styling */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Styling", function() { return Styling; }); /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/ui-components */ "./node_modules/@jupyterlab/ui-components/lib/index.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * A namespace for node styling. */ var Styling; (function (Styling) { /** * Style a node and its child elements with the default tag names. * * @param node - The base node. * * @param className - The optional CSS class to add to styled nodes. */ function styleNode(node, className = '') { styleNodeByTag(node, 'select', className); styleNodeByTag(node, 'textarea', className); styleNodeByTag(node, 'input', className); styleNodeByTag(node, 'button', className); } Styling.styleNode = styleNode; /** * Style a node and its elements that have a given tag name. * * @param node - The base node. * * @param tagName - The html tag name to style. * * @param className - The optional CSS class to add to styled nodes. */ function styleNodeByTag(node, tagName, className = '') { if (node.localName === tagName) { node.classList.add('jp-mod-styled'); } if (node.localName === 'select') { wrapSelect(node); } const nodes = node.getElementsByTagName(tagName); for (let i = 0; i < nodes.length; i++) { const child = nodes[i]; child.classList.add('jp-mod-styled'); if (className) { child.classList.add(className); } if (tagName === 'select') { wrapSelect(child); } } } Styling.styleNodeByTag = styleNodeByTag; /** * Wrap a select node. */ function wrapSelect(node) { const wrapper = document.createElement('div'); wrapper.classList.add('jp-select-wrapper'); node.addEventListener('focus', Private.onFocus); node.addEventListener('blur', Private.onFocus); node.classList.add('jp-mod-styled'); if (node.parentElement) { node.parentElement.replaceChild(wrapper, node); } wrapper.appendChild(node); // add the icon node wrapper.appendChild(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__["caretDownEmptyIcon"].element({ tag: 'span', stylesheet: 'select', right: '8px', top: '5px', width: '18px' })); return wrapper; } Styling.wrapSelect = wrapSelect; })(Styling || (Styling = {})); /** * The namespace for module private data. */ var Private; (function (Private) { /** * Handle a focus event on a styled select. */ function onFocus(event) { const target = event.target; const parent = target.parentElement; if (!parent) { return; } if (event.type === 'focus') { parent.classList.add('jp-mod-focused'); } else { parent.classList.remove('jp-mod-focused'); } } Private.onFocus = onFocus; })(Private || (Private = {})); //# sourceMappingURL=styling.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/thememanager.js": /*!***************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/thememanager.js ***! \***************************************************************/ /*! exports provided: ThemeManager */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ThemeManager", function() { return ThemeManager; }); /* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/coreutils */ "./node_modules/@jupyterlab/coreutils/lib/index.js"); /* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/translation */ "./node_modules/@jupyterlab/translation/lib/index.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/disposable */ "./node_modules/@lumino/disposable/dist/index.es6.js"); /* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/signaling */ "./node_modules/@lumino/signaling/dist/index.es6.js"); /* harmony import */ var _dialog__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dialog */ "./node_modules/@jupyterlab/apputils/lib/dialog.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * The number of milliseconds between theme loading attempts. */ const REQUEST_INTERVAL = 75; /** * The number of times to attempt to load a theme before giving up. */ const REQUEST_THRESHOLD = 20; /** * A class that provides theme management. */ class ThemeManager { /** * Construct a new theme manager. */ constructor(options) { this._current = null; this._links = []; this._overrides = {}; this._overrideProps = {}; this._outstanding = null; this._pending = 0; this._requests = {}; this._themes = {}; this._themeChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_4__["Signal"](this); const { host, key, splash, url } = options; this.translator = options.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__["nullTranslator"]; this._trans = this.translator.load('jupyterlab'); const registry = options.settings; this._base = url; this._host = host; this._splash = splash || null; void registry.load(key).then(settings => { this._settings = settings; // set up css overrides once we have a pointer to the settings schema this._initOverrideProps(); this._settings.changed.connect(this._loadSettings, this); this._loadSettings(); }); } /** * Get the name of the current theme. */ get theme() { return this._current; } /** * The names of the registered themes. */ get themes() { return Object.keys(this._themes); } /** * A signal fired when the application theme changes. */ get themeChanged() { return this._themeChanged; } /** * Get the value of a CSS variable from its key. * * @param key - A Jupyterlab CSS variable, without the leading '--jp-'. * * @return value - The current value of the Jupyterlab CSS variable */ getCSS(key) { var _a; return ((_a = this._overrides[key]) !== null && _a !== void 0 ? _a : getComputedStyle(document.documentElement).getPropertyValue(`--jp-${key}`)); } /** * Load a theme CSS file by path. * * @param path - The path of the file to load. */ loadCSS(path) { const base = this._base; const href = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__["URLExt"].isLocal(path) ? _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__["URLExt"].join(base, path) : path; const links = this._links; return new Promise((resolve, reject) => { const link = document.createElement('link'); link.setAttribute('rel', 'stylesheet'); link.setAttribute('type', 'text/css'); link.setAttribute('href', href); link.addEventListener('load', () => { resolve(undefined); }); link.addEventListener('error', () => { reject(`Stylesheet failed to load: ${href}`); }); document.body.appendChild(link); links.push(link); // add any css overrides to document this.loadCSSOverrides(); }); } /** * Loads all current CSS overrides from settings. If an override has been * removed or is invalid, this function unloads it instead. */ loadCSSOverrides() { var _a; const newOverrides = (_a = this._settings.user['overrides']) !== null && _a !== void 0 ? _a : {}; // iterate over the union of current and new CSS override keys Object.keys(Object.assign(Object.assign({}, this._overrides), newOverrides)).forEach(key => { const val = newOverrides[key]; if (val && this.validateCSS(key, val)) { // validation succeeded, set the override document.documentElement.style.setProperty(`--jp-${key}`, val); } else { // if key is not present or validation failed, the override will be removed delete newOverrides[key]; document.documentElement.style.removeProperty(`--jp-${key}`); } }); // replace the current overrides with the new ones this._overrides = newOverrides; } /** * Validate a CSS value w.r.t. a key * * @param key - A Jupyterlab CSS variable, without the leading '--jp-'. * * @param val - A candidate CSS value */ validateCSS(key, val) { // determine the css property corresponding to the key const prop = this._overrideProps[key]; if (!prop) { console.warn('CSS validation failed: could not find property corresponding to key.\n' + `key: '${key}', val: '${val}'`); return false; } // use built-in validation once we have the corresponding property if (CSS.supports(prop, val)) { return true; } else { console.warn('CSS validation failed: invalid value.\n' + `key: '${key}', val: '${val}', prop: '${prop}'`); return false; } } /** * Register a theme with the theme manager. * * @param theme - The theme to register. * * @returns A disposable that can be used to unregister the theme. */ register(theme) { const { name } = theme; const themes = this._themes; if (themes[name]) { throw new Error(`Theme already registered for ${name}`); } themes[name] = theme; return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_3__["DisposableDelegate"](() => { delete themes[name]; }); } /** * Add a CSS override to the settings. */ setCSSOverride(key, value) { return this._settings.set('overrides', Object.assign(Object.assign({}, this._overrides), { [key]: value })); } /** * Set the current theme. */ setTheme(name) { return this._settings.set('theme', name); } /** * Test whether a given theme is light. */ isLight(name) { return this._themes[name].isLight; } /** * Increase a font size w.r.t. its current setting or its value in the * current theme. * * @param key - A Jupyterlab font size CSS variable, without the leading '--jp-'. */ incrFontSize(key) { return this._incrFontSize(key, true); } /** * Decrease a font size w.r.t. its current setting or its value in the * current theme. * * @param key - A Jupyterlab font size CSS variable, without the leading '--jp-'. */ decrFontSize(key) { return this._incrFontSize(key, false); } /** * Test whether a given theme styles scrollbars, * and if the user has scrollbar styling enabled. */ themeScrollbars(name) { return (!!this._settings.composite['theme-scrollbars'] && !!this._themes[name].themeScrollbars); } /** * Test if the user has scrollbar styling enabled. */ isToggledThemeScrollbars() { return !!this._settings.composite['theme-scrollbars']; } /** * Toggle the `theme-scrollbars` setting. */ toggleThemeScrollbars() { return this._settings.set('theme-scrollbars', !this._settings.composite['theme-scrollbars']); } /** * Get the display name of the theme. */ getDisplayName(name) { var _a, _b; return (_b = (_a = this._themes[name]) === null || _a === void 0 ? void 0 : _a.displayName) !== null && _b !== void 0 ? _b : name; } /** * Change a font size by a positive or negative increment. */ _incrFontSize(key, add = true) { var _a; // get the numeric and unit parts of the current font size const parts = ((_a = this.getCSS(key)) !== null && _a !== void 0 ? _a : '13px').split(/([a-zA-Z]+)/); // determine the increment const incr = (add ? 1 : -1) * (parts[1] === 'em' ? 0.1 : 1); // increment the font size and set it as an override return this.setCSSOverride(key, `${Number(parts[0]) + incr}${parts[1]}`); } /** * Initialize the key -> property dict for the overrides */ _initOverrideProps() { const definitions = this._settings.schema.definitions; const overidesSchema = definitions.cssOverrides.properties; Object.keys(overidesSchema).forEach(key => { // override validation is against the CSS property in the description // field. Example: for key ui-font-family, .description is font-family this._overrideProps[key] = overidesSchema[key].description; }); } /** * Handle the current settings. */ _loadSettings() { const outstanding = this._outstanding; const pending = this._pending; const requests = this._requests; // If another request is pending, cancel it. if (pending) { window.clearTimeout(pending); this._pending = 0; } const settings = this._settings; const themes = this._themes; const theme = settings.composite['theme']; // If another promise is outstanding, wait until it finishes before // attempting to load the settings. Because outstanding promises cannot // be aborted, the order in which they occur must be enforced. if (outstanding) { outstanding .then(() => { this._loadSettings(); }) .catch(() => { this._loadSettings(); }); this._outstanding = null; return; } // Increment the request counter. requests[theme] = requests[theme] ? requests[theme] + 1 : 1; // If the theme exists, load it right away. if (themes[theme]) { this._outstanding = this._loadTheme(theme); delete requests[theme]; return; } // If the request has taken too long, give up. if (requests[theme] > REQUEST_THRESHOLD) { const fallback = settings.default('theme'); // Stop tracking the requests for this theme. delete requests[theme]; if (!themes[fallback]) { this._onError(this._trans.__('Neither theme %1 nor default %2 loaded.', theme, fallback)); return; } console.warn(`Could not load theme ${theme}, using default ${fallback}.`); this._outstanding = this._loadTheme(fallback); return; } // If the theme does not yet exist, attempt to wait for it. this._pending = window.setTimeout(() => { this._loadSettings(); }, REQUEST_INTERVAL); } /** * Load the theme. * * #### Notes * This method assumes that the `theme` exists. */ _loadTheme(theme) { var _a; const current = this._current; const links = this._links; const themes = this._themes; const splash = this._splash ? this._splash.show(themes[theme].isLight) : new _lumino_disposable__WEBPACK_IMPORTED_MODULE_3__["DisposableDelegate"](() => undefined); // Unload any CSS files that have been loaded. links.forEach(link => { if (link.parentElement) { link.parentElement.removeChild(link); } }); links.length = 0; const themeProps = (_a = this._settings.schema.properties) === null || _a === void 0 ? void 0 : _a.theme; if (themeProps) { themeProps.enum = Object.keys(themes).map(value => { var _a; return (_a = themes[value].displayName) !== null && _a !== void 0 ? _a : value; }); } // Unload the previously loaded theme. const old = current ? themes[current].unload() : Promise.resolve(); return Promise.all([old, themes[theme].load()]) .then(() => { this._current = theme; this._themeChanged.emit({ name: 'theme', oldValue: current, newValue: theme }); // Need to force a redraw of the app here to avoid a Chrome rendering // bug that can leave the scrollbars in an invalid state this._host.hide(); // If we hide/show the widget too quickly, no redraw will happen. // requestAnimationFrame delays until after the next frame render. requestAnimationFrame(() => { this._host.show(); Private.fitAll(this._host); splash.dispose(); }); }) .catch(reason => { this._onError(reason); splash.dispose(); }); } /** * Handle a theme error. */ _onError(reason) { void Object(_dialog__WEBPACK_IMPORTED_MODULE_5__["showDialog"])({ title: this._trans.__('Error Loading Theme'), body: String(reason), buttons: [_dialog__WEBPACK_IMPORTED_MODULE_5__["Dialog"].okButton({ label: this._trans.__('OK') })] }); } } /** * A namespace for module private data. */ var Private; (function (Private) { /** * Fit a widget and all of its children, recursively. */ function fitAll(widget) { Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["each"])(widget.children(), fitAll); widget.fit(); } Private.fitAll = fitAll; })(Private || (Private = {})); //# sourceMappingURL=thememanager.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/tokens.js": /*!*********************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/tokens.js ***! \*********************************************************/ /*! exports provided: ISessionContextDialogs, IThemeManager, ISanitizer, IToolbarWidgetRegistry */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ISessionContextDialogs", function() { return ISessionContextDialogs; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IThemeManager", function() { return IThemeManager; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ISanitizer", function() { return ISanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IToolbarWidgetRegistry", function() { return IToolbarWidgetRegistry; }); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /* tslint:disable */ /** * The session context dialogs token. */ const ISessionContextDialogs = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["Token"]('@jupyterlab/apputils:ISessionContextDialogs'); /* tslint:enable */ /* tslint:disable */ /** * The theme manager token. */ const IThemeManager = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["Token"]('@jupyterlab/apputils:IThemeManager'); /** * The sanitizer token. */ const ISanitizer = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["Token"]('@jupyterlab/apputils:ISanitizer'); /** * The toolbar registry token. */ const IToolbarWidgetRegistry = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__["Token"]('@jupyterlab/apputils:IToolbarWidgetRegistry'); //# sourceMappingURL=tokens.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/toolbar/factory.js": /*!******************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/toolbar/factory.js ***! \******************************************************************/ /*! exports provided: createToolbarFactory */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createToolbarFactory", function() { return createToolbarFactory; }); /* harmony import */ var _jupyterlab_observables__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/observables */ "./node_modules/@jupyterlab/observables/lib/index.js"); /* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/settingregistry */ "./node_modules/@jupyterlab/settingregistry/lib/index.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/coreutils */ "./node_modules/@lumino/coreutils/dist/index.js"); /* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _dialog__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../dialog */ "./node_modules/@jupyterlab/apputils/lib/dialog.js"); /** * Default toolbar item rank * * #### Notes * This will place item just before the white spacer item in the notebook toolbar. */ const DEFAULT_TOOLBAR_ITEM_RANK = 50; /** * Display warning when the toolbar definition have been modified. * * @param trans Translation bundle */ async function displayInformation(trans) { const result = await Object(_dialog__WEBPACK_IMPORTED_MODULE_4__["showDialog"])({ title: trans.__('Information'), body: trans.__('Toolbar customization has changed. You will need to reload JupyterLab to see the changes.'), buttons: [ _dialog__WEBPACK_IMPORTED_MODULE_4__["Dialog"].cancelButton(), _dialog__WEBPACK_IMPORTED_MODULE_4__["Dialog"].okButton({ label: trans.__('Reload') }) ] }); if (result.button.accept) { location.reload(); } } /** * Set the toolbar definition by accumulating all settings definition. * * The list will be populated only with the enabled items. * * @param toolbarItems Observable list to populate * @param registry Application settings registry * @param factoryName Widget factory name that needs a toolbar * @param pluginId Settings plugin id * @param translator Translator object * @param propertyId Property holding the toolbar definition in the settings; default 'toolbar' * @returns List of toolbar items */ async function setToolbarItems(toolbarItems, registry, factoryName, pluginId, translator, propertyId = 'toolbar') { var _a; const trans = translator.load('jupyterlab'); let canonical; let loaded = {}; /** * Populate the plugin's schema defaults. * * We keep track of disabled entries in case the plugin is loaded * after the toolbar initialization. */ function populate(schema) { var _a, _b; loaded = {}; const pluginDefaults = Object.keys(registry.plugins) .map(plugin => { var _a, _b; const items = (_b = ((_a = registry.plugins[plugin].schema['jupyter.lab.toolbars']) !== null && _a !== void 0 ? _a : {})[factoryName]) !== null && _b !== void 0 ? _b : []; loaded[plugin] = items; return items; }) .concat([(_b = ((_a = schema['jupyter.lab.toolbars']) !== null && _a !== void 0 ? _a : {})[factoryName]) !== null && _b !== void 0 ? _b : []]) .reduceRight((acc, val) => _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_1__["SettingRegistry"].reconcileToolbarItems(acc, val, true), []); // Apply default value as last step to take into account overrides.json // The standard default being [] as the plugin must use `jupyter.lab.toolbars.` // to define their default value. schema.properties[propertyId].default = _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_1__["SettingRegistry"].reconcileToolbarItems(pluginDefaults, schema.properties[propertyId].default, true).sort((a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : DEFAULT_TOOLBAR_ITEM_RANK) - ((_b = b.rank) !== null && _b !== void 0 ? _b : DEFAULT_TOOLBAR_ITEM_RANK); }); } // Transform the plugin object to return different schema than the default. registry.transform(pluginId, { compose: plugin => { var _a, _b, _c, _d, _e; // Only override the canonical schema the first time. if (!canonical) { canonical = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["JSONExt"].deepCopy(plugin.schema); populate(canonical); } const defaults = (_c = ((_b = ((_a = canonical.properties) !== null && _a !== void 0 ? _a : {})[propertyId]) !== null && _b !== void 0 ? _b : {}).default) !== null && _c !== void 0 ? _c : []; // Initialize the settings const user = plugin.data.user; const composite = plugin.data.composite; // Overrides the value with using the aggregated default for the toolbar property user[propertyId] = (_d = plugin.data.user[propertyId]) !== null && _d !== void 0 ? _d : []; composite[propertyId] = ((_e = _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_1__["SettingRegistry"].reconcileToolbarItems(defaults, user[propertyId], false)) !== null && _e !== void 0 ? _e : []).sort((a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : DEFAULT_TOOLBAR_ITEM_RANK) - ((_b = b.rank) !== null && _b !== void 0 ? _b : DEFAULT_TOOLBAR_ITEM_RANK); }); plugin.data = { composite, user }; return plugin; }, fetch: plugin => { // Only override the canonical schema the first time. if (!canonical) { canonical = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["JSONExt"].deepCopy(plugin.schema); populate(canonical); } return { data: plugin.data, id: plugin.id, raw: plugin.raw, schema: canonical, version: plugin.version }; } }); // Repopulate the canonical variable after the setting registry has // preloaded all initial plugins. canonical = null; const settings = await registry.load(pluginId); // React to customization by the user settings.changed.connect(() => { var _a; const newItems = (_a = settings.composite[propertyId]) !== null && _a !== void 0 ? _a : []; transferSettings(newItems); }); // React to plugin changes registry.pluginChanged.connect(async (sender, plugin) => { var _a, _b, _c, _d; // As the plugin storing the toolbar definition is transformed using // the above definition, if it changes, this means that a request to // reloaded was triggered. Hence the toolbar definitions from the other // plugins has been automatically reset during the transform step. if (plugin !== pluginId) { // If a plugin changed its toolbar items const oldItems = (_a = loaded[plugin]) !== null && _a !== void 0 ? _a : []; const newItems = (_c = ((_b = registry.plugins[plugin].schema['jupyter.lab.toolbars']) !== null && _b !== void 0 ? _b : {})[factoryName]) !== null && _c !== void 0 ? _c : []; if (!_lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["JSONExt"].deepEqual(oldItems, newItems)) { if (loaded[plugin]) { // The plugin has changed, request the user to reload the UI await displayInformation(trans); } else { // The plugin was not yet loaded => update the toolbar items list loaded[plugin] = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["JSONExt"].deepCopy(newItems); const newList = ((_d = _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_1__["SettingRegistry"].reconcileToolbarItems(Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["toArray"])(toolbarItems), newItems, false)) !== null && _d !== void 0 ? _d : []).sort((a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : DEFAULT_TOOLBAR_ITEM_RANK) - ((_b = b.rank) !== null && _b !== void 0 ? _b : DEFAULT_TOOLBAR_ITEM_RANK); }); transferSettings(newList); } } } }); const transferSettings = (newItems) => { // This is not optimal but safer because a toolbar item with the same // name cannot be inserted (it will be a no-op). But that could happen // if the settings are changing the items order. toolbarItems.clear(); toolbarItems.pushAll(newItems.filter(item => !item.disabled)); }; // Initialize the toolbar transferSettings((_a = settings.composite[propertyId]) !== null && _a !== void 0 ? _a : []); } /** * Create the toolbar factory for a given container widget based * on a data description stored in settings * * @param toolbarRegistry Toolbar widgets registry * @param settingsRegistry Settings registry * @param factoryName Toolbar container factory name * @param pluginId Settings plugin id * @param translator Translator * @param propertyId Toolbar definition key in the settings plugin * @returns List of toolbar widgets */ function createToolbarFactory(toolbarRegistry, settingsRegistry, factoryName, pluginId, translator, propertyId = 'toolbar') { const items = new _jupyterlab_observables__WEBPACK_IMPORTED_MODULE_0__["ObservableList"]({ itemCmp: (a, b) => _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__["JSONExt"].deepEqual(a, b) }); // Get toolbar definition from the settings setToolbarItems(items, settingsRegistry, factoryName, pluginId, translator, propertyId).catch(reason => { console.error(`Failed to load toolbar items for factory ${factoryName} from ${pluginId}`, reason); }); return (widget) => { const updateToolbar = (list, change) => { switch (change.type) { case 'move': toolbar.move(change.oldIndex, change.newIndex); break; case 'add': change.newValues.forEach(item => toolbar.push({ name: item.name, widget: toolbarRegistry.createWidget(factoryName, widget, item) })); break; case 'remove': change.oldValues.forEach(() => toolbar.remove(change.oldIndex)); break; case 'set': change.newValues.forEach(item => toolbar.set(change.newIndex, { name: item.name, widget: toolbarRegistry.createWidget(factoryName, widget, item) })); break; } }; const toolbar = new _jupyterlab_observables__WEBPACK_IMPORTED_MODULE_0__["ObservableList"]({ values: Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["toArray"])(items).map(item => { return { name: item.name, widget: toolbarRegistry.createWidget(factoryName, widget, item) }; }) }); items.changed.connect(updateToolbar); widget.disposed.connect(() => { items.changed.disconnect(updateToolbar); }); return toolbar; }; } //# sourceMappingURL=factory.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/toolbar/index.js": /*!****************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/toolbar/index.js ***! \****************************************************************/ /*! exports provided: createToolbarFactory, ToolbarWidgetRegistry, createDefaultFactory, Toolbar, ReactiveToolbar, ToolbarButtonComponent, addToolbarButtonClass, ToolbarButton, CommandToolbarButtonComponent, addCommandToolbarButtonClass, CommandToolbarButton */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _factory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./factory */ "./node_modules/@jupyterlab/apputils/lib/toolbar/factory.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createToolbarFactory", function() { return _factory__WEBPACK_IMPORTED_MODULE_0__["createToolbarFactory"]; }); /* harmony import */ var _registry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./registry */ "./node_modules/@jupyterlab/apputils/lib/toolbar/registry.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToolbarWidgetRegistry", function() { return _registry__WEBPACK_IMPORTED_MODULE_1__["ToolbarWidgetRegistry"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createDefaultFactory", function() { return _registry__WEBPACK_IMPORTED_MODULE_1__["createDefaultFactory"]; }); /* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./widget */ "./node_modules/@jupyterlab/apputils/lib/toolbar/widget.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Toolbar", function() { return _widget__WEBPACK_IMPORTED_MODULE_2__["Toolbar"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ReactiveToolbar", function() { return _widget__WEBPACK_IMPORTED_MODULE_2__["ReactiveToolbar"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToolbarButtonComponent", function() { return _widget__WEBPACK_IMPORTED_MODULE_2__["ToolbarButtonComponent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addToolbarButtonClass", function() { return _widget__WEBPACK_IMPORTED_MODULE_2__["addToolbarButtonClass"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ToolbarButton", function() { return _widget__WEBPACK_IMPORTED_MODULE_2__["ToolbarButton"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandToolbarButtonComponent", function() { return _widget__WEBPACK_IMPORTED_MODULE_2__["CommandToolbarButtonComponent"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addCommandToolbarButtonClass", function() { return _widget__WEBPACK_IMPORTED_MODULE_2__["addCommandToolbarButtonClass"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandToolbarButton", function() { return _widget__WEBPACK_IMPORTED_MODULE_2__["CommandToolbarButton"]; }); //# sourceMappingURL=index.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/toolbar/registry.js": /*!*******************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/toolbar/registry.js ***! \*******************************************************************/ /*! exports provided: ToolbarWidgetRegistry, createDefaultFactory */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ToolbarWidgetRegistry", function() { return ToolbarWidgetRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createDefaultFactory", function() { return createDefaultFactory; }); /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/ui-components */ "./node_modules/@jupyterlab/ui-components/lib/index.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./widget */ "./node_modules/@jupyterlab/apputils/lib/toolbar/widget.js"); /** * Concrete implementation of IToolbarWidgetRegistry interface */ class ToolbarWidgetRegistry { constructor(options) { this._widgets = new Map(); this._defaultFactory = options.defaultFactory; } /** * Default toolbar item factory */ get defaultFactory() { return this._defaultFactory; } set defaultFactory(factory) { this._defaultFactory = factory; } /** * Create a toolbar item widget * * @param widgetFactory The widget factory name that creates the toolbar * @param widget The newly widget containing the toolbar * @param toolbarItem The toolbar item definition * @returns The widget to be inserted in the toolbar. */ createWidget(widgetFactory, widget, toolbarItem) { var _a; const factory = (_a = this._widgets.get(widgetFactory)) === null || _a === void 0 ? void 0 : _a.get(toolbarItem.name); return factory ? factory(widget) : this._defaultFactory(widgetFactory, widget, toolbarItem); } /** * Register a new toolbar item factory * * @param widgetFactory The widget factory name that creates the toolbar * @param toolbarItemName The unique toolbar item * @param factory The factory function that receives the widget containing the toolbar and returns the toolbar widget. * @returns The previously defined factory */ registerFactory(widgetFactory, toolbarItemName, factory) { let namespace = this._widgets.get(widgetFactory); const oldFactory = namespace === null || namespace === void 0 ? void 0 : namespace.get(toolbarItemName); if (!namespace) { namespace = new Map(); this._widgets.set(widgetFactory, namespace); } namespace.set(toolbarItemName, factory); return oldFactory; } } /** * Create the default toolbar item widget factory * * @param commands Application commands registry * @returns Default factory */ function createDefaultFactory(commands) { return (widgetFactory, widget, toolbarItem) => { var _a; switch ((_a = toolbarItem.type) !== null && _a !== void 0 ? _a : 'command') { case 'command': { const { command: tId, args: tArgs, label: tLabel, icon: tIcon } = toolbarItem; const id = tId !== null && tId !== void 0 ? tId : ''; const args = Object.assign({ toolbar: true }, tArgs); const icon = tIcon ? _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__["LabIcon"].resolve({ icon: tIcon }) : undefined; // If there is an icon, undefined label will results in no label // otherwise the label will be set using the setting or the command label const label = (icon !== null && icon !== void 0 ? icon : commands.icon(id, args)) ? tLabel !== null && tLabel !== void 0 ? tLabel : '' : tLabel; return new _widget__WEBPACK_IMPORTED_MODULE_2__["CommandToolbarButton"]({ commands, id, args, icon, label }); } case 'spacer': return _widget__WEBPACK_IMPORTED_MODULE_2__["Toolbar"].createSpacerItem(); default: return new _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__["Widget"](); } }; } //# sourceMappingURL=registry.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/toolbar/widget.js": /*!*****************************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/toolbar/widget.js ***! \*****************************************************************/ /*! exports provided: Toolbar, ReactiveToolbar, ToolbarButtonComponent, addToolbarButtonClass, ToolbarButton, CommandToolbarButtonComponent, addCommandToolbarButtonClass, CommandToolbarButton */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Toolbar", function() { return Toolbar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReactiveToolbar", function() { return ReactiveToolbar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ToolbarButtonComponent", function() { return ToolbarButtonComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addToolbarButtonClass", function() { return addToolbarButtonClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ToolbarButton", function() { return ToolbarButton; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommandToolbarButtonComponent", function() { return CommandToolbarButtonComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addCommandToolbarButtonClass", function() { return addCommandToolbarButtonClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommandToolbarButton", function() { return CommandToolbarButton; }); /* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/translation */ "./node_modules/@jupyterlab/translation/lib/index.js"); /* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/ui-components */ "./node_modules/@jupyterlab/ui-components/lib/index.js"); /* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/algorithm */ "./node_modules/@lumino/algorithm/dist/index.es6.js"); /* harmony import */ var _lumino_commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/commands */ "./src/emptyshim.js"); /* harmony import */ var _lumino_commands__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_commands__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/messaging */ "./node_modules/@lumino/messaging/dist/index.es6.js"); /* harmony import */ var _lumino_properties__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/properties */ "./node_modules/@lumino/properties/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var _sessioncontext__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../sessioncontext */ "./node_modules/@jupyterlab/apputils/lib/sessioncontext.js"); /* harmony import */ var _kernelstatuses__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../kernelstatuses */ "./node_modules/@jupyterlab/apputils/lib/kernelstatuses.js"); /* harmony import */ var _vdom__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../vdom */ "./node_modules/@jupyterlab/apputils/lib/vdom.js"); /* harmony import */ var _lumino_polling__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @lumino/polling */ "./node_modules/@lumino/polling/dist/index.es6.js"); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * The class name added to toolbars. */ const TOOLBAR_CLASS = 'jp-Toolbar'; /** * Toolbar pop-up opener button name */ const TOOLBAR_OPENER_NAME = 'toolbar-popup-opener'; /** * The class name added to toolbar items. */ const TOOLBAR_ITEM_CLASS = 'jp-Toolbar-item'; /** * The class name added to toolbar kernel name text. */ const TOOLBAR_KERNEL_NAME_CLASS = 'jp-Toolbar-kernelName'; /** * The class name added to toolbar spacer. */ const TOOLBAR_SPACER_CLASS = 'jp-Toolbar-spacer'; /** * The class name added to toolbar kernel status icon. */ const TOOLBAR_KERNEL_STATUS_CLASS = 'jp-Toolbar-kernelStatus'; /** * A layout for toolbars. * * #### Notes * This layout automatically collapses its height if there are no visible * toolbar widgets, and expands to the standard toolbar height if there are * visible toolbar widgets. */ class ToolbarLayout extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["PanelLayout"] { constructor() { super(...arguments); this._dirty = false; } /** * A message handler invoked on a `'fit-request'` message. * * If any child widget is visible, expand the toolbar height to the normal * toolbar height. */ onFitRequest(msg) { super.onFitRequest(msg); if (this.parent.isAttached) { // If there are any widgets not explicitly hidden, expand the toolbar to // accommodate them. if (Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["some"])(this.widgets, w => !w.isHidden)) { this.parent.node.style.minHeight = 'var(--jp-private-toolbar-height)'; this.parent.removeClass('jp-Toolbar-micro'); } else { this.parent.node.style.minHeight = ''; this.parent.addClass('jp-Toolbar-micro'); } } // Set the dirty flag to ensure only a single update occurs. this._dirty = true; // Notify the ancestor that it should fit immediately. This may // cause a resize of the parent, fulfilling the required update. if (this.parent.parent) { _lumino_messaging__WEBPACK_IMPORTED_MODULE_4__["MessageLoop"].sendMessage(this.parent.parent, _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["Widget"].Msg.FitRequest); } // If the dirty flag is still set, the parent was not resized. // Trigger the required update on the parent widget immediately. if (this._dirty) { _lumino_messaging__WEBPACK_IMPORTED_MODULE_4__["MessageLoop"].sendMessage(this.parent, _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["Widget"].Msg.UpdateRequest); } } /** * A message handler invoked on an `'update-request'` message. */ onUpdateRequest(msg) { super.onUpdateRequest(msg); if (this.parent.isVisible) { this._dirty = false; } } /** * A message handler invoked on a `'child-shown'` message. */ onChildShown(msg) { super.onChildShown(msg); // Post a fit request for the parent widget. this.parent.fit(); } /** * A message handler invoked on a `'child-hidden'` message. */ onChildHidden(msg) { super.onChildHidden(msg); // Post a fit request for the parent widget. this.parent.fit(); } /** * A message handler invoked on a `'before-attach'` message. */ onBeforeAttach(msg) { super.onBeforeAttach(msg); // Post a fit request for the parent widget. this.parent.fit(); } /** * Attach a widget to the parent's DOM node. * * @param index - The current index of the widget in the layout. * * @param widget - The widget to attach to the parent. * * #### Notes * This is a reimplementation of the superclass method. */ attachWidget(index, widget) { super.attachWidget(index, widget); // Post a fit request for the parent widget. this.parent.fit(); } /** * Detach a widget from the parent's DOM node. * * @param index - The previous index of the widget in the layout. * * @param widget - The widget to detach from the parent. * * #### Notes * This is a reimplementation of the superclass method. */ detachWidget(index, widget) { super.detachWidget(index, widget); // Post a fit request for the parent widget. this.parent.fit(); } } /** * A class which provides a toolbar widget. */ class Toolbar extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["Widget"] { /** * Construct a new toolbar widget. */ constructor() { super(); this.addClass(TOOLBAR_CLASS); this.layout = new ToolbarLayout(); } /** * Get an iterator over the ordered toolbar item names. * * @returns An iterator over the toolbar item names. */ names() { const layout = this.layout; return Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["map"])(layout.widgets, widget => { return Private.nameProperty.get(widget); }); } /** * Add an item to the end of the toolbar. * * @param name - The name of the widget to add to the toolbar. * * @param widget - The widget to add to the toolbar. * * @param index - The optional name of the item to insert after. * * @returns Whether the item was added to toolbar. Returns false if * an item of the same name is already in the toolbar. * * #### Notes * The item can be removed from the toolbar by setting its parent to `null`. */ addItem(name, widget) { const layout = this.layout; return this.insertItem(layout.widgets.length, name, widget); } /** * Insert an item into the toolbar at the specified index. * * @param index - The index at which to insert the item. * * @param name - The name of the item. * * @param widget - The widget to add. * * @returns Whether the item was added to the toolbar. Returns false if * an item of the same name is already in the toolbar. * * #### Notes * The index will be clamped to the bounds of the items. * The item can be removed from the toolbar by setting its parent to `null`. */ insertItem(index, name, widget) { const existing = Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["find"])(this.names(), value => value === name); if (existing) { return false; } widget.addClass(TOOLBAR_ITEM_CLASS); const layout = this.layout; const j = Math.max(0, Math.min(index, layout.widgets.length)); layout.insertWidget(j, widget); Private.nameProperty.set(widget, name); return true; } /** * Insert an item into the toolbar at the after a target item. * * @param at - The target item to insert after. * * @param name - The name of the item. * * @param widget - The widget to add. * * @returns Whether the item was added to the toolbar. Returns false if * an item of the same name is already in the toolbar. * * #### Notes * The index will be clamped to the bounds of the items. * The item can be removed from the toolbar by setting its parent to `null`. */ insertAfter(at, name, widget) { return this._insertRelative(at, 1, name, widget); } /** * Insert an item into the toolbar at the before a target item. * * @param at - The target item to insert before. * * @param name - The name of the item. * * @param widget - The widget to add. * * @returns Whether the item was added to the toolbar. Returns false if * an item of the same name is already in the toolbar. * * #### Notes * The index will be clamped to the bounds of the items. * The item can be removed from the toolbar by setting its parent to `null`. */ insertBefore(at, name, widget) { return this._insertRelative(at, 0, name, widget); } _insertRelative(at, offset, name, widget) { const nameWithIndex = Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["map"])(this.names(), (name, i) => { return { name: name, index: i }; }); const target = Object(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__["find"])(nameWithIndex, x => x.name === at); if (target) { return this.insertItem(target.index + offset, name, widget); } return false; } /** * Handle the DOM events for the widget. * * @param event - The DOM event sent to the widget. * * #### Notes * This method implements the DOM `EventListener` interface and is * called in response to events on the dock panel's node. It should * not be called directly by user code. */ handleEvent(event) { switch (event.type) { case 'click': this.handleClick(event); break; default: break; } } /** * Handle a DOM click event. */ handleClick(event) { // Stop propagating the click outside the toolbar event.stopPropagation(); // Clicking a label focuses the corresponding control // that is linked with `for` attribute, so let it be. if (event.target instanceof HTMLLabelElement) { const forId = event.target.getAttribute('for'); if (forId && this.node.querySelector(`#${forId}`)) { return; } } // If this click already focused a control, let it be. if (this.node.contains(document.activeElement)) { return; } // Otherwise, activate the parent widget, which may take focus if desired. if (this.parent) { this.parent.activate(); } } /** * Handle `after-attach` messages for the widget. */ onAfterAttach(msg) { this.node.addEventListener('click', this); } /** * Handle `before-detach` messages for the widget. */ onBeforeDetach(msg) { this.node.removeEventListener('click', this); } } /** * A class which provides a toolbar widget. */ class ReactiveToolbar extends Toolbar { /** * Construct a new toolbar widget. */ constructor() { super(); this.popupOpener = new ToolbarPopupOpener(); this._widgetWidths = {}; this.insertItem(0, TOOLBAR_OPENER_NAME, this.popupOpener); this.popupOpener.hide(); this._resizer = new _lumino_polling__WEBPACK_IMPORTED_MODULE_11__["Throttler"](this._onResize.bind(this), 500); } /** * Dispose of the widget and its descendant widgets. */ dispose() { if (this.isDisposed) { return; } if (this._resizer) { this._resizer.dispose(); } super.dispose(); } /** * Insert an item into the toolbar at the after a target item. * * @param at - The target item to insert after. * * @param name - The name of the item. * * @param widget - The widget to add. * * @returns Whether the item was added to the toolbar. Returns false if * an item of the same name is already in the toolbar or if the target * is the toolbar pop-up opener. * * #### Notes * The index will be clamped to the bounds of the items. * The item can be removed from the toolbar by setting its parent to `null`. */ insertAfter(at, name, widget) { if (at === TOOLBAR_OPENER_NAME) { return false; } return super.insertAfter(at, name, widget); } /** * Insert an item into the toolbar at the specified index. * * @param index - The index at which to insert the item. * * @param name - The name of the item. * * @param widget - The widget to add. * * @returns Whether the item was added to the toolbar. Returns false if * an item of the same name is already in the toolbar. * * #### Notes * The index will be clamped to the bounds of the items. * The item can be removed from the toolbar by setting its parent to `null`. */ insertItem(index, name, widget) { if (widget instanceof ToolbarPopupOpener) { return super.insertItem(index, name, widget); } else { const j = Math.max(0, Math.min(index, this.layout.widgets.length - 1)); return super.insertItem(j, name, widget); } } /** * A message handler invoked on a `'before-hide'` message. * * It will hide the pop-up panel */ onBeforeHide(msg) { this.popupOpener.hidePopup(); super.onBeforeHide(msg); } onResize(msg) { super.onResize(msg); if (msg.width > 0 && this._resizer) { void this._resizer.invoke(); } } _onResize() { if (this.parent && this.parent.isAttached) { const toolbarWidth = this.node.clientWidth; const opener = this.popupOpener; const openerWidth = 30; const toolbarPadding = 2; const layout = this.layout; let width = opener.isHidden ? toolbarPadding : toolbarPadding + openerWidth; let index = 0; const widgetsToRemove = []; const toIndex = layout.widgets.length - 1; while (index < toIndex) { const widget = layout.widgets[index]; this._saveWidgetWidth(widget); width += this._getWidgetWidth(widget); if (widgetsToRemove.length === 0 && opener.isHidden && width + openerWidth > toolbarWidth) { width += openerWidth; } if (width > toolbarWidth) { widgetsToRemove.push(widget); } index++; } while (widgetsToRemove.length > 0) { const widget = widgetsToRemove.pop(); width -= this._getWidgetWidth(widget); opener.addWidget(widget); } if (opener.widgetCount() > 0) { const widgetsToAdd = []; let index = 0; let widget = opener.widgetAt(index); const widgetCount = opener.widgetCount(); width += this._getWidgetWidth(widget); if (widgetCount === 1 && width - openerWidth <= toolbarWidth) { width -= openerWidth; } while (width < toolbarWidth && index < widgetCount) { widgetsToAdd.push(widget); index++; widget = opener.widgetAt(index); if (widget) { width += this._getWidgetWidth(widget); } else { break; } } while (widgetsToAdd.length > 0) { const widget = widgetsToAdd.shift(); this.addItem(Private.nameProperty.get(widget), widget); } } if (opener.widgetCount() > 0) { opener.updatePopup(); opener.show(); } else { opener.hide(); } } } _saveWidgetWidth(widget) { const widgetName = Private.nameProperty.get(widget); this._widgetWidths[widgetName] = widget.hasClass(TOOLBAR_SPACER_CLASS) ? 2 : widget.node.clientWidth; } _getWidgetWidth(widget) { const widgetName = Private.nameProperty.get(widget); return this._widgetWidths[widgetName]; } } /** * The namespace for Toolbar class statics. */ (function (Toolbar) { /** * Create an interrupt toolbar item. * * @deprecated since version v3.2 * This is dead code now. */ function createInterruptButton(sessionContext, translator) { translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__["nullTranslator"]; const trans = translator.load('jupyterlab'); return new ToolbarButton({ icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["stopIcon"], onClick: () => { var _a, _b; void ((_b = (_a = sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) === null || _b === void 0 ? void 0 : _b.interrupt()); }, tooltip: trans.__('Interrupt the kernel') }); } Toolbar.createInterruptButton = createInterruptButton; /** * Create a restart toolbar item. * * @deprecated since v3.2 * This is dead code now. */ function createRestartButton(sessionContext, dialogs, translator) { translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__["nullTranslator"]; const trans = translator.load('jupyterlab'); return new ToolbarButton({ icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["refreshIcon"], onClick: () => { void (dialogs !== null && dialogs !== void 0 ? dialogs : _sessioncontext__WEBPACK_IMPORTED_MODULE_8__["sessionContextDialogs"]).restart(sessionContext, translator); }, tooltip: trans.__('Restart the kernel') }); } Toolbar.createRestartButton = createRestartButton; /** * Create a toolbar spacer item. * * #### Notes * It is a flex spacer that separates the left toolbar items * from the right toolbar items. */ function createSpacerItem() { return new Private.Spacer(); } Toolbar.createSpacerItem = createSpacerItem; /** * Create a kernel name indicator item. * * #### Notes * It will display the `'display_name`' of the session context. It can * handle a change in context or kernel. */ function createKernelNameItem(sessionContext, dialogs, translator) { const el = _vdom__WEBPACK_IMPORTED_MODULE_10__["ReactWidget"].create(react__WEBPACK_IMPORTED_MODULE_7__["createElement"](Private.KernelNameComponent, { sessionContext: sessionContext, dialogs: dialogs !== null && dialogs !== void 0 ? dialogs : _sessioncontext__WEBPACK_IMPORTED_MODULE_8__["sessionContextDialogs"], translator: translator })); el.addClass('jp-KernelName'); return el; } Toolbar.createKernelNameItem = createKernelNameItem; /** * Create a kernel status indicator item. * * #### Notes * It will show a busy status if the kernel status is busy. * It will show the current status in the node title. * It can handle a change to the context or the kernel. */ function createKernelStatusItem(sessionContext, translator) { return new Private.KernelStatus(sessionContext, translator); } Toolbar.createKernelStatusItem = createKernelStatusItem; })(Toolbar || (Toolbar = {})); /** * React component for a toolbar button. * * @param props - The props for ToolbarButtonComponent. */ function ToolbarButtonComponent(props) { var _a, _b; // In some browsers, a button click event moves the focus from the main // content to the button (see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus). // We avoid a click event by calling preventDefault in mousedown, and // we bind the button action to `mousedown`. const handleMouseDown = (event) => { var _a; // Fire action only when left button is pressed. if (event.button === 0) { event.preventDefault(); (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); } }; const handleKeyDown = (event) => { var _a; const { key } = event; if (key === 'Enter' || key === ' ') { (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); } }; const handleClick = (event) => { var _a; if (event.button === 0) { (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); } }; const getTooltip = () => { if (props.enabled === false && props.disabledTooltip) { return props.disabledTooltip; } else if (props.pressed && props.pressedTooltip) { return props.pressedTooltip; } else { return props.tooltip || props.iconLabel; } }; return (react__WEBPACK_IMPORTED_MODULE_7__["createElement"](_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["Button"], { className: props.className ? props.className + ' jp-ToolbarButtonComponent' : 'jp-ToolbarButtonComponent', "aria-pressed": props.pressed, "aria-disabled": props.enabled === false, disabled: props.enabled === false, onClick: ((_a = props.actualOnClick) !== null && _a !== void 0 ? _a : false) ? handleClick : undefined, onMouseDown: !((_b = props.actualOnClick) !== null && _b !== void 0 ? _b : false) ? handleMouseDown : undefined, onKeyDown: handleKeyDown, title: getTooltip(), minimal: true }, (props.icon || props.iconClass) && (react__WEBPACK_IMPORTED_MODULE_7__["createElement"](_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["LabIcon"].resolveReact, { icon: props.pressed ? props.pressedIcon : props.icon, iconClass: // add some extra classes for proper support of icons-as-css-background Object(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["classes"])(props.iconClass, 'jp-Icon'), className: "jp-ToolbarButtonComponent-icon", tag: "span", stylesheet: "toolbarButton" })), props.label && (react__WEBPACK_IMPORTED_MODULE_7__["createElement"]("span", { className: "jp-ToolbarButtonComponent-label" }, props.label)))); } /** * Adds the toolbar button class to the toolbar widget. * @param w Toolbar button widget. */ function addToolbarButtonClass(w) { w.addClass('jp-ToolbarButton'); return w; } /** * Phosphor Widget version of static ToolbarButtonComponent. */ class ToolbarButton extends _vdom__WEBPACK_IMPORTED_MODULE_10__["ReactWidget"] { /** * Creates a toolbar button * @param props props for underlying `ToolbarButton` component */ constructor(props = {}) { var _a, _b; super(); this.props = props; addToolbarButtonClass(this); this._enabled = (_a = props.enabled) !== null && _a !== void 0 ? _a : true; this._pressed = this._enabled && ((_b = props.pressed) !== null && _b !== void 0 ? _b : false); this._onClick = props.onClick; } /** * Sets the pressed state for the button * @param value true if button is pressed, false otherwise */ set pressed(value) { if (this.enabled && value !== this._pressed) { this._pressed = value; this.update(); } } /** * Returns true if button is pressed, false otherwise */ get pressed() { return this._pressed; } /** * Sets the enabled state for the button * @param value true to enable the button, false otherwise */ set enabled(value) { if (value != this._enabled) { this._enabled = value; if (!this._enabled) { this._pressed = false; } this.update(); } } /** * Returns true if button is enabled, false otherwise */ get enabled() { return this._enabled; } /** * Sets the click handler for the button * @param value click handler */ set onClick(value) { if (value !== this._onClick) { this._onClick = value; this.update(); } } /** * Returns the click handler for the button */ get onClick() { return this._onClick; } render() { return (react__WEBPACK_IMPORTED_MODULE_7__["createElement"](ToolbarButtonComponent, Object.assign({}, this.props, { pressed: this.pressed, enabled: this.enabled, onClick: this.onClick }))); } } /** * React component for a toolbar button that wraps a command. * * This wraps the ToolbarButtonComponent and watches the command registry * for changes to the command. */ function CommandToolbarButtonComponent(props) { return (react__WEBPACK_IMPORTED_MODULE_7__["createElement"](_vdom__WEBPACK_IMPORTED_MODULE_10__["UseSignal"], { signal: props.commands.commandChanged, shouldUpdate: (sender, args) => (args.id === props.id && args.type === 'changed') || args.type === 'many-changed' }, () => react__WEBPACK_IMPORTED_MODULE_7__["createElement"](ToolbarButtonComponent, Object.assign({}, Private.propsFromCommand(props))))); } /* * Adds the command toolbar button class to the command toolbar widget. * @param w Command toolbar button widget. */ function addCommandToolbarButtonClass(w) { w.addClass('jp-CommandToolbarButton'); return w; } /** * Phosphor Widget version of CommandToolbarButtonComponent. */ class CommandToolbarButton extends _vdom__WEBPACK_IMPORTED_MODULE_10__["ReactWidget"] { /** * Creates a command toolbar button * @param props props for underlying `CommandToolbarButtonComponent` component */ constructor(props) { super(); this.props = props; addCommandToolbarButtonClass(this); } render() { return react__WEBPACK_IMPORTED_MODULE_7__["createElement"](CommandToolbarButtonComponent, Object.assign({}, this.props)); } } /** * A class which provides a toolbar popup * used to store widgets that don't fit * in the toolbar when it is resized */ class ToolbarPopup extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["Widget"] { /** * Construct a new ToolbarPopup */ constructor() { super(); this.width = 0; this.addClass('jp-Toolbar-responsive-popup'); this.layout = new _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["PanelLayout"](); _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["Widget"].attach(this, document.body); this.hide(); } /** * Updates the width of the popup, this * should match with the toolbar width * * @param width - The width to resize to * @protected */ updateWidth(width) { if (width > 0) { this.width = width; this.node.style.width = `${width}px`; } } /** * Aligns the popup to left bottom of widget * * @param widget the widget to align to * @private */ alignTo(widget) { const { height: widgetHeight, width: widgetWidth, x: widgetX, y: widgetY } = widget.node.getBoundingClientRect(); const width = this.width; this.node.style.left = `${widgetX + widgetWidth - width + 1}px`; this.node.style.top = `${widgetY + widgetHeight + 1}px`; } /** * Inserts the widget at specified index * @param index the index * @param widget widget to add */ insertWidget(index, widget) { this.layout.insertWidget(0, widget); } /** * Total number of widgets in the popup */ widgetCount() { return this.layout.widgets.length; } /** * Returns the widget at index * @param index the index */ widgetAt(index) { return this.layout.widgets[index]; } } /** * A class that provides a ToolbarPopupOpener, * which is a button added to toolbar when * the toolbar items overflow toolbar width */ class ToolbarPopupOpener extends ToolbarButton { /** * Create a new popup opener */ constructor() { super({ icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["ellipsesIcon"], onClick: () => { this.handleClick(); } }); this.addClass('jp-Toolbar-responsive-opener'); this.popup = new ToolbarPopup(); } /** * Add widget to the popup, prepends widgets * @param widget the widget to add */ addWidget(widget) { this.popup.insertWidget(0, widget); } /** * Dispose of the widget and its descendant widgets. * * #### Notes * It is unsafe to use the widget after it has been disposed. * * All calls made to this method after the first are a no-op. */ dispose() { if (this.isDisposed) { return; } this.popup.dispose(); super.dispose(); } /** * Hides the opener and the popup */ hide() { super.hide(); this.hidePopup(); } /** * Hides the popup */ hidePopup() { this.popup.hide(); } /** * Updates width and position of the popup * to align with the toolbar */ updatePopup() { this.popup.updateWidth(this.parent.node.clientWidth); this.popup.alignTo(this.parent); } /** * Returns widget at index in the popup * @param index */ widgetAt(index) { return this.popup.widgetAt(index); } /** * Returns total number of widgets in the popup * * @returns Number of widgets */ widgetCount() { return this.popup.widgetCount(); } handleClick() { this.updatePopup(); this.popup.setHidden(!this.popup.isHidden); } } /** * A namespace for private data. */ var Private; (function (Private) { function propsFromCommand(options) { var _a, _b; const { commands, id, args } = options; const iconClass = commands.iconClass(id, args); const iconLabel = commands.iconLabel(id, args); // DEPRECATED: remove _icon when lumino 2.0 is adopted // if icon is aliasing iconClass, don't use it const _icon = (_a = options.icon) !== null && _a !== void 0 ? _a : commands.icon(id, args); const icon = _icon === iconClass ? undefined : _icon; const label = commands.label(id, args); let className = commands.className(id, args); // Add the boolean state classes. if (commands.isToggled(id, args)) { className += ' lm-mod-toggled'; } if (!commands.isVisible(id, args)) { className += ' lm-mod-hidden'; } let tooltip = commands.caption(id, args) || options.label || label || iconLabel; // Shows hot keys in tooltips const binding = commands.keyBindings.find(b => b.command === id); if (binding) { const ks = _lumino_commands__WEBPACK_IMPORTED_MODULE_3__["CommandRegistry"].formatKeystroke(binding.keys.join(' ')); tooltip = `${tooltip} (${ks})`; } const onClick = () => { void commands.execute(id, args); }; const enabled = commands.isEnabled(id, args); return { className, icon, iconClass, tooltip, onClick, enabled, label: (_b = options.label) !== null && _b !== void 0 ? _b : label }; } Private.propsFromCommand = propsFromCommand; /** * An attached property for the name of a toolbar item. */ Private.nameProperty = new _lumino_properties__WEBPACK_IMPORTED_MODULE_5__["AttachedProperty"]({ name: 'name', create: () => '' }); /** * A no-op function. */ function noOp() { /* no-op */ } Private.noOp = noOp; /** * A spacer widget. */ class Spacer extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["Widget"] { /** * Construct a new spacer widget. */ constructor() { super(); this.addClass(TOOLBAR_SPACER_CLASS); } } Private.Spacer = Spacer; /** * React component for a kernel name button. * * This wraps the ToolbarButtonComponent and watches the kernel * session for changes. */ function KernelNameComponent(props) { const translator = props.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__["nullTranslator"]; const trans = translator.load('jupyterlab'); const callback = () => { void props.dialogs.selectKernel(props.sessionContext, translator); }; return (react__WEBPACK_IMPORTED_MODULE_7__["createElement"](_vdom__WEBPACK_IMPORTED_MODULE_10__["UseSignal"], { signal: props.sessionContext.kernelChanged, initialSender: props.sessionContext }, sessionContext => (react__WEBPACK_IMPORTED_MODULE_7__["createElement"](ToolbarButtonComponent, { className: TOOLBAR_KERNEL_NAME_CLASS, onClick: callback, tooltip: trans.__('Switch kernel'), label: sessionContext === null || sessionContext === void 0 ? void 0 : sessionContext.kernelDisplayName })))); } Private.KernelNameComponent = KernelNameComponent; /** * A toolbar item that displays kernel status. */ class KernelStatus extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_6__["Widget"] { /** * Construct a new kernel status widget. */ constructor(sessionContext, translator) { super(); this.translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_0__["nullTranslator"]; this._trans = this.translator.load('jupyterlab'); this.addClass(TOOLBAR_KERNEL_STATUS_CLASS); this._statusNames = Object(_kernelstatuses__WEBPACK_IMPORTED_MODULE_9__["translateKernelStatuses"])(this.translator); this._onStatusChanged(sessionContext); sessionContext.statusChanged.connect(this._onStatusChanged, this); sessionContext.connectionStatusChanged.connect(this._onStatusChanged, this); } /** * Handle a status on a kernel. */ _onStatusChanged(sessionContext) { if (this.isDisposed) { return; } const status = sessionContext.kernelDisplayStatus; const circleIconProps = { container: this.node, title: this._trans.__('Kernel %1', this._statusNames[status] || status), stylesheet: 'toolbarButton', alignSelf: 'normal', height: '24px' }; // set the icon _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["LabIcon"].remove(this.node); if (status === 'busy' || status === 'starting' || status === 'terminating' || status === 'restarting' || status === 'initializing') { _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["circleIcon"].element(circleIconProps); } else if (status === 'connecting' || status === 'disconnected' || status === 'unknown') { _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["offlineBoltIcon"].element(circleIconProps); } else { _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__["circleEmptyIcon"].element(circleIconProps); } } } Private.KernelStatus = KernelStatus; })(Private || (Private = {})); //# sourceMappingURL=widget.js.map /***/ }), /***/ "./node_modules/@jupyterlab/apputils/lib/vdom.js": /*!*******************************************************!*\ !*** ./node_modules/@jupyterlab/apputils/lib/vdom.js ***! \*******************************************************/ /*! exports provided: ReactWidget, VDomRenderer, UseSignal, VDomModel */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReactWidget", function() { return ReactWidget; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VDomRenderer", function() { return VDomRenderer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UseSignal", function() { return UseSignal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VDomModel", function() { return VDomModel; }); /* harmony import */ var _lumino_messaging__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/messaging */ "./node_modules/@lumino/messaging/dist/index.es6.js"); /* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/signaling */ "./node_modules/@lumino/signaling/dist/index.es6.js"); /* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/widgets */ "./node_modules/@lumino/widgets/dist/index.es6.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-dom */ "./src/emptyshim.js"); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_4__); // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. /** * An abstract class for a Phosphor widget which renders a React component. */ class ReactWidget extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"] { /** * Creates a new `ReactWidget` that renders a constant element. * @param element React element to render. */ static create(element) { return new (class extends ReactWidget { render() { return element; } })(); } /** * Called to update the state of the widget. * * The default implementation of this method triggers * VDOM based rendering by calling the `renderDOM` method. */ onUpdateRequest(msg) { this.renderPromise = this.renderDOM(); } /** * Called after the widget is attached to the DOM */ onAfterAttach(msg) { // Make *sure* the widget is rendered. _lumino_messaging__WEBPACK_IMPORTED_MODULE_0__["MessageLoop"].sendMessage(this, _lumino_widgets__WEBPACK_IMPORTED_MODULE_2__["Widget"].Msg.UpdateRequest); } /** * Called before the widget is detached from the DOM. */ onBeforeDetach(msg) { // Unmount the component so it can tear down. react_dom__WEBPACK_IMPORTED_MODULE_4__["unmountComponentAtNode"](this.node); } /** * Render the React nodes to the DOM. * * @returns a promise that resolves when the rendering is done. */ renderDOM() { return new Promise(resolve => { const vnode = this.render(); // Split up the array/element cases so type inference chooses the right // signature. if (Array.isArray(vnode)) { react_dom__WEBPACK_IMPORTED_MODULE_4__["render"](vnode, this.node, resolve); } else if (vnode) { react_dom__WEBPACK_IMPORTED_MODULE_4__["render"](vnode, this.node, resolve); } }); } } /** * An abstract ReactWidget with a model. */ class VDomRenderer extends ReactWidget { /** * Create a new VDomRenderer */ constructor(model) { super(); this._modelChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_1__["Signal"](this); this.model = (model !== null && model !== void 0 ? model : null); } /** * A signal emitted when the model changes. */ get modelChanged() { return this._modelChanged; } /** * Set the model and fire changed signals. */ set model(newValue) { if (this._model === newValue) { return; } if (this._model) { this._model.stateChanged.disconnect(this.update, this); } this._model = newValue; if (newValue) { newValue.stateChanged.connect(this.update, this); } this.update(); this._modelChanged.emit(void 0); } /** * Get the current model. */ get model() { return this._model; } /** * Dispose this widget. */ dispose() { if (this.isDisposed) { return; } this._model = null; super.dispose(); } } /** * UseSignal provides a way to hook up a Phosphor signal to a React element, * so that the element is re-rendered every time the signal fires. * * It is implemented through the "render props" technique, using the `children` * prop as a function to render, so that it can be used either as a prop or as a child * of this element * https://reactjs.org/docs/render-props.html * * * Example as child: * * ``` * function LiveButton(isActiveSignal: ISignal) { * return ( * * {(_, isActive) =>