(self["webpackChunk_molinsp_eigendata"] = self["webpackChunk_molinsp_eigendata"] || []).push([["lib_index_js"],{

/***/ "./lib/assets/svgs.js":
/*!****************************!*\
  !*** ./lib/assets/svgs.js ***!
  \****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "thumbUp": () => (/* binding */ thumbUp),
/* harmony export */   "thumbDown": () => (/* binding */ thumbDown),
/* harmony export */   "magnifier": () => (/* binding */ magnifier),
/* harmony export */   "tableIcon": () => (/* binding */ tableIcon),
/* harmony export */   "binIcon": () => (/* binding */ binIcon),
/* harmony export */   "noDataMagnifier": () => (/* binding */ noDataMagnifier),
/* harmony export */   "reloadIcon": () => (/* binding */ reloadIcon)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

const thumbUp = (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", { className: "BinaryFeedback__icon", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 155.123 155.123" },
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { d: "M150.669 84.068c7.858-7.823 5.43-23.647-8.181-23.647l-35.813.024c1.36-7.584 3.33-20.156 3.252-21.343-.752-11.242-7.918-24.924-8.228-25.484-1.307-2.434-7.906-5.734-14.547-4.32-8.586 1.838-9.463 7.315-9.428 8.825 0 0 .37 14.983.406 18.981-4.105 9.016-18.259 32.71-22.549 34.536a6.542 6.542 0 0 0-3.401-.955H6.934A6.927 6.927 0 0 0 0 77.618l.006 62.533c.269 3.371 3.133 6.015 6.516 6.015h40.64a6.54 6.54 0 0 0 6.534-6.534v-2.076s1.51-.113 2.196.328c2.613 1.659 5.842 3.747 10.054 3.747h60.647c22.674 0 20.24-20.126 18.169-22.871 3.831-4.171 6.2-11.528 2.966-17.34 2.482-2.631 6.85-9.863 2.941-17.352zM45.766 139.62H6.51V77.212h39.256v62.408zm94.324-56.089l-.37 1.545c10.448 2.971 4.887 15.013-2.608 15.794l-.37 1.545c10.018 2.548 5.239 14.947-2.608 15.794l-.37 1.539c8.181 1.343 6.2 15.305-6.194 15.305l-61.686.024c-4.356 0-8.324-4.964-11.528-4.964H51.56V82.075c3.485-2.16 7.769-4.964 10.15-6.987 4.499-3.837 22.913-33.593 22.913-37.317s-.406-19.834-.406-19.834 3.61-4.654 11.671-1.259c0 0 6.784 12.721 7.476 22.859 0 0-3.055 20.884-4.696 27.436h42.765c10.507.012 8.502 15.013-1.343 16.558z", fill: "#010002" })));
const thumbDown = (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", { className: "BinaryFeedback__icon", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 155.129 155.129" },
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { d: "M4.454 71.061c-7.858 7.829-5.43 23.653 8.181 23.653l35.813-.024c-1.36 7.584-3.33 20.156-3.252 21.338.752 11.248 7.924 24.93 8.228 25.485 1.307 2.434 7.906 5.734 14.553 4.32 8.586-1.838 9.463-7.315 9.428-8.825 0 0-.376-14.983-.406-18.981 4.099-9.022 18.253-32.71 22.555-34.536a6.515 6.515 0 0 0 3.395.949h45.247a6.928 6.928 0 0 0 6.934-6.934l-.006-62.533c-.269-3.371-3.127-6.015-6.516-6.015h-40.634c-3.604 0-6.54 2.93-6.54 6.534v2.076s-1.51.107-2.196-.328c-2.608-1.659-5.842-3.747-10.054-3.747H28.542c-22.674 0-20.234 20.126-18.169 22.871-3.831 4.171-6.2 11.528-2.966 17.34C4.913 56.34.545 63.572 4.454 71.061zm104.903-55.552h39.256v62.407h-39.256V15.509zm-94.33 56.089l.37-1.545c-10.448-2.971-4.887-15.007 2.602-15.794l.37-1.545C8.35 50.165 13.13 37.766 20.976 36.918l.364-1.539c-8.181-1.343-6.2-15.305 6.194-15.305l61.685-.024c4.356 0 8.324 4.964 11.534 4.964h2.793v48.033c-3.485 2.166-7.763 4.964-10.15 6.993-4.499 3.837-22.913 33.593-22.913 37.317 0 3.723.412 19.834.412 19.834s-3.616 4.648-11.671 1.259c0 0-6.784-12.727-7.476-22.859 0 0 3.049-20.884 4.696-27.442H13.678c-10.495-.005-8.49-15.012 1.349-16.551z", fill: "#010002" })));
const magnifier = (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", { className: "svg-magnifier", viewBox: "0 0 20 20" },
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { fill: "#666DFF", d: "M19.129,18.164l-4.518-4.52c1.152-1.373,1.852-3.143,1.852-5.077c0-4.361-3.535-7.896-7.896-7.896\n\t\t\t\t\t\t\t\tc-4.361,0-7.896,3.535-7.896,7.896s3.535,7.896,7.896,7.896c1.934,0,3.705-0.698,5.078-1.853l4.52,4.519\n\t\t\t\t\t\t\t\tc0.266,0.268,0.699,0.268,0.965,0C19.396,18.863,19.396,18.431,19.129,18.164z M8.567,15.028c-3.568,0-6.461-2.893-6.461-6.461\n\t\t\t\t\t\t\t\ts2.893-6.461,6.461-6.461c3.568,0,6.46,2.893,6.46,6.461S12.135,15.028,8.567,15.028z" })));
const tableIcon = (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16pt", height: "16pt", viewBox: "0 0 16 16" },
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { fill: "#2684ff", d: "M 15.402344 0.855469 L 0.597656 0.855469 C 0.269531 0.855469 0 1.121094 0 1.453125 L 0 14.546875 C 0 14.75 0.101562 14.929688 0.257812 15.035156 L 0.257812 15.128906 L 0.46875 15.128906 C 0.511719 15.140625 0.554688 15.144531 0.597656 15.144531 L 15.402344 15.144531 C 15.445312 15.144531 15.488281 15.140625 15.527344 15.128906 L 15.558594 15.128906 L 15.558594 15.121094 C 15.8125 15.050781 16 14.824219 16 14.546875 L 16 1.453125 C 16 1.121094 15.730469 0.855469 15.402344 0.855469 Z M 2.363281 14.617188 L 0.554688 14.617188 C 0.527344 14.601562 0.511719 14.578125 0.511719 14.546875 L 0.511719 12.996094 L 2.363281 12.996094 Z M 2.363281 12.484375 L 0.511719 12.484375 L 0.511719 10.800781 L 2.363281 10.800781 Z M 2.363281 10.289062 L 0.511719 10.289062 L 0.511719 8.511719 L 2.363281 8.511719 Z M 2.363281 8 L 0.511719 8 L 0.511719 6.078125 L 2.363281 6.078125 Z M 2.363281 5.566406 L 0.511719 5.566406 L 0.511719 3.6875 L 2.363281 3.6875 Z M 6.675781 14.617188 L 2.875 14.617188 L 2.875 12.996094 L 6.675781 12.996094 Z M 6.675781 12.484375 L 2.875 12.484375 L 2.875 10.800781 L 6.675781 10.800781 Z M 6.675781 10.289062 L 2.875 10.289062 L 2.875 8.511719 L 6.675781 8.511719 Z M 6.675781 8 L 2.875 8 L 2.875 6.078125 L 6.675781 6.078125 Z M 6.675781 5.566406 L 2.875 5.566406 L 2.875 3.6875 L 6.675781 3.6875 Z M 6.675781 3.175781 L 2.875 3.175781 L 2.875 1.367188 L 6.675781 1.367188 Z M 11.03125 14.617188 L 7.1875 14.617188 L 7.1875 12.996094 L 11.03125 12.996094 Z M 11.03125 12.484375 L 7.1875 12.484375 L 7.1875 10.800781 L 11.03125 10.800781 Z M 11.03125 10.289062 L 7.1875 10.289062 L 7.1875 8.511719 L 11.03125 8.511719 Z M 11.03125 8 L 7.1875 8 L 7.1875 6.078125 L 11.03125 6.078125 Z M 11.03125 5.566406 L 7.1875 5.566406 L 7.1875 3.6875 L 11.03125 3.6875 Z M 11.03125 3.175781 L 7.1875 3.175781 L 7.1875 1.367188 L 11.03125 1.367188 Z M 15.488281 14.546875 C 15.488281 14.578125 15.46875 14.601562 15.445312 14.617188 L 11.542969 14.617188 L 11.542969 12.996094 L 15.488281 12.996094 Z M 15.488281 12.484375 L 11.542969 12.484375 L 11.542969 10.800781 L 15.488281 10.800781 Z M 15.488281 10.289062 L 11.542969 10.289062 L 11.542969 8.511719 L 15.488281 8.511719 Z M 15.488281 8 L 11.542969 8 L 11.542969 6.078125 L 15.488281 6.078125 Z M 15.488281 5.566406 L 11.542969 5.566406 L 11.542969 3.6875 L 15.488281 3.6875 Z M 15.488281 3.175781 L 11.542969 3.175781 L 11.542969 1.367188 L 15.402344 1.367188 C 15.449219 1.367188 15.488281 1.40625 15.488281 1.453125 Z M 15.488281 3.175781 " })));
const binIcon = (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", { className: "svg-bin", xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24" },
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { d: "M3 6v18h18v-18h-18zm5 14c0 .552-.448 1-1 1s-1-.448-1-1v-10c0-.552.448-1 1-1s1 .448 1 1v10zm5 0c0 .552-.448 1-1 1s-1-.448-1-1v-10c0-.552.448-1 1-1s1 .448 1 1v10zm5 0c0 .552-.448 1-1 1s-1-.448-1-1v-10c0-.552.448-1 1-1s1 .448 1 1v10zm4-18v2h-20v-2h5.711c.9 0 1.631-1.099 1.631-2h5.315c0 .901.73 2 1.631 2h5.712z" })));
const noDataMagnifier = (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "359", height: "366", viewBox: "0 0 359 366", fill: "none" },
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("circle", { cx: "165.601", cy: "180.601", r: "145.601", fill: "#F1F1F1" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("circle", { cx: "164.41", cy: "180.849", r: "86.0656", fill: "#F1F1F1", stroke: "#C4C4C4", strokeWidth: "2" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("circle", { cx: "164.41", cy: "180.849", r: "61.1897", fill: "#FFFEFF", stroke: "#C4C4C4", strokeWidth: "2" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { d: "M164.41 135.128C164.41 134.215 163.669 133.472 162.756 133.504C151.33 133.902 140.411 138.423 132.037 146.261C123.662 154.099 118.43 164.695 117.277 176.07C117.185 176.979 117.877 177.767 118.789 177.828C119.7 177.888 120.484 177.197 120.579 176.289C121.675 165.752 126.535 155.94 134.297 148.676C142.058 141.411 152.17 137.21 162.756 136.813C163.669 136.779 164.41 136.042 164.41 135.128Z", fill: "#C4C4C4" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { x: "232.151", y: "273.177", width: "26.3429", height: "83.1432", rx: "13", transform: "rotate(-45 232.151 273.177)", fill: "#F1F1F1", stroke: "#C4C4C4", strokeWidth: "2" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { x: "260.672", y: "280.014", width: "3.9524", height: "33.1397", rx: "1.9762", transform: "rotate(-45 260.672 280.014)", fill: "white" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { x: "227.812", y: "253.08", width: "4.05716", height: "16.2286", transform: "rotate(-45 227.812 253.08)", fill: "#C4C4C4" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { x: "270.859", y: "170.633", width: "40.5716", height: "4.05716", rx: "2", fill: "#C4C4C4" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { x: "20", y: "204.195", width: "40.5716", height: "4.05716", rx: "2", fill: "#C4C4C4" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { x: "319.545", y: "170.633", width: "20.2858", height: "4.05716", rx: "2", fill: "#C4C4C4" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { x: "281.002", y: "185.519", width: "20.2858", height: "4.05716", rx: "2", fill: "#C4C4C4" }),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { x: "30.1429", y: "219.081", width: "20.2858", height: "4.05716", rx: "2", fill: "#C4C4C4" })));
const reloadIcon = (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" },
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", { clipPath: "url(#clip0)" },
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { d: "M17.25 3V7.5H12.75", stroke: "#109CF1", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", { d: "M15.3675 11.25C14.88 12.6299 13.9572 13.8141 12.7382 14.6239C11.5191 15.4337 10.0699 15.8254 8.60885 15.74C7.14782 15.6545 5.75415 15.0965 4.63785 14.15C3.52155 13.2036 2.7431 11.9199 2.41981 10.4926C2.09651 9.06518 2.24589 7.5714 2.84543 6.23631C3.44497 4.90122 4.46219 3.79716 5.7438 3.09049C7.02541 2.38382 8.50198 2.11284 9.951 2.31837C11.4 2.5239 12.743 3.19481 13.7775 4.23001L17.25 7.50001", stroke: "#109CF1", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })),
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("defs", null,
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("clipPath", { id: "clip0" },
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("rect", { width: "18", height: "18", fill: "white" })))));


/***/ }),

/***/ "./lib/components/customSelect.js":
/*!****************************************!*\
  !*** ./lib/components/customSelect.js ***!
  \****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-select */ "webpack/sharing/consume/default/react-select/react-select");
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_select__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/*-----------------------------------
 CUSTOM SELECT: Use React select with JSONSchema form
 -----------------------------------*/
// Inspired by example here https://codesandbox.io/s/13vo8wj13?file=/src/formGenerationEngine/Form.js
// To-do: Move custom components to separate files


const CustomSelect = (props) => {
    const processSingleSelect = (selection) => {
        const { value } = selection;
        return value;
    };
    // Return the value corresponding to the lable that the user has selected
    const processMultiSelect = (selection) => {
        // Handle the case when the user removes selections
        if (selection === null) {
            return [];
        }
        return selection.map(item => item.value);
    };
    // If defined as array, use the multi-select
    if (props.schema.type === 'array') {
        return (react__WEBPACK_IMPORTED_MODULE_1___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_0___default()), { options: props.options.enumOptions, onChange: (selection) => props.onChange(processMultiSelect(selection)), isMulti: true }));
    }
    else {
        return (react__WEBPACK_IMPORTED_MODULE_1___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_0___default()), { value: props.options.enumOptions.filter((option) => option.value === props.value), options: props.options.enumOptions, onChange: (selection) => props.onChange(processSingleSelect(selection)) }));
    }
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CustomSelect);


/***/ }),

/***/ "./lib/components/feedbackContent.js":
/*!*******************************************!*\
  !*** ./lib/components/feedbackContent.js ***!
  \*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "FeedbackContent": () => (/* binding */ FeedbackContent)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
// [COMPONENT] Element with thumb and text
//   -> Description: return JSX.Element with svg "thumb" and text
//   -> Used in: Formulabar

const FeedbackContent = (thumb, text, textColor) => {
    return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "feedback__content" },
        thumb,
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", { className: "full-width  feedback__buttons-text", style: { color: textColor } }, text)));
};


/***/ }),

/***/ "./lib/components/formWidget.js":
/*!**************************************!*\
  !*** ./lib/components/formWidget.js ***!
  \**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "FormWidget": () => (/* binding */ FormWidget)
/* harmony export */ });
/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/apputils */ "webpack/sharing/consume/default/@jupyterlab/apputils");
/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _formulabar_formulabar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../formulabar/formulabar */ "./lib/formulabar/formulabar.js");
// [COMPONENT] Wrapper for rendering React in jupyter
//   -> Class that acts as a wrapper for rendering React in jupyter (based on the react jupyterlab extension example)
//   -> Used in: Formulabar



const UseSignalComponent = (props) => {
    return (react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.UseSignal, { signal: props.signal }, () => react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_formulabar_formulabar__WEBPACK_IMPORTED_MODULE_2__.FormComponent, { logic: props.logic })));
};
class FormWidget extends _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_0__.ReactWidget {
    // -------------------------------------------------------------------------------------------------------------
    // CONSTRUCTOR
    // -------------------------------------------------------------------------------------------------------------
    constructor(backend) {
        super();
        this._backend = null;
        console.log('------> Constructor');
        this.addClass('jp-ReactWidget');
        this._backend = backend;
    }
    // -------------------------------------------------------------------------------------------------------------
    // RENDER
    // -------------------------------------------------------------------------------------------------------------
    render() {
        return (react__WEBPACK_IMPORTED_MODULE_1___default().createElement(UseSignalComponent, { signal: this._backend.signal, logic: this._backend }));
    }
}


/***/ }),

/***/ "./lib/components/noDataLoadedComponent.js":
/*!*************************************************!*\
  !*** ./lib/components/noDataLoadedComponent.js ***!
  \*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "EmptyStateComponent": () => (/* binding */ EmptyStateComponent)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _assets_svgs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assets/svgs */ "./lib/assets/svgs.js");
/* harmony import */ var _reloadButton__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./reloadButton */ "./lib/components/reloadButton.js");
// [COMPONENT] Empty state component
//   -> Description: is shown if there are no dataframes loaded
//   -> Used in: Datavizualizer



const EmptyStateComponent = ({ onLinkClick, onReloadButtonClick }) => {
    return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "empty-state__container" },
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", { className: "empty-state__title" }, "No data loaded"),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, _assets_svgs__WEBPACK_IMPORTED_MODULE_1__.noDataMagnifier),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_reloadButton__WEBPACK_IMPORTED_MODULE_2__.ReloadButton, { title: "Reload datavizualizer", onClick: onReloadButtonClick })));
};


/***/ }),

/***/ "./lib/components/paginationPanel.js":
/*!*******************************************!*\
  !*** ./lib/components/paginationPanel.js ***!
  \*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "PaginationPanel": () => (/* binding */ PaginationPanel)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-select */ "webpack/sharing/consume/default/react-select/react-select");
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_select__WEBPACK_IMPORTED_MODULE_1__);
// [COMPONENT] Panel for pagination control
//   -> Description: return JSX.Element with buttons and selects
// that allows to add pagination for table
//   -> Used in: Datavizualizer


const PaginationPanel = (props) => {
    const modifiedSelectedOption = Object.assign({}, props.currentPageConfig.selectedOption);
    modifiedSelectedOption.label =
        props.currentPageConfig.selectedOption.label + ` of ${props.pageSize}`;
    return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "pagination-panel" },
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { className: "pagination-segment", onClick: props.onFirstClick, disabled: props.currentPageConfig.selectedOption.value === 1 }, "First"),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { className: "pagination-segment", onClick: props.onPrevClick, disabled: props.currentPageConfig.selectedOption.value === 1 }, "\u276E"),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { className: "pagination-segment", onClick: props.onNextClick, disabled: props.currentPageConfig.selectedOption.value === props.pageSize }, "\u276F"),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { className: "pagination-segment", onClick: props.onLastClick, disabled: props.currentPageConfig.selectedOption.value === props.pageSize }, "Last"),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_1___default()), { options: props.currentPageConfig.options, value: modifiedSelectedOption, onChange: (value) => props.currentPageConfig.onSelect(value), className: "pagination-page-select", placeholder: "Go to the page...", menuPlacement: "auto", isSearchable: true }),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_1___default()), { options: props.pageSizeSelectionConfig.options, value: props.pageSizeSelectionConfig.selectedOption, onChange: (value) => props.pageSizeSelectionConfig.onSelect(value), className: "pagination-size-select", menuPlacement: "auto" })));
};


/***/ }),

/***/ "./lib/components/querybuilder.js":
/*!****************************************!*\
  !*** ./lib/components/querybuilder.js ***!
  \****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ QueryBuilder)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-awesome-query-builder */ "webpack/sharing/consume/default/react-awesome-query-builder/react-awesome-query-builder");
/* harmony import */ var react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react_awesome_query_builder_lib_css_styles_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-awesome-query-builder/lib/css/styles.css */ "./node_modules/react-awesome-query-builder/lib/css/styles.css");
/* harmony import */ var _querybuilderConfig__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./querybuilderConfig */ "./lib/components/querybuilderConfig.js");
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-select */ "webpack/sharing/consume/default/react-select/react-select");
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_select__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var amplitude_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! amplitude-js */ "webpack/sharing/consume/default/amplitude-js/amplitude-js");
/* harmony import */ var amplitude_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(amplitude_js__WEBPACK_IMPORTED_MODULE_4__);






