/*
 * 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([["vendors-node_modules_jupyterlab_docprovider_lib_index_js"],{

/***/ "../node_modules/@jupyterlab/docprovider/lib/awareness.js":
/*!****************************************************************!*\
  !*** ../node_modules/@jupyterlab/docprovider/lib/awareness.js ***!
  \****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"moonsOfJupyter\": () => (/* binding */ moonsOfJupyter),\n/* harmony export */   \"getAnonymousUserName\": () => (/* binding */ getAnonymousUserName),\n/* harmony export */   \"userColors\": () => (/* binding */ userColors),\n/* harmony export */   \"getRandomColor\": () => (/* binding */ getRandomColor)\n/* harmony export */ });\n// From https://en.wikipedia.org/wiki/Moons_of_Jupiter\nconst moonsOfJupyter = [\n    'Metis',\n    'Adrastea',\n    'Amalthea',\n    'Thebe',\n    'Io',\n    'Europa',\n    'Ganymede',\n    'Callisto',\n    'Themisto',\n    'Leda',\n    'Ersa',\n    'Pandia',\n    'Himalia',\n    'Lysithea',\n    'Elara',\n    'Dia',\n    'Carpo',\n    'Valetudo',\n    'Euporie',\n    'Eupheme',\n    // 'S/2003 J 18',\n    // 'S/2010 J 2',\n    'Helike',\n    // 'S/2003 J 16',\n    // 'S/2003 J 2',\n    'Euanthe',\n    // 'S/2017 J 7',\n    'Hermippe',\n    'Praxidike',\n    'Thyone',\n    'Thelxinoe',\n    // 'S/2017 J 3',\n    'Ananke',\n    'Mneme',\n    // 'S/2016 J 1',\n    'Orthosie',\n    'Harpalyke',\n    'Iocaste',\n    // 'S/2017 J 9',\n    // 'S/2003 J 12',\n    // 'S/2003 J 4',\n    'Erinome',\n    'Aitne',\n    'Herse',\n    'Taygete',\n    // 'S/2017 J 2',\n    // 'S/2017 J 6',\n    'Eukelade',\n    'Carme',\n    // 'S/2003 J 19',\n    'Isonoe',\n    // 'S/2003 J 10',\n    'Autonoe',\n    'Philophrosyne',\n    'Cyllene',\n    'Pasithee',\n    // 'S/2010 J 1',\n    'Pasiphae',\n    'Sponde',\n    // 'S/2017 J 8',\n    'Eurydome',\n    // 'S/2017 J 5',\n    'Kalyke',\n    'Hegemone',\n    'Kale',\n    'Kallichore',\n    // 'S/2011 J 1',\n    // 'S/2017 J 1',\n    'Chaldene',\n    'Arche',\n    'Eirene',\n    'Kore',\n    // 'S/2011 J 2',\n    // 'S/2003 J 9',\n    'Megaclite',\n    'Aoede',\n    // 'S/2003 J 23',\n    'Callirrhoe',\n    'Sinope'\n];\n/**\n * Get a random user-name based on the moons of Jupyter.\n * This function returns names like \"Anonymous Io\" or \"Anonymous Metis\".\n */\nconst getAnonymousUserName = () => 'Anonymous ' +\n    moonsOfJupyter[Math.floor(Math.random() * moonsOfJupyter.length)];\nconst userColors = [\n    '#12A0D3',\n    '#17AB30',\n    '#CC8500',\n    '#A79011',\n    '#ee6352',\n    '#609DA9',\n    '#4BA749',\n    '#00A1B3'\n];\nconst getRandomColor = () => userColors[Math.floor(Math.random() * userColors.length)];\n//# sourceMappingURL=awareness.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/docprovider/lib/awareness.js?");

/***/ }),

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

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"getAnonymousUserName\": () => (/* reexport safe */ _awareness__WEBPACK_IMPORTED_MODULE_0__.getAnonymousUserName),\n/* harmony export */   \"getRandomColor\": () => (/* reexport safe */ _awareness__WEBPACK_IMPORTED_MODULE_0__.getRandomColor),\n/* harmony export */   \"moonsOfJupyter\": () => (/* reexport safe */ _awareness__WEBPACK_IMPORTED_MODULE_0__.moonsOfJupyter),\n/* harmony export */   \"userColors\": () => (/* reexport safe */ _awareness__WEBPACK_IMPORTED_MODULE_0__.userColors),\n/* harmony export */   \"ProviderMock\": () => (/* reexport safe */ _mock__WEBPACK_IMPORTED_MODULE_1__.ProviderMock),\n/* harmony export */   \"IDocumentProviderFactory\": () => (/* reexport safe */ _tokens__WEBPACK_IMPORTED_MODULE_2__.IDocumentProviderFactory),\n/* harmony export */   \"WebSocketProviderWithLocks\": () => (/* reexport safe */ _yprovider__WEBPACK_IMPORTED_MODULE_3__.WebSocketProviderWithLocks)\n/* harmony export */ });\n/* harmony import */ var _awareness__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./awareness */ \"../node_modules/@jupyterlab/docprovider/lib/awareness.js\");\n/* harmony import */ var _mock__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mock */ \"../node_modules/@jupyterlab/docprovider/lib/mock.js\");\n/* harmony import */ var _tokens__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tokens */ \"../node_modules/@jupyterlab/docprovider/lib/tokens.js\");\n/* harmony import */ var _yprovider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./yprovider */ \"../node_modules/@jupyterlab/docprovider/lib/yprovider.js\");\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module docprovider\n */\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/docprovider/lib/index.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/docprovider/lib/mock.js":
/*!***********************************************************!*\
  !*** ../node_modules/@jupyterlab/docprovider/lib/mock.js ***!
  \***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"ProviderMock\": () => (/* binding */ ProviderMock)\n/* harmony export */ });\nclass ProviderMock {\n    requestInitialContent() {\n        return Promise.resolve(false);\n    }\n    putInitializedState() {\n        /* nop */\n    }\n    acquireLock() {\n        return Promise.resolve(0);\n    }\n    releaseLock(lock) {\n        /* nop */\n    }\n    destroy() {\n        /* nop */\n    }\n    setPath(path) {\n        /* nop */\n    }\n}\n//# sourceMappingURL=mock.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/docprovider/lib/mock.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/docprovider/lib/tokens.js":
