"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_jupyterlab_running_lib_index_js"],{

/***/ "../node_modules/@jupyterlab/running/lib/index.js":
/*!********************************************************!*\
  !*** ../node_modules/@jupyterlab/running/lib/index.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 */   \"IRunningSessionManagers\": () => (/* binding */ IRunningSessionManagers),\n/* harmony export */   \"RunningSessionManagers\": () => (/* binding */ RunningSessionManagers),\n/* harmony export */   \"RunningSessions\": () => (/* binding */ RunningSessions)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/ui-components */ \"webpack/sharing/consume/default/@jupyterlab/ui-components/@jupyterlab/ui-components\");\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/disposable */ \"webpack/sharing/consume/default/@lumino/disposable/@lumino/disposable\");\n/* harmony import */ var _lumino_disposable__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_disposable__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/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module running\n */\n\n\n\n\n\n\n\n/**\n * The class name added to a running widget.\n */\nconst RUNNING_CLASS = 'jp-RunningSessions';\n/**\n * The class name added to the running terminal sessions section.\n */\nconst SECTION_CLASS = 'jp-RunningSessions-section';\n/**\n * The class name added to a section container.\n */\nconst CONTAINER_CLASS = 'jp-RunningSessions-sectionContainer';\n/**\n * The class name added to the running kernel sessions section list.\n */\nconst LIST_CLASS = 'jp-RunningSessions-sectionList';\n/**\n * The class name added to the running sessions items.\n */\nconst ITEM_CLASS = 'jp-RunningSessions-item';\n/**\n * The class name added to a running session item label.\n */\nconst ITEM_LABEL_CLASS = 'jp-RunningSessions-itemLabel';\n/**\n * The class name added to a running session item detail.\n */\nconst ITEM_DETAIL_CLASS = 'jp-RunningSessions-itemDetail';\n/**\n * The class name added to a running session item shutdown button.\n */\nconst SHUTDOWN_BUTTON_CLASS = 'jp-RunningSessions-itemShutdown';\n/**\n * The class name added to a running session item shutdown button.\n */\nconst SHUTDOWN_ALL_BUTTON_CLASS = 'jp-RunningSessions-shutdownAll';\n/**\n * The running sessions token.\n */\nconst IRunningSessionManagers = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__.Token('@jupyterlab/running:IRunningSessionManagers', 'A service to add running session managers.');\nclass RunningSessionManagers {\n    constructor() {\n        this._added = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n        this._managers = [];\n    }\n    /**\n     * Signal emitted when a new manager is added.\n     */\n    get added() {\n        return this._added;\n    }\n    /**\n     * Add a running item manager.\n     *\n     * @param manager - The running item manager.\n     *\n     */\n    add(manager) {\n        this._managers.push(manager);\n        this._added.emit(manager);\n        return new _lumino_disposable__WEBPACK_IMPORTED_MODULE_4__.DisposableDelegate(() => {\n            const i = this._managers.indexOf(manager);\n            if (i > -1) {\n                this._managers.splice(i, 1);\n            }\n        });\n    }\n    /**\n     * Return an iterator of launcher items.\n     */\n    items() {\n        return this._managers;\n    }\n}\nfunction Item(props) {\n    var _a, _b;\n    const { runningItem } = props;\n    const classList = [ITEM_CLASS];\n    const detail = (_a = runningItem.detail) === null || _a === void 0 ? void 0 : _a.call(runningItem);\n    const icon = runningItem.icon();\n    const title = runningItem.labelTitle ? runningItem.labelTitle() : '';\n    const translator = props.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator;\n    const trans = translator.load('jupyterlab');\n    // Handle shutdown requests.\n    let stopPropagation = false;\n    const shutdownItemIcon = props.shutdownItemIcon || _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.closeIcon;\n    const shutdownLabel = props.shutdownLabel || trans.__('Shut Down');\n    const shutdown = () => {\n        var _a;\n        stopPropagation = true;\n        (_a = runningItem.shutdown) === null || _a === void 0 ? void 0 : _a.call(runningItem);\n    };\n    // Manage collapsed state. Use the shutdown flag in lieu of `stopPropagation`.\n    const [collapsed, collapse] = react__WEBPACK_IMPORTED_MODULE_6__.useState(false);\n    const collapsible = !!((_b = runningItem.children) === null || _b === void 0 ? void 0 : _b.length);\n    const onClick = collapsible\n        ? () => !stopPropagation && collapse(!collapsed)\n        : undefined;\n    if (runningItem.className) {\n        classList.push(runningItem.className);\n    }\n    if (props.child) {\n        classList.push('jp-mod-running-child');\n    }\n    return (react__WEBPACK_IMPORTED_MODULE_6__.createElement(react__WEBPACK_IMPORTED_MODULE_6__.Fragment, null,\n        react__WEBPACK_IMPORTED_MODULE_6__.createElement(\"li\", null,\n            react__WEBPACK_IMPORTED_MODULE_6__.createElement(\"div\", { className: classList.join(' '), onClick: onClick, \"data-context\": runningItem.context || '' },\n                collapsible &&\n                    (collapsed ? (react__WEBPACK_IMPORTED_MODULE_6__.createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.caretRightIcon.react, { tag: \"span\", stylesheet: \"runningItem\" })) : (react__WEBPACK_IMPORTED_MODULE_6__.createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.caretDownIcon.react, { tag: \"span\", stylesheet: \"runningItem\" }))),\n                typeof icon === 'string' ? (icon ? (react__WEBPACK_IMPORTED_MODULE_6__.createElement(\"img\", { src: icon })) : undefined) : (react__WEBPACK_IMPORTED_MODULE_6__.createElement(icon.react, { tag: \"span\", stylesheet: \"runningItem\" })),\n                react__WEBPACK_IMPORTED_MODULE_6__.createElement(\"span\", { className: ITEM_LABEL_CLASS, title: title, onClick: runningItem.open && (() => runningItem.open()) }, runningItem.label()),\n                detail && react__WEBPACK_IMPORTED_MODULE_6__.createElement(\"span\", { className: ITEM_DETAIL_CLASS }, detail),\n                runningItem.shutdown && (react__WEBPACK_IMPORTED_MODULE_6__.createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButtonComponent, { className: SHUTDOWN_BUTTON_CLASS, icon: shutdownItemIcon, onClick: shutdown, tooltip: shutdownLabel }))),\n            collapsible && !collapsed && (react__WEBPACK_IMPORTED_MODULE_6__.createElement(List, { child: true, runningItems: runningItem.children, shutdownItemIcon: shutdownItemIcon, translator: translator })))));\n}\nfunction List(props) {\n    return (react__WEBPACK_IMPORTED_MODULE_6__.createElement(\"ul\", { className: LIST_CLASS }, props.runningItems.map((item, i) => (react__WEBPACK_IMPORTED_MODULE_6__.createElement(Item, { child: props.child, key: i, runningItem: item, shutdownLabel: props.shutdownLabel, shutdownItemIcon: props.shutdownItemIcon, translator: props.translator })))));\n}\nclass ListWidget extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ReactWidget {\n    constructor(_options) {\n        super();\n        this._options = _options;\n        this._update = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_5__.Signal(this);\n        _options.manager.runningChanged.connect(this._emitUpdate, this);\n    }\n    dispose() {\n        this._options.manager.runningChanged.disconnect(this._emitUpdate, this);\n        super.dispose();\n    }\n    onBeforeShow(msg) {\n        super.onBeforeShow(msg);\n        this._update.emit();\n    }\n    render() {\n        const options = this._options;\n        let cached = true;\n        return (react__WEBPACK_IMPORTED_MODULE_6__.createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.UseSignal, { signal: this._update }, () => {\n            // Cache the running items for the intial load and request from\n            // the service every subsequent load.\n            if (cached) {\n                cached = false;\n            }\n            else {\n                options.runningItems = options.manager.running();\n            }\n            return (react__WEBPACK_IMPORTED_MODULE_6__.createElement(\"div\", { className: CONTAINER_CLASS },\n                react__WEBPACK_IMPORTED_MODULE_6__.createElement(List, { runningItems: options.runningItems, shutdownLabel: options.manager.shutdownLabel, shutdownAllLabel: options.shutdownAllLabel, shutdownItemIcon: options.manager.shutdownItemIcon, translator: options.translator })));\n        }));\n    }\n    /**\n     * Check if the widget or any of it's parents is hidden.\n     *\n     * Checking parents is necessary as lumino does not propagate visibility\n     * changes from parents down to children (although it does notify parents\n     * about changes to children visibility).\n     */\n    _isAnyHidden() {\n        let isHidden = this.isHidden;\n        if (isHidden) {\n            return isHidden;\n        }\n        let parent = this.parent;\n        while (parent != null) {\n            if (parent.isHidden) {\n                isHidden = true;\n                break;\n            }\n            parent = parent.parent;\n        }\n        return isHidden;\n    }\n    _emitUpdate() {\n        if (this._isAnyHidden()) {\n            return;\n        }\n        this._update.emit();\n    }\n}\n/**\n * The Section component contains the shared look and feel for an interactive\n * list of kernels and sessions.\n *\n * It is specialized for each based on its props.\n */\nclass Section extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.PanelWithToolbar {\n    constructor(options) {\n        super();\n        this._manager = options.manager;\n        const translator = options.translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator;\n        const trans = translator.load('jupyterlab');\n        const shutdownAllLabel = options.manager.shutdownAllLabel || trans.__('Shut Down All');\n        const shutdownTitle = `${shutdownAllLabel}?`;\n        const shutdownAllConfirmationText = options.manager.shutdownAllConfirmationText ||\n            `${shutdownAllLabel} ${options.manager.name}`;\n        this.addClass(SECTION_CLASS);\n        this.title.label = options.manager.name;\n        function onShutdown() {\n            void (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.showDialog)({\n                title: shutdownTitle,\n                body: shutdownAllConfirmationText,\n                buttons: [\n                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.cancelButton(),\n                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.Dialog.warnButton({ label: shutdownAllLabel })\n                ]\n            }).then(result => {\n                if (result.button.accept) {\n                    options.manager.shutdownAll();\n                }\n            });\n        }\n        let runningItems = options.manager.running();\n        const enabled = runningItems.length > 0;\n        this._button = new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton({\n            label: shutdownAllLabel,\n            className: `${SHUTDOWN_ALL_BUTTON_CLASS} jp-mod-styled ${!enabled && 'jp-mod-disabled'}`,\n            enabled,\n            onClick: onShutdown\n        });\n        this._manager.runningChanged.connect(this._updateButton, this);\n        this.toolbar.addItem('shutdown-all', this._button);\n        this.addWidget(new ListWidget({ runningItems, shutdownAllLabel, ...options }));\n    }\n    /**\n     * Dispose the resources held by the widget\n     */\n    dispose() {\n        if (this.isDisposed) {\n            return;\n        }\n        this._manager.runningChanged.disconnect(this._updateButton, this);\n        super.dispose();\n    }\n    _updateButton() {\n        var _a, _b;\n        const button = this._button;\n        button.enabled = this._manager.running().length > 0;\n        if (button.enabled) {\n            (_a = button.node.querySelector('button')) === null || _a === void 0 ? void 0 : _a.classList.remove('jp-mod-disabled');\n        }\n        else {\n            (_b = button.node.querySelector('button')) === null || _b === void 0 ? void 0 : _b.classList.add('jp-mod-disabled');\n        }\n    }\n}\n/**\n * A class that exposes the running terminal and kernel sessions.\n */\nclass RunningSessions extends _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.SidePanel {\n    /**\n     * Construct a new running widget.\n     */\n    constructor(managers, translator) {\n        super();\n        this.managers = managers;\n        this.translator = translator !== null && translator !== void 0 ? translator : _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_1__.nullTranslator;\n        const trans = this.translator.load('jupyterlab');\n        this.addClass(RUNNING_CLASS);\n        this.toolbar.addItem('refresh', new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.ToolbarButton({\n            tooltip: trans.__('Refresh List'),\n            icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.refreshIcon,\n            onClick: () => managers.items().forEach(manager => manager.refreshRunning())\n        }));\n        managers.items().forEach(manager => this.addSection(managers, manager));\n        managers.added.connect(this.addSection, this);\n    }\n    /**\n     * Dispose the resources held by the widget\n     */\n    dispose() {\n        if (this.isDisposed) {\n            return;\n        }\n        this.managers.added.disconnect(this.addSection, this);\n        super.dispose();\n    }\n    /**\n     * Add a section for a new manager.\n     *\n     * @param managers Managers\n     * @param manager New manager\n     */\n    addSection(_, manager) {\n        this.addWidget(new Section({ manager, translator: this.translator }));\n    }\n}\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/running/lib/index.js?");

/***/ })

}]);