// You can load query value from your backend storage (for saving see `Query.onChange()`)
// Default empty query value
const queryValue = { id: react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__.Utils.uuid(), type: 'group' };
class QueryBuilder extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
    constructor(props) {
        super(props);
        this.options = [
            { value: 'query', label: 'Filter the dataframe' },
            { value: 'eval', label: 'Create true/false indicators' }
        ];
        this.setQueryType = (input) => {
            //console.log('Dropdown changed', input);
            this.setState(state => (Object.assign(Object.assign({}, state), { queryType: input.value })));
        };
        this.handleChange = (event) => {
            this.setState(Object.assign(Object.assign({}, this.state), { newTableName: event.target.value }));
        };
        this.render = () => (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("form", { id: "query-form" },
            this.state.error && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "panel panel-danger errors" },
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "panel-heading" },
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("h3", { className: "panel-title" }, "Errors")),
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement("ul", { className: "list-group" },
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", { className: "list-group-item text-danger" }, this.state.error.message)))),
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "form-group" },
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement("fieldset", null,
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("legend", null, "Filter/Query dataframe"),
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__.Query, Object.assign({}, this.state.config, { value: this.state.tree, onChange: this.onChange, renderBuilder: this.renderBuilder })),
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "form-group" },
                        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", { htmlFor: "filterDataFrame", className: "control-label" }, "filter type"),
                        react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_3___default()), { id: "filterDataFrame", options: this.options, onChange: this.setQueryType, defaultValue: { value: 'query', label: 'Filter the dataframe' } })),
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "form-group" },
                        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", { htmlFor: "newTableNameTextInput", className: "control-label" }, this.state.queryType === 'query'
                            ? 'new table name'
                            : 'new column name'),
                        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", { id: "newTableNameTextInput", value: this.state.newTableName, type: "text", name: "newTableName", onChange: this.handleChange, className: "form-control", placeholder: "Leave blank to modify selected table" })))),
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { type: "button", onClick: this.generateCode, className: "btn btn-info" }, "Submit")));
        this.renderBuilder = (props) => (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "query-builder-container" },
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "query-builder qb-lite" },
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__.Builder, Object.assign({}, props)))));
        /*----------------------------------------------------------------------------------------------------
          [FUNCTION] Take query input ange generate code in the notebook
          -> Writes: Notebook
          -----------------------------------------------------------------------------------------------------*/
        this.generateCode = async () => {
            let sqlQuery = JSON.stringify(react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__.Utils.sqlFormat(this.state.tree, this.state.config), undefined, 2);
            console.log('Querybuilder: Original SQL query', sqlQuery);
            if (sqlQuery) {
                sqlQuery = sqlQuery
                    .replace(/ IS EMPTY/g, '.isnull()')
                    .replace(/ IS NOT EMPTY/g, '.notnull()')
                    .replace(/AND/g, 'and')
                    .replace(/OR/g, 'or')
                    .replace(/true/g, 'True')
                    .replace(/false/g, 'False')
                    // Handle the case of any in ['a','b'] instead of IN ('a', 'b')  
                    .replace(/NOT IN\s\((.*?)\)/g, 'not in [$1]')
                    // Not and not in in python
                    .replace(/IN\s\((.*?)\)/g, 'in [$1]')
                    .replace(/NOT/g, '~')
                    // Replace comparison to remove spaces (convention)
                    .replace(/ >= /g, '>=')
                    .replace(/ <= /g, '<=')
                    .replace(/ > /g, '>')
                    .replace(/ < /g, '<')
                    // Use python characters for equal to and distinct to
                    .replace(/ <> /g, '!=')
                    .replace(/ = /g, '==');
                const colNames = Object.entries(this.state.config.fields).map(([k, v]) => v.label);
                //console.log('Querybuilder: Config fields type', typeof colNames);
                //console.log('Querybuilder: Config fields', colNames);
                const colNamesSorted = colNames.sort((a, b) => b.length - a.length);
                //console.log('Querybuilder: Config fields sorted', colNamesSorted);
                console.log('Querybuilder: Processed sql query', sqlQuery);
                for (const i of colNamesSorted) {
                    const colName = i;
                    //console.log('Col name', colName);
                    // Check if there is any blank space in the column names
                    if (/\s/.test(colName) && sqlQuery.includes(colName)) {
                        // It has any kind of whitespace
                        // Replace with backticks to ensure pandas does not generate an error;
                        // To avoid replacing columns that are substrings of other columns with backticks
                        // E.g. "col on", "cole one two" -> "`col one` two"
                        // To avoid this, we replace only strins that do not end with space
                        // since by convention we don't use spaces for comparison operators
                        // - Numercial operators. e.g. "col a>5"
                        // - String and null operators, e.g. "col a.isnull"
                        // EXCEPT for the cases of "in [" / "not in ["
                        const colsWithBlanks = "(" + colName + ")(?! (?!in \\[|not in \\[))";
                        const colsAlsoCategories = "'`" + colName + "`'";
                        const reColsWithBlanks = new RegExp(colsWithBlanks, 'g');
                        const reColsAlsoCategories = new RegExp(colsAlsoCategories, 'g');
                        console.log('re', colsWithBlanks);
                        sqlQuery = sqlQuery
                            .replace(reColsWithBlanks, "`" + colName + "`")
                            .replace(reColsAlsoCategories, "'" + colName + "'");
                    }
                }
                let returnType = '';
                if (this.state.queryType.localeCompare('query') === 0) {
                    returnType = 'dataframe';
                }
                else {
                    // eval case
                    returnType = 'series';
                }
                // If no variable defined, use this dataframe selection
                let variable = '';
                if (returnType.localeCompare('dataframe') === 0) {
                    if (this.state.newTableName === '') {
                        variable = this.props.dataframeSelection;
                    }
                    else {
                        variable = this.state.newTableName.replace(/ /g, '_');
                    }
                }
                else if (returnType.localeCompare('series') === 0) {
                    if (this.state.newTableName === '') {
                        variable = this.props.dataframeSelection + '["indicator"]';
                    }
                    else {
                        variable =
                            this.props.dataframeSelection +
                                '["' +
                                this.state.newTableName.replace(/ /g, '_') +
                                '"]';
                    }
                }
                //  Compose formula: variable = dataframe . query/eval (query)
                let formula = variable + ' = ' + this.props.dataframeSelection;
                formula = formula + '.' + this.state.queryType;
                // Add the copy command to make sure pandas knows we are creating a copy
                if (returnType.localeCompare('dataframe') === 0) {
                    formula = formula + '(' + sqlQuery + ', engine="python"' + ').copy()';
                }
                else {
                    formula = formula + '(' + sqlQuery + ', engine="python"' + ')';
                }
                console.log('Querybuilder: Datatable selection', this.props.dataframeSelection);
                console.log('Querybuilder: Formula', formula);
                if (this.state.logic.production && this.state.logic.shareProductData) {
                    amplitude_js__WEBPACK_IMPORTED_MODULE_4___default().getInstance().logEvent('Querybuilder: submit transformation', {
                        function: 'query',
                        generatedCode: formula
                    });
                }
                try {
                    await this.state.logic.writeToNotebookAndExecute(formula, returnType);
                    this.setState(state => (Object.assign(Object.assign({}, state), { error: null })));
                }
                catch (error) {
                    this.setState(state => (Object.assign(Object.assign({}, state), { error: error })));
                }
            }
            else {
                var error = new ErrorEvent('oh nose', {
                    message: 'Invalid query: The submited query is not valid, please check your inputs.',
                });
                this.setState(state => (Object.assign(Object.assign({}, state), { error: error })));
            }
        };
        /*----------------------------------------------------------------------------------------------------
          [FUNCTION] Save changes to state
          -> Writes: State
          -----------------------------------------------------------------------------------------------------*/
        this.onChange = (immutableTree, config) => {
            // Tip: for better performance you can apply `throttle` - see `examples/demo`
            this.setState(state => (Object.assign(Object.assign({}, state), { tree: immutableTree, config: config })));
            // const jsonTree = QbUtils.getTree(immutableTree);
            // console.log('JSON TREE', jsonTree);
            // `jsonTree` can be saved to backend, and later loaded to `queryValue`
        };
        const config = Object.assign(Object.assign({}, _querybuilderConfig__WEBPACK_IMPORTED_MODULE_5__.default), { fields: Object.assign({}, this.props.queryConfig) });
        this.state = {
            tree: react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__.Utils.checkTree(react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__.Utils.loadTree(queryValue), config),
            config: config,
            logic: props.backend,
            queryType: 'query',
            newTableName: '',
            error: null
        };
    }
    componentDidUpdate(prevProps) {
        if (this.props.queryConfig !== prevProps.queryConfig) {
            const config = Object.assign(Object.assign({}, _querybuilderConfig__WEBPACK_IMPORTED_MODULE_5__.default), { fields: Object.assign({}, this.props.queryConfig) });
            this.setState(state => (Object.assign(Object.assign({}, this.state), { tree: react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__.Utils.checkTree(react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_1__.Utils.loadTree(queryValue), config), config: config })));
        }
    }
}


/***/ }),

/***/ "./lib/components/querybuilderConfig.js":
/*!**********************************************!*\
  !*** ./lib/components/querybuilderConfig.js ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-awesome-query-builder */ "webpack/sharing/consume/default/react-awesome-query-builder/react-awesome-query-builder");
/* harmony import */ var react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _querybuilderCustomSelect__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./querybuilderCustomSelect */ "./lib/components/querybuilderCustomSelect.js");
/* harmony import */ var _querybuilderCustomMultiselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./querybuilderCustomMultiselect */ "./lib/components/querybuilderCustomMultiselect.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/*eslint @typescript-eslint/no-unused-vars: ["off", {"varsIgnorePattern": "^_"}]*/




const InitialConfig = react_awesome_query_builder__WEBPACK_IMPORTED_MODULE_0__.BasicConfig; // or BasicConfig or MaterialConfig
//////////////////////////////////////////////////////////////////////
const types = Object.assign(Object.assign({}, InitialConfig.types), { 
    // examples of  overriding
    number: {
        defaultOperator: 'equal',
        //mainWidget: "number",
        valueSources: ['value'],
        widgets: {
            number: {
                operators: [
                    'equal',
                    'not_equal',
                    'less',
                    'less_or_equal',
                    'greater',
                    'greater_or_equal',
                    //"between",
                    //"not_between",
                    'is_empty',
                    'is_not_empty'
                ]
            },
            slider: {
                operators: [
                    'equal',
                    'not_equal',
                    'less',
                    'less_or_equal',
                    'greater',
                    'greater_or_equal',
                    'is_empty',
                    'is_not_empty'
                ]
            }
        }
    }, date: {
        defaultOperator: 'equal',
        //mainWidget: "number",
        valueSources: ['value'],
        widgets: {
            date: {
                operators: [
                    'equal',
                    'not_equal',
                    'less',
                    'less_or_equal',
                    'greater',
                    'greater_or_equal',
                    //"between",
                    //"not_between",
                    'is_empty',
                    'is_not_empty'
                ]
            }
        }
    }, time: {
        defaultOperator: 'equal',
        //mainWidget: "number",
        valueSources: ['value'],
        widgets: {
            time: {
                operators: [
                    'equal',
                    'not_equal',
                    'less',
                    'less_or_equal',
                    'greater',
                    'greater_or_equal'
                    //"between",
                    //"not_between",
                    //"is_empty",
                    //"is_not_empty",
                ]
            }
        }
    }, datetime: {
        defaultOperator: 'equal',
        //mainWidget: "number",
        valueSources: ['value'],
        widgets: {
            datetime: {
                operators: [
                    'equal',
                    'not_equal',
                    'less',
                    'less_or_equal',
                    'greater',
                    'greater_or_equal'
                    //"between",
                    //"not_between",
                    //"is_empty",
                    //"is_not_empty",
                ]
            }
        }
    }, text: {
        defaultOperator: 'equal',
        valueSources: ['value'],
        widgets: {
            text: {
                operators: [
                    'equal',
                    'not_equal',
                    'is_empty',
                    'is_not_empty',
                    //"like",
                    //"not_like",
                    //"starts_with",
                    //"ends_with",
                    //"proximity",
                    'python_contains'
                ],
                widgetProps: {},
                opProps: {}
            },
            field: {
                operators: [
                    //unary ops (like `is_empty`) will be excluded anyway, see getWidgetsForFieldOp()
                    'equal',
                    'not_equal'
                    //"proximity",
                ]
            }
        }
    }, select: {
        defaultOperator: 'select_any_in',
        valueSources: ['value'],
        widgets: {
            multiselect: {
                operators: [
                    'select_any_in',
                    'select_not_any_in',
                    'is_empty',
                    'is_not_empty'
                ]
            }
        }
    }, boolean: {
        defaultOperator: 'equal',
        valueSources: ['value'],
        widgets: {
            boolean: {
                operators: ['equal', 'not_equal', 'is_empty', 'is_not_empty'],
                widgetProps: {
                //you can enable this if you don't use fields as value sources
                // hideOperator: true,
                // operatorInlineLabel: "is",
                }
            },
            field: {
                operators: ['equal', 'not_equal']
            }
        }
    } });
const widgets = Object.assign(Object.assign({}, InitialConfig.widgets), { multiselect: Object.assign(Object.assign({}, InitialConfig.widgets.multiselect), { type: 'multiselect', factory: (props) => (react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_querybuilderCustomMultiselect__WEBPACK_IMPORTED_MODULE_2__.QuerybuilderCustomMultiselect, Object.assign({}, props))), sqlFormatValue: (val) => {
            return val.map(value => `'${value}'`);
        } }) });
const operators = Object.assign(Object.assign({}, InitialConfig.operators), { 
    // examples of  overriding
    python_contains: {
        label: 'Contains',
        labelForFormat: 'Like',
        reversedOp: 'not_like',
        sqlFormatOp: (field, op, values, valueSrc, valueType, opDef, operatorOptions) => {
            if (valueSrc === 'value') {
                return `${field}.str.contains(${values})`;
            }
            else {
                return undefined;
            } // not supported
        },
        valueSources: ['value']
    } });
const settings = Object.assign(Object.assign({}, InitialConfig.settings), { renderOperator: props => {
        return react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_querybuilderCustomSelect__WEBPACK_IMPORTED_MODULE_3__.QuerybuilderCustomSelect, Object.assign({}, props, { operatorField: true }));
    }, renderField: props => {
        return react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_querybuilderCustomSelect__WEBPACK_IMPORTED_MODULE_3__.QuerybuilderCustomSelect, Object.assign({}, props));
    } });
const customConfig = Object.assign(Object.assign({}, InitialConfig), { types,
    operators,
    settings,
    widgets });
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (customConfig);


/***/ }),

/***/ "./lib/components/querybuilderCustomMultiselect.js":
/*!*********************************************************!*\
  !*** ./lib/components/querybuilderCustomMultiselect.js ***!
  \*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "QuerybuilderCustomMultiselect": () => (/* binding */ QuerybuilderCustomMultiselect)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-select */ "webpack/sharing/consume/default/react-select/react-select");
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_select__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _styles_reactSelectStyles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../styles/reactSelectStyles */ "./lib/styles/reactSelectStyles.js");
// [COMPONENT] Custom select
//   -> Custom widget for query builder multi selects
//   -> Used in: Querybuilder



const QuerybuilderCustomMultiselect = (props) => {
    const [options, setOptions] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);
    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
        // React select requires 'value' field for options
        const modifiedOptions = props.listValues.map(listValue => {
            return { label: listValue.title, value: listValue.value };
        });
        setOptions(modifiedOptions);
    }, []);
    return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_1___default()), { onChange: (selection) => {
            if (selection) {
                props.setValue(selection.map(item => item.value));
            }
            // Handle the case wehre there is only one selection and it is cleared by the user
            else {
                props.setValue(null);
            }
        }, isMulti: true, options: options, menuPortalTarget: document.body, styles: _styles_reactSelectStyles__WEBPACK_IMPORTED_MODULE_2__.querySelectStyles }));
};


/***/ }),

/***/ "./lib/components/querybuilderCustomSelect.js":
/*!****************************************************!*\
  !*** ./lib/components/querybuilderCustomSelect.js ***!
  \****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "QuerybuilderCustomSelect": () => (/* binding */ QuerybuilderCustomSelect)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-select */ "webpack/sharing/consume/default/react-select/react-select");
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_select__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _styles_reactSelectStyles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../styles/reactSelectStyles */ "./lib/styles/reactSelectStyles.js");
// [COMPONENT] Custom select
//   -> Custom widget for query builder selects
//   -> Used in: Querybuilder



const QuerybuilderCustomSelect = (props) => {
    const [options, setOptions] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);
    const [selectedOption, setSelectedOption] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();
    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
        // React select requires 'value' field for options
        const modifiedOptions = props.items.map(item => {
            return { value: item.key, label: item.label };
        });
        if (props.operatorField) {
            const defaultOperator = {
                value: props.selectedKey,
                label: props.selectedLabel
            };
            setSelectedOption(defaultOperator);
        }
        console.log(props);
        setOptions(modifiedOptions);
    }, []);
    return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_1___default()), { value: selectedOption, onChange: (selection) => {
            props.setField(selection.value);
            setSelectedOption(selection);
        }, options: options, menuPortalTarget: document.body, styles: _styles_reactSelectStyles__WEBPACK_IMPORTED_MODULE_2__.querySelectStyles }));
};


/***/ }),

/***/ "./lib/components/radioButtonGroup.js":
/*!********************************************!*\
  !*** ./lib/components/radioButtonGroup.js ***!
  \********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "RadioButtonGroup": () => (/* binding */ RadioButtonGroup)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
// [COMPONENT] Container with radio buttons
//   -> Custom widget for radio button group in transformations.json
//   -> Used in: Formulabar

const RadioButtonGroup = (props) => {
    return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "radio-button-group" }, props.options.enumOptions.map((option, index) => (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { key: option.label + index, className: "radio-wrapper" },
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", { type: "radio", className: "radio-button", id: `rb-${index}`, onChange: () => {
                props.onChange(option.value);
            }, checked: props.value === option.value }),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", { className: "radio-button-label ellipsized", htmlFor: `rb-${index}` }, option.label))))));
};


/***/ }),

/***/ "./lib/components/reloadButton.js":
/*!****************************************!*\
  !*** ./lib/components/reloadButton.js ***!
  \****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "ReloadButton": () => (/* binding */ ReloadButton)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _assets_svgs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../assets/svgs */ "./lib/assets/svgs.js");


const ReloadButton = ({ onClick, title }) => {
    return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "reload-button__container" },
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { id: "reload-button", onClick: () => {
                if (onClick) {
                    onClick();
                }
            } }, _assets_svgs__WEBPACK_IMPORTED_MODULE_1__.reloadIcon),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", { htmlFor: "reload-button" }, title)));
};


/***/ }),

/***/ "./lib/components/spinner.js":
/*!***********************************!*\
  !*** ./lib/components/spinner.js ***!
  \***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Spinner": () => (/* binding */ Spinner)
/* harmony export */ });
/* harmony import */ var react_spinners_BarLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-spinners/BarLoader */ "./node_modules/react-spinners/BarLoader.js");
/* harmony import */ var react_spinners_BarLoader__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_spinners_BarLoader__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
// [COMPONENT] React spinner
//   -> Description: Bar loader spinner
//   -> Used in: Formulabar


const Spinner = react__WEBPACK_IMPORTED_MODULE_0___default().memo(() => (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "spinner-wrapper" },
    react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_spinners_BarLoader__WEBPACK_IMPORTED_MODULE_1___default()), { width: '100%', color: '#2684FF' }))));


/***/ }),

/***/ "./lib/core/CellUtilities.js":
/*!***********************************!*\
  !*** ./lib/core/CellUtilities.js ***!
  \***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ CellUtilities)
/* harmony export */ });
/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/cells */ "webpack/sharing/consume/default/@jupyterlab/cells");
/* harmony import */ var _jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/nbformat */ "webpack/sharing/consume/default/@jupyterlab/nbformat");
/* harmony import */ var _jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/notebook */ "webpack/sharing/consume/default/@jupyterlab/notebook");
/* harmony import */ var _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_2__);
//SOURCE: https://github.com/CDAT/jupyter-vcdat/blob/master/src/CellUtilities.ts
// Dependencies