/*!*************************************************************!*\
  !*** ../node_modules/@jupyterlab/docprovider/lib/tokens.js ***!
  \*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"IDocumentProviderFactory\": () => (/* binding */ IDocumentProviderFactory)\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\n/**\n * The default document provider token.\n */\nconst IDocumentProviderFactory = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.Token('@jupyterlab/docprovider:IDocumentProviderFactory');\n//# sourceMappingURL=tokens.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/docprovider/lib/tokens.js?");

/***/ }),

/***/ "../node_modules/@jupyterlab/docprovider/lib/yprovider.js":
/*!****************************************************************!*\
  !*** ../node_modules/@jupyterlab/docprovider/lib/yprovider.js ***!
  \****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"WebSocketProviderWithLocks\": () => (/* binding */ WebSocketProviderWithLocks)\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/* harmony import */ var lib0_decoding__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lib0/decoding */ \"../node_modules/lib0/decoding.js\");\n/* harmony import */ var lib0_encoding__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lib0/encoding */ \"../node_modules/lib0/encoding.js\");\n/* harmony import */ var y_websocket__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! y-websocket */ \"../node_modules/y-websocket/src/y-websocket.js\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! yjs */ \"webpack/sharing/consume/default/yjs/yjs\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(yjs__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _awareness__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./awareness */ \"../node_modules/@jupyterlab/docprovider/lib/awareness.js\");\n/* harmony import */ var lib0_environment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lib0/environment */ \"../node_modules/lib0/environment.js\");\n/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n\n\n\n\n\n\n\n/**\n * A class to provide Yjs synchronization over WebSocket.\n *\n * The user can specify their own user-name and user-color by adding url parameters:\n *   ?username=Alice&usercolor=007007\n * where usercolor must be a six-digit hexadecimal encoded RGB value without the hash token.\n *\n * We specify custom messages that the server can interpret. For reference please look in yjs_ws_server.\n *\n */\nclass WebSocketProviderWithLocks extends y_websocket__WEBPACK_IMPORTED_MODULE_2__.WebsocketProvider {\n    /**\n     * Construct a new WebSocketProviderWithLocks\n     *\n     * @param options The instantiation options for a WebSocketProviderWithLocks\n     */\n    constructor(options) {\n        var _a;\n        super(options.url, options.contentType + ':' + options.path, options.ymodel.ydoc, {\n            awareness: options.ymodel.awareness\n        });\n        this._currentLockRequest = null;\n        this._initialContentRequest = null;\n        this._path = options.path;\n        this._contentType = options.contentType;\n        this._serverUrl = options.url;\n        const color = '#' + lib0_environment__WEBPACK_IMPORTED_MODULE_3__.getParam('--usercolor', (0,_awareness__WEBPACK_IMPORTED_MODULE_4__.getRandomColor)().slice(1));\n        const name = lib0_environment__WEBPACK_IMPORTED_MODULE_3__.getParam('--username', (0,_awareness__WEBPACK_IMPORTED_MODULE_4__.getAnonymousUserName)());\n        const awareness = options.ymodel.awareness;\n        const currState = awareness.getLocalState();\n        // only set if this was not already set by another plugin\n        if (currState && ((_a = currState.user) === null || _a === void 0 ? void 0 : _a.name) == null) {\n            options.ymodel.awareness.setLocalStateField('user', {\n                name,\n                color\n            });\n        }\n        // Message handler that confirms when a lock has been acquired\n        this.messageHandlers[127] = (encoder, decoder, provider, emitSynced, messageType) => {\n            // acquired lock\n            const timestamp = lib0_decoding__WEBPACK_IMPORTED_MODULE_5__.readUint32(decoder);\n            const lockRequest = this._currentLockRequest;\n            this._currentLockRequest = null;\n            if (lockRequest) {\n                lockRequest.resolve(timestamp);\n            }\n        };\n        // Message handler that receives the initial content\n        this.messageHandlers[125] = (encoder, decoder, provider, emitSynced, messageType) => {\n            // received initial content\n            const initialContent = lib0_decoding__WEBPACK_IMPORTED_MODULE_5__.readTailAsUint8Array(decoder);\n            // Apply data from server\n            if (initialContent.byteLength > 0) {\n                setTimeout(() => {\n                    yjs__WEBPACK_IMPORTED_MODULE_1__.applyUpdate(this.doc, initialContent);\n                }, 0);\n            }\n            const initialContentRequest = this._initialContentRequest;\n            this._initialContentRequest = null;\n            if (initialContentRequest) {\n                initialContentRequest.resolve(initialContent.byteLength > 0);\n            }\n        };\n        this._isInitialized = false;\n        this._onConnectionStatus = this._onConnectionStatus.bind(this);\n        this.on('status', this._onConnectionStatus);\n    }\n    setPath(newPath) {\n        if (newPath !== this._path) {\n            this._path = newPath;\n            // The next time the provider connects, we should connect through a different server url\n            this.bcChannel =\n                this._serverUrl + '/' + this._contentType + ':' + this._path;\n            this.url = this.bcChannel;\n            const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.createEncoder();\n            lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.write(encoder, 123);\n            // writing a utf8 string to the encoder\n            const escapedPath = unescape(encodeURIComponent(this._contentType + ':' + newPath));\n            for (let i = 0; i < escapedPath.length; i++) {\n                lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.write(encoder, \n                /** @type {number} */ escapedPath.codePointAt(i));\n            }\n            this._sendMessage(lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.toUint8Array(encoder));\n        }\n    }\n    /**\n     * Resolves to true if the initial content has been initialized on the server. false otherwise.\n     */\n    requestInitialContent() {\n        if (this._initialContentRequest) {\n            return this._initialContentRequest.promise;\n        }\n        this._initialContentRequest = new _lumino_coreutils__WEBPACK_IMPORTED_MODULE_0__.PromiseDelegate();\n        this._sendMessage(new Uint8Array([125]));\n        // Resolve with true if the server doesn't respond for some reason.\n        // In case of a connection problem, we don't want the user to re-initialize the window.\n        // Instead wait for y-websocket to connect to the server.\n        // @todo maybe we should reload instead..\n        setTimeout(() => { var _a; return (_a = this._initialContentRequest) === null || _a === void 0 ? void 0 : _a.resolve(false); }, 1000);\n        return this._initialContentRequest.promise;\n    }\n    /**\n     * Put the initialized state.\n     */\n    putInitializedState() {\n        const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.createEncoder();\n        lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.writeVarUint(encoder, 124);\n        lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.writeUint8Array(encoder, yjs__WEBPACK_IMPORTED_MODULE_1__.encodeStateAsUpdate(this.doc));\n        this._sendMessage(lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.toUint8Array(encoder));\n        this._isInitialized = true;\n    }\n    /**\n     * Acquire a lock.\n     * Returns a Promise that resolves to the lock number.\n     */\n    acquireLock() {\n        if (this._currentLockRequest) {\n            return this._currentLockRequest.promise;\n        }\n        this._sendMessage(new Uint8Array([127]));\n        // try to acquire lock in regular interval\n        const intervalID = setInterval(() => {\n            if (this.wsconnected) {\n                // try to acquire lock\n                this._sendMessage(new Uint8Array([127]));\n            }\n        }, 500);\n        let resolve, reject;\n        const promise = new Promise((_resolve, _reject) => {\n            resolve = _resolve;\n            reject = _reject;\n        });\n        this._currentLockRequest = { promise, resolve, reject };\n        const _finally = () => {\n            clearInterval(intervalID);\n        };\n        promise.then(_finally, _finally);\n        return promise;\n    }\n    /**\n     * Release a lock.\n     *\n     * @param lock The lock to release.\n     */\n    releaseLock(lock) {\n        const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.createEncoder();\n        // reply with release lock\n        lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.writeVarUint(encoder, 126);\n        lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.writeUint32(encoder, lock);\n        // releasing lock\n        this._sendMessage(lib0_encoding__WEBPACK_IMPORTED_MODULE_6__.toUint8Array(encoder));\n    }\n    /**\n     * Send a new message to WebSocket server.\n     *\n     * @param message The message to send\n     */\n    _sendMessage(message) {\n        // send once connected\n        const send = () => {\n            setTimeout(() => {\n                if (this.wsconnected) {\n                    this.ws.send(message);\n                }\n                else {\n                    this.once('status', send);\n                }\n            }, 0);\n        };\n        send();\n    }\n    /**\n     * Handle a change to the connection status.\n     *\n     * @param status The connection status.\n     */\n    async _onConnectionStatus(status) {\n        if (this._isInitialized && status.status === 'connected') {\n            const lock = await this.acquireLock();\n            const contentIsInitialized = await this.requestInitialContent();\n            if (!contentIsInitialized) {\n                this.putInitializedState();\n            }\n            this.releaseLock(lock);\n        }\n    }\n}\n//# sourceMappingURL=yprovider.js.map\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/@jupyterlab/docprovider/lib/yprovider.js?");

