"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_imageviewer_lib_index_js-_afb91"],{

/***/ "../node_modules/@jupyterlab/imageviewer/lib/index.js":
/*!************************************************************!*\
  !*** ../node_modules/@jupyterlab/imageviewer/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 */   IImageTracker: () => (/* reexport safe */ _tokens__WEBPACK_IMPORTED_MODULE_0__.IImageTracker),\n/* harmony export */   ImageViewer: () => (/* reexport safe */ _widget__WEBPACK_IMPORTED_MODULE_1__.ImageViewer),\n/* harmony export */   ImageViewerFactory: () => (/* reexport safe */ _widget__WEBPACK_IMPORTED_MODULE_1__.ImageViewerFactory)\n/* harmony export */ });\n/* harmony import */ var _tokens__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tokens */ \"../node_modules/@jupyterlab/imageviewer/lib/tokens.js\");\n/* harmony import */ var _widget__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./widget */ \"../node_modules/@jupyterlab/imageviewer/lib/widget.js\");\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module imageviewer\n */\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/imageviewer/lib/index.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/imageviewer/lib/tokens.js":
/*!*************************************************************!*\
  !*** ../node_modules/@jupyterlab/imageviewer/lib/tokens.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 */   IImageTracker: () => (/* binding */ IImageTracker)\n/* harmony export */ });\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n/**\n * The image tracker token.\n */\nconst IImageTracker = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.Token('@jupyterlab/imageviewer:IImageTracker', `A widget tracker for images.\n  Use this if you want to be able to iterate over and interact with images\n  viewed by the application.`);\n//# sourceMappingURL=tokens.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/imageviewer/lib/tokens.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/imageviewer/lib/widget.js":