/** Contains some utility functions for handling notebook cells */
class CellUtilities {
    /**
     * @description Reads the output at a cell within the specified notebook and returns it as a string
     * @param notebook The notebook to get the cell from
     * @param index The index of the cell to read
     * @returns any - A string value of the cell output from the specified
     * notebook and cell index, or null if there is no output.
     * @throws An error message if there are issues in getting the output
     */
    static readOutput(notebook, index) {
        if (!notebook) {
            throw new Error("Notebook was null!");
        }
        if (index < 0 || index >= notebook.model.cells.length) {
            throw new Error("Cell index out of range.");
        }
        const cell = notebook.model.cells.get(index);
        if (!(0,_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.isCodeCellModel)(cell)) {
            throw new Error("cell is not a code cell.");
        }
        if (cell.outputs.length < 1) {
            return null;
        }
        const out = cell.outputs.toJSON().pop();
        if ((0,_jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__.isExecuteResult)(out)) {
            const execData = out;
            return execData.data["text/plain"];
        }
        if ((0,_jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__.isStream)(out)) {
            return out.text;
        }
        if ((0,_jupyterlab_nbformat__WEBPACK_IMPORTED_MODULE_1__.isError)(out)) {
            const errData = out;
            throw new Error(`Code resulted in errors. Error name: ${errData.ename}.\nMessage: ${errData.evalue}.`);
        }
    }
    /**
     * @description Gets the value of a key from the specified cell's metadata.
     * @param notebook The notebook that contains the cell.
     * @param index The index of the cell.
     * @param key The key of the value.
     * @returns any - The value of the metadata. Returns null if the key doesn't exist.
     */
    static getCellMetaData(notebook, index, key) {
        if (!notebook) {
            throw new Error("Notebook was null!");
        }
        if (index < 0 || index >= notebook.model.cells.length) {
            throw new Error("Cell index out of range.");
        }
        const cell = notebook.model.cells.get(index);
        if (cell.metadata.has(key)) {
            return cell.metadata.get(key);
        }
        return null;
    }
    /**
     * @description Sets the key value pair in the notebook's metadata.
     * If the key doesn't exists it will add one.
     * @param notebookPanel The notebook to set meta data in.
     * @param key The key of the value to create.
     * @param value The value to set.
     * @param save Default is false. Whether the notebook should be saved after the meta data is set.
     * Note: This function will not wait for the save to complete, it only sends a save request.
     * @returns any - The old value for the key, or undefined if it did not exist.
     */
    static setCellMetaData(notebookPanel, index, key, value, save = false) {
        if (!notebookPanel) {
            throw new Error("Notebook was null!");
        }
        if (index < 0 || index >= notebookPanel.model.cells.length) {
            throw new Error("Cell index out of range.");
        }
        try {
            const cell = notebookPanel.model.cells.get(index);
            const oldVal = cell.metadata.set(key, value);
            if (save) {
                notebookPanel.context.save();
            }
            return oldVal;
        }
        catch (error) {
            throw error;
        }
    }
    /**
     * @description Looks within the notebook for a cell containing the specified meta key
     * @param notebook The notebook to search in
     * @param key The metakey to search for
     * @returns [number, ICellModel] - A pair of values, the first is the index of where the cell was found
     * and the second is a reference to the cell itself. Returns [-1, null] if cell not found.
     */
    static findCellWithMetaKey(notebookPanel, key) {
        if (!notebookPanel) {
            throw new Error("Notebook was null!");
        }
        const cells = notebookPanel.model.cells;
        let cell;
        for (let idx = 0; idx < cells.length; idx += 1) {
            cell = cells.get(idx);
            if (cell.metadata.has(key)) {
                return [idx, cell];
            }
        }
        return [-1, null];
    }
    /**
     * @description Gets the cell object at specified index in the notebook.
     * @param notebook The notebook to get the cell from
     * @param index The index for the cell
     * @returns Cell - The cell at specified index, or null if not found
     */
    static getCell(notebook, index) {
        if (notebook && index >= 0 && index < notebook.model.cells.length) {
            return notebook.model.cells.get(index);
        }
        return null;
    }
    /**
     * @description Runs code in the notebook cell found at the given index.
     * @param command The command registry which can execute the run command.
     * @param notebook The notebook panel to run the cell in
     * @returns Promise<string> - A promise containing the output after the code has executed.
     */
    static async runCellAtIndex(notebookPanel, index) {
        if (notebookPanel === null) {
            throw new Error("Null or undefined parameter was given for command or notebook argument.");
        }
        // await notebookPanel.sessionContext.ready;
        const notebook = notebookPanel.content;
        if (index < 0 || index >= notebook.widgets.length) {
            throw new Error("The index was out of range.");
        }
        // Save the old index, then set the current active cell
        const oldIndex = notebook.activeCellIndex;
        notebook.activeCellIndex = index;
        try {
            await _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_2__.NotebookActions.run(notebook, notebookPanel.sessionContext);
            // await command.execute("notebook:run-cell");
            const output = CellUtilities.readOutput(notebook, index);
            notebook.activeCellIndex = oldIndex;
            return output;
        }
        finally {
            notebook.activeCellIndex = oldIndex;
        }
    }
    /**
     * @description Deletes the cell at specified index in the open notebook
     * @param notebookPanel The notebook panel to delete the cell from
     * @param index The index that the cell will be deleted at
     * @returns void
     */
    static deleteCellAtIndex(notebook, index) {
        if (notebook === null) {
            throw new Error("Null or undefined parameter was given for notebook argument.");
        }
        if (index < 0 || index >= notebook.widgets.length) {
            throw new Error("The index was out of range.");
        }
        // Save the old index, then set the current active cell
        let oldIndex = notebook.activeCellIndex;
        notebook.model.cells.remove(index);
        // Adjust old index to account for deleted cell.
        if (oldIndex === index) {
            if (oldIndex > 0) {
                oldIndex -= 1;
            }
            else {
                oldIndex = 0;
            }
        }
        else if (oldIndex > index) {
            oldIndex -= 1;
        }
        notebook.activeCellIndex = oldIndex;
    }
    /**
     * @description Inserts a cell into the notebook, the new cell will be at the specified index.
     * @param notebook The notebook panel to insert the cell in
     * @param index The index of where the new cell will be inserted.
     * If the cell index is less than or equal to 0, it will be added at the top.
     * If the cell index is greater than the last index, it will be added at the bottom.
     * @returns number - The index it where the cell was inserted
     */
    static insertCellAtIndex(notebook, index) {
        // Create a new cell
        const cell = notebook.model.contentFactory.createCodeCell({});
        // Save the old index, then set the current active cell
        let oldIndex = notebook.activeCellIndex;
        // Adjust old index for cells inserted above active cell.
        if (oldIndex >= index) {
            oldIndex += 1;
        }
        if (index <= 0) {
            notebook.model.cells.insert(0, cell);
            notebook.activeCellIndex = oldIndex;
            return 0;
        }
        if (index >= notebook.widgets.length) {
            notebook.model.cells.insert(notebook.widgets.length - 1, cell);
            notebook.activeCellIndex = oldIndex;
            return notebook.widgets.length - 1;
        }
        notebook.model.cells.insert(index, cell);
        notebook.activeCellIndex = oldIndex;
        return index;
    }
    /**
     * @description Injects code into the specified cell of a notebook, does not run the code.
     * Warning: the existing cell's code/text will be overwritten.
     * @param notebook The notebook to select the cell from
     * @param index The index of the cell to inject the code into
     * @param code A string containing the code to inject into the CodeCell.
     * @throws An error message if there are issues with injecting code at a particular cell
     * @returns void
     */
    static injectCodeAtIndex(notebook, index, code) {
        if (notebook === null) {
            throw new Error("Notebook was null or undefined.");
        }
        if (index < 0 || index >= notebook.model.cells.length) {
            throw new Error("Cell index out of range.");
        }
        const cell = notebook.model.cells.get(index);
        if ((0,_jupyterlab_cells__WEBPACK_IMPORTED_MODULE_0__.isCodeCellModel)(cell)) {
            cell.value.text = code;
            return;
        }
        throw new Error("Cell is not a code cell.");
    }
    /**
     * @description This will insert a new cell at the specified index and the inject the specified code into it.
     * @param notebook The notebook to insert the cell into
     * @param index The index of where the new cell will be inserted.
     * If the cell index is less than or equal to 0, it will be added at the top.
     * If the cell index is greater than the last index, it will be added at the bottom.
     * @param code The code to inject into the cell after it has been inserted
     * @returns number - index of where the cell was inserted
     */
    static insertInjectCode(notebook, index, code) {
        const newIndex = CellUtilities.insertCellAtIndex(notebook, index);
        CellUtilities.injectCodeAtIndex(notebook, newIndex, code);
        return newIndex;
    }
    /**
     * @description This will insert a new cell at the specified index, inject the specified code into it and the run the code.
     * Note: The code will be run and the result (output or errors) WILL BE DISPLAYED in the cell.
     * @param notebookPanel The notebook to insert the cell into
     * @param command The command registry which can execute the run command.
     * @param index The index of where the new cell will be inserted and run.
     * If the cell index is less than or equal to 0, it will be added at the top.
     * If the cell index is greater than the last index, it will be added at the bottom.
     * @param code The code to inject into the cell after it has been inserted
     * @param deleteOnError If set to true, the cell will be deleted if the code results in an error
     * @returns Promise<[number, string]> - A promise for when the cell code has executed
     * containing the cell's index and output result
     */
    static async insertRunShow(notebookPanel, index, code, deleteOnError) {
        let insertionIndex;
        try {
            insertionIndex = CellUtilities.insertInjectCode(notebookPanel.content, index, code);
            const output = await CellUtilities.runCellAtIndex(notebookPanel, insertionIndex);
            return [insertionIndex, output];
        }
        catch (error) {
            if (deleteOnError) {
                CellUtilities.deleteCellAtIndex(notebookPanel.content, insertionIndex);
            }
            throw error;
        }
    }
}


/***/ }),

/***/ "./lib/core/backend.js":
/*!*****************************!*\
  !*** ./lib/core/backend.js ***!
  \*****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Backend": () => (/* binding */ Backend)
/* harmony export */ });
/* harmony import */ var _kernelconnector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./kernelconnector */ "./lib/core/kernelconnector.js");
/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/signaling */ "webpack/sharing/consume/default/@lumino/signaling");
/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _initscript__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./initscript */ "./lib/core/initscript.js");
/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/apputils */ "webpack/sharing/consume/default/@jupyterlab/apputils");
/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _CellUtilities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CellUtilities */ "./lib/core/CellUtilities.js");
/* harmony import */ var _formulabar_transformations_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../formulabar/transformations.json */ "./lib/formulabar/transformations.json");
/* harmony import */ var amplitude_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! amplitude-js */ "webpack/sharing/consume/default/amplitude-js/amplitude-js");
/* harmony import */ var amplitude_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(amplitude_js__WEBPACK_IMPORTED_MODULE_3__);
// -------------------------------------------------------------------------------------------------------------
// BACKEND LOGIC
// -------------------------------------------------------------------------------------------------------------
/*
  The Eigendata backend communicates between the Magic Formula Bar and the Jupyter Kernel
  Major functionality include:
  - (A) HANDLE CHANGE OF NOTEBOOK: Keeping track of notebooks in the Jupyter applicaiton
  - (B) HANDLE CODE RUNNING IN NOTEBOOK: Keeping track of the state in each Jupyter notebook, and update it every time code runs
    - This includes thigns like dataframes loaded, other variables, imported packages, imported functions, etc.
    - Most of the code for this is in initscript.ts
  - (C) API FOR REACT GUI: Handle execution of GUI tasks in the backend
    - Examples include completing the transformations form with kernel data
  - (D) UTILITIES: Utilities to communicate with the kernel
*/
// KernelConnector class. See file for more details.


// Initialization scripts. See file for more details.



// Utilities from another project. See file for more details.

// JSON configuration holding all information for the UI transformationsList