/***/ }),

/***/ "../node_modules/lib0/broadcastchannel.js":
/*!************************************************!*\
  !*** ../node_modules/lib0/broadcastchannel.js ***!
  \************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"subscribe\": () => (/* binding */ subscribe),\n/* harmony export */   \"unsubscribe\": () => (/* binding */ unsubscribe),\n/* harmony export */   \"publish\": () => (/* binding */ publish)\n/* harmony export */ });\n/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./map.js */ \"../node_modules/lib0/map.js\");\n/* harmony import */ var _buffer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./buffer.js */ \"../node_modules/lib0/buffer.js\");\n/* harmony import */ var _storage_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storage.js */ \"../node_modules/lib0/storage.js\");\n/* eslint-env browser */\n\n/**\n * Helpers for cross-tab communication using broadcastchannel with LocalStorage fallback.\n *\n * ```js\n * // In browser window A:\n * broadcastchannel.subscribe('my events', data => console.log(data))\n * broadcastchannel.publish('my events', 'Hello world!') // => A: 'Hello world!' fires synchronously in same tab\n *\n * // In browser window B:\n * broadcastchannel.publish('my events', 'hello from tab B') // => A: 'hello from tab B'\n * ```\n *\n * @module broadcastchannel\n */\n\n// @todo before next major: use Uint8Array instead as buffer object\n\n\n\n\n\n/**\n * @typedef {Object} Channel\n * @property {Set<Function>} Channel.subs\n * @property {any} Channel.bc\n */\n\n/**\n * @type {Map<string, Channel>}\n */\nconst channels = new Map()\n\nclass LocalStoragePolyfill {\n  /**\n   * @param {string} room\n   */\n  constructor (room) {\n    this.room = room\n    /**\n     * @type {null|function({data:ArrayBuffer}):void}\n     */\n    this.onmessage = null\n    _storage_js__WEBPACK_IMPORTED_MODULE_0__.onChange(e => e.key === room && this.onmessage !== null && this.onmessage({ data: _buffer_js__WEBPACK_IMPORTED_MODULE_1__.fromBase64(e.newValue || '') }))\n  }\n\n  /**\n   * @param {ArrayBuffer} buf\n   */\n  postMessage (buf) {\n    _storage_js__WEBPACK_IMPORTED_MODULE_0__.varStorage.setItem(this.room, _buffer_js__WEBPACK_IMPORTED_MODULE_1__.toBase64(_buffer_js__WEBPACK_IMPORTED_MODULE_1__.createUint8ArrayFromArrayBuffer(buf)))\n  }\n}\n\n// Use BroadcastChannel or Polyfill\nconst BC = typeof BroadcastChannel === 'undefined' ? LocalStoragePolyfill : BroadcastChannel\n\n/**\n * @param {string} room\n * @return {Channel}\n */\nconst getChannel = room =>\n  _map_js__WEBPACK_IMPORTED_MODULE_2__.setIfUndefined(channels, room, () => {\n    const subs = new Set()\n    const bc = new BC(room)\n    /**\n     * @param {{data:ArrayBuffer}} e\n     */\n    bc.onmessage = e => subs.forEach(sub => sub(e.data))\n    return {\n      bc, subs\n    }\n  })\n\n/**\n * Subscribe to global `publish` events.\n *\n * @function\n * @param {string} room\n * @param {function(any):any} f\n */\nconst subscribe = (room, f) => getChannel(room).subs.add(f)\n\n/**\n * Unsubscribe from `publish` global events.\n *\n * @function\n * @param {string} room\n * @param {function(any):any} f\n */\nconst unsubscribe = (room, f) => getChannel(room).subs.delete(f)\n\n/**\n * Publish data to all subscribers (including subscribers on this tab)\n *\n * @function\n * @param {string} room\n * @param {any} data\n */\nconst publish = (room, data) => {\n  const c = getChannel(room)\n  c.bc.postMessage(data)\n  c.subs.forEach(sub => sub(data))\n}\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/lib0/broadcastchannel.js?");

