"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] = self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] || []).push([["vendors-node_modules_lumino_commands_dist_index_es6_js"],{

/***/ "../node_modules/@lumino/commands/dist/index.es6.js":
/*!**********************************************************!*\
  !*** ../node_modules/@lumino/commands/dist/index.es6.js ***!
  \**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   CommandRegistry: () => (/* binding */ CommandRegistry)\n/* harmony export */ });\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/disposable */ \"webpack/sharing/consume/default/@lumino/disposable/@lumino/disposable\");\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_lumino_disposable__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/domutils */ \"webpack/sharing/consume/default/@lumino/domutils/@lumino/domutils\");\n/* harmony import */ var _lumino_domutils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_keyboard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/keyboard */ \"webpack/sharing/consume/default/@lumino/keyboard/@lumino/keyboard\");\n/* harmony import */ var _lumino_keyboard__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_keyboard__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/signaling */ \"webpack/sharing/consume/default/@lumino/signaling/@lumino/signaling\");\n/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_5__);\n\n\n\n\n\n\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module commands\n */\n/**\n * An object which manages a collection of commands.\n *\n * #### Notes\n * A command registry can be used to populate a variety of action-based\n * widgets, such as command palettes, menus, and toolbars.\n */\nclass CommandRegistry {\n    constructor() {\n        this._timerID = 0;\n        this._replaying = false;\n        this._keystrokes = [];\n        this._keydownEvents = [];\n        this._keyBindings = [];\n        this._exactKeyMatch = null;\n        this._commands = new Map();\n        this._commandChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n        this._commandExecuted = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n        this._keyBindingChanged = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n        this._holdKeyBindingPromises = new Map();\n    }\n    /**\n     * A signal emitted when a command has changed.\n     *\n     * #### Notes\n     * This signal is useful for visual representations of commands which\n     * need to refresh when the state of a relevant command has changed.\n     */\n    get commandChanged() {\n        return this._commandChanged;\n    }\n    /**\n     * A signal emitted when a command has executed.\n     *\n     * #### Notes\n     * Care should be taken when consuming this signal. The command system is used\n     * by many components for many user actions. Handlers registered with this\n     * signal must return quickly to ensure the overall application remains responsive.\n     */\n    get commandExecuted() {\n        return this._commandExecuted;\n    }\n    /**\n     * A signal emitted when a key binding is changed.\n     */\n    get keyBindingChanged() {\n        return this._keyBindingChanged;\n    }\n    /**\n     * A read-only array of the key bindings in the registry.\n     */\n    get keyBindings() {\n        return this._keyBindings;\n    }\n    /**\n     * List the ids of the registered commands.\n     *\n     * @returns A new array of the registered command ids.\n     */\n    listCommands() {\n        return Array.from(this._commands.keys());\n    }\n    /**\n     * Test whether a specific command is registered.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @returns `true` if the command is registered, `false` otherwise.\n     */\n    hasCommand(id) {\n        return this._commands.has(id);\n    }\n    /**\n     * Add a command to the registry.\n     *\n     * @param id - The unique id of the command.\n     *\n     * @param options - The options for the command.\n     *\n     * @returns A disposable which will remove the command.\n     *\n     * @throws An error if the given `id` is already registered.\n     */\n    addCommand(id, options) {\n        // Throw an error if the id is already registered.\n        if (this._commands.has(id)) {\n            throw new Error(`Command '${id}' already registered.`);\n        }\n        // Add the command to the registry.\n        this._commands.set(id, Private.createCommand(options));\n        // Emit the `commandChanged` signal.\n        this._commandChanged.emit({ id, type: 'added' });\n        // Return a disposable which will remove the command.\n        return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_2__.DisposableDelegate(() => {\n            // Remove the command from the registry.\n            this._commands.delete(id);\n            // Emit the `commandChanged` signal.\n            this._commandChanged.emit({ id, type: 'removed' });\n        });\n    }\n    /**\n     * Notify listeners that the state of a command has changed.\n     *\n     * @param id - The id of the command which has changed. If more than\n     *   one command has changed, this argument should be omitted.\n     *\n     * @throws An error if the given `id` is not registered.\n     *\n     * #### Notes\n     * This method should be called by the command author whenever the\n     * application state changes such that the results of the command\n     * metadata functions may have changed.\n     *\n     * This will cause the `commandChanged` signal to be emitted.\n     */\n    notifyCommandChanged(id) {\n        if (id !== undefined && !this._commands.has(id)) {\n            throw new Error(`Command '${id}' is not registered.`);\n        }\n        this._commandChanged.emit({ id, type: id ? 'changed' : 'many-changed' });\n    }\n    /**\n     * Get the description for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The description for the command.\n     */\n    describedBy(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        var _a;\n        let cmd = this._commands.get(id);\n        return Promise.resolve((_a = cmd === null || cmd === void 0 ? void 0 : cmd.describedBy.call(undefined, args)) !== null && _a !== void 0 ? _a : { args: null });\n    }\n    /**\n     * Get the display label for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The display label for the command, or an empty string\n     *   if the command is not registered.\n     */\n    label(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        var _a;\n        let cmd = this._commands.get(id);\n        return (_a = cmd === null || cmd === void 0 ? void 0 : cmd.label.call(undefined, args)) !== null && _a !== void 0 ? _a : '';\n    }\n    /**\n     * Get the mnemonic index for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The mnemonic index for the command, or `-1` if the\n     *   command is not registered.\n     */\n    mnemonic(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.mnemonic.call(undefined, args) : -1;\n    }\n    /**\n     * Get the icon renderer for a specific command.\n     *\n     * DEPRECATED: if set to a string value, the .icon field will\n     * function as an alias for the .iconClass field, for backwards\n     * compatibility. In the future when this is removed, the default\n     * return type will become undefined.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The icon renderer for the command or `undefined`.\n     */\n    icon(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        var _a;\n        return (_a = this._commands.get(id)) === null || _a === void 0 ? void 0 : _a.icon.call(undefined, args);\n    }\n    /**\n     * Get the icon class for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The icon class for the command, or an empty string if\n     *   the command is not registered.\n     */\n    iconClass(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.iconClass.call(undefined, args) : '';\n    }\n    /**\n     * Get the icon label for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The icon label for the command, or an empty string if\n     *   the command is not registered.\n     */\n    iconLabel(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.iconLabel.call(undefined, args) : '';\n    }\n    /**\n     * Get the short form caption for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The caption for the command, or an empty string if the\n     *   command is not registered.\n     */\n    caption(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.caption.call(undefined, args) : '';\n    }\n    /**\n     * Get the usage help text for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The usage text for the command, or an empty string if\n     *   the command is not registered.\n     */\n    usage(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.usage.call(undefined, args) : '';\n    }\n    /**\n     * Get the extra class name for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The class name for the command, or an empty string if\n     *   the command is not registered.\n     */\n    className(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.className.call(undefined, args) : '';\n    }\n    /**\n     * Get the dataset for a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns The dataset for the command, or an empty dataset if\n     *   the command is not registered.\n     */\n    dataset(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.dataset.call(undefined, args) : {};\n    }\n    /**\n     * Test whether a specific command is enabled.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns A boolean indicating whether the command is enabled,\n     *   or `false` if the command is not registered.\n     */\n    isEnabled(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.isEnabled.call(undefined, args) : false;\n    }\n    /**\n     * Test whether a specific command is toggled.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns A boolean indicating whether the command is toggled,\n     *   or `false` if the command is not registered.\n     */\n    isToggled(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.isToggled.call(undefined, args) : false;\n    }\n    /**\n     * Test whether a specific command is toggleable.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns A boolean indicating whether the command is toggleable,\n     *   or `false` if the command is not registered.\n     */\n    isToggleable(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.isToggleable : false;\n    }\n    /**\n     * Test whether a specific command is visible.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns A boolean indicating whether the command is visible,\n     *   or `false` if the command is not registered.\n     */\n    isVisible(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        let cmd = this._commands.get(id);\n        return cmd ? cmd.isVisible.call(undefined, args) : false;\n    }\n    /**\n     * Execute a specific command.\n     *\n     * @param id - The id of the command of interest.\n     *\n     * @param args - The arguments for the command.\n     *\n     * @returns A promise which resolves with the result of the command.\n     *\n     * #### Notes\n     * The promise will reject if the command throws an exception,\n     * or if the command is not registered.\n     */\n    execute(id, args = _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject) {\n        // Reject if the command is not registered.\n        let cmd = this._commands.get(id);\n        if (!cmd) {\n            return Promise.reject(new Error(`Command '${id}' not registered.`));\n        }\n        // Execute the command and reject if an exception is thrown.\n        let value;\n        try {\n            value = cmd.execute.call(undefined, args);\n        }\n        catch (err) {\n            value = Promise.reject(err);\n        }\n        // Create the return promise which resolves the result.\n        let result = Promise.resolve(value);\n        // Emit the command executed signal.\n        this._commandExecuted.emit({ id, args, result });\n        // Return the result promise to the caller.\n        return result;\n    }\n    /**\n     * Add a key binding to the registry.\n     *\n     * @param options - The options for creating the key binding.\n     *\n     * @returns A disposable which removes the added key binding.\n     *\n     * #### Notes\n     * If multiple key bindings are registered for the same sequence, the\n     * binding with the highest selector specificity is executed first. A\n     * tie is broken by using the most recently added key binding.\n     *\n     * Ambiguous key bindings are resolved with a timeout. As an example,\n     * suppose two key bindings are registered: one with the key sequence\n     * `['Ctrl D']`, and another with `['Ctrl D', 'Ctrl W']`. If the user\n     * presses `Ctrl D`, the first binding cannot be immediately executed\n     * since the user may intend to complete the chord with `Ctrl W`. For\n     * such cases, a timer is used to allow the chord to be completed. If\n     * the chord is not completed before the timeout, the first binding\n     * is executed.\n     */\n    addKeyBinding(options) {\n        // Create the binding for the given options.\n        let binding = Private.createKeyBinding(options);\n        // Add the key binding to the bindings array.\n        this._keyBindings.push(binding);\n        // Emit the `bindingChanged` signal.\n        this._keyBindingChanged.emit({ binding, type: 'added' });\n        // Return a disposable which will remove the binding.\n        return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_2__.DisposableDelegate(() => {\n            // Remove the binding from the array.\n            _lumino_algorithm__WEBPACK_IMPORTED_MODULE_0__.ArrayExt.removeFirstOf(this._keyBindings, binding);\n            // Emit the `bindingChanged` signal.\n            this._keyBindingChanged.emit({ binding, type: 'removed' });\n        });\n    }\n    /**\n     * Process a `'keydown'` event and invoke a matching key binding.\n     *\n     * @param event - The event object for a `'keydown'` event.\n     *\n     * #### Notes\n     * This should be called in response to a `'keydown'` event in order\n     * to invoke the command for the best matching key binding.\n     *\n     * The registry **does not** install its own listener for `'keydown'`\n     * events. This allows the application full control over the nodes\n     * and phase for which the registry processes `'keydown'` events.\n     *\n     * When the keydown event is processed, if the event target or any of its\n     * ancestor nodes has a `data-lm-suppress-shortcuts` attribute, its keydown\n     * events will not invoke commands.\n     */\n    processKeydownEvent(event) {\n        // Bail immediately if playing back keystrokes\n        // or if the event has been processed\n        if (event.defaultPrevented ||\n            this._replaying ||\n            CommandRegistry.isModifierKeyPressed(event)) {\n            return;\n        }\n        // Get the normalized keystroke for the event.\n        const keystroke = CommandRegistry.keystrokeForKeydownEvent(event);\n        // If the keystroke is not valid for the keyboard layout, replay\n        // any suppressed events and clear the pending state.\n        if (!keystroke) {\n            this._replayKeydownEvents();\n            this._clearPendingState();\n            return;\n        }\n        // Add the keystroke to the current key sequence.\n        this._keystrokes.push(keystroke);\n        // Find the exact and partial matches for the key sequence.\n        const { exact, partial } = Private.matchKeyBinding(this._keyBindings, this._keystrokes, event);\n        // Whether there is any partial match.\n        const hasPartial = partial.length !== 0;\n        // If there is no exact match and no partial match, replay\n        // any suppressed events and clear the pending state.\n        if (!exact && !hasPartial) {\n            this._replayKeydownEvents();\n            this._clearPendingState();\n            return;\n        }\n        // Stop propagation of the event. If there is only a partial match,\n        // the event will be replayed if a final exact match never occurs.\n        if ((exact === null || exact === void 0 ? void 0 : exact.preventDefault) || partial.some(match => match.preventDefault)) {\n            event.preventDefault();\n            event.stopPropagation();\n        }\n        // Store the event for possible playback in the future and for\n        // the use in execution hold check.\n        this._keydownEvents.push(event);\n        // If there is an exact match but no partial match, the exact match\n        // can be dispatched immediately. The pending state is cleared so\n        // the next key press starts from the default state.\n        if (exact && !hasPartial) {\n            this._executeKeyBinding(exact);\n            this._clearPendingState();\n            return;\n        }\n        // If there is both an exact match and a partial match, the exact\n        // match is stored for future dispatch in case the timer expires\n        // before a more specific match is triggered.\n        if (exact) {\n            this._exactKeyMatch = exact;\n        }\n        // (Re)start the timer to dispatch the most recent exact match\n        // in case the partial match fails to result in an exact match.\n        this._startTimer();\n    }\n    /**\n     * Delay the execution of any command matched against the given 'keydown' event\n     * until the `permission` to execute is granted.\n     *\n     * @param event - The event object for a `'keydown'` event.\n     * @param permission - The promise with value indicating whether to proceed with the execution.\n     *\n     * ### Note\n     * This enables the caller of `processKeydownEvent` to asynchronously prevent the\n     * execution of the command based on external events.\n     */\n    holdKeyBindingExecution(event, permission) {\n        this._holdKeyBindingPromises.set(event, permission);\n    }\n    /**\n     * Start or restart the pending timeout.\n     */\n    _startTimer() {\n        this._clearTimer();\n        this._timerID = window.setTimeout(() => {\n            this._onPendingTimeout();\n        }, Private.CHORD_TIMEOUT);\n    }\n    /**\n     * Clear the pending timeout.\n     */\n    _clearTimer() {\n        if (this._timerID !== 0) {\n            clearTimeout(this._timerID);\n            this._timerID = 0;\n        }\n    }\n    /**\n     * Replay the keydown events which were suppressed.\n     */\n    _replayKeydownEvents() {\n        if (this._keydownEvents.length === 0) {\n            return;\n        }\n        this._replaying = true;\n        this._keydownEvents.forEach(Private.replayKeyEvent);\n        this._replaying = false;\n    }\n    /**\n     * Execute the command for the given key binding.\n     *\n     * If the command is missing or disabled, a warning will be logged.\n     *\n     * The execution will not proceed if any of the events leading to\n     * the keybinding matching were held with the permission resolving to false.\n     */\n    async _executeKeyBinding(binding) {\n        if (this._holdKeyBindingPromises.size !== 0) {\n            // Copy keydown events list to ensure it is available in async code.\n            const keydownEvents = [...this._keydownEvents];\n            // Wait until all hold requests on execution are lifted.\n            const executionAllowed = (await Promise.race([\n                Promise.all(keydownEvents.map(async (event) => { var _a; return (_a = this._holdKeyBindingPromises.get(event)) !== null && _a !== void 0 ? _a : Promise.resolve(true); })),\n                new Promise(resolve => {\n                    setTimeout(() => resolve([false]), Private.KEYBINDING_HOLD_TIMEOUT);\n                })\n            ])).every(Boolean);\n            // Clear the hold requests.\n            this._holdKeyBindingPromises.clear();\n            // Do not proceed with the execution if any of the hold requests did not get the permission to proceed.\n            if (!executionAllowed) {\n                return;\n            }\n        }\n        let { command, args } = binding;\n        let newArgs = {\n            _luminoEvent: { type: 'keybinding', keys: binding.keys },\n            ...args\n        };\n        if (!this.hasCommand(command) || !this.isEnabled(command, newArgs)) {\n            let word = this.hasCommand(command) ? 'enabled' : 'registered';\n            let keys = binding.keys.join(', ');\n            let msg1 = `Cannot execute key binding '${keys}':`;\n            let msg2 = `command '${command}' is not ${word}.`;\n            console.warn(`${msg1} ${msg2}`);\n            return;\n        }\n        await this.execute(command, newArgs);\n    }\n    /**\n     * Clear the internal pending state.\n     */\n    _clearPendingState() {\n        this._clearTimer();\n        this._exactKeyMatch = null;\n        this._keystrokes.length = 0;\n        this._keydownEvents.length = 0;\n    }\n    /**\n     * Handle the partial match timeout.\n     */\n    _onPendingTimeout() {\n        this._timerID = 0;\n        if (this._exactKeyMatch) {\n            this._executeKeyBinding(this._exactKeyMatch);\n        }\n        else {\n            this._replayKeydownEvents();\n        }\n        this._clearPendingState();\n    }\n}\n/**\n * The namespace for the `CommandRegistry` class statics.\n */\n(function (CommandRegistry) {\n    /**\n     * Parse a keystroke into its constituent components.\n     *\n     * @param keystroke - The keystroke of interest.\n     *\n     * @returns The parsed components of the keystroke.\n     *\n     * #### Notes\n     * The keystroke should be of the form:\n     *   `[<modifier 1> [<modifier 2> [<modifier N> ]]]<primary key>`\n     *\n     * The supported modifiers are: `Accel`, `Alt`, `Cmd`, `Ctrl`, and\n     * `Shift`. The `Accel` modifier is translated to `Cmd` on Mac and\n     * `Ctrl` on all other platforms.\n     *\n     * The parsing is tolerant and will not throw exceptions. Notably:\n     *   - Duplicate modifiers are ignored.\n     *   - Extra primary keys are ignored.\n     *   - The order of modifiers and primary key is irrelevant.\n     *   - The keystroke parts should be separated by whitespace.\n     *   - The keystroke is case sensitive.\n     */\n    function parseKeystroke(keystroke) {\n        let key = '';\n        let alt = false;\n        let cmd = false;\n        let ctrl = false;\n        let shift = false;\n        for (let token of keystroke.split(/\\s+/)) {\n            if (token === 'Accel') {\n                if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n                    cmd = true;\n                }\n                else {\n                    ctrl = true;\n                }\n            }\n            else if (token === 'Alt') {\n                alt = true;\n            }\n            else if (token === 'Cmd') {\n                cmd = true;\n            }\n            else if (token === 'Ctrl') {\n                ctrl = true;\n            }\n            else if (token === 'Shift') {\n                shift = true;\n            }\n            else if (token.length > 0) {\n                key = token;\n            }\n        }\n        return { cmd, ctrl, alt, shift, key };\n    }\n    CommandRegistry.parseKeystroke = parseKeystroke;\n    /**\n     * Normalize a keystroke into a canonical representation.\n     *\n     * @param keystroke - The keystroke of interest.\n     *\n     * @returns The normalized representation of the keystroke.\n     *\n     * #### Notes\n     * This normalizes the keystroke by removing duplicate modifiers and\n     * extra primary keys, and assembling the parts in a canonical order.\n     *\n     * The `Cmd` modifier is ignored on non-Mac platforms.\n     */\n    function normalizeKeystroke(keystroke) {\n        let mods = '';\n        let parts = parseKeystroke(keystroke);\n        if (parts.ctrl) {\n            mods += 'Ctrl ';\n        }\n        if (parts.alt) {\n            mods += 'Alt ';\n        }\n        if (parts.shift) {\n            mods += 'Shift ';\n        }\n        if (parts.cmd && _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n            mods += 'Cmd ';\n        }\n        return mods + parts.key;\n    }\n    CommandRegistry.normalizeKeystroke = normalizeKeystroke;\n    /**\n     * Get the platform-specific normalized keys for an options object.\n     *\n     * @param options - The options for the key binding.\n     *\n     * @returns Array of combined, normalized keys.\n     */\n    function normalizeKeys(options) {\n        let keys;\n        if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_WIN) {\n            keys = options.winKeys || options.keys;\n        }\n        else if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n            keys = options.macKeys || options.keys;\n        }\n        else {\n            keys = options.linuxKeys || options.keys;\n        }\n        return keys.map(normalizeKeystroke);\n    }\n    CommandRegistry.normalizeKeys = normalizeKeys;\n    /**\n     * Format keystrokes for display on the local system.\n     *\n     * If a list of keystrokes is provided, it will be displayed as\n     * a comma-separated string\n     *\n     * @param keystroke The keystrokes to format\n     * @returns The keystrokes representation\n     */\n    function formatKeystroke(keystroke) {\n        return typeof keystroke === 'string'\n            ? formatSingleKey(keystroke)\n            : keystroke.map(formatSingleKey).join(', ');\n        function formatSingleKey(key) {\n            let mods = [];\n            let separator = _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC ? ' ' : '+';\n            let parts = parseKeystroke(key);\n            if (parts.ctrl) {\n                mods.push('Ctrl');\n            }\n            if (parts.alt) {\n                mods.push('Alt');\n            }\n            if (parts.shift) {\n                mods.push('Shift');\n            }\n            if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC && parts.cmd) {\n                mods.push('Cmd');\n            }\n            mods.push(parts.key);\n            return mods.map(Private.formatKey).join(separator);\n        }\n    }\n    CommandRegistry.formatKeystroke = formatKeystroke;\n    /**\n     * Check if `'keydown'` event is caused by pressing a modifier key that should be ignored.\n     *\n     * @param event - The event object for a `'keydown'` event.\n     *\n     * @returns `true` if modifier key was pressed, `false` otherwise.\n     */\n    function isModifierKeyPressed(event) {\n        let layout = (0,_lumino_keyboard__WEBPACK_IMPORTED_MODULE_4__.getKeyboardLayout)();\n        let key = layout.keyForKeydownEvent(event);\n        return layout.isModifierKey(key);\n    }\n    CommandRegistry.isModifierKeyPressed = isModifierKeyPressed;\n    /**\n     * Create a normalized keystroke for a `'keydown'` event.\n     *\n     * @param event - The event object for a `'keydown'` event.\n     *\n     * @returns A normalized keystroke, or an empty string if the event\n     *   does not represent a valid keystroke for the given layout.\n     */\n    function keystrokeForKeydownEvent(event) {\n        let layout = (0,_lumino_keyboard__WEBPACK_IMPORTED_MODULE_4__.getKeyboardLayout)();\n        let key = layout.keyForKeydownEvent(event);\n        if (!key || layout.isModifierKey(key)) {\n            return '';\n        }\n        let mods = [];\n        if (event.ctrlKey) {\n            mods.push('Ctrl');\n        }\n        if (event.altKey) {\n            mods.push('Alt');\n        }\n        if (event.shiftKey) {\n            mods.push('Shift');\n        }\n        if (event.metaKey && _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n            mods.push('Cmd');\n        }\n        mods.push(key);\n        return mods.join(' ');\n    }\n    CommandRegistry.keystrokeForKeydownEvent = keystrokeForKeydownEvent;\n})(CommandRegistry || (CommandRegistry = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n    /**\n     * The timeout in ms for triggering a key binding chord.\n     */\n    Private.CHORD_TIMEOUT = 1000;\n    /**\n     * The timeout in ms for stopping the hold on keybinding execution.\n     */\n    Private.KEYBINDING_HOLD_TIMEOUT = 1000;\n    /**\n     * Create a normalized command from an options object.\n     */\n    function createCommand(options) {\n        return {\n            execute: options.execute,\n            describedBy: asFunc(typeof options.describedBy === 'function'\n                ? options.describedBy\n                : { args: null, ...options.describedBy }, () => {\n                return { args: null };\n            }),\n            label: asFunc(options.label, emptyStringFunc),\n            mnemonic: asFunc(options.mnemonic, negativeOneFunc),\n            icon: asFunc(options.icon, undefinedFunc),\n            iconClass: asFunc(options.iconClass, emptyStringFunc),\n            iconLabel: asFunc(options.iconLabel, emptyStringFunc),\n            caption: asFunc(options.caption, emptyStringFunc),\n            usage: asFunc(options.usage, emptyStringFunc),\n            className: asFunc(options.className, emptyStringFunc),\n            dataset: asFunc(options.dataset, emptyDatasetFunc),\n            isEnabled: options.isEnabled || trueFunc,\n            isToggled: options.isToggled || falseFunc,\n            isToggleable: options.isToggleable || !!options.isToggled,\n            isVisible: options.isVisible || trueFunc\n        };\n    }\n    Private.createCommand = createCommand;\n    /**\n     * Create a key binding object from key binding options.\n     */\n    function createKeyBinding(options) {\n        var _a;\n        return {\n            keys: CommandRegistry.normalizeKeys(options),\n            selector: validateSelector(options),\n            command: options.command,\n            args: options.args || _lumino_coreutils__WEBPACK_IMPORTED_MODULE_1__.JSONExt.emptyObject,\n            preventDefault: (_a = options.preventDefault) !== null && _a !== void 0 ? _a : true\n        };\n    }\n    Private.createKeyBinding = createKeyBinding;\n    /**\n     * Find the key bindings which match a key sequence.\n     *\n     * This returns a match result which contains the best exact matching\n     * binding, and a flag which indicates if there are partial matches.\n     */\n    function matchKeyBinding(bindings, keys, event) {\n        // The current best exact match.\n        let exact = null;\n        // Partial matches.\n        let partial = [];\n        // The match distance for the exact match.\n        let distance = Infinity;\n        // The specificity for the exact match.\n        let specificity = 0;\n        // Iterate over the bindings and search for the best match.\n        for (let i = 0, n = bindings.length; i < n; ++i) {\n            // Lookup the current binding.\n            let binding = bindings[i];\n            // Check whether the key binding sequence is a match.\n            let sqm = matchSequence(binding.keys, keys);\n            // If there is no match, the binding is ignored.\n            if (sqm === 0 /* SequenceMatch.None */) {\n                continue;\n            }\n            // If it is a partial match and no other partial match has been\n            // found, ensure the selector matches and set the partial flag.\n            if (sqm === 2 /* SequenceMatch.Partial */) {\n                if (targetDistance(binding.selector, event) !== -1) {\n                    partial.push(binding);\n                }\n                continue;\n            }\n            // Ignore the match if the selector doesn't match, or if the\n            // matched node is farther away than the current best match.\n            let td = targetDistance(binding.selector, event);\n            if (td === -1 || td > distance) {\n                continue;\n            }\n            // Get the specificity for the selector.\n            let sp = _lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Selector.calculateSpecificity(binding.selector);\n            // Update the best match if this match is stronger.\n            if (!exact || td < distance || sp >= specificity) {\n                exact = binding;\n                distance = td;\n                specificity = sp;\n            }\n        }\n        // Return the match result.\n        return { exact, partial };\n    }\n    Private.matchKeyBinding = matchKeyBinding;\n    /**\n     * Replay a keyboard event.\n     *\n     * This synthetically dispatches a clone of the keyboard event.\n     */\n    function replayKeyEvent(event) {\n        event.target.dispatchEvent(cloneKeyboardEvent(event));\n    }\n    Private.replayKeyEvent = replayKeyEvent;\n    function formatKey(key) {\n        if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Platform.IS_MAC) {\n            return MAC_DISPLAY.hasOwnProperty(key) ? MAC_DISPLAY[key] : key;\n        }\n        else {\n            return WIN_DISPLAY.hasOwnProperty(key) ? WIN_DISPLAY[key] : key;\n        }\n    }\n    Private.formatKey = formatKey;\n    const MAC_DISPLAY = {\n        Backspace: '⌫',\n        Tab: '⇥',\n        Enter: '⏎',\n        Shift: '⇧',\n        Ctrl: '⌃',\n        Alt: '⌥',\n        Escape: '⎋',\n        PageUp: '⇞',\n        PageDown: '⇟',\n        End: '↘',\n        Home: '↖',\n        ArrowLeft: '←',\n        ArrowUp: '↑',\n        ArrowRight: '→',\n        ArrowDown: '↓',\n        Delete: '⌦',\n        Cmd: '⌘'\n    };\n    const WIN_DISPLAY = {\n        Escape: 'Esc',\n        PageUp: 'Page Up',\n        PageDown: 'Page Down',\n        ArrowLeft: 'Left',\n        ArrowUp: 'Up',\n        ArrowRight: 'Right',\n        ArrowDown: 'Down',\n        Delete: 'Del'\n    };\n    /**\n     * A singleton empty string function.\n     */\n    const emptyStringFunc = () => '';\n    /**\n     * A singleton `-1` number function\n     */\n    const negativeOneFunc = () => -1;\n    /**\n     * A singleton true boolean function.\n     */\n    const trueFunc = () => true;\n    /**\n     * A singleton false boolean function.\n     */\n    const falseFunc = () => false;\n    /**\n     * A singleton empty dataset function.\n     */\n    const emptyDatasetFunc = () => ({});\n    /**\n     * A singleton undefined function\n     */\n    const undefinedFunc = () => undefined;\n    /**\n     * Cast a value or command func to a command func.\n     */\n    function asFunc(value, dfault) {\n        if (value === undefined) {\n            return dfault;\n        }\n        if (typeof value === 'function') {\n            return value;\n        }\n        return () => value;\n    }\n    /**\n     * Validate the selector for an options object.\n     *\n     * This returns the validated selector, or throws if the selector is\n     * invalid or contains commas.\n     */\n    function validateSelector(options) {\n        if (options.selector.indexOf(',') !== -1) {\n            throw new Error(`Selector cannot contain commas: ${options.selector}`);\n        }\n        if (!_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Selector.isValid(options.selector)) {\n            throw new Error(`Invalid selector: ${options.selector}`);\n        }\n        return options.selector;\n    }\n    /**\n     * Test whether a key binding sequence matches a key sequence.\n     *\n     * Returns a `SequenceMatch` value indicating the type of match.\n     */\n    function matchSequence(bindKeys, userKeys) {\n        if (bindKeys.length < userKeys.length) {\n            return 0 /* SequenceMatch.None */;\n        }\n        for (let i = 0, n = userKeys.length; i < n; ++i) {\n            if (bindKeys[i] !== userKeys[i]) {\n                return 0 /* SequenceMatch.None */;\n            }\n        }\n        if (bindKeys.length > userKeys.length) {\n            return 2 /* SequenceMatch.Partial */;\n        }\n        return 1 /* SequenceMatch.Exact */;\n    }\n    /**\n     * Find the distance from the target node to the first matching node.\n     *\n     * This traverses the event path from `target` to `currentTarget` and\n     * computes the distance from `target` to the first node which matches\n     * the CSS selector. If no match is found, `-1` is returned.\n     */\n    function targetDistance(selector, event) {\n        let targ = event.target;\n        let curr = event.currentTarget;\n        for (let dist = 0; targ !== null; targ = targ.parentElement, ++dist) {\n            if (targ.hasAttribute('data-lm-suppress-shortcuts')) {\n                return -1;\n            }\n            if (_lumino_domutils__WEBPACK_IMPORTED_MODULE_3__.Selector.matches(targ, selector)) {\n                return dist;\n            }\n            if (targ === curr) {\n                return -1;\n            }\n        }\n        return -1;\n    }\n    /**\n     * Clone a keyboard event.\n     */\n    function cloneKeyboardEvent(event) {\n        // A custom event is required because Chrome nulls out the\n        // `keyCode` field in user-generated `KeyboardEvent` types.\n        let clone = document.createEvent('Event');\n        let bubbles = event.bubbles || true;\n        let cancelable = event.cancelable || true;\n        clone.initEvent(event.type || 'keydown', bubbles, cancelable);\n        clone.key = event.key || '';\n        clone.keyCode = event.keyCode || 0;\n        clone.which = event.keyCode || 0;\n        clone.ctrlKey = event.ctrlKey || false;\n        clone.altKey = event.altKey || false;\n        clone.shiftKey = event.shiftKey || false;\n        clone.metaKey = event.metaKey || false;\n        clone.view = event.view || window;\n        return clone;\n    }\n})(Private || (Private = {}));\n\n\n//# sourceMappingURL=index.es6.js.map\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@lumino/commands/dist/index.es6.js?");

/***/ })

}]);