//import { CodeCell } from '@jupyterlab/cells';
// Before deploying to production, we change this flag
const packageVersion = '0.3.2';
let transformationsConfig = _formulabar_transformations_json__WEBPACK_IMPORTED_MODULE_4__;
class Backend {
    // -------------------------------------------------------------------------------------------------------------
    // CONSTRUCTOR
    // -------------------------------------------------------------------------------------------------------------
    constructor(notebooks, settingRegistry, manager, outputPanel) {
        /*---------------------------------
          Communicate with UI
        ----------------------------------*/
        // Signal that triggers the update of the react component
        this.signal = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_0__.Signal(this);
        // Keeps track of dataframes that can be transformed through the UI
        // Used to display forms
        this.dataframesLoaded = [];
        this.packagesImported = [];
        this.packageNamespaces = [];
        this.importedFunctions = [];
        // Data transformation functions
        this.transformationsList = [];
        this.variablesLoaded = [];
        // Flag to reset the state of the frontend
        this.resetStateFormulabarFlag = false;
        this.resetStateDatavisualizerFlag = false;
        // Production flag that determines if usage analytics are captured
        this.production = true;
        // Returns a json object with all the dataframes & imported modules
        // Use multi import call strategy
        this.kernelInspectorRequest = `
  call_backend_functions([
   {'name': 'ed_get_dfs', 'parameters': {}},
   {'name': 'ed_get_imported_modules', 'parameters': {}},  
   {'name': 'ed_get_nondf_variables', 'parameters': {}},
   {'name': 'ed_get_module_namespaces', 'parameters': {}},
   {'name': 'ed_get_functions', 'parameters': {}}
  ])
  `;
        // -------------------------------------------------------------------------------------------------------------
        //
        // (B) HANDLE CODE RUNNING IN NOTEBOOK
        //
        // -------------------------------------------------------------------------------------------------------------
        // Overview: codeRunningOnNotebook ->  pythonRequestDataframes -> handleGetDataframesResponse
        /*----------------------------------------------------------------------------------------------------
        [FUNCTION] Get list of dataframes through reqeuestDataframes when new code runs
        -> Returns: None
        -----------------------------------------------------------------------------------------------------*/
        this.codeRunningOnNotebook = (sess, msg) => {
            const msgType = msg.header.msg_type;
            const code = msg.content.code;
            switch (msgType) {
                case 'error':
                    console.warn('Kernel error', msg.content);
                case 'execute_input':
                    // Check this is not my code running
                    if (!(code === this.kernelInspectorRequest) &&
                        !(code === this.initScripts) &&
                        !(code === this.codeToIgnore) &&
                        // This avoids an infinite loop of errors caused by the data visualizer
                        // refreshing after an error, and encountering another error
                        !(code === undefined)) {
                        console.log('Non-internal code running:', code);
                        this.pythonRequestDataframes();
                    }
                    break;
                case 'status':
                    this.kernelStatus = msg.content['execution_state'];
                    this.signal.emit();
                    // console.log('[' + this.kernelStatus + ']');
                    break;
                default:
                    break;
            }
        };
        /*----------------------------------------------------------------------------------------------------
        [FUNCTION] Send request to the Kernel to get dataframes, processed with handleGetDataframesResponse
        -> Writes: dataframesLoaded
        -----------------------------------------------------------------------------------------------------*/
        this.handleGetDataframesResponse = (response) => {
            //console.log('------> Handle inspector request');
            const messageType = response.header.msg_type;
            // console.log('Message type from the backend', messageType);
            if (messageType === 'execute_result') {
                console.log('------> Get dataframe list');
                const payload = response.content;
                let content = payload.data['text/plain'];
                // The resulting python JSON neets to be cleaned
                if (content.slice(0, 1) === "'" || content.slice(0, 1) === '"') {
                    content = content.slice(1, -1);
                    content = content.replace(/\\"/g, '"').replace(/\\'/g, "'");
                }
                const kernelData = JSON.parse(content);
                //console.log('Kernel Inspector: Result', kernelData)
                const dataframes = kernelData['ed_get_dfs'];
                //console.log('Number of dataframes:', dataframes.length);
                const variables = kernelData['ed_get_nondf_variables'];
                this.variablesLoaded = variables;
                if (dataframes.length === 0) {
                    // If there is no data loaded, reset frontend component
                    this.dataframesLoaded = [];
                    this.resetStateFormulabarFlag = true;
                    this.resetStateDatavisualizerFlag = true;
                    this.packagesImported = kernelData['ed_get_imported_modules'];
                    this.packageNamespaces = kernelData['ed_get_module_namespaces'];
                    this.importedFunctions = kernelData['ed_get_functions'];
                }
                else {
                    console.log('Refreshing dataframes');
                    const dataframeList = [];
                    // Note: Just trying to make an array so that I can iterate here
                    dataframes.forEach(item => {
                        const dataframeItem = {
                            value: item,
                            label: item
                        };
                        dataframeList.push(dataframeItem);
                    });
                    this.dataframesLoaded = dataframeList;
                    this.packagesImported = kernelData['ed_get_imported_modules'];
                    this.packageNamespaces = kernelData['ed_get_module_namespaces'];
                    this.importedFunctions = kernelData['ed_get_functions'];
                }
                // Emit signal to re-render the component
                this.signal.emit();
            }
        };
        console.log('Eigendata version:', packageVersion);
        // Add a notebook tracker
        this.notebookTracker = notebooks;
        this.notebookMode = 'notebook';
        // Read transformations config
        const readTransformationConfig = () => {
            this.transformationsConfig = transformationsConfig['transformations'];
            const transformationList = [
                { value: 'query', label: 'Filter dataframe' }
            ];
            console.log('Read transformations into list', transformationsConfig['transformations']);
            for (const transformation in transformationsConfig['transformations']) {
                if (transformation) {
                    transformationList.push({
                        value: transformation,
                        label: transformationsConfig['transformations'][transformation]['form']['title']
                    });
                }
            }
            this.transformationsList = transformationList;
        };
        // Read default transformation config (replaced later)
        readTransformationConfig();
        // Load python initialization script
        this.initScripts = _initscript__WEBPACK_IMPORTED_MODULE_5__.pythonInitializationScript;
        /*------------------------------------
          LOAD SETTINGS
        ------------------------------------*/
        settingRegistry.load('@molinsp/eigendata:settings').then((settings) => {
            if (settings.get('answeredProductDataDialog').composite === false) {
                (0,_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.showDialog)({
                    title: 'Welcome to Eigendata',
                    body: 'Eigendata captures anonymous product data using cookies. If you wish, you can opt-out by selecting reject.',
                    buttons: [
                        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.cancelButton({ label: 'Reject' }),
                        _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Dialog.okButton({ label: 'Accept' })
                    ]
                })
                    .catch(e => console.log(e))
                    .then(async (result) => {
                    await settings.set('answeredProductDataDialog', true);
                    const clickedButtonLabel = result.button.label;
                    console.log('Analytics: Clicked', clickedButtonLabel);
                    if (clickedButtonLabel === 'Accept') {
                        console.log('Analytics: Accepted permission');
                        await settings.set('shareProductData', true);
                        this.shareProductData = true;
                    }
                    else {
                        await settings.set('shareProductData', false);
                        this.shareProductData = false;
                    }
                });
            }
            else {
                this.shareProductData = settings.get('shareProductData').composite;
            }
            this.completedProductTour = settings.get('completedProductTour').composite;
            this.eigendataMode = settings.get('eigendataMode').composite;
            this.transformationServer = settings.get('transformationServer').composite;
            this.transformationAuth = settings.get('transformationAuth').composite;
            this.openFormulabarCellByDefault = settings.get('openFormulabarCellByDefault').composite;
            console.log('Open formulabar cell by default', this.openFormulabarCellByDefault);
            // Save the settings object to be used. Use case is to change settings after product tour
            this.eigendataSettings = settings;
            console.log('Analytics: Product tracking data', this.shareProductData);
            // Tracking setup
            if (this.production && this.shareProductData) {
                amplitude_js__WEBPACK_IMPORTED_MODULE_3___default().getInstance().init('c461bfacd2f2ac406483d90c01a708a7');
                amplitude_js__WEBPACK_IMPORTED_MODULE_3___default().getInstance().setVersionName(packageVersion);
            }
        }, (err) => {
            console.error(`jupyterlab-execute-time: Could not load settings, so did not active the plugin: ${err}`);
        }).then(() => {
            /*------------------------------------
              LOAD USER TRANSFORMATIONS
            ------------------------------------*/
            settingRegistry.load('@molinsp/eigendata:usertransformations').then((settings) => {
                const userTransformations = settings.get('userTransformations').composite;
                if (!lodash__WEBPACK_IMPORTED_MODULE_2___default().isEmpty(userTransformations)) {
                    transformationsConfig['transformations'] = Object.assign({}, transformationsConfig['transformations'], userTransformations);
                    console.log('User added configs', transformationsConfig);
                }
                else {
                    console.log('No user transformations found');
                }
            });
        })
            .then(() => {
            /*------------------------------------
                  LOAD REMOTE TRANSFORMATIONS
            ------------------------------------*/
            if (this.transformationAuth.length != 0 && this.transformationServer.length != 0) {
                const myHeaders = new Headers();
                myHeaders.append('Authorization', 'Bearer '.concat(this.transformationAuth));
                const requestOptions = {
                    method: 'GET',
                    headers: myHeaders,
                    redirect: 'follow'
                };
                fetch(this.transformationServer, requestOptions)
                    .then(response => {
                    return response.json();
                })
                    .then(parsedConfig => {
                    console.log('REMOTE TRANSFORMATIONS VERSION:', parsedConfig['version']);
                    //transformationsConfig = parsedConfig;
                    transformationsConfig['transformations'] = Object.assign({}, transformationsConfig['transformations'], parsedConfig['transformations']);
                })
                    .then(() => {
                    readTransformationConfig();
                    this.signal.emit();
                });
            }
        }).then(() => {
            /*------------------------------------
              START KERNEL IF IN NO-CODE MODE
            ------------------------------------*/
            if (this.eigendataMode === 'no-code') {
                //Ad-hoc mode not working well yet 
                this.notebookMode = 'ad-hoc';
                this.outputPanel = outputPanel;
                this.startAdHocKernel(manager);
            }
        });
        // Subscribe to signal when notebooks change
        this.notebookTracker.currentChanged.connect(this.updateCurrentNotebook, this);
    }
    get dataframeSelection() {
        return this._dataframeSelection;
    }
    set dataframeSelection(value) {
        this._dataframeSelection = value;
    }
    // -------------------------------------------------------------------------------------------------------------
    //
    // (D) INTERNAL UTILITIES
    //
    // -------------------------------------------------------------------------------------------------------------
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Sends request to Kernel
    -> Returns: User expressions
    Todo: Unique way of creating Kernel requests. Probably move to the kernel connector class
    SOURCE: https://github.com/kubeflow-kale/kale/blob/167aa8859b58918622bb9b742a08cf5807dee4d8/labextension/src/utils/NotebookUtils.tsx#L326
    -----------------------------------------------------------------------------------------------------*/
    static async sendKernelRequest(kernel, runCode, userExpressions, runSilent = false, storeHistory = false, allowStdIn = false, stopOnError = false) {
        if (!kernel) {
            throw new Error('Kernel is null or undefined.');
        }
        // Wait for kernel to be ready before sending request
        // Kernel.ready is deprecated from 2.0: https://jupyterlab.readthedocs.io/en/stable/developer/extension_migration.html
        //await kernel.ready;
        const message = await kernel.requestExecute({
            allow_stdin: allowStdIn,
            code: runCode,
            silent: runSilent,
            stop_on_error: stopOnError,
            store_history: storeHistory,
            user_expressions: userExpressions
        }).done;
        const content = message.content;
        if (content.status !== 'ok') {
            // If response is not 'ok', throw contents as error, log code
            const msg = `Code caused an error:\n${runCode}`;
            console.error(msg);
            if (content.traceback) {
                content.traceback.forEach((line) => console.log(line.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '')));
            }
            throw content;
        }
        // Return user_expressions of the content
        return content.user_expressions;
    }
    // -------------------------------------------------------------------------------------------------------------
    //
    // (C) API FOR REACT GUI
    //
    // -------------------------------------------------------------------------------------------------------------
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Based on the user selection of dataframe and transformation returns form to render UI
    -> Returns: customTransformation as JSONSchema7
    -> Writes: codeToIgnore
  
      Depends on:
      - sendKernelRequest
    -----------------------------------------------------------------------------------------------------*/
    async getTransformationFormSchema(dataFrameSelection, transformationSelection) {
        // Check that there is a transformation selection and a dataframe selection
        console.log('------> Get transformation UI form');
        console.log('Transformation Selection', transformationSelection);
        if (typeof this.transformationsConfig[transformationSelection] === 'undefined') {
            console.log('TG: No transformation found');
        }
        else {
            /*-------------------------------------------
              Read form from custom configuration
            -------------------------------------------*/
            const customTransformation = lodash__WEBPACK_IMPORTED_MODULE_2___default().cloneDeep(this.transformationsConfig[transformationSelection].form);
            // Check if there is a definitions object
            if (typeof customTransformation['definitions'] !== 'undefined') {
                const definitions = customTransformation['definitions'];
                // Check if column or columns defined
                if (typeof definitions['columns'] !== 'undefined' ||
                    typeof definitions['column'] !== 'undefined') {
                    console.log('TG: Transformation needs columns');
                    const columns = await this.pythonGetDataframeColumns(dataFrameSelection);
                    console.log('TG: fetched columns', columns);
                    // Check if multi-select columns defined
                    if (typeof customTransformation['definitions']['columns'] !==
                        'undefined') {
                        customTransformation['definitions']['columns']['items']['enum'] = columns;
                    }
                    // Check if single select column defined
                    if (typeof customTransformation['definitions']['column'] !== 'undefined') {
                        customTransformation['definitions']['column']['enum'] = columns;
                    }
                }
                // Check if there is a dataframes select
                if (typeof customTransformation['definitions']['dataframes'] !==
                    'undefined') {
                    customTransformation['definitions']['dataframes']['enum'] = this.dataframesLoaded.map(item => item.value);
                }
            }
            return customTransformation;
        }
    }
    getTransformationUISchema(transformationSelection) {
        if (typeof this.transformationsConfig[transformationSelection] === 'undefined') {
            console.log('TG: No transformation form defined');
            return;
        }
        else {
            if (typeof this.transformationsConfig[transformationSelection]['uischema'] !== 'undefined') {
                return this.transformationsConfig[transformationSelection]['uischema'];
            }
            else {
                console.log('TG: No transformation uiSchema defined');
            }
        }
    }
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Write to the last cell of the notebook and execute
    -> Returns: None
    -----------------------------------------------------------------------------------------------------*/
    async writeToNotebookAndExecute(code, returnType) {
        if (this.notebookMode === 'notebook') {
            // Run and insert using cell utilities      
            await _CellUtilities__WEBPACK_IMPORTED_MODULE_6__.default.insertRunShow(this.currentNotebook, this.currentNotebook.content.activeCellIndex, code, true);
        }
        else if (this.notebookMode === 'ad-hoc') {
            // If no output type and ad-hoc mode, show in outputPanel
            if (returnType === 'none') {
                console.log('Execute in output panel');
                this.outputPanel.execute(code, this.adHocSessionContext);
                //this.outputPanel.addOutput(code, this.currentNotebook.sessionContext, this.currentNotebook.content.widgets[lastCellIndex] as CodeCell);
            }
            else {
                // Execute agains adhoc kernel
                await Backend.sendKernelRequest(this.adHocSessionContext.session.kernel, code, {});
            }
        }
        return 'success';
    }
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Get list of columns from Kernel for selected dataframe
    -> Returns: Array of columns
    -> Writes: codeToIgnore
    -----------------------------------------------------------------------------------------------------*/
    async pythonGetDataframeColumns(rightParameter) {
        const codeToRun = 'ed_form = ed_get_json_column_values(' + rightParameter + ')';
        // Flag as code to ignore avoid triggering the pythonRequestDataframes function
        this.codeToIgnore = codeToRun;
        //console.log('Request expression', codeToRun);
        let sessionContext;
        if (this.notebookMode === 'notebook') {
            sessionContext = this.currentNotebook.sessionContext;
        }
        else if (this.notebookMode === 'ad-hoc') {
            sessionContext = this.adHocSessionContext;
        }
        // Execute code and save the result. The last parameter is a mapping from the python variable to the javascript object
        const result = await Backend.sendKernelRequest(sessionContext.session.kernel, codeToRun, { form: 'ed_form' });
        // Retriev the data behind the javascript object where the result is saved
        let content = result.form.data['text/plain'];
        // Clean the JSON result that python returns
        if (content.slice(0, 1) === "'" || content.slice(0, 1) === '"') {
            content = content.slice(1, -1);
            // Replace \' with ', \" with " and \xa0 with \\xa0
            content = content
                .replace(/\\"/g, '"')
                .replace(/\\'/g, "'")
                .replace(/\\xa0/g, '\\\\xa0');
        }
        return JSON.parse(content);
    }
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Get the querybuilder configuration
    -> Returns: JSON object to pass to querybuiler
    -> Writes: codeToIgnore
    -----------------------------------------------------------------------------------------------------*/
    async pythonGenerateQuerybuilderConfig(dataframe) {
        const codeToRun = 'ed_queryconfig = ed_generate_querybuilder_config(' + dataframe + ')';
        // Flag as code to ignore avoid triggering the pythonRequestDataframes function
        this.codeToIgnore = codeToRun;
        console.log('Request expression', codeToRun);
        let sessionContext;
        if (this.notebookMode === 'notebook') {
            sessionContext = this.currentNotebook.sessionContext;
        }
        else if (this.notebookMode === 'ad-hoc') {
            sessionContext = this.adHocSessionContext;
        }
        // Execute code and save the result. The last parameter is a mapping from the python variable to the javascript object
        const result = await Backend.sendKernelRequest(sessionContext.session.kernel, codeToRun, { queryconfig: 'ed_queryconfig' });
        // Retrieve the data behind the javascript object where the result is saved
        let content = result.queryconfig.data['text/plain'];
        // Clean the JSON result that python returns
        if (content.slice(0, 1) === "'" || content.slice(0, 1) === '"') {
            content = content.slice(1, -1);
            // Replace \' with ', \" with "
            content = content
                .replace(/\\"/g, '"')
                .replace(/\\'/g, "'")
                .replace(/\\xa0/g, '\\\\xa0');
        }
        console.log('Content', content);
        const queryConfig = JSON.parse(content);
        console.log('Query config', queryConfig);
        return queryConfig;
    }
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Get the backend data in the visualizer
    -> Returns: JSON object to pass to querybuiler
    -> Writes: codeToIgnore
    ----------------------------------------------------------------------------------------------------*/
    async pythonGetDataForVisualization(dataframe, sortBy, ascending, page, pageSize) {
        const isAscending = () => (ascending ? 'True' : 'False');
        let codeToRun = `ed_visualizer_data = ed_prep_data_for_visualization(${dataframe}`;
        if (sortBy) {
            codeToRun += `, sortby="${sortBy}" ${ascending !== undefined ? ', ascending=' + isAscending() : ''}`;
        }
        if (page) {
            codeToRun += `, page=${page}`;
        }
        if (pageSize) {
            codeToRun += `, page_size=${pageSize}`;
        }
        codeToRun += ')';
        // Flag as code to ignore avoid triggering the pythonRequestDataframes function
        this.codeToIgnore = codeToRun;
        console.log('DataViz: Request expression', codeToRun);
        let resultObject = {};
        let sessionContext;
        if (this.notebookMode === 'notebook') {
            sessionContext = this.currentNotebook.sessionContext;
        }
        else if (this.notebookMode === 'ad-hoc') {
            sessionContext = this.adHocSessionContext;
        }
        // Execute code and save the result. The last parameter is a mapping from the python variable to the javascript object
        const result = await Backend.sendKernelRequest(sessionContext.session.kernel, codeToRun, { data: 'ed_visualizer_data' });
        let content = result.data.data['text/plain'];
        //console.log('DataViz content', content.slice(0,100));
        if (content.slice(0, 1) === "'" || content.slice(0, 1) === '"') {
            content = content.slice(1, -1);
            // Replace \' with ', \" with " and \xa0 with \\xa0
            content = content
                .replace(/\\"/g, '"')
                .replace(/\\'/g, "'")
                .replace(/\\xa0/g, '\\\\xa0');
        }
        let parsedData = {};
        try {
            parsedData = JSON.parse(content);
        }
        catch (e) {
            console.error('DataViz: (!) Cannot parse data', e);
        }
        resultObject = parsedData;
        console.log('DataViz: Backend visualizer object', resultObject);
        return resultObject;
    }
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Remove table or variable from python kernel
    -> Returns: na
    -> Writes: na
    -----------------------------------------------------------------------------------------------------*/
    async pythonRemoveData(data) {
        const codeToRun = 'del ' + data;
        console.log('Request expression', codeToRun);
        let sessionContext;
        if (this.notebookMode === 'notebook') {
            sessionContext = this.currentNotebook.sessionContext;
        }
        else if (this.notebookMode === 'ad-hoc') {
            sessionContext = this.adHocSessionContext;
        }
        // Execute code and save the result. The last parameter is a mapping from the python variable to the javascript object
        const result = await Backend.sendKernelRequest(sessionContext.session.kernel, codeToRun, {});
        console.log('Result', result);
    }
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Import library/ snippet with given statement
    -> Returns: na
    -> Writes: na
    -----------------------------------------------------------------------------------------------------*/
    async pythonImportLibraries(importStatement) {
        if (this.notebookMode === 'notebook') {
            // Execute the import in the kernel
            await Backend.sendKernelRequest(this.currentNotebook.sessionContext.session.kernel, importStatement, {});
            // Get content of first cell, which by convention is for the imports
            const importsCell = _CellUtilities__WEBPACK_IMPORTED_MODULE_6__.default.getCell(this.currentNotebook.content, 0);
            const importsCellContent = importsCell.value.text;
            let importsCellNewContent = '';
            console.log('imports cell', importsCellContent);
            // If the cell is empty, write the imports
            if (importsCellContent === '') {
                importsCellNewContent = importStatement;
                await _CellUtilities__WEBPACK_IMPORTED_MODULE_6__.default.insertRunShow(this.currentNotebook, 0, importsCellNewContent, true);
            }
            // If it has text, add the import in a new line
            else {
                importsCellNewContent = importsCellContent + '\n' + importStatement;
                importsCell.value.text = importsCellNewContent;
            }
            // Write in the first cell
            //this.currentNotebook.content.model.cells.get(0).value.text = importsCellNewContent;
            //await CellUtilities.injectCodeAtIndex(this.currentNotebook.content, 0, importsCellNewContent);
        }
        else if (this.notebookMode === 'ad-hoc') {
            await Backend.sendKernelRequest(this.adHocSessionContext.session.kernel, importStatement, {});
        }
    }
    // -------------------------------------------------------------------------------------------------------------
    //
    // (A) HANDLE CHANGE OF NOTEBOOK
    //
    // -------------------------------------------------------------------------------------------------------------
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Initialize ad-hoc kernel
    -----------------------------------------------------------------------------------------------------*/
    startAdHocKernel(manager) {
        console.log('Start ad-hoc kernel for no-code mode');
        manager.sessions.shutdownAll();
        this.adHocSessionContext = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.SessionContext({
            sessionManager: manager.sessions,
            specsManager: manager.kernelspecs,
            kernelPreference: { name: 'python3' },
            name: 'Ad-hoc Kernel'
        });
        this.adHocSessionContext.initialize();
        const session = this.adHocSessionContext;
        // Note: When an IOptions object is passed, need to look at the sourc code to see which variables this option has. If ther eis one, we can pass it with brackets and the same name
        // To-do: Not sure if at some point I need to drop all these connections
        this.connector = new _kernelconnector__WEBPACK_IMPORTED_MODULE_7__.KernelConnector({ session });
        // INIT SCRIPTS
        // Basically if the connector is ready, should not have to worry about this
        this.connector.ready.then(() => {
            console.log('Connector ready');
            const content = {
                code: this.initScripts,
                stop_on_error: false,
                store_history: false
            };
            this.connector
                .fetch(content, () => { })
                .then(() => {
                console.log('Fetched content');
                this.pythonRequestDataframes();
            });
        });
        // Connect to changes running in the code
        this.connector.iopubMessage.connect(this.codeRunningOnNotebook);
    }
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Update current notebook and create kernel connector
    -> Writes: currentNotebook, connector
    -----------------------------------------------------------------------------------------------------*/
    async updateCurrentNotebook(sender, nbPanel) {
        if (nbPanel && this.notebookMode === 'notebook') {
            console.log('------> Notebook changed', nbPanel.content.title.label);
            // Update the current notebook
            this.currentNotebook = nbPanel;
            // Creates a new way to connect to the Kernel in this notebook
            const session = this.currentNotebook.sessionContext;
            // Note: When an IOptions object is passed, need to look at the sourc code to see which variables this option has. If ther eis one, we can pass it with brackets and the same name
            // To-do: Not sure if at some point I need to drop all these connections
            this.connector = new _kernelconnector__WEBPACK_IMPORTED_MODULE_7__.KernelConnector({ session });
            // Basically if the connector is ready, should not have to worry about this
            this.connector.ready.then(() => {
                const content = {
                    code: this.initScripts,
                    stop_on_error: false,
                    store_history: false
                };
                this.connector
                    .fetch(content, () => { })
                    .then(() => {
                    this.pythonRequestDataframes();
                });
            });
            // Connect to changes running in the code
            this.connector.iopubMessage.connect(this.codeRunningOnNotebook);
            /*----------------------------------------------
            Handle the case where the Kernel is restarted
            -----------------------------------------------*/
            this.connector.kernelRestarted.connect((sender, kernelReady) => {
                this.connector.ready.then(() => {
                    // Flag to reset the frontend
                    this.resetStateFormulabarFlag = true;
                    this.resetStateDatavisualizerFlag = true;
                    // Reset dataframes
                    this.packagesImported = [];
                    this.variablesLoaded = [];
                    // Restart init scripts
                    const content = {
                        code: this.initScripts,
                        stop_on_error: false,
                        store_history: false
                    };
                    this.connector
                        .fetch(content, () => { })
                        .then(() => {
                        // Emit signal to re-render the component
                        this.signal.emit();
                    });
                });
            });
            /*----------------------------------------------
            Handle the case where the Kernel is shut down (e.g. closing notebook)
            -----------------------------------------------*/
            this.connector.kernelShutDown.connect((sender, kernelReady) => {
                this.connector.ready.then(() => {
                    // Flag to reset the frontend
                    //this.resetStateFormulabarFlag = true;
                    this.resetStateDatavisualizerFlag = true;
                    // Reset dataframes
                    this.packagesImported = [];
                    this.variablesLoaded = [];
                    this.signal.emit();
                });
            });
            // Need to re-render so that the output function in the button has the latest version of
            // the current notebook. Probably there is a better way of doing this.
            this.signal.emit();
        }
    }
    /*----------------------------------------------------------------------------------------------------
    [FUNCTION] Send request to the Kernel to get dataframes, processed with handleGetDataframesResponse
    -> Returns: None
    -----------------------------------------------------------------------------------------------------*/
    pythonRequestDataframes() {
        const content = {
            code: this.kernelInspectorRequest,
            stop_on_error: false,
            store_history: false
        };
        this.connector.fetch(content, this.handleGetDataframesResponse);
    }
}


/***/ }),

/***/ "./lib/core/initscript.js":
/*!********************************!*\
  !*** ./lib/core/initscript.js ***!
  \********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "pythonInitializationScript": () => (/* binding */ pythonInitializationScript)
/* harmony export */ });
const pythonInitializationScript = `
# ---------------- VARIABLE INSPECTOR ----------------
import json
import sys
from IPython import get_ipython
from IPython.core.magics.namespace import NamespaceMagics
from numpy import isscalar
import numpy as np


_jupyterlab_variableinspector_nms = NamespaceMagics()
_jupyterlab_variableinspector_Jupyter = get_ipython()
_jupyterlab_variableinspector_nms.shell = _jupyterlab_variableinspector_Jupyter.kernel.shell

# Convert the numpy data types to something that can be serialized in JSON
class NpEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, np.integer):
            return int(obj)
        elif isinstance(obj, np.floating):
            return float(obj)
        elif isinstance(obj, np.ndarray):
            return obj.tolist()
        else:
            return super(NpEncoder, self).default(obj)


# ---------------- Multi-backend caller ----------------
def call_backend_functions(functions):
    results = {}
    for func in functions:
        func_name = func['name']
        results[func_name] = globals()[func_name](**func['parameters']) 
        
    return json.dumps(results, cls=NpEncoder)

def ed_keep_dataframes(v):
    try:
        obj = eval(v)
        # Check if datadrame
        if isinstance(obj, pd.core.frame.DataFrame):
            return True
        return False
    except:
        return False
    
def ed_keep_nondf_variables(v):
    try:
        obj = eval(v)
        # Ignore internal variables
        if v.startswith('ed_'):
            return False
        elif isinstance(obj, str):
            return True
        elif isinstance(obj, int):
            return True
        elif isinstance(obj, float):
            return True
        elif isinstance(obj, list):
            return True
        elif isscalar(obj):
            return True
        else:
            return False
    except:
        pass

def ed_keep_modules(v):
    try:
        obj = eval(v)
        # Ignore internal variables
        if getattr(obj, "__version__", None) != None:
            return True
    except:
        pass

def ed_keep_functions(v):
    try:
        obj = eval(v)
        # Check if it is a function
        # and ignore internal eigendata functions
        if callable(obj) and v[:2] != 'ed':
            return True
    except:
        pass
    
def ed_get_nondf_variables():
    values = _jupyterlab_variableinspector_nms.who_ls()
    variables = [{'name': _v,
      'type': type(eval(_v)).__name__,
      'value' : eval(_v)
     } for _v in values if ed_keep_nondf_variables(_v)]
    
    return variables

def ed_get_dfs():
    values = _jupyterlab_variableinspector_nms.who_ls()
    vararray = [_v for _v in values if ed_keep_dataframes(_v)]
    return vararray

def ed_get_imported_modules():
    return list(sys.modules.keys())

def ed_get_module_namespaces():
    values = _jupyterlab_variableinspector_nms.who_ls()
    vararray = [_v for _v in values if ed_keep_modules(_v)]
    return vararray

def ed_get_functions():
    values = _jupyterlab_variableinspector_nms.who_ls()
    vararray = [_v for _v in values if ed_keep_functions(_v)]
    return vararray

# ---------------- GET DF COLUMNS AS JSON ----------------
def ed_get_json_column_values(df):
    return json.dumps(df.columns.tolist(), ensure_ascii=False)

# ---------------- QUERYBUILDER BACKEND ----------------
from pandas.api.types import is_categorical_dtype, is_integer_dtype, is_float_dtype, is_bool_dtype, is_object_dtype
def ed_get_percentage_unique_column(df, col_name):
    return df[col_name].nunique() / df[col_name].count() * 100.0 

def ed_generate_querybuilder_config(df):
    queryprops = {}
    for i,col_type in enumerate(df.dtypes):
        col_name = df.columns[i]
        if is_integer_dtype(df[col_name]) or is_float_dtype(df[col_name]):      
            queryprops[col_name] = {
                'label' : col_name,
                'type' : 'number'
            }
        elif is_bool_dtype(df[col_name]):
            queryprops[col_name] = {
                'label' : col_name,
                'type' : 'boolean'
            }
        elif is_object_dtype(df[col_name]):
            # Categorical if less than 10% of values are unique
            if (ed_get_percentage_unique_column(df, col_name) < 10):
                queryprops[col_name] = {
                'label' : col_name,
                'type' : 'select',
                'fieldSettings' : {
                    'listValues' : [{'value': row, 'title': row} for row in df[col_name].unique() if type(row) == str]
                    }
                }
            else:
                queryprops[col_name] = {
                    'label' : col_name,
                    'type' : 'text'
                }
        elif is_categorical_dtype(df[col_name]):
            queryprops[col_name] = {
                'label' : col_name,
                'type' : 'select',
                'fieldSettings' : {
                    'listValues' : [{'value': row, 'title': row} for row in df[col_name].unique() if type(row) == str]
                    }
                }
        elif is_datetime64_any_dtype(df[col_name]):
            # Check if it contains only dates
            if ((df[col_name].dt.floor('d') == df[col_name]) | (df[col_name].isnull())).all():
                queryprops[col_name] = {
                    'label' : col_name,
                    'type' : 'date'
                }
            # Check if it contains only times
            elif ( (df[col_name].dt.date == pd.Timestamp('now').date()) | (df[col_name].isnull()) ).all():
                queryprops[col_name] = {
                    'label' : col_name,
                    'type' : 'time'
                }
            else:
                queryprops[col_name] = {
                    'label' : col_name,
                    'type' : 'datetime'
                }
            
    return json.dumps(queryprops, ensure_ascii=False)
# ---------------- DATA VISUALIZER ----------------
from pandas.api.types import is_datetime64_any_dtype,is_numeric_dtype,is_bool_dtype
def ed_build_colDefs_for_mi_cols(df):
    """
    create columnDefs dict for column grouping
    from multiindex dataframe columns
    """
    # utility
    def get_idx(s, x):
        li_headerName = [e['Header'] for e in s]
        if x not in li_headerName:
            return -1
        else:
            return li_headerName.index(x)

    mindexcol = df.columns
    li_idx_col = mindexcol.tolist()
    s = []
    for levels in li_idx_col:
        col = df.loc[:, levels]
        num_levels = len(levels)
        s2 = s
        flat_field = None
        for k, index_name in enumerate(levels):
            if flat_field:
                # Generate flat field names
                flat_field = str(flat_field) + '_' + str(index_name)
            else:
                flat_field = index_name
            # Upper levels
            if k < num_levels - 1:
                i = get_idx(s2, index_name)
                if i < 0:
                    new_index_name = {'Header': str(index_name),
                             'columns': []}
                    s2.append(new_index_name)
                    i = len(s2) - 1
                s2 = s2[i]['columns']
            # Lowest level
            else:
                flat_field = flat_field.replace('.', '_')
                new_index_name = {'accessor': flat_field,
                         'Header': str(index_name)}
                s2.append(new_index_name)
    return s

def ed_build_colDefs(df, verbose=True):
    colDefs = [{'accessor': str(col).replace('.','_'), 'Header': col} for col in df.columns]
    return colDefs


def ed_flatten_mi_col_df(dfmi):
    """
    create flattend dataframe
    multi index col ('a', 'b', 'c') turned to 'a_b_c'
    """
    df = dfmi.copy()
    cols = df.columns.map(lambda x: '_'.join([str(i) for i in x]))
    df.columns = cols
    return df

def ed_is_multiindex_col_df(df):
    if isinstance(df, pd.core.frame.DataFrame):
        if isinstance(df.columns, pd.core.indexes.multi.MultiIndex):
            return True
    return False

def ed_is_df(data):
    if isinstance(data, pd.core.frame.DataFrame):
        return True
    return False

def ed_is_multiindex_row_df(df):
    if ed_is_df(df):
        if isinstance(df.index, pd.core.indexes.multi.MultiIndex):
            return True
    return False

def ed_format_data_for_visualization(df_data):
    for col_name, col in df_data.items():
        if is_datetime64_any_dtype(col):
            # Check if it contains only dates
            if ((df_data[col_name].dt.floor('d') == df_data[col_name]) | (df_data[col_name].isnull())).all():
                df_data[col_name] =  df_data[col_name].dt.strftime('%Y-%m-%d')
            # Check if it contains only times (commented out given the default notebook diplay does not print this)
            #elif ( (df_data[col_name].dt.date == pd.Timestamp('now').date()) | (df_data[col_name].isnull()) ).all():
            #    df_data[col_name] =  df_data[col_name].dt.strftime('%H:%M:%S')
            else:
                df_data[col_name] =  df_data[col_name].dt.strftime('%Y-%m-%d %H:%M:%S')
            
            df_data[col_name] = df_data[col_name].fillna('NaT')
        # Check for bool before numeric, given booleans return tru to is_numeric
        elif is_bool_dtype(col):
            df_data[col_name] = df_data[col_name].astype('str').replace('nan','NaN')
        elif is_numeric_dtype(col):
            df_data[col_name] = df_data[col_name].fillna('NaN')
            pass
        else:
            #If not handled, treat as a string
            df_data[col_name] = df_data[col_name].astype('str').replace('nan','NaN')

def ed_prep_data_for_visualization(dfmi,index=False, sortby=None, ascending=False, page=1, page_size=30):
    """
    Prepare multiindex dataframe (data) and options
    to display it with corresponding row grouping and
    column grouping
    To do that the dataframe is modified
    + multi index columns are flattened
    + multi index rows are made regular columns
    """

    df_data = dfmi.copy()
    if sortby != None:
        df_data = df_data.sort_values(by=sortby, ascending=ascending)
    
    # Abreviations: mi is multi index

    # 1. Adjust size
    # First get real size
    n_rows =  df_data.shape[0]
    n_columns =  df_data.shape[1]
    # Hide columns for very wide dataframes
    displayed_columns = n_columns
    if n_columns > 200:
        df_data = df_data.iloc[:,:200]
        displayed_columns = 200

    # Get number of row & cols for current page
    row_start = (page-1)*page_size
    row_end = page*page_size
    df_data = df_data.iloc[row_start:row_end,:]
    
    # 2. Handle multi-level columns
    # Check it ther are multi-level columns, and generate the column definitions
    if ed_is_multiindex_col_df(df_data):
        # Build multi-level column definitions to be used by the frontend grid
        columnDefs_col = ed_build_colDefs_for_mi_cols(df_data)
        # Create a unique name for each column by composing the names of all the levels
        df_data = ed_flatten_mi_col_df(df_data)
    else:
        columnDefs_col = ed_build_colDefs(df_data)
    
    # 3. Handle multi-index rows
    if ed_is_multiindex_row_df(df_data):
        columnDefs_row = [{'accessor': str(col).replace('.','_'), 'Header': col} for col in list(df_data.index.names)]
        df_data = df_data.reset_index()
    else:
        # There is already a column named index in the dataframe
        if 'index' in df_data.columns:
            # Name the index pd_index given there is already a column named index
            columnDefs_row = [{'accessor': 'level_0', 'Header': 'pd_index'}]
            df_data = df_data.reset_index()
        # The index has a name
        elif df_data.index.name != None:
            columnDefs_row = [{'accessor': df_data.index.name, 'Header': df_data.index.name}]
            df_data = df_data.reset_index()
        # The index has no name
        else:
            columnDefs_row = [{'accessor': 'index', 'Header': 'index'}]
            df_data = df_data.reset_index()

    # 4. Get the col types before transforming
    names = [col for col in df_data.columns]
    types = [dtype.name for dtype in df_data.dtypes]
    col_types = [{'name': name, 'type': dtype} for name,dtype in zip(names,types)]

    # 5. Ensure data can be read in the frontend
    ed_format_data_for_visualization(df_data)
    # If there are any dots, remove them because react-table can't handle them
    # Only relevatn for single index columns case. 
    df_data.columns = df_data.columns.map(lambda x: str(x).replace('.','_'))
    
    # 6.Prepare output
    # Put together the columns from flattening rows and from flattinging columns
    new_columnDefs = columnDefs_row + columnDefs_col
    
    # 7. Set the json format. 
    df_data = df_data.to_dict(orient='records')
    
    result = {
        'data': df_data, 
        'columns': new_columnDefs,
        'columnTypes': col_types,
        'shape' : {
            'rows': n_rows,
            'columns': n_columns,
            'displayedColumns' : displayed_columns
        }  
    }
    
    # 3. Return as JSON
    return json.dumps(result, ensure_ascii=False, allow_nan=False)
`;