/***/ }),

/***/ "../node_modules/lib0/mutex.js":
/*!*************************************!*\
  !*** ../node_modules/lib0/mutex.js ***!
  \*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"createMutex\": () => (/* binding */ createMutex)\n/* harmony export */ });\n/**\n * Mutual exclude for JavaScript.\n *\n * @module mutex\n */\n\n/**\n * @callback mutex\n * @param {function():void} cb Only executed when this mutex is not in the current stack\n * @param {function():void} [elseCb] Executed when this mutex is in the current stack\n */\n\n/**\n * Creates a mutual exclude function with the following property:\n *\n * ```js\n * const mutex = createMutex()\n * mutex(() => {\n *   // This function is immediately executed\n *   mutex(() => {\n *     // This function is not executed, as the mutex is already active.\n *   })\n * })\n * ```\n *\n * @return {mutex} A mutual exclude function\n * @public\n */\nconst createMutex = () => {\n  let token = true\n  return (f, g) => {\n    if (token) {\n      token = false\n      try {\n        f()\n      } finally {\n        token = true\n      }\n    } else if (g !== undefined) {\n      g()\n    }\n  }\n}\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/lib0/mutex.js?");

/***/ }),

/***/ "../node_modules/lib0/url.js":
/*!***********************************!*\
  !*** ../node_modules/lib0/url.js ***!
  \***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"decodeQueryParams\": () => (/* binding */ decodeQueryParams),\n/* harmony export */   \"encodeQueryParams\": () => (/* binding */ encodeQueryParams)\n/* harmony export */ });\n/* harmony import */ var _object_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./object.js */ \"../node_modules/lib0/object.js\");\n/**\n * Utility module to work with urls.\n *\n * @module url\n */\n\n\n\n/**\n * Parse query parameters from an url.\n *\n * @param {string} url\n * @return {Object<string,string>}\n */\nconst decodeQueryParams = url => {\n  /**\n   * @type {Object<string,string>}\n   */\n  const query = {}\n  const urlQuerySplit = url.split('?')\n  const pairs = urlQuerySplit[urlQuerySplit.length - 1].split('&')\n  for (var i = 0; i < pairs.length; i++) {\n    const item = pairs[i]\n    if (item.length > 0) {\n      const pair = item.split('=')\n      query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '')\n    }\n  }\n  return query\n}\n\n/**\n * @param {Object<string,string>} params\n * @return {string}\n */\nconst encodeQueryParams = params =>\n  _object_js__WEBPACK_IMPORTED_MODULE_0__.map(params, (val, key) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`).join('&')\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/lib0/url.js?");

/***/ }),

/***/ "../node_modules/y-protocols/auth.js":
/*!*******************************************!*\
  !*** ../node_modules/y-protocols/auth.js ***!
  \*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"messagePermissionDenied\": () => (/* binding */ messagePermissionDenied),\n/* harmony export */   \"writePermissionDenied\": () => (/* binding */ writePermissionDenied),\n/* harmony export */   \"readAuthMessage\": () => (/* binding */ readAuthMessage)\n/* harmony export */ });\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! yjs */ \"webpack/sharing/consume/default/yjs/yjs\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(yjs__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lib0_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib0/encoding */ \"../node_modules/lib0/encoding.js\");\n/* harmony import */ var lib0_decoding__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lib0/decoding */ \"../node_modules/lib0/decoding.js\");\n\n // eslint-disable-line\n\n\n\nconst messagePermissionDenied = 0\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {string} reason\n */\nconst writePermissionDenied = (encoder, reason) => {\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_1__.writeVarUint(encoder, messagePermissionDenied)\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_1__.writeVarString(encoder, reason)\n}\n\n/**\n * @callback PermissionDeniedHandler\n * @param {any} y\n * @param {string} reason\n */\n\n/**\n *\n * @param {decoding.Decoder} decoder\n * @param {Y.Doc} y\n * @param {PermissionDeniedHandler} permissionDeniedHandler\n */\nconst readAuthMessage = (decoder, y, permissionDeniedHandler) => {\n  switch (lib0_decoding__WEBPACK_IMPORTED_MODULE_2__.readVarUint(decoder)) {\n    case messagePermissionDenied: permissionDeniedHandler(y, lib0_decoding__WEBPACK_IMPORTED_MODULE_2__.readVarString(decoder))\n  }\n}\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/y-protocols/auth.js?");