/*!*************************************************************!*\
  !*** ../node_modules/@jupyterlab/imageviewer/lib/widget.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 */   ImageViewer: () => (/* binding */ ImageViewer),\n/* harmony export */   ImageViewerFactory: () => (/* binding */ ImageViewerFactory)\n/* harmony export */ });\n/* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @jupyterlab/coreutils */ \"webpack/sharing/consume/default/@jupyterlab/coreutils/@jupyterlab/coreutils\");\n/* harmony import */ var _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @jupyterlab/apputils */ \"webpack/sharing/consume/default/@jupyterlab/apputils/@jupyterlab/apputils\");\n/* harmony import */ var _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @jupyterlab/docregistry */ \"webpack/sharing/consume/default/@jupyterlab/docregistry/@jupyterlab/docregistry\");\n/* harmony import */ var _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lumino/coreutils */ \"webpack/sharing/consume/default/@lumino/coreutils/@lumino/coreutils\");\n/* harmony import */ var _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lumino/widgets */ \"webpack/sharing/consume/default/@lumino/widgets/@lumino/widgets\");\n/* harmony import */ var _lumino_widgets__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_lumino_widgets__WEBPACK_IMPORTED_MODULE_4__);\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\n\n\n\n\n/**\n * The class name added to a imageviewer.\n */\nconst IMAGE_CLASS = 'jp-ImageViewer';\n/**\n * A widget for images.\n */\nclass ImageViewer extends _lumino_widgets__WEBPACK_IMPORTED_MODULE_4__.Widget {\n    /**\n     * Construct a new image widget.\n     */\n    constructor(context) {\n        super();\n        this._scale = 1;\n        this._matrix = [1, 0, 0, 1];\n        this._colorinversion = 0;\n        this._ready = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_3__.PromiseDelegate();\n        this.context = context;\n        this.node.tabIndex = 0;\n        this.addClass(IMAGE_CLASS);\n        this._img = document.createElement('img');\n        this.node.appendChild(this._img);\n        this._onTitleChanged();\n        context.pathChanged.connect(this._onTitleChanged, this);\n        void context.ready.then(() => {\n            if (this.isDisposed) {\n                return;\n            }\n            const contents = context.contentsModel;\n            this._mimeType = contents.mimetype;\n            this._render();\n            context.model.contentChanged.connect(this.update, this);\n            context.fileChanged.connect(this.update, this);\n            this._ready.resolve(void 0);\n        });\n    }\n    /**\n     * Print in iframe.\n     */\n    [_jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Printing.symbol]() {\n        return () => _jupyterlab_apputils__WEBPACK_IMPORTED_MODULE_1__.Printing.printWidget(this);\n    }\n    /**\n     * A promise that resolves when the image viewer is ready.\n     */\n    get ready() {\n        return this._ready.promise;\n    }\n    /**\n     * The scale factor for the image.\n     */\n    get scale() {\n        return this._scale;\n    }\n    set scale(value) {\n        if (value === this._scale) {\n            return;\n        }\n        this._scale = value;\n        this._updateStyle();\n    }\n    /**\n     * The color inversion of the image.\n     */\n    get colorinversion() {\n        return this._colorinversion;\n    }\n    set colorinversion(value) {\n        if (value === this._colorinversion) {\n            return;\n        }\n        this._colorinversion = value;\n        this._updateStyle();\n    }\n    /**\n     * Dispose of resources held by the image viewer.\n     */\n    dispose() {\n        if (this._img.src) {\n            URL.revokeObjectURL(this._img.src || '');\n        }\n        super.dispose();\n    }\n    /**\n     * Reset rotation and flip transformations.\n     */\n    resetRotationFlip() {\n        this._matrix = [1, 0, 0, 1];\n        this._updateStyle();\n    }\n    /**\n     * Rotate the image counter-clockwise (left).\n     */\n    rotateCounterclockwise() {\n        this._matrix = Private.prod(this._matrix, Private.rotateCounterclockwiseMatrix);\n        this._updateStyle();\n    }\n    /**\n     * Rotate the image clockwise (right).\n     */\n    rotateClockwise() {\n        this._matrix = Private.prod(this._matrix, Private.rotateClockwiseMatrix);\n        this._updateStyle();\n    }\n    /**\n     * Flip the image horizontally.\n     */\n    flipHorizontal() {\n        this._matrix = Private.prod(this._matrix, Private.flipHMatrix);\n        this._updateStyle();\n    }\n    /**\n     * Flip the image vertically.\n     */\n    flipVertical() {\n        this._matrix = Private.prod(this._matrix, Private.flipVMatrix);\n        this._updateStyle();\n    }\n    /**\n     * Handle `update-request` messages for the widget.\n     */\n    onUpdateRequest(msg) {\n        if (this.isDisposed || !this.context.isReady) {\n            return;\n        }\n        this._render();\n    }\n    /**\n     * Handle `'activate-request'` messages.\n     */\n    onActivateRequest(msg) {\n        this.node.focus();\n    }\n    /**\n     * Handle a change to the title.\n     */\n    _onTitleChanged() {\n        this.title.label = _jupyterlab_coreutils__WEBPACK_IMPORTED_MODULE_0__.PathExt.basename(this.context.localPath);\n    }\n    /**\n     * Render the widget content.\n     */\n    _render() {\n        const context = this.context;\n        const cm = context.contentsModel;\n        if (!cm) {\n            return;\n        }\n        const oldurl = this._img.src || '';\n        let content = context.model.toString();\n        if (cm.format === 'base64') {\n            this._img.src = `data:${this._mimeType};base64,${content}`;\n        }\n        else {\n            const a = new Blob([content], { type: this._mimeType });\n            this._img.src = URL.createObjectURL(a);\n        }\n        URL.revokeObjectURL(oldurl);\n    }\n    /**\n     * Update the image CSS style, including the transform and filter.\n     */\n    _updateStyle() {\n        const [a, b, c, d] = this._matrix;\n        const [tX, tY] = Private.prodVec(this._matrix, [1, 1]);\n        const transform = `matrix(${a}, ${b}, ${c}, ${d}, 0, 0) translate(${tX < 0 ? -100 : 0}%, ${tY < 0 ? -100 : 0}%) `;\n        this._img.style.transform = `scale(${this._scale}) ${transform}`;\n        this._img.style.filter = `invert(${this._colorinversion})`;\n    }\n}\n/**\n * A widget factory for images.\n */\nclass ImageViewerFactory extends _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_2__.ABCWidgetFactory {\n    /**\n     * Create a new widget given a context.\n     */\n    createNewWidget(context) {\n        const content = new ImageViewer(context);\n        const widget = new _jupyterlab_docregistry__WEBPACK_IMPORTED_MODULE_2__.DocumentWidget({ content, context });\n        return widget;\n    }\n}\n/**\n * A namespace for image widget private data.\n */\nvar Private;\n(function (Private) {\n    /**\n     * Multiply 2x2 matrices.\n     */\n    function prod([a11, a12, a21, a22], [b11, b12, b21, b22]) {\n        return [\n            a11 * b11 + a12 * b21,\n            a11 * b12 + a12 * b22,\n            a21 * b11 + a22 * b21,\n            a21 * b12 + a22 * b22\n        ];\n    }\n    Private.prod = prod;\n    /**\n     * Multiply a 2x2 matrix and a 2x1 vector.\n     */\n    function prodVec([a11, a12, a21, a22], [b1, b2]) {\n        return [a11 * b1 + a12 * b2, a21 * b1 + a22 * b2];\n    }\n    Private.prodVec = prodVec;\n    /**\n     * Clockwise rotation transformation matrix.\n     */\n    Private.rotateClockwiseMatrix = [0, 1, -1, 0];\n    /**\n     * Counter-clockwise rotation transformation matrix.\n     */\n    Private.rotateCounterclockwiseMatrix = [0, -1, 1, 0];\n    /**\n     * Horizontal flip transformation matrix.\n     */\n    Private.flipHMatrix = [-1, 0, 0, 1];\n    /**\n     * Vertical flip transformation matrix.\n     */\n    Private.flipVMatrix = [1, 0, 0, -1];\n})(Private || (Private = {}));\n//# sourceMappingURL=widget.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/imageviewer/lib/widget.js?");

/***/ })

}]);