/***/ }),

/***/ "./lib/core/kernelconnector.js":
/*!*************************************!*\
  !*** ./lib/core/kernelconnector.js ***!
  \*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "KernelConnector": () => (/* binding */ KernelConnector)
/* harmony export */ });
/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/signaling */ "webpack/sharing/consume/default/@lumino/signaling");
/* harmony import */ var _lumino_signaling__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_signaling__WEBPACK_IMPORTED_MODULE_0__);
// SOURCE: https://github.com/lckr/jupyterlab-variableInspector

/**
 * Connector class that handles execute request to a kernel
 */
class KernelConnector {
    constructor(options) {
        this._kernelRestarted = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_0__.Signal(this);
        this._kernelShutDown = new _lumino_signaling__WEBPACK_IMPORTED_MODULE_0__.Signal(this);
        this._session = options.session;
        this._session.statusChanged.connect((sender, new_status) => {
            switch (new_status) {
                case "restarting":
                case "autorestarting":
                    this._kernelRestarted.emit(this._session.ready);
                default:
                    break;
            }
        });
        // This is useful if we want to support manually shutind down and restarting Kernels, which we won't support for the moment for simplif
        this._session.connectionStatusChanged.connect((sender, connectionStatus) => {
            console.log('Debug: Connection status ->', connectionStatus);
            switch (connectionStatus) {
                case "connected":
                case "disconnected":
                    this._kernelShutDown.emit(this._session.ready);
                default:
                    break;
            }
        });
    }
    get kernelRestarted() {
        return this._kernelRestarted;
    }
    get kernelShutDown() {
        return this._kernelShutDown;
    }
    get kernelLanguage() {
        return this._session.session.kernel.info.then(infoReply => {
            return infoReply.language_info.name;
        });
    }
    get kernelName() {
        return this._session.kernelDisplayName;
    }
    /**
     *  A Promise that is fulfilled when the session associated w/ the connector is ready.
     */
    get ready() {
        return this._session.ready;
    }
    /**
     *  A signal emitted for iopub messages of the kernel associated with the kernel.
     */
    get iopubMessage() {
        return this._session.iopubMessage;
    }
    /**
     * Executes the given request on the kernel associated with the connector.
     * @param content: IExecuteRequestMsg to forward to the kernel.
     * @param ioCallback: Callable to forward IOPub messages of the kernel to.
     * @returns Promise<KernelMessage.IExecuteReplyMsg>
     */
    fetch(content, ioCallback) {
        const kernel = this._session.session.kernel;
        if (!kernel) {
            return Promise.reject(new Error("Require kernel to perform variable inspection!"));
        }
        let future = kernel.requestExecute(content);
        future.onIOPub = ((msg) => {
            ioCallback(msg);
        });
        return future.done;
    }
    execute(content) {
        return this._session.session.kernel.requestExecute(content);
    }
}


/***/ }),

/***/ "./lib/datavisualizer/datavisualizer.js":
/*!**********************************************!*\
  !*** ./lib/datavisualizer/datavisualizer.js ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "DataVisualizerWidget": () => (/* binding */ DataVisualizerWidget)
/* harmony export */ });
/* harmony import */ var abortcontroller_polyfill__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! abortcontroller-polyfill */ "webpack/sharing/consume/default/abortcontroller-polyfill/abortcontroller-polyfill");
/* harmony import */ var abortcontroller_polyfill__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(abortcontroller_polyfill__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/apputils */ "webpack/sharing/consume/default/@jupyterlab/apputils");
/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var react_table__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-table */ "webpack/sharing/consume/default/react-table/react-table");
/* harmony import */ var react_table__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_table__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var amplitude_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! amplitude-js */ "webpack/sharing/consume/default/amplitude-js/amplitude-js");
/* harmony import */ var amplitude_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(amplitude_js__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _utils_stringUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/stringUtils */ "./lib/utils/stringUtils.js");
/* harmony import */ var _assets_svgs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../assets/svgs */ "./lib/assets/svgs.js");
/* harmony import */ var _components_paginationPanel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/paginationPanel */ "./lib/components/paginationPanel.js");
/* harmony import */ var _components_noDataLoadedComponent__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/noDataLoadedComponent */ "./lib/components/noDataLoadedComponent.js");
/* harmony import */ var _components_reloadButton__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/reloadButton */ "./lib/components/reloadButton.js");










/**
 * React component for a counter.
 *
 * @returns The React component
 */
//A controller object that allows to abort requests as and when desired
const controller = new window.AbortController();
const signal = controller.signal;
const getOptions = (from, to, counter, label) => {
    const array = [];
    for (let i = from; i <= to; i += counter) {
        array.push({ value: i, label: `${label} ${i}` });
    }
    return array;
};
const defaultPanelState = {
    currentPageOptions: [],
    pageSizeOptions: getOptions(10, 40, 5, 'Show'),
    currentPageSelection: { value: 1, label: 'Page 1' },
    pageSizeSelection: { value: 25, label: 'Show 25' }
};
const DataVisualizerComponent = (props) => {
    const [columns, setColumns] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)([]);
    const [data, setData] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)([]);
    const [showTable, setShowTable] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false);
    const [activeTab, setActiveTab] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(0);
    const [columnTypes, setColumnTypes] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)([]);
    const [shape, setShape] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)({});
    const [columnSizes, setColumnSizes] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)({});
    const [sortConfig, setSortConfig] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)({ sortBy: undefined, ascending: undefined });
    const [loading, setLoading] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false);
    const [paginationPanelState, setPaginationPanelState] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(Object.assign({}, defaultPanelState));
    const resetState = () => {
        console.log('RESETING DATA VISUALIZER STATE');
        setColumns([]);
        setData([]);
        setShowTable(false);
        setActiveTab(0);
        setPaginationPanelState(Object.assign({}, defaultPanelState));
        setSortConfig({ sortBy: undefined, ascending: undefined });
        setColumnSizes({});
        setColumnTypes([]);
        setShape({});
    };
    if (props.logic.resetStateDatavisualizerFlag === true) {
        resetState();
        props.logic.resetStateDatavisualizerFlag = false;
    }
    /*--------------------------------------------------------------------
      PAGINATION: Set the page number the user is seeing
      Triggered when:
        - shape['rows']: When the size of the data changes
        - props.logic.dataframeSelection: The user changes the dataframe
    ----------------------------------------------------------------------*/
    (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {
        const pageSize = Math.ceil(shape['rows'] / paginationPanelState.pageSizeSelection.value);
        setPaginationPanelState(Object.assign(Object.assign({}, defaultPanelState), { currentPageOptions: getOptions(1, pageSize, 1, 'Page') }));
    }, [shape['rows'], props.logic.dataframeSelection]);
    /*--------------------------------------------------------------------
      VARIABLES TAB: Display variables
      Triggered when:
        - activeTab: Change the variables tab
        - props.logic.variablesLoaded: Change in variables loaded
    ----------------------------------------------------------------------*/
    (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {
        const variables = props.logic.variablesLoaded;
        if (isVariableTab(activeTab)) {
            try {
                const keys = Object.keys(variables[0]);
                const columns = keys.map((key, index) => ({
                    accessor: key,
                    Header: key,
                    Cell: (props) => (0,_utils_stringUtils__WEBPACK_IMPORTED_MODULE_5__.getUSDString)(props.value),
                    //if there are custom sizes for columns - apply them
                    width: columnSizes['variables'] ? columnSizes['variables'][index]
                        // else - use default 160 : 80 : 160 sizes for columns
                        : (index === 0 || index === 2) ? 160 : 80
                }));
                setColumns([...columns]);
                setData([...variables]);
            }
            catch (e) {
                props.logic.dataframeSelection = props.logic.dataframesLoaded[0].value;
                setActiveTab(0);
                console.log('Error switching to the variables tab');
            }
        }
    }, [activeTab, props.logic.variablesLoaded]);
    /*--------------------------------------------------------------------
      DATAFRAMES TABS: Display variables
      Triggered when:
        - activeTab: Change the variables tab
        - dataframesLoaded: User load new or delete dataframe
        - sortConfig: User select one of sort options
        - paginationPanelState: User interacts with pagination panel
    ----------------------------------------------------------------------*/
    (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {
        const getDataForVisualization = async () => {
            try {
                const dataframes = props.logic.dataframesLoaded;
                if (dataframes[activeTab]) {
                    //start data loading (get dataframes from backend)
                    setLoading(true);
                    const result = await props.logic.pythonGetDataForVisualization(dataframes[activeTab].value, sortConfig.sortBy, sortConfig.ascending, paginationPanelState.currentPageSelection.value, paginationPanelState.pageSizeSelection.value);
                    // Add missing methods and properties
                    const columns = result['columns'].map((column, index) => {
                        var _a;
                        if (!columnSizes[dataframes[activeTab].value]) {
                            if (index === 0) {
                                column.width = 55;
                            }
                        }
                        else {
                            // eslint-disable-next-line prettier/prettier
                            column.width = (_a = columnSizes[dataframes[activeTab].value][index]) !== null && _a !== void 0 ? _a : 80;
                        }
                        column.Cell = (props) => (0,_utils_stringUtils__WEBPACK_IMPORTED_MODULE_5__.getUSDString)(props.value);
                        return column;
                    });
                    setShowTable(true);
                    setColumns([...columns]);
                    setData([...result['data']]);
                    setColumnTypes([...result['columnTypes']]);
                    setShape(Object.assign({}, result['shape']));
                }
            }
            catch (e) {
                setShowTable(false);
            }
            finally {
                //loading is finished (no matter success or not)
                setLoading(false);
            }
        };
        //wrap getDataForVisualization() function in cancelable Promise
        const getDataForVisualizationWrapper = (signal) => {
            return new Promise((resolve, reject) => {
                getDataForVisualization().then(() => resolve());
                //if abort() method was called we reject this Promise
                signal.addEventListener('abort', () => {
                    reject('Promise aborted');
                });
            });
        };
        const cancelPromise = () => {
            controller.abort();
        };
        if (loading) {
            cancelPromise();
            //else let it (the last one) be resolved
        }
        else {
            getDataForVisualizationWrapper(signal).catch();
        }
    }, [
        activeTab,
        props.logic.dataframesLoaded,
        sortConfig,
        paginationPanelState.pageSizeSelection,
        paginationPanelState.currentPageSelection
    ]);
    // Default size of columns
    const defaultColumn = react__WEBPACK_IMPORTED_MODULE_2___default().useMemo(() => ({
        minWidth: 30,
        width: 80
    }), []);
    const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = (0,react_table__WEBPACK_IMPORTED_MODULE_3__.useTable)({ columns, data, defaultColumn }, react_table__WEBPACK_IMPORTED_MODULE_3__.useBlockLayout, react_table__WEBPACK_IMPORTED_MODULE_3__.useResizeColumns);
    const closeDropdownMenus = (menuName) => {
        const dropdowns = document.querySelectorAll(menuName);
        const element = Array.from(dropdowns).find(element => element.className.includes('show'));
        if (element) {
            element.className = element.className.replace(' show', '');
        }
    };
    const openDropdownMenu = (menuToOpen, menusToClose) => {
        const dropdown = document.querySelector(menuToOpen);
        if (dropdown.className.indexOf('show') === -1) {
            dropdown.className += ' show';
        }
        else {
            closeDropdownMenus(menusToClose);
        }
    };
    const onBlur = (e, menusToClose) => {
        const target = e.relatedTarget;
        if (!target || (target === null || target === void 0 ? void 0 : target.className) !== 'dropdown-item') {
            closeDropdownMenus(menusToClose);
        }
    };
    // Delte a dataframe
    const deleteTab = async (table, menusToClose) => {
        console.log('Delete tab');
        await props.logic.pythonRemoveData(table);
        closeDropdownMenus(menusToClose);
        // If more than one tabs go back to the previous tab
        if (props.logic.dataframesLoaded.length >= 1 && activeTab != 0) {
            console.log('Go to previous tab');
            setActiveTab(activeTab - 1);
        }
    };
    const deleteVariable = async (variable) => {
        await props.logic.pythonRemoveData(variable);
        if (props.logic.variablesLoaded.length === 0) {
            setActiveTab(0);
            props.logic.dataframeSelection = props.logic.dataframesLoaded[0].value;
        }
    };
    const isLastRow = (row) => {
        return row === headerGroups.length - 1;
    };
    const isVariableTab = (tab) => {
        return tab === -1;
    };
    const onTabClick = (index) => {
        setActiveTab(index);
        setPaginationPanelState(Object.assign({}, defaultPanelState));
        props.logic.dataframeSelection = props.logic.dataframesLoaded[index].value;
        if (props.logic.production && props.logic.shareProductData) {
            amplitude_js__WEBPACK_IMPORTED_MODULE_4___default().getInstance()
                .logEvent('Datavisualizer: change tab', {
                index: index
            });
        }
        setSortConfig({ sortBy: undefined, ascending: undefined });
    };
    const onMouseUpHandler = () => {
        const columnHeaders = document.querySelectorAll('div.th');
        const data = isVariableTab(activeTab)
            ? 'variables'
            : props.logic.dataframesLoaded[activeTab].value;
        const getWidths = () => {
            const res = [];
            for (const node of columnHeaders) {
                res.push(node.clientWidth);
            }
            return res;
        };
        if (data) {
            setColumnSizes(Object.assign(Object.assign({}, columnSizes), { [data]: getWidths() }));
        }
    };
    const sortColumn = (sortBy, ascending, menusToClose) => {
        setSortConfig({ sortBy, ascending });
        closeDropdownMenus(menusToClose);
    };
    const getSortArrow = (sorted) => {
        switch (sorted) {
            case true: return '↑';
            case false: return '↓';
            default: return '';
        }
    };
    const goToThePage = (page) => {
        setPaginationPanelState(Object.assign(Object.assign({}, paginationPanelState), { currentPageSelection: paginationPanelState.currentPageOptions[page - 1] }));
    };
    return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "full-height-container" },
        " ",
        showTable ?
            react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "full-height-container" },
                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("nav", { className: "scroll-nav" },
                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "dropdown-container" },
                        props.logic.variablesLoaded.length > 0 &&
                            react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { type: "button", className: `tab-button ${isVariableTab(activeTab) && 'tab-button_active'} variables-button`, onClick: () => setActiveTab(-1) }, "Variables"),
                        props.logic.dataframesLoaded.map((dataframe, index) => {
                            return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "dropdown", id: 'dropdown-' + index, key: 'dropdown-' + index },
                                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { type: "button", className: `tab-button ellipsized ${activeTab === index
                                        ? 'tab-button_active'
                                        : 'tab-button_inactive'}`, onClick: () => { onTabClick(index); }, title: dataframe.label }, (0,_utils_stringUtils__WEBPACK_IMPORTED_MODULE_5__.cutString)(dataframe.label, 20)),
                                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { type: "button", className: `dropdown-button dropdown-toggle ${activeTab === index
                                        ? 'tab-button_active'
                                        : 'tab-button_inactive'}`, onClick: () => openDropdownMenu(`#dropdown-${index} .dropdown-menu`, '.dropdown-menu'), onBlur: (e) => onBlur(e, '.dropdown-menu'), key: 'dropdown-button' + index },
                                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("span", { className: "dropdown-arrow" })),
                                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "dropdown-menu", key: 'dropdown-menu' + index },
                                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("a", { className: "dropdown-item", href: "#", onClick: () => deleteTab(dataframe.label, '.dropdown-menu') }, "Delete table"))));
                        })),
                    isVariableTab(activeTab)
                        ? react__WEBPACK_IMPORTED_MODULE_2___default().createElement("p", { className: "disclaimer" },
                            "Shape: ",
                            (0,_utils_stringUtils__WEBPACK_IMPORTED_MODULE_5__.separateThousands)(props.logic.variablesLoaded.length),
                            " rows.")
                        : react__WEBPACK_IMPORTED_MODULE_2___default().createElement("p", { className: "disclaimer" },
                            "Data shape: ",
                            (0,_utils_stringUtils__WEBPACK_IMPORTED_MODULE_5__.separateThousands)(shape['rows']),
                            " rows and",
                            ' ',
                            shape['columns'],
                            " columns. ",
                            shape['columns'] > shape['displayedColumns']
                                ? 'Only ' + shape['displayedColumns'] + ' displayed.'
                                : '')),
                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "tab-item" },
                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", Object.assign({}, getTableProps(), { className: "div-table div-table-striped", role: "table", onMouseUp: onMouseUpHandler }),
                        react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "thead-dark sticky", role: "thead" }, headerGroups.map((headerGroup, rowIndex) => (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", Object.assign({}, headerGroup.getHeaderGroupProps(), { className: "tr", role: "tr" }),
                            isLastRow(rowIndex) && !isVariableTab(activeTab) &&
                                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "header-white-row" }),
                            headerGroup.headers.map((column, index) => (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", Object.assign({}, column.getHeaderProps(), { className: "th", role: "th", id: `dropdown-header-${column.Header}-${index}` }),
                                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: `ellipsized header ${index === 0 && column.Header === 'index' ? 'index-column-header' : ''}`, title: column.Header },
                                    column.render('Header'),
                                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("p", { className: `sort-arrow ${column.Header === sortConfig.sortBy ? 'show' : ''}` }, getSortArrow(sortConfig.ascending)),
                                    column.Header !== 'index' && !isVariableTab(activeTab) &&
                                        react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { className: "dropdown-header-button", onClick: () => openDropdownMenu(`#dropdown-header-${column.Header}-${index} .dropdown-header-menu`, '.dropdown-header-menu'), onBlur: (e) => onBlur(e, '.dropdown-header-menu') },
                                            react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "dropdown-arrow" }))),
                                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", Object.assign({}, column.getResizerProps(), { className: "delimiter-wrapper" }),
                                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "delimiter" })),
                                isLastRow(rowIndex) && (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", null,
                                    " ",
                                    !isVariableTab(activeTab) &&
                                        react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "data-type-info" }, columnTypes[index] && columnTypes[index].type))),
                                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { className: "dropdown-header-menu", key: 'dropdown-menu' + index },
                                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("p", { className: "sort-header" }, "SORT"),
                                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("a", { className: "dropdown-item", href: "#", onClick: () => { sortColumn(column.Header, true, '.dropdown-header-menu'); } }, "Ascending \u2191"),
                                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("a", { className: "dropdown-item", href: "#", onClick: () => sortColumn(column.Header, false, '.dropdown-header-menu') }, "Descending \u2193"),
                                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("a", { className: "dropdown-item", href: "#", onClick: () => sortColumn(undefined, undefined, '.dropdown-header-menu') }, "Reset"))))))))),
                        react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", Object.assign({}, getTableBodyProps(), { className: "tbody", role: "tbody" }), rows.map(row => {
                            prepareRow(row);
                            return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", Object.assign({}, row.getRowProps(), { className: "tr", role: "tr" }),
                                row.cells.map(cell => {
                                    return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", Object.assign({}, cell.getCellProps(), { title: (0,_utils_stringUtils__WEBPACK_IMPORTED_MODULE_5__.getUSDString)(cell.value), className: "td ellipsized", role: "td" }), cell.render('Cell')));
                                }),
                                react__WEBPACK_IMPORTED_MODULE_2___default().createElement("button", { className: "trash-bin-button", onClick: async () => await deleteVariable(row.cells[0].value) }, isVariableTab(activeTab) && _assets_svgs__WEBPACK_IMPORTED_MODULE_6__.binIcon)));
                        })))),
                (!isVariableTab(activeTab)) &&
                    react__WEBPACK_IMPORTED_MODULE_2___default().createElement("div", { style: { display: 'flex' } },
                        react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_paginationPanel__WEBPACK_IMPORTED_MODULE_7__.PaginationPanel, { pageSize: Math.ceil(shape['rows'] / paginationPanelState.pageSizeSelection.value), pageSizeSelectionConfig: {
                                options: paginationPanelState.pageSizeOptions,
                                selectedOption: paginationPanelState.pageSizeSelection,
                                onSelect: (value) => {
                                    const pageSize = Math.ceil(shape['rows'] / value.value);
                                    setPaginationPanelState(Object.assign(Object.assign({}, paginationPanelState), { currentPageOptions: getOptions(1, pageSize, 1, 'Page'), pageSizeSelection: value, currentPageSelection: paginationPanelState.currentPageSelection.value > pageSize
                                            ? { value: pageSize, label: 'Page ' + (pageSize) }
                                            : paginationPanelState.currentPageSelection }));
                                }
                            }, currentPageConfig: {
                                options: paginationPanelState.currentPageOptions,
                                selectedOption: paginationPanelState.currentPageSelection,
                                onSelect: (value) => setPaginationPanelState(Object.assign(Object.assign({}, paginationPanelState), { currentPageSelection: value }))
                            }, onFirstClick: () => goToThePage(1), onLastClick: () => goToThePage(Math.ceil(shape['rows'] / paginationPanelState.pageSizeSelection.value)), onPrevClick: () => goToThePage(paginationPanelState.currentPageSelection.value - 1), onNextClick: () => goToThePage(paginationPanelState.currentPageSelection.value + 1) }),
                        react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_reloadButton__WEBPACK_IMPORTED_MODULE_8__.ReloadButton, { title: "Reload", onClick: resetState })))
            : react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_components_noDataLoadedComponent__WEBPACK_IMPORTED_MODULE_9__.EmptyStateComponent, { onReloadButtonClick: resetState })));
};
// This allows to re-render the component whene there is a signal emitted (Read about signals here https://jupyterlab.readthedocs.io/en/stable/developer/patterns.html)
// This is the recommended approach from the Jupyter team: https://jupyterlab.readthedocs.io/en/stable/developer/virtualdom.html
// Inspired by this example: https://github.com/jupyterlab/jupyterlab/blob/master/docs/source/developer/virtualdom.usesignal.tsx
// ...and this example: https://github.com/jupyterlab/jupyterlab/blob/f2e0cde0e7c960dc82fd9b010fcd3dbd9e9b43d0/packages/running/src/index.tsx#L157-L159
const UseSignalComponent = (props) => {
    return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.UseSignal, { signal: props.signal }, () => react__WEBPACK_IMPORTED_MODULE_2___default().createElement(DataVisualizerComponent, { logic: props.logic })));
};
/**
 * A Counter Lumino Widget that wraps a CounterComponent.
 */