/***/ }),

/***/ "../node_modules/y-protocols/sync.js":
/*!*******************************************!*\
  !*** ../node_modules/y-protocols/sync.js ***!
  \*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"messageYjsSyncStep1\": () => (/* binding */ messageYjsSyncStep1),\n/* harmony export */   \"messageYjsSyncStep2\": () => (/* binding */ messageYjsSyncStep2),\n/* harmony export */   \"messageYjsUpdate\": () => (/* binding */ messageYjsUpdate),\n/* harmony export */   \"writeSyncStep1\": () => (/* binding */ writeSyncStep1),\n/* harmony export */   \"writeSyncStep2\": () => (/* binding */ writeSyncStep2),\n/* harmony export */   \"readSyncStep1\": () => (/* binding */ readSyncStep1),\n/* harmony export */   \"readSyncStep2\": () => (/* binding */ readSyncStep2),\n/* harmony export */   \"writeUpdate\": () => (/* binding */ writeUpdate),\n/* harmony export */   \"readUpdate\": () => (/* binding */ readUpdate),\n/* harmony export */   \"readSyncMessage\": () => (/* binding */ readSyncMessage)\n/* harmony export */ });\n/* harmony import */ var lib0_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lib0/encoding */ \"../node_modules/lib0/encoding.js\");\n/* harmony import */ var lib0_decoding__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lib0/decoding */ \"../node_modules/lib0/decoding.js\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! yjs */ \"webpack/sharing/consume/default/yjs/yjs\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(yjs__WEBPACK_IMPORTED_MODULE_0__);\n/**\n * @module sync-protocol\n */\n\n\n\n\n\n/**\n * @typedef {Map<number, number>} StateMap\n */\n\n/**\n * Core Yjs defines two message types:\n * • YjsSyncStep1: Includes the State Set of the sending client. When received, the client should reply with YjsSyncStep2.\n * • YjsSyncStep2: Includes all missing structs and the complete delete set. When received, the client is assured that it\n *   received all information from the remote client.\n *\n * In a peer-to-peer network, you may want to introduce a SyncDone message type. Both parties should initiate the connection\n * with SyncStep1. When a client received SyncStep2, it should reply with SyncDone. When the local client received both\n * SyncStep2 and SyncDone, it is assured that it is synced to the remote client.\n *\n * In a client-server model, you want to handle this differently: The client should initiate the connection with SyncStep1.\n * When the server receives SyncStep1, it should reply with SyncStep2 immediately followed by SyncStep1. The client replies\n * with SyncStep2 when it receives SyncStep1. Optionally the server may send a SyncDone after it received SyncStep2, so the\n * client knows that the sync is finished.  There are two reasons for this more elaborated sync model: 1. This protocol can\n * easily be implemented on top of http and websockets. 2. The server shoul only reply to requests, and not initiate them.\n * Therefore it is necesarry that the client initiates the sync.\n *\n * Construction of a message:\n * [messageType : varUint, message definition..]\n *\n * Note: A message does not include information about the room name. This must to be handled by the upper layer protocol!\n *\n * stringify[messageType] stringifies a message definition (messageType is already read from the bufffer)\n */\n\nconst messageYjsSyncStep1 = 0\nconst messageYjsSyncStep2 = 1\nconst messageYjsUpdate = 2\n\n/**\n * Create a sync step 1 message based on the state of the current shared document.\n *\n * @param {encoding.Encoder} encoder\n * @param {Y.Doc} doc\n */\nconst writeSyncStep1 = (encoder, doc) => {\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_1__.writeVarUint(encoder, messageYjsSyncStep1)\n  const sv = yjs__WEBPACK_IMPORTED_MODULE_0__.encodeStateVector(doc)\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_1__.writeVarUint8Array(encoder, sv)\n}\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {Y.Doc} doc\n * @param {Uint8Array} [encodedStateVector]\n */\nconst writeSyncStep2 = (encoder, doc, encodedStateVector) => {\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_1__.writeVarUint(encoder, messageYjsSyncStep2)\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_1__.writeVarUint8Array(encoder, yjs__WEBPACK_IMPORTED_MODULE_0__.encodeStateAsUpdate(doc, encodedStateVector))\n}\n\n/**\n * Read SyncStep1 message and reply with SyncStep2.\n *\n * @param {decoding.Decoder} decoder The reply to the received message\n * @param {encoding.Encoder} encoder The received message\n * @param {Y.Doc} doc\n */\nconst readSyncStep1 = (decoder, encoder, doc) =>\n  writeSyncStep2(encoder, doc, lib0_decoding__WEBPACK_IMPORTED_MODULE_2__.readVarUint8Array(decoder))\n\n/**\n * Read and apply Structs and then DeleteStore to a y instance.\n *\n * @param {decoding.Decoder} decoder\n * @param {Y.Doc} doc\n * @param {any} transactionOrigin\n */\nconst readSyncStep2 = (decoder, doc, transactionOrigin) => {\n  try {\n    yjs__WEBPACK_IMPORTED_MODULE_0__.applyUpdate(doc, lib0_decoding__WEBPACK_IMPORTED_MODULE_2__.readVarUint8Array(decoder), transactionOrigin)\n  } catch (error) {\n    // This catches errors that are thrown by event handlers\n    console.error('Caught error while handling a Yjs update', error)\n  }\n}\n\n/**\n * @param {encoding.Encoder} encoder\n * @param {Uint8Array} update\n */\nconst writeUpdate = (encoder, update) => {\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_1__.writeVarUint(encoder, messageYjsUpdate)\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_1__.writeVarUint8Array(encoder, update)\n}\n\n/**\n * Read and apply Structs and then DeleteStore to a y instance.\n *\n * @param {decoding.Decoder} decoder\n * @param {Y.Doc} doc\n * @param {any} transactionOrigin\n */\nconst readUpdate = readSyncStep2\n\n/**\n * @param {decoding.Decoder} decoder A message received from another client\n * @param {encoding.Encoder} encoder The reply message. Will not be sent if empty.\n * @param {Y.Doc} doc\n * @param {any} transactionOrigin\n */\nconst readSyncMessage = (decoder, encoder, doc, transactionOrigin) => {\n  const messageType = lib0_decoding__WEBPACK_IMPORTED_MODULE_2__.readVarUint(decoder)\n  switch (messageType) {\n    case messageYjsSyncStep1:\n      readSyncStep1(decoder, encoder, doc)\n      break\n    case messageYjsSyncStep2:\n      readSyncStep2(decoder, doc, transactionOrigin)\n      break\n    case messageYjsUpdate:\n      readUpdate(decoder, doc, transactionOrigin)\n      break\n    default:\n      throw new Error('Unknown message type')\n  }\n  return messageType\n}\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/y-protocols/sync.js?");

