"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] = self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] || []).push([["node_modules_jupyterlab_vega5-extension_lib_index_js"],{

/***/ "../node_modules/@jupyterlab/vega5-extension/lib/index.js":
/*!****************************************************************!*\
  !*** ../node_modules/@jupyterlab/vega5-extension/lib/index.js ***!
  \****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   RenderedVega: () => (/* binding */ RenderedVega),\n/* harmony export */   VEGALITE3_MIME_TYPE: () => (/* binding */ VEGALITE3_MIME_TYPE),\n/* harmony export */   VEGALITE4_MIME_TYPE: () => (/* binding */ VEGALITE4_MIME_TYPE),\n/* harmony export */   VEGALITE5_MIME_TYPE: () => (/* binding */ VEGALITE5_MIME_TYPE),\n/* harmony export */   VEGA_MIME_TYPE: () => (/* binding */ VEGA_MIME_TYPE),\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */   rendererFactory: () => (/* binding */ rendererFactory)\n/* harmony export */ });\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_0__);\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module vega5-extension\n */\n\n/**\n * The CSS class to add to the Vega and Vega-Lite widget.\n */\nconst VEGA_COMMON_CLASS = 'jp-RenderedVegaCommon5';\n/**\n * The CSS class to add to the Vega.\n */\nconst VEGA_CLASS = 'jp-RenderedVega5';\n/**\n * The CSS class to add to the Vega-Lite.\n */\nconst VEGALITE_CLASS = 'jp-RenderedVegaLite';\n/**\n * The MIME type for Vega.\n *\n * #### Notes\n * The version of this follows the major version of Vega.\n */\nconst VEGA_MIME_TYPE = 'application/vnd.vega.v5+json';\n/**\n * The MIME type for Vega-Lite.\n *\n * #### Notes\n * The version of this follows the major version of Vega-Lite.\n */\nconst VEGALITE3_MIME_TYPE = 'application/vnd.vegalite.v3+json';\n/**\n * The MIME type for Vega-Lite.\n *\n * #### Notes\n * The version of this follows the major version of Vega-Lite.\n */\nconst VEGALITE4_MIME_TYPE = 'application/vnd.vegalite.v4+json';\n/**\n * The MIME type for Vega-Lite.\n *\n * #### Notes\n * The version of this follows the major version of Vega-Lite.\n */\nconst VEGALITE5_MIME_TYPE = 'application/vnd.vegalite.v5+json';\n/**\n * A widget for rendering Vega or Vega-Lite data, for usage with rendermime.\n */\nclass RenderedVega extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_0__.Widget {\n    /**\n     * Create a new widget for rendering Vega/Vega-Lite.\n     */\n    constructor(options) {\n        super();\n        this._mimeType = options.mimeType;\n        this._resolver = options.resolver;\n        this.addClass(VEGA_COMMON_CLASS);\n        this.addClass(this._mimeType === VEGA_MIME_TYPE ? VEGA_CLASS : VEGALITE_CLASS);\n    }\n    /**\n     * Render Vega/Vega-Lite into this widget's node.\n     */\n    async renderModel(model) {\n        const spec = model.data[this._mimeType];\n        if (spec === undefined) {\n            return;\n        }\n        const metadata = model.metadata[this._mimeType];\n        const embedOptions = metadata && metadata.embed_options ? metadata.embed_options : {};\n        // If the JupyterLab theme is dark, render this using a dark Vega theme.\n        let bodyThemeDark = document.body.dataset.jpThemeLight === 'false';\n        if (bodyThemeDark) {\n            embedOptions.theme = 'dark';\n        }\n        const mode = this._mimeType === VEGA_MIME_TYPE ? 'vega' : 'vega-lite';\n        const vega = Private.vega != null ? Private.vega : await Private.ensureVega();\n        const el = document.createElement('div');\n        // clear the output before attaching a chart\n        this.node.textContent = '';\n        this.node.appendChild(el);\n        if (this._result) {\n            this._result.finalize();\n        }\n        const loader = vega.vega.loader({\n            http: { credentials: 'same-origin' }\n        });\n        const sanitize = async (uri, options) => {\n            // Use the resolver for any URIs it wants to handle\n            const resolver = this._resolver;\n            if ((resolver === null || resolver === void 0 ? void 0 : resolver.isLocal) && resolver.isLocal(uri)) {\n                const absPath = await resolver.resolveUrl(uri);\n                uri = await resolver.getDownloadUrl(absPath);\n            }\n            return loader.sanitize(uri, options);\n        };\n        this._result = await vega.default(el, spec, {\n            actions: true,\n            defaultStyle: true,\n            ...embedOptions,\n            mode,\n            loader: { ...loader, sanitize }\n        });\n        if (model.data['image/png']) {\n            return;\n        }\n        // Add png representation of vega chart to output\n        const imageURL = await this._result.view.toImageURL('png', typeof embedOptions.scaleFactor === 'number'\n            ? embedOptions.scaleFactor\n            : embedOptions.scaleFactor\n                ? embedOptions.scaleFactor.png\n                : embedOptions.scaleFactor);\n        model.setData({\n            data: { ...model.data, 'image/png': imageURL.split(',')[1] }\n        });\n    }\n    dispose() {\n        if (this._result) {\n            this._result.finalize();\n        }\n        super.dispose();\n    }\n}\n/**\n * A mime renderer factory for vega data.\n */\nconst rendererFactory = {\n    safe: true,\n    mimeTypes: [\n        VEGA_MIME_TYPE,\n        VEGALITE3_MIME_TYPE,\n        VEGALITE4_MIME_TYPE,\n        VEGALITE5_MIME_TYPE\n    ],\n    createRenderer: options => new RenderedVega(options)\n};\nconst extension = {\n    id: '@jupyterlab/vega5-extension:factory',\n    description: 'Provides a renderer for Vega 5 and Vega-Lite 3 to 5 content.',\n    rendererFactory,\n    rank: 57,\n    dataType: 'json',\n    documentWidgetFactoryOptions: [\n        {\n            name: 'Vega5',\n            primaryFileType: 'vega5',\n            fileTypes: ['vega5', 'json'],\n            defaultFor: ['vega5']\n        },\n        {\n            name: 'Vega-Lite5',\n            primaryFileType: 'vega-lite5',\n            fileTypes: ['vega-lite3', 'vega-lite4', 'vega-lite5', 'json'],\n            defaultFor: ['vega-lite3', 'vega-lite4', 'vega-lite5']\n        }\n    ],\n    fileTypes: [\n        {\n            mimeTypes: [VEGA_MIME_TYPE],\n            name: 'vega5',\n            extensions: ['.vg', '.vg.json', '.vega'],\n            icon: 'ui-components:vega'\n        },\n        {\n            mimeTypes: [VEGALITE5_MIME_TYPE],\n            name: 'vega-lite5',\n            extensions: ['.vl', '.vl.json', '.vegalite'],\n            icon: 'ui-components:vega'\n        },\n        {\n            mimeTypes: [VEGALITE4_MIME_TYPE],\n            name: 'vega-lite4',\n            extensions: [],\n            icon: 'ui-components:vega'\n        },\n        {\n            mimeTypes: [VEGALITE3_MIME_TYPE],\n            name: 'vega-lite3',\n            extensions: [],\n            icon: 'ui-components:vega'\n        }\n    ]\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (extension);\n/**\n * A namespace for private module data.\n */\nvar Private;\n(function (Private) {\n    /**\n     * Lazy-load and cache the vega-embed library\n     */\n    function ensureVega() {\n        if (Private.vegaReady) {\n            return Private.vegaReady;\n        }\n        Private.vegaReady = Promise.all(/*! import() */[__webpack_require__.e(\"vendors-node_modules_d3-array_src_deviation_js-node_modules_d3-array_src_intersection_js-node-18c317\"), __webpack_require__.e(\"vendors-node_modules_vega-embed_build_vega-embed_module_js\")]).then(__webpack_require__.bind(__webpack_require__, /*! vega-embed */ \"../node_modules/vega-embed/build/vega-embed.module.js\"));\n        return Private.vegaReady;\n    }\n    Private.ensureVega = ensureVega;\n})(Private || (Private = {}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/vega5-extension/lib/index.js?");

/***/ })

}]);