class DataVisualizerWidget extends _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ReactWidget {
    constructor(backend) {
        super();
        /**
         * Constructs a new CounterWidget.
         */
        this.backend = null;
        this.addClass('jp-dataviz');
        this.backend = backend;
    }
    render() {
        return (react__WEBPACK_IMPORTED_MODULE_2___default().createElement(UseSignalComponent, { signal: this.backend.signal, logic: this.backend }));
    }
}


/***/ }),

/***/ "./lib/datavisualizer/outputPanel.js":
/*!*******************************************!*\
  !*** ./lib/datavisualizer/outputPanel.js ***!
  \*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "OutputPanel": () => (/* binding */ OutputPanel)
/* harmony export */ });
/* harmony import */ var _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/outputarea */ "webpack/sharing/consume/default/@jupyterlab/outputarea");
/* harmony import */ var _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lumino/widgets */ "webpack/sharing/consume/default/@lumino/widgets");
/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _labIcons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../labIcons */ "./lib/labIcons.js");
// Modified from https://github.com/jupyterlab/extension-examples/blob/master/kernel-output/src/panel.ts



/**
 * The class name added to the example panel.
 */
const PANEL_CLASS = 'jp-RovaPanel';
/**
 * A panel with the ability to add other children.
 */
class OutputPanel extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_1__.StackedPanel {
    constructor(manager, rendermime) {
        super();
        this.addClass(PANEL_CLASS);
        this.id = 'kernel-output-panel';
        this.title.icon = _labIcons__WEBPACK_IMPORTED_MODULE_2__.chartIcon;
        //this.title.label = ' Charts';
        this.title.closable = true;
        this._outputareamodel = new _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_0__.OutputAreaModel();
        this._outputarea = new _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_0__.SimplifiedOutputArea({
            model: this._outputareamodel,
            rendermime: rendermime
        });
        this.addWidget(this._outputarea);
    }
    dispose() {
        super.dispose();
    }
    execute(code, session) {
        _jupyterlab_outputarea__WEBPACK_IMPORTED_MODULE_0__.SimplifiedOutputArea.execute(code, this._outputarea, session)
            .then((msg) => {
            console.log('OP: Kernel message', msg);
        })
            .catch(reason => console.log('ERROR:', reason));
    }
    addOutput(code, session, cell) {
        const clone = cell.cloneOutputArea();
        if (this.widgets.length != 0) {
            this.widgets[0].dispose();
        }
        this.addWidget(clone);
    }
    onCloseRequest(msg) {
        super.onCloseRequest(msg);
        this.dispose();
    }
}


/***/ }),

/***/ "./lib/formulabar/codeGeneration.js":
/*!******************************************!*\
  !*** ./lib/formulabar/codeGeneration.js ***!
  \******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "generatePythonCode": () => (/* binding */ generatePythonCode)
/* harmony export */ });
const mapFormResponseToPythonCode = (fieldInput, fieldSchema, dataframeSelection) => {
    console.log('field fieldInput', fieldInput);
    console.log('field schema', fieldSchema);
    console.log('field schema type', typeof fieldSchema['$ref']);
    /*----------------------------------------------------------------------------------------------------------
      CASE A: Custom code generation style
    ----------------------------------------------------------------------------------------------------------*/
    if (typeof fieldSchema['codegenstyle'] !== 'undefined') {
        console.log('1. CodeGenStyle detected');
        const codeGenStyle = fieldSchema['codegenstyle'];
        /*----------------------------------------------------------------------------------------------------------
          VARIABLES
        ----------------------------------------------------------------------------------------------------------*/
        if (codeGenStyle === 'variable') {
            console.log('1.1 Variable codegenstyle');
            return fieldInput;
        }
        /*----------------------------------------------------------------------------------------------------------
          SERIES COLUMN
        ----------------------------------------------------------------------------------------------------------*/
        // CASE where a series is passed as df[Series_Name]
        else if (codeGenStyle === 'seriesColumn') {
            console.log('1.2 Column as series');
            return dataframeSelection + '["' + fieldInput + '"]';
        }
        /*----------------------------------------------------------------------------------------------------------
          SERIES COLUMN LIST
        ----------------------------------------------------------------------------------------------------------*/
        // CASE where a series is passed as [df[Series_Name_1], df[Series_Name_2]]
        else if (codeGenStyle === 'seriesColumnList') {
            let seriesColumnList = fieldInput.map((listElement) => {
                return dataframeSelection + '["' + listElement + '"]';
            });
            console.log('1.2 Column as series list');
            return '[' + seriesColumnList.join(',') + ']';
        }
        console.log('WARNING: No codeGenStyle');
    }
    else if (typeof fieldSchema['$ref'] !== 'undefined') {
        /*----------------------------------------------------------------------------------------------------------
          CASE B: Reference to a column definition
        ----------------------------------------------------------------------------------------------------------*/
        // Specific hardcoded cases
        console.log('2. REF detected');
        if (fieldSchema['$ref'].includes('columns')) {
            console.log('2.1 Column multi-select detected');
            return JSON.stringify(fieldInput);
        }
        else if (fieldSchema['$ref'] === '#/definitions/column') {
            console.log('2.2 Column single-select detected');
            return '"' + fieldInput + '"';
        }
        console.log('WARNING: No ref found');
    }
    else if (fieldSchema['type'] === 'array') {
        /*----------------------------------------------------------------------------------------------------------
          CASE C: Array
        ----------------------------------------------------------------------------------------------------------*/
        console.log('3. Array detected');
        // Array of variables, i.e. no quotation marks
        if (typeof fieldSchema.items['codegenstyle'] !== 'undefined') {
            console.log('3.1 Array of variables');
            const codeGenStyle = fieldSchema.items['codegenstyle'];
            if (codeGenStyle === 'variable') {
                return ('[' + fieldInput.map((item) => item.replace('/\\"/g', '')) + ']');
            }
        }
        // Standard array of strings
        else if (fieldSchema.items['type'] === 'string') {
            console.log('3.2 Array of strings');
            return JSON.stringify(fieldInput);
        }
        else if (fieldSchema.items['type'] === 'number') {
            console.log('3.3 Array of numbers');
            return JSON.stringify(fieldInput);
        }
    }
    else if (fieldSchema['type'] === 'string') {
        /*----------------------------------------------------------------------------------------------------------
          CASE E: Standard jsonschema form types STRING/NUMBER
        ----------------------------------------------------------------------------------------------------------*/
        console.log('4. String detected');
        console.log('String detected');
        return '"' + fieldInput + '"';
    }
    else if (fieldSchema['type'] === 'number') {
        console.log('5. Number detected');
        return fieldInput;
    }
    console.log('---------------------------------------');
};
// Generate python code and write in the notebook
const generatePythonCode = (formResponse, dataframeSelection) => {
    // Commented out python implementation of the same functionality
    //logic.pythonGenerateCodeAndRun(formReponse, state.dataframeSelection);
    // COMMENTED OUT CODE IS REPLACED BY PYTHON FUNCTION TO MAKE DEVELOPMENT FASTER
    console.log('------------------- Generating form code -------------------');
    console.log('CG: Data submitted: ', formResponse);
    /*-------------------------------------------------------------------
    Process formula with this pattern:
      resultVariable = caller_object.transformation(parameters)
        1. Generate caller object & transformation selection
        2. Process every parameter input
        3. Assign to result to variable
    --------------------------------------------------------------------*/
    const formData = formResponse.formData;
    let transformationSelection = formResponse.schema.function;
    let callerObject = formResponse.schema.callerObject;
    // The result will be saved in one variable: resultVariable = object.transformation(parameters)
    // This variable is of type dataframe by default
    let resultVariable = '';
    /*-------------------------------------------------------------------
      1. Generate caller object
    --------------------------------------------------------------------*/
    // Compose the caller object
    if (typeof callerObject !== 'undefined') {
        if (callerObject.includes('DataFrame') === true) {
            // If there is no dataframe selection, calling from pandas
            console.log('CG: Caller is Dataframe object');
            callerObject = callerObject.replace('DataFrame', dataframeSelection);
        }
        if (callerObject.includes('Series') === true) {
            // In case of a series, the formula becomes df[series] = df[series].function(params)
            console.log('CG: Caller is Series object');
            // Replace the callerobject series placeholder with the value from the column parameter
            const seriesString = '"' + formData['column'] + '"';
            callerObject = callerObject.replace('Series', seriesString);
        }
    }
    // In the initial state to load data, no explicit transformation has been selected by the user
    // thus, we need to initalize it
    if (!transformationSelection) {
        transformationSelection = 'read_csv';
    }
    let formula;
    let transformationType = 'function';
    // Formula that will be generated in the form of: object.transformation(parameters)
    if (typeof formResponse.schema.transformationType !== 'undefined') {
        console.log('CG: Transformation type defined');
        transformationType = formResponse.schema.transformationType;
    }
    if (transformationType === 'property') {
        formula = callerObject + '.' + transformationSelection;
    }
    else if (typeof callerObject === 'undefined') {
        formula = transformationSelection + '(';
    }
    else {
        formula = callerObject + '.' + transformationSelection + '(';
    }
    /*-------------------------------------------------------------------
      2. Determine what the return type will be
    --------------------------------------------------------------------*/
    let returnType = '';
    // Determine the type of the result variable. Default is dataframe
    if (typeof formResponse.schema.returnType !== 'undefined') {
        console.log('CG: Defined return type in schema');
        returnType = formResponse.schema.returnType;
    }
    else {
        if (typeof formResponse.schema.properties['new variable name'] !== 'undefined') {
            returnType = 'variable';
        }
        else if (typeof formResponse.schema.properties['new column name'] !== 'undefined') {
            returnType = 'series';
        }
        else {
            returnType = 'dataframe';
        }
    }
    console.log('CG: Return type', returnType);
    /*-------------------------------------------------------------------
     Use the object selectino dropdown as a parameter input
     E.g. px.line(df, ...)
    --------------------------------------------------------------------*/
    // If there is a selectionAsParameter config and it's set to true,
    // add a first parameter that is equal to the dataframe selection
    if (typeof formResponse.schema.selectionAsParameter !== 'undefined'
        && formResponse.schema.selectionAsParameter === true) {
        formula = formula + dataframeSelection + ',';
    }
    /*-------------------------------
       MERGE ALL DEPENDENCIES
    --------------------------------*/
    let effectivePropertiesSchema = formResponse.schema.properties;
    console.log('CG: effectivePropertiesSchema', effectivePropertiesSchema);
    if (typeof formResponse.schema.dependencies !== 'undefined') {
        for (const dependencyParameter in formResponse.schema.dependencies) {
            console.log('CG: Merging dependency for ', dependencyParameter);
            // Get dependency selected by the user
            const selectedDependency = formData[dependencyParameter];
            console.log('CG: Dependency input value ', selectedDependency);
            // Find the index of that dependency, i.e. is it the 0th, 1st, 2nd element
            const selectedDependencyEnumIndex = formResponse.schema.properties[dependencyParameter]['enum'].findIndex(element => element === selectedDependency);
            console.log('CG: Selected dependency item ', selectedDependencyEnumIndex);
            // Copy the schema from the dependency object
            const schemaFromDependency = formResponse.schema.dependencies[dependencyParameter]['oneOf'][selectedDependencyEnumIndex].properties;
            // Delete the property that is used to stitch schemas
            // In the dependency object there is a property that indicates which dependency should be rendered. 
            // This needs to be removed when merging with the main schema according to selected dependency
            delete schemaFromDependency[dependencyParameter];
            console.log('CG: Dependency object to append', schemaFromDependency);
            effectivePropertiesSchema = Object.assign(schemaFromDependency, effectivePropertiesSchema);
        }
    }
    console.log('CG: Effective Property Schema', effectivePropertiesSchema);
    /*-------------------------------------------------------------------
      3. Process every parameter input
    --------------------------------------------------------------------*/
    // Process every input
    let parameterCounter = 0;
    for (const parameterName in formData) {
        const startNewLine = '\n    ';
        const fieldInput = formData[parameterName];
        let fieldSchema = effectivePropertiesSchema[parameterName];
        console.log('CG: Parameter', parameterName);
        /*----------------------------------------------------------------------------------------------------------
        3.2: Process the result parameters
        ----------------------------------------------------------------------------------------------------------*/
        // Check if we save to a variable or just print in the notebook
        // IF specified by the user, set the name of the result
        if (parameterName === 'new table name') {
            console.log('CG: 3.2 New table name detected');
            if (typeof formData[parameterName] !== 'undefined') {
                console.log('CG: 3.2 User entered table name');
                resultVariable = formData[parameterName].replace(/ /g, '_');
            }
        }
        else if (parameterName === 'new column name' &&
            returnType !== 'print') {
            console.log('CG: 3.2 New column name detected');
            if (typeof formData[parameterName] !== 'undefined') {
                console.log('CG: User entered series name');
                resultVariable =
                    dataframeSelection + '["' + formData[parameterName].replace(/ /g, '_') + '"]';
            }
        }
        else if (parameterName === 'new variable name' && returnType !== 'print') {
            console.log('CG: 3.2 New variable name detected');
            if (typeof formData[parameterName] !== 'undefined') {
                console.log('CG: User entered variable name');
                resultVariable = formData[parameterName].replace(/ /g, '_');
            }
        }
        // IGNORE the fields marked as ignore
        else if (typeof fieldSchema['codegenstyle'] !== 'undefined' &&
            fieldSchema['codegenstyle'] === 'ignore') {
            //ignore
            console.log('CG: Ignore column field');
        }
        /*----------------------------------------------------------------------------------------------------------
        3.3: Handle complex arrays
        ----------------------------------------------------------------------------------------------------------*/
        // Build an object of type {parameterName: value, parameterName:value, ..} with an array consisting of two inputs
        else if (typeof fieldSchema['type'] !== 'undefined' &&
            fieldSchema['type'] === 'array' &&
            typeof fieldSchema['items']['type'] !== 'undefined' &&
            fieldSchema['items']['type'] === 'object') {
            console.log('CG: 3.3 Complex object');
            let parameterDict = '{';
            const mapperProperties = fieldSchema.items.properties;
            // Firs element is the parameterName
            const mapperKey = Object.keys(mapperProperties)[0];
            // Second element is the value
            const mapperValue = Object.keys(mapperProperties)[1];
            console.log('Sub-field schema for parameterName', fieldSchema.items.properties[mapperKey]);
            for (const dict of formData[parameterName]) {
                const parameterName = mapFormResponseToPythonCode(dict[mapperKey], fieldSchema.items.properties[mapperKey], dataframeSelection);
                const value = mapFormResponseToPythonCode(dict[mapperValue], fieldSchema.items.properties[mapperValue], dataframeSelection);
                parameterDict = parameterDict + parameterName + ' : ' + value + ', ';
            }
            parameterDict = parameterDict.substring(0, parameterDict.length - 2);
            parameterDict = parameterDict + '}';
            console.log('Aggregation Dict', parameterDict);
            parameterDict = startNewLine + parameterName + '=' + parameterDict;
            formula = formula + parameterDict + ', ';
            parameterCounter += 1;
        }
        else {
            /*----------------------------------------------------------------------------------------------------------
          3.4: Handle standard fields according to type
          ----------------------------------------------------------------------------------------------------------*/
            console.log('------- MAP FORM RESPONSE:', parameterName);
            const mappedFieldResponse = mapFormResponseToPythonCode(fieldInput, fieldSchema, dataframeSelection);
            formula =
                formula + startNewLine + parameterName + '=' + mappedFieldResponse + ', ';
            console.log('Mapped field', formula);
            parameterCounter += 1;
        }
    }
    // Handle the case of 0 parameters found
    if (parameterCounter !== 0) {
        // Remove last comma and space given there are no more parameters
        formula = formula.substring(0, formula.length - 2);
    }
    // Close parenthesis for functions, leave as is for properties (object.property)
    if (transformationType !== 'property') {
        formula = formula + ')';
    }
    /*-------------------------------------------------------------------
      4. Handle defaults when there is no result variable defined
    --------------------------------------------------------------------*/
    /*------------------------------------
      4.1 Result is a dataframe
    ------------------------------------*/
    if (returnType === 'dataframe') {
        console.log('CG: 3.1 Return type is dataframe');
        // If no target variable, and calling from a given dataframe apply transformation to this dataframe
        if (resultVariable === '' &&
            dataframeSelection !== null &&
            transformationType !== 'dataLoading') {
            console.log('CG: 4.1.1 Result defaults: Use selected dataframe');
            resultVariable = dataframeSelection;
        }
        // else if dataframe not defined (only case is read_csv), name it data
        else if (resultVariable === '' && dataframeSelection === null) {
            console.log('CG: 4.1.2 Result defaults: no dataframe selected');
            resultVariable = 'data';
        }
        // If the variable is written above no need to handle default cases
        else if (resultVariable === '') {
            console.log('CG: 4.1.3 Catch remaining cases');
            resultVariable = 'data';
        }
    }
    else if (returnType === 'series') {
        /*------------------------------------
        4.2 Result is a series
      ------------------------------------*/
        console.log('CG: 4.2 Return type is series');
        // This covers both scenarios df->series and series->series
        let resultColumnName = '';
        // If not defined, change the column that has been selected
        if (resultVariable === '') {
            // Find the column that has a column definition to use
            for (const parameterName in formResponse.schema.properties) {
                const colSchema = formResponse.schema.properties[parameterName];
                if (typeof colSchema['$ref'] !== 'undefined') {
                    console.log('Ref found', colSchema['$ref']);
                    if (colSchema['$ref'] === '#/definitions/column') {
                        console.log('CG: 4.2.1 Result defaults: Using default column');
                        resultColumnName = formData[parameterName];
                        break;
                    }
                }
            }
            if (resultColumnName === '') {
                // This handle the case pandasObject -> series, where a column definition has not been found
                console.log('CG: 4.2.2 Result defaults: No column found');
                resultColumnName = 'new column';
            }
            resultVariable = dataframeSelection + '["' + resultColumnName + '"]';
        }
    }
    else if (returnType === 'variable') {
        /*------------------------------------
        4.3 Result is a variable
      ------------------------------------*/
        console.log('CG: 4.3 Return type is variable');
        if (resultVariable === '') {
            console.log('CG: 4.3.1 Result defaults: Using var');
            resultVariable = 'var';
        }
    }
    // Handle the case where we do not save the result to a variable and we just want to print to a notebook
    if (returnType !== 'none') {
        formula = resultVariable + ' = ' + formula;
    }
    // Handle the cases where we append something at the end
    if (typeof formResponse.schema.append !== 'undefined') {
        formula = formula + formResponse.schema.append;
    }
    // In the case the ruturn type is a series, remove the column name from the variable
    // i.e. df instead of df['col name']
    let resultDataFrame = resultVariable;
    if (returnType === 'series') {
        resultDataFrame = dataframeSelection;
    }
    console.log('RESULT DF', resultDataFrame);
    console.log('FORMULA: ', formula);
    return {
        formula: formula,
        resultVariable: resultDataFrame,
        returnType: returnType
    };
};


/***/ }),

/***/ "./lib/formulabar/formulabar.js":
/*!**************************************!*\
  !*** ./lib/formulabar/formulabar.js ***!
  \**************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "FormComponent": () => (/* binding */ FormComponent)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _rjsf_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @rjsf/core */ "webpack/sharing/consume/default/@rjsf/core/@rjsf/core");
/* harmony import */ var _rjsf_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_rjsf_core__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-select */ "webpack/sharing/consume/default/react-select/react-select");
/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_select__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var react_joyride__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-joyride */ "webpack/sharing/consume/default/react-joyride/react-joyride");
/* harmony import */ var react_joyride__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_joyride__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _codeGeneration__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./codeGeneration */ "./lib/formulabar/codeGeneration.js");
/* harmony import */ var bootstrap_dist_css_bootstrap_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! bootstrap/dist/css/bootstrap.css */ "./node_modules/bootstrap/dist/css/bootstrap.css");
/* harmony import */ var react_simple_user_feedback__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-simple-user-feedback */ "webpack/sharing/consume/default/react-simple-user-feedback/react-simple-user-feedback");
/* harmony import */ var react_simple_user_feedback__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_simple_user_feedback__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _components_feedbackContent__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../components/feedbackContent */ "./lib/components/feedbackContent.js");
/* harmony import */ var amplitude_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! amplitude-js */ "webpack/sharing/consume/default/amplitude-js/amplitude-js");
/* harmony import */ var amplitude_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(amplitude_js__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _components_querybuilder__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../components/querybuilder */ "./lib/components/querybuilder.js");
/* harmony import */ var _assets_svgs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../assets/svgs */ "./lib/assets/svgs.js");
/* harmony import */ var _styles_reactSelectStyles__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../styles/reactSelectStyles */ "./lib/styles/reactSelectStyles.js");
/* harmony import */ var _components_customSelect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/customSelect */ "./lib/components/customSelect.js");
/* harmony import */ var _productTour__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../productTour */ "./lib/productTour.js");
/* harmony import */ var _components_radioButtonGroup__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/radioButtonGroup */ "./lib/components/radioButtonGroup.js");
/* harmony import */ var _components_spinner__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../components/spinner */ "./lib/components/spinner.js");






// Feedback buttons library


// Usage analytics

// This is used to force refresh the form schema for dynamic forms with react-jsonschema-form

// Awesome querybuilder