/***/ }),

/***/ "../node_modules/y-websocket/src/y-websocket.js":
/*!******************************************************!*\
  !*** ../node_modules/y-websocket/src/y-websocket.js ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"WebsocketProvider\": () => (/* binding */ WebsocketProvider)\n/* harmony export */ });\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! yjs */ \"webpack/sharing/consume/default/yjs/yjs\");\n/* harmony import */ var yjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(yjs__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lib0/broadcastchannel */ \"../node_modules/lib0/broadcastchannel.js\");\n/* harmony import */ var lib0_time__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lib0/time */ \"../node_modules/lib0/time.js\");\n/* harmony import */ var lib0_encoding__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lib0/encoding */ \"../node_modules/lib0/encoding.js\");\n/* harmony import */ var lib0_decoding__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lib0/decoding */ \"../node_modules/lib0/decoding.js\");\n/* harmony import */ var y_protocols_sync__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! y-protocols/sync */ \"../node_modules/y-protocols/sync.js\");\n/* harmony import */ var y_protocols_auth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! y-protocols/auth */ \"../node_modules/y-protocols/auth.js\");\n/* harmony import */ var y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! y-protocols/awareness */ \"../node_modules/y-protocols/awareness.js\");\n/* harmony import */ var lib0_mutex__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! lib0/mutex */ \"../node_modules/lib0/mutex.js\");\n/* harmony import */ var lib0_observable__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! lib0/observable */ \"../node_modules/lib0/observable.js\");\n/* harmony import */ var lib0_math__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lib0/math */ \"../node_modules/lib0/math.js\");\n/* harmony import */ var lib0_url__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! lib0/url */ \"../node_modules/lib0/url.js\");\n/*\nUnlike stated in the LICENSE file, it is not necessary to include the copyright notice and permission notice when you copy code from this file.\n*/\n\n/**\n * @module provider/websocket\n */\n\n/* eslint-env browser */\n\n // eslint-disable-line\n\n\n\n\n\n\n\n\n\n\n\n\nconst messageSync = 0\nconst messageQueryAwareness = 3\nconst messageAwareness = 1\nconst messageAuth = 2\n\n/**\n *                       encoder,          decoder,          provider,          emitSynced, messageType\n * @type {Array<function(encoding.Encoder, decoding.Decoder, WebsocketProvider, boolean,    number):void>}\n */\nconst messageHandlers = []\n\nmessageHandlers[messageSync] = (encoder, decoder, provider, emitSynced, messageType) => {\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoder, messageSync)\n  const syncMessageType = y_protocols_sync__WEBPACK_IMPORTED_MODULE_1__.readSyncMessage(decoder, encoder, provider.doc, provider)\n  if (emitSynced && syncMessageType === y_protocols_sync__WEBPACK_IMPORTED_MODULE_1__.messageYjsSyncStep2 && !provider.synced) {\n    provider.synced = true\n  }\n}\n\nmessageHandlers[messageQueryAwareness] = (encoder, decoder, provider, emitSynced, messageType) => {\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoder, messageAwareness)\n  lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint8Array(encoder, y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.encodeAwarenessUpdate(provider.awareness, Array.from(provider.awareness.getStates().keys())))\n}\n\nmessageHandlers[messageAwareness] = (encoder, decoder, provider, emitSynced, messageType) => {\n  y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.applyAwarenessUpdate(provider.awareness, lib0_decoding__WEBPACK_IMPORTED_MODULE_5__.readVarUint8Array(decoder), provider)\n}\n\nmessageHandlers[messageAuth] = (encoder, decoder, provider, emitSynced, messageType) => {\n  y_protocols_auth__WEBPACK_IMPORTED_MODULE_2__.readAuthMessage(decoder, provider.doc, permissionDeniedHandler)\n}\n\nconst reconnectTimeoutBase = 1200\nconst maxReconnectTimeout = 2500\n// @todo - this should depend on awareness.outdatedTime\nconst messageReconnectTimeout = 30000\n\n/**\n * @param {WebsocketProvider} provider\n * @param {string} reason\n */\nconst permissionDeniedHandler = (provider, reason) => console.warn(`Permission denied to access ${provider.url}.\\n${reason}`)\n\n/**\n * @param {WebsocketProvider} provider\n * @param {Uint8Array} buf\n * @param {boolean} emitSynced\n * @return {encoding.Encoder}\n */\nconst readMessage = (provider, buf, emitSynced) => {\n  const decoder = lib0_decoding__WEBPACK_IMPORTED_MODULE_5__.createDecoder(buf)\n  const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n  const messageType = lib0_decoding__WEBPACK_IMPORTED_MODULE_5__.readVarUint(decoder)\n  const messageHandler = provider.messageHandlers[messageType]\n  if (/** @type {any} */ (messageHandler)) {\n    messageHandler(encoder, decoder, provider, emitSynced, messageType)\n  } else {\n    console.error('Unable to compute message')\n  }\n  return encoder\n}\n\n/**\n * @param {WebsocketProvider} provider\n */\nconst setupWS = provider => {\n  if (provider.shouldConnect && provider.ws === null) {\n    const websocket = new provider._WS(provider.url)\n    websocket.binaryType = 'arraybuffer'\n    provider.ws = websocket\n    provider.wsconnecting = true\n    provider.wsconnected = false\n    provider.synced = false\n\n    websocket.onmessage = event => {\n      provider.wsLastMessageReceived = lib0_time__WEBPACK_IMPORTED_MODULE_6__.getUnixTime()\n      const encoder = readMessage(provider, new Uint8Array(event.data), true)\n      if (lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.length(encoder) > 1) {\n        websocket.send(lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoder))\n      }\n    }\n    websocket.onclose = () => {\n      provider.ws = null\n      provider.wsconnecting = false\n      if (provider.wsconnected) {\n        provider.wsconnected = false\n        provider.synced = false\n        // update awareness (all users except local left)\n        y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.removeAwarenessStates(provider.awareness, Array.from(provider.awareness.getStates().keys()).filter(client => client !== provider.doc.clientID), provider)\n        provider.emit('status', [{\n          status: 'disconnected'\n        }])\n      } else {\n        provider.wsUnsuccessfulReconnects++\n      }\n      // Start with no reconnect timeout and increase timeout by\n      // log10(wsUnsuccessfulReconnects).\n      // The idea is to increase reconnect timeout slowly and have no reconnect\n      // timeout at the beginning (log(1) = 0)\n      setTimeout(setupWS, lib0_math__WEBPACK_IMPORTED_MODULE_7__.min(lib0_math__WEBPACK_IMPORTED_MODULE_7__.log10(provider.wsUnsuccessfulReconnects + 1) * reconnectTimeoutBase, maxReconnectTimeout), provider)\n    }\n    websocket.onopen = () => {\n      provider.wsLastMessageReceived = lib0_time__WEBPACK_IMPORTED_MODULE_6__.getUnixTime()\n      provider.wsconnecting = false\n      provider.wsconnected = true\n      provider.wsUnsuccessfulReconnects = 0\n      provider.emit('status', [{\n        status: 'connected'\n      }])\n      // always send sync step 1 when connected\n      const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n      lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoder, messageSync)\n      y_protocols_sync__WEBPACK_IMPORTED_MODULE_1__.writeSyncStep1(encoder, provider.doc)\n      websocket.send(lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoder))\n      // broadcast local awareness state\n      if (provider.awareness.getLocalState() !== null) {\n        const encoderAwarenessState = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n        lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoderAwarenessState, messageAwareness)\n        lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint8Array(encoderAwarenessState, y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.encodeAwarenessUpdate(provider.awareness, [provider.doc.clientID]))\n        websocket.send(lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoderAwarenessState))\n      }\n    }\n\n    provider.emit('status', [{\n      status: 'connecting'\n    }])\n  }\n}\n\n/**\n * @param {WebsocketProvider} provider\n * @param {ArrayBuffer} buf\n */\nconst broadcastMessage = (provider, buf) => {\n  if (provider.wsconnected) {\n    /** @type {WebSocket} */ (provider.ws).send(buf)\n  }\n  if (provider.bcconnected) {\n    provider.mux(() => {\n      lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__.publish(provider.bcChannel, buf)\n    })\n  }\n}\n\n/**\n * Websocket Provider for Yjs. Creates a websocket connection to sync the shared document.\n * The document name is attached to the provided url. I.e. the following example\n * creates a websocket connection to http://localhost:1234/my-document-name\n *\n * @example\n *   import * as Y from 'yjs'\n *   import { WebsocketProvider } from 'y-websocket'\n *   const doc = new Y.Doc()\n *   const provider = new WebsocketProvider('http://localhost:1234', 'my-document-name', doc)\n *\n * @extends {Observable<string>}\n */\nclass WebsocketProvider extends lib0_observable__WEBPACK_IMPORTED_MODULE_9__.Observable {\n  /**\n   * @param {string} serverUrl\n   * @param {string} roomname\n   * @param {Y.Doc} doc\n   * @param {object} [opts]\n   * @param {boolean} [opts.connect]\n   * @param {awarenessProtocol.Awareness} [opts.awareness]\n   * @param {Object<string,string>} [opts.params]\n   * @param {typeof WebSocket} [opts.WebSocketPolyfill] Optionall provide a WebSocket polyfill\n   * @param {number} [opts.resyncInterval] Request server state every `resyncInterval` milliseconds\n   */\n  constructor (serverUrl, roomname, doc, { connect = true, awareness = new y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.Awareness(doc), params = {}, WebSocketPolyfill = WebSocket, resyncInterval = -1 } = {}) {\n    super()\n    // ensure that url is always ends with /\n    while (serverUrl[serverUrl.length - 1] === '/') {\n      serverUrl = serverUrl.slice(0, serverUrl.length - 1)\n    }\n    const encodedParams = lib0_url__WEBPACK_IMPORTED_MODULE_10__.encodeQueryParams(params)\n    this.bcChannel = serverUrl + '/' + roomname\n    this.url = serverUrl + '/' + roomname + (encodedParams.length === 0 ? '' : '?' + encodedParams)\n    this.roomname = roomname\n    this.doc = doc\n    this._WS = WebSocketPolyfill\n    this.awareness = awareness\n    this.wsconnected = false\n    this.wsconnecting = false\n    this.bcconnected = false\n    this.wsUnsuccessfulReconnects = 0\n    this.messageHandlers = messageHandlers.slice()\n    this.mux = lib0_mutex__WEBPACK_IMPORTED_MODULE_11__.createMutex()\n    /**\n     * @type {boolean}\n     */\n    this._synced = false\n    /**\n     * @type {WebSocket?}\n     */\n    this.ws = null\n    this.wsLastMessageReceived = 0\n    /**\n     * Whether to connect to other peers or not\n     * @type {boolean}\n     */\n    this.shouldConnect = connect\n\n    /**\n     * @type {number}\n     */\n    this._resyncInterval = 0\n    if (resyncInterval > 0) {\n      this._resyncInterval = /** @type {any} */ (setInterval(() => {\n        if (this.ws) {\n          // resend sync step 1\n          const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n          lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoder, messageSync)\n          y_protocols_sync__WEBPACK_IMPORTED_MODULE_1__.writeSyncStep1(encoder, doc)\n          this.ws.send(lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoder))\n        }\n      }, resyncInterval))\n    }\n\n    /**\n     * @param {ArrayBuffer} data\n     */\n    this._bcSubscriber = data => {\n      this.mux(() => {\n        const encoder = readMessage(this, new Uint8Array(data), false)\n        if (lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.length(encoder) > 1) {\n          lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__.publish(this.bcChannel, lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoder))\n        }\n      })\n    }\n    /**\n     * Listens to Yjs updates and sends them to remote peers (ws and broadcastchannel)\n     * @param {Uint8Array} update\n     * @param {any} origin\n     */\n    this._updateHandler = (update, origin) => {\n      if (origin !== this) {\n        const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n        lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoder, messageSync)\n        y_protocols_sync__WEBPACK_IMPORTED_MODULE_1__.writeUpdate(encoder, update)\n        broadcastMessage(this, lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoder))\n      }\n    }\n    this.doc.on('update', this._updateHandler)\n    /**\n     * @param {any} changed\n     * @param {any} origin\n     */\n    this._awarenessUpdateHandler = ({ added, updated, removed }, origin) => {\n      const changedClients = added.concat(updated).concat(removed)\n      const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n      lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoder, messageAwareness)\n      lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint8Array(encoder, y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.encodeAwarenessUpdate(awareness, changedClients))\n      broadcastMessage(this, lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoder))\n    }\n    if (typeof window !== 'undefined') {\n      window.addEventListener('beforeunload', () => {\n        y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.removeAwarenessStates(this.awareness, [doc.clientID], 'window unload')\n      })\n    }\n    awareness.on('update', this._awarenessUpdateHandler)\n    this._checkInterval = /** @type {any} */ (setInterval(() => {\n      if (this.wsconnected && messageReconnectTimeout < lib0_time__WEBPACK_IMPORTED_MODULE_6__.getUnixTime() - this.wsLastMessageReceived) {\n        // no message received in a long time - not even your own awareness\n        // updates (which are updated every 15 seconds)\n        /** @type {WebSocket} */ (this.ws).close()\n      }\n    }, messageReconnectTimeout / 10))\n    if (connect) {\n      this.connect()\n    }\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get synced () {\n    return this._synced\n  }\n\n  set synced (state) {\n    if (this._synced !== state) {\n      this._synced = state\n      this.emit('synced', [state])\n      this.emit('sync', [state])\n    }\n  }\n\n  destroy () {\n    if (this._resyncInterval !== 0) {\n      clearInterval(this._resyncInterval)\n    }\n    clearInterval(this._checkInterval)\n    this.disconnect()\n    this.awareness.off('update', this._awarenessUpdateHandler)\n    this.doc.off('update', this._updateHandler)\n    super.destroy()\n  }\n\n  connectBc () {\n    if (!this.bcconnected) {\n      lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__.subscribe(this.bcChannel, this._bcSubscriber)\n      this.bcconnected = true\n    }\n    // send sync step1 to bc\n    this.mux(() => {\n      // write sync step 1\n      const encoderSync = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n      lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoderSync, messageSync)\n      y_protocols_sync__WEBPACK_IMPORTED_MODULE_1__.writeSyncStep1(encoderSync, this.doc)\n      lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__.publish(this.bcChannel, lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoderSync))\n      // broadcast local state\n      const encoderState = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n      lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoderState, messageSync)\n      y_protocols_sync__WEBPACK_IMPORTED_MODULE_1__.writeSyncStep2(encoderState, this.doc)\n      lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__.publish(this.bcChannel, lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoderState))\n      // write queryAwareness\n      const encoderAwarenessQuery = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n      lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoderAwarenessQuery, messageQueryAwareness)\n      lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__.publish(this.bcChannel, lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoderAwarenessQuery))\n      // broadcast local awareness state\n      const encoderAwarenessState = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n      lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoderAwarenessState, messageAwareness)\n      lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint8Array(encoderAwarenessState, y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.encodeAwarenessUpdate(this.awareness, [this.doc.clientID]))\n      lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__.publish(this.bcChannel, lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoderAwarenessState))\n    })\n  }\n\n  disconnectBc () {\n    // broadcast message with local awareness state set to null (indicating disconnect)\n    const encoder = lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.createEncoder()\n    lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint(encoder, messageAwareness)\n    lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.writeVarUint8Array(encoder, y_protocols_awareness__WEBPACK_IMPORTED_MODULE_3__.encodeAwarenessUpdate(this.awareness, [this.doc.clientID], new Map()))\n    broadcastMessage(this, lib0_encoding__WEBPACK_IMPORTED_MODULE_4__.toUint8Array(encoder))\n    if (this.bcconnected) {\n      lib0_broadcastchannel__WEBPACK_IMPORTED_MODULE_8__.unsubscribe(this.bcChannel, this._bcSubscriber)\n      this.bcconnected = false\n    }\n  }\n\n  disconnect () {\n    this.shouldConnect = false\n    this.disconnectBc()\n    if (this.ws !== null) {\n      this.ws.close()\n    }\n  }\n\n  connect () {\n    this.shouldConnect = true\n    if (!this.wsconnected && this.ws === null) {\n      setupWS(this)\n      this.connectBc()\n    }\n  }\n}\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/y-websocket/src/y-websocket.js?");

/***/ })

}]);