"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([["node_modules_jupyterlab_htmlviewer-extension_lib_index_js"],{

/***/ "../node_modules/@jupyterlab/htmlviewer-extension/lib/index.js":
/*!*********************************************************************!*\
  !*** ../node_modules/@jupyterlab/htmlviewer-extension/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 */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/application */ \"webpack/sharing/consume/default/@jupyterlab/application/@jupyterlab/application\");\n/* harmony import */ var _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_htmlviewer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/htmlviewer */ \"webpack/sharing/consume/default/@jupyterlab/htmlviewer/@jupyterlab/htmlviewer\");\n/* harmony import */ var _jupyterlab_htmlviewer__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_htmlviewer__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/settingregistry */ \"webpack/sharing/consume/default/@jupyterlab/settingregistry/@jupyterlab/settingregistry\");\n/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_5__ = __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_5___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_5__);\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module htmlviewer-extension\n */\n\n\n\n\n\n\nconst HTML_VIEWER_PLUGIN_ID = '@jupyterlab/htmlviewer-extension:plugin';\n/**\n * Factory name\n */\nconst FACTORY = 'HTML Viewer';\n/**\n * Command IDs used by the plugin.\n */\nvar CommandIDs;\n(function (CommandIDs) {\n    CommandIDs.trustHTML = 'htmlviewer:trust-html';\n})(CommandIDs || (CommandIDs = {}));\n/**\n * The HTML file handler extension.\n */\nconst htmlPlugin = {\n    activate: activateHTMLViewer,\n    id: HTML_VIEWER_PLUGIN_ID,\n    description: 'Adds HTML file viewer and provides its tracker.',\n    provides: _jupyterlab_htmlviewer__WEBPACK_IMPORTED_MODULE_2__.IHTMLViewerTracker,\n    requires: [_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.ITranslator],\n    optional: [\n        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ICommandPalette,\n        _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ILayoutRestorer,\n        _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__.ISettingRegistry,\n        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.IToolbarWidgetRegistry\n    ],\n    autoStart: true\n};\n/**\n * Activate the HTMLViewer extension.\n */\nfunction activateHTMLViewer(app, translator, palette, restorer, settingRegistry, toolbarRegistry) {\n    let toolbarFactory;\n    const trans = translator.load('jupyterlab');\n    if (toolbarRegistry) {\n        toolbarRegistry.addFactory(FACTORY, 'refresh', widget => _jupyterlab_htmlviewer__WEBPACK_IMPORTED_MODULE_2__.ToolbarItems.createRefreshButton(widget, translator));\n        toolbarRegistry.addFactory(FACTORY, 'trust', widget => _jupyterlab_htmlviewer__WEBPACK_IMPORTED_MODULE_2__.ToolbarItems.createTrustButton(widget, translator));\n        if (settingRegistry) {\n            toolbarFactory = (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.createToolbarFactory)(toolbarRegistry, settingRegistry, FACTORY, htmlPlugin.id, translator);\n        }\n    }\n    // Add an HTML file type to the docregistry.\n    const ft = {\n        name: 'html',\n        contentType: 'file',\n        fileFormat: 'text',\n        displayName: trans.__('HTML File'),\n        extensions: ['.html'],\n        mimeTypes: ['text/html'],\n        icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_5__.html5Icon\n    };\n    app.docRegistry.addFileType(ft);\n    // Create a new viewer factory.\n    const factory = new _jupyterlab_htmlviewer__WEBPACK_IMPORTED_MODULE_2__.HTMLViewerFactory({\n        name: FACTORY,\n        label: trans.__('HTML Viewer'),\n        fileTypes: ['html'],\n        defaultFor: ['html'],\n        readOnly: true,\n        toolbarFactory,\n        translator\n    });\n    // Create a widget tracker for HTML documents.\n    const tracker = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.WidgetTracker({\n        namespace: 'htmlviewer'\n    });\n    // Handle state restoration.\n    if (restorer) {\n        void restorer.restore(tracker, {\n            command: 'docmanager:open',\n            args: widget => ({ path: widget.context.path, factory: 'HTML Viewer' }),\n            name: widget => widget.context.path\n        });\n    }\n    let trustByDefault = false;\n    if (settingRegistry) {\n        const loadSettings = settingRegistry.load(HTML_VIEWER_PLUGIN_ID);\n        const updateSettings = (settings) => {\n            trustByDefault = settings.get('trustByDefault').composite;\n        };\n        Promise.all([loadSettings, app.restored])\n            .then(([settings]) => {\n            updateSettings(settings);\n            settings.changed.connect(settings => {\n                updateSettings(settings);\n            });\n        })\n            .catch((reason) => {\n            console.error(reason.message);\n        });\n    }\n    app.docRegistry.addWidgetFactory(factory);\n    factory.widgetCreated.connect((sender, widget) => {\n        var _a, _b;\n        // Track the widget.\n        void tracker.add(widget);\n        // Notify the widget tracker if restore data needs to update.\n        widget.context.pathChanged.connect(() => {\n            void tracker.save(widget);\n        });\n        // Notify the application when the trust state changes so it\n        // can update any renderings of the trust command.\n        widget.trustedChanged.connect(() => {\n            app.commands.notifyCommandChanged(CommandIDs.trustHTML);\n        });\n        widget.trusted = trustByDefault;\n        widget.title.icon = ft.icon;\n        widget.title.iconClass = (_a = ft.iconClass) !== null && _a !== void 0 ? _a : '';\n        widget.title.iconLabel = (_b = ft.iconLabel) !== null && _b !== void 0 ? _b : '';\n    });\n    // Add a command to trust the active HTML document,\n    // allowing script executions in its context.\n    app.commands.addCommand(CommandIDs.trustHTML, {\n        label: trans.__('Trust HTML File'),\n        caption: trans.__(`Whether the HTML file is trusted.\n    Trusting the file allows scripts to run in it,\n    which may result in security risks.\n    Only enable for files you trust.`),\n        isEnabled: () => !!tracker.currentWidget,\n        isToggled: () => {\n            const current = tracker.currentWidget;\n            if (!current) {\n                return false;\n            }\n            const sandbox = current.content.sandbox;\n            return sandbox.indexOf('allow-scripts') !== -1;\n        },\n        execute: () => {\n            const current = tracker.currentWidget;\n            if (!current) {\n                return;\n            }\n            current.trusted = !current.trusted;\n        }\n    });\n    tracker.currentChanged.connect(() => {\n        app.commands.notifyCommandChanged(CommandIDs.trustHTML);\n    });\n    if (palette) {\n        palette.addItem({\n            command: CommandIDs.trustHTML,\n            category: trans.__('File Operations')\n        });\n    }\n    return tracker;\n}\n/**\n * Export the plugins as default.\n */\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (htmlPlugin);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/htmlviewer-extension/lib/index.js?");

/***/ })

}]);