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

/***/ "../node_modules/@jupyterlab/celltags-extension/lib/celltag.js":
/*!*********************************************************************!*\
  !*** ../node_modules/@jupyterlab/celltags-extension/lib/celltag.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 */   CellTagField: () => (/* binding */ CellTagField)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__ = __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_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lumino/algorithm */ \"webpack/sharing/consume/default/@lumino/algorithm/@lumino/algorithm\");\n/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/translation */ \"webpack/sharing/consume/default/@jupyterlab/translation/@jupyterlab/translation\");\n/* harmony import */ var _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__);\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\n\n\n\n\n/**\n * The class name added to the cell-tags field.\n */\nconst CELL_TAGS_WIDGET_CLASS = 'jp-CellTags';\n/**\n * The class name added to each tag element.\n */\nconst CELL_TAGS_ELEMENT_CLASS = 'jp-CellTags-Tag';\n/**\n * The class name added to each applied tag element.\n */\nconst CELL_TAGS_ELEMENT_APPLIED_CLASS = 'jp-CellTags-Applied';\n/**\n * The class name added to each unapplied tag element.\n */\nconst CELL_TAGS_ELEMENT_UNAPPLIED_CLASS = 'jp-CellTags-Unapplied';\n/**\n * The class name added to the tag holder.\n */\nconst CELL_TAGS_HOLDER_CLASS = 'jp-CellTags-Holder';\n/**\n * The class name added to the add-tag input.\n */\nconst CELL_TAGS_ADD_CLASS = 'jp-CellTags-Add';\n/**\n * The class name added to an empty input.\n */\nconst CELL_TAGS_EMPTY_CLASS = 'jp-CellTags-Empty';\nclass CellTagField {\n    constructor(tracker, translator) {\n        this._tracker = tracker;\n        this._translator = translator || _jupyterlab_translation__WEBPACK_IMPORTED_MODULE_3__.nullTranslator;\n        this._trans = this._translator.load('jupyterlab');\n        this._editing = false;\n    }\n    addTag(props, tag) {\n        const data = props.formData;\n        if (tag && !data.includes(tag)) {\n            data.push(tag);\n            props.formContext.updateMetadata({ [props.name]: data }, true);\n        }\n    }\n    /**\n     * Pull from cell metadata all the tags used in the notebook and update the\n     * stored tag list.\n     */\n    pullTags() {\n        var _a, _b;\n        const notebook = (_a = this._tracker) === null || _a === void 0 ? void 0 : _a.currentWidget;\n        const cells = (_b = notebook === null || notebook === void 0 ? void 0 : notebook.model) === null || _b === void 0 ? void 0 : _b.cells;\n        if (cells === undefined) {\n            return [];\n        }\n        const allTags = (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_2__.reduce)(cells, (allTags, cell) => {\n            var _a;\n            const tags = (_a = cell.getMetadata('tags')) !== null && _a !== void 0 ? _a : [];\n            return [...allTags, ...tags];\n        }, []);\n        return [...new Set(allTags)].filter(tag => tag !== '');\n    }\n    _emptyAddTag(target) {\n        target.value = '';\n        target.style.width = '';\n        target.classList.add(CELL_TAGS_EMPTY_CLASS);\n    }\n    _onAddTagKeyDown(props, event) {\n        const input = event.target;\n        if (event.ctrlKey)\n            return;\n        if (event.key === 'Enter') {\n            this.addTag(props, input.value);\n        }\n        else if (event.key === 'Escape') {\n            this._emptyAddTag(input);\n        }\n    }\n    _onAddTagFocus(event) {\n        if (!this._editing) {\n            event.target.blur();\n        }\n    }\n    _onAddTagBlur(input) {\n        if (this._editing) {\n            this._editing = false;\n            this._emptyAddTag(input);\n        }\n    }\n    _onChange(event) {\n        if (!event.target.value) {\n            this._emptyAddTag(event.target);\n        }\n        else {\n            event.target.classList.remove(CELL_TAGS_EMPTY_CLASS);\n            const tmp = document.createElement('span');\n            tmp.className = CELL_TAGS_ADD_CLASS;\n            tmp.textContent = event.target.value;\n            // set width to the pixel length of the text\n            document.body.appendChild(tmp);\n            event.target.style.setProperty('width', `calc(${tmp.getBoundingClientRect().width}px + var(--jp-add-tag-extra-width))`);\n            document.body.removeChild(tmp);\n        }\n    }\n    _onAddTagClick(props, event) {\n        const elem = event.target.closest('div');\n        const input = elem === null || elem === void 0 ? void 0 : elem.childNodes[0];\n        if (!this._editing) {\n            this._editing = true;\n            input.value = '';\n            input.focus();\n        }\n        else if (event.target !== input) {\n            this.addTag(props, input.value);\n        }\n        event.preventDefault();\n    }\n    _onTagClick(props, tag) {\n        const data = props.formData;\n        if (data.includes(tag)) {\n            data.splice(data.indexOf(tag), 1);\n        }\n        else {\n            data.push(tag);\n        }\n        props.formContext.updateMetadata({ [props.name]: data }, true);\n    }\n    render(props) {\n        const allTags = this.pullTags();\n        return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: CELL_TAGS_WIDGET_CLASS },\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: \"jp-FormGroup-fieldLabel jp-FormGroup-contentItem\" }, \"Cell Tags\"),\n            allTags &&\n                allTags.map((tag, i) => (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { key: i, className: `${CELL_TAGS_ELEMENT_CLASS} ${props.formData.includes(tag)\n                        ? CELL_TAGS_ELEMENT_APPLIED_CLASS\n                        : CELL_TAGS_ELEMENT_UNAPPLIED_CLASS}`, onClick: () => this._onTagClick(props, tag) },\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: CELL_TAGS_HOLDER_CLASS },\n                        react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", null, tag),\n                        props.formData.includes(tag) && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.LabIcon.resolveReact, { icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.checkIcon, tag: \"span\", elementPosition: \"center\", height: \"18px\", width: \"18px\", marginLeft: \"5px\", marginRight: \"-3px\" })))))),\n            react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: `${CELL_TAGS_ELEMENT_CLASS} ${CELL_TAGS_ELEMENT_UNAPPLIED_CLASS}` },\n                react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", { className: CELL_TAGS_HOLDER_CLASS, onMouseDown: (e) => this._onAddTagClick(props, e) },\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"input\", { className: `${CELL_TAGS_ADD_CLASS} ${CELL_TAGS_EMPTY_CLASS}`, type: \"text\", placeholder: this._trans.__('Add Tag'), onKeyDown: (e) => this._onAddTagKeyDown(props, e), onFocus: (e) => this._onAddTagFocus(e), onBlur: (e) => this._onAddTagBlur(e.target), onChange: (e) => {\n                            this._onChange(e);\n                        } }),\n                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.LabIcon.resolveReact, { icon: _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.addIcon, tag: \"span\", height: \"18px\", width: \"18px\", className: CELL_TAGS_HOLDER_CLASS })))));\n    }\n}\n//# sourceMappingURL=celltag.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/celltags-extension/lib/celltag.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/celltags-extension/lib/index.js":
/*!*******************************************************************!*\
  !*** ../node_modules/@jupyterlab/celltags-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_notebook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/notebook */ \"webpack/sharing/consume/default/@jupyterlab/notebook/@jupyterlab/notebook\");\n/* harmony import */ var _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _celltag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./celltag */ \"../node_modules/@jupyterlab/celltags-extension/lib/celltag.js\");\n/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__ = __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_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module celltags-extension\n */\n\n\n\n/**\n * Registering cell tag field.\n */\nconst customCellTag = {\n    id: '@jupyterlab/celltags-extension:plugin',\n    description: 'Adds the cell tags editor.',\n    autoStart: true,\n    requires: [_jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_0__.INotebookTracker],\n    optional: [_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_1__.IFormRendererRegistry],\n    activate: (app, tracker, formRegistry) => {\n        // Register the custom field\n        if (formRegistry) {\n            const component = {\n                fieldRenderer: (props) => {\n                    return new _celltag__WEBPACK_IMPORTED_MODULE_2__.CellTagField(tracker).render(props);\n                }\n            };\n            formRegistry.addRenderer('@jupyterlab/celltags-extension:plugin.renderer', component);\n        }\n    }\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ([customCellTag]);\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/celltags-extension/lib/index.js?");

/***/ })

}]);