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

/***/ "../node_modules/@jupyterlab/translation-extension/lib/index.js":
/*!**********************************************************************!*\
  !*** ../node_modules/@jupyterlab/translation-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_mainmenu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/mainmenu */ \"webpack/sharing/consume/default/@jupyterlab/mainmenu/@jupyterlab/mainmenu\");\n/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_mainmenu__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/* ----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module translation-extension\n */\n\n\n\n\n\n/**\n * Translation plugins\n */\nconst PLUGIN_ID = '@jupyterlab/translation-extension:plugin';\nconst translator = {\n    id: '@jupyterlab/translation:translator',\n    description: 'Provides the application translation object.',\n    autoStart: true,\n    requires: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.JupyterFrontEnd.IPaths, _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__.ISettingRegistry],\n    optional: [_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ILabShell],\n    provides: _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.ITranslator,\n    activate: async (app, paths, settings, labShell) => {\n        const setting = await settings.load(PLUGIN_ID);\n        const currentLocale = setting.get('locale').composite;\n        let stringsPrefix = setting.get('stringsPrefix')\n            .composite;\n        const displayStringsPrefix = setting.get('displayStringsPrefix')\n            .composite;\n        stringsPrefix = displayStringsPrefix ? stringsPrefix : '';\n        const serverSettings = app.serviceManager.serverSettings;\n        const translationManager = new _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.TranslationManager(paths.urls.translations, stringsPrefix, serverSettings);\n        await translationManager.fetch(currentLocale);\n        // Set translator to UI\n        if (labShell) {\n            labShell.translator = translationManager;\n        }\n        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.translator = translationManager;\n        return translationManager;\n    }\n};\n/**\n * Initialization data for the extension.\n */\nconst langMenu = {\n    id: PLUGIN_ID,\n    description: 'Adds translation commands and settings.',\n    requires: [_jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_3__.ISettingRegistry, _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.ITranslator],\n    optional: [_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_2__.IMainMenu, _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ICommandPalette],\n    autoStart: true,\n    activate: (app, settings, translator, mainMenu, palette) => {\n        const trans = translator.load('jupyterlab');\n        const { commands } = app;\n        let currentLocale;\n        /**\n         * Load the settings for this extension\n         *\n         * @param setting Extension settings\n         */\n        function loadSetting(setting) {\n            // Read the settings and convert to the correct type\n            currentLocale = setting.get('locale').composite;\n        }\n        settings\n            .load(PLUGIN_ID)\n            .then(setting => {\n            var _a;\n            // Read the settings\n            loadSetting(setting);\n            // Ensure currentLocale is not 'default' which is not a valid language code\n            if (currentLocale !== 'default') {\n                document.documentElement.lang = (currentLocale !== null && currentLocale !== void 0 ? currentLocale : '').replace('_', '-');\n            }\n            else {\n                document.documentElement.lang = 'en-US';\n            }\n            // Listen for your plugin setting changes using Signal\n            setting.changed.connect(loadSetting);\n            // Create a languages menu\n            const languagesMenu = mainMenu\n                ? (_a = mainMenu.settingsMenu.items.find(item => {\n                    var _a;\n                    return item.type === 'submenu' &&\n                        ((_a = item.submenu) === null || _a === void 0 ? void 0 : _a.id) === 'jp-mainmenu-settings-language';\n                })) === null || _a === void 0 ? void 0 : _a.submenu\n                : null;\n            let command;\n            const serverSettings = app.serviceManager.serverSettings;\n            // Get list of available locales\n            (0,_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_4__.requestTranslationsAPI)('', '', {}, serverSettings)\n                .then(data => {\n                for (const locale in data['data']) {\n                    const value = data['data'][locale];\n                    const displayName = value.displayName;\n                    const nativeName = value.nativeName;\n                    const toggled = displayName === nativeName;\n                    const label = toggled\n                        ? `${displayName}`\n                        : `${displayName} - ${nativeName}`;\n                    // Add a command per language\n                    command = `jupyterlab-translation:${locale}`;\n                    commands.addCommand(command, {\n                        label: label,\n                        caption: label,\n                        isEnabled: () => !toggled,\n                        isVisible: () => true,\n                        isToggled: () => toggled,\n                        execute: () => {\n                            return (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.showDialog)({\n                                title: trans.__('Change interface language?'),\n                                body: trans.__('After changing the interface language to %1, you will need to reload JupyterLab to see the changes.', label),\n                                buttons: [\n                                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.cancelButton({ label: trans.__('Cancel') }),\n                                    _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.okButton({ label: trans.__('Change and reload') })\n                                ]\n                            }).then(result => {\n                                if (result.button.accept) {\n                                    setting\n                                        .set('locale', locale)\n                                        .then(() => {\n                                        window.location.reload();\n                                    })\n                                        .catch(reason => {\n                                        console.error(reason);\n                                    });\n                                }\n                            });\n                        }\n                    });\n                    // Add the language command to the menu\n                    if (languagesMenu) {\n                        languagesMenu.addItem({\n                            command,\n                            args: {}\n                        });\n                    }\n                    if (palette) {\n                        palette.addItem({\n                            category: trans.__('Display Languages'),\n                            command\n                        });\n                    }\n                }\n            })\n                .catch(reason => {\n                console.error(`Available locales errored!\\n${reason}`);\n            });\n        })\n            .catch(reason => {\n            console.error(`The jupyterlab translation extension appears to be missing.\\n${reason}`);\n        });\n    }\n};\n/**\n * Export the plugins as default.\n */\nconst plugins = [translator, langMenu];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plugins);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/translation-extension/lib/index.js?");

/***/ })

}]);