// -------------------------------------------------------------------------------------------------------------
// FORMULABAR COMPONENT
// -------------------------------------------------------------------------------------------------------------
/*
 This magic formula bar provides a GUI over python functions with the goal of facilitating the use by non experts
 and non technical users

 How this works on a high-level is that we define a json schema for each function, and render that as a form for
 the end user. The end user can interact with the form, and upon submission this form generates "code" in a
 notebook cell

 Functionality in this file:
   - (A) Search: Find transformations using keywords and log data when users search
   - (B) Form handling: Display form when user selects data and transformation and request the json schema
   - (C) Code generation: Update internal state after generating code and generating the "text" out of the
       json object returned by reactjsonschemaform
   - (D) Logic to get feedback from users after they have used a transformation
*/
// Component takes props with the main class (FormWidget) that handles all the logic, communication with kernel etc.
const FormComponent = (props) => {
    // Access backend class through logic object
    const logic = props.logic;
    const url = window.location.href;
    const binderUrl = url.includes('cloud.eigendata.co') || url.includes('molinsp-eigendata-trial');
    // Defaults for form and UI schema
    const transformationForm = logic.transformationsConfig['read_csv']['form'];
    const defaultUISchema = logic.transformationsConfig['read_csv']['uischema'];
    const defaultTransformationSelection = {
        value: 'read_csv',
        label: 'Read CSV'
    };
    // Display only transformations that load data when there is no data
    const loadingTransformations = () => {
        const result = [];
        lodash__WEBPACK_IMPORTED_MODULE_7___default().forIn(logic.transformationsConfig, (value, key) => {
            if (value['form']['transformationType'] === 'dataLoading') {
                result.push({ value: key, label: value['form']['title'] });
            }
        });
        return result;
    };
    // References for handling autofocus
    const transformationSelectionRef = react__WEBPACK_IMPORTED_MODULE_0___default().useRef();
    const dataframeSelectionRef = react__WEBPACK_IMPORTED_MODULE_0___default().useRef();
    const setFocusOnElement = (element) => {
        element.focus();
    };
    /* Main state of the component:
        - Transformation form
        - UI schema
        - Show or not show form: If we don't have both dataframe and transformation selected, we don't show the form
        - DataFrame selection
        - Transformation selection
    */
    const [state, setState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({
        transformationForm: transformationForm,
        transformationUI: defaultUISchema,
        showForm: false,
        enableCallerSelection: false,
        dataframeSelection: null,
        transformationSelection: null,
        formData: {},
        queryConfig: null,
        formKey: Date.now(),
        error: null
    });
    // Separate state for feedback buttons (for to not expand the common state)
    const [feedbackState, setFeedbackState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({
        negativeDescription: '',
        submittedTransformation: null
    });
    // Separate state for product tour
    const [productTourState, setProductTourState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({
        run: false
    });
    // Show and hide form with shortcuts
    const [visibility, setVisibility] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(logic.openFormulabarCellByDefault);
    /*-----------------------------------
    RESET STATE LOGIC
    -----------------------------------*/
    if (logic.resetStateFormulabarFlag === true) {
        console.log('RESETING FORMULABAR STATE');
        setState(Object.assign(Object.assign({}, state), { transformationForm: transformationForm, transformationUI: defaultUISchema, showForm: true, dataframeSelection: null, transformationSelection: defaultTransformationSelection, formData: {}, queryConfig: null }));
        logic.resetStateFormulabarFlag = false;
        // This starts the product tour. It's here because it needs to load after the rest of the elements
        if (logic.completedProductTour === false) {
            setState(state => (Object.assign(Object.assign({}, state), { formData: { filepath_or_buffer: 'players_20.csv' } })));
            setProductTourState({ run: true });
            // Change the settings for it not to run next time (next refresh)
            logic.eigendataSettings.set('completedProductTour', true);
            // Set to true for it not to run again in the current session
            logic.completedProductTour = true;
        }
    }
    /*-----------------------------------
      HANDLE SHORTCUTS
    -----------------------------------*/
    const handleKeyDown = (event) => {
        if (event.ctrlKey && event.key === "e") {
            setVisibility(prevVisibility => !prevVisibility);
            //console.log('Change visibility', visibility);
        }
    };
    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
        window.addEventListener("keydown", handleKeyDown);
        return () => window.removeEventListener("keydown", handleKeyDown);
    }, []);
    /*-----------------------------------
      (A) SEARCH
    -----------------------------------*/
    // Log what the users are searching
    let prevInput = '';
    const handleInputChange = (inputValue) => {
        if (inputValue.length === 0 && prevInput.length !== 0) {
            console.log('Formulabar search: search and select - ', prevInput);
            if (logic.production && logic.shareProductData) {
                amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance()
                    .logEvent('Formulabar search: search and select', {
                    searchString: prevInput
                });
            }
        }
        else if (inputValue.length < prevInput.length) {
            //console.log('Formulabar Search: Deleted text', prevInput);
        }
        else if (inputValue.endsWith(' ')) {
            console.log('Formulabar search: search keyword - ', prevInput);
            if (logic.production && logic.shareProductData) {
                amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance()
                    .logEvent('Formulabar search: search and select', {
                    searchString: prevInput
                });
            }
        }
        prevInput = inputValue;
    };
    // Search logic
    const getKeywordsForFilter = (option, rawInput) => {
        // Add keywords to search
        let keywords = '';
        if (option.value === 'query') {
            // Query is handled differently
            keywords = ['filter', 'more', 'less', 'equal'].join(' ');
        }
        else if (option.value === 'notfound') {
            return true;
        }
        else if (logic.transformationsConfig[option.value]['keywords']) {
            keywords = logic.transformationsConfig[option.value]['keywords'].join(' ');
        }
        const textToSearch = option.label + ' ' + keywords + ' ' + option.value.replace(/_/g, ' ');
        const words = rawInput.split(' ');
        return words.reduce((acc, cur) => acc && textToSearch.toLowerCase().includes(cur.toLowerCase()), true);
    };
    /*--------------------------------------
      (B) FORM HANDLING
    ---------------------------------------*/
    // Add the behavior described above
    const widgets = {
        SelectWidget: _components_customSelect__WEBPACK_IMPORTED_MODULE_8__.default,
        RadioWidget: _components_radioButtonGroup__WEBPACK_IMPORTED_MODULE_9__.RadioButtonGroup
    };
    // UPDATE FORMS DYNAMICALLY, i.e. when the input of a form field changes, the form itself changes
    const handleFormChange = async (data) => {
        /*-------------------------------
         MERGE
         -------------------------------*/
        if (data.schema.function === 'merge' &&
            // Do not trigger this when another parameter is set
            typeof data.formData['right'] !== 'undefined' &&
            // Only trigger if the state does not have the data (undefined) or if the state has different data (selected another right)
            (typeof state.formData['right'] === 'undefined' ||
                data.formData['right'] !== state.formData['right'])) {
            console.log('Dynamic forms: Changed right in merge');
            // Get the columns from the backend
            const columns = await logic.pythonGetDataframeColumns(data.formData['right']);
            // Perform deep copy of the object, otherwise it does not re-render
            const newState = lodash__WEBPACK_IMPORTED_MODULE_7___default().cloneDeep(state.transformationForm);
            // Add the queried columns to the state
            newState['definitions']['right_columns']['items']['enum'] = columns;
            setState(state => (Object.assign(Object.assign({}, state), { transformationForm: newState, formData: data.formData, error: null })));
        }
    };
    // Save the input of the Dataframe selection in the UI to the state
    const handleDataframeSelectionChange = async (input) => {
        if (state.transformationSelection) {
            console.log('Formulabar: get transformation to state');
            await getTransformationFormToState(input, state.transformationSelection, state.enableCallerSelection);
        }
        else {
            setState(state => (Object.assign(Object.assign({}, state), { dataframeSelection: input, error: null })));
        }
    };
    // Save the input of the transformation selection in the UI to the state
    const handleTransformationSelectionChange = async (input) => {
        // Event tracking
        if (logic.production && logic.shareProductData) {
            amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance().logEvent('Formulabar: select transformation', {
                userSelection: input.value
            });
        }
        // Two cases, requires a dataframe selection and not
        // DO NOT REQUIRE DF SELECTION
        if (input.value.localeCompare('query') != 0 // Is not the query
            && (typeof (logic.transformationsConfig[input.value]['form']['callerObject']) === 'undefined'
                || logic.transformationsConfig[input.value]['form']['callerObject'].includes('DataFrame') == false)
            && typeof (logic.transformationsConfig[input.value]['form']['selectionAsParameter']) === 'undefined') {
            // Set the input and load transformation form
            await getTransformationFormToState(state.dataframeSelection, input, false);
        }
        // REQUIRES CALLER OBJECT SELECTION
        else {
            // Caller object already selected
            if (state.dataframeSelection) {
                console.log('all defined');
                await getTransformationFormToState(state.dataframeSelection, input, true);
            }
            // Caller object not selected
            else {
                setFocusOnElement(dataframeSelectionRef.current);
                setState(state => (Object.assign(Object.assign({}, state), { showForm: false, enableCallerSelection: true, transformationSelection: input, formData: {}, error: null })));
            }
        }
        ;
    };
    // Populates the transformation form into the state
    const getTransformationFormToState = async (dataframeSelection, transformationSelection, enableCallerSelection) => {
        if (transformationSelection.value.localeCompare('query') === 0) {
            console.log('Querybuilder');
            const queryConfig = await logic.pythonGenerateQuerybuilderConfig(dataframeSelection.value);
            setState(state => (Object.assign(Object.assign({}, state), { queryConfig: queryConfig, showForm: false, enableCallerSelection: enableCallerSelection, dataframeSelection: dataframeSelection, transformationSelection: transformationSelection, formData: {}, error: null })));
        }
        else {
            // STANDARD behavior
            const newFormSchema = await logic.getTransformationFormSchema(dataframeSelection == null ? null : dataframeSelection.value, transformationSelection.value);
            const newUISchema = logic.getTransformationUISchema(transformationSelection.value);
            setState(Object.assign(Object.assign({}, state), { transformationForm: newFormSchema, transformationUI: newUISchema, showForm: true, enableCallerSelection: enableCallerSelection, dataframeSelection: dataframeSelection, transformationSelection: transformationSelection, queryConfig: null, formData: {}, error: null, 
                // Re-render Form each time new transformation is loaded
                // by generating new key
                formKey: Date.now() }));
        }
    };
    /*--------------------------------------
      (C) GENERATE CODE & UPDATE INTERNALS
    ---------------------------------------*/
    // Generate python code and write in the notebook
    const callGeneratePythonCode = async (formResponse) => {
        console.log('SUBMIT WAS PRESSED');
        /*-------------------------------------------------------
        Handle product feedback case (not found transformation)
        --------------------------------------------------------*/
        if (state.transformationSelection.value === 'notfound') {
            // Remove transformation selection and hide form
            setState(state => (Object.assign(Object.assign({}, state), { transformationSelection: null, showForm: false, error: null })));
            // Log event
            if (logic.production && logic.shareProductData) {
                amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance().logEvent('Formulabar: request transformation', {
                    userRequest: formResponse.formData.description
                });
            }
            return;
        }
        /*-------------------------------------------------------
        Get transformation schema
        --------------------------------------------------------*/
        let transformationSchema = logic.transformationsConfig[state.transformationSelection.value];
        if (typeof transformationSchema === 'undefined') {
            console.warn('Transformation not found');
        }
        /*-----------------------------------------------
        Generate formula (Either snippet of function)
        -----------------------------------------------*/
        let formula, resultVariable, returnType;
        if (typeof transformationSchema['code_snippet'] === 'undefined') {
            let dataframeSelection;
            if (state.dataframeSelection) {
                dataframeSelection = state.dataframeSelection.value;
            }
            else {
                dataframeSelection = null;
            }
            // Get the code generated
            ({ formula, resultVariable, returnType } = (0,_codeGeneration__WEBPACK_IMPORTED_MODULE_10__.generatePythonCode)(formResponse, dataframeSelection));
        }
        else {
            // For code snippets there is no need to generate a formula
            formula = transformationSchema['code_snippet']['code'];
            resultVariable = 'na';
        }
        /*-----------------------------------------------
        Tracking in amplitude
        -----------------------------------------------*/
        if (logic.production && logic.shareProductData) {
            amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance().logEvent('Formulabar: submit transformation', {
                function: formResponse.schema.function,
                formInput: formResponse.formData,
                generatedCode: formula
            });
        }
        /*-----------------------------------------------
        Import libraries/functions if needed
        -----------------------------------------------*/
        if (typeof transformationSchema['library'] === 'undefined' &&
            typeof transformationSchema['function_snippet'] !== 'undefined') {
            console.log('CG: Code-gen for snippet');
            /*----------------
              FUNC SNIPPETS
            -----------------*/
            const snippetFunction = transformationSchema['function_snippet'];
            console.log('CG: Imported functions', logic.importedFunctions);
            if (logic.importedFunctions.includes(snippetFunction['name'])) {
                console.log('CG: Snippet already imported');
            }
            else {
                console.log('CG: Snippet not imported, using statement', snippetFunction['name']);
                try {
                    await logic.pythonImportLibraries(snippetFunction['code']);
                }
                catch (error) {
                    console.log(error);
                }
            }
        }
        else if (typeof transformationSchema['library'] !== 'undefined') {
            /*----------------
              MODULES
            -----------------*/
            console.log('CG: Code-gen for module');
            const library = transformationSchema['library'];
            // Check if there is a need for a namespace
            let hasNamespace = false;
            if (typeof library['namespace'] !== 'undefined') {
                hasNamespace = true;
            }
            // Check if the library is already imported or not
            // Case 1: No namespace
            if (!hasNamespace && logic.packagesImported.includes(library['name'])) {
                console.log('CG: Module already imported');
            }
            // Case 2: There is a namespace, in which case you need both the import and the namespace for it to work
            else if (hasNamespace &&
                logic.packagesImported.includes(library['name']) &&
                logic.packageNamespaces.includes(library['namespace'])) {
                console.log('CG: Package & namespace already imported');
            }
            else {
                console.log('CG: Module not imported, using statement', library['importStatement']);
                try {
                    await logic.pythonImportLibraries(library['importStatement']);
                }
                catch (error) {
                    console.log(error);
                }
            }
        }
        /*-----------------------------------------------
        Generate & execute code
        -----------------------------------------------*/
        try {
            await logic.writeToNotebookAndExecute(formula, returnType);
            console.log('CG: Return type', returnType);
            // Write and execute the formula in the notebook
            // Add submitted transformation to the feedback state
            setFeedbackState(Object.assign(Object.assign({}, feedbackState), { submittedTransformation: state.transformationSelection }));
            if (returnType === 'dataframe') {
                setState(state => (Object.assign(Object.assign({}, state), { dataframeSelection: {
                        label: resultVariable,
                        value: resultVariable
                    }, transformationSelection: null, showForm: false, error: null })));
            }
            else {
                setState(state => (Object.assign(Object.assign({}, state), { transformationSelection: null, showForm: false, error: null })));
            }
            setFocusOnElement(transformationSelectionRef.current);
        }
        catch (error) {
            // Log transformation errors
            if (logic.production && logic.shareProductData) {
                amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance().logEvent('Formulabar: transformation error', {
                    function: formResponse.schema.function,
                    formInput: formResponse.formData,
                    generatedCode: formula,
                    errorMessage: error.message
                });
            }
            console.log('Error in submit', error);
            setState(state => (Object.assign(Object.assign({}, state), { error: error, formData: Object.assign({}, formResponse.formData) })));
        }
    };
    /*--------------------------------------
      (D) FEEDBACK LOGIC
    ---------------------------------------*/
    const extraErrors = state.error
        ? { form: { __errors: [state.error.message] } }
        : undefined;
    // Action when click "Didn't work" button
    const onNegativeClick = () => {
        console.log('Logged: ', feedbackState.submittedTransformation.value);
        // Log result
        if (logic.production && logic.shareProductData) {
            amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance()
                .logEvent('Formulabar: transformation did not work', {
                transformation: feedbackState.submittedTransformation.value
            });
        }
        // Show the block with text input
        const elem = document.getElementById('feedback__negative-description');
        elem.className = 'show_flex';
    };
    // Action when click "Worked" button
    const onPositiveClick = () => {
        console.log('Logged: ', feedbackState.submittedTransformation.value);
        // Log result
        if (logic.production && logic.shareProductData) {
            amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance().logEvent('Formulabar: transformation worked', {
                transformation: feedbackState.submittedTransformation.value
            });
        }
        // Hide the feedback buttons
        setFeedbackState(Object.assign(Object.assign({}, feedbackState), { submittedTransformation: null }));
    };
    // Action when click "Submit" in the block for negative description
    const onSubmitDescription = (e) => {
        e.preventDefault();
        const text = feedbackState.negativeDescription;
        console.log('Logged: ', feedbackState.submittedTransformation.value, text);
        // Log result
        if (logic.production && logic.shareProductData) {
            amplitude_js__WEBPACK_IMPORTED_MODULE_6___default().getInstance()
                .logEvent('Formulabar: transformation did not work', {
                transformation: feedbackState.submittedTransformation.value,
                description: text
            });
        }
        // Hide the feedback buttons and clear text input content
        setFeedbackState({
            submittedTransformation: null,
            negativeDescription: ''
        });
    };
    // Update feedback state when type something in the text input
    const onTextChange = (e) => {
        setFeedbackState(Object.assign(Object.assign({}, feedbackState), { negativeDescription: e.target.value }));
    };
    return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "app" }, visibility && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "content" },
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_joyride__WEBPACK_IMPORTED_MODULE_3___default()), { steps: _productTour__WEBPACK_IMPORTED_MODULE_11__.default, continuous: true, run: productTourState.run, hideBackButton: true, disableScrollParentFix: true, showSkipButton: true, locale: {
                back: "Back",
                close: "Close",
                last: "Finish",
                next: "Next",
                skip: "Skip",
            }, styles: {
                options: {
                    zIndex: 1000,
                    primaryColor: "#3698DC",
                },
            } }),
        props.logic.kernelStatus === "busy" && react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_spinner__WEBPACK_IMPORTED_MODULE_12__.Spinner, null),
        react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "side-by-side-fields" },
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "centered" }),
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("fieldset", { className: "data-transformation-form" },
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_2___default()), { name: "Select transformation", placeholder: "Search transformation", options: logic.dataframesLoaded.length !== 0
                        ? logic.transformationsList
                        : loadingTransformations(), value: state.transformationSelection, label: "Select transformation", onChange: handleTransformationSelectionChange, onInputChange: handleInputChange, className: "right-field", components: {
                        DropdownIndicator: () => _assets_svgs__WEBPACK_IMPORTED_MODULE_13__.magnifier,
                        IndicatorSeparator: () => null,
                    }, id: "transformationselect", filterOption: getKeywordsForFilter, maxMenuHeight: 400, styles: _styles_reactSelectStyles__WEBPACK_IMPORTED_MODULE_14__.formulabarMainSelect, autoFocus: true, ref: transformationSelectionRef }),
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react_select__WEBPACK_IMPORTED_MODULE_2___default()), { name: "Select dataframe", placeholder: logic.dataframesLoaded.length !== 0 ? "Select data" : "No data", options: logic.dataframesLoaded, value: state.dataframeSelection, label: "Select data", onChange: handleDataframeSelectionChange, className: "left-field", isDisabled: !state.enableCallerSelection, id: "dataselect", components: {
                        DropdownIndicator: () => _assets_svgs__WEBPACK_IMPORTED_MODULE_13__.tableIcon,
                        IndicatorSeparator: () => null,
                    }, styles: _styles_reactSelectStyles__WEBPACK_IMPORTED_MODULE_14__.formulabarMainSelect, ref: dataframeSelectionRef })),
            binderUrl && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "binderButtonSeparator" },
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", { href: "https://calendly.com/molinsp/eigendata-demo", className: "binderButton" }, "BOOK A DEMO"))),
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "centered formulaFormDivider" }),
            state.showForm && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement((_rjsf_core__WEBPACK_IMPORTED_MODULE_1___default()), { formData: state.formData, schema: state.transformationForm, onSubmit: callGeneratePythonCode, onChange: handleFormChange, widgets: widgets, uiSchema: state.transformationUI, extraErrors: extraErrors, omitExtraData: true, 
                // React renders new Element for each key.
                // We need to re-render Form to update shown errors
                key: state.formKey })),
            state.queryConfig && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_querybuilder__WEBPACK_IMPORTED_MODULE_15__.default, { queryConfig: state.queryConfig, dataframeSelection: state.dataframeSelection.value, backend: logic })),
            feedbackState.submittedTransformation &&
                !(state.showForm || state.queryConfig) && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("form", { id: "feedback", onSubmit: onSubmitDescription },
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { id: "feedback__buttons" },
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_simple_user_feedback__WEBPACK_IMPORTED_MODULE_5__.BinaryFeedback, { onPositiveClick: onPositiveClick, onNegativeClick: onNegativeClick, positiveContent: (0,_components_feedbackContent__WEBPACK_IMPORTED_MODULE_16__.FeedbackContent)(_assets_svgs__WEBPACK_IMPORTED_MODULE_13__.thumbUp, "Worked", "#93C47d"), negativeContent: (0,_components_feedbackContent__WEBPACK_IMPORTED_MODULE_16__.FeedbackContent)(_assets_svgs__WEBPACK_IMPORTED_MODULE_13__.thumbDown, "Didn't work", "#E06666"), singleSelect: true })),
                react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { id: "feedback__negative-description" },
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", { placeholder: "Share the issue so we can fix it!", type: "text", className: "short form-control margin-right", onChange: onTextChange, value: feedbackState.negativeDescription }),
                    react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", { type: "submit", className: "short btn btn-info", disabled: feedbackState.negativeDescription === "" })))))))));
};


/***/ }),

/***/ "./lib/formulabar/formulabarCell.js":
/*!******************************************!*\
  !*** ./lib/formulabar/formulabarCell.js ***!
  \******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "CellToolbarTracker": () => (/* binding */ CellToolbarTracker),
/* harmony export */   "CellBarExtension": () => (/* binding */ CellBarExtension)
/* harmony export */ });
/* harmony import */ var _components_formWidget__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/formWidget */ "./lib/components/formWidget.js");

// Renders the form Widget under a cell
class CellToolbarTracker {
    constructor(panel, commands, settings, backend) {
        //private _commands: CommandRegistry;
        this._isDisposed = false;
        //this._commands = commands;
        this._panel = panel;
        this._backend = backend;
        // Create widget
        this.toolbarWidget = new _components_formWidget__WEBPACK_IMPORTED_MODULE_0__.FormWidget(this._backend);
        this.toolbarWidget.addClass('marginsNotebook');
        // On change of active cell move the toolbar
        this._panel.content.activeCellChanged.connect(this.updateActiveCells, this);
    }
    get isDisposed() {
        return this._isDisposed;
    }
    dispose() {
        var _a;
        if (this.isDisposed) {
            return;
        }
        this._isDisposed = true;
        const cells = (_a = this._panel) === null || _a === void 0 ? void 0 : _a.context.model.cells;
        if (cells) {
            this._panel.content.activeCellChanged.disconnect(this.updateActiveCells, this);
        }
        this._panel = null;
    }
    updateActiveCells(sender, activeCell) {
        this._addToolbar(activeCell === null || activeCell === void 0 ? void 0 : activeCell.model);
    }
    _addToolbar(model) {
        const cell = this._getCell(model);
        //console.log('Cell value', cell.model.value.text.length);
        //console.log('Cell type', cell.model.type);
        if (cell) {
            // 0 is above the cell
            cell.layout.insertWidget(3, this.toolbarWidget);
        }
    }
    _getCell(model) {
        var _a;
        return (_a = this._panel) === null || _a === void 0 ? void 0 : _a.content.widgets.find(widget => widget.model === model);
    }
}
/**
 * Widget extension that creates a CellToolbarTracker each time a notebook is
 * created.
 */
class CellBarExtension {
    constructor(commands, settings, backend) {
        this._commands = commands;
        this._settings = settings;
        this._backend = backend;
    }
    createNew(panel) {
        return new CellToolbarTracker(panel, this._commands, this._settings, this._backend);
    }
}


/***/ }),

/***/ "./lib/formulabar/transformations.json":
/*!*********************************************!*\
  !*** ./lib/formulabar/transformations.json ***!
  \*********************************************/
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"version":"0.0.44","transformations":{"read_csv":{"form":{"properties":{"filepath_or_buffer":{"type":"string","title":"file path","description":"Location of the file relative to the notebook. E.g. /Documents/Data/testdata.csv."},"sep":{"type":"string","default":",","title":"separator","description":"Character used to separate columns (e.g. commas, semicolons, etc.)."},"decimal":{"type":"string","default":".","description":"Character used to indicate decimals."},"header":{"type":"number","description":"Row to use for the column labels (first row is 0)."},"new table name":{"type":"string"}},"required":["filepath_or_buffer"],"title":"Read CSV file","type":"object","callerObject":"pd","function":"read_csv","transformationType":"dataLoading","description":"Load the csv in a table."},"uischema":{"new table name":{"ui:placeholder":"Leave blank to modify selected table"}},"library":{"name":"pandas","importStatement":"import pandas as pd","namespace":"pd"},"keywords":["csv","load","read"]},"notfound":{"form":{"properties":{"description":{"type":"string","description":"Tell us which functionality you are missing."}},"title":"Can\'t find what you want?","type":"object"},"uischema":{"description":{"ui:widget":"textarea"}}}}}');

/***/ }),

/***/ "./lib/index.js":
/*!**********************!*\
  !*** ./lib/index.js ***!
  \**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/application */ "webpack/sharing/consume/default/@jupyterlab/application");
/* harmony import */ var _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/apputils */ "webpack/sharing/consume/default/@jupyterlab/apputils");
/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _components_formWidget__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./components/formWidget */ "./lib/components/formWidget.js");
/* harmony import */ var _formulabar_formulabarCell__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./formulabar/formulabarCell */ "./lib/formulabar/formulabarCell.js");
/* harmony import */ var _core_backend__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./core/backend */ "./lib/core/backend.js");
/* harmony import */ var _datavisualizer_datavisualizer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./datavisualizer/datavisualizer */ "./lib/datavisualizer/datavisualizer.js");
/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/ui-components */ "webpack/sharing/consume/default/@jupyterlab/ui-components");
/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _labIcons__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./labIcons */ "./lib/labIcons.js");
/* harmony import */ var _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @jupyterlab/notebook */ "webpack/sharing/consume/default/@jupyterlab/notebook");
/* harmony import */ var _jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @jupyterlab/mainmenu */ "webpack/sharing/consume/default/@jupyterlab/mainmenu");
/* harmony import */ var _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lumino/algorithm */ "webpack/sharing/consume/default/@lumino/algorithm");
/* harmony import */ var _lumino_algorithm__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @jupyterlab/settingregistry */ "webpack/sharing/consume/default/@jupyterlab/settingregistry");
/* harmony import */ var _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @jupyterlab/rendermime */ "webpack/sharing/consume/default/@jupyterlab/rendermime");
/* harmony import */ var _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _datavisualizer_outputPanel__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./datavisualizer/outputPanel */ "./lib/datavisualizer/outputPanel.js");
/* harmony import */ var _jupyterlab_launcher__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @jupyterlab/launcher */ "webpack/sharing/consume/default/@jupyterlab/launcher");
/* harmony import */ var _jupyterlab_launcher__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_launcher__WEBPACK_IMPORTED_MODULE_8__);















/**
 * The command IDs used by the react-formulawidget plugin.
 */
var CommandIDs;
(function (CommandIDs) {
    CommandIDs.create = 'ed:open';
    CommandIDs.dataviz = 'ed:opendataviz';
})(CommandIDs || (CommandIDs = {}));
/**
 * Initialization data for the hello-world extension.
 */
const extension = {
    id: '@molinsp/eigendata:plugin',
    autoStart: true,
    optional: [_jupyterlab_launcher__WEBPACK_IMPORTED_MODULE_8__.ILauncher],
    requires: [_jupyterlab_notebook__WEBPACK_IMPORTED_MODULE_3__.INotebookTracker, _jupyterlab_mainmenu__WEBPACK_IMPORTED_MODULE_4__.IMainMenu, _jupyterlab_application__WEBPACK_IMPORTED_MODULE_0__.ILayoutRestorer, _jupyterlab_settingregistry__WEBPACK_IMPORTED_MODULE_6__.ISettingRegistry, _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_7__.IRenderMimeRegistry, _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.ICommandPalette],
    activate: (app, notebook_tracker, mainMenu, restorer, settingRegistry, rendermime, palette, launcher) => {
        console.log('JupyterLab Eigendata is activated!');
        const { commands } = app;
        /*---------------------------------
          Read mode from the configuration
        ----------------------------------*/
        let eigendataMode = 'low-code';
        let firstRun = true;
        let simplifyMenus = true;
        let simplifySidebars = true;
        settingRegistry.load('@molinsp/eigendata:settings').then((settings) => {
            eigendataMode = settings.get('eigendataMode').composite;
            firstRun = !settings.get('answeredProductDataDialog').composite;
            simplifyMenus = settings.get('simplifyMenus').composite;
            simplifySidebars = settings.get('simplifySidebars').composite;
            console.log('firstRun', firstRun);
            console.log('Eigendata mode', eigendataMode);
        }, (err) => {
            console.error(`jupyterlab-execute-time: Could not load settings, so did not active the plugin: ${err}`);
        }).then(() => {
            let backend;
            // -------------------------------------------------------------------------------------------------------------
            // LOW-CODE MODE
            // -------------------------------------------------------------------------------------------------------------
            if (eigendataMode.localeCompare('low-code') == 0) {
                backend = new _core_backend__WEBPACK_IMPORTED_MODULE_9__.Backend(notebook_tracker, settingRegistry, app.serviceManager, null);
                /*---------------------------------
                  Add formula bar below cells
                ----------------------------------*/
                const cellToolbar = new _formulabar_formulabarCell__WEBPACK_IMPORTED_MODULE_10__.CellBarExtension(app.commands, null, backend);
                app.docRegistry.addWidgetExtension('Notebook', cellToolbar);
            }
            // -------------------------------------------------------------------------------------------------------------
            // NO-CODE MODE
            // -------------------------------------------------------------------------------------------------------------
            else {
                let formulawidget;
                const formulaBarCommand = CommandIDs.create;
                /*---------------------------------
                  Create panel for viz output
                ----------------------------------*/
                let outputsPanel = new _datavisualizer_outputPanel__WEBPACK_IMPORTED_MODULE_11__.OutputPanel(app.serviceManager, rendermime);
                app.shell.add(outputsPanel, 'right');
                // Create class that manages the backend behavior
                backend = new _core_backend__WEBPACK_IMPORTED_MODULE_9__.Backend(notebook_tracker, settingRegistry, app.serviceManager, outputsPanel);
                /*---------------------------------
                  Create formulabar as a widget
                ----------------------------------*/
                commands.addCommand(formulaBarCommand, {
                    caption: 'Create a new React Widget',
                    label: 'Magic Formula Bar',
                    icon: args => (args['isPalette'] ? null : _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_2__.searchIcon),
                    execute: () => {
                        if (!formulawidget || formulawidget.isDisposed) {
                            // Create form component and pass backend behavior
                            const content = new _components_formWidget__WEBPACK_IMPORTED_MODULE_12__.FormWidget(backend);
                            // Create formulawidget
                            formulawidget = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.MainAreaWidget({ content });
                            formulawidget.title.label = 'Magic Formula Bar';
                            formulawidget.title.closable = true;
                            // Open on start
                            app.shell.add(formulawidget, 'main');
                        }
                        if (!formulaBarTracker.has(formulawidget)) {
                            // Track the state of the formulawidget for later restoration
                            formulaBarTracker.add(formulawidget);
                        }
                        if (!formulawidget.isAttached) {
                            // Attach the formulawidget to the main work area if it's not there
                            app.shell.add(formulawidget, 'main');
                        }
                        formulawidget.content.update();
                        // Activate the formulawidget
                        app.shell.activateById(formulawidget.id);
                    }
                });
                // Add to command palette (command + shift + c)
                palette.addItem({ command: formulaBarCommand, category: 'Eigendata' });
                console.log('Debug launcher', launcher);
                // Add launcher
                if (launcher) {
                    console.log('Debug add to launcher');
                    launcher.add({
                        command: formulaBarCommand,
                        category: 'Eigendata',
                        rank: 100
                    });
                }
                // Track and restore the formulawidget state
                const formulaBarTracker = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.WidgetTracker({
                    namespace: 'ed'
                });
                restorer.restore(formulaBarTracker, {
                    command: formulaBarCommand,
                    name: () => 'ed'
                });
            }
            // -------------------------------------------------------------------------------------------------------------
            //Data visualizer
            // -------------------------------------------------------------------------------------------------------------
            let datavizwidget;
            const dataVizCommand = CommandIDs.dataviz;
            commands.addCommand(dataVizCommand, {
                caption: 'Create a new Data Data Visualizer',
                label: 'Open Data Visualizer',
                icon: args => (args['isPalette'] ? null : _labIcons__WEBPACK_IMPORTED_MODULE_13__.tableIcon),
                execute: () => {
                    if (!datavizwidget || datavizwidget.isDisposed) {
                        // Create form component and pass backend behavior
                        const content = new _datavisualizer_datavisualizer__WEBPACK_IMPORTED_MODULE_14__.DataVisualizerWidget(backend);
                        // Create datavizwidget
                        datavizwidget = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.MainAreaWidget({ content });
                        datavizwidget.title.icon = _labIcons__WEBPACK_IMPORTED_MODULE_13__.tableIcon;
                        //datavizwidget.title.closable = true;
                        app.shell.add(datavizwidget, 'right');
                    }
                    if (!viztracker.has(datavizwidget)) {
                        // Track the state of the datavizwidget for later restoration
                        viztracker.add(datavizwidget);
                    }
                    if (!datavizwidget.isAttached) {
                        // Attach the datavizwidget to the main work area if it's not there
                        app.shell.add(datavizwidget, 'right');
                    }
                    datavizwidget.content.update();
                    // Activate the datavizwidget
                    app.shell.activateById(datavizwidget.id);
                }
            });
            // Add command to palette
            palette.addItem({ command: dataVizCommand, category: 'Eigendata' });
            // Track and restore the data visualizer state
            const viztracker = new _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.WidgetTracker({
                namespace: 'dv'
            });
            restorer.restore(viztracker, {
                command: dataVizCommand,
                name: () => 'dv'
            });
            // -------------------------------------------------------------------------------------------------------------
            // Simplify jupyterlab on first run
            // -------------------------------------------------------------------------------------------------------------
            if (firstRun == true) {
                console.log('Changing default settings');
                /*---------------------------------
                   Kill on notebook close
                ----------------------------------*/
                settingRegistry.load('@jupyterlab/notebook-extension:tracker').then((settings) => {
                    settings.set('kernelShutdown', true);
                }, (err) => {
                    console.error(`jupyterlab-execute-time: Could not load settings, so did not active the plugin: ${err}`);
                });
                /*---------------------------------
                   Set notion-like shortcuts
                ----------------------------------*/
                settingRegistry.load('@jupyterlab/shortcuts-extension:shortcuts').then((settings) => {
                    let userShortcutsCount = settings.get('shortcuts').user.length;
                    // console.log('User shortcuts count', userShortcutsCount);
                    if (userShortcutsCount == 0) {
                        settings.set('shortcuts', [{ "command": "application:toggle-right-area", "keys": ["Accel /"], "selector": "body" }, { "command": "application:toggle-left-area", "keys": ["Accel \\"], "selector": "body" }]);
                    }
                }, (err) => {
                    console.error(`jupyterlab-execute-time: Could not load settings, so did not active the plugin: ${err}`);
                });
                /*---------------------------------
                   Hide status bar
                ----------------------------------*/
                settingRegistry.load('@jupyterlab/statusbar-extension:plugin').then((settings) => {
                    settings.set('visible', false);
                }, (err) => {
                    console.error(`jupyterlab-execute-time: Could not load settings, so did not active the plugin: ${err}`);
                });
            }
            /*---------------------------------
               Hide sidebar items
            ----------------------------------*/
            if (simplifySidebars == true) {
                (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__.each)(app.shell.widgets('left'), widget => {
                    //console.log('id', widget.id);
                    // For debugging purposes we will show the running sessions
                    if (widget.id == 'jp-running-sessions' && backend.production == true) {
                        //widget.close();
                    }
                });
                (0,_lumino_algorithm__WEBPACK_IMPORTED_MODULE_5__.each)(app.shell.widgets('right'), widget => {
                    //console.log('id', widget.id);
                    if (widget.id == 'jp-property-inspector') {
                        widget.close();
                    }
                });
            }
            /*---------------------------------
               Remove superfluous menus
            ----------------------------------*/
            if (simplifyMenus == true) {
                //mainMenu.editMenu.dispose();
                mainMenu.viewMenu.dispose();
                mainMenu.runMenu.dispose();
                mainMenu.fileMenu.dispose();
                mainMenu.kernelMenu.dispose();
                mainMenu.tabsMenu.dispose();
                mainMenu.settingsMenu.dispose();
                mainMenu.helpMenu.dispose();
            }
        }).then(() => {
            /*---------------------------------
              Open by default
            ----------------------------------*/
            commands.execute('ed:opendataviz');
        });
    }
};
/**
 * Export the plugins as default.
 */
const plugins = [extension];
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plugins);


/***/ }),

/***/ "./lib/labIcons.js":
/*!*************************!*\
  !*** ./lib/labIcons.js ***!
  \*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "chartIcon": () => (/* binding */ chartIcon),
/* harmony export */   "tableIcon": () => (/* binding */ tableIcon)
/* harmony export */ });
/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/ui-components */ "webpack/sharing/consume/default/@jupyterlab/ui-components");
/* harmony import */ var _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__);

const chartIcon = new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__.LabIcon({
    name: 'chartIcon',
    svgstr: ' <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000" class="jp-icon3" ><path d="M0 0h24v24H0z" fill="none"/><path d="M6 10h3v10H6zm0-5h3v4H6zm10 11h3v4h-3zm0-3h3v2h-3zm-5 0h3v7h-3zm0-4h3v3h-3z"/></svg>'
});
const tableIcon = new _jupyterlab_ui_components__WEBPACK_IMPORTED_MODULE_0__.LabIcon({
    name: 'tableIcon',
    svgstr: '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <path fill="#2684ff" class="jp-icon3" d="M 20.248 3.085 L 3.75 3.085 C 3.385 3.085 3.085 3.415 3.085 3.83 L 3.085 20.17 C 3.085 20.423 3.198 20.647 3.371 20.778 L 3.371 20.895 L 3.606 20.895 C 3.655 20.91 3.702 20.915 3.75 20.915 L 20.248 20.915 C 20.297 20.915 20.344 20.91 20.389 20.895 L 20.423 20.895 L 20.423 20.885 C 20.705 20.798 20.915 20.514 20.915 20.17 L 20.915 3.83 C 20.915 3.415 20.614 3.085 20.248 3.085 Z M 5.718 20.256 L 3.702 20.256 C 3.673 20.237 3.655 20.208 3.655 20.17 L 3.655 18.234 L 5.718 18.234 Z M 5.718 17.596 L 3.655 17.596 L 3.655 15.494 L 5.718 15.494 Z M 5.718 14.855 L 3.655 14.855 L 3.655 12.638 L 5.718 12.638 Z M 5.718 11.999 L 3.655 11.999 L 3.655 9.601 L 5.718 9.601 Z M 5.718 8.964 L 3.655 8.964 L 3.655 6.619 L 5.718 6.619 Z M 10.524 20.256 L 6.289 20.256 L 6.289 18.234 L 10.524 18.234 Z M 10.524 17.596 L 6.289 17.596 L 6.289 15.494 L 10.524 15.494 Z M 10.524 14.855 L 6.289 14.855 L 6.289 12.638 L 10.524 12.638 Z M 10.524 11.999 L 6.289 11.999 L 6.289 9.601 L 10.524 9.601 Z M 10.524 8.964 L 6.289 8.964 L 6.289 6.619 L 10.524 6.619 Z M 10.524 5.98 L 6.289 5.98 L 6.289 3.722 L 10.524 3.722 Z M 15.378 20.256 L 11.094 20.256 L 11.094 18.234 L 15.378 18.234 Z M 15.378 17.596 L 11.094 17.596 L 11.094 15.494 L 15.378 15.494 Z M 15.378 14.855 L 11.094 14.855 L 11.094 12.638 L 15.378 12.638 Z M 15.378 11.999 L 11.094 11.999 L 11.094 9.601 L 15.378 9.601 Z M 15.378 8.964 L 11.094 8.964 L 11.094 6.619 L 15.378 6.619 Z M 15.378 5.98 L 11.094 5.98 L 11.094 3.722 L 15.378 3.722 Z M 20.344 20.17 C 20.344 20.208 20.322 20.237 20.297 20.256 L 15.949 20.256 L 15.949 18.234 L 20.344 18.234 Z M 20.344 17.596 L 15.949 17.596 L 15.949 15.494 L 20.344 15.494 Z M 20.344 14.855 L 15.949 14.855 L 15.949 12.638 L 20.344 12.638 Z M 20.344 11.999 L 15.949 11.999 L 15.949 9.601 L 20.344 9.601 Z M 20.344 8.964 L 15.949 8.964 L 15.949 6.619 L 20.344 6.619 Z M 20.344 5.98 L 15.949 5.98 L 15.949 3.722 L 20.248 3.722 C 20.301 3.722 20.344 3.771 20.344 3.83 Z M 20.344 5.98" style=""/> </svg>'
});


/***/ }),

/***/ "./lib/productTour.js":
/*!****************************!*\
  !*** ./lib/productTour.js ***!
  \****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/*-----------------------------------
PRODUCT TOUR
-----------------------------------*/

const productTourSteps = [
    {
        content: (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null,
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, "This is the magic formula bar, your gateway to data superpowers"))),
        target: '.data-transformation-form',
        // Remove beacon with circle to enable autostart
        disableBeacon: true,
        placement: 'bottom-start'
    },
    {
        content: (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null,
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, "Here you search for data transformations."),
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, "We will start by loading a csv file."))),
        target: '#transformationselect',
        // Remove beacon with circle to enable autostart
        disableBeacon: true
    },
    {
        content: (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null,
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, " On the right you select which dataset you want to transform"),
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, " Right now there is no data loaded"))),
        target: '#dataselect',
        // Remove beacon with circle to enable autostart
        disableBeacon: true
    },
    {
        content: 'Here is where you enter the parameters, like the csv file name. We have already entered the name of a demo file for you.',
        target: '#root_filepath_or_buffer',
        // Remove beacon with circle to enable autostart
        disableBeacon: true
    },
    {
        content: (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null,
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, "To see your files, you can use the file browser on the left."),
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, "You can also hide it by clicking the browser icon on the top-left"))),
        target: '#filebrowser',
        // Remove beacon with circle to enable autostart
        disableBeacon: true,
        placement: 'left'
    },
    {
        content: 'To execute a transformation, press Submit',
        target: '.btn-info',
        // Remove beacon with circle to enable autostart
        disableBeacon: true
    },
    {
        content: (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null,
            react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, "The data will be displayed in the data visualizer."))),
        target: '.lm-Widget .p-Widget .jp-dataviz',
        // Remove beacon with circle to enable autostart
        disableBeacon: true,
        placement: 'left'
    }
];
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (productTourSteps);


/***/ }),

/***/ "./lib/styles/reactSelectStyles.js":
/*!*****************************************!*\
  !*** ./lib/styles/reactSelectStyles.js ***!
  \*****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "querySelectStyles": () => (/* binding */ querySelectStyles),
/* harmony export */   "formulabarMainSelect": () => (/* binding */ formulabarMainSelect)
/* harmony export */ });
const querySelectHeight = 30;
const querySelectStyles = {
    menuPortal: (base) => (Object.assign(Object.assign({}, base), { zIndex: 9999 })),
    control: (base) => (Object.assign(Object.assign({}, base), { minHeight: querySelectHeight })),
    valueContainer: (base) => (Object.assign(Object.assign({}, base), { minHeight: querySelectHeight })),
    input: (base) => (Object.assign(Object.assign({}, base), { margin: 0 })),
    indicatorsContainer: (base) => (Object.assign(Object.assign({}, base), { minHeight: querySelectHeight }))
};
const formulabarMainSelect = {
    // The main container of Select
    control: (base, { isFocused }) => (Object.assign(Object.assign({}, base), { borderColor: isFocused ? '#2684FF' : '#A6A6A6', borderWidth: 2, borderRadius: 10, ':hover': {
            borderColor: isFocused ? '#2684FF' : '#777777'
        } })),
    //Indicator container
    indicatorsContainer: (base) => (Object.assign(Object.assign({}, base), { width: 40, paddingRight: 10, paddingLeft: 10 }))
};


/***/ }),

/***/ "./lib/utils/stringUtils.js":
/*!**********************************!*\
  !*** ./lib/utils/stringUtils.js ***!
  \**********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "separateThousands": () => (/* binding */ separateThousands),
/* harmony export */   "getUSDString": () => (/* binding */ getUSDString),
/* harmony export */   "cutString": () => (/* binding */ cutString)
/* harmony export */ });
const separateThousands = (value) => {
    let stringNumber = value + '';
    const rgx = /(\d+)(\d{3})/;
    while (rgx.test(stringNumber)) {
        stringNumber = stringNumber.replace(rgx, '$1' + '.' + '$2');
    }
    return stringNumber;
};
const getUSDString = (value) => {
    return typeof value === 'number'
        ? value.toLocaleString('USD')
        : String(value);
};
const cutString = (text, requiredLength) => {
    return text.length > requiredLength
        ? `${text.slice(0, requiredLength)}...`
        : text;
};


/***/ })

}]);
//# sourceMappingURL=lib_index_js.5254946bf27802ffe613.js.map