@stonecrop/stonecrop 0.3.11 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"stonecrop.umd.cjs","sources":["../src/exceptions.ts","../src/stonecrop.ts","../../common/temp/node_modules/.pnpm/vue-demi@0.14.10_vue@3.5.13_typescript@5.7.2_/node_modules/vue-demi/lib/index.mjs","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/env.js","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/const.js","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/time.js","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/proxy.js","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/index.js","../../common/temp/node_modules/.pnpm/pinia@2.3.0_typescript@5.7.2_vue@3.5.13_typescript@5.7.2_/node_modules/pinia/dist/pinia.mjs","../src/stores/data.ts","../src/composable.ts","../src/doctype.ts","../src/registry.ts","../../common/temp/node_modules/.pnpm/vue-router@4.5.0_vue@3.5.13_typescript@5.7.2_/node_modules/vue-router/dist/vue-router.mjs","../src/router.ts","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/util.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/methods/native.js","../../common/temp/node_modules/.pnpm/oblivious-set@1.1.1/node_modules/oblivious-set/dist/es/index.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/options.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/methods/indexed-db.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/methods/localstorage.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/methods/simulate.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/method-chooser.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/broadcast-channel.js","../../common/temp/node_modules/.pnpm/devalue@4.3.3/node_modules/devalue/src/utils.js","../../common/temp/node_modules/.pnpm/devalue@4.3.3/node_modules/devalue/src/constants.js","../../common/temp/node_modules/.pnpm/devalue@4.3.3/node_modules/devalue/src/parse.js","../../common/temp/node_modules/.pnpm/devalue@4.3.3/node_modules/devalue/src/stringify.js","../../common/temp/node_modules/.pnpm/pinia-shared-state@0.3.0_pinia@2.3.0_typescript@5.7.2_vue@3.5.13_typescript@5.7.2___vue@3.5.13_typescript@5.7.2_/node_modules/pinia-shared-state/dist/index.mjs","../src/stores/index.ts","../src/plugins/index.ts"],"sourcesContent":["/**\n * NotImplementedError\n * @param message {string} - The error message\n * @class\n * @description This error is thrown when a method has not been implemented\n * @example\n * throw new NotImplementedError('Method not implemented')\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}\n * @public\n */\nexport function NotImplementedError(message: string) {\n\tthis.message = message || ''\n}\n\nNotImplementedError.prototype = Object.create(Error.prototype, {\n\tconstructor: { value: NotImplementedError },\n\tname: { value: 'NotImplemented' },\n\tstack: {\n\t\tget: function () {\n\t\t\treturn new Error().stack\n\t\t},\n\t},\n})\n","import DoctypeMeta from './doctype'\nimport { NotImplementedError } from './exceptions'\nimport Registry from './registry'\nimport { useDataStore } from './stores/data'\nimport type { ImmutableDoctype, Schema } from './types'\n\n/**\n * Stonecrop class\n * @public\n */\nexport class Stonecrop {\n\t/**\n\t * The root Stonecrop instance\n\t */\n\tstatic _root: Stonecrop\n\n\t/**\n\t * The name of the Stonecrop instance\n\t * @readonly\n\t *\n\t * @defaultValue 'Stonecrop'\n\t */\n\treadonly name = 'Stonecrop'\n\n\t/**\n\t * The registry is an immutable collection of doctypes\n\t * @example\n\t * ```ts\n\t * {\n\t * \t'task': {\n\t * \t\tdoctype: 'Task',\n\t * \t\tschema: {\n\t * \t\t\ttitle: 'string',\n\t * \t\t\tdescription: 'string',\n\t * \t\t\t...\n\t * \t\t}\n\t * \t},\n\t * \t...\n\t * }\n\t * ```\n\t * @see {@link Registry}\n\t * @see {@link DoctypeMeta}\n\t */\n\treadonly registry: Registry\n\n\t/**\n\t * The Pinia store that manages the mutable records\n\t */\n\tstore: ReturnType<typeof useDataStore>\n\n\t/**\n\t * schema - The Stonecrop schema; the schema is a subset of the registry\n\t * @example\n\t * ```ts\n\t * {\n\t * \tdoctype: 'Task',\n\t * \tschema: {\n\t * \t\ttitle: 'string',\n\t * \t\tdescription: 'string',\n\t * \t\t...\n\t * \t}\n\t * }\n\t * ```\n\t * @see {@link Registry}\n\t * @see {@link DoctypeMeta}\n\t * @see {@link DoctypeMeta.schema}\n\t */\n\tschema?: Schema\n\n\t/**\n\t * The workflow is a subset of the registry\n\t */\n\tworkflow?: ImmutableDoctype['workflow']\n\n\t/**\n\t * The actions are a subset of the registry\n\t */\n\tactions?: ImmutableDoctype['actions']\n\n\t/**\n\t * @param registry - The immutable registry\n\t * @param store - The mutable Pinia store\n\t * @param schema - The Stonecrop schema\n\t * @param workflow - The Stonecrop workflow\n\t * @param actions - The Stonecrop actions\n\t * @returns The Stonecrop instance with the given registry, store, schema, workflow, and actions. If a Stonecrop instance has already been created, it returns the existing instance instead of creating a new one.\n\t * @example\n\t * ```ts\n\t * const registry = new Registry()\n\t * const store = useDataStore()\n\t * const stonecrop = new Stonecrop(registry, store)\n\t * ```\n\t */\n\tconstructor(\n\t\tregistry: Registry,\n\t\tstore: ReturnType<typeof useDataStore>,\n\t\tschema?: Schema,\n\t\tworkflow?: ImmutableDoctype['workflow'],\n\t\tactions?: ImmutableDoctype['actions']\n\t) {\n\t\tif (Stonecrop._root) {\n\t\t\treturn Stonecrop._root\n\t\t}\n\t\tStonecrop._root = this\n\t\tthis.registry = registry\n\t\tthis.store = store\n\t\tthis.schema = schema // new Registry(schema)\n\t\tthis.workflow = workflow\n\t\tthis.actions = actions\n\t}\n\n\t/**\n\t * Sets up the Stonecrop instance with the given doctype\n\t * @param doctype - The doctype to setup\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.setup(doctype)\n\t * ```\n\t */\n\tsetup(doctype: DoctypeMeta): void {\n\t\tvoid this.getMeta(doctype)\n\t\tthis.getWorkflow(doctype)\n\t\tthis.getActions(doctype)\n\t}\n\n\t/**\n\t * Gets the meta for the given doctype\n\t * @param doctype - The doctype to get meta for\n\t * @returns The meta for the given doctype\n\t * @throws NotImplementedError\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * const meta = stonecrop.getMeta(doctype)\n\t * ```\n\t * @see {@link DoctypeMeta}\n\t */\n\tgetMeta(doctype: DoctypeMeta): DoctypeMeta | Promise<DoctypeMeta> | never {\n\t\treturn this.registry.getMeta ? this.registry.getMeta(doctype.doctype) : new NotImplementedError(doctype.doctype)\n\t}\n\n\t/**\n\t * Gets the workflow for the given doctype\n\t * @param doctype - The doctype to get workflow for\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.getWorkflow(doctype)\n\t * ```\n\t */\n\tgetWorkflow(doctype: DoctypeMeta): void {\n\t\tconst doctypeRegistry = this.registry.registry[doctype.slug]\n\t\tthis.workflow = doctypeRegistry.workflow\n\t}\n\n\t/**\n\t * Gets the actions for the given doctype\n\t * @param doctype - The doctype to get actions for\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.getActions(doctype)\n\t * ```\n\t */\n\tgetActions(doctype: DoctypeMeta): void {\n\t\tconst doctypeRegistry = this.registry.registry[doctype.slug]\n\t\tthis.actions = doctypeRegistry.actions\n\t}\n\n\t/**\n\t * Gets the records for the given doctype\n\t * @param doctype - The doctype to get records for\n\t * @param filters - The filters to apply to the records\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * await stonecrop.getRecords(doctype)\n\t * ```\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * const filters = JSON.stringify({ status: 'Open' })\n\t * await stonecrop.getRecords(doctype, { body: filters })\n\t * ```\n\t */\n\tasync getRecords(doctype: DoctypeMeta, filters?: RequestInit): Promise<void> {\n\t\tthis.store.$patch({ records: [] })\n\t\tconst records = await fetch(`/${doctype.slug}`, filters)\n\t\tconst data: Record<string, any>[] = await records.json()\n\t\tthis.store.$patch({ records: data })\n\t}\n\n\t/**\n\t * Gets the record for the given doctype and id\n\t * @param doctype - The doctype to get record for\n\t * @param id - The id of the record to get\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * await stonecrop.getRecord(doctype, 'TASK-00001')\n\t * ```\n\t */\n\tasync getRecord(doctype: DoctypeMeta, id: string): Promise<void> {\n\t\tthis.store.$patch({ record: {} })\n\t\tconst record = await fetch(`/${doctype.slug}/${id}`)\n\t\tconst data: Record<string, any> = await record.json()\n\t\tthis.store.$patch({ record: data })\n\t}\n\n\t/**\n\t * Runs the action for the given doctype and id\n\t * @param doctype - The doctype to run action for\n\t * @param action - The action to run\n\t * @param id - The id(s) of the record(s) to run action on\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.runAction(doctype, 'CREATE')\n\t * ```\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.runAction(doctype, 'UPDATE', ['TASK-00001'])\n\t * ```\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.runAction(doctype, 'DELETE', ['TASK-00001'])\n\t * ```\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.runAction(doctype, 'TRANSITION', ['TASK-00001', 'TASK-00002'])\n\t * ```\n\t */\n\trunAction(doctype: DoctypeMeta, action: string, id?: string[]): void {\n\t\tconst doctypeRegistry = this.registry.registry[doctype.slug]\n\t\tconst actions = doctypeRegistry.actions?.get(action)\n\n\t\t// trigger the action on the state machine\n\t\tif (this.workflow) {\n\t\t\tconst { initialState } = this.workflow\n\t\t\tthis.workflow.transition(initialState, { type: action })\n\n\t\t\t// run actions after state machine transition\n\t\t\t// TODO: should this happen with or without the workflow?\n\t\t\tif (actions && actions.length > 0) {\n\t\t\t\tactions.forEach(action => {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-implied-eval\n\t\t\t\t\tconst actionFn = new Function(action)\n\t\t\t\t\tactionFn(id)\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}\n","import * as Vue from 'vue'\n\nvar isVue2 = false\nvar isVue3 = true\nvar Vue2 = undefined\n\nfunction install() {}\n\nexport function set(target, key, val) {\n if (Array.isArray(target)) {\n target.length = Math.max(target.length, key)\n target.splice(key, 1, val)\n return val\n }\n target[key] = val\n return val\n}\n\nexport function del(target, key) {\n if (Array.isArray(target)) {\n target.splice(key, 1)\n return\n }\n delete target[key]\n}\n\nexport * from 'vue'\nexport {\n Vue,\n Vue2,\n isVue2,\n isVue3,\n install,\n}\n","export function getDevtoolsGlobalHook() {\n return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;\n}\nexport function getTarget() {\n // @ts-expect-error navigator and windows are not available in all environments\n return (typeof navigator !== 'undefined' && typeof window !== 'undefined')\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : {};\n}\nexport const isProxyAvailable = typeof Proxy === 'function';\n","export const HOOK_SETUP = 'devtools-plugin:setup';\nexport const HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';\n","let supported;\nlet perf;\nexport function isPerformanceSupported() {\n var _a;\n if (supported !== undefined) {\n return supported;\n }\n if (typeof window !== 'undefined' && window.performance) {\n supported = true;\n perf = window.performance;\n }\n else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {\n supported = true;\n perf = globalThis.perf_hooks.performance;\n }\n else {\n supported = false;\n }\n return supported;\n}\nexport function now() {\n return isPerformanceSupported() ? perf.now() : Date.now();\n}\n","import { HOOK_PLUGIN_SETTINGS_SET } from './const.js';\nimport { now } from './time.js';\nexport class ApiProxy {\n constructor(plugin, hook) {\n this.target = null;\n this.targetQueue = [];\n this.onQueue = [];\n this.plugin = plugin;\n this.hook = hook;\n const defaultSettings = {};\n if (plugin.settings) {\n for (const id in plugin.settings) {\n const item = plugin.settings[id];\n defaultSettings[id] = item.defaultValue;\n }\n }\n const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;\n let currentSettings = Object.assign({}, defaultSettings);\n try {\n const raw = localStorage.getItem(localSettingsSaveId);\n const data = JSON.parse(raw);\n Object.assign(currentSettings, data);\n }\n catch (e) {\n // noop\n }\n this.fallbacks = {\n getSettings() {\n return currentSettings;\n },\n setSettings(value) {\n try {\n localStorage.setItem(localSettingsSaveId, JSON.stringify(value));\n }\n catch (e) {\n // noop\n }\n currentSettings = value;\n },\n now() {\n return now();\n },\n };\n if (hook) {\n hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {\n if (pluginId === this.plugin.id) {\n this.fallbacks.setSettings(value);\n }\n });\n }\n this.proxiedOn = new Proxy({}, {\n get: (_target, prop) => {\n if (this.target) {\n return this.target.on[prop];\n }\n else {\n return (...args) => {\n this.onQueue.push({\n method: prop,\n args,\n });\n };\n }\n },\n });\n this.proxiedTarget = new Proxy({}, {\n get: (_target, prop) => {\n if (this.target) {\n return this.target[prop];\n }\n else if (prop === 'on') {\n return this.proxiedOn;\n }\n else if (Object.keys(this.fallbacks).includes(prop)) {\n return (...args) => {\n this.targetQueue.push({\n method: prop,\n args,\n resolve: () => { },\n });\n return this.fallbacks[prop](...args);\n };\n }\n else {\n return (...args) => {\n return new Promise((resolve) => {\n this.targetQueue.push({\n method: prop,\n args,\n resolve,\n });\n });\n };\n }\n },\n });\n }\n async setRealTarget(target) {\n this.target = target;\n for (const item of this.onQueue) {\n this.target.on[item.method](...item.args);\n }\n for (const item of this.targetQueue) {\n item.resolve(await this.target[item.method](...item.args));\n }\n }\n}\n","import { getDevtoolsGlobalHook, getTarget, isProxyAvailable } from './env.js';\nimport { HOOK_SETUP } from './const.js';\nimport { ApiProxy } from './proxy.js';\nexport * from './api/index.js';\nexport * from './plugin.js';\nexport * from './time.js';\nexport function setupDevtoolsPlugin(pluginDescriptor, setupFn) {\n const descriptor = pluginDescriptor;\n const target = getTarget();\n const hook = getDevtoolsGlobalHook();\n const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;\n if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {\n hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);\n }\n else {\n const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;\n const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];\n list.push({\n pluginDescriptor: descriptor,\n setupFn,\n proxy,\n });\n if (proxy) {\n setupFn(proxy.proxiedTarget);\n }\n }\n}\n","/*!\n * pinia v2.3.0\n * (c) 2024 Eduardo San Martin Morote\n * @license MIT\n */\nimport { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope, ref, isVue2, isRef, isReactive, set, getCurrentScope, onScopeDispose, getCurrentInstance, reactive, toRef, del, nextTick, computed, toRefs } from 'vue-demi';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n\n/**\n * setActivePinia must be called to handle SSR at the top of functions like\n * `fetch`, `setup`, `serverPrefetch` and others\n */\nlet activePinia;\n/**\n * Sets or unsets the active pinia. Used in SSR and internally when calling\n * actions and getters\n *\n * @param pinia - Pinia instance\n */\n// @ts-expect-error: cannot constrain the type of the return\nconst setActivePinia = (pinia) => (activePinia = pinia);\n/**\n * Get the currently active pinia if there is any.\n */\nconst getActivePinia = () => (hasInjectionContext() && inject(piniaSymbol)) || activePinia;\nconst piniaSymbol = ((process.env.NODE_ENV !== 'production') ? Symbol('pinia') : /* istanbul ignore next */ Symbol());\n\nfunction isPlainObject(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\no) {\n return (o &&\n typeof o === 'object' &&\n Object.prototype.toString.call(o) === '[object Object]' &&\n typeof o.toJSON !== 'function');\n}\n// type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> }\n// TODO: can we change these to numbers?\n/**\n * Possible types for SubscriptionCallback\n */\nvar MutationType;\n(function (MutationType) {\n /**\n * Direct mutation of the state:\n *\n * - `store.name = 'new name'`\n * - `store.$state.name = 'new name'`\n * - `store.list.push('new item')`\n */\n MutationType[\"direct\"] = \"direct\";\n /**\n * Mutated the state with `$patch` and an object\n *\n * - `store.$patch({ name: 'newName' })`\n */\n MutationType[\"patchObject\"] = \"patch object\";\n /**\n * Mutated the state with `$patch` and a function\n *\n * - `store.$patch(state => state.name = 'newName')`\n */\n MutationType[\"patchFunction\"] = \"patch function\";\n // maybe reset? for $state = {} and $reset\n})(MutationType || (MutationType = {}));\n\nconst IS_CLIENT = typeof window !== 'undefined';\n\n/*\n * FileSaver.js A saveAs() FileSaver implementation.\n *\n * Originally by Eli Grey, adapted as an ESM module by Eduardo San Martin\n * Morote.\n *\n * License : MIT\n */\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nconst _global = /*#__PURE__*/ (() => typeof window === 'object' && window.window === window\n ? window\n : typeof self === 'object' && self.self === self\n ? self\n : typeof global === 'object' && global.global === global\n ? global\n : typeof globalThis === 'object'\n ? globalThis\n : { HTMLElement: null })();\nfunction bom(blob, { autoBom = false } = {}) {\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (autoBom &&\n /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xfeff), blob], { type: blob.type });\n }\n return blob;\n}\nfunction download(url, name, opts) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.responseType = 'blob';\n xhr.onload = function () {\n saveAs(xhr.response, name, opts);\n };\n xhr.onerror = function () {\n console.error('could not download file');\n };\n xhr.send();\n}\nfunction corsEnabled(url) {\n const xhr = new XMLHttpRequest();\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false);\n try {\n xhr.send();\n }\n catch (e) { }\n return xhr.status >= 200 && xhr.status <= 299;\n}\n// `a.click()` doesn't work for all browsers (#465)\nfunction click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'));\n }\n catch (e) {\n const evt = document.createEvent('MouseEvents');\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);\n node.dispatchEvent(evt);\n }\n}\nconst _navigator = typeof navigator === 'object' ? navigator : { userAgent: '' };\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nconst isMacOSWebView = /*#__PURE__*/ (() => /Macintosh/.test(_navigator.userAgent) &&\n /AppleWebKit/.test(_navigator.userAgent) &&\n !/Safari/.test(_navigator.userAgent))();\nconst saveAs = !IS_CLIENT\n ? () => { } // noop\n : // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program\n typeof HTMLAnchorElement !== 'undefined' &&\n 'download' in HTMLAnchorElement.prototype &&\n !isMacOSWebView\n ? downloadSaveAs\n : // Use msSaveOrOpenBlob as a second approach\n 'msSaveOrOpenBlob' in _navigator\n ? msSaveAs\n : // Fallback to using FileReader and a popup\n fileSaverSaveAs;\nfunction downloadSaveAs(blob, name = 'download', opts) {\n const a = document.createElement('a');\n a.download = name;\n a.rel = 'noopener'; // tabnabbing\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob;\n if (a.origin !== location.origin) {\n if (corsEnabled(a.href)) {\n download(blob, name, opts);\n }\n else {\n a.target = '_blank';\n click(a);\n }\n }\n else {\n click(a);\n }\n }\n else {\n // Support blobs\n a.href = URL.createObjectURL(blob);\n setTimeout(function () {\n URL.revokeObjectURL(a.href);\n }, 4e4); // 40s\n setTimeout(function () {\n click(a);\n }, 0);\n }\n}\nfunction msSaveAs(blob, name = 'download', opts) {\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts);\n }\n else {\n const a = document.createElement('a');\n a.href = blob;\n a.target = '_blank';\n setTimeout(function () {\n click(a);\n });\n }\n }\n else {\n // @ts-ignore: works on windows\n navigator.msSaveOrOpenBlob(bom(blob, opts), name);\n }\n}\nfunction fileSaverSaveAs(blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank');\n if (popup) {\n popup.document.title = popup.document.body.innerText = 'downloading...';\n }\n if (typeof blob === 'string')\n return download(blob, name, opts);\n const force = blob.type === 'application/octet-stream';\n const isSafari = /constructor/i.test(String(_global.HTMLElement)) || 'safari' in _global;\n const isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent);\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) &&\n typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n const reader = new FileReader();\n reader.onloadend = function () {\n let url = reader.result;\n if (typeof url !== 'string') {\n popup = null;\n throw new Error('Wrong reader.result type');\n }\n url = isChromeIOS\n ? url\n : url.replace(/^data:[^;]*;/, 'data:attachment/file;');\n if (popup) {\n popup.location.href = url;\n }\n else {\n location.assign(url);\n }\n popup = null; // reverse-tabnabbing #460\n };\n reader.readAsDataURL(blob);\n }\n else {\n const url = URL.createObjectURL(blob);\n if (popup)\n popup.location.assign(url);\n else\n location.href = url;\n popup = null; // reverse-tabnabbing #460\n setTimeout(function () {\n URL.revokeObjectURL(url);\n }, 4e4); // 40s\n }\n}\n\n/**\n * Shows a toast or console.log\n *\n * @param message - message to log\n * @param type - different color of the tooltip\n */\nfunction toastMessage(message, type) {\n const piniaMessage = '🍍 ' + message;\n if (typeof __VUE_DEVTOOLS_TOAST__ === 'function') {\n // No longer available :(\n __VUE_DEVTOOLS_TOAST__(piniaMessage, type);\n }\n else if (type === 'error') {\n console.error(piniaMessage);\n }\n else if (type === 'warn') {\n console.warn(piniaMessage);\n }\n else {\n console.log(piniaMessage);\n }\n}\nfunction isPinia(o) {\n return '_a' in o && 'install' in o;\n}\n\n/**\n * This file contain devtools actions, they are not Pinia actions.\n */\n// ---\nfunction checkClipboardAccess() {\n if (!('clipboard' in navigator)) {\n toastMessage(`Your browser doesn't support the Clipboard API`, 'error');\n return true;\n }\n}\nfunction checkNotFocusedError(error) {\n if (error instanceof Error &&\n error.message.toLowerCase().includes('document is not focused')) {\n toastMessage('You need to activate the \"Emulate a focused page\" setting in the \"Rendering\" panel of devtools.', 'warn');\n return true;\n }\n return false;\n}\nasync function actionGlobalCopyState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));\n toastMessage('Global state copied to clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to serialize the state. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalPasteState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n loadStoresState(pinia, JSON.parse(await navigator.clipboard.readText()));\n toastMessage('Global state pasted from clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalSaveState(pinia) {\n try {\n saveAs(new Blob([JSON.stringify(pinia.state.value)], {\n type: 'text/plain;charset=utf-8',\n }), 'pinia-state.json');\n }\n catch (error) {\n toastMessage(`Failed to export the state as JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nlet fileInput;\nfunction getFileOpener() {\n if (!fileInput) {\n fileInput = document.createElement('input');\n fileInput.type = 'file';\n fileInput.accept = '.json';\n }\n function openFile() {\n return new Promise((resolve, reject) => {\n fileInput.onchange = async () => {\n const files = fileInput.files;\n if (!files)\n return resolve(null);\n const file = files.item(0);\n if (!file)\n return resolve(null);\n return resolve({ text: await file.text(), file });\n };\n // @ts-ignore: TODO: changed from 4.3 to 4.4\n fileInput.oncancel = () => resolve(null);\n fileInput.onerror = reject;\n fileInput.click();\n });\n }\n return openFile;\n}\nasync function actionGlobalOpenStateFile(pinia) {\n try {\n const open = getFileOpener();\n const result = await open();\n if (!result)\n return;\n const { text, file } = result;\n loadStoresState(pinia, JSON.parse(text));\n toastMessage(`Global state imported from \"${file.name}\".`);\n }\n catch (error) {\n toastMessage(`Failed to import the state from JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nfunction loadStoresState(pinia, state) {\n for (const key in state) {\n const storeState = pinia.state.value[key];\n // store is already instantiated, patch it\n if (storeState) {\n Object.assign(storeState, state[key]);\n }\n else {\n // store is not instantiated, set the initial state\n pinia.state.value[key] = state[key];\n }\n }\n}\n\nfunction formatDisplay(display) {\n return {\n _custom: {\n display,\n },\n };\n}\nconst PINIA_ROOT_LABEL = '🍍 Pinia (root)';\nconst PINIA_ROOT_ID = '_root';\nfunction formatStoreForInspectorTree(store) {\n return isPinia(store)\n ? {\n id: PINIA_ROOT_ID,\n label: PINIA_ROOT_LABEL,\n }\n : {\n id: store.$id,\n label: store.$id,\n };\n}\nfunction formatStoreForInspectorState(store) {\n if (isPinia(store)) {\n const storeNames = Array.from(store._s.keys());\n const storeMap = store._s;\n const state = {\n state: storeNames.map((storeId) => ({\n editable: true,\n key: storeId,\n value: store.state.value[storeId],\n })),\n getters: storeNames\n .filter((id) => storeMap.get(id)._getters)\n .map((id) => {\n const store = storeMap.get(id);\n return {\n editable: false,\n key: id,\n value: store._getters.reduce((getters, key) => {\n getters[key] = store[key];\n return getters;\n }, {}),\n };\n }),\n };\n return state;\n }\n const state = {\n state: Object.keys(store.$state).map((key) => ({\n editable: true,\n key,\n value: store.$state[key],\n })),\n };\n // avoid adding empty getters\n if (store._getters && store._getters.length) {\n state.getters = store._getters.map((getterName) => ({\n editable: false,\n key: getterName,\n value: store[getterName],\n }));\n }\n if (store._customProperties.size) {\n state.customProperties = Array.from(store._customProperties).map((key) => ({\n editable: true,\n key,\n value: store[key],\n }));\n }\n return state;\n}\nfunction formatEventData(events) {\n if (!events)\n return {};\n if (Array.isArray(events)) {\n // TODO: handle add and delete for arrays and objects\n return events.reduce((data, event) => {\n data.keys.push(event.key);\n data.operations.push(event.type);\n data.oldValue[event.key] = event.oldValue;\n data.newValue[event.key] = event.newValue;\n return data;\n }, {\n oldValue: {},\n keys: [],\n operations: [],\n newValue: {},\n });\n }\n else {\n return {\n operation: formatDisplay(events.type),\n key: formatDisplay(events.key),\n oldValue: events.oldValue,\n newValue: events.newValue,\n };\n }\n}\nfunction formatMutationType(type) {\n switch (type) {\n case MutationType.direct:\n return 'mutation';\n case MutationType.patchFunction:\n return '$patch';\n case MutationType.patchObject:\n return '$patch';\n default:\n return 'unknown';\n }\n}\n\n// timeline can be paused when directly changing the state\nlet isTimelineActive = true;\nconst componentStateTypes = [];\nconst MUTATIONS_LAYER_ID = 'pinia:mutations';\nconst INSPECTOR_ID = 'pinia';\nconst { assign: assign$1 } = Object;\n/**\n * Gets the displayed name of a store in devtools\n *\n * @param id - id of the store\n * @returns a formatted string\n */\nconst getStoreType = (id) => '🍍 ' + id;\n/**\n * Add the pinia plugin without any store. Allows displaying a Pinia plugin tab\n * as soon as it is added to the application.\n *\n * @param app - Vue application\n * @param pinia - pinia instance\n */\nfunction registerPiniaDevtools(app, pinia) {\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia 🍍',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n }, (api) => {\n if (typeof api.now !== 'function') {\n toastMessage('You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.');\n }\n api.addTimelineLayer({\n id: MUTATIONS_LAYER_ID,\n label: `Pinia 🍍`,\n color: 0xe5df88,\n });\n api.addInspector({\n id: INSPECTOR_ID,\n label: 'Pinia 🍍',\n icon: 'storage',\n treeFilterPlaceholder: 'Search stores',\n actions: [\n {\n icon: 'content_copy',\n action: () => {\n actionGlobalCopyState(pinia);\n },\n tooltip: 'Serialize and copy the state',\n },\n {\n icon: 'content_paste',\n action: async () => {\n await actionGlobalPasteState(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Replace the state with the content of your clipboard',\n },\n {\n icon: 'save',\n action: () => {\n actionGlobalSaveState(pinia);\n },\n tooltip: 'Save the state as a JSON file',\n },\n {\n icon: 'folder_open',\n action: async () => {\n await actionGlobalOpenStateFile(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Import the state from a JSON file',\n },\n ],\n nodeActions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state (with \"$reset\")',\n action: (nodeId) => {\n const store = pinia._s.get(nodeId);\n if (!store) {\n toastMessage(`Cannot reset \"${nodeId}\" store because it wasn't found.`, 'warn');\n }\n else if (typeof store.$reset !== 'function') {\n toastMessage(`Cannot reset \"${nodeId}\" store because it doesn't have a \"$reset\" method implemented.`, 'warn');\n }\n else {\n store.$reset();\n toastMessage(`Store \"${nodeId}\" reset.`);\n }\n },\n },\n ],\n });\n api.on.inspectComponent((payload, ctx) => {\n const proxy = (payload.componentInstance &&\n payload.componentInstance.proxy);\n if (proxy && proxy._pStores) {\n const piniaStores = payload.componentInstance.proxy._pStores;\n Object.values(piniaStores).forEach((store) => {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'state',\n editable: true,\n value: store._isOptionsAPI\n ? {\n _custom: {\n value: toRaw(store.$state),\n actions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state of this store',\n action: () => store.$reset(),\n },\n ],\n },\n }\n : // NOTE: workaround to unwrap transferred refs\n Object.keys(store.$state).reduce((state, key) => {\n state[key] = store.$state[key];\n return state;\n }, {}),\n });\n if (store._getters && store._getters.length) {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'getters',\n editable: false,\n value: store._getters.reduce((getters, key) => {\n try {\n getters[key] = store[key];\n }\n catch (error) {\n // @ts-expect-error: we just want to show it in devtools\n getters[key] = error;\n }\n return getters;\n }, {}),\n });\n }\n });\n }\n });\n api.on.getInspectorTree((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n let stores = [pinia];\n stores = stores.concat(Array.from(pinia._s.values()));\n payload.rootNodes = (payload.filter\n ? stores.filter((store) => '$id' in store\n ? store.$id\n .toLowerCase()\n .includes(payload.filter.toLowerCase())\n : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase()))\n : stores).map(formatStoreForInspectorTree);\n }\n });\n // Expose pinia instance as $pinia to window\n globalThis.$pinia = pinia;\n api.on.getInspectorState((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n // this could be the selected store restored for a different project\n // so it's better not to say anything here\n return;\n }\n if (inspectedStore) {\n // Expose selected store as $store to window\n if (payload.nodeId !== PINIA_ROOT_ID)\n globalThis.$store = toRaw(inspectedStore);\n payload.state = formatStoreForInspectorState(inspectedStore);\n }\n }\n });\n api.on.editInspectorState((payload, ctx) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n return toastMessage(`store \"${payload.nodeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (!isPinia(inspectedStore)) {\n // access only the state\n if (path.length !== 1 ||\n !inspectedStore._customProperties.has(path[0]) ||\n path[0] in inspectedStore.$state) {\n path.unshift('$state');\n }\n }\n else {\n // Root access, we can omit the `.value` because the devtools API does it for us\n path.unshift('state');\n }\n isTimelineActive = false;\n payload.set(inspectedStore, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n api.on.editComponentState((payload) => {\n if (payload.type.startsWith('🍍')) {\n const storeId = payload.type.replace(/^🍍\\s*/, '');\n const store = pinia._s.get(storeId);\n if (!store) {\n return toastMessage(`store \"${storeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (path[0] !== 'state') {\n return toastMessage(`Invalid path for store \"${storeId}\":\\n${path}\\nOnly state can be modified.`);\n }\n // rewrite the first entry to be able to directly set the state as\n // well as any other path\n path[0] = '$state';\n isTimelineActive = false;\n payload.set(store, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n });\n}\nfunction addStoreToDevtools(app, store) {\n if (!componentStateTypes.includes(getStoreType(store.$id))) {\n componentStateTypes.push(getStoreType(store.$id));\n }\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia 🍍',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n settings: {\n logStoreChanges: {\n label: 'Notify about new/deleted stores',\n type: 'boolean',\n defaultValue: true,\n },\n // useEmojis: {\n // label: 'Use emojis in messages ⚡️',\n // type: 'boolean',\n // defaultValue: true,\n // },\n },\n }, (api) => {\n // gracefully handle errors\n const now = typeof api.now === 'function' ? api.now.bind(api) : Date.now;\n store.$onAction(({ after, onError, name, args }) => {\n const groupId = runningActionId++;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🛫 ' + name,\n subtitle: 'start',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n },\n groupId,\n },\n });\n after((result) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🛬 ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n result,\n },\n groupId,\n },\n });\n });\n onError((error) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n logType: 'error',\n title: '💥 ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n error,\n },\n groupId,\n },\n });\n });\n }, true);\n store._customProperties.forEach((name) => {\n watch(() => unref(store[name]), (newValue, oldValue) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (isTimelineActive) {\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: 'Change',\n subtitle: name,\n data: {\n newValue,\n oldValue,\n },\n groupId: activeAction,\n },\n });\n }\n }, { deep: true });\n });\n store.$subscribe(({ events, type }, state) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (!isTimelineActive)\n return;\n // rootStore.state[store.id] = state\n const eventData = {\n time: now(),\n title: formatMutationType(type),\n data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),\n groupId: activeAction,\n };\n if (type === MutationType.patchFunction) {\n eventData.subtitle = '⤵️';\n }\n else if (type === MutationType.patchObject) {\n eventData.subtitle = '🧩';\n }\n else if (events && !Array.isArray(events)) {\n eventData.subtitle = events.type;\n }\n if (events) {\n eventData.data['rawEvent(s)'] = {\n _custom: {\n display: 'DebuggerEvent',\n type: 'object',\n tooltip: 'raw DebuggerEvent[]',\n value: events,\n },\n };\n }\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: eventData,\n });\n }, { detached: true, flush: 'sync' });\n const hotUpdate = store._hotUpdate;\n store._hotUpdate = markRaw((newStore) => {\n hotUpdate(newStore);\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🔥 ' + store.$id,\n subtitle: 'HMR update',\n data: {\n store: formatDisplay(store.$id),\n info: formatDisplay(`HMR update`),\n },\n },\n });\n // update the devtools too\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n });\n const { $dispose } = store;\n store.$dispose = () => {\n $dispose();\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`Disposed \"${store.$id}\" store 🗑`);\n };\n // trigger an update so it can display new registered stores\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`\"${store.$id}\" store installed 🆕`);\n });\n}\nlet runningActionId = 0;\nlet activeAction;\n/**\n * Patches a store to enable action grouping in devtools by wrapping the store with a Proxy that is passed as the\n * context of all actions, allowing us to set `runningAction` on each access and effectively associating any state\n * mutation to the action.\n *\n * @param store - store to patch\n * @param actionNames - list of actionst to patch\n */\nfunction patchActionForGrouping(store, actionNames, wrapWithProxy) {\n // original actions of the store as they are given by pinia. We are going to override them\n const actions = actionNames.reduce((storeActions, actionName) => {\n // use toRaw to avoid tracking #541\n storeActions[actionName] = toRaw(store)[actionName];\n return storeActions;\n }, {});\n for (const actionName in actions) {\n store[actionName] = function () {\n // the running action id is incremented in a before action hook\n const _actionId = runningActionId;\n const trackedStore = wrapWithProxy\n ? new Proxy(store, {\n get(...args) {\n activeAction = _actionId;\n return Reflect.get(...args);\n },\n set(...args) {\n activeAction = _actionId;\n return Reflect.set(...args);\n },\n })\n : store;\n // For Setup Stores we need https://github.com/tc39/proposal-async-context\n activeAction = _actionId;\n const retValue = actions[actionName].apply(trackedStore, arguments);\n // this is safer as async actions in Setup Stores would associate mutations done outside of the action\n activeAction = undefined;\n return retValue;\n };\n }\n}\n/**\n * pinia.use(devtoolsPlugin)\n */\nfunction devtoolsPlugin({ app, store, options }) {\n // HMR module\n if (store.$id.startsWith('__hot:')) {\n return;\n }\n // detect option api vs setup api\n store._isOptionsAPI = !!options.state;\n // Do not overwrite actions mocked by @pinia/testing (#2298)\n if (!store._p._testing) {\n patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);\n // Upgrade the HMR to also update the new actions\n const originalHotUpdate = store._hotUpdate;\n toRaw(store)._hotUpdate = function (newStore) {\n originalHotUpdate.apply(this, arguments);\n patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);\n };\n }\n addStoreToDevtools(app, \n // FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?\n store);\n}\n\n/**\n * Creates a Pinia instance to be used by the application\n */\nfunction createPinia() {\n const scope = effectScope(true);\n // NOTE: here we could check the window object for a state and directly set it\n // if there is anything like it with Vue 3 SSR\n const state = scope.run(() => ref({}));\n let _p = [];\n // plugins added before calling app.use(pinia)\n let toBeInstalled = [];\n const pinia = markRaw({\n install(app) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n if (!isVue2) {\n pinia._a = app;\n app.provide(piniaSymbol, pinia);\n app.config.globalProperties.$pinia = pinia;\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n registerPiniaDevtools(app, pinia);\n }\n toBeInstalled.forEach((plugin) => _p.push(plugin));\n toBeInstalled = [];\n }\n },\n use(plugin) {\n if (!this._a && !isVue2) {\n toBeInstalled.push(plugin);\n }\n else {\n _p.push(plugin);\n }\n return this;\n },\n _p,\n // it's actually undefined here\n // @ts-expect-error\n _a: null,\n _e: scope,\n _s: new Map(),\n state,\n });\n // pinia devtools rely on dev only features so they cannot be forced unless\n // the dev build of Vue is used. Avoid old browsers like IE11.\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT && typeof Proxy !== 'undefined') {\n pinia.use(devtoolsPlugin);\n }\n return pinia;\n}\n/**\n * Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly\n * useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances.\n * Once disposed, the pinia instance cannot be used anymore.\n *\n * @param pinia - pinia instance\n */\nfunction disposePinia(pinia) {\n pinia._e.stop();\n pinia._s.clear();\n pinia._p.splice(0);\n pinia.state.value = {};\n // @ts-expect-error: non valid\n pinia._a = null;\n}\n\n/**\n * Checks if a function is a `StoreDefinition`.\n *\n * @param fn - object to test\n * @returns true if `fn` is a StoreDefinition\n */\nconst isUseStore = (fn) => {\n return typeof fn === 'function' && typeof fn.$id === 'string';\n};\n/**\n * Mutates in place `newState` with `oldState` to _hot update_ it. It will\n * remove any key not existing in `newState` and recursively merge plain\n * objects.\n *\n * @param newState - new state object to be patched\n * @param oldState - old state that should be used to patch newState\n * @returns - newState\n */\nfunction patchObject(newState, oldState) {\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in oldState) {\n const subPatch = oldState[key];\n // skip the whole sub tree\n if (!(key in newState)) {\n continue;\n }\n const targetValue = newState[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n newState[key] = patchObject(targetValue, subPatch);\n }\n else {\n // objects are either a bit more complex (e.g. refs) or primitives, so we\n // just set the whole thing\n if (isVue2) {\n set(newState, key, subPatch);\n }\n else {\n newState[key] = subPatch;\n }\n }\n }\n return newState;\n}\n/**\n * Creates an _accept_ function to pass to `import.meta.hot` in Vite applications.\n *\n * @example\n * ```js\n * const useUser = defineStore(...)\n * if (import.meta.hot) {\n * import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))\n * }\n * ```\n *\n * @param initialUseStore - return of the defineStore to hot update\n * @param hot - `import.meta.hot`\n */\nfunction acceptHMRUpdate(initialUseStore, hot) {\n // strip as much as possible from iife.prod\n if (!(process.env.NODE_ENV !== 'production')) {\n return () => { };\n }\n return (newModule) => {\n const pinia = hot.data.pinia || initialUseStore._pinia;\n if (!pinia) {\n // this store is still not used\n return;\n }\n // preserve the pinia instance across loads\n hot.data.pinia = pinia;\n // console.log('got data', newStore)\n for (const exportName in newModule) {\n const useStore = newModule[exportName];\n // console.log('checking for', exportName)\n if (isUseStore(useStore) && pinia._s.has(useStore.$id)) {\n // console.log('Accepting update for', useStore.$id)\n const id = useStore.$id;\n if (id !== initialUseStore.$id) {\n console.warn(`The id of the store changed from \"${initialUseStore.$id}\" to \"${id}\". Reloading.`);\n // return import.meta.hot.invalidate()\n return hot.invalidate();\n }\n const existingStore = pinia._s.get(id);\n if (!existingStore) {\n console.log(`[Pinia]: skipping hmr because store doesn't exist yet`);\n return;\n }\n useStore(pinia, existingStore);\n }\n }\n };\n}\n\nconst noop = () => { };\nfunction addSubscription(subscriptions, callback, detached, onCleanup = noop) {\n subscriptions.push(callback);\n const removeSubscription = () => {\n const idx = subscriptions.indexOf(callback);\n if (idx > -1) {\n subscriptions.splice(idx, 1);\n onCleanup();\n }\n };\n if (!detached && getCurrentScope()) {\n onScopeDispose(removeSubscription);\n }\n return removeSubscription;\n}\nfunction triggerSubscriptions(subscriptions, ...args) {\n subscriptions.slice().forEach((callback) => {\n callback(...args);\n });\n}\n\nconst fallbackRunWithContext = (fn) => fn();\n/**\n * Marks a function as an action for `$onAction`\n * @internal\n */\nconst ACTION_MARKER = Symbol();\n/**\n * Action name symbol. Allows to add a name to an action after defining it\n * @internal\n */\nconst ACTION_NAME = Symbol();\nfunction mergeReactiveObjects(target, patchToApply) {\n // Handle Map instances\n if (target instanceof Map && patchToApply instanceof Map) {\n patchToApply.forEach((value, key) => target.set(key, value));\n }\n else if (target instanceof Set && patchToApply instanceof Set) {\n // Handle Set instances\n patchToApply.forEach(target.add, target);\n }\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in patchToApply) {\n if (!patchToApply.hasOwnProperty(key))\n continue;\n const subPatch = patchToApply[key];\n const targetValue = target[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n target.hasOwnProperty(key) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n // NOTE: here I wanted to warn about inconsistent types but it's not possible because in setup stores one might\n // start the value of a property as a certain type e.g. a Map, and then for some reason, during SSR, change that\n // to `undefined`. When trying to hydrate, we want to override the Map with `undefined`.\n target[key] = mergeReactiveObjects(targetValue, subPatch);\n }\n else {\n // @ts-expect-error: subPatch is a valid value\n target[key] = subPatch;\n }\n }\n return target;\n}\nconst skipHydrateSymbol = (process.env.NODE_ENV !== 'production')\n ? Symbol('pinia:skipHydration')\n : /* istanbul ignore next */ Symbol();\n/**\n * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a\n * stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.\n *\n * @param obj - target object\n * @returns obj\n */\nfunction skipHydrate(obj) {\n return Object.defineProperty(obj, skipHydrateSymbol, {});\n}\n/**\n * Returns whether a value should be hydrated\n *\n * @param obj - target variable\n * @returns true if `obj` should be hydrated\n */\nfunction shouldHydrate(obj) {\n return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);\n}\nconst { assign } = Object;\nfunction isComputed(o) {\n return !!(isRef(o) && o.effect);\n}\nfunction createOptionsStore(id, options, pinia, hot) {\n const { state, actions, getters } = options;\n const initialState = pinia.state.value[id];\n let store;\n function setup() {\n if (!initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value, id, state ? state() : {});\n }\n else {\n pinia.state.value[id] = state ? state() : {};\n }\n }\n // avoid creating a state in pinia.state.value\n const localState = (process.env.NODE_ENV !== 'production') && hot\n ? // use ref() to unwrap refs inside state TODO: check if this is still necessary\n toRefs(ref(state ? state() : {}).value)\n : toRefs(pinia.state.value[id]);\n return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {\n if ((process.env.NODE_ENV !== 'production') && name in localState) {\n console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with \"${name}\" in store \"${id}\".`);\n }\n computedGetters[name] = markRaw(computed(() => {\n setActivePinia(pinia);\n // it was created just before\n const store = pinia._s.get(id);\n // allow cross using stores\n /* istanbul ignore if */\n if (isVue2 && !store._r)\n return;\n // @ts-expect-error\n // return getters![name].call(context, context)\n // TODO: avoid reading the getter while assigning with a global variable\n return getters[name].call(store, store);\n }));\n return computedGetters;\n }, {}));\n }\n store = createSetupStore(id, setup, options, pinia, hot, true);\n return store;\n}\nfunction createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {\n let scope;\n const optionsForPlugin = assign({ actions: {} }, options);\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && !pinia._e.active) {\n throw new Error('Pinia destroyed');\n }\n // watcher options for $subscribe\n const $subscribeOptions = { deep: true };\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production') && !isVue2) {\n $subscribeOptions.onTrigger = (event) => {\n /* istanbul ignore else */\n if (isListening) {\n debuggerEvents = event;\n // avoid triggering this while the store is being built and the state is being set in pinia\n }\n else if (isListening == false && !store._hotUpdating) {\n // let patch send all the events together later\n /* istanbul ignore else */\n if (Array.isArray(debuggerEvents)) {\n debuggerEvents.push(event);\n }\n else {\n console.error('🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.');\n }\n }\n };\n }\n // internal state\n let isListening; // set to true at the end\n let isSyncListening; // set to true at the end\n let subscriptions = [];\n let actionSubscriptions = [];\n let debuggerEvents;\n const initialState = pinia.state.value[$id];\n // avoid setting the state for option stores if it is set\n // by the setup\n if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value, $id, {});\n }\n else {\n pinia.state.value[$id] = {};\n }\n }\n const hotState = ref({});\n // avoid triggering too many listeners\n // https://github.com/vuejs/pinia/issues/1129\n let activeListener;\n function $patch(partialStateOrMutator) {\n let subscriptionMutation;\n isListening = isSyncListening = false;\n // reset the debugger events since patches are sync\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n debuggerEvents = [];\n }\n if (typeof partialStateOrMutator === 'function') {\n partialStateOrMutator(pinia.state.value[$id]);\n subscriptionMutation = {\n type: MutationType.patchFunction,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n else {\n mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);\n subscriptionMutation = {\n type: MutationType.patchObject,\n payload: partialStateOrMutator,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n const myListenerId = (activeListener = Symbol());\n nextTick().then(() => {\n if (activeListener === myListenerId) {\n isListening = true;\n }\n });\n isSyncListening = true;\n // because we paused the watcher, we need to manually call the subscriptions\n triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);\n }\n const $reset = isOptionsStore\n ? function $reset() {\n const { state } = options;\n const newState = state ? state() : {};\n // we use a patch to group all changes into one single subscription\n this.$patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, newState);\n });\n }\n : /* istanbul ignore next */\n (process.env.NODE_ENV !== 'production')\n ? () => {\n throw new Error(`🍍: Store \"${$id}\" is built using the setup syntax and does not implement $reset().`);\n }\n : noop;\n function $dispose() {\n scope.stop();\n subscriptions = [];\n actionSubscriptions = [];\n pinia._s.delete($id);\n }\n /**\n * Helper that wraps function so it can be tracked with $onAction\n * @param fn - action to wrap\n * @param name - name of the action\n */\n const action = (fn, name = '') => {\n if (ACTION_MARKER in fn) {\n fn[ACTION_NAME] = name;\n return fn;\n }\n const wrappedAction = function () {\n setActivePinia(pinia);\n const args = Array.from(arguments);\n const afterCallbackList = [];\n const onErrorCallbackList = [];\n function after(callback) {\n afterCallbackList.push(callback);\n }\n function onError(callback) {\n onErrorCallbackList.push(callback);\n }\n // @ts-expect-error\n triggerSubscriptions(actionSubscriptions, {\n args,\n name: wrappedAction[ACTION_NAME],\n store,\n after,\n onError,\n });\n let ret;\n try {\n ret = fn.apply(this && this.$id === $id ? this : store, args);\n // handle sync errors\n }\n catch (error) {\n triggerSubscriptions(onErrorCallbackList, error);\n throw error;\n }\n if (ret instanceof Promise) {\n return ret\n .then((value) => {\n triggerSubscriptions(afterCallbackList, value);\n return value;\n })\n .catch((error) => {\n triggerSubscriptions(onErrorCallbackList, error);\n return Promise.reject(error);\n });\n }\n // trigger after callbacks\n triggerSubscriptions(afterCallbackList, ret);\n return ret;\n };\n wrappedAction[ACTION_MARKER] = true;\n wrappedAction[ACTION_NAME] = name; // will be set later\n // @ts-expect-error: we are intentionally limiting the returned type to just Fn\n // because all the added properties are internals that are exposed through `$onAction()` only\n return wrappedAction;\n };\n const _hmrPayload = /*#__PURE__*/ markRaw({\n actions: {},\n getters: {},\n state: [],\n hotState,\n });\n const partialStore = {\n _p: pinia,\n // _s: scope,\n $id,\n $onAction: addSubscription.bind(null, actionSubscriptions),\n $patch,\n $reset,\n $subscribe(callback, options = {}) {\n const removeSubscription = addSubscription(subscriptions, callback, options.detached, () => stopWatcher());\n const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {\n if (options.flush === 'sync' ? isSyncListening : isListening) {\n callback({\n storeId: $id,\n type: MutationType.direct,\n events: debuggerEvents,\n }, state);\n }\n }, assign({}, $subscribeOptions, options)));\n return removeSubscription;\n },\n $dispose,\n };\n /* istanbul ignore if */\n if (isVue2) {\n // start as non ready\n partialStore._r = false;\n }\n const store = reactive((process.env.NODE_ENV !== 'production') || ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT)\n ? assign({\n _hmrPayload,\n _customProperties: markRaw(new Set()), // devtools custom properties\n }, partialStore\n // must be added later\n // setupStore\n )\n : partialStore);\n // store the partial store now so the setup of stores can instantiate each other before they are finished without\n // creating infinite loops.\n pinia._s.set($id, store);\n const runWithContext = (pinia._a && pinia._a.runWithContext) || fallbackRunWithContext;\n // TODO: idea create skipSerialize that marks properties as non serializable and they are skipped\n const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action }))));\n // overwrite existing actions to support $onAction\n for (const key in setupStore) {\n const prop = setupStore[key];\n if ((isRef(prop) && !isComputed(prop)) || isReactive(prop)) {\n // mark it as a piece of state to be serialized\n if ((process.env.NODE_ENV !== 'production') && hot) {\n set(hotState.value, key, toRef(setupStore, key));\n // createOptionStore directly sets the state in pinia.state.value so we\n // can just skip that\n }\n else if (!isOptionsStore) {\n // in setup stores we must hydrate the state and sync pinia state tree with the refs the user just created\n if (initialState && shouldHydrate(prop)) {\n if (isRef(prop)) {\n prop.value = initialState[key];\n }\n else {\n // probably a reactive object, lets recursively assign\n // @ts-expect-error: prop is unknown\n mergeReactiveObjects(prop, initialState[key]);\n }\n }\n // transfer the ref to the pinia state to keep everything in sync\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value[$id], key, prop);\n }\n else {\n pinia.state.value[$id][key] = prop;\n }\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.state.push(key);\n }\n // action\n }\n else if (typeof prop === 'function') {\n const actionValue = (process.env.NODE_ENV !== 'production') && hot ? prop : action(prop, key);\n // this a hot module replacement store because the hotUpdate method needs\n // to do it with the right context\n /* istanbul ignore if */\n if (isVue2) {\n set(setupStore, key, actionValue);\n }\n else {\n // @ts-expect-error\n setupStore[key] = actionValue;\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.actions[key] = prop;\n }\n // list actions so they can be used in plugins\n // @ts-expect-error\n optionsForPlugin.actions[key] = prop;\n }\n else if ((process.env.NODE_ENV !== 'production')) {\n // add getters for devtools\n if (isComputed(prop)) {\n _hmrPayload.getters[key] = isOptionsStore\n ? // @ts-expect-error\n options.getters[key]\n : prop;\n if (IS_CLIENT) {\n const getters = setupStore._getters ||\n // @ts-expect-error: same\n (setupStore._getters = markRaw([]));\n getters.push(key);\n }\n }\n }\n }\n // add the state, getters, and action properties\n /* istanbul ignore if */\n if (isVue2) {\n Object.keys(setupStore).forEach((key) => {\n set(store, key, setupStore[key]);\n });\n }\n else {\n assign(store, setupStore);\n // allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.\n // Make `storeToRefs()` work with `reactive()` #799\n assign(toRaw(store), setupStore);\n }\n // use this instead of a computed with setter to be able to create it anywhere\n // without linking the computed lifespan to wherever the store is first\n // created.\n Object.defineProperty(store, '$state', {\n get: () => ((process.env.NODE_ENV !== 'production') && hot ? hotState.value : pinia.state.value[$id]),\n set: (state) => {\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && hot) {\n throw new Error('cannot set hotState');\n }\n $patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, state);\n });\n },\n });\n // add the hotUpdate before plugins to allow them to override it\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n store._hotUpdate = markRaw((newStore) => {\n store._hotUpdating = true;\n newStore._hmrPayload.state.forEach((stateKey) => {\n if (stateKey in store.$state) {\n const newStateTarget = newStore.$state[stateKey];\n const oldStateSource = store.$state[stateKey];\n if (typeof newStateTarget === 'object' &&\n isPlainObject(newStateTarget) &&\n isPlainObject(oldStateSource)) {\n patchObject(newStateTarget, oldStateSource);\n }\n else {\n // transfer the ref\n newStore.$state[stateKey] = oldStateSource;\n }\n }\n // patch direct access properties to allow store.stateProperty to work as\n // store.$state.stateProperty\n set(store, stateKey, toRef(newStore.$state, stateKey));\n });\n // remove deleted state properties\n Object.keys(store.$state).forEach((stateKey) => {\n if (!(stateKey in newStore.$state)) {\n del(store, stateKey);\n }\n });\n // avoid devtools logging this as a mutation\n isListening = false;\n isSyncListening = false;\n pinia.state.value[$id] = toRef(newStore._hmrPayload, 'hotState');\n isSyncListening = true;\n nextTick().then(() => {\n isListening = true;\n });\n for (const actionName in newStore._hmrPayload.actions) {\n const actionFn = newStore[actionName];\n set(store, actionName, action(actionFn, actionName));\n }\n // TODO: does this work in both setup and option store?\n for (const getterName in newStore._hmrPayload.getters) {\n const getter = newStore._hmrPayload.getters[getterName];\n const getterValue = isOptionsStore\n ? // special handling of options api\n computed(() => {\n setActivePinia(pinia);\n return getter.call(store, store);\n })\n : getter;\n set(store, getterName, getterValue);\n }\n // remove deleted getters\n Object.keys(store._hmrPayload.getters).forEach((key) => {\n if (!(key in newStore._hmrPayload.getters)) {\n del(store, key);\n }\n });\n // remove old actions\n Object.keys(store._hmrPayload.actions).forEach((key) => {\n if (!(key in newStore._hmrPayload.actions)) {\n del(store, key);\n }\n });\n // update the values used in devtools and to allow deleting new properties later on\n store._hmrPayload = newStore._hmrPayload;\n store._getters = newStore._getters;\n store._hotUpdating = false;\n });\n }\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const nonEnumerable = {\n writable: true,\n configurable: true,\n // avoid warning on devtools trying to display this property\n enumerable: false,\n };\n ['_p', '_hmrPayload', '_getters', '_customProperties'].forEach((p) => {\n Object.defineProperty(store, p, assign({ value: store[p] }, nonEnumerable));\n });\n }\n /* istanbul ignore if */\n if (isVue2) {\n // mark the store as ready before plugins\n store._r = true;\n }\n // apply all plugins\n pinia._p.forEach((extender) => {\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const extensions = scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n }));\n Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));\n assign(store, extensions);\n }\n else {\n assign(store, scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n })));\n }\n });\n if ((process.env.NODE_ENV !== 'production') &&\n store.$state &&\n typeof store.$state === 'object' &&\n typeof store.$state.constructor === 'function' &&\n !store.$state.constructor.toString().includes('[native code]')) {\n console.warn(`[🍍]: The \"state\" must be a plain object. It cannot be\\n` +\n `\\tstate: () => new MyClass()\\n` +\n `Found in store \"${store.$id}\".`);\n }\n // only apply hydrate to option stores with an initial state in pinia\n if (initialState &&\n isOptionsStore &&\n options.hydrate) {\n options.hydrate(store.$state, initialState);\n }\n isListening = true;\n isSyncListening = true;\n return store;\n}\n// allows unused stores to be tree shaken\n/*! #__NO_SIDE_EFFECTS__ */\nfunction defineStore(\n// TODO: add proper types from above\nidOrOptions, setup, setupOptions) {\n let id;\n let options;\n const isSetupStore = typeof setup === 'function';\n if (typeof idOrOptions === 'string') {\n id = idOrOptions;\n // the option store setup will contain the actual options in this case\n options = isSetupStore ? setupOptions : setup;\n }\n else {\n options = idOrOptions;\n id = idOrOptions.id;\n if ((process.env.NODE_ENV !== 'production') && typeof id !== 'string') {\n throw new Error(`[🍍]: \"defineStore()\" must be passed a store id as its first argument.`);\n }\n }\n function useStore(pinia, hot) {\n const hasContext = hasInjectionContext();\n pinia =\n // in test mode, ignore the argument provided as we can always retrieve a\n // pinia instance with getActivePinia()\n ((process.env.NODE_ENV === 'test') && activePinia && activePinia._testing ? null : pinia) ||\n (hasContext ? inject(piniaSymbol, null) : null);\n if (pinia)\n setActivePinia(pinia);\n if ((process.env.NODE_ENV !== 'production') && !activePinia) {\n throw new Error(`[🍍]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\\n` +\n `See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\\n` +\n `This will fail in production.`);\n }\n pinia = activePinia;\n if (!pinia._s.has(id)) {\n // creating the store registers it in `pinia._s`\n if (isSetupStore) {\n createSetupStore(id, setup, options, pinia);\n }\n else {\n createOptionsStore(id, options, pinia);\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n // @ts-expect-error: not the right inferred type\n useStore._pinia = pinia;\n }\n }\n const store = pinia._s.get(id);\n if ((process.env.NODE_ENV !== 'production') && hot) {\n const hotId = '__hot:' + id;\n const newStore = isSetupStore\n ? createSetupStore(hotId, setup, options, pinia, true)\n : createOptionsStore(hotId, assign({}, options), pinia, true);\n hot._hotUpdate(newStore);\n // cleanup the state properties and the store from the cache\n delete pinia.state.value[hotId];\n pinia._s.delete(hotId);\n }\n if ((process.env.NODE_ENV !== 'production') && IS_CLIENT) {\n const currentInstance = getCurrentInstance();\n // save stores in instances to access them devtools\n if (currentInstance &&\n currentInstance.proxy &&\n // avoid adding stores that are just built for hot module replacement\n !hot) {\n const vm = currentInstance.proxy;\n const cache = '_pStores' in vm ? vm._pStores : (vm._pStores = {});\n cache[id] = store;\n }\n }\n // StoreGeneric cannot be casted towards Store\n return store;\n }\n useStore.$id = id;\n return useStore;\n}\n\nlet mapStoreSuffix = 'Store';\n/**\n * Changes the suffix added by `mapStores()`. Can be set to an empty string.\n * Defaults to `\"Store\"`. Make sure to extend the MapStoresCustomization\n * interface if you are using TypeScript.\n *\n * @param suffix - new suffix\n */\nfunction setMapStoreSuffix(suffix // could be 'Store' but that would be annoying for JS\n) {\n mapStoreSuffix = suffix;\n}\n/**\n * Allows using stores without the composition API (`setup()`) by generating an\n * object to be spread in the `computed` field of a component. It accepts a list\n * of store definitions.\n *\n * @example\n * ```js\n * export default {\n * computed: {\n * // other computed properties\n * ...mapStores(useUserStore, useCartStore)\n * },\n *\n * created() {\n * this.userStore // store with id \"user\"\n * this.cartStore // store with id \"cart\"\n * }\n * }\n * ```\n *\n * @param stores - list of stores to map to an object\n */\nfunction mapStores(...stores) {\n if ((process.env.NODE_ENV !== 'production') && Array.isArray(stores[0])) {\n console.warn(`[🍍]: Directly pass all stores to \"mapStores()\" without putting them in an array:\\n` +\n `Replace\\n` +\n `\\tmapStores([useAuthStore, useCartStore])\\n` +\n `with\\n` +\n `\\tmapStores(useAuthStore, useCartStore)\\n` +\n `This will fail in production if not fixed.`);\n stores = stores[0];\n }\n return stores.reduce((reduced, useStore) => {\n // @ts-expect-error: $id is added by defineStore\n reduced[useStore.$id + mapStoreSuffix] = function () {\n return useStore(this.$pinia);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = function () {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key];\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function () {\n const store = useStore(this.$pinia);\n const storeKey = keysOrMapper[key];\n // for some reason TS is unable to infer the type of storeKey to be a\n // function\n return typeof storeKey === 'function'\n ? storeKey.call(this, store)\n : // @ts-expect-error: FIXME: should work?\n store[storeKey];\n };\n return reduced;\n }, {});\n}\n/**\n * Alias for `mapState()`. You should use `mapState()` instead.\n * @deprecated use `mapState()` instead.\n */\nconst mapGetters = mapState;\n/**\n * Allows directly using actions from your store without using the composition\n * API (`setup()`) by generating an object to be spread in the `methods` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapActions(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key](...args);\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[keysOrMapper[key]](...args);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapWritableState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = {\n get() {\n return useStore(this.$pinia)[key];\n },\n set(value) {\n return (useStore(this.$pinia)[key] = value);\n },\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n reduced[key] = {\n get() {\n return useStore(this.$pinia)[keysOrMapper[key]];\n },\n set(value) {\n return (useStore(this.$pinia)[keysOrMapper[key]] = value);\n },\n };\n return reduced;\n }, {});\n}\n\n/**\n * Creates an object of references with all the state, getters, and plugin-added\n * state properties of the store. Similar to `toRefs()` but specifically\n * designed for Pinia stores so methods and non reactive properties are\n * completely ignored.\n *\n * @param store - store to extract the refs from\n */\nfunction storeToRefs(store) {\n // See https://github.com/vuejs/pinia/issues/852\n // It's easier to just use toRefs() even if it includes more stuff\n if (isVue2) {\n // @ts-expect-error: toRefs include methods and others\n return toRefs(store);\n }\n else {\n const rawStore = toRaw(store);\n const refs = {};\n for (const key in rawStore) {\n const value = rawStore[key];\n // There is no native method to check for a computed\n // https://github.com/vuejs/core/pull/4165\n if (value.effect) {\n // @ts-expect-error: too hard to type correctly\n refs[key] =\n // ...\n computed({\n get: () => store[key],\n set(value) {\n store[key] = value;\n },\n });\n }\n else if (isRef(value) || isReactive(value)) {\n // @ts-expect-error: the key is state or getter\n refs[key] =\n // ---\n toRef(store, key);\n }\n }\n return refs;\n }\n}\n\n/**\n * Vue 2 Plugin that must be installed for pinia to work. Note **you don't need\n * this plugin if you are using Nuxt.js**. Use the `buildModule` instead:\n * https://pinia.vuejs.org/ssr/nuxt.html.\n *\n * @example\n * ```js\n * import Vue from 'vue'\n * import { PiniaVuePlugin, createPinia } from 'pinia'\n *\n * Vue.use(PiniaVuePlugin)\n * const pinia = createPinia()\n *\n * new Vue({\n * el: '#app',\n * // ...\n * pinia,\n * })\n * ```\n *\n * @param _Vue - `Vue` imported from 'vue'.\n */\nconst PiniaVuePlugin = function (_Vue) {\n // Equivalent of\n // app.config.globalProperties.$pinia = pinia\n _Vue.mixin({\n beforeCreate() {\n const options = this.$options;\n if (options.pinia) {\n const pinia = options.pinia;\n // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/main/src/apis/inject.ts#L31\n /* istanbul ignore else */\n if (!this._provided) {\n const provideCache = {};\n Object.defineProperty(this, '_provided', {\n get: () => provideCache,\n set: (v) => Object.assign(provideCache, v),\n });\n }\n this._provided[piniaSymbol] = pinia;\n // propagate the pinia instance in an SSR friendly way\n // avoid adding it to nuxt twice\n /* istanbul ignore else */\n if (!this.$pinia) {\n this.$pinia = pinia;\n }\n pinia._a = this;\n if (IS_CLIENT) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n }\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n registerPiniaDevtools(pinia._a, pinia);\n }\n }\n else if (!this.$pinia && options.parent && options.parent.$pinia) {\n this.$pinia = options.parent.$pinia;\n }\n },\n destroyed() {\n delete this._pStores;\n },\n });\n};\n\nexport { MutationType, PiniaVuePlugin, acceptHMRUpdate, createPinia, defineStore, disposePinia, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, shouldHydrate, skipHydrate, storeToRefs };\n","import { defineStore } from 'pinia'\nimport { ref } from 'vue'\n\nexport const useDataStore = defineStore('data', () => {\n\tconst records = ref<Record<string, any>[]>([])\n\tconst record = ref<Record<string, any>>({})\n\treturn { records, record }\n})\n","import { inject, onBeforeMount, Ref, ref } from 'vue'\n\nimport Registry from './registry'\nimport { Stonecrop } from './stonecrop'\nimport { useDataStore } from './stores/data'\n\n/**\n * Stonecrop composable return type\n * @public\n */\nexport type StonecropReturn = {\n\tstonecrop: Ref<Stonecrop>\n\tisReady: Ref<boolean>\n}\n\n/**\n * Stonecrop composable\n * @param registry - An existing Stonecrop Registry instance\n * @returns The Stonecrop instance and a boolean indicating if Stonecrop is setup and ready\n * @throws Error if the Stonecrop plugin is not enabled before using the composable\n * @public\n */\nexport function useStonecrop(registry?: Registry): StonecropReturn {\n\tif (!registry) {\n\t\tregistry = inject<Registry>('$registry')\n\t}\n\n\tlet store: ReturnType<typeof useDataStore>\n\ttry {\n\t\tstore = useDataStore()\n\t} catch (e) {\n\t\tthrow new Error('Please enable the Stonecrop plugin before using the Stonecrop composable')\n\t}\n\n\t// @ts-expect-error TODO: handle empty registry passed to Stonecrop\n\tconst stonecrop = ref(new Stonecrop(registry, store))\n\tconst isReady = ref(false)\n\n\tonBeforeMount(async () => {\n\t\tif (!registry) return\n\n\t\tconst route = registry.router.currentRoute.value\n\t\tconst doctypeSlug = route.params.records?.toString().toLowerCase()\n\t\tconst recordId = route.params.record?.toString().toLowerCase()\n\n\t\t// TODO: handle views other than list and form views?\n\t\tif (!doctypeSlug && !recordId) {\n\t\t\treturn\n\t\t}\n\n\t\t// setup doctype via registry\n\t\tconst doctype = await registry.getMeta?.(doctypeSlug)\n\t\tif (doctype) {\n\t\t\tregistry.addDoctype(doctype)\n\t\t\tstonecrop.value.setup(doctype)\n\n\t\t\tif (doctypeSlug) {\n\t\t\t\tif (recordId) {\n\t\t\t\t\tawait stonecrop.value.getRecord(doctype, recordId)\n\t\t\t\t} else {\n\t\t\t\t\tawait stonecrop.value.getRecords(doctype)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tstonecrop.value.runAction(doctype, 'LOAD', recordId ? [recordId] : undefined)\n\t\t}\n\n\t\tisReady.value = true\n\t})\n\n\t// @ts-expect-error TODO: fix the type mismatch\n\treturn { stonecrop, isReady }\n}\n","import { Component } from 'vue'\n\nimport type { ImmutableDoctype } from './types'\n\n/**\n * Doctype Meta class\n * @public\n */\nexport default class DoctypeMeta {\n\t/**\n\t * The doctype name\n\t * @public\n\t * @readonly\n\t */\n\treadonly doctype: string\n\n\t/**\n\t * The doctype schema\n\t * @public\n\t * @readonly\n\t */\n\treadonly schema: ImmutableDoctype['schema']\n\n\t/**\n\t * The doctype workflow\n\t * @public\n\t * @readonly\n\t */\n\treadonly workflow: ImmutableDoctype['workflow']\n\n\t/**\n\t * The doctype actions\n\t * @public\n\t * @readonly\n\t */\n\treadonly actions: ImmutableDoctype['actions']\n\n\t/**\n\t * The doctype component\n\t * @public\n\t * @readonly\n\t */\n\treadonly component?: Component\n\t// TODO: allow different components for different views; probably\n\t// should be defined in the schema instead?\n\n\tconstructor(\n\t\tdoctype: string,\n\t\tschema: ImmutableDoctype['schema'],\n\t\tworkflow: ImmutableDoctype['workflow'],\n\t\tactions: ImmutableDoctype['actions'],\n\t\tcomponent?: Component\n\t) {\n\t\tthis.doctype = doctype\n\t\tthis.schema = schema\n\t\tthis.workflow = workflow\n\t\tthis.actions = actions\n\t\tthis.component = component\n\t}\n\n\t/**\n\t * Converts the registered doctype to a slug (kebab-case)\n\t * @returns The slugified doctype string\n\t * @public\n\t */\n\tget slug() {\n\t\treturn this.doctype\n\t\t\t.replace(/([a-z])([A-Z])/g, '$1-$2')\n\t\t\t.replace(/[\\s_]+/g, '-')\n\t\t\t.toLowerCase()\n\t}\n}\n","import { Router } from 'vue-router'\n\nimport DoctypeMeta from './doctype'\n\n/**\n * Stonecrop Registry class\n * @public\n */\nexport default class Registry {\n\t/**\n\t * The root Registry instance\n\t */\n\tstatic _root: Registry\n\n\t/**\n\t * The name of the Registry instance\n\t *\n\t * @defaultValue 'Registry'\n\t */\n\tname: string\n\n\t/**\n\t * The Vue router instance\n\t * @see {@link https://router.vuejs.org/}\n\t */\n\trouter: Router\n\n\t/**\n\t * The registry property contains a collection of doctypes\n\t * @see {@link DoctypeMeta}\n\t */\n\tregistry: Record<string, DoctypeMeta>\n\n\t/**\n\t * The getMeta function fetches doctype metadata from an API\n\t * @see {@link DoctypeMeta}\n\t */\n\tgetMeta?: (doctype: string) => DoctypeMeta | Promise<DoctypeMeta>\n\n\tconstructor(router: Router, getMeta?: (doctype: string) => DoctypeMeta | Promise<DoctypeMeta>) {\n\t\tif (Registry._root) {\n\t\t\treturn Registry._root\n\t\t}\n\t\tRegistry._root = this\n\t\tthis.name = 'Registry'\n\t\tthis.router = router\n\t\tthis.registry = {}\n\t\tthis.getMeta = getMeta\n\t}\n\n\t/**\n\t * Get doctype metadata\n\t * @param doctype - The doctype to fetch metadata for\n\t * @returns The doctype metadata\n\t * @see {@link DoctypeMeta}\n\t */\n\taddDoctype(doctype: DoctypeMeta) {\n\t\tif (!(doctype.doctype in Object.keys(this.registry))) {\n\t\t\tthis.registry[doctype.slug] = doctype\n\t\t}\n\t\tif (!this.router.hasRoute(doctype.doctype) && doctype.component) {\n\t\t\tthis.router.addRoute({\n\t\t\t\tpath: `/${doctype.slug}`,\n\t\t\t\tname: doctype.slug,\n\t\t\t\tcomponent: doctype.component,\n\t\t\t})\n\t\t}\n\t}\n}\n","/*!\n * vue-router v4.5.0\n * (c) 2024 Eduardo San Martin Morote\n * @license MIT\n */\nimport { getCurrentInstance, inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, shallowReactive, nextTick } from 'vue';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n\nconst isBrowser = typeof document !== 'undefined';\n\n/**\n * Allows differentiating lazy components from functional components and vue-class-component\n * @internal\n *\n * @param component\n */\nfunction isRouteComponent(component) {\n return (typeof component === 'object' ||\n 'displayName' in component ||\n 'props' in component ||\n '__vccOpts' in component);\n}\nfunction isESModule(obj) {\n return (obj.__esModule ||\n obj[Symbol.toStringTag] === 'Module' ||\n // support CF with dynamic imports that do not\n // add the Module string tag\n (obj.default && isRouteComponent(obj.default)));\n}\nconst assign = Object.assign;\nfunction applyToParams(fn, params) {\n const newParams = {};\n for (const key in params) {\n const value = params[key];\n newParams[key] = isArray(value)\n ? value.map(fn)\n : fn(value);\n }\n return newParams;\n}\nconst noop = () => { };\n/**\n * Typesafe alternative to Array.isArray\n * https://github.com/microsoft/TypeScript/pull/48228\n */\nconst isArray = Array.isArray;\n\nfunction warn(msg) {\n // avoid using ...args as it breaks in older Edge builds\n const args = Array.from(arguments).slice(1);\n console.warn.apply(console, ['[Vue Router warn]: ' + msg].concat(args));\n}\n\n/**\n * Encoding Rules (␣ = Space)\n * - Path: ␣ \" < > # ? { }\n * - Query: ␣ \" < > # & =\n * - Hash: ␣ \" < > `\n *\n * On top of that, the RFC3986 (https://tools.ietf.org/html/rfc3986#section-2.2)\n * defines some extra characters to be encoded. Most browsers do not encode them\n * in encodeURI https://github.com/whatwg/url/issues/369, so it may be safer to\n * also encode `!'()*`. Leaving un-encoded only ASCII alphanumeric(`a-zA-Z0-9`)\n * plus `-._~`. This extra safety should be applied to query by patching the\n * string returned by encodeURIComponent encodeURI also encodes `[\\]^`. `\\`\n * should be encoded to avoid ambiguity. Browsers (IE, FF, C) transform a `\\`\n * into a `/` if directly typed in. The _backtick_ (`````) should also be\n * encoded everywhere because some browsers like FF encode it when directly\n * written while others don't. Safari and IE don't encode ``\"<>{}``` in hash.\n */\n// const EXTRA_RESERVED_RE = /[!'()*]/g\n// const encodeReservedReplacer = (c: string) => '%' + c.charCodeAt(0).toString(16)\nconst HASH_RE = /#/g; // %23\nconst AMPERSAND_RE = /&/g; // %26\nconst SLASH_RE = /\\//g; // %2F\nconst EQUAL_RE = /=/g; // %3D\nconst IM_RE = /\\?/g; // %3F\nconst PLUS_RE = /\\+/g; // %2B\n/**\n * NOTE: It's not clear to me if we should encode the + symbol in queries, it\n * seems to be less flexible than not doing so and I can't find out the legacy\n * systems requiring this for regular requests like text/html. In the standard,\n * the encoding of the plus character is only mentioned for\n * application/x-www-form-urlencoded\n * (https://url.spec.whatwg.org/#urlencoded-parsing) and most browsers seems lo\n * leave the plus character as is in queries. To be more flexible, we allow the\n * plus character on the query, but it can also be manually encoded by the user.\n *\n * Resources:\n * - https://url.spec.whatwg.org/#urlencoded-parsing\n * - https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20\n */\nconst ENC_BRACKET_OPEN_RE = /%5B/g; // [\nconst ENC_BRACKET_CLOSE_RE = /%5D/g; // ]\nconst ENC_CARET_RE = /%5E/g; // ^\nconst ENC_BACKTICK_RE = /%60/g; // `\nconst ENC_CURLY_OPEN_RE = /%7B/g; // {\nconst ENC_PIPE_RE = /%7C/g; // |\nconst ENC_CURLY_CLOSE_RE = /%7D/g; // }\nconst ENC_SPACE_RE = /%20/g; // }\n/**\n * Encode characters that need to be encoded on the path, search and hash\n * sections of the URL.\n *\n * @internal\n * @param text - string to encode\n * @returns encoded string\n */\nfunction commonEncode(text) {\n return encodeURI('' + text)\n .replace(ENC_PIPE_RE, '|')\n .replace(ENC_BRACKET_OPEN_RE, '[')\n .replace(ENC_BRACKET_CLOSE_RE, ']');\n}\n/**\n * Encode characters that need to be encoded on the hash section of the URL.\n *\n * @param text - string to encode\n * @returns encoded string\n */\nfunction encodeHash(text) {\n return commonEncode(text)\n .replace(ENC_CURLY_OPEN_RE, '{')\n .replace(ENC_CURLY_CLOSE_RE, '}')\n .replace(ENC_CARET_RE, '^');\n}\n/**\n * Encode characters that need to be encoded query values on the query\n * section of the URL.\n *\n * @param text - string to encode\n * @returns encoded string\n */\nfunction encodeQueryValue(text) {\n return (commonEncode(text)\n // Encode the space as +, encode the + to differentiate it from the space\n .replace(PLUS_RE, '%2B')\n .replace(ENC_SPACE_RE, '+')\n .replace(HASH_RE, '%23')\n .replace(AMPERSAND_RE, '%26')\n .replace(ENC_BACKTICK_RE, '`')\n .replace(ENC_CURLY_OPEN_RE, '{')\n .replace(ENC_CURLY_CLOSE_RE, '}')\n .replace(ENC_CARET_RE, '^'));\n}\n/**\n * Like `encodeQueryValue` but also encodes the `=` character.\n *\n * @param text - string to encode\n */\nfunction encodeQueryKey(text) {\n return encodeQueryValue(text).replace(EQUAL_RE, '%3D');\n}\n/**\n * Encode characters that need to be encoded on the path section of the URL.\n *\n * @param text - string to encode\n * @returns encoded string\n */\nfunction encodePath(text) {\n return commonEncode(text).replace(HASH_RE, '%23').replace(IM_RE, '%3F');\n}\n/**\n * Encode characters that need to be encoded on the path section of the URL as a\n * param. This function encodes everything {@link encodePath} does plus the\n * slash (`/`) character. If `text` is `null` or `undefined`, returns an empty\n * string instead.\n *\n * @param text - string to encode\n * @returns encoded string\n */\nfunction encodeParam(text) {\n return text == null ? '' : encodePath(text).replace(SLASH_RE, '%2F');\n}\n/**\n * Decode text using `decodeURIComponent`. Returns the original text if it\n * fails.\n *\n * @param text - string to decode\n * @returns decoded string\n */\nfunction decode(text) {\n try {\n return decodeURIComponent('' + text);\n }\n catch (err) {\n (process.env.NODE_ENV !== 'production') && warn(`Error decoding \"${text}\". Using original value`);\n }\n return '' + text;\n}\n\nconst TRAILING_SLASH_RE = /\\/$/;\nconst removeTrailingSlash = (path) => path.replace(TRAILING_SLASH_RE, '');\n/**\n * Transforms a URI into a normalized history location\n *\n * @param parseQuery\n * @param location - URI to normalize\n * @param currentLocation - current absolute location. Allows resolving relative\n * paths. Must start with `/`. Defaults to `/`\n * @returns a normalized history location\n */\nfunction parseURL(parseQuery, location, currentLocation = '/') {\n let path, query = {}, searchString = '', hash = '';\n // Could use URL and URLSearchParams but IE 11 doesn't support it\n // TODO: move to new URL()\n const hashPos = location.indexOf('#');\n let searchPos = location.indexOf('?');\n // the hash appears before the search, so it's not part of the search string\n if (hashPos < searchPos && hashPos >= 0) {\n searchPos = -1;\n }\n if (searchPos > -1) {\n path = location.slice(0, searchPos);\n searchString = location.slice(searchPos + 1, hashPos > -1 ? hashPos : location.length);\n query = parseQuery(searchString);\n }\n if (hashPos > -1) {\n path = path || location.slice(0, hashPos);\n // keep the # character\n hash = location.slice(hashPos, location.length);\n }\n // no search and no query\n path = resolveRelativePath(path != null ? path : location, currentLocation);\n // empty path means a relative query or hash `?foo=f`, `#thing`\n return {\n fullPath: path + (searchString && '?') + searchString + hash,\n path,\n query,\n hash: decode(hash),\n };\n}\n/**\n * Stringifies a URL object\n *\n * @param stringifyQuery\n * @param location\n */\nfunction stringifyURL(stringifyQuery, location) {\n const query = location.query ? stringifyQuery(location.query) : '';\n return location.path + (query && '?') + query + (location.hash || '');\n}\n/**\n * Strips off the base from the beginning of a location.pathname in a non-case-sensitive way.\n *\n * @param pathname - location.pathname\n * @param base - base to strip off\n */\nfunction stripBase(pathname, base) {\n // no base or base is not found at the beginning\n if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase()))\n return pathname;\n return pathname.slice(base.length) || '/';\n}\n/**\n * Checks if two RouteLocation are equal. This means that both locations are\n * pointing towards the same {@link RouteRecord} and that all `params`, `query`\n * parameters and `hash` are the same\n *\n * @param stringifyQuery - A function that takes a query object of type LocationQueryRaw and returns a string representation of it.\n * @param a - first {@link RouteLocation}\n * @param b - second {@link RouteLocation}\n */\nfunction isSameRouteLocation(stringifyQuery, a, b) {\n const aLastIndex = a.matched.length - 1;\n const bLastIndex = b.matched.length - 1;\n return (aLastIndex > -1 &&\n aLastIndex === bLastIndex &&\n isSameRouteRecord(a.matched[aLastIndex], b.matched[bLastIndex]) &&\n isSameRouteLocationParams(a.params, b.params) &&\n stringifyQuery(a.query) === stringifyQuery(b.query) &&\n a.hash === b.hash);\n}\n/**\n * Check if two `RouteRecords` are equal. Takes into account aliases: they are\n * considered equal to the `RouteRecord` they are aliasing.\n *\n * @param a - first {@link RouteRecord}\n * @param b - second {@link RouteRecord}\n */\nfunction isSameRouteRecord(a, b) {\n // since the original record has an undefined value for aliasOf\n // but all aliases point to the original record, this will always compare\n // the original record\n return (a.aliasOf || a) === (b.aliasOf || b);\n}\nfunction isSameRouteLocationParams(a, b) {\n if (Object.keys(a).length !== Object.keys(b).length)\n return false;\n for (const key in a) {\n if (!isSameRouteLocationParamsValue(a[key], b[key]))\n return false;\n }\n return true;\n}\nfunction isSameRouteLocationParamsValue(a, b) {\n return isArray(a)\n ? isEquivalentArray(a, b)\n : isArray(b)\n ? isEquivalentArray(b, a)\n : a === b;\n}\n/**\n * Check if two arrays are the same or if an array with one single entry is the\n * same as another primitive value. Used to check query and parameters\n *\n * @param a - array of values\n * @param b - array of values or a single value\n */\nfunction isEquivalentArray(a, b) {\n return isArray(b)\n ? a.length === b.length && a.every((value, i) => value === b[i])\n : a.length === 1 && a[0] === b;\n}\n/**\n * Resolves a relative path that starts with `.`.\n *\n * @param to - path location we are resolving\n * @param from - currentLocation.path, should start with `/`\n */\nfunction resolveRelativePath(to, from) {\n if (to.startsWith('/'))\n return to;\n if ((process.env.NODE_ENV !== 'production') && !from.startsWith('/')) {\n warn(`Cannot resolve a relative location without an absolute path. Trying to resolve \"${to}\" from \"${from}\". It should look like \"/${from}\".`);\n return to;\n }\n if (!to)\n return from;\n const fromSegments = from.split('/');\n const toSegments = to.split('/');\n const lastToSegment = toSegments[toSegments.length - 1];\n // make . and ./ the same (../ === .., ../../ === ../..)\n // this is the same behavior as new URL()\n if (lastToSegment === '..' || lastToSegment === '.') {\n toSegments.push('');\n }\n let position = fromSegments.length - 1;\n let toPosition;\n let segment;\n for (toPosition = 0; toPosition < toSegments.length; toPosition++) {\n segment = toSegments[toPosition];\n // we stay on the same position\n if (segment === '.')\n continue;\n // go up in the from array\n if (segment === '..') {\n // we can't go below zero, but we still need to increment toPosition\n if (position > 1)\n position--;\n // continue\n }\n // we reached a non-relative path, we stop here\n else\n break;\n }\n return (fromSegments.slice(0, position).join('/') +\n '/' +\n toSegments.slice(toPosition).join('/'));\n}\n/**\n * Initial route location where the router is. Can be used in navigation guards\n * to differentiate the initial navigation.\n *\n * @example\n * ```js\n * import { START_LOCATION } from 'vue-router'\n *\n * router.beforeEach((to, from) => {\n * if (from === START_LOCATION) {\n * // initial navigation\n * }\n * })\n * ```\n */\nconst START_LOCATION_NORMALIZED = {\n path: '/',\n // TODO: could we use a symbol in the future?\n name: undefined,\n params: {},\n query: {},\n hash: '',\n fullPath: '/',\n matched: [],\n meta: {},\n redirectedFrom: undefined,\n};\n\nvar NavigationType;\n(function (NavigationType) {\n NavigationType[\"pop\"] = \"pop\";\n NavigationType[\"push\"] = \"push\";\n})(NavigationType || (NavigationType = {}));\nvar NavigationDirection;\n(function (NavigationDirection) {\n NavigationDirection[\"back\"] = \"back\";\n NavigationDirection[\"forward\"] = \"forward\";\n NavigationDirection[\"unknown\"] = \"\";\n})(NavigationDirection || (NavigationDirection = {}));\n/**\n * Starting location for Histories\n */\nconst START = '';\n// Generic utils\n/**\n * Normalizes a base by removing any trailing slash and reading the base tag if\n * present.\n *\n * @param base - base to normalize\n */\nfunction normalizeBase(base) {\n if (!base) {\n if (isBrowser) {\n // respect <base> tag\n const baseEl = document.querySelector('base');\n base = (baseEl && baseEl.getAttribute('href')) || '/';\n // strip full URL origin\n base = base.replace(/^\\w+:\\/\\/[^\\/]+/, '');\n }\n else {\n base = '/';\n }\n }\n // ensure leading slash when it was removed by the regex above avoid leading\n // slash with hash because the file could be read from the disk like file://\n // and the leading slash would cause problems\n if (base[0] !== '/' && base[0] !== '#')\n base = '/' + base;\n // remove the trailing slash so all other method can just do `base + fullPath`\n // to build an href\n return removeTrailingSlash(base);\n}\n// remove any character before the hash\nconst BEFORE_HASH_RE = /^[^#]+#/;\nfunction createHref(base, location) {\n return base.replace(BEFORE_HASH_RE, '#') + location;\n}\n\nfunction getElementPosition(el, offset) {\n const docRect = document.documentElement.getBoundingClientRect();\n const elRect = el.getBoundingClientRect();\n return {\n behavior: offset.behavior,\n left: elRect.left - docRect.left - (offset.left || 0),\n top: elRect.top - docRect.top - (offset.top || 0),\n };\n}\nconst computeScrollPosition = () => ({\n left: window.scrollX,\n top: window.scrollY,\n});\nfunction scrollToPosition(position) {\n let scrollToOptions;\n if ('el' in position) {\n const positionEl = position.el;\n const isIdSelector = typeof positionEl === 'string' && positionEl.startsWith('#');\n /**\n * `id`s can accept pretty much any characters, including CSS combinators\n * like `>` or `~`. It's still possible to retrieve elements using\n * `document.getElementById('~')` but it needs to be escaped when using\n * `document.querySelector('#\\\\~')` for it to be valid. The only\n * requirements for `id`s are them to be unique on the page and to not be\n * empty (`id=\"\"`). Because of that, when passing an id selector, it should\n * be properly escaped for it to work with `querySelector`. We could check\n * for the id selector to be simple (no CSS combinators `+ >~`) but that\n * would make things inconsistent since they are valid characters for an\n * `id` but would need to be escaped when using `querySelector`, breaking\n * their usage and ending up in no selector returned. Selectors need to be\n * escaped:\n *\n * - `#1-thing` becomes `#\\31 -thing`\n * - `#with~symbols` becomes `#with\\\\~symbols`\n *\n * - More information about the topic can be found at\n * https://mathiasbynens.be/notes/html5-id-class.\n * - Practical example: https://mathiasbynens.be/demo/html5-id\n */\n if ((process.env.NODE_ENV !== 'production') && typeof position.el === 'string') {\n if (!isIdSelector || !document.getElementById(position.el.slice(1))) {\n try {\n const foundEl = document.querySelector(position.el);\n if (isIdSelector && foundEl) {\n warn(`The selector \"${position.el}\" should be passed as \"el: document.querySelector('${position.el}')\" because it starts with \"#\".`);\n // return to avoid other warnings\n return;\n }\n }\n catch (err) {\n warn(`The selector \"${position.el}\" is invalid. If you are using an id selector, make sure to escape it. You can find more information about escaping characters in selectors at https://mathiasbynens.be/notes/css-escapes or use CSS.escape (https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape).`);\n // return to avoid other warnings\n return;\n }\n }\n }\n const el = typeof positionEl === 'string'\n ? isIdSelector\n ? document.getElementById(positionEl.slice(1))\n : document.querySelector(positionEl)\n : positionEl;\n if (!el) {\n (process.env.NODE_ENV !== 'production') &&\n warn(`Couldn't find element using selector \"${position.el}\" returned by scrollBehavior.`);\n return;\n }\n scrollToOptions = getElementPosition(el, position);\n }\n else {\n scrollToOptions = position;\n }\n if ('scrollBehavior' in document.documentElement.style)\n window.scrollTo(scrollToOptions);\n else {\n window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.scrollX, scrollToOptions.top != null ? scrollToOptions.top : window.scrollY);\n }\n}\nfunction getScrollKey(path, delta) {\n const position = history.state ? history.state.position - delta : -1;\n return position + path;\n}\nconst scrollPositions = new Map();\nfunction saveScrollPosition(key, scrollPosition) {\n scrollPositions.set(key, scrollPosition);\n}\nfunction getSavedScrollPosition(key) {\n const scroll = scrollPositions.get(key);\n // consume it so it's not used again\n scrollPositions.delete(key);\n return scroll;\n}\n// TODO: RFC about how to save scroll position\n/**\n * ScrollBehavior instance used by the router to compute and restore the scroll\n * position when navigating.\n */\n// export interface ScrollHandler<ScrollPositionEntry extends HistoryStateValue, ScrollPosition extends ScrollPositionEntry> {\n// // returns a scroll position that can be saved in history\n// compute(): ScrollPositionEntry\n// // can take an extended ScrollPositionEntry\n// scroll(position: ScrollPosition): void\n// }\n// export const scrollHandler: ScrollHandler<ScrollPosition> = {\n// compute: computeScroll,\n// scroll: scrollToPosition,\n// }\n\nlet createBaseLocation = () => location.protocol + '//' + location.host;\n/**\n * Creates a normalized history location from a window.location object\n * @param base - The base path\n * @param location - The window.location object\n */\nfunction createCurrentLocation(base, location) {\n const { pathname, search, hash } = location;\n // allows hash bases like #, /#, #/, #!, #!/, /#!/, or even /folder#end\n const hashPos = base.indexOf('#');\n if (hashPos > -1) {\n let slicePos = hash.includes(base.slice(hashPos))\n ? base.slice(hashPos).length\n : 1;\n let pathFromHash = hash.slice(slicePos);\n // prepend the starting slash to hash so the url starts with /#\n if (pathFromHash[0] !== '/')\n pathFromHash = '/' + pathFromHash;\n return stripBase(pathFromHash, '');\n }\n const path = stripBase(pathname, base);\n return path + search + hash;\n}\nfunction useHistoryListeners(base, historyState, currentLocation, replace) {\n let listeners = [];\n let teardowns = [];\n // TODO: should it be a stack? a Dict. Check if the popstate listener\n // can trigger twice\n let pauseState = null;\n const popStateHandler = ({ state, }) => {\n const to = createCurrentLocation(base, location);\n const from = currentLocation.value;\n const fromState = historyState.value;\n let delta = 0;\n if (state) {\n currentLocation.value = to;\n historyState.value = state;\n // ignore the popstate and reset the pauseState\n if (pauseState && pauseState === from) {\n pauseState = null;\n return;\n }\n delta = fromState ? state.position - fromState.position : 0;\n }\n else {\n replace(to);\n }\n // Here we could also revert the navigation by calling history.go(-delta)\n // this listener will have to be adapted to not trigger again and to wait for the url\n // to be updated before triggering the listeners. Some kind of validation function would also\n // need to be passed to the listeners so the navigation can be accepted\n // call all listeners\n listeners.forEach(listener => {\n listener(currentLocation.value, from, {\n delta,\n type: NavigationType.pop,\n direction: delta\n ? delta > 0\n ? NavigationDirection.forward\n : NavigationDirection.back\n : NavigationDirection.unknown,\n });\n });\n };\n function pauseListeners() {\n pauseState = currentLocation.value;\n }\n function listen(callback) {\n // set up the listener and prepare teardown callbacks\n listeners.push(callback);\n const teardown = () => {\n const index = listeners.indexOf(callback);\n if (index > -1)\n listeners.splice(index, 1);\n };\n teardowns.push(teardown);\n return teardown;\n }\n function beforeUnloadListener() {\n const { history } = window;\n if (!history.state)\n return;\n history.replaceState(assign({}, history.state, { scroll: computeScrollPosition() }), '');\n }\n function destroy() {\n for (const teardown of teardowns)\n teardown();\n teardowns = [];\n window.removeEventListener('popstate', popStateHandler);\n window.removeEventListener('beforeunload', beforeUnloadListener);\n }\n // set up the listeners and prepare teardown callbacks\n window.addEventListener('popstate', popStateHandler);\n // TODO: could we use 'pagehide' or 'visibilitychange' instead?\n // https://developer.chrome.com/blog/page-lifecycle-api/\n window.addEventListener('beforeunload', beforeUnloadListener, {\n passive: true,\n });\n return {\n pauseListeners,\n listen,\n destroy,\n };\n}\n/**\n * Creates a state object\n */\nfunction buildState(back, current, forward, replaced = false, computeScroll = false) {\n return {\n back,\n current,\n forward,\n replaced,\n position: window.history.length,\n scroll: computeScroll ? computeScrollPosition() : null,\n };\n}\nfunction useHistoryStateNavigation(base) {\n const { history, location } = window;\n // private variables\n const currentLocation = {\n value: createCurrentLocation(base, location),\n };\n const historyState = { value: history.state };\n // build current history entry as this is a fresh navigation\n if (!historyState.value) {\n changeLocation(currentLocation.value, {\n back: null,\n current: currentLocation.value,\n forward: null,\n // the length is off by one, we need to decrease it\n position: history.length - 1,\n replaced: true,\n // don't add a scroll as the user may have an anchor, and we want\n // scrollBehavior to be triggered without a saved position\n scroll: null,\n }, true);\n }\n function changeLocation(to, state, replace) {\n /**\n * if a base tag is provided, and we are on a normal domain, we have to\n * respect the provided `base` attribute because pushState() will use it and\n * potentially erase anything before the `#` like at\n * https://github.com/vuejs/router/issues/685 where a base of\n * `/folder/#` but a base of `/` would erase the `/folder/` section. If\n * there is no host, the `<base>` tag makes no sense and if there isn't a\n * base tag we can just use everything after the `#`.\n */\n const hashIndex = base.indexOf('#');\n const url = hashIndex > -1\n ? (location.host && document.querySelector('base')\n ? base\n : base.slice(hashIndex)) + to\n : createBaseLocation() + base + to;\n try {\n // BROWSER QUIRK\n // NOTE: Safari throws a SecurityError when calling this function 100 times in 30 seconds\n history[replace ? 'replaceState' : 'pushState'](state, '', url);\n historyState.value = state;\n }\n catch (err) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('Error with push/replace State', err);\n }\n else {\n console.error(err);\n }\n // Force the navigation, this also resets the call count\n location[replace ? 'replace' : 'assign'](url);\n }\n }\n function replace(to, data) {\n const state = assign({}, history.state, buildState(historyState.value.back, \n // keep back and forward entries but override current position\n to, historyState.value.forward, true), data, { position: historyState.value.position });\n changeLocation(to, state, true);\n currentLocation.value = to;\n }\n function push(to, data) {\n // Add to current entry the information of where we are going\n // as well as saving the current position\n const currentState = assign({}, \n // use current history state to gracefully handle a wrong call to\n // history.replaceState\n // https://github.com/vuejs/router/issues/366\n historyState.value, history.state, {\n forward: to,\n scroll: computeScrollPosition(),\n });\n if ((process.env.NODE_ENV !== 'production') && !history.state) {\n warn(`history.state seems to have been manually replaced without preserving the necessary values. Make sure to preserve existing history state if you are manually calling history.replaceState:\\n\\n` +\n `history.replaceState(history.state, '', url)\\n\\n` +\n `You can find more information at https://router.vuejs.org/guide/migration/#Usage-of-history-state`);\n }\n changeLocation(currentState.current, currentState, true);\n const state = assign({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data);\n changeLocation(to, state, false);\n currentLocation.value = to;\n }\n return {\n location: currentLocation,\n state: historyState,\n push,\n replace,\n };\n}\n/**\n * Creates an HTML5 history. Most common history for single page applications.\n *\n * @param base -\n */\nfunction createWebHistory(base) {\n base = normalizeBase(base);\n const historyNavigation = useHistoryStateNavigation(base);\n const historyListeners = useHistoryListeners(base, historyNavigation.state, historyNavigation.location, historyNavigation.replace);\n function go(delta, triggerListeners = true) {\n if (!triggerListeners)\n historyListeners.pauseListeners();\n history.go(delta);\n }\n const routerHistory = assign({\n // it's overridden right after\n location: '',\n base,\n go,\n createHref: createHref.bind(null, base),\n }, historyNavigation, historyListeners);\n Object.defineProperty(routerHistory, 'location', {\n enumerable: true,\n get: () => historyNavigation.location.value,\n });\n Object.defineProperty(routerHistory, 'state', {\n enumerable: true,\n get: () => historyNavigation.state.value,\n });\n return routerHistory;\n}\n\n/**\n * Creates an in-memory based history. The main purpose of this history is to handle SSR. It starts in a special location that is nowhere.\n * It's up to the user to replace that location with the starter location by either calling `router.push` or `router.replace`.\n *\n * @param base - Base applied to all urls, defaults to '/'\n * @returns a history object that can be passed to the router constructor\n */\nfunction createMemoryHistory(base = '') {\n let listeners = [];\n let queue = [START];\n let position = 0;\n base = normalizeBase(base);\n function setLocation(location) {\n position++;\n if (position !== queue.length) {\n // we are in the middle, we remove everything from here in the queue\n queue.splice(position);\n }\n queue.push(location);\n }\n function triggerListeners(to, from, { direction, delta }) {\n const info = {\n direction,\n delta,\n type: NavigationType.pop,\n };\n for (const callback of listeners) {\n callback(to, from, info);\n }\n }\n const routerHistory = {\n // rewritten by Object.defineProperty\n location: START,\n // TODO: should be kept in queue\n state: {},\n base,\n createHref: createHref.bind(null, base),\n replace(to) {\n // remove current entry and decrement position\n queue.splice(position--, 1);\n setLocation(to);\n },\n push(to, data) {\n setLocation(to);\n },\n listen(callback) {\n listeners.push(callback);\n return () => {\n const index = listeners.indexOf(callback);\n if (index > -1)\n listeners.splice(index, 1);\n };\n },\n destroy() {\n listeners = [];\n queue = [START];\n position = 0;\n },\n go(delta, shouldTrigger = true) {\n const from = this.location;\n const direction = \n // we are considering delta === 0 going forward, but in abstract mode\n // using 0 for the delta doesn't make sense like it does in html5 where\n // it reloads the page\n delta < 0 ? NavigationDirection.back : NavigationDirection.forward;\n position = Math.max(0, Math.min(position + delta, queue.length - 1));\n if (shouldTrigger) {\n triggerListeners(this.location, from, {\n direction,\n delta,\n });\n }\n },\n };\n Object.defineProperty(routerHistory, 'location', {\n enumerable: true,\n get: () => queue[position],\n });\n return routerHistory;\n}\n\n/**\n * Creates a hash history. Useful for web applications with no host (e.g. `file://`) or when configuring a server to\n * handle any URL is not possible.\n *\n * @param base - optional base to provide. Defaults to `location.pathname + location.search` If there is a `<base>` tag\n * in the `head`, its value will be ignored in favor of this parameter **but note it affects all the history.pushState()\n * calls**, meaning that if you use a `<base>` tag, it's `href` value **has to match this parameter** (ignoring anything\n * after the `#`).\n *\n * @example\n * ```js\n * // at https://example.com/folder\n * createWebHashHistory() // gives a url of `https://example.com/folder#`\n * createWebHashHistory('/folder/') // gives a url of `https://example.com/folder/#`\n * // if the `#` is provided in the base, it won't be added by `createWebHashHistory`\n * createWebHashHistory('/folder/#/app/') // gives a url of `https://example.com/folder/#/app/`\n * // you should avoid doing this because it changes the original url and breaks copying urls\n * createWebHashHistory('/other-folder/') // gives a url of `https://example.com/other-folder/#`\n *\n * // at file:///usr/etc/folder/index.html\n * // for locations with no `host`, the base is ignored\n * createWebHashHistory('/iAmIgnored') // gives a url of `file:///usr/etc/folder/index.html#`\n * ```\n */\nfunction createWebHashHistory(base) {\n // Make sure this implementation is fine in terms of encoding, specially for IE11\n // for `file://`, directly use the pathname and ignore the base\n // location.pathname contains an initial `/` even at the root: `https://example.com`\n base = location.host ? base || location.pathname + location.search : '';\n // allow the user to provide a `#` in the middle: `/base/#/app`\n if (!base.includes('#'))\n base += '#';\n if ((process.env.NODE_ENV !== 'production') && !base.endsWith('#/') && !base.endsWith('#')) {\n warn(`A hash base must end with a \"#\":\\n\"${base}\" should be \"${base.replace(/#.*$/, '#')}\".`);\n }\n return createWebHistory(base);\n}\n\nfunction isRouteLocation(route) {\n return typeof route === 'string' || (route && typeof route === 'object');\n}\nfunction isRouteName(name) {\n return typeof name === 'string' || typeof name === 'symbol';\n}\n\nconst NavigationFailureSymbol = Symbol((process.env.NODE_ENV !== 'production') ? 'navigation failure' : '');\n/**\n * Enumeration with all possible types for navigation failures. Can be passed to\n * {@link isNavigationFailure} to check for specific failures.\n */\nvar NavigationFailureType;\n(function (NavigationFailureType) {\n /**\n * An aborted navigation is a navigation that failed because a navigation\n * guard returned `false` or called `next(false)`\n */\n NavigationFailureType[NavigationFailureType[\"aborted\"] = 4] = \"aborted\";\n /**\n * A cancelled navigation is a navigation that failed because a more recent\n * navigation finished started (not necessarily finished).\n */\n NavigationFailureType[NavigationFailureType[\"cancelled\"] = 8] = \"cancelled\";\n /**\n * A duplicated navigation is a navigation that failed because it was\n * initiated while already being at the exact same location.\n */\n NavigationFailureType[NavigationFailureType[\"duplicated\"] = 16] = \"duplicated\";\n})(NavigationFailureType || (NavigationFailureType = {}));\n// DEV only debug messages\nconst ErrorTypeMessages = {\n [1 /* ErrorTypes.MATCHER_NOT_FOUND */]({ location, currentLocation }) {\n return `No match for\\n ${JSON.stringify(location)}${currentLocation\n ? '\\nwhile being at\\n' + JSON.stringify(currentLocation)\n : ''}`;\n },\n [2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */]({ from, to, }) {\n return `Redirected from \"${from.fullPath}\" to \"${stringifyRoute(to)}\" via a navigation guard.`;\n },\n [4 /* ErrorTypes.NAVIGATION_ABORTED */]({ from, to }) {\n return `Navigation aborted from \"${from.fullPath}\" to \"${to.fullPath}\" via a navigation guard.`;\n },\n [8 /* ErrorTypes.NAVIGATION_CANCELLED */]({ from, to }) {\n return `Navigation cancelled from \"${from.fullPath}\" to \"${to.fullPath}\" with a new navigation.`;\n },\n [16 /* ErrorTypes.NAVIGATION_DUPLICATED */]({ from, to }) {\n return `Avoided redundant navigation to current location: \"${from.fullPath}\".`;\n },\n};\n/**\n * Creates a typed NavigationFailure object.\n * @internal\n * @param type - NavigationFailureType\n * @param params - { from, to }\n */\nfunction createRouterError(type, params) {\n // keep full error messages in cjs versions\n if ((process.env.NODE_ENV !== 'production') || !true) {\n return assign(new Error(ErrorTypeMessages[type](params)), {\n type,\n [NavigationFailureSymbol]: true,\n }, params);\n }\n else {\n return assign(new Error(), {\n type,\n [NavigationFailureSymbol]: true,\n }, params);\n }\n}\nfunction isNavigationFailure(error, type) {\n return (error instanceof Error &&\n NavigationFailureSymbol in error &&\n (type == null || !!(error.type & type)));\n}\nconst propertiesToLog = ['params', 'query', 'hash'];\nfunction stringifyRoute(to) {\n if (typeof to === 'string')\n return to;\n if (to.path != null)\n return to.path;\n const location = {};\n for (const key of propertiesToLog) {\n if (key in to)\n location[key] = to[key];\n }\n return JSON.stringify(location, null, 2);\n}\n\n// default pattern for a param: non-greedy everything but /\nconst BASE_PARAM_PATTERN = '[^/]+?';\nconst BASE_PATH_PARSER_OPTIONS = {\n sensitive: false,\n strict: false,\n start: true,\n end: true,\n};\n// Special Regex characters that must be escaped in static tokens\nconst REGEX_CHARS_RE = /[.+*?^${}()[\\]/\\\\]/g;\n/**\n * Creates a path parser from an array of Segments (a segment is an array of Tokens)\n *\n * @param segments - array of segments returned by tokenizePath\n * @param extraOptions - optional options for the regexp\n * @returns a PathParser\n */\nfunction tokensToParser(segments, extraOptions) {\n const options = assign({}, BASE_PATH_PARSER_OPTIONS, extraOptions);\n // the amount of scores is the same as the length of segments except for the root segment \"/\"\n const score = [];\n // the regexp as a string\n let pattern = options.start ? '^' : '';\n // extracted keys\n const keys = [];\n for (const segment of segments) {\n // the root segment needs special treatment\n const segmentScores = segment.length ? [] : [90 /* PathScore.Root */];\n // allow trailing slash\n if (options.strict && !segment.length)\n pattern += '/';\n for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {\n const token = segment[tokenIndex];\n // resets the score if we are inside a sub-segment /:a-other-:b\n let subSegmentScore = 40 /* PathScore.Segment */ +\n (options.sensitive ? 0.25 /* PathScore.BonusCaseSensitive */ : 0);\n if (token.type === 0 /* TokenType.Static */) {\n // prepend the slash if we are starting a new segment\n if (!tokenIndex)\n pattern += '/';\n pattern += token.value.replace(REGEX_CHARS_RE, '\\\\$&');\n subSegmentScore += 40 /* PathScore.Static */;\n }\n else if (token.type === 1 /* TokenType.Param */) {\n const { value, repeatable, optional, regexp } = token;\n keys.push({\n name: value,\n repeatable,\n optional,\n });\n const re = regexp ? regexp : BASE_PARAM_PATTERN;\n // the user provided a custom regexp /:id(\\\\d+)\n if (re !== BASE_PARAM_PATTERN) {\n subSegmentScore += 10 /* PathScore.BonusCustomRegExp */;\n // make sure the regexp is valid before using it\n try {\n new RegExp(`(${re})`);\n }\n catch (err) {\n throw new Error(`Invalid custom RegExp for param \"${value}\" (${re}): ` +\n err.message);\n }\n }\n // when we repeat we must take care of the repeating leading slash\n let subPattern = repeatable ? `((?:${re})(?:/(?:${re}))*)` : `(${re})`;\n // prepend the slash if we are starting a new segment\n if (!tokenIndex)\n subPattern =\n // avoid an optional / if there are more segments e.g. /:p?-static\n // or /:p?-:p2\n optional && segment.length < 2\n ? `(?:/${subPattern})`\n : '/' + subPattern;\n if (optional)\n subPattern += '?';\n pattern += subPattern;\n subSegmentScore += 20 /* PathScore.Dynamic */;\n if (optional)\n subSegmentScore += -8 /* PathScore.BonusOptional */;\n if (repeatable)\n subSegmentScore += -20 /* PathScore.BonusRepeatable */;\n if (re === '.*')\n subSegmentScore += -50 /* PathScore.BonusWildcard */;\n }\n segmentScores.push(subSegmentScore);\n }\n // an empty array like /home/ -> [[{home}], []]\n // if (!segment.length) pattern += '/'\n score.push(segmentScores);\n }\n // only apply the strict bonus to the last score\n if (options.strict && options.end) {\n const i = score.length - 1;\n score[i][score[i].length - 1] += 0.7000000000000001 /* PathScore.BonusStrict */;\n }\n // TODO: dev only warn double trailing slash\n if (!options.strict)\n pattern += '/?';\n if (options.end)\n pattern += '$';\n // allow paths like /dynamic to only match dynamic or dynamic/... but not dynamic_something_else\n else if (options.strict && !pattern.endsWith('/'))\n pattern += '(?:/|$)';\n const re = new RegExp(pattern, options.sensitive ? '' : 'i');\n function parse(path) {\n const match = path.match(re);\n const params = {};\n if (!match)\n return null;\n for (let i = 1; i < match.length; i++) {\n const value = match[i] || '';\n const key = keys[i - 1];\n params[key.name] = value && key.repeatable ? value.split('/') : value;\n }\n return params;\n }\n function stringify(params) {\n let path = '';\n // for optional parameters to allow to be empty\n let avoidDuplicatedSlash = false;\n for (const segment of segments) {\n if (!avoidDuplicatedSlash || !path.endsWith('/'))\n path += '/';\n avoidDuplicatedSlash = false;\n for (const token of segment) {\n if (token.type === 0 /* TokenType.Static */) {\n path += token.value;\n }\n else if (token.type === 1 /* TokenType.Param */) {\n const { value, repeatable, optional } = token;\n const param = value in params ? params[value] : '';\n if (isArray(param) && !repeatable) {\n throw new Error(`Provided param \"${value}\" is an array but it is not repeatable (* or + modifiers)`);\n }\n const text = isArray(param)\n ? param.join('/')\n : param;\n if (!text) {\n if (optional) {\n // if we have more than one optional param like /:a?-static we don't need to care about the optional param\n if (segment.length < 2) {\n // remove the last slash as we could be at the end\n if (path.endsWith('/'))\n path = path.slice(0, -1);\n // do not append a slash on the next iteration\n else\n avoidDuplicatedSlash = true;\n }\n }\n else\n throw new Error(`Missing required param \"${value}\"`);\n }\n path += text;\n }\n }\n }\n // avoid empty path when we have multiple optional params\n return path || '/';\n }\n return {\n re,\n score,\n keys,\n parse,\n stringify,\n };\n}\n/**\n * Compares an array of numbers as used in PathParser.score and returns a\n * number. This function can be used to `sort` an array\n *\n * @param a - first array of numbers\n * @param b - second array of numbers\n * @returns 0 if both are equal, < 0 if a should be sorted first, > 0 if b\n * should be sorted first\n */\nfunction compareScoreArray(a, b) {\n let i = 0;\n while (i < a.length && i < b.length) {\n const diff = b[i] - a[i];\n // only keep going if diff === 0\n if (diff)\n return diff;\n i++;\n }\n // if the last subsegment was Static, the shorter segments should be sorted first\n // otherwise sort the longest segment first\n if (a.length < b.length) {\n return a.length === 1 && a[0] === 40 /* PathScore.Static */ + 40 /* PathScore.Segment */\n ? -1\n : 1;\n }\n else if (a.length > b.length) {\n return b.length === 1 && b[0] === 40 /* PathScore.Static */ + 40 /* PathScore.Segment */\n ? 1\n : -1;\n }\n return 0;\n}\n/**\n * Compare function that can be used with `sort` to sort an array of PathParser\n *\n * @param a - first PathParser\n * @param b - second PathParser\n * @returns 0 if both are equal, < 0 if a should be sorted first, > 0 if b\n */\nfunction comparePathParserScore(a, b) {\n let i = 0;\n const aScore = a.score;\n const bScore = b.score;\n while (i < aScore.length && i < bScore.length) {\n const comp = compareScoreArray(aScore[i], bScore[i]);\n // do not return if both are equal\n if (comp)\n return comp;\n i++;\n }\n if (Math.abs(bScore.length - aScore.length) === 1) {\n if (isLastScoreNegative(aScore))\n return 1;\n if (isLastScoreNegative(bScore))\n return -1;\n }\n // if a and b share the same score entries but b has more, sort b first\n return bScore.length - aScore.length;\n // this is the ternary version\n // return aScore.length < bScore.length\n // ? 1\n // : aScore.length > bScore.length\n // ? -1\n // : 0\n}\n/**\n * This allows detecting splats at the end of a path: /home/:id(.*)*\n *\n * @param score - score to check\n * @returns true if the last entry is negative\n */\nfunction isLastScoreNegative(score) {\n const last = score[score.length - 1];\n return score.length > 0 && last[last.length - 1] < 0;\n}\n\nconst ROOT_TOKEN = {\n type: 0 /* TokenType.Static */,\n value: '',\n};\nconst VALID_PARAM_RE = /[a-zA-Z0-9_]/;\n// After some profiling, the cache seems to be unnecessary because tokenizePath\n// (the slowest part of adding a route) is very fast\n// const tokenCache = new Map<string, Token[][]>()\nfunction tokenizePath(path) {\n if (!path)\n return [[]];\n if (path === '/')\n return [[ROOT_TOKEN]];\n if (!path.startsWith('/')) {\n throw new Error((process.env.NODE_ENV !== 'production')\n ? `Route paths should start with a \"/\": \"${path}\" should be \"/${path}\".`\n : `Invalid path \"${path}\"`);\n }\n // if (tokenCache.has(path)) return tokenCache.get(path)!\n function crash(message) {\n throw new Error(`ERR (${state})/\"${buffer}\": ${message}`);\n }\n let state = 0 /* TokenizerState.Static */;\n let previousState = state;\n const tokens = [];\n // the segment will always be valid because we get into the initial state\n // with the leading /\n let segment;\n function finalizeSegment() {\n if (segment)\n tokens.push(segment);\n segment = [];\n }\n // index on the path\n let i = 0;\n // char at index\n let char;\n // buffer of the value read\n let buffer = '';\n // custom regexp for a param\n let customRe = '';\n function consumeBuffer() {\n if (!buffer)\n return;\n if (state === 0 /* TokenizerState.Static */) {\n segment.push({\n type: 0 /* TokenType.Static */,\n value: buffer,\n });\n }\n else if (state === 1 /* TokenizerState.Param */ ||\n state === 2 /* TokenizerState.ParamRegExp */ ||\n state === 3 /* TokenizerState.ParamRegExpEnd */) {\n if (segment.length > 1 && (char === '*' || char === '+'))\n crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`);\n segment.push({\n type: 1 /* TokenType.Param */,\n value: buffer,\n regexp: customRe,\n repeatable: char === '*' || char === '+',\n optional: char === '*' || char === '?',\n });\n }\n else {\n crash('Invalid state to consume buffer');\n }\n buffer = '';\n }\n function addCharToBuffer() {\n buffer += char;\n }\n while (i < path.length) {\n char = path[i++];\n if (char === '\\\\' && state !== 2 /* TokenizerState.ParamRegExp */) {\n previousState = state;\n state = 4 /* TokenizerState.EscapeNext */;\n continue;\n }\n switch (state) {\n case 0 /* TokenizerState.Static */:\n if (char === '/') {\n if (buffer) {\n consumeBuffer();\n }\n finalizeSegment();\n }\n else if (char === ':') {\n consumeBuffer();\n state = 1 /* TokenizerState.Param */;\n }\n else {\n addCharToBuffer();\n }\n break;\n case 4 /* TokenizerState.EscapeNext */:\n addCharToBuffer();\n state = previousState;\n break;\n case 1 /* TokenizerState.Param */:\n if (char === '(') {\n state = 2 /* TokenizerState.ParamRegExp */;\n }\n else if (VALID_PARAM_RE.test(char)) {\n addCharToBuffer();\n }\n else {\n consumeBuffer();\n state = 0 /* TokenizerState.Static */;\n // go back one character if we were not modifying\n if (char !== '*' && char !== '?' && char !== '+')\n i--;\n }\n break;\n case 2 /* TokenizerState.ParamRegExp */:\n // TODO: is it worth handling nested regexp? like :p(?:prefix_([^/]+)_suffix)\n // it already works by escaping the closing )\n // https://paths.esm.dev/?p=AAMeJbiAwQEcDKbAoAAkP60PG2R6QAvgNaA6AFACM2ABuQBB#\n // is this really something people need since you can also write\n // /prefix_:p()_suffix\n if (char === ')') {\n // handle the escaped )\n if (customRe[customRe.length - 1] == '\\\\')\n customRe = customRe.slice(0, -1) + char;\n else\n state = 3 /* TokenizerState.ParamRegExpEnd */;\n }\n else {\n customRe += char;\n }\n break;\n case 3 /* TokenizerState.ParamRegExpEnd */:\n // same as finalizing a param\n consumeBuffer();\n state = 0 /* TokenizerState.Static */;\n // go back one character if we were not modifying\n if (char !== '*' && char !== '?' && char !== '+')\n i--;\n customRe = '';\n break;\n default:\n crash('Unknown state');\n break;\n }\n }\n if (state === 2 /* TokenizerState.ParamRegExp */)\n crash(`Unfinished custom RegExp for param \"${buffer}\"`);\n consumeBuffer();\n finalizeSegment();\n // tokenCache.set(path, tokens)\n return tokens;\n}\n\nfunction createRouteRecordMatcher(record, parent, options) {\n const parser = tokensToParser(tokenizePath(record.path), options);\n // warn against params with the same name\n if ((process.env.NODE_ENV !== 'production')) {\n const existingKeys = new Set();\n for (const key of parser.keys) {\n if (existingKeys.has(key.name))\n warn(`Found duplicated params with name \"${key.name}\" for path \"${record.path}\". Only the last one will be available on \"$route.params\".`);\n existingKeys.add(key.name);\n }\n }\n const matcher = assign(parser, {\n record,\n parent,\n // these needs to be populated by the parent\n children: [],\n alias: [],\n });\n if (parent) {\n // both are aliases or both are not aliases\n // we don't want to mix them because the order is used when\n // passing originalRecord in Matcher.addRoute\n if (!matcher.record.aliasOf === !parent.record.aliasOf)\n parent.children.push(matcher);\n }\n return matcher;\n}\n\n/**\n * Creates a Router Matcher.\n *\n * @internal\n * @param routes - array of initial routes\n * @param globalOptions - global route options\n */\nfunction createRouterMatcher(routes, globalOptions) {\n // normalized ordered array of matchers\n const matchers = [];\n const matcherMap = new Map();\n globalOptions = mergeOptions({ strict: false, end: true, sensitive: false }, globalOptions);\n function getRecordMatcher(name) {\n return matcherMap.get(name);\n }\n function addRoute(record, parent, originalRecord) {\n // used later on to remove by name\n const isRootAdd = !originalRecord;\n const mainNormalizedRecord = normalizeRouteRecord(record);\n if ((process.env.NODE_ENV !== 'production')) {\n checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent);\n }\n // we might be the child of an alias\n mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;\n const options = mergeOptions(globalOptions, record);\n // generate an array of records to correctly handle aliases\n const normalizedRecords = [mainNormalizedRecord];\n if ('alias' in record) {\n const aliases = typeof record.alias === 'string' ? [record.alias] : record.alias;\n for (const alias of aliases) {\n normalizedRecords.push(\n // we need to normalize again to ensure the `mods` property\n // being non enumerable\n normalizeRouteRecord(assign({}, mainNormalizedRecord, {\n // this allows us to hold a copy of the `components` option\n // so that async components cache is hold on the original record\n components: originalRecord\n ? originalRecord.record.components\n : mainNormalizedRecord.components,\n path: alias,\n // we might be the child of an alias\n aliasOf: originalRecord\n ? originalRecord.record\n : mainNormalizedRecord,\n // the aliases are always of the same kind as the original since they\n // are defined on the same record\n })));\n }\n }\n let matcher;\n let originalMatcher;\n for (const normalizedRecord of normalizedRecords) {\n const { path } = normalizedRecord;\n // Build up the path for nested routes if the child isn't an absolute\n // route. Only add the / delimiter if the child path isn't empty and if the\n // parent path doesn't have a trailing slash\n if (parent && path[0] !== '/') {\n const parentPath = parent.record.path;\n const connectingSlash = parentPath[parentPath.length - 1] === '/' ? '' : '/';\n normalizedRecord.path =\n parent.record.path + (path && connectingSlash + path);\n }\n if ((process.env.NODE_ENV !== 'production') && normalizedRecord.path === '*') {\n throw new Error('Catch all routes (\"*\") must now be defined using a param with a custom regexp.\\n' +\n 'See more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-routes.');\n }\n // create the object beforehand, so it can be passed to children\n matcher = createRouteRecordMatcher(normalizedRecord, parent, options);\n if ((process.env.NODE_ENV !== 'production') && parent && path[0] === '/')\n checkMissingParamsInAbsolutePath(matcher, parent);\n // if we are an alias we must tell the original record that we exist,\n // so we can be removed\n if (originalRecord) {\n originalRecord.alias.push(matcher);\n if ((process.env.NODE_ENV !== 'production')) {\n checkSameParams(originalRecord, matcher);\n }\n }\n else {\n // otherwise, the first record is the original and others are aliases\n originalMatcher = originalMatcher || matcher;\n if (originalMatcher !== matcher)\n originalMatcher.alias.push(matcher);\n // remove the route if named and only for the top record (avoid in nested calls)\n // this works because the original record is the first one\n if (isRootAdd && record.name && !isAliasRecord(matcher)) {\n if ((process.env.NODE_ENV !== 'production')) {\n checkSameNameAsAncestor(record, parent);\n }\n removeRoute(record.name);\n }\n }\n // Avoid adding a record that doesn't display anything. This allows passing through records without a component to\n // not be reached and pass through the catch all route\n if (isMatchable(matcher)) {\n insertMatcher(matcher);\n }\n if (mainNormalizedRecord.children) {\n const children = mainNormalizedRecord.children;\n for (let i = 0; i < children.length; i++) {\n addRoute(children[i], matcher, originalRecord && originalRecord.children[i]);\n }\n }\n // if there was no original record, then the first one was not an alias and all\n // other aliases (if any) need to reference this record when adding children\n originalRecord = originalRecord || matcher;\n // TODO: add normalized records for more flexibility\n // if (parent && isAliasRecord(originalRecord)) {\n // parent.children.push(originalRecord)\n // }\n }\n return originalMatcher\n ? () => {\n // since other matchers are aliases, they should be removed by the original matcher\n removeRoute(originalMatcher);\n }\n : noop;\n }\n function removeRoute(matcherRef) {\n if (isRouteName(matcherRef)) {\n const matcher = matcherMap.get(matcherRef);\n if (matcher) {\n matcherMap.delete(matcherRef);\n matchers.splice(matchers.indexOf(matcher), 1);\n matcher.children.forEach(removeRoute);\n matcher.alias.forEach(removeRoute);\n }\n }\n else {\n const index = matchers.indexOf(matcherRef);\n if (index > -1) {\n matchers.splice(index, 1);\n if (matcherRef.record.name)\n matcherMap.delete(matcherRef.record.name);\n matcherRef.children.forEach(removeRoute);\n matcherRef.alias.forEach(removeRoute);\n }\n }\n }\n function getRoutes() {\n return matchers;\n }\n function insertMatcher(matcher) {\n const index = findInsertionIndex(matcher, matchers);\n matchers.splice(index, 0, matcher);\n // only add the original record to the name map\n if (matcher.record.name && !isAliasRecord(matcher))\n matcherMap.set(matcher.record.name, matcher);\n }\n function resolve(location, currentLocation) {\n let matcher;\n let params = {};\n let path;\n let name;\n if ('name' in location && location.name) {\n matcher = matcherMap.get(location.name);\n if (!matcher)\n throw createRouterError(1 /* ErrorTypes.MATCHER_NOT_FOUND */, {\n location,\n });\n // warn if the user is passing invalid params so they can debug it better when they get removed\n if ((process.env.NODE_ENV !== 'production')) {\n const invalidParams = Object.keys(location.params || {}).filter(paramName => !matcher.keys.find(k => k.name === paramName));\n if (invalidParams.length) {\n warn(`Discarded invalid param(s) \"${invalidParams.join('\", \"')}\" when navigating. See https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 for more details.`);\n }\n }\n name = matcher.record.name;\n params = assign(\n // paramsFromLocation is a new object\n paramsFromLocation(currentLocation.params, \n // only keep params that exist in the resolved location\n // only keep optional params coming from a parent record\n matcher.keys\n .filter(k => !k.optional)\n .concat(matcher.parent ? matcher.parent.keys.filter(k => k.optional) : [])\n .map(k => k.name)), \n // discard any existing params in the current location that do not exist here\n // #1497 this ensures better active/exact matching\n location.params &&\n paramsFromLocation(location.params, matcher.keys.map(k => k.name)));\n // throws if cannot be stringified\n path = matcher.stringify(params);\n }\n else if (location.path != null) {\n // no need to resolve the path with the matcher as it was provided\n // this also allows the user to control the encoding\n path = location.path;\n if ((process.env.NODE_ENV !== 'production') && !path.startsWith('/')) {\n warn(`The Matcher cannot resolve relative paths but received \"${path}\". Unless you directly called \\`matcher.resolve(\"${path}\")\\`, this is probably a bug in vue-router. Please open an issue at https://github.com/vuejs/router/issues/new/choose.`);\n }\n matcher = matchers.find(m => m.re.test(path));\n // matcher should have a value after the loop\n if (matcher) {\n // we know the matcher works because we tested the regexp\n params = matcher.parse(path);\n name = matcher.record.name;\n }\n // location is a relative path\n }\n else {\n // match by name or path of current route\n matcher = currentLocation.name\n ? matcherMap.get(currentLocation.name)\n : matchers.find(m => m.re.test(currentLocation.path));\n if (!matcher)\n throw createRouterError(1 /* ErrorTypes.MATCHER_NOT_FOUND */, {\n location,\n currentLocation,\n });\n name = matcher.record.name;\n // since we are navigating to the same location, we don't need to pick the\n // params like when `name` is provided\n params = assign({}, currentLocation.params, location.params);\n path = matcher.stringify(params);\n }\n const matched = [];\n let parentMatcher = matcher;\n while (parentMatcher) {\n // reversed order so parents are at the beginning\n matched.unshift(parentMatcher.record);\n parentMatcher = parentMatcher.parent;\n }\n return {\n name,\n path,\n params,\n matched,\n meta: mergeMetaFields(matched),\n };\n }\n // add initial routes\n routes.forEach(route => addRoute(route));\n function clearRoutes() {\n matchers.length = 0;\n matcherMap.clear();\n }\n return {\n addRoute,\n resolve,\n removeRoute,\n clearRoutes,\n getRoutes,\n getRecordMatcher,\n };\n}\nfunction paramsFromLocation(params, keys) {\n const newParams = {};\n for (const key of keys) {\n if (key in params)\n newParams[key] = params[key];\n }\n return newParams;\n}\n/**\n * Normalizes a RouteRecordRaw. Creates a copy\n *\n * @param record\n * @returns the normalized version\n */\nfunction normalizeRouteRecord(record) {\n const normalized = {\n path: record.path,\n redirect: record.redirect,\n name: record.name,\n meta: record.meta || {},\n aliasOf: record.aliasOf,\n beforeEnter: record.beforeEnter,\n props: normalizeRecordProps(record),\n children: record.children || [],\n instances: {},\n leaveGuards: new Set(),\n updateGuards: new Set(),\n enterCallbacks: {},\n // must be declared afterwards\n // mods: {},\n components: 'components' in record\n ? record.components || null\n : record.component && { default: record.component },\n };\n // mods contain modules and shouldn't be copied,\n // logged or anything. It's just used for internal\n // advanced use cases like data loaders\n Object.defineProperty(normalized, 'mods', {\n value: {},\n });\n return normalized;\n}\n/**\n * Normalize the optional `props` in a record to always be an object similar to\n * components. Also accept a boolean for components.\n * @param record\n */\nfunction normalizeRecordProps(record) {\n const propsObject = {};\n // props does not exist on redirect records, but we can set false directly\n const props = record.props || false;\n if ('component' in record) {\n propsObject.default = props;\n }\n else {\n // NOTE: we could also allow a function to be applied to every component.\n // Would need user feedback for use cases\n for (const name in record.components)\n propsObject[name] = typeof props === 'object' ? props[name] : props;\n }\n return propsObject;\n}\n/**\n * Checks if a record or any of its parent is an alias\n * @param record\n */\nfunction isAliasRecord(record) {\n while (record) {\n if (record.record.aliasOf)\n return true;\n record = record.parent;\n }\n return false;\n}\n/**\n * Merge meta fields of an array of records\n *\n * @param matched - array of matched records\n */\nfunction mergeMetaFields(matched) {\n return matched.reduce((meta, record) => assign(meta, record.meta), {});\n}\nfunction mergeOptions(defaults, partialOptions) {\n const options = {};\n for (const key in defaults) {\n options[key] = key in partialOptions ? partialOptions[key] : defaults[key];\n }\n return options;\n}\nfunction isSameParam(a, b) {\n return (a.name === b.name &&\n a.optional === b.optional &&\n a.repeatable === b.repeatable);\n}\n/**\n * Check if a path and its alias have the same required params\n *\n * @param a - original record\n * @param b - alias record\n */\nfunction checkSameParams(a, b) {\n for (const key of a.keys) {\n if (!key.optional && !b.keys.find(isSameParam.bind(null, key)))\n return warn(`Alias \"${b.record.path}\" and the original record: \"${a.record.path}\" must have the exact same param named \"${key.name}\"`);\n }\n for (const key of b.keys) {\n if (!key.optional && !a.keys.find(isSameParam.bind(null, key)))\n return warn(`Alias \"${b.record.path}\" and the original record: \"${a.record.path}\" must have the exact same param named \"${key.name}\"`);\n }\n}\n/**\n * A route with a name and a child with an empty path without a name should warn when adding the route\n *\n * @param mainNormalizedRecord - RouteRecordNormalized\n * @param parent - RouteRecordMatcher\n */\nfunction checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent) {\n if (parent &&\n parent.record.name &&\n !mainNormalizedRecord.name &&\n !mainNormalizedRecord.path) {\n warn(`The route named \"${String(parent.record.name)}\" has a child without a name and an empty path. Using that name won't render the empty path child so you probably want to move the name to the child instead. If this is intentional, add a name to the child route to remove the warning.`);\n }\n}\nfunction checkSameNameAsAncestor(record, parent) {\n for (let ancestor = parent; ancestor; ancestor = ancestor.parent) {\n if (ancestor.record.name === record.name) {\n throw new Error(`A route named \"${String(record.name)}\" has been added as a ${parent === ancestor ? 'child' : 'descendant'} of a route with the same name. Route names must be unique and a nested route cannot use the same name as an ancestor.`);\n }\n }\n}\nfunction checkMissingParamsInAbsolutePath(record, parent) {\n for (const key of parent.keys) {\n if (!record.keys.find(isSameParam.bind(null, key)))\n return warn(`Absolute path \"${record.record.path}\" must have the exact same param named \"${key.name}\" as its parent \"${parent.record.path}\".`);\n }\n}\n/**\n * Performs a binary search to find the correct insertion index for a new matcher.\n *\n * Matchers are primarily sorted by their score. If scores are tied then we also consider parent/child relationships,\n * with descendants coming before ancestors. If there's still a tie, new routes are inserted after existing routes.\n *\n * @param matcher - new matcher to be inserted\n * @param matchers - existing matchers\n */\nfunction findInsertionIndex(matcher, matchers) {\n // First phase: binary search based on score\n let lower = 0;\n let upper = matchers.length;\n while (lower !== upper) {\n const mid = (lower + upper) >> 1;\n const sortOrder = comparePathParserScore(matcher, matchers[mid]);\n if (sortOrder < 0) {\n upper = mid;\n }\n else {\n lower = mid + 1;\n }\n }\n // Second phase: check for an ancestor with the same score\n const insertionAncestor = getInsertionAncestor(matcher);\n if (insertionAncestor) {\n upper = matchers.lastIndexOf(insertionAncestor, upper - 1);\n if ((process.env.NODE_ENV !== 'production') && upper < 0) {\n // This should never happen\n warn(`Finding ancestor route \"${insertionAncestor.record.path}\" failed for \"${matcher.record.path}\"`);\n }\n }\n return upper;\n}\nfunction getInsertionAncestor(matcher) {\n let ancestor = matcher;\n while ((ancestor = ancestor.parent)) {\n if (isMatchable(ancestor) &&\n comparePathParserScore(matcher, ancestor) === 0) {\n return ancestor;\n }\n }\n return;\n}\n/**\n * Checks if a matcher can be reachable. This means if it's possible to reach it as a route. For example, routes without\n * a component, or name, or redirect, are just used to group other routes.\n * @param matcher\n * @param matcher.record record of the matcher\n * @returns\n */\nfunction isMatchable({ record }) {\n return !!(record.name ||\n (record.components && Object.keys(record.components).length) ||\n record.redirect);\n}\n\n/**\n * Transforms a queryString into a {@link LocationQuery} object. Accept both, a\n * version with the leading `?` and without Should work as URLSearchParams\n\n * @internal\n *\n * @param search - search string to parse\n * @returns a query object\n */\nfunction parseQuery(search) {\n const query = {};\n // avoid creating an object with an empty key and empty value\n // because of split('&')\n if (search === '' || search === '?')\n return query;\n const hasLeadingIM = search[0] === '?';\n const searchParams = (hasLeadingIM ? search.slice(1) : search).split('&');\n for (let i = 0; i < searchParams.length; ++i) {\n // pre decode the + into space\n const searchParam = searchParams[i].replace(PLUS_RE, ' ');\n // allow the = character\n const eqPos = searchParam.indexOf('=');\n const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));\n const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));\n if (key in query) {\n // an extra variable for ts types\n let currentValue = query[key];\n if (!isArray(currentValue)) {\n currentValue = query[key] = [currentValue];\n }\n currentValue.push(value);\n }\n else {\n query[key] = value;\n }\n }\n return query;\n}\n/**\n * Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it\n * doesn't prepend a `?`\n *\n * @internal\n *\n * @param query - query object to stringify\n * @returns string version of the query without the leading `?`\n */\nfunction stringifyQuery(query) {\n let search = '';\n for (let key in query) {\n const value = query[key];\n key = encodeQueryKey(key);\n if (value == null) {\n // only null adds the value\n if (value !== undefined) {\n search += (search.length ? '&' : '') + key;\n }\n continue;\n }\n // keep null values\n const values = isArray(value)\n ? value.map(v => v && encodeQueryValue(v))\n : [value && encodeQueryValue(value)];\n values.forEach(value => {\n // skip undefined values in arrays as if they were not present\n // smaller code than using filter\n if (value !== undefined) {\n // only append & with non-empty search\n search += (search.length ? '&' : '') + key;\n if (value != null)\n search += '=' + value;\n }\n });\n }\n return search;\n}\n/**\n * Transforms a {@link LocationQueryRaw} into a {@link LocationQuery} by casting\n * numbers into strings, removing keys with an undefined value and replacing\n * undefined with null in arrays\n *\n * @param query - query object to normalize\n * @returns a normalized query object\n */\nfunction normalizeQuery(query) {\n const normalizedQuery = {};\n for (const key in query) {\n const value = query[key];\n if (value !== undefined) {\n normalizedQuery[key] = isArray(value)\n ? value.map(v => (v == null ? null : '' + v))\n : value == null\n ? value\n : '' + value;\n }\n }\n return normalizedQuery;\n}\n\n/**\n * RouteRecord being rendered by the closest ancestor Router View. Used for\n * `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View\n * Location Matched\n *\n * @internal\n */\nconst matchedRouteKey = Symbol((process.env.NODE_ENV !== 'production') ? 'router view location matched' : '');\n/**\n * Allows overriding the router view depth to control which component in\n * `matched` is rendered. rvd stands for Router View Depth\n *\n * @internal\n */\nconst viewDepthKey = Symbol((process.env.NODE_ENV !== 'production') ? 'router view depth' : '');\n/**\n * Allows overriding the router instance returned by `useRouter` in tests. r\n * stands for router\n *\n * @internal\n */\nconst routerKey = Symbol((process.env.NODE_ENV !== 'production') ? 'router' : '');\n/**\n * Allows overriding the current route returned by `useRoute` in tests. rl\n * stands for route location\n *\n * @internal\n */\nconst routeLocationKey = Symbol((process.env.NODE_ENV !== 'production') ? 'route location' : '');\n/**\n * Allows overriding the current route used by router-view. Internally this is\n * used when the `route` prop is passed.\n *\n * @internal\n */\nconst routerViewLocationKey = Symbol((process.env.NODE_ENV !== 'production') ? 'router view location' : '');\n\n/**\n * Create a list of callbacks that can be reset. Used to create before and after navigation guards list\n */\nfunction useCallbacks() {\n let handlers = [];\n function add(handler) {\n handlers.push(handler);\n return () => {\n const i = handlers.indexOf(handler);\n if (i > -1)\n handlers.splice(i, 1);\n };\n }\n function reset() {\n handlers = [];\n }\n return {\n add,\n list: () => handlers.slice(),\n reset,\n };\n}\n\nfunction registerGuard(record, name, guard) {\n const removeFromList = () => {\n record[name].delete(guard);\n };\n onUnmounted(removeFromList);\n onDeactivated(removeFromList);\n onActivated(() => {\n record[name].add(guard);\n });\n record[name].add(guard);\n}\n/**\n * Add a navigation guard that triggers whenever the component for the current\n * location is about to be left. Similar to {@link beforeRouteLeave} but can be\n * used in any component. The guard is removed when the component is unmounted.\n *\n * @param leaveGuard - {@link NavigationGuard}\n */\nfunction onBeforeRouteLeave(leaveGuard) {\n if ((process.env.NODE_ENV !== 'production') && !getCurrentInstance()) {\n warn('getCurrentInstance() returned null. onBeforeRouteLeave() must be called at the top of a setup function');\n return;\n }\n const activeRecord = inject(matchedRouteKey, \n // to avoid warning\n {}).value;\n if (!activeRecord) {\n (process.env.NODE_ENV !== 'production') &&\n warn('No active route record was found when calling `onBeforeRouteLeave()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?');\n return;\n }\n registerGuard(activeRecord, 'leaveGuards', leaveGuard);\n}\n/**\n * Add a navigation guard that triggers whenever the current location is about\n * to be updated. Similar to {@link beforeRouteUpdate} but can be used in any\n * component. The guard is removed when the component is unmounted.\n *\n * @param updateGuard - {@link NavigationGuard}\n */\nfunction onBeforeRouteUpdate(updateGuard) {\n if ((process.env.NODE_ENV !== 'production') && !getCurrentInstance()) {\n warn('getCurrentInstance() returned null. onBeforeRouteUpdate() must be called at the top of a setup function');\n return;\n }\n const activeRecord = inject(matchedRouteKey, \n // to avoid warning\n {}).value;\n if (!activeRecord) {\n (process.env.NODE_ENV !== 'production') &&\n warn('No active route record was found when calling `onBeforeRouteUpdate()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?');\n return;\n }\n registerGuard(activeRecord, 'updateGuards', updateGuard);\n}\nfunction guardToPromiseFn(guard, to, from, record, name, runWithContext = fn => fn()) {\n // keep a reference to the enterCallbackArray to prevent pushing callbacks if a new navigation took place\n const enterCallbackArray = record &&\n // name is defined if record is because of the function overload\n (record.enterCallbacks[name] = record.enterCallbacks[name] || []);\n return () => new Promise((resolve, reject) => {\n const next = (valid) => {\n if (valid === false) {\n reject(createRouterError(4 /* ErrorTypes.NAVIGATION_ABORTED */, {\n from,\n to,\n }));\n }\n else if (valid instanceof Error) {\n reject(valid);\n }\n else if (isRouteLocation(valid)) {\n reject(createRouterError(2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */, {\n from: to,\n to: valid,\n }));\n }\n else {\n if (enterCallbackArray &&\n // since enterCallbackArray is truthy, both record and name also are\n record.enterCallbacks[name] === enterCallbackArray &&\n typeof valid === 'function') {\n enterCallbackArray.push(valid);\n }\n resolve();\n }\n };\n // wrapping with Promise.resolve allows it to work with both async and sync guards\n const guardReturn = runWithContext(() => guard.call(record && record.instances[name], to, from, (process.env.NODE_ENV !== 'production') ? canOnlyBeCalledOnce(next, to, from) : next));\n let guardCall = Promise.resolve(guardReturn);\n if (guard.length < 3)\n guardCall = guardCall.then(next);\n if ((process.env.NODE_ENV !== 'production') && guard.length > 2) {\n const message = `The \"next\" callback was never called inside of ${guard.name ? '\"' + guard.name + '\"' : ''}:\\n${guard.toString()}\\n. If you are returning a value instead of calling \"next\", make sure to remove the \"next\" parameter from your function.`;\n if (typeof guardReturn === 'object' && 'then' in guardReturn) {\n guardCall = guardCall.then(resolvedValue => {\n // @ts-expect-error: _called is added at canOnlyBeCalledOnce\n if (!next._called) {\n warn(message);\n return Promise.reject(new Error('Invalid navigation guard'));\n }\n return resolvedValue;\n });\n }\n else if (guardReturn !== undefined) {\n // @ts-expect-error: _called is added at canOnlyBeCalledOnce\n if (!next._called) {\n warn(message);\n reject(new Error('Invalid navigation guard'));\n return;\n }\n }\n }\n guardCall.catch(err => reject(err));\n });\n}\nfunction canOnlyBeCalledOnce(next, to, from) {\n let called = 0;\n return function () {\n if (called++ === 1)\n warn(`The \"next\" callback was called more than once in one navigation guard when going from \"${from.fullPath}\" to \"${to.fullPath}\". It should be called exactly one time in each navigation guard. This will fail in production.`);\n // @ts-expect-error: we put it in the original one because it's easier to check\n next._called = true;\n if (called === 1)\n next.apply(null, arguments);\n };\n}\nfunction extractComponentsGuards(matched, guardType, to, from, runWithContext = fn => fn()) {\n const guards = [];\n for (const record of matched) {\n if ((process.env.NODE_ENV !== 'production') && !record.components && !record.children.length) {\n warn(`Record with path \"${record.path}\" is either missing a \"component(s)\"` +\n ` or \"children\" property.`);\n }\n for (const name in record.components) {\n let rawComponent = record.components[name];\n if ((process.env.NODE_ENV !== 'production')) {\n if (!rawComponent ||\n (typeof rawComponent !== 'object' &&\n typeof rawComponent !== 'function')) {\n warn(`Component \"${name}\" in record with path \"${record.path}\" is not` +\n ` a valid component. Received \"${String(rawComponent)}\".`);\n // throw to ensure we stop here but warn to ensure the message isn't\n // missed by the user\n throw new Error('Invalid route component');\n }\n else if ('then' in rawComponent) {\n // warn if user wrote import('/component.vue') instead of () =>\n // import('./component.vue')\n warn(`Component \"${name}\" in record with path \"${record.path}\" is a ` +\n `Promise instead of a function that returns a Promise. Did you ` +\n `write \"import('./MyPage.vue')\" instead of ` +\n `\"() => import('./MyPage.vue')\" ? This will break in ` +\n `production if not fixed.`);\n const promise = rawComponent;\n rawComponent = () => promise;\n }\n else if (rawComponent.__asyncLoader &&\n // warn only once per component\n !rawComponent.__warnedDefineAsync) {\n rawComponent.__warnedDefineAsync = true;\n warn(`Component \"${name}\" in record with path \"${record.path}\" is defined ` +\n `using \"defineAsyncComponent()\". ` +\n `Write \"() => import('./MyPage.vue')\" instead of ` +\n `\"defineAsyncComponent(() => import('./MyPage.vue'))\".`);\n }\n }\n // skip update and leave guards if the route component is not mounted\n if (guardType !== 'beforeRouteEnter' && !record.instances[name])\n continue;\n if (isRouteComponent(rawComponent)) {\n // __vccOpts is added by vue-class-component and contain the regular options\n const options = rawComponent.__vccOpts || rawComponent;\n const guard = options[guardType];\n guard &&\n guards.push(guardToPromiseFn(guard, to, from, record, name, runWithContext));\n }\n else {\n // start requesting the chunk already\n let componentPromise = rawComponent();\n if ((process.env.NODE_ENV !== 'production') && !('catch' in componentPromise)) {\n warn(`Component \"${name}\" in record with path \"${record.path}\" is a function that does not return a Promise. If you were passing a functional component, make sure to add a \"displayName\" to the component. This will break in production if not fixed.`);\n componentPromise = Promise.resolve(componentPromise);\n }\n guards.push(() => componentPromise.then(resolved => {\n if (!resolved)\n throw new Error(`Couldn't resolve component \"${name}\" at \"${record.path}\"`);\n const resolvedComponent = isESModule(resolved)\n ? resolved.default\n : resolved;\n // keep the resolved module for plugins like data loaders\n record.mods[name] = resolved;\n // replace the function with the resolved component\n // cannot be null or undefined because we went into the for loop\n record.components[name] = resolvedComponent;\n // __vccOpts is added by vue-class-component and contain the regular options\n const options = resolvedComponent.__vccOpts || resolvedComponent;\n const guard = options[guardType];\n return (guard &&\n guardToPromiseFn(guard, to, from, record, name, runWithContext)());\n }));\n }\n }\n }\n return guards;\n}\n/**\n * Ensures a route is loaded, so it can be passed as o prop to `<RouterView>`.\n *\n * @param route - resolved route to load\n */\nfunction loadRouteLocation(route) {\n return route.matched.every(record => record.redirect)\n ? Promise.reject(new Error('Cannot load a route that redirects.'))\n : Promise.all(route.matched.map(record => record.components &&\n Promise.all(Object.keys(record.components).reduce((promises, name) => {\n const rawComponent = record.components[name];\n if (typeof rawComponent === 'function' &&\n !('displayName' in rawComponent)) {\n promises.push(rawComponent().then(resolved => {\n if (!resolved)\n return Promise.reject(new Error(`Couldn't resolve component \"${name}\" at \"${record.path}\". Ensure you passed a function that returns a promise.`));\n const resolvedComponent = isESModule(resolved)\n ? resolved.default\n : resolved;\n // keep the resolved module for plugins like data loaders\n record.mods[name] = resolved;\n // replace the function with the resolved component\n // cannot be null or undefined because we went into the for loop\n record.components[name] = resolvedComponent;\n return;\n }));\n }\n return promises;\n }, [])))).then(() => route);\n}\n\n// TODO: we could allow currentRoute as a prop to expose `isActive` and\n// `isExactActive` behavior should go through an RFC\n/**\n * Returns the internal behavior of a {@link RouterLink} without the rendering part.\n *\n * @param props - a `to` location and an optional `replace` flag\n */\nfunction useLink(props) {\n const router = inject(routerKey);\n const currentRoute = inject(routeLocationKey);\n let hasPrevious = false;\n let previousTo = null;\n const route = computed(() => {\n const to = unref(props.to);\n if ((process.env.NODE_ENV !== 'production') && (!hasPrevious || to !== previousTo)) {\n if (!isRouteLocation(to)) {\n if (hasPrevious) {\n warn(`Invalid value for prop \"to\" in useLink()\\n- to:`, to, `\\n- previous to:`, previousTo, `\\n- props:`, props);\n }\n else {\n warn(`Invalid value for prop \"to\" in useLink()\\n- to:`, to, `\\n- props:`, props);\n }\n }\n previousTo = to;\n hasPrevious = true;\n }\n return router.resolve(to);\n });\n const activeRecordIndex = computed(() => {\n const { matched } = route.value;\n const { length } = matched;\n const routeMatched = matched[length - 1];\n const currentMatched = currentRoute.matched;\n if (!routeMatched || !currentMatched.length)\n return -1;\n const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));\n if (index > -1)\n return index;\n // possible parent record\n const parentRecordPath = getOriginalPath(matched[length - 2]);\n return (\n // we are dealing with nested routes\n length > 1 &&\n // if the parent and matched route have the same path, this link is\n // referring to the empty child. Or we currently are on a different\n // child of the same parent\n getOriginalPath(routeMatched) === parentRecordPath &&\n // avoid comparing the child with its parent\n currentMatched[currentMatched.length - 1].path !== parentRecordPath\n ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2]))\n : index);\n });\n const isActive = computed(() => activeRecordIndex.value > -1 &&\n includesParams(currentRoute.params, route.value.params));\n const isExactActive = computed(() => activeRecordIndex.value > -1 &&\n activeRecordIndex.value === currentRoute.matched.length - 1 &&\n isSameRouteLocationParams(currentRoute.params, route.value.params));\n function navigate(e = {}) {\n if (guardEvent(e)) {\n const p = router[unref(props.replace) ? 'replace' : 'push'](unref(props.to)\n // avoid uncaught errors are they are logged anyway\n ).catch(noop);\n if (props.viewTransition &&\n typeof document !== 'undefined' &&\n 'startViewTransition' in document) {\n document.startViewTransition(() => p);\n }\n return p;\n }\n return Promise.resolve();\n }\n // devtools only\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) && isBrowser) {\n const instance = getCurrentInstance();\n if (instance) {\n const linkContextDevtools = {\n route: route.value,\n isActive: isActive.value,\n isExactActive: isExactActive.value,\n error: null,\n };\n // @ts-expect-error: this is internal\n instance.__vrl_devtools = instance.__vrl_devtools || [];\n // @ts-expect-error: this is internal\n instance.__vrl_devtools.push(linkContextDevtools);\n watchEffect(() => {\n linkContextDevtools.route = route.value;\n linkContextDevtools.isActive = isActive.value;\n linkContextDevtools.isExactActive = isExactActive.value;\n linkContextDevtools.error = isRouteLocation(unref(props.to))\n ? null\n : 'Invalid \"to\" value';\n }, { flush: 'post' });\n }\n }\n /**\n * NOTE: update {@link _RouterLinkI}'s `$slots` type when updating this\n */\n return {\n route,\n href: computed(() => route.value.href),\n isActive,\n isExactActive,\n navigate,\n };\n}\nfunction preferSingleVNode(vnodes) {\n return vnodes.length === 1 ? vnodes[0] : vnodes;\n}\nconst RouterLinkImpl = /*#__PURE__*/ defineComponent({\n name: 'RouterLink',\n compatConfig: { MODE: 3 },\n props: {\n to: {\n type: [String, Object],\n required: true,\n },\n replace: Boolean,\n activeClass: String,\n // inactiveClass: String,\n exactActiveClass: String,\n custom: Boolean,\n ariaCurrentValue: {\n type: String,\n default: 'page',\n },\n },\n useLink,\n setup(props, { slots }) {\n const link = reactive(useLink(props));\n const { options } = inject(routerKey);\n const elClass = computed(() => ({\n [getLinkClass(props.activeClass, options.linkActiveClass, 'router-link-active')]: link.isActive,\n // [getLinkClass(\n // props.inactiveClass,\n // options.linkInactiveClass,\n // 'router-link-inactive'\n // )]: !link.isExactActive,\n [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, 'router-link-exact-active')]: link.isExactActive,\n }));\n return () => {\n const children = slots.default && preferSingleVNode(slots.default(link));\n return props.custom\n ? children\n : h('a', {\n 'aria-current': link.isExactActive\n ? props.ariaCurrentValue\n : null,\n href: link.href,\n // this would override user added attrs but Vue will still add\n // the listener, so we end up triggering both\n onClick: link.navigate,\n class: elClass.value,\n }, children);\n };\n },\n});\n// export the public type for h/tsx inference\n// also to avoid inline import() in generated d.ts files\n/**\n * Component to render a link that triggers a navigation on click.\n */\nconst RouterLink = RouterLinkImpl;\nfunction guardEvent(e) {\n // don't redirect with control keys\n if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n return;\n // don't redirect when preventDefault called\n if (e.defaultPrevented)\n return;\n // don't redirect on right click\n if (e.button !== undefined && e.button !== 0)\n return;\n // don't redirect if `target=\"_blank\"`\n // @ts-expect-error getAttribute does exist\n if (e.currentTarget && e.currentTarget.getAttribute) {\n // @ts-expect-error getAttribute exists\n const target = e.currentTarget.getAttribute('target');\n if (/\\b_blank\\b/i.test(target))\n return;\n }\n // this may be a Weex event which doesn't have this method\n if (e.preventDefault)\n e.preventDefault();\n return true;\n}\nfunction includesParams(outer, inner) {\n for (const key in inner) {\n const innerValue = inner[key];\n const outerValue = outer[key];\n if (typeof innerValue === 'string') {\n if (innerValue !== outerValue)\n return false;\n }\n else {\n if (!isArray(outerValue) ||\n outerValue.length !== innerValue.length ||\n innerValue.some((value, i) => value !== outerValue[i]))\n return false;\n }\n }\n return true;\n}\n/**\n * Get the original path value of a record by following its aliasOf\n * @param record\n */\nfunction getOriginalPath(record) {\n return record ? (record.aliasOf ? record.aliasOf.path : record.path) : '';\n}\n/**\n * Utility class to get the active class based on defaults.\n * @param propClass\n * @param globalClass\n * @param defaultClass\n */\nconst getLinkClass = (propClass, globalClass, defaultClass) => propClass != null\n ? propClass\n : globalClass != null\n ? globalClass\n : defaultClass;\n\nconst RouterViewImpl = /*#__PURE__*/ defineComponent({\n name: 'RouterView',\n // #674 we manually inherit them\n inheritAttrs: false,\n props: {\n name: {\n type: String,\n default: 'default',\n },\n route: Object,\n },\n // Better compat for @vue/compat users\n // https://github.com/vuejs/router/issues/1315\n compatConfig: { MODE: 3 },\n setup(props, { attrs, slots }) {\n (process.env.NODE_ENV !== 'production') && warnDeprecatedUsage();\n const injectedRoute = inject(routerViewLocationKey);\n const routeToDisplay = computed(() => props.route || injectedRoute.value);\n const injectedDepth = inject(viewDepthKey, 0);\n // The depth changes based on empty components option, which allows passthrough routes e.g. routes with children\n // that are used to reuse the `path` property\n const depth = computed(() => {\n let initialDepth = unref(injectedDepth);\n const { matched } = routeToDisplay.value;\n let matchedRoute;\n while ((matchedRoute = matched[initialDepth]) &&\n !matchedRoute.components) {\n initialDepth++;\n }\n return initialDepth;\n });\n const matchedRouteRef = computed(() => routeToDisplay.value.matched[depth.value]);\n provide(viewDepthKey, computed(() => depth.value + 1));\n provide(matchedRouteKey, matchedRouteRef);\n provide(routerViewLocationKey, routeToDisplay);\n const viewRef = ref();\n // watch at the same time the component instance, the route record we are\n // rendering, and the name\n watch(() => [viewRef.value, matchedRouteRef.value, props.name], ([instance, to, name], [oldInstance, from, oldName]) => {\n // copy reused instances\n if (to) {\n // this will update the instance for new instances as well as reused\n // instances when navigating to a new route\n to.instances[name] = instance;\n // the component instance is reused for a different route or name, so\n // we copy any saved update or leave guards. With async setup, the\n // mounting component will mount before the matchedRoute changes,\n // making instance === oldInstance, so we check if guards have been\n // added before. This works because we remove guards when\n // unmounting/deactivating components\n if (from && from !== to && instance && instance === oldInstance) {\n if (!to.leaveGuards.size) {\n to.leaveGuards = from.leaveGuards;\n }\n if (!to.updateGuards.size) {\n to.updateGuards = from.updateGuards;\n }\n }\n }\n // trigger beforeRouteEnter next callbacks\n if (instance &&\n to &&\n // if there is no instance but to and from are the same this might be\n // the first visit\n (!from || !isSameRouteRecord(to, from) || !oldInstance)) {\n (to.enterCallbacks[name] || []).forEach(callback => callback(instance));\n }\n }, { flush: 'post' });\n return () => {\n const route = routeToDisplay.value;\n // we need the value at the time we render because when we unmount, we\n // navigated to a different location so the value is different\n const currentName = props.name;\n const matchedRoute = matchedRouteRef.value;\n const ViewComponent = matchedRoute && matchedRoute.components[currentName];\n if (!ViewComponent) {\n return normalizeSlot(slots.default, { Component: ViewComponent, route });\n }\n // props from route configuration\n const routePropsOption = matchedRoute.props[currentName];\n const routeProps = routePropsOption\n ? routePropsOption === true\n ? route.params\n : typeof routePropsOption === 'function'\n ? routePropsOption(route)\n : routePropsOption\n : null;\n const onVnodeUnmounted = vnode => {\n // remove the instance reference to prevent leak\n if (vnode.component.isUnmounted) {\n matchedRoute.instances[currentName] = null;\n }\n };\n const component = h(ViewComponent, assign({}, routeProps, attrs, {\n onVnodeUnmounted,\n ref: viewRef,\n }));\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) &&\n isBrowser &&\n component.ref) {\n // TODO: can display if it's an alias, its props\n const info = {\n depth: depth.value,\n name: matchedRoute.name,\n path: matchedRoute.path,\n meta: matchedRoute.meta,\n };\n const internalInstances = isArray(component.ref)\n ? component.ref.map(r => r.i)\n : [component.ref.i];\n internalInstances.forEach(instance => {\n // @ts-expect-error\n instance.__vrv_devtools = info;\n });\n }\n return (\n // pass the vnode to the slot as a prop.\n // h and <component :is=\"...\"> both accept vnodes\n normalizeSlot(slots.default, { Component: component, route }) ||\n component);\n };\n },\n});\nfunction normalizeSlot(slot, data) {\n if (!slot)\n return null;\n const slotContent = slot(data);\n return slotContent.length === 1 ? slotContent[0] : slotContent;\n}\n// export the public type for h/tsx inference\n// also to avoid inline import() in generated d.ts files\n/**\n * Component to display the current route the user is at.\n */\nconst RouterView = RouterViewImpl;\n// warn against deprecated usage with <transition> & <keep-alive>\n// due to functional component being no longer eager in Vue 3\nfunction warnDeprecatedUsage() {\n const instance = getCurrentInstance();\n const parentName = instance.parent && instance.parent.type.name;\n const parentSubTreeType = instance.parent && instance.parent.subTree && instance.parent.subTree.type;\n if (parentName &&\n (parentName === 'KeepAlive' || parentName.includes('Transition')) &&\n typeof parentSubTreeType === 'object' &&\n parentSubTreeType.name === 'RouterView') {\n const comp = parentName === 'KeepAlive' ? 'keep-alive' : 'transition';\n warn(`<router-view> can no longer be used directly inside <transition> or <keep-alive>.\\n` +\n `Use slot props instead:\\n\\n` +\n `<router-view v-slot=\"{ Component }\">\\n` +\n ` <${comp}>\\n` +\n ` <component :is=\"Component\" />\\n` +\n ` </${comp}>\\n` +\n `</router-view>`);\n }\n}\n\n/**\n * Copies a route location and removes any problematic properties that cannot be shown in devtools (e.g. Vue instances).\n *\n * @param routeLocation - routeLocation to format\n * @param tooltip - optional tooltip\n * @returns a copy of the routeLocation\n */\nfunction formatRouteLocation(routeLocation, tooltip) {\n const copy = assign({}, routeLocation, {\n // remove variables that can contain vue instances\n matched: routeLocation.matched.map(matched => omit(matched, ['instances', 'children', 'aliasOf'])),\n });\n return {\n _custom: {\n type: null,\n readOnly: true,\n display: routeLocation.fullPath,\n tooltip,\n value: copy,\n },\n };\n}\nfunction formatDisplay(display) {\n return {\n _custom: {\n display,\n },\n };\n}\n// to support multiple router instances\nlet routerId = 0;\nfunction addDevtools(app, router, matcher) {\n // Take over router.beforeEach and afterEach\n // make sure we are not registering the devtool twice\n if (router.__hasDevtools)\n return;\n router.__hasDevtools = true;\n // increment to support multiple router instances\n const id = routerId++;\n setupDevtoolsPlugin({\n id: 'org.vuejs.router' + (id ? '.' + id : ''),\n label: 'Vue Router',\n packageName: 'vue-router',\n homepage: 'https://router.vuejs.org',\n logo: 'https://router.vuejs.org/logo.png',\n componentStateTypes: ['Routing'],\n app,\n }, api => {\n if (typeof api.now !== 'function') {\n console.warn('[Vue Router]: You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.');\n }\n // display state added by the router\n api.on.inspectComponent((payload, ctx) => {\n if (payload.instanceData) {\n payload.instanceData.state.push({\n type: 'Routing',\n key: '$route',\n editable: false,\n value: formatRouteLocation(router.currentRoute.value, 'Current Route'),\n });\n }\n });\n // mark router-link as active and display tags on router views\n api.on.visitComponentTree(({ treeNode: node, componentInstance }) => {\n if (componentInstance.__vrv_devtools) {\n const info = componentInstance.__vrv_devtools;\n node.tags.push({\n label: (info.name ? `${info.name.toString()}: ` : '') + info.path,\n textColor: 0,\n tooltip: 'This component is rendered by &lt;router-view&gt;',\n backgroundColor: PINK_500,\n });\n }\n // if multiple useLink are used\n if (isArray(componentInstance.__vrl_devtools)) {\n componentInstance.__devtoolsApi = api;\n componentInstance.__vrl_devtools.forEach(devtoolsData => {\n let label = devtoolsData.route.path;\n let backgroundColor = ORANGE_400;\n let tooltip = '';\n let textColor = 0;\n if (devtoolsData.error) {\n label = devtoolsData.error;\n backgroundColor = RED_100;\n textColor = RED_700;\n }\n else if (devtoolsData.isExactActive) {\n backgroundColor = LIME_500;\n tooltip = 'This is exactly active';\n }\n else if (devtoolsData.isActive) {\n backgroundColor = BLUE_600;\n tooltip = 'This link is active';\n }\n node.tags.push({\n label,\n textColor,\n tooltip,\n backgroundColor,\n });\n });\n }\n });\n watch(router.currentRoute, () => {\n // refresh active state\n refreshRoutesView();\n api.notifyComponentUpdate();\n api.sendInspectorTree(routerInspectorId);\n api.sendInspectorState(routerInspectorId);\n });\n const navigationsLayerId = 'router:navigations:' + id;\n api.addTimelineLayer({\n id: navigationsLayerId,\n label: `Router${id ? ' ' + id : ''} Navigations`,\n color: 0x40a8c4,\n });\n // const errorsLayerId = 'router:errors'\n // api.addTimelineLayer({\n // id: errorsLayerId,\n // label: 'Router Errors',\n // color: 0xea5455,\n // })\n router.onError((error, to) => {\n api.addTimelineEvent({\n layerId: navigationsLayerId,\n event: {\n title: 'Error during Navigation',\n subtitle: to.fullPath,\n logType: 'error',\n time: api.now(),\n data: { error },\n groupId: to.meta.__navigationId,\n },\n });\n });\n // attached to `meta` and used to group events\n let navigationId = 0;\n router.beforeEach((to, from) => {\n const data = {\n guard: formatDisplay('beforeEach'),\n from: formatRouteLocation(from, 'Current Location during this navigation'),\n to: formatRouteLocation(to, 'Target location'),\n };\n // Used to group navigations together, hide from devtools\n Object.defineProperty(to.meta, '__navigationId', {\n value: navigationId++,\n });\n api.addTimelineEvent({\n layerId: navigationsLayerId,\n event: {\n time: api.now(),\n title: 'Start of navigation',\n subtitle: to.fullPath,\n data,\n groupId: to.meta.__navigationId,\n },\n });\n });\n router.afterEach((to, from, failure) => {\n const data = {\n guard: formatDisplay('afterEach'),\n };\n if (failure) {\n data.failure = {\n _custom: {\n type: Error,\n readOnly: true,\n display: failure ? failure.message : '',\n tooltip: 'Navigation Failure',\n value: failure,\n },\n };\n data.status = formatDisplay('❌');\n }\n else {\n data.status = formatDisplay('✅');\n }\n // we set here to have the right order\n data.from = formatRouteLocation(from, 'Current Location during this navigation');\n data.to = formatRouteLocation(to, 'Target location');\n api.addTimelineEvent({\n layerId: navigationsLayerId,\n event: {\n title: 'End of navigation',\n subtitle: to.fullPath,\n time: api.now(),\n data,\n logType: failure ? 'warning' : 'default',\n groupId: to.meta.__navigationId,\n },\n });\n });\n /**\n * Inspector of Existing routes\n */\n const routerInspectorId = 'router-inspector:' + id;\n api.addInspector({\n id: routerInspectorId,\n label: 'Routes' + (id ? ' ' + id : ''),\n icon: 'book',\n treeFilterPlaceholder: 'Search routes',\n });\n function refreshRoutesView() {\n // the routes view isn't active\n if (!activeRoutesPayload)\n return;\n const payload = activeRoutesPayload;\n // children routes will appear as nested\n let routes = matcher.getRoutes().filter(route => !route.parent ||\n // these routes have a parent with no component which will not appear in the view\n // therefore we still need to include them\n !route.parent.record.components);\n // reset match state to false\n routes.forEach(resetMatchStateOnRouteRecord);\n // apply a match state if there is a payload\n if (payload.filter) {\n routes = routes.filter(route => \n // save matches state based on the payload\n isRouteMatching(route, payload.filter.toLowerCase()));\n }\n // mark active routes\n routes.forEach(route => markRouteRecordActive(route, router.currentRoute.value));\n payload.rootNodes = routes.map(formatRouteRecordForInspector);\n }\n let activeRoutesPayload;\n api.on.getInspectorTree(payload => {\n activeRoutesPayload = payload;\n if (payload.app === app && payload.inspectorId === routerInspectorId) {\n refreshRoutesView();\n }\n });\n /**\n * Display information about the currently selected route record\n */\n api.on.getInspectorState(payload => {\n if (payload.app === app && payload.inspectorId === routerInspectorId) {\n const routes = matcher.getRoutes();\n const route = routes.find(route => route.record.__vd_id === payload.nodeId);\n if (route) {\n payload.state = {\n options: formatRouteRecordMatcherForStateInspector(route),\n };\n }\n }\n });\n api.sendInspectorTree(routerInspectorId);\n api.sendInspectorState(routerInspectorId);\n });\n}\nfunction modifierForKey(key) {\n if (key.optional) {\n return key.repeatable ? '*' : '?';\n }\n else {\n return key.repeatable ? '+' : '';\n }\n}\nfunction formatRouteRecordMatcherForStateInspector(route) {\n const { record } = route;\n const fields = [\n { editable: false, key: 'path', value: record.path },\n ];\n if (record.name != null) {\n fields.push({\n editable: false,\n key: 'name',\n value: record.name,\n });\n }\n fields.push({ editable: false, key: 'regexp', value: route.re });\n if (route.keys.length) {\n fields.push({\n editable: false,\n key: 'keys',\n value: {\n _custom: {\n type: null,\n readOnly: true,\n display: route.keys\n .map(key => `${key.name}${modifierForKey(key)}`)\n .join(' '),\n tooltip: 'Param keys',\n value: route.keys,\n },\n },\n });\n }\n if (record.redirect != null) {\n fields.push({\n editable: false,\n key: 'redirect',\n value: record.redirect,\n });\n }\n if (route.alias.length) {\n fields.push({\n editable: false,\n key: 'aliases',\n value: route.alias.map(alias => alias.record.path),\n });\n }\n if (Object.keys(route.record.meta).length) {\n fields.push({\n editable: false,\n key: 'meta',\n value: route.record.meta,\n });\n }\n fields.push({\n key: 'score',\n editable: false,\n value: {\n _custom: {\n type: null,\n readOnly: true,\n display: route.score.map(score => score.join(', ')).join(' | '),\n tooltip: 'Score used to sort routes',\n value: route.score,\n },\n },\n });\n return fields;\n}\n/**\n * Extracted from tailwind palette\n */\nconst PINK_500 = 0xec4899;\nconst BLUE_600 = 0x2563eb;\nconst LIME_500 = 0x84cc16;\nconst CYAN_400 = 0x22d3ee;\nconst ORANGE_400 = 0xfb923c;\n// const GRAY_100 = 0xf4f4f5\nconst DARK = 0x666666;\nconst RED_100 = 0xfee2e2;\nconst RED_700 = 0xb91c1c;\nfunction formatRouteRecordForInspector(route) {\n const tags = [];\n const { record } = route;\n if (record.name != null) {\n tags.push({\n label: String(record.name),\n textColor: 0,\n backgroundColor: CYAN_400,\n });\n }\n if (record.aliasOf) {\n tags.push({\n label: 'alias',\n textColor: 0,\n backgroundColor: ORANGE_400,\n });\n }\n if (route.__vd_match) {\n tags.push({\n label: 'matches',\n textColor: 0,\n backgroundColor: PINK_500,\n });\n }\n if (route.__vd_exactActive) {\n tags.push({\n label: 'exact',\n textColor: 0,\n backgroundColor: LIME_500,\n });\n }\n if (route.__vd_active) {\n tags.push({\n label: 'active',\n textColor: 0,\n backgroundColor: BLUE_600,\n });\n }\n if (record.redirect) {\n tags.push({\n label: typeof record.redirect === 'string'\n ? `redirect: ${record.redirect}`\n : 'redirects',\n textColor: 0xffffff,\n backgroundColor: DARK,\n });\n }\n // add an id to be able to select it. Using the `path` is not possible because\n // empty path children would collide with their parents\n let id = record.__vd_id;\n if (id == null) {\n id = String(routeRecordId++);\n record.__vd_id = id;\n }\n return {\n id,\n label: record.path,\n tags,\n children: route.children.map(formatRouteRecordForInspector),\n };\n}\n// incremental id for route records and inspector state\nlet routeRecordId = 0;\nconst EXTRACT_REGEXP_RE = /^\\/(.*)\\/([a-z]*)$/;\nfunction markRouteRecordActive(route, currentRoute) {\n // no route will be active if matched is empty\n // reset the matching state\n const isExactActive = currentRoute.matched.length &&\n isSameRouteRecord(currentRoute.matched[currentRoute.matched.length - 1], route.record);\n route.__vd_exactActive = route.__vd_active = isExactActive;\n if (!isExactActive) {\n route.__vd_active = currentRoute.matched.some(match => isSameRouteRecord(match, route.record));\n }\n route.children.forEach(childRoute => markRouteRecordActive(childRoute, currentRoute));\n}\nfunction resetMatchStateOnRouteRecord(route) {\n route.__vd_match = false;\n route.children.forEach(resetMatchStateOnRouteRecord);\n}\nfunction isRouteMatching(route, filter) {\n const found = String(route.re).match(EXTRACT_REGEXP_RE);\n route.__vd_match = false;\n if (!found || found.length < 3) {\n return false;\n }\n // use a regexp without $ at the end to match nested routes better\n const nonEndingRE = new RegExp(found[1].replace(/\\$$/, ''), found[2]);\n if (nonEndingRE.test(filter)) {\n // mark children as matches\n route.children.forEach(child => isRouteMatching(child, filter));\n // exception case: `/`\n if (route.record.path !== '/' || filter === '/') {\n route.__vd_match = route.re.test(filter);\n return true;\n }\n // hide the / route\n return false;\n }\n const path = route.record.path.toLowerCase();\n const decodedPath = decode(path);\n // also allow partial matching on the path\n if (!filter.startsWith('/') &&\n (decodedPath.includes(filter) || path.includes(filter)))\n return true;\n if (decodedPath.startsWith(filter) || path.startsWith(filter))\n return true;\n if (route.record.name && String(route.record.name).includes(filter))\n return true;\n return route.children.some(child => isRouteMatching(child, filter));\n}\nfunction omit(obj, keys) {\n const ret = {};\n for (const key in obj) {\n if (!keys.includes(key)) {\n // @ts-expect-error\n ret[key] = obj[key];\n }\n }\n return ret;\n}\n\n/**\n * Creates a Router instance that can be used by a Vue app.\n *\n * @param options - {@link RouterOptions}\n */\nfunction createRouter(options) {\n const matcher = createRouterMatcher(options.routes, options);\n const parseQuery$1 = options.parseQuery || parseQuery;\n const stringifyQuery$1 = options.stringifyQuery || stringifyQuery;\n const routerHistory = options.history;\n if ((process.env.NODE_ENV !== 'production') && !routerHistory)\n throw new Error('Provide the \"history\" option when calling \"createRouter()\":' +\n ' https://router.vuejs.org/api/interfaces/RouterOptions.html#history');\n const beforeGuards = useCallbacks();\n const beforeResolveGuards = useCallbacks();\n const afterGuards = useCallbacks();\n const currentRoute = shallowRef(START_LOCATION_NORMALIZED);\n let pendingLocation = START_LOCATION_NORMALIZED;\n // leave the scrollRestoration if no scrollBehavior is provided\n if (isBrowser && options.scrollBehavior && 'scrollRestoration' in history) {\n history.scrollRestoration = 'manual';\n }\n const normalizeParams = applyToParams.bind(null, paramValue => '' + paramValue);\n const encodeParams = applyToParams.bind(null, encodeParam);\n const decodeParams = \n // @ts-expect-error: intentionally avoid the type check\n applyToParams.bind(null, decode);\n function addRoute(parentOrRoute, route) {\n let parent;\n let record;\n if (isRouteName(parentOrRoute)) {\n parent = matcher.getRecordMatcher(parentOrRoute);\n if ((process.env.NODE_ENV !== 'production') && !parent) {\n warn(`Parent route \"${String(parentOrRoute)}\" not found when adding child route`, route);\n }\n record = route;\n }\n else {\n record = parentOrRoute;\n }\n return matcher.addRoute(record, parent);\n }\n function removeRoute(name) {\n const recordMatcher = matcher.getRecordMatcher(name);\n if (recordMatcher) {\n matcher.removeRoute(recordMatcher);\n }\n else if ((process.env.NODE_ENV !== 'production')) {\n warn(`Cannot remove non-existent route \"${String(name)}\"`);\n }\n }\n function getRoutes() {\n return matcher.getRoutes().map(routeMatcher => routeMatcher.record);\n }\n function hasRoute(name) {\n return !!matcher.getRecordMatcher(name);\n }\n function resolve(rawLocation, currentLocation) {\n // const resolve: Router['resolve'] = (rawLocation: RouteLocationRaw, currentLocation) => {\n // const objectLocation = routerLocationAsObject(rawLocation)\n // we create a copy to modify it later\n currentLocation = assign({}, currentLocation || currentRoute.value);\n if (typeof rawLocation === 'string') {\n const locationNormalized = parseURL(parseQuery$1, rawLocation, currentLocation.path);\n const matchedRoute = matcher.resolve({ path: locationNormalized.path }, currentLocation);\n const href = routerHistory.createHref(locationNormalized.fullPath);\n if ((process.env.NODE_ENV !== 'production')) {\n if (href.startsWith('//'))\n warn(`Location \"${rawLocation}\" resolved to \"${href}\". A resolved location cannot start with multiple slashes.`);\n else if (!matchedRoute.matched.length) {\n warn(`No match found for location with path \"${rawLocation}\"`);\n }\n }\n // locationNormalized is always a new object\n return assign(locationNormalized, matchedRoute, {\n params: decodeParams(matchedRoute.params),\n hash: decode(locationNormalized.hash),\n redirectedFrom: undefined,\n href,\n });\n }\n if ((process.env.NODE_ENV !== 'production') && !isRouteLocation(rawLocation)) {\n warn(`router.resolve() was passed an invalid location. This will fail in production.\\n- Location:`, rawLocation);\n return resolve({});\n }\n let matcherLocation;\n // path could be relative in object as well\n if (rawLocation.path != null) {\n if ((process.env.NODE_ENV !== 'production') &&\n 'params' in rawLocation &&\n !('name' in rawLocation) &&\n // @ts-expect-error: the type is never\n Object.keys(rawLocation.params).length) {\n warn(`Path \"${rawLocation.path}\" was passed with params but they will be ignored. Use a named route alongside params instead.`);\n }\n matcherLocation = assign({}, rawLocation, {\n path: parseURL(parseQuery$1, rawLocation.path, currentLocation.path).path,\n });\n }\n else {\n // remove any nullish param\n const targetParams = assign({}, rawLocation.params);\n for (const key in targetParams) {\n if (targetParams[key] == null) {\n delete targetParams[key];\n }\n }\n // pass encoded values to the matcher, so it can produce encoded path and fullPath\n matcherLocation = assign({}, rawLocation, {\n params: encodeParams(targetParams),\n });\n // current location params are decoded, we need to encode them in case the\n // matcher merges the params\n currentLocation.params = encodeParams(currentLocation.params);\n }\n const matchedRoute = matcher.resolve(matcherLocation, currentLocation);\n const hash = rawLocation.hash || '';\n if ((process.env.NODE_ENV !== 'production') && hash && !hash.startsWith('#')) {\n warn(`A \\`hash\\` should always start with the character \"#\". Replace \"${hash}\" with \"#${hash}\".`);\n }\n // the matcher might have merged current location params, so\n // we need to run the decoding again\n matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params));\n const fullPath = stringifyURL(stringifyQuery$1, assign({}, rawLocation, {\n hash: encodeHash(hash),\n path: matchedRoute.path,\n }));\n const href = routerHistory.createHref(fullPath);\n if ((process.env.NODE_ENV !== 'production')) {\n if (href.startsWith('//')) {\n warn(`Location \"${rawLocation}\" resolved to \"${href}\". A resolved location cannot start with multiple slashes.`);\n }\n else if (!matchedRoute.matched.length) {\n warn(`No match found for location with path \"${rawLocation.path != null ? rawLocation.path : rawLocation}\"`);\n }\n }\n return assign({\n fullPath,\n // keep the hash encoded so fullPath is effectively path + encodedQuery +\n // hash\n hash,\n query: \n // if the user is using a custom query lib like qs, we might have\n // nested objects, so we keep the query as is, meaning it can contain\n // numbers at `$route.query`, but at the point, the user will have to\n // use their own type anyway.\n // https://github.com/vuejs/router/issues/328#issuecomment-649481567\n stringifyQuery$1 === stringifyQuery\n ? normalizeQuery(rawLocation.query)\n : (rawLocation.query || {}),\n }, matchedRoute, {\n redirectedFrom: undefined,\n href,\n });\n }\n function locationAsObject(to) {\n return typeof to === 'string'\n ? parseURL(parseQuery$1, to, currentRoute.value.path)\n : assign({}, to);\n }\n function checkCanceledNavigation(to, from) {\n if (pendingLocation !== to) {\n return createRouterError(8 /* ErrorTypes.NAVIGATION_CANCELLED */, {\n from,\n to,\n });\n }\n }\n function push(to) {\n return pushWithRedirect(to);\n }\n function replace(to) {\n return push(assign(locationAsObject(to), { replace: true }));\n }\n function handleRedirectRecord(to) {\n const lastMatched = to.matched[to.matched.length - 1];\n if (lastMatched && lastMatched.redirect) {\n const { redirect } = lastMatched;\n let newTargetLocation = typeof redirect === 'function' ? redirect(to) : redirect;\n if (typeof newTargetLocation === 'string') {\n newTargetLocation =\n newTargetLocation.includes('?') || newTargetLocation.includes('#')\n ? (newTargetLocation = locationAsObject(newTargetLocation))\n : // force empty params\n { path: newTargetLocation };\n // @ts-expect-error: force empty params when a string is passed to let\n // the router parse them again\n newTargetLocation.params = {};\n }\n if ((process.env.NODE_ENV !== 'production') &&\n newTargetLocation.path == null &&\n !('name' in newTargetLocation)) {\n warn(`Invalid redirect found:\\n${JSON.stringify(newTargetLocation, null, 2)}\\n when navigating to \"${to.fullPath}\". A redirect must contain a name or path. This will break in production.`);\n throw new Error('Invalid redirect');\n }\n return assign({\n query: to.query,\n hash: to.hash,\n // avoid transferring params if the redirect has a path\n params: newTargetLocation.path != null ? {} : to.params,\n }, newTargetLocation);\n }\n }\n function pushWithRedirect(to, redirectedFrom) {\n const targetLocation = (pendingLocation = resolve(to));\n const from = currentRoute.value;\n const data = to.state;\n const force = to.force;\n // to could be a string where `replace` is a function\n const replace = to.replace === true;\n const shouldRedirect = handleRedirectRecord(targetLocation);\n if (shouldRedirect)\n return pushWithRedirect(assign(locationAsObject(shouldRedirect), {\n state: typeof shouldRedirect === 'object'\n ? assign({}, data, shouldRedirect.state)\n : data,\n force,\n replace,\n }), \n // keep original redirectedFrom if it exists\n redirectedFrom || targetLocation);\n // if it was a redirect we already called `pushWithRedirect` above\n const toLocation = targetLocation;\n toLocation.redirectedFrom = redirectedFrom;\n let failure;\n if (!force && isSameRouteLocation(stringifyQuery$1, from, targetLocation)) {\n failure = createRouterError(16 /* ErrorTypes.NAVIGATION_DUPLICATED */, { to: toLocation, from });\n // trigger scroll to allow scrolling to the same anchor\n handleScroll(from, from, \n // this is a push, the only way for it to be triggered from a\n // history.listen is with a redirect, which makes it become a push\n true, \n // This cannot be the first navigation because the initial location\n // cannot be manually navigated to\n false);\n }\n return (failure ? Promise.resolve(failure) : navigate(toLocation, from))\n .catch((error) => isNavigationFailure(error)\n ? // navigation redirects still mark the router as ready\n isNavigationFailure(error, 2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */)\n ? error\n : markAsReady(error) // also returns the error\n : // reject any unknown error\n triggerError(error, toLocation, from))\n .then((failure) => {\n if (failure) {\n if (isNavigationFailure(failure, 2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */)) {\n if ((process.env.NODE_ENV !== 'production') &&\n // we are redirecting to the same location we were already at\n isSameRouteLocation(stringifyQuery$1, resolve(failure.to), toLocation) &&\n // and we have done it a couple of times\n redirectedFrom &&\n // @ts-expect-error: added only in dev\n (redirectedFrom._count = redirectedFrom._count\n ? // @ts-expect-error\n redirectedFrom._count + 1\n : 1) > 30) {\n warn(`Detected a possibly infinite redirection in a navigation guard when going from \"${from.fullPath}\" to \"${toLocation.fullPath}\". Aborting to avoid a Stack Overflow.\\n Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`);\n return Promise.reject(new Error('Infinite redirect in navigation guard'));\n }\n return pushWithRedirect(\n // keep options\n assign({\n // preserve an existing replacement but allow the redirect to override it\n replace,\n }, locationAsObject(failure.to), {\n state: typeof failure.to === 'object'\n ? assign({}, data, failure.to.state)\n : data,\n force,\n }), \n // preserve the original redirectedFrom if any\n redirectedFrom || toLocation);\n }\n }\n else {\n // if we fail we don't finalize the navigation\n failure = finalizeNavigation(toLocation, from, true, replace, data);\n }\n triggerAfterEach(toLocation, from, failure);\n return failure;\n });\n }\n /**\n * Helper to reject and skip all navigation guards if a new navigation happened\n * @param to\n * @param from\n */\n function checkCanceledNavigationAndReject(to, from) {\n const error = checkCanceledNavigation(to, from);\n return error ? Promise.reject(error) : Promise.resolve();\n }\n function runWithContext(fn) {\n const app = installedApps.values().next().value;\n // support Vue < 3.3\n return app && typeof app.runWithContext === 'function'\n ? app.runWithContext(fn)\n : fn();\n }\n // TODO: refactor the whole before guards by internally using router.beforeEach\n function navigate(to, from) {\n let guards;\n const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from);\n // all components here have been resolved once because we are leaving\n guards = extractComponentsGuards(leavingRecords.reverse(), 'beforeRouteLeave', to, from);\n // leavingRecords is already reversed\n for (const record of leavingRecords) {\n record.leaveGuards.forEach(guard => {\n guards.push(guardToPromiseFn(guard, to, from));\n });\n }\n const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(null, to, from);\n guards.push(canceledNavigationCheck);\n // run the queue of per route beforeRouteLeave guards\n return (runGuardQueue(guards)\n .then(() => {\n // check global guards beforeEach\n guards = [];\n for (const guard of beforeGuards.list()) {\n guards.push(guardToPromiseFn(guard, to, from));\n }\n guards.push(canceledNavigationCheck);\n return runGuardQueue(guards);\n })\n .then(() => {\n // check in components beforeRouteUpdate\n guards = extractComponentsGuards(updatingRecords, 'beforeRouteUpdate', to, from);\n for (const record of updatingRecords) {\n record.updateGuards.forEach(guard => {\n guards.push(guardToPromiseFn(guard, to, from));\n });\n }\n guards.push(canceledNavigationCheck);\n // run the queue of per route beforeEnter guards\n return runGuardQueue(guards);\n })\n .then(() => {\n // check the route beforeEnter\n guards = [];\n for (const record of enteringRecords) {\n // do not trigger beforeEnter on reused views\n if (record.beforeEnter) {\n if (isArray(record.beforeEnter)) {\n for (const beforeEnter of record.beforeEnter)\n guards.push(guardToPromiseFn(beforeEnter, to, from));\n }\n else {\n guards.push(guardToPromiseFn(record.beforeEnter, to, from));\n }\n }\n }\n guards.push(canceledNavigationCheck);\n // run the queue of per route beforeEnter guards\n return runGuardQueue(guards);\n })\n .then(() => {\n // NOTE: at this point to.matched is normalized and does not contain any () => Promise<Component>\n // clear existing enterCallbacks, these are added by extractComponentsGuards\n to.matched.forEach(record => (record.enterCallbacks = {}));\n // check in-component beforeRouteEnter\n guards = extractComponentsGuards(enteringRecords, 'beforeRouteEnter', to, from, runWithContext);\n guards.push(canceledNavigationCheck);\n // run the queue of per route beforeEnter guards\n return runGuardQueue(guards);\n })\n .then(() => {\n // check global guards beforeResolve\n guards = [];\n for (const guard of beforeResolveGuards.list()) {\n guards.push(guardToPromiseFn(guard, to, from));\n }\n guards.push(canceledNavigationCheck);\n return runGuardQueue(guards);\n })\n // catch any navigation canceled\n .catch(err => isNavigationFailure(err, 8 /* ErrorTypes.NAVIGATION_CANCELLED */)\n ? err\n : Promise.reject(err)));\n }\n function triggerAfterEach(to, from, failure) {\n // navigation is confirmed, call afterGuards\n // TODO: wrap with error handlers\n afterGuards\n .list()\n .forEach(guard => runWithContext(() => guard(to, from, failure)));\n }\n /**\n * - Cleans up any navigation guards\n * - Changes the url if necessary\n * - Calls the scrollBehavior\n */\n function finalizeNavigation(toLocation, from, isPush, replace, data) {\n // a more recent navigation took place\n const error = checkCanceledNavigation(toLocation, from);\n if (error)\n return error;\n // only consider as push if it's not the first navigation\n const isFirstNavigation = from === START_LOCATION_NORMALIZED;\n const state = !isBrowser ? {} : history.state;\n // change URL only if the user did a push/replace and if it's not the initial navigation because\n // it's just reflecting the url\n if (isPush) {\n // on the initial navigation, we want to reuse the scroll position from\n // history state if it exists\n if (replace || isFirstNavigation)\n routerHistory.replace(toLocation.fullPath, assign({\n scroll: isFirstNavigation && state && state.scroll,\n }, data));\n else\n routerHistory.push(toLocation.fullPath, data);\n }\n // accept current navigation\n currentRoute.value = toLocation;\n handleScroll(toLocation, from, isPush, isFirstNavigation);\n markAsReady();\n }\n let removeHistoryListener;\n // attach listener to history to trigger navigations\n function setupListeners() {\n // avoid setting up listeners twice due to an invalid first navigation\n if (removeHistoryListener)\n return;\n removeHistoryListener = routerHistory.listen((to, _from, info) => {\n if (!router.listening)\n return;\n // cannot be a redirect route because it was in history\n const toLocation = resolve(to);\n // due to dynamic routing, and to hash history with manual navigation\n // (manually changing the url or calling history.hash = '#/somewhere'),\n // there could be a redirect record in history\n const shouldRedirect = handleRedirectRecord(toLocation);\n if (shouldRedirect) {\n pushWithRedirect(assign(shouldRedirect, { replace: true, force: true }), toLocation).catch(noop);\n return;\n }\n pendingLocation = toLocation;\n const from = currentRoute.value;\n // TODO: should be moved to web history?\n if (isBrowser) {\n saveScrollPosition(getScrollKey(from.fullPath, info.delta), computeScrollPosition());\n }\n navigate(toLocation, from)\n .catch((error) => {\n if (isNavigationFailure(error, 4 /* ErrorTypes.NAVIGATION_ABORTED */ | 8 /* ErrorTypes.NAVIGATION_CANCELLED */)) {\n return error;\n }\n if (isNavigationFailure(error, 2 /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */)) {\n // Here we could call if (info.delta) routerHistory.go(-info.delta,\n // false) but this is bug prone as we have no way to wait the\n // navigation to be finished before calling pushWithRedirect. Using\n // a setTimeout of 16ms seems to work but there is no guarantee for\n // it to work on every browser. So instead we do not restore the\n // history entry and trigger a new navigation as requested by the\n // navigation guard.\n // the error is already handled by router.push we just want to avoid\n // logging the error\n pushWithRedirect(assign(locationAsObject(error.to), {\n force: true,\n }), toLocation\n // avoid an uncaught rejection, let push call triggerError\n )\n .then(failure => {\n // manual change in hash history #916 ending up in the URL not\n // changing, but it was changed by the manual url change, so we\n // need to manually change it ourselves\n if (isNavigationFailure(failure, 4 /* ErrorTypes.NAVIGATION_ABORTED */ |\n 16 /* ErrorTypes.NAVIGATION_DUPLICATED */) &&\n !info.delta &&\n info.type === NavigationType.pop) {\n routerHistory.go(-1, false);\n }\n })\n .catch(noop);\n // avoid the then branch\n return Promise.reject();\n }\n // do not restore history on unknown direction\n if (info.delta) {\n routerHistory.go(-info.delta, false);\n }\n // unrecognized error, transfer to the global handler\n return triggerError(error, toLocation, from);\n })\n .then((failure) => {\n failure =\n failure ||\n finalizeNavigation(\n // after navigation, all matched components are resolved\n toLocation, from, false);\n // revert the navigation\n if (failure) {\n if (info.delta &&\n // a new navigation has been triggered, so we do not want to revert, that will change the current history\n // entry while a different route is displayed\n !isNavigationFailure(failure, 8 /* ErrorTypes.NAVIGATION_CANCELLED */)) {\n routerHistory.go(-info.delta, false);\n }\n else if (info.type === NavigationType.pop &&\n isNavigationFailure(failure, 4 /* ErrorTypes.NAVIGATION_ABORTED */ | 16 /* ErrorTypes.NAVIGATION_DUPLICATED */)) {\n // manual change in hash history #916\n // it's like a push but lacks the information of the direction\n routerHistory.go(-1, false);\n }\n }\n triggerAfterEach(toLocation, from, failure);\n })\n // avoid warnings in the console about uncaught rejections, they are logged by triggerErrors\n .catch(noop);\n });\n }\n // Initialization and Errors\n let readyHandlers = useCallbacks();\n let errorListeners = useCallbacks();\n let ready;\n /**\n * Trigger errorListeners added via onError and throws the error as well\n *\n * @param error - error to throw\n * @param to - location we were navigating to when the error happened\n * @param from - location we were navigating from when the error happened\n * @returns the error as a rejected promise\n */\n function triggerError(error, to, from) {\n markAsReady(error);\n const list = errorListeners.list();\n if (list.length) {\n list.forEach(handler => handler(error, to, from));\n }\n else {\n if ((process.env.NODE_ENV !== 'production')) {\n warn('uncaught error during route navigation:');\n }\n console.error(error);\n }\n // reject the error no matter there were error listeners or not\n return Promise.reject(error);\n }\n function isReady() {\n if (ready && currentRoute.value !== START_LOCATION_NORMALIZED)\n return Promise.resolve();\n return new Promise((resolve, reject) => {\n readyHandlers.add([resolve, reject]);\n });\n }\n function markAsReady(err) {\n if (!ready) {\n // still not ready if an error happened\n ready = !err;\n setupListeners();\n readyHandlers\n .list()\n .forEach(([resolve, reject]) => (err ? reject(err) : resolve()));\n readyHandlers.reset();\n }\n return err;\n }\n // Scroll behavior\n function handleScroll(to, from, isPush, isFirstNavigation) {\n const { scrollBehavior } = options;\n if (!isBrowser || !scrollBehavior)\n return Promise.resolve();\n const scrollPosition = (!isPush && getSavedScrollPosition(getScrollKey(to.fullPath, 0))) ||\n ((isFirstNavigation || !isPush) &&\n history.state &&\n history.state.scroll) ||\n null;\n return nextTick()\n .then(() => scrollBehavior(to, from, scrollPosition))\n .then(position => position && scrollToPosition(position))\n .catch(err => triggerError(err, to, from));\n }\n const go = (delta) => routerHistory.go(delta);\n let started;\n const installedApps = new Set();\n const router = {\n currentRoute,\n listening: true,\n addRoute,\n removeRoute,\n clearRoutes: matcher.clearRoutes,\n hasRoute,\n getRoutes,\n resolve,\n options,\n push,\n replace,\n go,\n back: () => go(-1),\n forward: () => go(1),\n beforeEach: beforeGuards.add,\n beforeResolve: beforeResolveGuards.add,\n afterEach: afterGuards.add,\n onError: errorListeners.add,\n isReady,\n install(app) {\n const router = this;\n app.component('RouterLink', RouterLink);\n app.component('RouterView', RouterView);\n app.config.globalProperties.$router = router;\n Object.defineProperty(app.config.globalProperties, '$route', {\n enumerable: true,\n get: () => unref(currentRoute),\n });\n // this initial navigation is only necessary on client, on server it doesn't\n // make sense because it will create an extra unnecessary navigation and could\n // lead to problems\n if (isBrowser &&\n // used for the initial navigation client side to avoid pushing\n // multiple times when the router is used in multiple apps\n !started &&\n currentRoute.value === START_LOCATION_NORMALIZED) {\n // see above\n started = true;\n push(routerHistory.location).catch(err => {\n if ((process.env.NODE_ENV !== 'production'))\n warn('Unexpected error when starting the router:', err);\n });\n }\n const reactiveRoute = {};\n for (const key in START_LOCATION_NORMALIZED) {\n Object.defineProperty(reactiveRoute, key, {\n get: () => currentRoute.value[key],\n enumerable: true,\n });\n }\n app.provide(routerKey, router);\n app.provide(routeLocationKey, shallowReactive(reactiveRoute));\n app.provide(routerViewLocationKey, currentRoute);\n const unmountApp = app.unmount;\n installedApps.add(app);\n app.unmount = function () {\n installedApps.delete(app);\n // the router is not attached to an app anymore\n if (installedApps.size < 1) {\n // invalidate the current navigation\n pendingLocation = START_LOCATION_NORMALIZED;\n removeHistoryListener && removeHistoryListener();\n removeHistoryListener = null;\n currentRoute.value = START_LOCATION_NORMALIZED;\n started = false;\n ready = false;\n }\n unmountApp();\n };\n // TODO: this probably needs to be updated so it can be used by vue-termui\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) && isBrowser) {\n addDevtools(app, router, matcher);\n }\n },\n };\n // TODO: type this as NavigationGuardReturn or similar instead of any\n function runGuardQueue(guards) {\n return guards.reduce((promise, guard) => promise.then(() => runWithContext(guard)), Promise.resolve());\n }\n return router;\n}\nfunction extractChangingRecords(to, from) {\n const leavingRecords = [];\n const updatingRecords = [];\n const enteringRecords = [];\n const len = Math.max(from.matched.length, to.matched.length);\n for (let i = 0; i < len; i++) {\n const recordFrom = from.matched[i];\n if (recordFrom) {\n if (to.matched.find(record => isSameRouteRecord(record, recordFrom)))\n updatingRecords.push(recordFrom);\n else\n leavingRecords.push(recordFrom);\n }\n const recordTo = to.matched[i];\n if (recordTo) {\n // the type doesn't matter because we are comparing per reference\n if (!from.matched.find(record => isSameRouteRecord(record, recordTo))) {\n enteringRecords.push(recordTo);\n }\n }\n }\n return [leavingRecords, updatingRecords, enteringRecords];\n}\n\n/**\n * Returns the router instance. Equivalent to using `$router` inside\n * templates.\n */\nfunction useRouter() {\n return inject(routerKey);\n}\n/**\n * Returns the current route location. Equivalent to using `$route` inside\n * templates.\n */\nfunction useRoute(_name) {\n return inject(routeLocationKey);\n}\n\nexport { NavigationFailureType, RouterLink, RouterView, START_LOCATION_NORMALIZED as START_LOCATION, createMemoryHistory, createRouter, createRouterMatcher, createWebHashHistory, createWebHistory, isNavigationFailure, loadRouteLocation, matchedRouteKey, onBeforeRouteLeave, onBeforeRouteUpdate, parseQuery, routeLocationKey, routerKey, routerViewLocationKey, stringifyQuery, useLink, useRoute, useRouter, viewDepthKey };\n","import { createRouter, createWebHistory } from 'vue-router'\n\nconst router = createRouter({\n\thistory: createWebHistory(),\n\troutes: [],\n})\n\nexport default router\n","/**\n * returns true if the given object is a promise\n */\nexport function isPromise(obj) {\n return obj && typeof obj.then === 'function';\n}\nexport var PROMISE_RESOLVED_FALSE = Promise.resolve(false);\nexport var PROMISE_RESOLVED_TRUE = Promise.resolve(true);\nexport var PROMISE_RESOLVED_VOID = Promise.resolve();\nexport function sleep(time, resolveWith) {\n if (!time) time = 0;\n return new Promise(function (res) {\n return setTimeout(function () {\n return res(resolveWith);\n }, time);\n });\n}\nexport function randomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\n\n/**\n * https://stackoverflow.com/a/8084248\n */\nexport function randomToken() {\n return Math.random().toString(36).substring(2);\n}\nvar lastMs = 0;\nvar additional = 0;\n\n/**\n * returns the current time in micro-seconds,\n * WARNING: This is a pseudo-function\n * Performance.now is not reliable in webworkers, so we just make sure to never return the same time.\n * This is enough in browsers, and this function will not be used in nodejs.\n * The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.\n */\nexport function microSeconds() {\n var ms = new Date().getTime();\n if (ms === lastMs) {\n additional++;\n return ms * 1000 + additional;\n } else {\n lastMs = ms;\n additional = 0;\n return ms * 1000;\n }\n}","import { microSeconds as micro, PROMISE_RESOLVED_VOID } from '../util.js';\nexport var microSeconds = micro;\nexport var type = 'native';\nexport function create(channelName) {\n var state = {\n messagesCallback: null,\n bc: new BroadcastChannel(channelName),\n subFns: [] // subscriberFunctions\n };\n\n state.bc.onmessage = function (msg) {\n if (state.messagesCallback) {\n state.messagesCallback(msg.data);\n }\n };\n return state;\n}\nexport function close(channelState) {\n channelState.bc.close();\n channelState.subFns = [];\n}\nexport function postMessage(channelState, messageJson) {\n try {\n channelState.bc.postMessage(messageJson, false);\n return PROMISE_RESOLVED_VOID;\n } catch (err) {\n return Promise.reject(err);\n }\n}\nexport function onMessage(channelState, fn) {\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n if (typeof window === 'undefined') {\n return false;\n }\n if (typeof BroadcastChannel === 'function') {\n if (BroadcastChannel._pubkey) {\n throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');\n }\n return true;\n } else {\n return false;\n }\n}\nexport function averageResponseTime() {\n return 150;\n}\nexport var NativeMethod = {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};","/**\n * this is a set which automatically forgets\n * a given entry when a new entry is set and the ttl\n * of the old one is over\n */\nvar ObliviousSet = /** @class */ (function () {\n function ObliviousSet(ttl) {\n this.ttl = ttl;\n this.map = new Map();\n /**\n * Creating calls to setTimeout() is expensive,\n * so we only do that if there is not timeout already open.\n */\n this._to = false;\n }\n ObliviousSet.prototype.has = function (value) {\n return this.map.has(value);\n };\n ObliviousSet.prototype.add = function (value) {\n var _this = this;\n this.map.set(value, now());\n /**\n * When a new value is added,\n * start the cleanup at the next tick\n * to not block the cpu for more important stuff\n * that might happen.\n */\n if (!this._to) {\n this._to = true;\n setTimeout(function () {\n _this._to = false;\n removeTooOldValues(_this);\n }, 0);\n }\n };\n ObliviousSet.prototype.clear = function () {\n this.map.clear();\n };\n return ObliviousSet;\n}());\nexport { ObliviousSet };\n/**\n * Removes all entries from the set\n * where the TTL has expired\n */\nexport function removeTooOldValues(obliviousSet) {\n var olderThen = now() - obliviousSet.ttl;\n var iterator = obliviousSet.map[Symbol.iterator]();\n /**\n * Because we can assume the new values are added at the bottom,\n * we start from the top and stop as soon as we reach a non-too-old value.\n */\n while (true) {\n var next = iterator.next().value;\n if (!next) {\n return; // no more elements\n }\n var value = next[0];\n var time = next[1];\n if (time < olderThen) {\n obliviousSet.map.delete(value);\n }\n else {\n // We reached a value that is not old enough\n return;\n }\n }\n}\nexport function now() {\n return new Date().getTime();\n}\n//# sourceMappingURL=index.js.map","export function fillOptionsWithDefaults() {\n var originalOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = JSON.parse(JSON.stringify(originalOptions));\n\n // main\n if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true;\n\n // indexed-db\n if (!options.idb) options.idb = {};\n // after this time the messages get deleted\n if (!options.idb.ttl) options.idb.ttl = 1000 * 45;\n if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 150;\n // handles abrupt db onclose events.\n if (originalOptions.idb && typeof originalOptions.idb.onclose === 'function') options.idb.onclose = originalOptions.idb.onclose;\n\n // localstorage\n if (!options.localstorage) options.localstorage = {};\n if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60;\n\n // custom methods\n if (originalOptions.methods) options.methods = originalOptions.methods;\n\n // node\n if (!options.node) options.node = {};\n if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes;\n /**\n * On linux use 'ulimit -Hn' to get the limit of open files.\n * On ubuntu this was 4096 for me, so we use half of that as maxParallelWrites default.\n */\n if (!options.node.maxParallelWrites) options.node.maxParallelWrites = 2048;\n if (typeof options.node.useFastPath === 'undefined') options.node.useFastPath = true;\n return options;\n}","/**\n * this method uses indexeddb to store the messages\n * There is currently no observerAPI for idb\n * @link https://github.com/w3c/IndexedDB/issues/51\n * \n * When working on this, ensure to use these performance optimizations:\n * @link https://rxdb.info/slow-indexeddb.html\n */\n\nimport { sleep, randomInt, randomToken, microSeconds as micro, PROMISE_RESOLVED_VOID } from '../util.js';\nexport var microSeconds = micro;\nimport { ObliviousSet } from 'oblivious-set';\nimport { fillOptionsWithDefaults } from '../options.js';\nvar DB_PREFIX = 'pubkey.broadcast-channel-0-';\nvar OBJECT_STORE_ID = 'messages';\n\n/**\n * Use relaxed durability for faster performance on all transactions.\n * @link https://nolanlawson.com/2021/08/22/speeding-up-indexeddb-reads-and-writes/\n */\nexport var TRANSACTION_SETTINGS = {\n durability: 'relaxed'\n};\nexport var type = 'idb';\nexport function getIdb() {\n if (typeof indexedDB !== 'undefined') return indexedDB;\n if (typeof window !== 'undefined') {\n if (typeof window.mozIndexedDB !== 'undefined') return window.mozIndexedDB;\n if (typeof window.webkitIndexedDB !== 'undefined') return window.webkitIndexedDB;\n if (typeof window.msIndexedDB !== 'undefined') return window.msIndexedDB;\n }\n return false;\n}\n\n/**\n * If possible, we should explicitly commit IndexedDB transactions\n * for better performance.\n * @link https://nolanlawson.com/2021/08/22/speeding-up-indexeddb-reads-and-writes/\n */\nexport function commitIndexedDBTransaction(tx) {\n if (tx.commit) {\n tx.commit();\n }\n}\nexport function createDatabase(channelName) {\n var IndexedDB = getIdb();\n\n // create table\n var dbName = DB_PREFIX + channelName;\n\n /**\n * All IndexedDB databases are opened without version\n * because it is a bit faster, especially on firefox\n * @link http://nparashuram.com/IndexedDB/perf/#Open%20Database%20with%20version\n */\n var openRequest = IndexedDB.open(dbName);\n openRequest.onupgradeneeded = function (ev) {\n var db = ev.target.result;\n db.createObjectStore(OBJECT_STORE_ID, {\n keyPath: 'id',\n autoIncrement: true\n });\n };\n return new Promise(function (res, rej) {\n openRequest.onerror = function (ev) {\n return rej(ev);\n };\n openRequest.onsuccess = function () {\n res(openRequest.result);\n };\n });\n}\n\n/**\n * writes the new message to the database\n * so other readers can find it\n */\nexport function writeMessage(db, readerUuid, messageJson) {\n var time = new Date().getTime();\n var writeObject = {\n uuid: readerUuid,\n time: time,\n data: messageJson\n };\n var tx = db.transaction([OBJECT_STORE_ID], 'readwrite', TRANSACTION_SETTINGS);\n return new Promise(function (res, rej) {\n tx.oncomplete = function () {\n return res();\n };\n tx.onerror = function (ev) {\n return rej(ev);\n };\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n objectStore.add(writeObject);\n commitIndexedDBTransaction(tx);\n });\n}\nexport function getAllMessages(db) {\n var tx = db.transaction(OBJECT_STORE_ID, 'readonly', TRANSACTION_SETTINGS);\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n var ret = [];\n return new Promise(function (res) {\n objectStore.openCursor().onsuccess = function (ev) {\n var cursor = ev.target.result;\n if (cursor) {\n ret.push(cursor.value);\n //alert(\"Name for SSN \" + cursor.key + \" is \" + cursor.value.name);\n cursor[\"continue\"]();\n } else {\n commitIndexedDBTransaction(tx);\n res(ret);\n }\n };\n });\n}\nexport function getMessagesHigherThan(db, lastCursorId) {\n var tx = db.transaction(OBJECT_STORE_ID, 'readonly', TRANSACTION_SETTINGS);\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n var ret = [];\n var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity);\n\n /**\n * Optimization shortcut,\n * if getAll() can be used, do not use a cursor.\n * @link https://rxdb.info/slow-indexeddb.html\n */\n if (objectStore.getAll) {\n var getAllRequest = objectStore.getAll(keyRangeValue);\n return new Promise(function (res, rej) {\n getAllRequest.onerror = function (err) {\n return rej(err);\n };\n getAllRequest.onsuccess = function (e) {\n res(e.target.result);\n };\n });\n }\n function openCursor() {\n // Occasionally Safari will fail on IDBKeyRange.bound, this\n // catches that error, having it open the cursor to the first\n // item. When it gets data it will advance to the desired key.\n try {\n keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity);\n return objectStore.openCursor(keyRangeValue);\n } catch (e) {\n return objectStore.openCursor();\n }\n }\n return new Promise(function (res, rej) {\n var openCursorRequest = openCursor();\n openCursorRequest.onerror = function (err) {\n return rej(err);\n };\n openCursorRequest.onsuccess = function (ev) {\n var cursor = ev.target.result;\n if (cursor) {\n if (cursor.value.id < lastCursorId + 1) {\n cursor[\"continue\"](lastCursorId + 1);\n } else {\n ret.push(cursor.value);\n cursor[\"continue\"]();\n }\n } else {\n commitIndexedDBTransaction(tx);\n res(ret);\n }\n };\n });\n}\nexport function removeMessagesById(channelState, ids) {\n if (channelState.closed) {\n return Promise.resolve([]);\n }\n var tx = channelState.db.transaction(OBJECT_STORE_ID, 'readwrite', TRANSACTION_SETTINGS);\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n return Promise.all(ids.map(function (id) {\n var deleteRequest = objectStore[\"delete\"](id);\n return new Promise(function (res) {\n deleteRequest.onsuccess = function () {\n return res();\n };\n });\n }));\n}\nexport function getOldMessages(db, ttl) {\n var olderThen = new Date().getTime() - ttl;\n var tx = db.transaction(OBJECT_STORE_ID, 'readonly', TRANSACTION_SETTINGS);\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n var ret = [];\n return new Promise(function (res) {\n objectStore.openCursor().onsuccess = function (ev) {\n var cursor = ev.target.result;\n if (cursor) {\n var msgObk = cursor.value;\n if (msgObk.time < olderThen) {\n ret.push(msgObk);\n //alert(\"Name for SSN \" + cursor.key + \" is \" + cursor.value.name);\n cursor[\"continue\"]();\n } else {\n // no more old messages,\n commitIndexedDBTransaction(tx);\n res(ret);\n }\n } else {\n res(ret);\n }\n };\n });\n}\nexport function cleanOldMessages(channelState) {\n return getOldMessages(channelState.db, channelState.options.idb.ttl).then(function (tooOld) {\n return removeMessagesById(channelState, tooOld.map(function (msg) {\n return msg.id;\n }));\n });\n}\nexport function create(channelName, options) {\n options = fillOptionsWithDefaults(options);\n return createDatabase(channelName).then(function (db) {\n var state = {\n closed: false,\n lastCursorId: 0,\n channelName: channelName,\n options: options,\n uuid: randomToken(),\n /**\n * emittedMessagesIds\n * contains all messages that have been emitted before\n * @type {ObliviousSet}\n */\n eMIs: new ObliviousSet(options.idb.ttl * 2),\n // ensures we do not read messages in parallel\n writeBlockPromise: PROMISE_RESOLVED_VOID,\n messagesCallback: null,\n readQueuePromises: [],\n db: db\n };\n\n /**\n * Handle abrupt closes that do not originate from db.close().\n * This could happen, for example, if the underlying storage is\n * removed or if the user clears the database in the browser's\n * history preferences.\n */\n db.onclose = function () {\n state.closed = true;\n if (options.idb.onclose) options.idb.onclose();\n };\n\n /**\n * if service-workers are used,\n * we have no 'storage'-event if they post a message,\n * therefore we also have to set an interval\n */\n _readLoop(state);\n return state;\n });\n}\nfunction _readLoop(state) {\n if (state.closed) return;\n readNewMessages(state).then(function () {\n return sleep(state.options.idb.fallbackInterval);\n }).then(function () {\n return _readLoop(state);\n });\n}\nfunction _filterMessage(msgObj, state) {\n if (msgObj.uuid === state.uuid) return false; // send by own\n if (state.eMIs.has(msgObj.id)) return false; // already emitted\n if (msgObj.data.time < state.messagesCallbackTime) return false; // older then onMessageCallback\n return true;\n}\n\n/**\n * reads all new messages from the database and emits them\n */\nfunction readNewMessages(state) {\n // channel already closed\n if (state.closed) return PROMISE_RESOLVED_VOID;\n\n // if no one is listening, we do not need to scan for new messages\n if (!state.messagesCallback) return PROMISE_RESOLVED_VOID;\n return getMessagesHigherThan(state.db, state.lastCursorId).then(function (newerMessages) {\n var useMessages = newerMessages\n /**\n * there is a bug in iOS where the msgObj can be undefined sometimes\n * so we filter them out\n * @link https://github.com/pubkey/broadcast-channel/issues/19\n */.filter(function (msgObj) {\n return !!msgObj;\n }).map(function (msgObj) {\n if (msgObj.id > state.lastCursorId) {\n state.lastCursorId = msgObj.id;\n }\n return msgObj;\n }).filter(function (msgObj) {\n return _filterMessage(msgObj, state);\n }).sort(function (msgObjA, msgObjB) {\n return msgObjA.time - msgObjB.time;\n }); // sort by time\n useMessages.forEach(function (msgObj) {\n if (state.messagesCallback) {\n state.eMIs.add(msgObj.id);\n state.messagesCallback(msgObj.data);\n }\n });\n return PROMISE_RESOLVED_VOID;\n });\n}\nexport function close(channelState) {\n channelState.closed = true;\n channelState.db.close();\n}\nexport function postMessage(channelState, messageJson) {\n channelState.writeBlockPromise = channelState.writeBlockPromise.then(function () {\n return writeMessage(channelState.db, channelState.uuid, messageJson);\n }).then(function () {\n if (randomInt(0, 10) === 0) {\n /* await (do not await) */\n cleanOldMessages(channelState);\n }\n });\n return channelState.writeBlockPromise;\n}\nexport function onMessage(channelState, fn, time) {\n channelState.messagesCallbackTime = time;\n channelState.messagesCallback = fn;\n readNewMessages(channelState);\n}\nexport function canBeUsed() {\n return !!getIdb();\n}\nexport function averageResponseTime(options) {\n return options.idb.fallbackInterval * 2;\n}\nexport var IndexedDBMethod = {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};","/**\n * A localStorage-only method which uses localstorage and its 'storage'-event\n * This does not work inside webworkers because they have no access to localstorage\n * This is basically implemented to support IE9 or your grandmother's toaster.\n * @link https://caniuse.com/#feat=namevalue-storage\n * @link https://caniuse.com/#feat=indexeddb\n */\n\nimport { ObliviousSet } from 'oblivious-set';\nimport { fillOptionsWithDefaults } from '../options.js';\nimport { sleep, randomToken, microSeconds as micro } from '../util.js';\nexport var microSeconds = micro;\nvar KEY_PREFIX = 'pubkey.broadcastChannel-';\nexport var type = 'localstorage';\n\n/**\n * copied from crosstab\n * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32\n */\nexport function getLocalStorage() {\n var localStorage;\n if (typeof window === 'undefined') return null;\n try {\n localStorage = window.localStorage;\n localStorage = window['ie8-eventlistener/storage'] || window.localStorage;\n } catch (e) {\n // New versions of Firefox throw a Security exception\n // if cookies are disabled. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153\n }\n return localStorage;\n}\nexport function storageKey(channelName) {\n return KEY_PREFIX + channelName;\n}\n\n/**\n* writes the new message to the storage\n* and fires the storage-event so other readers can find it\n*/\nexport function postMessage(channelState, messageJson) {\n return new Promise(function (res) {\n sleep().then(function () {\n var key = storageKey(channelState.channelName);\n var writeObj = {\n token: randomToken(),\n time: new Date().getTime(),\n data: messageJson,\n uuid: channelState.uuid\n };\n var value = JSON.stringify(writeObj);\n getLocalStorage().setItem(key, value);\n\n /**\n * StorageEvent does not fire the 'storage' event\n * in the window that changes the state of the local storage.\n * So we fire it manually\n */\n var ev = document.createEvent('Event');\n ev.initEvent('storage', true, true);\n ev.key = key;\n ev.newValue = value;\n window.dispatchEvent(ev);\n res();\n });\n });\n}\nexport function addStorageEventListener(channelName, fn) {\n var key = storageKey(channelName);\n var listener = function listener(ev) {\n if (ev.key === key) {\n fn(JSON.parse(ev.newValue));\n }\n };\n window.addEventListener('storage', listener);\n return listener;\n}\nexport function removeStorageEventListener(listener) {\n window.removeEventListener('storage', listener);\n}\nexport function create(channelName, options) {\n options = fillOptionsWithDefaults(options);\n if (!canBeUsed()) {\n throw new Error('BroadcastChannel: localstorage cannot be used');\n }\n var uuid = randomToken();\n\n /**\n * eMIs\n * contains all messages that have been emitted before\n * @type {ObliviousSet}\n */\n var eMIs = new ObliviousSet(options.localstorage.removeTimeout);\n var state = {\n channelName: channelName,\n uuid: uuid,\n eMIs: eMIs // emittedMessagesIds\n };\n\n state.listener = addStorageEventListener(channelName, function (msgObj) {\n if (!state.messagesCallback) return; // no listener\n if (msgObj.uuid === uuid) return; // own message\n if (!msgObj.token || eMIs.has(msgObj.token)) return; // already emitted\n if (msgObj.data.time && msgObj.data.time < state.messagesCallbackTime) return; // too old\n\n eMIs.add(msgObj.token);\n state.messagesCallback(msgObj.data);\n });\n return state;\n}\nexport function close(channelState) {\n removeStorageEventListener(channelState.listener);\n}\nexport function onMessage(channelState, fn, time) {\n channelState.messagesCallbackTime = time;\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n var ls = getLocalStorage();\n if (!ls) return false;\n try {\n var key = '__broadcastchannel_check';\n ls.setItem(key, 'works');\n ls.removeItem(key);\n } catch (e) {\n // Safari 10 in private mode will not allow write access to local\n // storage and fail with a QuotaExceededError. See\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API#Private_Browsing_Incognito_modes\n return false;\n }\n return true;\n}\nexport function averageResponseTime() {\n var defaultTime = 120;\n var userAgent = navigator.userAgent.toLowerCase();\n if (userAgent.includes('safari') && !userAgent.includes('chrome')) {\n // safari is much slower so this time is higher\n return defaultTime * 2;\n }\n return defaultTime;\n}\nexport var LocalstorageMethod = {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};","import { microSeconds as micro } from '../util.js';\nexport var microSeconds = micro;\nexport var type = 'simulate';\nvar SIMULATE_CHANNELS = new Set();\nexport function create(channelName) {\n var state = {\n name: channelName,\n messagesCallback: null\n };\n SIMULATE_CHANNELS.add(state);\n return state;\n}\nexport function close(channelState) {\n SIMULATE_CHANNELS[\"delete\"](channelState);\n}\nexport function postMessage(channelState, messageJson) {\n return new Promise(function (res) {\n return setTimeout(function () {\n var channelArray = Array.from(SIMULATE_CHANNELS);\n channelArray.filter(function (channel) {\n return channel.name === channelState.name;\n }).filter(function (channel) {\n return channel !== channelState;\n }).filter(function (channel) {\n return !!channel.messagesCallback;\n }).forEach(function (channel) {\n return channel.messagesCallback(messageJson);\n });\n res();\n }, 5);\n });\n}\nexport function onMessage(channelState, fn) {\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n return true;\n}\nexport function averageResponseTime() {\n return 5;\n}\nexport var SimulateMethod = {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};","import { NativeMethod } from './methods/native.js';\nimport { IndexedDBMethod } from './methods/indexed-db.js';\nimport { LocalstorageMethod } from './methods/localstorage.js';\nimport { SimulateMethod } from './methods/simulate.js';\n// the line below will be removed from es5/browser builds\n\n// order is important\nvar METHODS = [NativeMethod,\n// fastest\nIndexedDBMethod, LocalstorageMethod];\nexport function chooseMethod(options) {\n var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean);\n\n // the line below will be removed from es5/browser builds\n\n // directly chosen\n if (options.type) {\n if (options.type === 'simulate') {\n // only use simulate-method if directly chosen\n return SimulateMethod;\n }\n var ret = chooseMethods.find(function (m) {\n return m.type === options.type;\n });\n if (!ret) throw new Error('method-type ' + options.type + ' not found');else return ret;\n }\n\n /**\n * if no webworker support is needed,\n * remove idb from the list so that localstorage will be chosen\n */\n if (!options.webWorkerSupport) {\n chooseMethods = chooseMethods.filter(function (m) {\n return m.type !== 'idb';\n });\n }\n var useMethod = chooseMethods.find(function (method) {\n return method.canBeUsed();\n });\n if (!useMethod) throw new Error(\"No usable method found in \" + JSON.stringify(METHODS.map(function (m) {\n return m.type;\n })));else return useMethod;\n}","import { isPromise, PROMISE_RESOLVED_FALSE, PROMISE_RESOLVED_VOID } from './util.js';\nimport { chooseMethod } from './method-chooser.js';\nimport { fillOptionsWithDefaults } from './options.js';\n\n/**\n * Contains all open channels,\n * used in tests to ensure everything is closed.\n */\nexport var OPEN_BROADCAST_CHANNELS = new Set();\nvar lastId = 0;\nexport var BroadcastChannel = function BroadcastChannel(name, options) {\n // identifier of the channel to debug stuff\n this.id = lastId++;\n OPEN_BROADCAST_CHANNELS.add(this);\n this.name = name;\n if (ENFORCED_OPTIONS) {\n options = ENFORCED_OPTIONS;\n }\n this.options = fillOptionsWithDefaults(options);\n this.method = chooseMethod(this.options);\n\n // isListening\n this._iL = false;\n\n /**\n * _onMessageListener\n * setting onmessage twice,\n * will overwrite the first listener\n */\n this._onML = null;\n\n /**\n * _addEventListeners\n */\n this._addEL = {\n message: [],\n internal: []\n };\n\n /**\n * Unsent message promises\n * where the sending is still in progress\n * @type {Set<Promise>}\n */\n this._uMP = new Set();\n\n /**\n * _beforeClose\n * array of promises that will be awaited\n * before the channel is closed\n */\n this._befC = [];\n\n /**\n * _preparePromise\n */\n this._prepP = null;\n _prepareChannel(this);\n};\n\n// STATICS\n\n/**\n * used to identify if someone overwrites\n * window.BroadcastChannel with this\n * See methods/native.js\n */\nBroadcastChannel._pubkey = true;\n\n/**\n * clears the tmp-folder if is node\n * @return {Promise<boolean>} true if has run, false if not node\n */\nexport function clearNodeFolder(options) {\n options = fillOptionsWithDefaults(options);\n var method = chooseMethod(options);\n if (method.type === 'node') {\n return method.clearNodeFolder().then(function () {\n return true;\n });\n } else {\n return PROMISE_RESOLVED_FALSE;\n }\n}\n\n/**\n * if set, this method is enforced,\n * no mather what the options are\n */\nvar ENFORCED_OPTIONS;\nexport function enforceOptions(options) {\n ENFORCED_OPTIONS = options;\n}\n\n// PROTOTYPE\nBroadcastChannel.prototype = {\n postMessage: function postMessage(msg) {\n if (this.closed) {\n throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +\n /**\n * In the past when this error appeared, it was really hard to debug.\n * So now we log the msg together with the error so it at least\n * gives some clue about where in your application this happens.\n */\n JSON.stringify(msg));\n }\n return _post(this, 'message', msg);\n },\n postInternal: function postInternal(msg) {\n return _post(this, 'internal', msg);\n },\n set onmessage(fn) {\n var time = this.method.microSeconds();\n var listenObj = {\n time: time,\n fn: fn\n };\n _removeListenerObject(this, 'message', this._onML);\n if (fn && typeof fn === 'function') {\n this._onML = listenObj;\n _addListenerObject(this, 'message', listenObj);\n } else {\n this._onML = null;\n }\n },\n addEventListener: function addEventListener(type, fn) {\n var time = this.method.microSeconds();\n var listenObj = {\n time: time,\n fn: fn\n };\n _addListenerObject(this, type, listenObj);\n },\n removeEventListener: function removeEventListener(type, fn) {\n var obj = this._addEL[type].find(function (obj) {\n return obj.fn === fn;\n });\n _removeListenerObject(this, type, obj);\n },\n close: function close() {\n var _this = this;\n if (this.closed) {\n return;\n }\n OPEN_BROADCAST_CHANNELS[\"delete\"](this);\n this.closed = true;\n var awaitPrepare = this._prepP ? this._prepP : PROMISE_RESOLVED_VOID;\n this._onML = null;\n this._addEL.message = [];\n return awaitPrepare\n // wait until all current sending are processed\n .then(function () {\n return Promise.all(Array.from(_this._uMP));\n })\n // run before-close hooks\n .then(function () {\n return Promise.all(_this._befC.map(function (fn) {\n return fn();\n }));\n })\n // close the channel\n .then(function () {\n return _this.method.close(_this._state);\n });\n },\n get type() {\n return this.method.type;\n },\n get isClosed() {\n return this.closed;\n }\n};\n\n/**\n * Post a message over the channel\n * @returns {Promise} that resolved when the message sending is done\n */\nfunction _post(broadcastChannel, type, msg) {\n var time = broadcastChannel.method.microSeconds();\n var msgObj = {\n time: time,\n type: type,\n data: msg\n };\n var awaitPrepare = broadcastChannel._prepP ? broadcastChannel._prepP : PROMISE_RESOLVED_VOID;\n return awaitPrepare.then(function () {\n var sendPromise = broadcastChannel.method.postMessage(broadcastChannel._state, msgObj);\n\n // add/remove to unsent messages list\n broadcastChannel._uMP.add(sendPromise);\n sendPromise[\"catch\"]().then(function () {\n return broadcastChannel._uMP[\"delete\"](sendPromise);\n });\n return sendPromise;\n });\n}\nfunction _prepareChannel(channel) {\n var maybePromise = channel.method.create(channel.name, channel.options);\n if (isPromise(maybePromise)) {\n channel._prepP = maybePromise;\n maybePromise.then(function (s) {\n // used in tests to simulate slow runtime\n /*if (channel.options.prepareDelay) {\n await new Promise(res => setTimeout(res, this.options.prepareDelay));\n }*/\n channel._state = s;\n });\n } else {\n channel._state = maybePromise;\n }\n}\nfunction _hasMessageListeners(channel) {\n if (channel._addEL.message.length > 0) return true;\n if (channel._addEL.internal.length > 0) return true;\n return false;\n}\nfunction _addListenerObject(channel, type, obj) {\n channel._addEL[type].push(obj);\n _startListening(channel);\n}\nfunction _removeListenerObject(channel, type, obj) {\n channel._addEL[type] = channel._addEL[type].filter(function (o) {\n return o !== obj;\n });\n _stopListening(channel);\n}\nfunction _startListening(channel) {\n if (!channel._iL && _hasMessageListeners(channel)) {\n // someone is listening, start subscribing\n\n var listenerFn = function listenerFn(msgObj) {\n channel._addEL[msgObj.type].forEach(function (listenerObject) {\n /**\n * Getting the current time in JavaScript has no good precision.\n * So instead of only listening to events that happened 'after' the listener\n * was added, we also listen to events that happened 100ms before it.\n * This ensures that when another process, like a WebWorker, sends events\n * we do not miss them out because their timestamp is a bit off compared to the main process.\n * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.\n * @link https://johnresig.com/blog/accuracy-of-javascript-time/\n */\n var hundredMsInMicro = 100 * 1000;\n var minMessageTime = listenerObject.time - hundredMsInMicro;\n if (msgObj.time >= minMessageTime) {\n listenerObject.fn(msgObj.data);\n }\n });\n };\n var time = channel.method.microSeconds();\n if (channel._prepP) {\n channel._prepP.then(function () {\n channel._iL = true;\n channel.method.onMessage(channel._state, listenerFn, time);\n });\n } else {\n channel._iL = true;\n channel.method.onMessage(channel._state, listenerFn, time);\n }\n }\n}\nfunction _stopListening(channel) {\n if (channel._iL && !_hasMessageListeners(channel)) {\n // no one is listening, stop subscribing\n channel._iL = false;\n var time = channel.method.microSeconds();\n channel.method.onMessage(channel._state, null, time);\n }\n}","/** @type {Record<string, string>} */\nexport const escaped = {\n\t'<': '\\\\u003C',\n\t'\\\\': '\\\\\\\\',\n\t'\\b': '\\\\b',\n\t'\\f': '\\\\f',\n\t'\\n': '\\\\n',\n\t'\\r': '\\\\r',\n\t'\\t': '\\\\t',\n\t'\\u2028': '\\\\u2028',\n\t'\\u2029': '\\\\u2029'\n};\n\nexport class DevalueError extends Error {\n\t/**\n\t * @param {string} message\n\t * @param {string[]} keys\n\t */\n\tconstructor(message, keys) {\n\t\tsuper(message);\n\t\tthis.name = 'DevalueError';\n\t\tthis.path = keys.join('');\n\t}\n}\n\n/** @param {any} thing */\nexport function is_primitive(thing) {\n\treturn Object(thing) !== thing;\n}\n\nconst object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(\n\tObject.prototype\n)\n\t.sort()\n\t.join('\\0');\n\n/** @param {any} thing */\nexport function is_plain_object(thing) {\n\tconst proto = Object.getPrototypeOf(thing);\n\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getOwnPropertyNames(proto).sort().join('\\0') === object_proto_names\n\t);\n}\n\n/** @param {any} thing */\nexport function get_type(thing) {\n\treturn Object.prototype.toString.call(thing).slice(8, -1);\n}\n\n/** @param {string} char */\nfunction get_escaped_char(char) {\n\tswitch (char) {\n\t\tcase '\"':\n\t\t\treturn '\\\\\"';\n\t\tcase '<':\n\t\t\treturn '\\\\u003C';\n\t\tcase '\\\\':\n\t\t\treturn '\\\\\\\\';\n\t\tcase '\\n':\n\t\t\treturn '\\\\n';\n\t\tcase '\\r':\n\t\t\treturn '\\\\r';\n\t\tcase '\\t':\n\t\t\treturn '\\\\t';\n\t\tcase '\\b':\n\t\t\treturn '\\\\b';\n\t\tcase '\\f':\n\t\t\treturn '\\\\f';\n\t\tcase '\\u2028':\n\t\t\treturn '\\\\u2028';\n\t\tcase '\\u2029':\n\t\t\treturn '\\\\u2029';\n\t\tdefault:\n\t\t\treturn char < ' '\n\t\t\t\t? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`\n\t\t\t\t: '';\n\t}\n}\n\n/** @param {string} str */\nexport function stringify_string(str) {\n\tlet result = '';\n\tlet last_pos = 0;\n\tconst len = str.length;\n\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst char = str[i];\n\t\tconst replacement = get_escaped_char(char);\n\t\tif (replacement) {\n\t\t\tresult += str.slice(last_pos, i) + replacement;\n\t\t\tlast_pos = i + 1;\n\t\t}\n\t}\n\n\treturn `\"${last_pos === 0 ? str : result + str.slice(last_pos)}\"`;\n}\n","export const UNDEFINED = -1;\nexport const HOLE = -2;\nexport const NAN = -3;\nexport const POSITIVE_INFINITY = -4;\nexport const NEGATIVE_INFINITY = -5;\nexport const NEGATIVE_ZERO = -6;\n","import {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Revive a value serialized with `devalue.stringify`\n * @param {string} serialized\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function parse(serialized, revivers) {\n\treturn unflatten(JSON.parse(serialized), revivers);\n}\n\n/**\n * Revive a value flattened with `devalue.stringify`\n * @param {number | any[]} parsed\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function unflatten(parsed, revivers) {\n\tif (typeof parsed === 'number') return hydrate(parsed, true);\n\n\tif (!Array.isArray(parsed) || parsed.length === 0) {\n\t\tthrow new Error('Invalid input');\n\t}\n\n\tconst values = /** @type {any[]} */ (parsed);\n\n\tconst hydrated = Array(values.length);\n\n\t/**\n\t * @param {number} index\n\t * @returns {any}\n\t */\n\tfunction hydrate(index, standalone = false) {\n\t\tif (index === UNDEFINED) return undefined;\n\t\tif (index === NAN) return NaN;\n\t\tif (index === POSITIVE_INFINITY) return Infinity;\n\t\tif (index === NEGATIVE_INFINITY) return -Infinity;\n\t\tif (index === NEGATIVE_ZERO) return -0;\n\n\t\tif (standalone) throw new Error(`Invalid input`);\n\n\t\tif (index in hydrated) return hydrated[index];\n\n\t\tconst value = values[index];\n\n\t\tif (!value || typeof value !== 'object') {\n\t\t\thydrated[index] = value;\n\t\t} else if (Array.isArray(value)) {\n\t\t\tif (typeof value[0] === 'string') {\n\t\t\t\tconst type = value[0];\n\n\t\t\t\tconst reviver = revivers?.[type];\n\t\t\t\tif (reviver) {\n\t\t\t\t\treturn (hydrated[index] = reviver(hydrate(value[1])));\n\t\t\t\t}\n\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase 'Date':\n\t\t\t\t\t\thydrated[index] = new Date(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Set':\n\t\t\t\t\t\tconst set = new Set();\n\t\t\t\t\t\thydrated[index] = set;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 1) {\n\t\t\t\t\t\t\tset.add(hydrate(value[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Map':\n\t\t\t\t\t\tconst map = new Map();\n\t\t\t\t\t\thydrated[index] = map;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tmap.set(hydrate(value[i]), hydrate(value[i + 1]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'RegExp':\n\t\t\t\t\t\thydrated[index] = new RegExp(value[1], value[2]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Object':\n\t\t\t\t\t\thydrated[index] = Object(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'BigInt':\n\t\t\t\t\t\thydrated[index] = BigInt(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'null':\n\t\t\t\t\t\tconst obj = Object.create(null);\n\t\t\t\t\t\thydrated[index] = obj;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tobj[value[i]] = hydrate(value[i + 1]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error(`Unknown type ${type}`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst array = new Array(value.length);\n\t\t\t\thydrated[index] = array;\n\n\t\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\t\tconst n = value[i];\n\t\t\t\t\tif (n === HOLE) continue;\n\n\t\t\t\t\tarray[i] = hydrate(n);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t/** @type {Record<string, any>} */\n\t\t\tconst object = {};\n\t\t\thydrated[index] = object;\n\n\t\t\tfor (const key in value) {\n\t\t\t\tconst n = value[key];\n\t\t\t\tobject[key] = hydrate(n);\n\t\t\t}\n\t\t}\n\n\t\treturn hydrated[index];\n\t}\n\n\treturn hydrate(0);\n}\n","import {\n\tDevalueError,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_string\n} from './utils.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Turn a value into a JSON string that can be parsed with `devalue.parse`\n * @param {any} value\n * @param {Record<string, (value: any) => any>} [reducers]\n */\nexport function stringify(value, reducers) {\n\t/** @type {any[]} */\n\tconst stringified = [];\n\n\t/** @type {Map<any, number>} */\n\tconst indexes = new Map();\n\n\t/** @type {Array<{ key: string, fn: (value: any) => any }>} */\n\tconst custom = [];\n\tfor (const key in reducers) {\n\t\tcustom.push({ key, fn: reducers[key] });\n\t}\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tlet p = 0;\n\n\t/** @param {any} thing */\n\tfunction flatten(thing) {\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys);\n\t\t}\n\n\t\tif (indexes.has(thing)) return indexes.get(thing);\n\n\t\tif (thing === undefined) return UNDEFINED;\n\t\tif (Number.isNaN(thing)) return NAN;\n\t\tif (thing === Infinity) return POSITIVE_INFINITY;\n\t\tif (thing === -Infinity) return NEGATIVE_INFINITY;\n\t\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;\n\n\t\tconst index = p++;\n\t\tindexes.set(thing, index);\n\n\t\tfor (const { key, fn } of custom) {\n\t\t\tconst value = fn(thing);\n\t\t\tif (value) {\n\t\t\t\tstringified[index] = `[\"${key}\",${flatten(value)}]`;\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\tlet str = '';\n\n\t\tif (is_primitive(thing)) {\n\t\t\tstr = stringify_primitive(thing);\n\t\t} else {\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tstr = `[\"Object\",${stringify_primitive(thing)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'BigInt':\n\t\t\t\t\tstr = `[\"BigInt\",${thing}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tconst valid = !isNaN(thing.getDate());\n\t\t\t\t\tstr = `[\"Date\",\"${valid ? thing.toISOString() : ''}\"]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tconst { source, flags } = thing;\n\t\t\t\t\tstr = flags\n\t\t\t\t\t\t? `[\"RegExp\",${stringify_string(source)},\"${flags}\"]`\n\t\t\t\t\t\t: `[\"RegExp\",${stringify_string(source)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\tstr = '[';\n\n\t\t\t\t\tfor (let i = 0; i < thing.length; i += 1) {\n\t\t\t\t\t\tif (i > 0) str += ',';\n\n\t\t\t\t\t\tif (i in thing) {\n\t\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\t\tstr += flatten(thing[i]);\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tstr = '[\"Set\"';\n\n\t\t\t\t\tfor (const value of thing) {\n\t\t\t\t\t\tstr += `,${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tstr = '[\"Map\"';\n\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstr += `,${flatten(key)},${flatten(value)}`;\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getOwnPropertySymbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getPrototypeOf(thing) === null) {\n\t\t\t\t\t\tstr = '[\"null\"';\n\t\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\t\tstr += `,${stringify_string(key)},${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += ']';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr = '{';\n\t\t\t\t\t\tlet started = false;\n\t\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\t\tif (started) str += ',';\n\t\t\t\t\t\t\tstarted = true;\n\t\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\t\tstr += `${stringify_string(key)}:${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += '}';\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstringified[index] = str;\n\t\treturn index;\n\t}\n\n\tconst index = flatten(value);\n\n\t// special case — value is represented as a negative index\n\tif (index < 0) return `${index}`;\n\n\treturn `[${stringified.join(',')}]`;\n}\n\n/**\n * @param {any} thing\n * @returns {string}\n */\nfunction stringify_primitive(thing) {\n\tconst type = typeof thing;\n\tif (type === 'string') return stringify_string(thing);\n\tif (thing instanceof String) return stringify_string(thing.toString());\n\tif (thing === void 0) return UNDEFINED.toString();\n\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();\n\tif (type === 'bigint') return `[\"BigInt\",\"${thing}\"]`;\n\treturn String(thing);\n}\n","import{watch as c}from\"vue-demi\";import{BroadcastChannel as f}from\"broadcast-channel\";import*as s from\"devalue\";function m(t,a,{initialize:d,type:r}){let o=`${a.$id}-${t.toString()}`,n=new f(o,{type:r}),l=!1,e=0;c(()=>a[t],i=>{l||(e=Date.now(),n.postMessage({timestamp:e,state:s.parse(s.stringify(i))})),l=!1},{deep:!0}),n.onmessage=i=>{if(i===void 0){n.postMessage({timestamp:e,state:s.parse(s.stringify(a[t]))});return}i.timestamp<=e||(l=!0,e=i.timestamp,a[t]=i.state)};let u=()=>n.postMessage(void 0),p=()=>n.close();return d&&u(),{sync:u,unshare:p}}var h=(t,a)=>Object.keys(a).includes(t),g=({initialize:t=!0,enable:a=!0,type:d})=>({store:r,options:o})=>{let n=o?.share?.enable??a,l=o?.share?.omit??[];!n||Object.keys(r.$state).forEach(e=>{l.includes(e)||!h(e,r.$state)||m(e,r,{initialize:o?.share?.initialize??t,type:d})})};export{g as PiniaSharedState,m as share};\n","import { createPinia } from 'pinia'\nimport { PiniaSharedState } from 'pinia-shared-state'\n// import { PiniaUndo } from 'pinia-undo'\n\nconst pinia = createPinia()\n\n// Pass the plugin to your application's pinia plugin\npinia.use(\n\tPiniaSharedState({\n\t\tenable: true,\n\t\tinitialize: true,\n\t})\n)\n// pinia.use(PiniaUndo)\n\nexport { pinia }\n","import { App, type Plugin } from 'vue'\n\nimport Registry from '../registry'\nimport router from '../router'\nimport { pinia } from '../stores'\nimport type { InstallOptions } from '../types'\n\n/**\n * Stonecrop Vue plugin\n * @param app - The Vue app instance\n * @param options - The plugin options\n * @example\n * ```ts\n *\n * import { createApp } from 'vue'\n * import Stonecrop from 'stonecrop'\n *\n * import App from './App.vue'\n *\n * const app = createApp(App)\n * app.use(Stonecrop, {\n * router,\n * components: {\n * // register custom components\n * },\n * getMeta: async (doctype: string) => {\n * // fetch doctype meta from API\n * },\n * })\n *\n * app.mount('#app')\n * ```\n *\n * @public\n */\nconst plugin: Plugin = {\n\tinstall: (app: App, options?: InstallOptions) => {\n\t\tconst appRouter = options?.router || router\n\t\tconst registry = new Registry(appRouter, options?.getMeta)\n\n\t\tapp.use(appRouter)\n\t\tapp.use(pinia)\n\t\tapp.provide('$registry', registry)\n\n\t\tif (options?.components) {\n\t\t\tfor (const [tag, component] of Object.entries(options.components)) {\n\t\t\t\tapp.component(tag, component)\n\t\t\t}\n\t\t}\n\t},\n}\n\nexport default plugin\n"],"names":["NotImplementedError","message","_Stonecrop","registry","store","schema","workflow","actions","__publicField","doctype","doctypeRegistry","filters","data","id","action","_a","initialState","Stonecrop","isVue2","set","target","key","val","del","getDevtoolsGlobalHook","getTarget","isProxyAvailable","HOOK_SETUP","HOOK_PLUGIN_SETTINGS_SET","supported","perf","isPerformanceSupported","now","ApiProxy","plugin","hook","defaultSettings","item","localSettingsSaveId","currentSettings","raw","value","pluginId","_target","prop","args","resolve","setupDevtoolsPlugin","pluginDescriptor","setupFn","descriptor","enableProxy","proxy","activePinia","setActivePinia","pinia","piniaSymbol","isPlainObject","o","MutationType","IS_CLIENT","_global","bom","blob","autoBom","download","url","name","opts","xhr","saveAs","corsEnabled","click","node","evt","_navigator","isMacOSWebView","downloadSaveAs","msSaveAs","fileSaverSaveAs","a","popup","force","isSafari","isChromeIOS","reader","toastMessage","type","piniaMessage","isPinia","checkClipboardAccess","checkNotFocusedError","error","actionGlobalCopyState","actionGlobalPasteState","loadStoresState","actionGlobalSaveState","fileInput","getFileOpener","openFile","reject","files","file","actionGlobalOpenStateFile","result","text","state","storeState","formatDisplay","display","PINIA_ROOT_LABEL","PINIA_ROOT_ID","formatStoreForInspectorTree","formatStoreForInspectorState","storeNames","storeMap","storeId","getters","getterName","formatEventData","events","event","formatMutationType","isTimelineActive","componentStateTypes","MUTATIONS_LAYER_ID","INSPECTOR_ID","assign$1","getStoreType","registerPiniaDevtools","app","api","nodeId","payload","ctx","piniaStores","toRaw","stores","inspectedStore","path","addStoreToDevtools","after","onError","groupId","runningActionId","activeAction","watch","unref","newValue","oldValue","eventData","hotUpdate","markRaw","newStore","$dispose","patchActionForGrouping","actionNames","wrapWithProxy","storeActions","actionName","_actionId","trackedStore","retValue","devtoolsPlugin","options","originalHotUpdate","createPinia","scope","effectScope","ref","_p","toBeInstalled","patchObject","newState","oldState","subPatch","targetValue","isRef","isReactive","noop","addSubscription","subscriptions","callback","detached","onCleanup","removeSubscription","idx","getCurrentScope","onScopeDispose","triggerSubscriptions","fallbackRunWithContext","fn","ACTION_MARKER","ACTION_NAME","mergeReactiveObjects","patchToApply","skipHydrateSymbol","shouldHydrate","obj","assign","isComputed","createOptionsStore","hot","setup","localState","toRefs","computedGetters","computed","createSetupStore","$id","isOptionsStore","optionsForPlugin","$subscribeOptions","isListening","debuggerEvents","isSyncListening","actionSubscriptions","hotState","activeListener","$patch","partialStateOrMutator","subscriptionMutation","myListenerId","nextTick","$reset","$state","wrappedAction","afterCallbackList","onErrorCallbackList","ret","_hmrPayload","partialStore","stopWatcher","reactive","setupStore","toRef","actionValue","stateKey","newStateTarget","oldStateSource","actionFn","getter","getterValue","nonEnumerable","p","extender","extensions","defineStore","idOrOptions","setupOptions","isSetupStore","useStore","hasContext","hasInjectionContext","inject","hotId","currentInstance","getCurrentInstance","vm","cache","useDataStore","records","record","useStonecrop","stonecrop","isReady","onBeforeMount","route","doctypeSlug","recordId","_b","_c","DoctypeMeta","component","_Registry","router","getMeta","Registry","isBrowser","isRouteComponent","isESModule","applyToParams","params","newParams","isArray","warn","msg","HASH_RE","AMPERSAND_RE","SLASH_RE","EQUAL_RE","IM_RE","PLUS_RE","ENC_BRACKET_OPEN_RE","ENC_BRACKET_CLOSE_RE","ENC_CARET_RE","ENC_BACKTICK_RE","ENC_CURLY_OPEN_RE","ENC_PIPE_RE","ENC_CURLY_CLOSE_RE","ENC_SPACE_RE","commonEncode","encodeHash","encodeQueryValue","encodeQueryKey","encodePath","encodeParam","decode","TRAILING_SLASH_RE","removeTrailingSlash","parseURL","parseQuery","location","currentLocation","query","searchString","hash","hashPos","searchPos","resolveRelativePath","stringifyURL","stringifyQuery","stripBase","pathname","base","isSameRouteLocation","b","aLastIndex","bLastIndex","isSameRouteRecord","isSameRouteLocationParams","isSameRouteLocationParamsValue","isEquivalentArray","i","to","from","fromSegments","toSegments","lastToSegment","position","toPosition","segment","START_LOCATION_NORMALIZED","NavigationType","NavigationDirection","normalizeBase","baseEl","BEFORE_HASH_RE","createHref","getElementPosition","el","offset","docRect","elRect","computeScrollPosition","scrollToPosition","scrollToOptions","positionEl","isIdSelector","foundEl","getScrollKey","delta","scrollPositions","saveScrollPosition","scrollPosition","getSavedScrollPosition","scroll","createBaseLocation","createCurrentLocation","search","slicePos","pathFromHash","useHistoryListeners","historyState","replace","listeners","teardowns","pauseState","popStateHandler","fromState","listener","pauseListeners","listen","teardown","index","beforeUnloadListener","history","destroy","buildState","back","current","forward","replaced","computeScroll","useHistoryStateNavigation","changeLocation","hashIndex","err","push","currentState","createWebHistory","historyNavigation","historyListeners","go","triggerListeners","routerHistory","isRouteLocation","isRouteName","NavigationFailureSymbol","NavigationFailureType","ErrorTypeMessages","stringifyRoute","createRouterError","isNavigationFailure","propertiesToLog","BASE_PARAM_PATTERN","BASE_PATH_PARSER_OPTIONS","REGEX_CHARS_RE","tokensToParser","segments","extraOptions","score","pattern","keys","segmentScores","tokenIndex","token","subSegmentScore","repeatable","optional","regexp","re","subPattern","parse","match","stringify","avoidDuplicatedSlash","param","compareScoreArray","diff","comparePathParserScore","aScore","bScore","comp","isLastScoreNegative","last","ROOT_TOKEN","VALID_PARAM_RE","tokenizePath","crash","buffer","previousState","tokens","finalizeSegment","char","customRe","consumeBuffer","addCharToBuffer","createRouteRecordMatcher","parent","parser","existingKeys","matcher","createRouterMatcher","routes","globalOptions","matchers","matcherMap","mergeOptions","getRecordMatcher","addRoute","originalRecord","isRootAdd","mainNormalizedRecord","normalizeRouteRecord","checkChildMissingNameWithEmptyPath","normalizedRecords","aliases","alias","originalMatcher","normalizedRecord","parentPath","connectingSlash","checkMissingParamsInAbsolutePath","checkSameParams","isAliasRecord","checkSameNameAsAncestor","removeRoute","isMatchable","insertMatcher","children","matcherRef","getRoutes","findInsertionIndex","invalidParams","paramName","k","paramsFromLocation","m","matched","parentMatcher","mergeMetaFields","clearRoutes","normalized","normalizeRecordProps","propsObject","props","meta","defaults","partialOptions","isSameParam","ancestor","lower","upper","mid","insertionAncestor","getInsertionAncestor","searchParams","searchParam","eqPos","currentValue","v","normalizeQuery","normalizedQuery","matchedRouteKey","viewDepthKey","routerKey","routeLocationKey","routerViewLocationKey","useCallbacks","handlers","add","handler","reset","guardToPromiseFn","guard","runWithContext","enterCallbackArray","next","valid","guardReturn","canOnlyBeCalledOnce","guardCall","resolvedValue","called","extractComponentsGuards","guardType","guards","rawComponent","promise","componentPromise","resolved","resolvedComponent","useLink","currentRoute","hasPrevious","previousTo","activeRecordIndex","length","routeMatched","currentMatched","parentRecordPath","getOriginalPath","isActive","includesParams","isExactActive","navigate","e","guardEvent","instance","linkContextDevtools","watchEffect","preferSingleVNode","vnodes","RouterLink","defineComponent","slots","link","elClass","getLinkClass","h","outer","inner","innerValue","outerValue","propClass","globalClass","defaultClass","RouterViewImpl","attrs","warnDeprecatedUsage","injectedRoute","routeToDisplay","injectedDepth","depth","initialDepth","matchedRoute","matchedRouteRef","provide","viewRef","oldInstance","oldName","currentName","ViewComponent","normalizeSlot","routePropsOption","routeProps","onVnodeUnmounted","vnode","info","r","slot","slotContent","RouterView","parentName","parentSubTreeType","formatRouteLocation","routeLocation","tooltip","copy","omit","routerId","addDevtools","componentInstance","PINK_500","devtoolsData","label","backgroundColor","ORANGE_400","textColor","RED_100","RED_700","LIME_500","BLUE_600","refreshRoutesView","routerInspectorId","navigationsLayerId","navigationId","failure","activeRoutesPayload","resetMatchStateOnRouteRecord","isRouteMatching","markRouteRecordActive","formatRouteRecordForInspector","formatRouteRecordMatcherForStateInspector","modifierForKey","fields","CYAN_400","DARK","tags","routeRecordId","EXTRACT_REGEXP_RE","childRoute","filter","found","child","decodedPath","createRouter","parseQuery$1","stringifyQuery$1","beforeGuards","beforeResolveGuards","afterGuards","shallowRef","pendingLocation","normalizeParams","paramValue","encodeParams","decodeParams","parentOrRoute","recordMatcher","routeMatcher","hasRoute","rawLocation","locationNormalized","href","matcherLocation","targetParams","fullPath","locationAsObject","checkCanceledNavigation","pushWithRedirect","handleRedirectRecord","lastMatched","redirect","newTargetLocation","redirectedFrom","targetLocation","shouldRedirect","toLocation","handleScroll","markAsReady","triggerError","finalizeNavigation","triggerAfterEach","checkCanceledNavigationAndReject","installedApps","leavingRecords","updatingRecords","enteringRecords","extractChangingRecords","canceledNavigationCheck","runGuardQueue","beforeEnter","isPush","isFirstNavigation","removeHistoryListener","setupListeners","_from","readyHandlers","errorListeners","ready","list","scrollBehavior","started","reactiveRoute","shallowReactive","unmountApp","len","recordFrom","recordTo","isPromise","PROMISE_RESOLVED_VOID","sleep","time","resolveWith","res","randomInt","min","max","randomToken","lastMs","additional","microSeconds","ms","micro","create","channelName","close","channelState","postMessage","messageJson","onMessage","canBeUsed","averageResponseTime","NativeMethod","ObliviousSet","ttl","_this","removeTooOldValues","obliviousSet","olderThen","iterator","fillOptionsWithDefaults","originalOptions","DB_PREFIX","OBJECT_STORE_ID","TRANSACTION_SETTINGS","getIdb","commitIndexedDBTransaction","tx","createDatabase","IndexedDB","dbName","openRequest","ev","db","rej","writeMessage","readerUuid","writeObject","objectStore","getMessagesHigherThan","lastCursorId","keyRangeValue","getAllRequest","openCursor","openCursorRequest","cursor","removeMessagesById","ids","deleteRequest","getOldMessages","msgObk","cleanOldMessages","tooOld","_readLoop","readNewMessages","_filterMessage","msgObj","newerMessages","useMessages","msgObjA","msgObjB","IndexedDBMethod","KEY_PREFIX","getLocalStorage","localStorage","storageKey","writeObj","addStorageEventListener","removeStorageEventListener","uuid","eMIs","ls","defaultTime","userAgent","LocalstorageMethod","SIMULATE_CHANNELS","channelArray","channel","SimulateMethod","METHODS","chooseMethod","chooseMethods","useMethod","method","OPEN_BROADCAST_CHANNELS","lastId","BroadcastChannel","ENFORCED_OPTIONS","_prepareChannel","BroadcastChannel$1","_post","listenObj","_removeListenerObject","_addListenerObject","awaitPrepare","broadcastChannel","sendPromise","maybePromise","s","_hasMessageListeners","_startListening","_stopListening","listenerFn","listenerObject","hundredMsInMicro","minMessageTime","DevalueError","is_primitive","thing","object_proto_names","is_plain_object","proto","get_type","get_escaped_char","stringify_string","str","last_pos","replacement","UNDEFINED","HOLE","NAN","POSITIVE_INFINITY","NEGATIVE_INFINITY","NEGATIVE_ZERO","serialized","revivers","unflatten","parsed","hydrate","values","hydrated","standalone","map","array","n","object","reducers","stringified","indexes","custom","flatten","stringify_primitive","source","flags","t","d","f","l","c","s.parse","s.stringify","u","g","PiniaSharedState","appRouter","tag"],"mappings":"ybAUO,SAASA,GAAoBC,EAAiB,CACpD,KAAK,QAAUA,GAAW,EAC3B,CAEAD,GAAoB,UAAY,OAAO,OAAO,MAAM,UAAW,CAC9D,YAAa,CAAE,MAAOA,EAAoB,EAC1C,KAAM,CAAE,MAAO,gBAAiB,EAChC,MAAO,CACN,IAAK,UAAY,CACT,OAAA,IAAI,QAAQ,KAAA,CACpB,CAEF,CAAC,ECZM,MAAME,GAAN,MAAMA,EAAU,CAmFtB,YACCC,EACAC,EACAC,EACAC,EACAC,EACC,CA7EOC,EAAA,YAAO,aAqBPA,EAAA,iBAKTA,EAAA,cAmBAA,EAAA,eAKAA,EAAA,iBAKAA,EAAA,gBAuBC,GAAIN,GAAU,MACb,OAAOA,GAAU,MAElBA,GAAU,MAAQ,KAClB,KAAK,SAAWC,EAChB,KAAK,MAAQC,EACb,KAAK,OAASC,EACd,KAAK,SAAWC,EAChB,KAAK,QAAUC,CAAA,CAYhB,MAAME,EAA4B,CAC5B,KAAK,QAAQA,CAAO,EACzB,KAAK,YAAYA,CAAO,EACxB,KAAK,WAAWA,CAAO,CAAA,CAexB,QAAQA,EAAkE,CACzE,OAAO,KAAK,SAAS,QAAU,KAAK,SAAS,QAAQA,EAAQ,OAAO,EAAI,IAAIT,GAAoBS,EAAQ,OAAO,CAAA,CAYhH,YAAYA,EAA4B,CACvC,MAAMC,EAAkB,KAAK,SAAS,SAASD,EAAQ,IAAI,EAC3D,KAAK,SAAWC,EAAgB,QAAA,CAYjC,WAAWD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,7,8,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28]}
1
+ {"version":3,"file":"stonecrop.umd.cjs","sources":["../src/exceptions.ts","../src/stonecrop.ts","../../common/temp/node_modules/.pnpm/vue-demi@0.14.10_vue@3.5.13_typescript@5.6.3_/node_modules/vue-demi/lib/index.mjs","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/env.js","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/const.js","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/time.js","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/proxy.js","../../common/temp/node_modules/.pnpm/@vue+devtools-api@6.6.4/node_modules/@vue/devtools-api/lib/esm/index.js","../../common/temp/node_modules/.pnpm/pinia@2.3.0_typescript@5.6.3_vue@3.5.13_typescript@5.6.3_/node_modules/pinia/dist/pinia.mjs","../src/stores/data.ts","../src/composable.ts","../src/doctype.ts","../src/registry.ts","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/util.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/methods/native.js","../../common/temp/node_modules/.pnpm/oblivious-set@1.1.1/node_modules/oblivious-set/dist/es/index.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/options.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/methods/indexed-db.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/methods/localstorage.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/methods/simulate.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/method-chooser.js","../../common/temp/node_modules/.pnpm/broadcast-channel@4.20.2/node_modules/broadcast-channel/dist/esbrowser/broadcast-channel.js","../../common/temp/node_modules/.pnpm/devalue@4.3.3/node_modules/devalue/src/utils.js","../../common/temp/node_modules/.pnpm/devalue@4.3.3/node_modules/devalue/src/constants.js","../../common/temp/node_modules/.pnpm/devalue@4.3.3/node_modules/devalue/src/parse.js","../../common/temp/node_modules/.pnpm/devalue@4.3.3/node_modules/devalue/src/stringify.js","../../common/temp/node_modules/.pnpm/pinia-shared-state@0.3.0_pinia@2.3.0_typescript@5.6.3_vue@3.5.13_typescript@5.6.3___vue@3.5.13_typescript@5.6.3_/node_modules/pinia-shared-state/dist/index.mjs","../src/stores/index.ts","../src/plugins/index.ts"],"sourcesContent":["/**\n * NotImplementedError\n * @param message {string} - The error message\n * @class\n * @description This error is thrown when a method has not been implemented\n * @example\n * throw new NotImplementedError('Method not implemented')\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}\n * @public\n */\nexport function NotImplementedError(message: string) {\n\tthis.message = message || ''\n}\n\nNotImplementedError.prototype = Object.create(Error.prototype, {\n\tconstructor: { value: NotImplementedError },\n\tname: { value: 'NotImplemented' },\n\tstack: {\n\t\tget: function () {\n\t\t\treturn new Error().stack\n\t\t},\n\t},\n})\n","import DoctypeMeta from './doctype'\nimport { NotImplementedError } from './exceptions'\nimport Registry from './registry'\nimport { useDataStore } from './stores/data'\nimport type { ImmutableDoctype, Schema } from './types'\n\n/**\n * Stonecrop class\n * @public\n */\nexport class Stonecrop {\n\t/**\n\t * The root Stonecrop instance\n\t */\n\tstatic _root: Stonecrop\n\n\t/**\n\t * The name of the Stonecrop instance\n\t * @readonly\n\t *\n\t * @defaultValue 'Stonecrop'\n\t */\n\treadonly name = 'Stonecrop'\n\n\t/**\n\t * The registry is an immutable collection of doctypes\n\t * @example\n\t * ```ts\n\t * {\n\t * \t'task': {\n\t * \t\tdoctype: 'Task',\n\t * \t\tschema: {\n\t * \t\t\ttitle: 'string',\n\t * \t\t\tdescription: 'string',\n\t * \t\t\t...\n\t * \t\t}\n\t * \t},\n\t * \t...\n\t * }\n\t * ```\n\t * @see {@link Registry}\n\t * @see {@link DoctypeMeta}\n\t */\n\treadonly registry: Registry\n\n\t/**\n\t * The Pinia store that manages the mutable records\n\t */\n\tstore: ReturnType<typeof useDataStore>\n\n\t/**\n\t * schema - The Stonecrop schema; the schema is a subset of the registry\n\t * @example\n\t * ```ts\n\t * {\n\t * \tdoctype: 'Task',\n\t * \tschema: {\n\t * \t\ttitle: 'string',\n\t * \t\tdescription: 'string',\n\t * \t\t...\n\t * \t}\n\t * }\n\t * ```\n\t * @see {@link Registry}\n\t * @see {@link DoctypeMeta}\n\t * @see {@link DoctypeMeta.schema}\n\t */\n\tschema?: Schema\n\n\t/**\n\t * The workflow is a subset of the registry\n\t */\n\tworkflow?: ImmutableDoctype['workflow']\n\n\t/**\n\t * The actions are a subset of the registry\n\t */\n\tactions?: ImmutableDoctype['actions']\n\n\t/**\n\t * @param registry - The immutable registry\n\t * @param store - The mutable Pinia store\n\t * @param schema - The Stonecrop schema\n\t * @param workflow - The Stonecrop workflow\n\t * @param actions - The Stonecrop actions\n\t * @returns The Stonecrop instance with the given registry, store, schema, workflow, and actions. If a Stonecrop instance has already been created, it returns the existing instance instead of creating a new one.\n\t * @example\n\t * ```ts\n\t * const registry = new Registry()\n\t * const store = useDataStore()\n\t * const stonecrop = new Stonecrop(registry, store)\n\t * ```\n\t */\n\tconstructor(\n\t\tregistry: Registry,\n\t\tstore: ReturnType<typeof useDataStore>,\n\t\tschema?: Schema,\n\t\tworkflow?: ImmutableDoctype['workflow'],\n\t\tactions?: ImmutableDoctype['actions']\n\t) {\n\t\tif (Stonecrop._root) {\n\t\t\treturn Stonecrop._root\n\t\t}\n\t\tStonecrop._root = this\n\t\tthis.registry = registry\n\t\tthis.store = store\n\t\tthis.schema = schema // new Registry(schema)\n\t\tthis.workflow = workflow\n\t\tthis.actions = actions\n\t}\n\n\t/**\n\t * Sets up the Stonecrop instance with the given doctype\n\t * @param doctype - The doctype to setup\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.setup(doctype)\n\t * ```\n\t */\n\tsetup(doctype: DoctypeMeta): void {\n\t\tvoid this.getMeta(doctype)\n\t\tthis.getWorkflow(doctype)\n\t\tthis.getActions(doctype)\n\t}\n\n\t/**\n\t * Gets the meta for the given doctype\n\t * @param doctype - The doctype to get meta for\n\t * @returns The meta for the given doctype\n\t * @throws NotImplementedError\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * const meta = stonecrop.getMeta(doctype)\n\t * ```\n\t * @see {@link DoctypeMeta}\n\t */\n\tgetMeta(doctype: DoctypeMeta): DoctypeMeta | Promise<DoctypeMeta> | never {\n\t\treturn this.registry.getMeta ? this.registry.getMeta(doctype.doctype) : new NotImplementedError(doctype.doctype)\n\t}\n\n\t/**\n\t * Gets the workflow for the given doctype\n\t * @param doctype - The doctype to get workflow for\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.getWorkflow(doctype)\n\t * ```\n\t */\n\tgetWorkflow(doctype: DoctypeMeta): void {\n\t\tconst doctypeRegistry = this.registry.registry[doctype.slug]\n\t\tthis.workflow = doctypeRegistry.workflow\n\t}\n\n\t/**\n\t * Gets the actions for the given doctype\n\t * @param doctype - The doctype to get actions for\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.getActions(doctype)\n\t * ```\n\t */\n\tgetActions(doctype: DoctypeMeta): void {\n\t\tconst doctypeRegistry = this.registry.registry[doctype.slug]\n\t\tthis.actions = doctypeRegistry.actions\n\t}\n\n\t/**\n\t * Gets the records for the given doctype\n\t * @param doctype - The doctype to get records for\n\t * @param filters - The filters to apply to the records\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * await stonecrop.getRecords(doctype)\n\t * ```\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * const filters = JSON.stringify({ status: 'Open' })\n\t * await stonecrop.getRecords(doctype, { body: filters })\n\t * ```\n\t */\n\tasync getRecords(doctype: DoctypeMeta, filters?: RequestInit): Promise<void> {\n\t\tthis.store.$patch({ records: [] })\n\t\tconst records = await fetch(`/${doctype.slug}`, filters)\n\t\tconst data: Record<string, any>[] = await records.json()\n\t\tthis.store.$patch({ records: data })\n\t}\n\n\t/**\n\t * Gets the record for the given doctype and id\n\t * @param doctype - The doctype to get record for\n\t * @param id - The id of the record to get\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * await stonecrop.getRecord(doctype, 'TASK-00001')\n\t * ```\n\t */\n\tasync getRecord(doctype: DoctypeMeta, id: string): Promise<void> {\n\t\tthis.store.$patch({ record: {} })\n\t\tconst record = await fetch(`/${doctype.slug}/${id}`)\n\t\tconst data: Record<string, any> = await record.json()\n\t\tthis.store.$patch({ record: data })\n\t}\n\n\t/**\n\t * Runs the action for the given doctype and id\n\t * @param doctype - The doctype to run action for\n\t * @param action - The action to run\n\t * @param id - The id(s) of the record(s) to run action on\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.runAction(doctype, 'CREATE')\n\t * ```\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.runAction(doctype, 'UPDATE', ['TASK-00001'])\n\t * ```\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.runAction(doctype, 'DELETE', ['TASK-00001'])\n\t * ```\n\t * @example\n\t * ```ts\n\t * const doctype = await registry.getMeta('Task')\n\t * stonecrop.runAction(doctype, 'TRANSITION', ['TASK-00001', 'TASK-00002'])\n\t * ```\n\t */\n\trunAction(doctype: DoctypeMeta, action: string, id?: string[]): void {\n\t\tconst doctypeRegistry = this.registry.registry[doctype.slug]\n\t\tconst actions = doctypeRegistry.actions?.get(action)\n\n\t\t// trigger the action on the state machine\n\t\tif (this.workflow) {\n\t\t\tconst { initialState } = this.workflow\n\t\t\tthis.workflow.transition(initialState, { type: action })\n\n\t\t\t// run actions after state machine transition\n\t\t\t// TODO: should this happen with or without the workflow?\n\t\t\tif (actions && actions.length > 0) {\n\t\t\t\tactions.forEach(action => {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-implied-eval\n\t\t\t\t\tconst actionFn = new Function(action)\n\t\t\t\t\tactionFn(id)\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}\n","import * as Vue from 'vue'\n\nvar isVue2 = false\nvar isVue3 = true\nvar Vue2 = undefined\n\nfunction install() {}\n\nexport function set(target, key, val) {\n if (Array.isArray(target)) {\n target.length = Math.max(target.length, key)\n target.splice(key, 1, val)\n return val\n }\n target[key] = val\n return val\n}\n\nexport function del(target, key) {\n if (Array.isArray(target)) {\n target.splice(key, 1)\n return\n }\n delete target[key]\n}\n\nexport * from 'vue'\nexport {\n Vue,\n Vue2,\n isVue2,\n isVue3,\n install,\n}\n","export function getDevtoolsGlobalHook() {\n return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;\n}\nexport function getTarget() {\n // @ts-expect-error navigator and windows are not available in all environments\n return (typeof navigator !== 'undefined' && typeof window !== 'undefined')\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : {};\n}\nexport const isProxyAvailable = typeof Proxy === 'function';\n","export const HOOK_SETUP = 'devtools-plugin:setup';\nexport const HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';\n","let supported;\nlet perf;\nexport function isPerformanceSupported() {\n var _a;\n if (supported !== undefined) {\n return supported;\n }\n if (typeof window !== 'undefined' && window.performance) {\n supported = true;\n perf = window.performance;\n }\n else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {\n supported = true;\n perf = globalThis.perf_hooks.performance;\n }\n else {\n supported = false;\n }\n return supported;\n}\nexport function now() {\n return isPerformanceSupported() ? perf.now() : Date.now();\n}\n","import { HOOK_PLUGIN_SETTINGS_SET } from './const.js';\nimport { now } from './time.js';\nexport class ApiProxy {\n constructor(plugin, hook) {\n this.target = null;\n this.targetQueue = [];\n this.onQueue = [];\n this.plugin = plugin;\n this.hook = hook;\n const defaultSettings = {};\n if (plugin.settings) {\n for (const id in plugin.settings) {\n const item = plugin.settings[id];\n defaultSettings[id] = item.defaultValue;\n }\n }\n const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;\n let currentSettings = Object.assign({}, defaultSettings);\n try {\n const raw = localStorage.getItem(localSettingsSaveId);\n const data = JSON.parse(raw);\n Object.assign(currentSettings, data);\n }\n catch (e) {\n // noop\n }\n this.fallbacks = {\n getSettings() {\n return currentSettings;\n },\n setSettings(value) {\n try {\n localStorage.setItem(localSettingsSaveId, JSON.stringify(value));\n }\n catch (e) {\n // noop\n }\n currentSettings = value;\n },\n now() {\n return now();\n },\n };\n if (hook) {\n hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {\n if (pluginId === this.plugin.id) {\n this.fallbacks.setSettings(value);\n }\n });\n }\n this.proxiedOn = new Proxy({}, {\n get: (_target, prop) => {\n if (this.target) {\n return this.target.on[prop];\n }\n else {\n return (...args) => {\n this.onQueue.push({\n method: prop,\n args,\n });\n };\n }\n },\n });\n this.proxiedTarget = new Proxy({}, {\n get: (_target, prop) => {\n if (this.target) {\n return this.target[prop];\n }\n else if (prop === 'on') {\n return this.proxiedOn;\n }\n else if (Object.keys(this.fallbacks).includes(prop)) {\n return (...args) => {\n this.targetQueue.push({\n method: prop,\n args,\n resolve: () => { },\n });\n return this.fallbacks[prop](...args);\n };\n }\n else {\n return (...args) => {\n return new Promise((resolve) => {\n this.targetQueue.push({\n method: prop,\n args,\n resolve,\n });\n });\n };\n }\n },\n });\n }\n async setRealTarget(target) {\n this.target = target;\n for (const item of this.onQueue) {\n this.target.on[item.method](...item.args);\n }\n for (const item of this.targetQueue) {\n item.resolve(await this.target[item.method](...item.args));\n }\n }\n}\n","import { getDevtoolsGlobalHook, getTarget, isProxyAvailable } from './env.js';\nimport { HOOK_SETUP } from './const.js';\nimport { ApiProxy } from './proxy.js';\nexport * from './api/index.js';\nexport * from './plugin.js';\nexport * from './time.js';\nexport function setupDevtoolsPlugin(pluginDescriptor, setupFn) {\n const descriptor = pluginDescriptor;\n const target = getTarget();\n const hook = getDevtoolsGlobalHook();\n const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;\n if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {\n hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);\n }\n else {\n const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;\n const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];\n list.push({\n pluginDescriptor: descriptor,\n setupFn,\n proxy,\n });\n if (proxy) {\n setupFn(proxy.proxiedTarget);\n }\n }\n}\n","/*!\n * pinia v2.3.0\n * (c) 2024 Eduardo San Martin Morote\n * @license MIT\n */\nimport { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope, ref, isVue2, isRef, isReactive, set, getCurrentScope, onScopeDispose, getCurrentInstance, reactive, toRef, del, nextTick, computed, toRefs } from 'vue-demi';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n\n/**\n * setActivePinia must be called to handle SSR at the top of functions like\n * `fetch`, `setup`, `serverPrefetch` and others\n */\nlet activePinia;\n/**\n * Sets or unsets the active pinia. Used in SSR and internally when calling\n * actions and getters\n *\n * @param pinia - Pinia instance\n */\n// @ts-expect-error: cannot constrain the type of the return\nconst setActivePinia = (pinia) => (activePinia = pinia);\n/**\n * Get the currently active pinia if there is any.\n */\nconst getActivePinia = () => (hasInjectionContext() && inject(piniaSymbol)) || activePinia;\nconst piniaSymbol = ((process.env.NODE_ENV !== 'production') ? Symbol('pinia') : /* istanbul ignore next */ Symbol());\n\nfunction isPlainObject(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\no) {\n return (o &&\n typeof o === 'object' &&\n Object.prototype.toString.call(o) === '[object Object]' &&\n typeof o.toJSON !== 'function');\n}\n// type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> }\n// TODO: can we change these to numbers?\n/**\n * Possible types for SubscriptionCallback\n */\nvar MutationType;\n(function (MutationType) {\n /**\n * Direct mutation of the state:\n *\n * - `store.name = 'new name'`\n * - `store.$state.name = 'new name'`\n * - `store.list.push('new item')`\n */\n MutationType[\"direct\"] = \"direct\";\n /**\n * Mutated the state with `$patch` and an object\n *\n * - `store.$patch({ name: 'newName' })`\n */\n MutationType[\"patchObject\"] = \"patch object\";\n /**\n * Mutated the state with `$patch` and a function\n *\n * - `store.$patch(state => state.name = 'newName')`\n */\n MutationType[\"patchFunction\"] = \"patch function\";\n // maybe reset? for $state = {} and $reset\n})(MutationType || (MutationType = {}));\n\nconst IS_CLIENT = typeof window !== 'undefined';\n\n/*\n * FileSaver.js A saveAs() FileSaver implementation.\n *\n * Originally by Eli Grey, adapted as an ESM module by Eduardo San Martin\n * Morote.\n *\n * License : MIT\n */\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nconst _global = /*#__PURE__*/ (() => typeof window === 'object' && window.window === window\n ? window\n : typeof self === 'object' && self.self === self\n ? self\n : typeof global === 'object' && global.global === global\n ? global\n : typeof globalThis === 'object'\n ? globalThis\n : { HTMLElement: null })();\nfunction bom(blob, { autoBom = false } = {}) {\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (autoBom &&\n /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xfeff), blob], { type: blob.type });\n }\n return blob;\n}\nfunction download(url, name, opts) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.responseType = 'blob';\n xhr.onload = function () {\n saveAs(xhr.response, name, opts);\n };\n xhr.onerror = function () {\n console.error('could not download file');\n };\n xhr.send();\n}\nfunction corsEnabled(url) {\n const xhr = new XMLHttpRequest();\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false);\n try {\n xhr.send();\n }\n catch (e) { }\n return xhr.status >= 200 && xhr.status <= 299;\n}\n// `a.click()` doesn't work for all browsers (#465)\nfunction click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'));\n }\n catch (e) {\n const evt = document.createEvent('MouseEvents');\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);\n node.dispatchEvent(evt);\n }\n}\nconst _navigator = typeof navigator === 'object' ? navigator : { userAgent: '' };\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nconst isMacOSWebView = /*#__PURE__*/ (() => /Macintosh/.test(_navigator.userAgent) &&\n /AppleWebKit/.test(_navigator.userAgent) &&\n !/Safari/.test(_navigator.userAgent))();\nconst saveAs = !IS_CLIENT\n ? () => { } // noop\n : // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program\n typeof HTMLAnchorElement !== 'undefined' &&\n 'download' in HTMLAnchorElement.prototype &&\n !isMacOSWebView\n ? downloadSaveAs\n : // Use msSaveOrOpenBlob as a second approach\n 'msSaveOrOpenBlob' in _navigator\n ? msSaveAs\n : // Fallback to using FileReader and a popup\n fileSaverSaveAs;\nfunction downloadSaveAs(blob, name = 'download', opts) {\n const a = document.createElement('a');\n a.download = name;\n a.rel = 'noopener'; // tabnabbing\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob;\n if (a.origin !== location.origin) {\n if (corsEnabled(a.href)) {\n download(blob, name, opts);\n }\n else {\n a.target = '_blank';\n click(a);\n }\n }\n else {\n click(a);\n }\n }\n else {\n // Support blobs\n a.href = URL.createObjectURL(blob);\n setTimeout(function () {\n URL.revokeObjectURL(a.href);\n }, 4e4); // 40s\n setTimeout(function () {\n click(a);\n }, 0);\n }\n}\nfunction msSaveAs(blob, name = 'download', opts) {\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts);\n }\n else {\n const a = document.createElement('a');\n a.href = blob;\n a.target = '_blank';\n setTimeout(function () {\n click(a);\n });\n }\n }\n else {\n // @ts-ignore: works on windows\n navigator.msSaveOrOpenBlob(bom(blob, opts), name);\n }\n}\nfunction fileSaverSaveAs(blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank');\n if (popup) {\n popup.document.title = popup.document.body.innerText = 'downloading...';\n }\n if (typeof blob === 'string')\n return download(blob, name, opts);\n const force = blob.type === 'application/octet-stream';\n const isSafari = /constructor/i.test(String(_global.HTMLElement)) || 'safari' in _global;\n const isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent);\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) &&\n typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n const reader = new FileReader();\n reader.onloadend = function () {\n let url = reader.result;\n if (typeof url !== 'string') {\n popup = null;\n throw new Error('Wrong reader.result type');\n }\n url = isChromeIOS\n ? url\n : url.replace(/^data:[^;]*;/, 'data:attachment/file;');\n if (popup) {\n popup.location.href = url;\n }\n else {\n location.assign(url);\n }\n popup = null; // reverse-tabnabbing #460\n };\n reader.readAsDataURL(blob);\n }\n else {\n const url = URL.createObjectURL(blob);\n if (popup)\n popup.location.assign(url);\n else\n location.href = url;\n popup = null; // reverse-tabnabbing #460\n setTimeout(function () {\n URL.revokeObjectURL(url);\n }, 4e4); // 40s\n }\n}\n\n/**\n * Shows a toast or console.log\n *\n * @param message - message to log\n * @param type - different color of the tooltip\n */\nfunction toastMessage(message, type) {\n const piniaMessage = '🍍 ' + message;\n if (typeof __VUE_DEVTOOLS_TOAST__ === 'function') {\n // No longer available :(\n __VUE_DEVTOOLS_TOAST__(piniaMessage, type);\n }\n else if (type === 'error') {\n console.error(piniaMessage);\n }\n else if (type === 'warn') {\n console.warn(piniaMessage);\n }\n else {\n console.log(piniaMessage);\n }\n}\nfunction isPinia(o) {\n return '_a' in o && 'install' in o;\n}\n\n/**\n * This file contain devtools actions, they are not Pinia actions.\n */\n// ---\nfunction checkClipboardAccess() {\n if (!('clipboard' in navigator)) {\n toastMessage(`Your browser doesn't support the Clipboard API`, 'error');\n return true;\n }\n}\nfunction checkNotFocusedError(error) {\n if (error instanceof Error &&\n error.message.toLowerCase().includes('document is not focused')) {\n toastMessage('You need to activate the \"Emulate a focused page\" setting in the \"Rendering\" panel of devtools.', 'warn');\n return true;\n }\n return false;\n}\nasync function actionGlobalCopyState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));\n toastMessage('Global state copied to clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to serialize the state. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalPasteState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n loadStoresState(pinia, JSON.parse(await navigator.clipboard.readText()));\n toastMessage('Global state pasted from clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalSaveState(pinia) {\n try {\n saveAs(new Blob([JSON.stringify(pinia.state.value)], {\n type: 'text/plain;charset=utf-8',\n }), 'pinia-state.json');\n }\n catch (error) {\n toastMessage(`Failed to export the state as JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nlet fileInput;\nfunction getFileOpener() {\n if (!fileInput) {\n fileInput = document.createElement('input');\n fileInput.type = 'file';\n fileInput.accept = '.json';\n }\n function openFile() {\n return new Promise((resolve, reject) => {\n fileInput.onchange = async () => {\n const files = fileInput.files;\n if (!files)\n return resolve(null);\n const file = files.item(0);\n if (!file)\n return resolve(null);\n return resolve({ text: await file.text(), file });\n };\n // @ts-ignore: TODO: changed from 4.3 to 4.4\n fileInput.oncancel = () => resolve(null);\n fileInput.onerror = reject;\n fileInput.click();\n });\n }\n return openFile;\n}\nasync function actionGlobalOpenStateFile(pinia) {\n try {\n const open = getFileOpener();\n const result = await open();\n if (!result)\n return;\n const { text, file } = result;\n loadStoresState(pinia, JSON.parse(text));\n toastMessage(`Global state imported from \"${file.name}\".`);\n }\n catch (error) {\n toastMessage(`Failed to import the state from JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nfunction loadStoresState(pinia, state) {\n for (const key in state) {\n const storeState = pinia.state.value[key];\n // store is already instantiated, patch it\n if (storeState) {\n Object.assign(storeState, state[key]);\n }\n else {\n // store is not instantiated, set the initial state\n pinia.state.value[key] = state[key];\n }\n }\n}\n\nfunction formatDisplay(display) {\n return {\n _custom: {\n display,\n },\n };\n}\nconst PINIA_ROOT_LABEL = '🍍 Pinia (root)';\nconst PINIA_ROOT_ID = '_root';\nfunction formatStoreForInspectorTree(store) {\n return isPinia(store)\n ? {\n id: PINIA_ROOT_ID,\n label: PINIA_ROOT_LABEL,\n }\n : {\n id: store.$id,\n label: store.$id,\n };\n}\nfunction formatStoreForInspectorState(store) {\n if (isPinia(store)) {\n const storeNames = Array.from(store._s.keys());\n const storeMap = store._s;\n const state = {\n state: storeNames.map((storeId) => ({\n editable: true,\n key: storeId,\n value: store.state.value[storeId],\n })),\n getters: storeNames\n .filter((id) => storeMap.get(id)._getters)\n .map((id) => {\n const store = storeMap.get(id);\n return {\n editable: false,\n key: id,\n value: store._getters.reduce((getters, key) => {\n getters[key] = store[key];\n return getters;\n }, {}),\n };\n }),\n };\n return state;\n }\n const state = {\n state: Object.keys(store.$state).map((key) => ({\n editable: true,\n key,\n value: store.$state[key],\n })),\n };\n // avoid adding empty getters\n if (store._getters && store._getters.length) {\n state.getters = store._getters.map((getterName) => ({\n editable: false,\n key: getterName,\n value: store[getterName],\n }));\n }\n if (store._customProperties.size) {\n state.customProperties = Array.from(store._customProperties).map((key) => ({\n editable: true,\n key,\n value: store[key],\n }));\n }\n return state;\n}\nfunction formatEventData(events) {\n if (!events)\n return {};\n if (Array.isArray(events)) {\n // TODO: handle add and delete for arrays and objects\n return events.reduce((data, event) => {\n data.keys.push(event.key);\n data.operations.push(event.type);\n data.oldValue[event.key] = event.oldValue;\n data.newValue[event.key] = event.newValue;\n return data;\n }, {\n oldValue: {},\n keys: [],\n operations: [],\n newValue: {},\n });\n }\n else {\n return {\n operation: formatDisplay(events.type),\n key: formatDisplay(events.key),\n oldValue: events.oldValue,\n newValue: events.newValue,\n };\n }\n}\nfunction formatMutationType(type) {\n switch (type) {\n case MutationType.direct:\n return 'mutation';\n case MutationType.patchFunction:\n return '$patch';\n case MutationType.patchObject:\n return '$patch';\n default:\n return 'unknown';\n }\n}\n\n// timeline can be paused when directly changing the state\nlet isTimelineActive = true;\nconst componentStateTypes = [];\nconst MUTATIONS_LAYER_ID = 'pinia:mutations';\nconst INSPECTOR_ID = 'pinia';\nconst { assign: assign$1 } = Object;\n/**\n * Gets the displayed name of a store in devtools\n *\n * @param id - id of the store\n * @returns a formatted string\n */\nconst getStoreType = (id) => '🍍 ' + id;\n/**\n * Add the pinia plugin without any store. Allows displaying a Pinia plugin tab\n * as soon as it is added to the application.\n *\n * @param app - Vue application\n * @param pinia - pinia instance\n */\nfunction registerPiniaDevtools(app, pinia) {\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia 🍍',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n }, (api) => {\n if (typeof api.now !== 'function') {\n toastMessage('You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.');\n }\n api.addTimelineLayer({\n id: MUTATIONS_LAYER_ID,\n label: `Pinia 🍍`,\n color: 0xe5df88,\n });\n api.addInspector({\n id: INSPECTOR_ID,\n label: 'Pinia 🍍',\n icon: 'storage',\n treeFilterPlaceholder: 'Search stores',\n actions: [\n {\n icon: 'content_copy',\n action: () => {\n actionGlobalCopyState(pinia);\n },\n tooltip: 'Serialize and copy the state',\n },\n {\n icon: 'content_paste',\n action: async () => {\n await actionGlobalPasteState(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Replace the state with the content of your clipboard',\n },\n {\n icon: 'save',\n action: () => {\n actionGlobalSaveState(pinia);\n },\n tooltip: 'Save the state as a JSON file',\n },\n {\n icon: 'folder_open',\n action: async () => {\n await actionGlobalOpenStateFile(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Import the state from a JSON file',\n },\n ],\n nodeActions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state (with \"$reset\")',\n action: (nodeId) => {\n const store = pinia._s.get(nodeId);\n if (!store) {\n toastMessage(`Cannot reset \"${nodeId}\" store because it wasn't found.`, 'warn');\n }\n else if (typeof store.$reset !== 'function') {\n toastMessage(`Cannot reset \"${nodeId}\" store because it doesn't have a \"$reset\" method implemented.`, 'warn');\n }\n else {\n store.$reset();\n toastMessage(`Store \"${nodeId}\" reset.`);\n }\n },\n },\n ],\n });\n api.on.inspectComponent((payload, ctx) => {\n const proxy = (payload.componentInstance &&\n payload.componentInstance.proxy);\n if (proxy && proxy._pStores) {\n const piniaStores = payload.componentInstance.proxy._pStores;\n Object.values(piniaStores).forEach((store) => {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'state',\n editable: true,\n value: store._isOptionsAPI\n ? {\n _custom: {\n value: toRaw(store.$state),\n actions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state of this store',\n action: () => store.$reset(),\n },\n ],\n },\n }\n : // NOTE: workaround to unwrap transferred refs\n Object.keys(store.$state).reduce((state, key) => {\n state[key] = store.$state[key];\n return state;\n }, {}),\n });\n if (store._getters && store._getters.length) {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'getters',\n editable: false,\n value: store._getters.reduce((getters, key) => {\n try {\n getters[key] = store[key];\n }\n catch (error) {\n // @ts-expect-error: we just want to show it in devtools\n getters[key] = error;\n }\n return getters;\n }, {}),\n });\n }\n });\n }\n });\n api.on.getInspectorTree((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n let stores = [pinia];\n stores = stores.concat(Array.from(pinia._s.values()));\n payload.rootNodes = (payload.filter\n ? stores.filter((store) => '$id' in store\n ? store.$id\n .toLowerCase()\n .includes(payload.filter.toLowerCase())\n : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase()))\n : stores).map(formatStoreForInspectorTree);\n }\n });\n // Expose pinia instance as $pinia to window\n globalThis.$pinia = pinia;\n api.on.getInspectorState((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n // this could be the selected store restored for a different project\n // so it's better not to say anything here\n return;\n }\n if (inspectedStore) {\n // Expose selected store as $store to window\n if (payload.nodeId !== PINIA_ROOT_ID)\n globalThis.$store = toRaw(inspectedStore);\n payload.state = formatStoreForInspectorState(inspectedStore);\n }\n }\n });\n api.on.editInspectorState((payload, ctx) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n return toastMessage(`store \"${payload.nodeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (!isPinia(inspectedStore)) {\n // access only the state\n if (path.length !== 1 ||\n !inspectedStore._customProperties.has(path[0]) ||\n path[0] in inspectedStore.$state) {\n path.unshift('$state');\n }\n }\n else {\n // Root access, we can omit the `.value` because the devtools API does it for us\n path.unshift('state');\n }\n isTimelineActive = false;\n payload.set(inspectedStore, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n api.on.editComponentState((payload) => {\n if (payload.type.startsWith('🍍')) {\n const storeId = payload.type.replace(/^🍍\\s*/, '');\n const store = pinia._s.get(storeId);\n if (!store) {\n return toastMessage(`store \"${storeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (path[0] !== 'state') {\n return toastMessage(`Invalid path for store \"${storeId}\":\\n${path}\\nOnly state can be modified.`);\n }\n // rewrite the first entry to be able to directly set the state as\n // well as any other path\n path[0] = '$state';\n isTimelineActive = false;\n payload.set(store, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n });\n}\nfunction addStoreToDevtools(app, store) {\n if (!componentStateTypes.includes(getStoreType(store.$id))) {\n componentStateTypes.push(getStoreType(store.$id));\n }\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia 🍍',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n settings: {\n logStoreChanges: {\n label: 'Notify about new/deleted stores',\n type: 'boolean',\n defaultValue: true,\n },\n // useEmojis: {\n // label: 'Use emojis in messages ⚡️',\n // type: 'boolean',\n // defaultValue: true,\n // },\n },\n }, (api) => {\n // gracefully handle errors\n const now = typeof api.now === 'function' ? api.now.bind(api) : Date.now;\n store.$onAction(({ after, onError, name, args }) => {\n const groupId = runningActionId++;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🛫 ' + name,\n subtitle: 'start',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n },\n groupId,\n },\n });\n after((result) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🛬 ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n result,\n },\n groupId,\n },\n });\n });\n onError((error) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n logType: 'error',\n title: '💥 ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n error,\n },\n groupId,\n },\n });\n });\n }, true);\n store._customProperties.forEach((name) => {\n watch(() => unref(store[name]), (newValue, oldValue) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (isTimelineActive) {\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: 'Change',\n subtitle: name,\n data: {\n newValue,\n oldValue,\n },\n groupId: activeAction,\n },\n });\n }\n }, { deep: true });\n });\n store.$subscribe(({ events, type }, state) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (!isTimelineActive)\n return;\n // rootStore.state[store.id] = state\n const eventData = {\n time: now(),\n title: formatMutationType(type),\n data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),\n groupId: activeAction,\n };\n if (type === MutationType.patchFunction) {\n eventData.subtitle = '⤵️';\n }\n else if (type === MutationType.patchObject) {\n eventData.subtitle = '🧩';\n }\n else if (events && !Array.isArray(events)) {\n eventData.subtitle = events.type;\n }\n if (events) {\n eventData.data['rawEvent(s)'] = {\n _custom: {\n display: 'DebuggerEvent',\n type: 'object',\n tooltip: 'raw DebuggerEvent[]',\n value: events,\n },\n };\n }\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: eventData,\n });\n }, { detached: true, flush: 'sync' });\n const hotUpdate = store._hotUpdate;\n store._hotUpdate = markRaw((newStore) => {\n hotUpdate(newStore);\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🔥 ' + store.$id,\n subtitle: 'HMR update',\n data: {\n store: formatDisplay(store.$id),\n info: formatDisplay(`HMR update`),\n },\n },\n });\n // update the devtools too\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n });\n const { $dispose } = store;\n store.$dispose = () => {\n $dispose();\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`Disposed \"${store.$id}\" store 🗑`);\n };\n // trigger an update so it can display new registered stores\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`\"${store.$id}\" store installed 🆕`);\n });\n}\nlet runningActionId = 0;\nlet activeAction;\n/**\n * Patches a store to enable action grouping in devtools by wrapping the store with a Proxy that is passed as the\n * context of all actions, allowing us to set `runningAction` on each access and effectively associating any state\n * mutation to the action.\n *\n * @param store - store to patch\n * @param actionNames - list of actionst to patch\n */\nfunction patchActionForGrouping(store, actionNames, wrapWithProxy) {\n // original actions of the store as they are given by pinia. We are going to override them\n const actions = actionNames.reduce((storeActions, actionName) => {\n // use toRaw to avoid tracking #541\n storeActions[actionName] = toRaw(store)[actionName];\n return storeActions;\n }, {});\n for (const actionName in actions) {\n store[actionName] = function () {\n // the running action id is incremented in a before action hook\n const _actionId = runningActionId;\n const trackedStore = wrapWithProxy\n ? new Proxy(store, {\n get(...args) {\n activeAction = _actionId;\n return Reflect.get(...args);\n },\n set(...args) {\n activeAction = _actionId;\n return Reflect.set(...args);\n },\n })\n : store;\n // For Setup Stores we need https://github.com/tc39/proposal-async-context\n activeAction = _actionId;\n const retValue = actions[actionName].apply(trackedStore, arguments);\n // this is safer as async actions in Setup Stores would associate mutations done outside of the action\n activeAction = undefined;\n return retValue;\n };\n }\n}\n/**\n * pinia.use(devtoolsPlugin)\n */\nfunction devtoolsPlugin({ app, store, options }) {\n // HMR module\n if (store.$id.startsWith('__hot:')) {\n return;\n }\n // detect option api vs setup api\n store._isOptionsAPI = !!options.state;\n // Do not overwrite actions mocked by @pinia/testing (#2298)\n if (!store._p._testing) {\n patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);\n // Upgrade the HMR to also update the new actions\n const originalHotUpdate = store._hotUpdate;\n toRaw(store)._hotUpdate = function (newStore) {\n originalHotUpdate.apply(this, arguments);\n patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);\n };\n }\n addStoreToDevtools(app, \n // FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?\n store);\n}\n\n/**\n * Creates a Pinia instance to be used by the application\n */\nfunction createPinia() {\n const scope = effectScope(true);\n // NOTE: here we could check the window object for a state and directly set it\n // if there is anything like it with Vue 3 SSR\n const state = scope.run(() => ref({}));\n let _p = [];\n // plugins added before calling app.use(pinia)\n let toBeInstalled = [];\n const pinia = markRaw({\n install(app) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n if (!isVue2) {\n pinia._a = app;\n app.provide(piniaSymbol, pinia);\n app.config.globalProperties.$pinia = pinia;\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n registerPiniaDevtools(app, pinia);\n }\n toBeInstalled.forEach((plugin) => _p.push(plugin));\n toBeInstalled = [];\n }\n },\n use(plugin) {\n if (!this._a && !isVue2) {\n toBeInstalled.push(plugin);\n }\n else {\n _p.push(plugin);\n }\n return this;\n },\n _p,\n // it's actually undefined here\n // @ts-expect-error\n _a: null,\n _e: scope,\n _s: new Map(),\n state,\n });\n // pinia devtools rely on dev only features so they cannot be forced unless\n // the dev build of Vue is used. Avoid old browsers like IE11.\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT && typeof Proxy !== 'undefined') {\n pinia.use(devtoolsPlugin);\n }\n return pinia;\n}\n/**\n * Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly\n * useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances.\n * Once disposed, the pinia instance cannot be used anymore.\n *\n * @param pinia - pinia instance\n */\nfunction disposePinia(pinia) {\n pinia._e.stop();\n pinia._s.clear();\n pinia._p.splice(0);\n pinia.state.value = {};\n // @ts-expect-error: non valid\n pinia._a = null;\n}\n\n/**\n * Checks if a function is a `StoreDefinition`.\n *\n * @param fn - object to test\n * @returns true if `fn` is a StoreDefinition\n */\nconst isUseStore = (fn) => {\n return typeof fn === 'function' && typeof fn.$id === 'string';\n};\n/**\n * Mutates in place `newState` with `oldState` to _hot update_ it. It will\n * remove any key not existing in `newState` and recursively merge plain\n * objects.\n *\n * @param newState - new state object to be patched\n * @param oldState - old state that should be used to patch newState\n * @returns - newState\n */\nfunction patchObject(newState, oldState) {\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in oldState) {\n const subPatch = oldState[key];\n // skip the whole sub tree\n if (!(key in newState)) {\n continue;\n }\n const targetValue = newState[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n newState[key] = patchObject(targetValue, subPatch);\n }\n else {\n // objects are either a bit more complex (e.g. refs) or primitives, so we\n // just set the whole thing\n if (isVue2) {\n set(newState, key, subPatch);\n }\n else {\n newState[key] = subPatch;\n }\n }\n }\n return newState;\n}\n/**\n * Creates an _accept_ function to pass to `import.meta.hot` in Vite applications.\n *\n * @example\n * ```js\n * const useUser = defineStore(...)\n * if (import.meta.hot) {\n * import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))\n * }\n * ```\n *\n * @param initialUseStore - return of the defineStore to hot update\n * @param hot - `import.meta.hot`\n */\nfunction acceptHMRUpdate(initialUseStore, hot) {\n // strip as much as possible from iife.prod\n if (!(process.env.NODE_ENV !== 'production')) {\n return () => { };\n }\n return (newModule) => {\n const pinia = hot.data.pinia || initialUseStore._pinia;\n if (!pinia) {\n // this store is still not used\n return;\n }\n // preserve the pinia instance across loads\n hot.data.pinia = pinia;\n // console.log('got data', newStore)\n for (const exportName in newModule) {\n const useStore = newModule[exportName];\n // console.log('checking for', exportName)\n if (isUseStore(useStore) && pinia._s.has(useStore.$id)) {\n // console.log('Accepting update for', useStore.$id)\n const id = useStore.$id;\n if (id !== initialUseStore.$id) {\n console.warn(`The id of the store changed from \"${initialUseStore.$id}\" to \"${id}\". Reloading.`);\n // return import.meta.hot.invalidate()\n return hot.invalidate();\n }\n const existingStore = pinia._s.get(id);\n if (!existingStore) {\n console.log(`[Pinia]: skipping hmr because store doesn't exist yet`);\n return;\n }\n useStore(pinia, existingStore);\n }\n }\n };\n}\n\nconst noop = () => { };\nfunction addSubscription(subscriptions, callback, detached, onCleanup = noop) {\n subscriptions.push(callback);\n const removeSubscription = () => {\n const idx = subscriptions.indexOf(callback);\n if (idx > -1) {\n subscriptions.splice(idx, 1);\n onCleanup();\n }\n };\n if (!detached && getCurrentScope()) {\n onScopeDispose(removeSubscription);\n }\n return removeSubscription;\n}\nfunction triggerSubscriptions(subscriptions, ...args) {\n subscriptions.slice().forEach((callback) => {\n callback(...args);\n });\n}\n\nconst fallbackRunWithContext = (fn) => fn();\n/**\n * Marks a function as an action for `$onAction`\n * @internal\n */\nconst ACTION_MARKER = Symbol();\n/**\n * Action name symbol. Allows to add a name to an action after defining it\n * @internal\n */\nconst ACTION_NAME = Symbol();\nfunction mergeReactiveObjects(target, patchToApply) {\n // Handle Map instances\n if (target instanceof Map && patchToApply instanceof Map) {\n patchToApply.forEach((value, key) => target.set(key, value));\n }\n else if (target instanceof Set && patchToApply instanceof Set) {\n // Handle Set instances\n patchToApply.forEach(target.add, target);\n }\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in patchToApply) {\n if (!patchToApply.hasOwnProperty(key))\n continue;\n const subPatch = patchToApply[key];\n const targetValue = target[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n target.hasOwnProperty(key) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n // NOTE: here I wanted to warn about inconsistent types but it's not possible because in setup stores one might\n // start the value of a property as a certain type e.g. a Map, and then for some reason, during SSR, change that\n // to `undefined`. When trying to hydrate, we want to override the Map with `undefined`.\n target[key] = mergeReactiveObjects(targetValue, subPatch);\n }\n else {\n // @ts-expect-error: subPatch is a valid value\n target[key] = subPatch;\n }\n }\n return target;\n}\nconst skipHydrateSymbol = (process.env.NODE_ENV !== 'production')\n ? Symbol('pinia:skipHydration')\n : /* istanbul ignore next */ Symbol();\n/**\n * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a\n * stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.\n *\n * @param obj - target object\n * @returns obj\n */\nfunction skipHydrate(obj) {\n return Object.defineProperty(obj, skipHydrateSymbol, {});\n}\n/**\n * Returns whether a value should be hydrated\n *\n * @param obj - target variable\n * @returns true if `obj` should be hydrated\n */\nfunction shouldHydrate(obj) {\n return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);\n}\nconst { assign } = Object;\nfunction isComputed(o) {\n return !!(isRef(o) && o.effect);\n}\nfunction createOptionsStore(id, options, pinia, hot) {\n const { state, actions, getters } = options;\n const initialState = pinia.state.value[id];\n let store;\n function setup() {\n if (!initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value, id, state ? state() : {});\n }\n else {\n pinia.state.value[id] = state ? state() : {};\n }\n }\n // avoid creating a state in pinia.state.value\n const localState = (process.env.NODE_ENV !== 'production') && hot\n ? // use ref() to unwrap refs inside state TODO: check if this is still necessary\n toRefs(ref(state ? state() : {}).value)\n : toRefs(pinia.state.value[id]);\n return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {\n if ((process.env.NODE_ENV !== 'production') && name in localState) {\n console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with \"${name}\" in store \"${id}\".`);\n }\n computedGetters[name] = markRaw(computed(() => {\n setActivePinia(pinia);\n // it was created just before\n const store = pinia._s.get(id);\n // allow cross using stores\n /* istanbul ignore if */\n if (isVue2 && !store._r)\n return;\n // @ts-expect-error\n // return getters![name].call(context, context)\n // TODO: avoid reading the getter while assigning with a global variable\n return getters[name].call(store, store);\n }));\n return computedGetters;\n }, {}));\n }\n store = createSetupStore(id, setup, options, pinia, hot, true);\n return store;\n}\nfunction createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {\n let scope;\n const optionsForPlugin = assign({ actions: {} }, options);\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && !pinia._e.active) {\n throw new Error('Pinia destroyed');\n }\n // watcher options for $subscribe\n const $subscribeOptions = { deep: true };\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production') && !isVue2) {\n $subscribeOptions.onTrigger = (event) => {\n /* istanbul ignore else */\n if (isListening) {\n debuggerEvents = event;\n // avoid triggering this while the store is being built and the state is being set in pinia\n }\n else if (isListening == false && !store._hotUpdating) {\n // let patch send all the events together later\n /* istanbul ignore else */\n if (Array.isArray(debuggerEvents)) {\n debuggerEvents.push(event);\n }\n else {\n console.error('🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.');\n }\n }\n };\n }\n // internal state\n let isListening; // set to true at the end\n let isSyncListening; // set to true at the end\n let subscriptions = [];\n let actionSubscriptions = [];\n let debuggerEvents;\n const initialState = pinia.state.value[$id];\n // avoid setting the state for option stores if it is set\n // by the setup\n if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value, $id, {});\n }\n else {\n pinia.state.value[$id] = {};\n }\n }\n const hotState = ref({});\n // avoid triggering too many listeners\n // https://github.com/vuejs/pinia/issues/1129\n let activeListener;\n function $patch(partialStateOrMutator) {\n let subscriptionMutation;\n isListening = isSyncListening = false;\n // reset the debugger events since patches are sync\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n debuggerEvents = [];\n }\n if (typeof partialStateOrMutator === 'function') {\n partialStateOrMutator(pinia.state.value[$id]);\n subscriptionMutation = {\n type: MutationType.patchFunction,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n else {\n mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);\n subscriptionMutation = {\n type: MutationType.patchObject,\n payload: partialStateOrMutator,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n const myListenerId = (activeListener = Symbol());\n nextTick().then(() => {\n if (activeListener === myListenerId) {\n isListening = true;\n }\n });\n isSyncListening = true;\n // because we paused the watcher, we need to manually call the subscriptions\n triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);\n }\n const $reset = isOptionsStore\n ? function $reset() {\n const { state } = options;\n const newState = state ? state() : {};\n // we use a patch to group all changes into one single subscription\n this.$patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, newState);\n });\n }\n : /* istanbul ignore next */\n (process.env.NODE_ENV !== 'production')\n ? () => {\n throw new Error(`🍍: Store \"${$id}\" is built using the setup syntax and does not implement $reset().`);\n }\n : noop;\n function $dispose() {\n scope.stop();\n subscriptions = [];\n actionSubscriptions = [];\n pinia._s.delete($id);\n }\n /**\n * Helper that wraps function so it can be tracked with $onAction\n * @param fn - action to wrap\n * @param name - name of the action\n */\n const action = (fn, name = '') => {\n if (ACTION_MARKER in fn) {\n fn[ACTION_NAME] = name;\n return fn;\n }\n const wrappedAction = function () {\n setActivePinia(pinia);\n const args = Array.from(arguments);\n const afterCallbackList = [];\n const onErrorCallbackList = [];\n function after(callback) {\n afterCallbackList.push(callback);\n }\n function onError(callback) {\n onErrorCallbackList.push(callback);\n }\n // @ts-expect-error\n triggerSubscriptions(actionSubscriptions, {\n args,\n name: wrappedAction[ACTION_NAME],\n store,\n after,\n onError,\n });\n let ret;\n try {\n ret = fn.apply(this && this.$id === $id ? this : store, args);\n // handle sync errors\n }\n catch (error) {\n triggerSubscriptions(onErrorCallbackList, error);\n throw error;\n }\n if (ret instanceof Promise) {\n return ret\n .then((value) => {\n triggerSubscriptions(afterCallbackList, value);\n return value;\n })\n .catch((error) => {\n triggerSubscriptions(onErrorCallbackList, error);\n return Promise.reject(error);\n });\n }\n // trigger after callbacks\n triggerSubscriptions(afterCallbackList, ret);\n return ret;\n };\n wrappedAction[ACTION_MARKER] = true;\n wrappedAction[ACTION_NAME] = name; // will be set later\n // @ts-expect-error: we are intentionally limiting the returned type to just Fn\n // because all the added properties are internals that are exposed through `$onAction()` only\n return wrappedAction;\n };\n const _hmrPayload = /*#__PURE__*/ markRaw({\n actions: {},\n getters: {},\n state: [],\n hotState,\n });\n const partialStore = {\n _p: pinia,\n // _s: scope,\n $id,\n $onAction: addSubscription.bind(null, actionSubscriptions),\n $patch,\n $reset,\n $subscribe(callback, options = {}) {\n const removeSubscription = addSubscription(subscriptions, callback, options.detached, () => stopWatcher());\n const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {\n if (options.flush === 'sync' ? isSyncListening : isListening) {\n callback({\n storeId: $id,\n type: MutationType.direct,\n events: debuggerEvents,\n }, state);\n }\n }, assign({}, $subscribeOptions, options)));\n return removeSubscription;\n },\n $dispose,\n };\n /* istanbul ignore if */\n if (isVue2) {\n // start as non ready\n partialStore._r = false;\n }\n const store = reactive((process.env.NODE_ENV !== 'production') || ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT)\n ? assign({\n _hmrPayload,\n _customProperties: markRaw(new Set()), // devtools custom properties\n }, partialStore\n // must be added later\n // setupStore\n )\n : partialStore);\n // store the partial store now so the setup of stores can instantiate each other before they are finished without\n // creating infinite loops.\n pinia._s.set($id, store);\n const runWithContext = (pinia._a && pinia._a.runWithContext) || fallbackRunWithContext;\n // TODO: idea create skipSerialize that marks properties as non serializable and they are skipped\n const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action }))));\n // overwrite existing actions to support $onAction\n for (const key in setupStore) {\n const prop = setupStore[key];\n if ((isRef(prop) && !isComputed(prop)) || isReactive(prop)) {\n // mark it as a piece of state to be serialized\n if ((process.env.NODE_ENV !== 'production') && hot) {\n set(hotState.value, key, toRef(setupStore, key));\n // createOptionStore directly sets the state in pinia.state.value so we\n // can just skip that\n }\n else if (!isOptionsStore) {\n // in setup stores we must hydrate the state and sync pinia state tree with the refs the user just created\n if (initialState && shouldHydrate(prop)) {\n if (isRef(prop)) {\n prop.value = initialState[key];\n }\n else {\n // probably a reactive object, lets recursively assign\n // @ts-expect-error: prop is unknown\n mergeReactiveObjects(prop, initialState[key]);\n }\n }\n // transfer the ref to the pinia state to keep everything in sync\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value[$id], key, prop);\n }\n else {\n pinia.state.value[$id][key] = prop;\n }\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.state.push(key);\n }\n // action\n }\n else if (typeof prop === 'function') {\n const actionValue = (process.env.NODE_ENV !== 'production') && hot ? prop : action(prop, key);\n // this a hot module replacement store because the hotUpdate method needs\n // to do it with the right context\n /* istanbul ignore if */\n if (isVue2) {\n set(setupStore, key, actionValue);\n }\n else {\n // @ts-expect-error\n setupStore[key] = actionValue;\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.actions[key] = prop;\n }\n // list actions so they can be used in plugins\n // @ts-expect-error\n optionsForPlugin.actions[key] = prop;\n }\n else if ((process.env.NODE_ENV !== 'production')) {\n // add getters for devtools\n if (isComputed(prop)) {\n _hmrPayload.getters[key] = isOptionsStore\n ? // @ts-expect-error\n options.getters[key]\n : prop;\n if (IS_CLIENT) {\n const getters = setupStore._getters ||\n // @ts-expect-error: same\n (setupStore._getters = markRaw([]));\n getters.push(key);\n }\n }\n }\n }\n // add the state, getters, and action properties\n /* istanbul ignore if */\n if (isVue2) {\n Object.keys(setupStore).forEach((key) => {\n set(store, key, setupStore[key]);\n });\n }\n else {\n assign(store, setupStore);\n // allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.\n // Make `storeToRefs()` work with `reactive()` #799\n assign(toRaw(store), setupStore);\n }\n // use this instead of a computed with setter to be able to create it anywhere\n // without linking the computed lifespan to wherever the store is first\n // created.\n Object.defineProperty(store, '$state', {\n get: () => ((process.env.NODE_ENV !== 'production') && hot ? hotState.value : pinia.state.value[$id]),\n set: (state) => {\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && hot) {\n throw new Error('cannot set hotState');\n }\n $patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, state);\n });\n },\n });\n // add the hotUpdate before plugins to allow them to override it\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n store._hotUpdate = markRaw((newStore) => {\n store._hotUpdating = true;\n newStore._hmrPayload.state.forEach((stateKey) => {\n if (stateKey in store.$state) {\n const newStateTarget = newStore.$state[stateKey];\n const oldStateSource = store.$state[stateKey];\n if (typeof newStateTarget === 'object' &&\n isPlainObject(newStateTarget) &&\n isPlainObject(oldStateSource)) {\n patchObject(newStateTarget, oldStateSource);\n }\n else {\n // transfer the ref\n newStore.$state[stateKey] = oldStateSource;\n }\n }\n // patch direct access properties to allow store.stateProperty to work as\n // store.$state.stateProperty\n set(store, stateKey, toRef(newStore.$state, stateKey));\n });\n // remove deleted state properties\n Object.keys(store.$state).forEach((stateKey) => {\n if (!(stateKey in newStore.$state)) {\n del(store, stateKey);\n }\n });\n // avoid devtools logging this as a mutation\n isListening = false;\n isSyncListening = false;\n pinia.state.value[$id] = toRef(newStore._hmrPayload, 'hotState');\n isSyncListening = true;\n nextTick().then(() => {\n isListening = true;\n });\n for (const actionName in newStore._hmrPayload.actions) {\n const actionFn = newStore[actionName];\n set(store, actionName, action(actionFn, actionName));\n }\n // TODO: does this work in both setup and option store?\n for (const getterName in newStore._hmrPayload.getters) {\n const getter = newStore._hmrPayload.getters[getterName];\n const getterValue = isOptionsStore\n ? // special handling of options api\n computed(() => {\n setActivePinia(pinia);\n return getter.call(store, store);\n })\n : getter;\n set(store, getterName, getterValue);\n }\n // remove deleted getters\n Object.keys(store._hmrPayload.getters).forEach((key) => {\n if (!(key in newStore._hmrPayload.getters)) {\n del(store, key);\n }\n });\n // remove old actions\n Object.keys(store._hmrPayload.actions).forEach((key) => {\n if (!(key in newStore._hmrPayload.actions)) {\n del(store, key);\n }\n });\n // update the values used in devtools and to allow deleting new properties later on\n store._hmrPayload = newStore._hmrPayload;\n store._getters = newStore._getters;\n store._hotUpdating = false;\n });\n }\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const nonEnumerable = {\n writable: true,\n configurable: true,\n // avoid warning on devtools trying to display this property\n enumerable: false,\n };\n ['_p', '_hmrPayload', '_getters', '_customProperties'].forEach((p) => {\n Object.defineProperty(store, p, assign({ value: store[p] }, nonEnumerable));\n });\n }\n /* istanbul ignore if */\n if (isVue2) {\n // mark the store as ready before plugins\n store._r = true;\n }\n // apply all plugins\n pinia._p.forEach((extender) => {\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const extensions = scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n }));\n Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));\n assign(store, extensions);\n }\n else {\n assign(store, scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n })));\n }\n });\n if ((process.env.NODE_ENV !== 'production') &&\n store.$state &&\n typeof store.$state === 'object' &&\n typeof store.$state.constructor === 'function' &&\n !store.$state.constructor.toString().includes('[native code]')) {\n console.warn(`[🍍]: The \"state\" must be a plain object. It cannot be\\n` +\n `\\tstate: () => new MyClass()\\n` +\n `Found in store \"${store.$id}\".`);\n }\n // only apply hydrate to option stores with an initial state in pinia\n if (initialState &&\n isOptionsStore &&\n options.hydrate) {\n options.hydrate(store.$state, initialState);\n }\n isListening = true;\n isSyncListening = true;\n return store;\n}\n// allows unused stores to be tree shaken\n/*! #__NO_SIDE_EFFECTS__ */\nfunction defineStore(\n// TODO: add proper types from above\nidOrOptions, setup, setupOptions) {\n let id;\n let options;\n const isSetupStore = typeof setup === 'function';\n if (typeof idOrOptions === 'string') {\n id = idOrOptions;\n // the option store setup will contain the actual options in this case\n options = isSetupStore ? setupOptions : setup;\n }\n else {\n options = idOrOptions;\n id = idOrOptions.id;\n if ((process.env.NODE_ENV !== 'production') && typeof id !== 'string') {\n throw new Error(`[🍍]: \"defineStore()\" must be passed a store id as its first argument.`);\n }\n }\n function useStore(pinia, hot) {\n const hasContext = hasInjectionContext();\n pinia =\n // in test mode, ignore the argument provided as we can always retrieve a\n // pinia instance with getActivePinia()\n ((process.env.NODE_ENV === 'test') && activePinia && activePinia._testing ? null : pinia) ||\n (hasContext ? inject(piniaSymbol, null) : null);\n if (pinia)\n setActivePinia(pinia);\n if ((process.env.NODE_ENV !== 'production') && !activePinia) {\n throw new Error(`[🍍]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\\n` +\n `See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\\n` +\n `This will fail in production.`);\n }\n pinia = activePinia;\n if (!pinia._s.has(id)) {\n // creating the store registers it in `pinia._s`\n if (isSetupStore) {\n createSetupStore(id, setup, options, pinia);\n }\n else {\n createOptionsStore(id, options, pinia);\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n // @ts-expect-error: not the right inferred type\n useStore._pinia = pinia;\n }\n }\n const store = pinia._s.get(id);\n if ((process.env.NODE_ENV !== 'production') && hot) {\n const hotId = '__hot:' + id;\n const newStore = isSetupStore\n ? createSetupStore(hotId, setup, options, pinia, true)\n : createOptionsStore(hotId, assign({}, options), pinia, true);\n hot._hotUpdate(newStore);\n // cleanup the state properties and the store from the cache\n delete pinia.state.value[hotId];\n pinia._s.delete(hotId);\n }\n if ((process.env.NODE_ENV !== 'production') && IS_CLIENT) {\n const currentInstance = getCurrentInstance();\n // save stores in instances to access them devtools\n if (currentInstance &&\n currentInstance.proxy &&\n // avoid adding stores that are just built for hot module replacement\n !hot) {\n const vm = currentInstance.proxy;\n const cache = '_pStores' in vm ? vm._pStores : (vm._pStores = {});\n cache[id] = store;\n }\n }\n // StoreGeneric cannot be casted towards Store\n return store;\n }\n useStore.$id = id;\n return useStore;\n}\n\nlet mapStoreSuffix = 'Store';\n/**\n * Changes the suffix added by `mapStores()`. Can be set to an empty string.\n * Defaults to `\"Store\"`. Make sure to extend the MapStoresCustomization\n * interface if you are using TypeScript.\n *\n * @param suffix - new suffix\n */\nfunction setMapStoreSuffix(suffix // could be 'Store' but that would be annoying for JS\n) {\n mapStoreSuffix = suffix;\n}\n/**\n * Allows using stores without the composition API (`setup()`) by generating an\n * object to be spread in the `computed` field of a component. It accepts a list\n * of store definitions.\n *\n * @example\n * ```js\n * export default {\n * computed: {\n * // other computed properties\n * ...mapStores(useUserStore, useCartStore)\n * },\n *\n * created() {\n * this.userStore // store with id \"user\"\n * this.cartStore // store with id \"cart\"\n * }\n * }\n * ```\n *\n * @param stores - list of stores to map to an object\n */\nfunction mapStores(...stores) {\n if ((process.env.NODE_ENV !== 'production') && Array.isArray(stores[0])) {\n console.warn(`[🍍]: Directly pass all stores to \"mapStores()\" without putting them in an array:\\n` +\n `Replace\\n` +\n `\\tmapStores([useAuthStore, useCartStore])\\n` +\n `with\\n` +\n `\\tmapStores(useAuthStore, useCartStore)\\n` +\n `This will fail in production if not fixed.`);\n stores = stores[0];\n }\n return stores.reduce((reduced, useStore) => {\n // @ts-expect-error: $id is added by defineStore\n reduced[useStore.$id + mapStoreSuffix] = function () {\n return useStore(this.$pinia);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = function () {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key];\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function () {\n const store = useStore(this.$pinia);\n const storeKey = keysOrMapper[key];\n // for some reason TS is unable to infer the type of storeKey to be a\n // function\n return typeof storeKey === 'function'\n ? storeKey.call(this, store)\n : // @ts-expect-error: FIXME: should work?\n store[storeKey];\n };\n return reduced;\n }, {});\n}\n/**\n * Alias for `mapState()`. You should use `mapState()` instead.\n * @deprecated use `mapState()` instead.\n */\nconst mapGetters = mapState;\n/**\n * Allows directly using actions from your store without using the composition\n * API (`setup()`) by generating an object to be spread in the `methods` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapActions(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key](...args);\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[keysOrMapper[key]](...args);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapWritableState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = {\n get() {\n return useStore(this.$pinia)[key];\n },\n set(value) {\n return (useStore(this.$pinia)[key] = value);\n },\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n reduced[key] = {\n get() {\n return useStore(this.$pinia)[keysOrMapper[key]];\n },\n set(value) {\n return (useStore(this.$pinia)[keysOrMapper[key]] = value);\n },\n };\n return reduced;\n }, {});\n}\n\n/**\n * Creates an object of references with all the state, getters, and plugin-added\n * state properties of the store. Similar to `toRefs()` but specifically\n * designed for Pinia stores so methods and non reactive properties are\n * completely ignored.\n *\n * @param store - store to extract the refs from\n */\nfunction storeToRefs(store) {\n // See https://github.com/vuejs/pinia/issues/852\n // It's easier to just use toRefs() even if it includes more stuff\n if (isVue2) {\n // @ts-expect-error: toRefs include methods and others\n return toRefs(store);\n }\n else {\n const rawStore = toRaw(store);\n const refs = {};\n for (const key in rawStore) {\n const value = rawStore[key];\n // There is no native method to check for a computed\n // https://github.com/vuejs/core/pull/4165\n if (value.effect) {\n // @ts-expect-error: too hard to type correctly\n refs[key] =\n // ...\n computed({\n get: () => store[key],\n set(value) {\n store[key] = value;\n },\n });\n }\n else if (isRef(value) || isReactive(value)) {\n // @ts-expect-error: the key is state or getter\n refs[key] =\n // ---\n toRef(store, key);\n }\n }\n return refs;\n }\n}\n\n/**\n * Vue 2 Plugin that must be installed for pinia to work. Note **you don't need\n * this plugin if you are using Nuxt.js**. Use the `buildModule` instead:\n * https://pinia.vuejs.org/ssr/nuxt.html.\n *\n * @example\n * ```js\n * import Vue from 'vue'\n * import { PiniaVuePlugin, createPinia } from 'pinia'\n *\n * Vue.use(PiniaVuePlugin)\n * const pinia = createPinia()\n *\n * new Vue({\n * el: '#app',\n * // ...\n * pinia,\n * })\n * ```\n *\n * @param _Vue - `Vue` imported from 'vue'.\n */\nconst PiniaVuePlugin = function (_Vue) {\n // Equivalent of\n // app.config.globalProperties.$pinia = pinia\n _Vue.mixin({\n beforeCreate() {\n const options = this.$options;\n if (options.pinia) {\n const pinia = options.pinia;\n // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/main/src/apis/inject.ts#L31\n /* istanbul ignore else */\n if (!this._provided) {\n const provideCache = {};\n Object.defineProperty(this, '_provided', {\n get: () => provideCache,\n set: (v) => Object.assign(provideCache, v),\n });\n }\n this._provided[piniaSymbol] = pinia;\n // propagate the pinia instance in an SSR friendly way\n // avoid adding it to nuxt twice\n /* istanbul ignore else */\n if (!this.$pinia) {\n this.$pinia = pinia;\n }\n pinia._a = this;\n if (IS_CLIENT) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n }\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n registerPiniaDevtools(pinia._a, pinia);\n }\n }\n else if (!this.$pinia && options.parent && options.parent.$pinia) {\n this.$pinia = options.parent.$pinia;\n }\n },\n destroyed() {\n delete this._pStores;\n },\n });\n};\n\nexport { MutationType, PiniaVuePlugin, acceptHMRUpdate, createPinia, defineStore, disposePinia, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, shouldHydrate, skipHydrate, storeToRefs };\n","import { defineStore } from 'pinia'\nimport { ref } from 'vue'\n\nexport const useDataStore = defineStore('data', () => {\n\tconst records = ref<Record<string, any>[]>([])\n\tconst record = ref<Record<string, any>>({})\n\treturn { records, record }\n})\n","import { inject, onMounted, Ref, ref } from 'vue'\n\nimport Registry from './registry'\nimport { Stonecrop } from './stonecrop'\nimport { useDataStore } from './stores/data'\n\n/**\n * Stonecrop composable return type\n * @public\n */\nexport type StonecropReturn = {\n\tstonecrop: Ref<Stonecrop | undefined>\n}\n\n/**\n * Stonecrop composable\n * @param registry - An existing Stonecrop Registry instance\n * @returns The Stonecrop instance and a boolean indicating if Stonecrop is setup and ready\n * @throws Error if the Stonecrop plugin is not enabled before using the composable\n * @public\n */\nexport function useStonecrop(registry?: Registry): StonecropReturn {\n\tconst stonecrop = ref<Stonecrop>()\n\n\tonMounted(async () => {\n\t\tif (!registry) {\n\t\t\tregistry = inject<Registry>('$registry')\n\t\t}\n\n\t\tlet store: ReturnType<typeof useDataStore>\n\t\ttry {\n\t\t\tstore = useDataStore()\n\t\t} catch (e) {\n\t\t\tthrow new Error('Please enable the Stonecrop plugin before using the Stonecrop composable')\n\t\t}\n\n\t\t// @ts-expect-error TODO: handle empty registry passed to Stonecrop\n\t\tstonecrop.value = new Stonecrop(registry, store)\n\n\t\tif (!registry || !registry.router) return\n\n\t\tconst route = registry.router.currentRoute.value\n\t\tconst doctypeSlug = route.params.records?.toString().toLowerCase()\n\t\tconst recordId = route.params.record?.toString().toLowerCase()\n\n\t\t// TODO: handle views other than list and form views?\n\t\tif (!doctypeSlug && !recordId) {\n\t\t\treturn\n\t\t}\n\n\t\t// setup doctype via registry\n\t\tconst doctype = await registry.getMeta?.(doctypeSlug)\n\t\tif (doctype) {\n\t\t\tregistry.addDoctype(doctype)\n\t\t\tstonecrop.value.setup(doctype)\n\n\t\t\tif (doctypeSlug) {\n\t\t\t\tif (recordId) {\n\t\t\t\t\tawait stonecrop.value.getRecord(doctype, recordId)\n\t\t\t\t} else {\n\t\t\t\t\tawait stonecrop.value.getRecords(doctype)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tstonecrop.value.runAction(doctype, 'LOAD', recordId ? [recordId] : undefined)\n\t\t}\n\t})\n\n\treturn { stonecrop }\n}\n","import { Component } from 'vue'\n\nimport type { ImmutableDoctype } from './types'\n\n/**\n * Doctype Meta class\n * @public\n */\nexport default class DoctypeMeta {\n\t/**\n\t * The doctype name\n\t * @public\n\t * @readonly\n\t */\n\treadonly doctype: string\n\n\t/**\n\t * The doctype schema\n\t * @public\n\t * @readonly\n\t */\n\treadonly schema: ImmutableDoctype['schema']\n\n\t/**\n\t * The doctype workflow\n\t * @public\n\t * @readonly\n\t */\n\treadonly workflow: ImmutableDoctype['workflow']\n\n\t/**\n\t * The doctype actions\n\t * @public\n\t * @readonly\n\t */\n\treadonly actions: ImmutableDoctype['actions']\n\n\t/**\n\t * The doctype component\n\t * @public\n\t * @readonly\n\t */\n\treadonly component?: Component\n\t// TODO: allow different components for different views; probably\n\t// should be defined in the schema instead?\n\n\tconstructor(\n\t\tdoctype: string,\n\t\tschema: ImmutableDoctype['schema'],\n\t\tworkflow: ImmutableDoctype['workflow'],\n\t\tactions: ImmutableDoctype['actions'],\n\t\tcomponent?: Component\n\t) {\n\t\tthis.doctype = doctype\n\t\tthis.schema = schema\n\t\tthis.workflow = workflow\n\t\tthis.actions = actions\n\t\tthis.component = component\n\t}\n\n\t/**\n\t * Converts the registered doctype to a slug (kebab-case)\n\t * @returns The slugified doctype string\n\t * @public\n\t */\n\tget slug() {\n\t\treturn this.doctype\n\t\t\t.replace(/([a-z])([A-Z])/g, '$1-$2')\n\t\t\t.replace(/[\\s_]+/g, '-')\n\t\t\t.toLowerCase()\n\t}\n}\n","import { Router } from 'vue-router'\n\nimport DoctypeMeta from './doctype'\n\n/**\n * Stonecrop Registry class\n * @public\n */\nexport default class Registry {\n\t/**\n\t * The root Registry instance\n\t */\n\tstatic _root: Registry\n\n\t/**\n\t * The name of the Registry instance\n\t *\n\t * @defaultValue 'Registry'\n\t */\n\tname: string\n\n\t/**\n\t * The registry property contains a collection of doctypes\n\t * @see {@link DoctypeMeta}\n\t */\n\tregistry: Record<string, DoctypeMeta>\n\n\t/**\n\t * The Vue router instance\n\t * @see {@link https://router.vuejs.org/}\n\t */\n\trouter?: Router\n\n\t/**\n\t * The getMeta function fetches doctype metadata from an API\n\t * @see {@link DoctypeMeta}\n\t */\n\tgetMeta?: (doctype: string) => DoctypeMeta | Promise<DoctypeMeta>\n\n\tconstructor(router?: Router, getMeta?: (doctype: string) => DoctypeMeta | Promise<DoctypeMeta>) {\n\t\tif (Registry._root) {\n\t\t\treturn Registry._root\n\t\t}\n\t\tRegistry._root = this\n\t\tthis.name = 'Registry'\n\t\tthis.registry = {}\n\t\tthis.router = router\n\t\tthis.getMeta = getMeta\n\t}\n\n\t/**\n\t * Get doctype metadata\n\t * @param doctype - The doctype to fetch metadata for\n\t * @returns The doctype metadata\n\t * @see {@link DoctypeMeta}\n\t */\n\taddDoctype(doctype: DoctypeMeta) {\n\t\tif (!(doctype.doctype in Object.keys(this.registry))) {\n\t\t\tthis.registry[doctype.slug] = doctype\n\t\t}\n\n\t\tif (doctype.component && this.router && !this.router.hasRoute(doctype.doctype)) {\n\t\t\tthis.router.addRoute({\n\t\t\t\tpath: `/${doctype.slug}`,\n\t\t\t\tname: doctype.slug,\n\t\t\t\tcomponent: doctype.component,\n\t\t\t})\n\t\t}\n\t}\n}\n","/**\n * returns true if the given object is a promise\n */\nexport function isPromise(obj) {\n return obj && typeof obj.then === 'function';\n}\nexport var PROMISE_RESOLVED_FALSE = Promise.resolve(false);\nexport var PROMISE_RESOLVED_TRUE = Promise.resolve(true);\nexport var PROMISE_RESOLVED_VOID = Promise.resolve();\nexport function sleep(time, resolveWith) {\n if (!time) time = 0;\n return new Promise(function (res) {\n return setTimeout(function () {\n return res(resolveWith);\n }, time);\n });\n}\nexport function randomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\n\n/**\n * https://stackoverflow.com/a/8084248\n */\nexport function randomToken() {\n return Math.random().toString(36).substring(2);\n}\nvar lastMs = 0;\nvar additional = 0;\n\n/**\n * returns the current time in micro-seconds,\n * WARNING: This is a pseudo-function\n * Performance.now is not reliable in webworkers, so we just make sure to never return the same time.\n * This is enough in browsers, and this function will not be used in nodejs.\n * The main reason for this hack is to ensure that BroadcastChannel behaves equal to production when it is used in fast-running unit tests.\n */\nexport function microSeconds() {\n var ms = new Date().getTime();\n if (ms === lastMs) {\n additional++;\n return ms * 1000 + additional;\n } else {\n lastMs = ms;\n additional = 0;\n return ms * 1000;\n }\n}","import { microSeconds as micro, PROMISE_RESOLVED_VOID } from '../util.js';\nexport var microSeconds = micro;\nexport var type = 'native';\nexport function create(channelName) {\n var state = {\n messagesCallback: null,\n bc: new BroadcastChannel(channelName),\n subFns: [] // subscriberFunctions\n };\n\n state.bc.onmessage = function (msg) {\n if (state.messagesCallback) {\n state.messagesCallback(msg.data);\n }\n };\n return state;\n}\nexport function close(channelState) {\n channelState.bc.close();\n channelState.subFns = [];\n}\nexport function postMessage(channelState, messageJson) {\n try {\n channelState.bc.postMessage(messageJson, false);\n return PROMISE_RESOLVED_VOID;\n } catch (err) {\n return Promise.reject(err);\n }\n}\nexport function onMessage(channelState, fn) {\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n if (typeof window === 'undefined') {\n return false;\n }\n if (typeof BroadcastChannel === 'function') {\n if (BroadcastChannel._pubkey) {\n throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');\n }\n return true;\n } else {\n return false;\n }\n}\nexport function averageResponseTime() {\n return 150;\n}\nexport var NativeMethod = {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};","/**\n * this is a set which automatically forgets\n * a given entry when a new entry is set and the ttl\n * of the old one is over\n */\nvar ObliviousSet = /** @class */ (function () {\n function ObliviousSet(ttl) {\n this.ttl = ttl;\n this.map = new Map();\n /**\n * Creating calls to setTimeout() is expensive,\n * so we only do that if there is not timeout already open.\n */\n this._to = false;\n }\n ObliviousSet.prototype.has = function (value) {\n return this.map.has(value);\n };\n ObliviousSet.prototype.add = function (value) {\n var _this = this;\n this.map.set(value, now());\n /**\n * When a new value is added,\n * start the cleanup at the next tick\n * to not block the cpu for more important stuff\n * that might happen.\n */\n if (!this._to) {\n this._to = true;\n setTimeout(function () {\n _this._to = false;\n removeTooOldValues(_this);\n }, 0);\n }\n };\n ObliviousSet.prototype.clear = function () {\n this.map.clear();\n };\n return ObliviousSet;\n}());\nexport { ObliviousSet };\n/**\n * Removes all entries from the set\n * where the TTL has expired\n */\nexport function removeTooOldValues(obliviousSet) {\n var olderThen = now() - obliviousSet.ttl;\n var iterator = obliviousSet.map[Symbol.iterator]();\n /**\n * Because we can assume the new values are added at the bottom,\n * we start from the top and stop as soon as we reach a non-too-old value.\n */\n while (true) {\n var next = iterator.next().value;\n if (!next) {\n return; // no more elements\n }\n var value = next[0];\n var time = next[1];\n if (time < olderThen) {\n obliviousSet.map.delete(value);\n }\n else {\n // We reached a value that is not old enough\n return;\n }\n }\n}\nexport function now() {\n return new Date().getTime();\n}\n//# sourceMappingURL=index.js.map","export function fillOptionsWithDefaults() {\n var originalOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = JSON.parse(JSON.stringify(originalOptions));\n\n // main\n if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true;\n\n // indexed-db\n if (!options.idb) options.idb = {};\n // after this time the messages get deleted\n if (!options.idb.ttl) options.idb.ttl = 1000 * 45;\n if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 150;\n // handles abrupt db onclose events.\n if (originalOptions.idb && typeof originalOptions.idb.onclose === 'function') options.idb.onclose = originalOptions.idb.onclose;\n\n // localstorage\n if (!options.localstorage) options.localstorage = {};\n if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60;\n\n // custom methods\n if (originalOptions.methods) options.methods = originalOptions.methods;\n\n // node\n if (!options.node) options.node = {};\n if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes;\n /**\n * On linux use 'ulimit -Hn' to get the limit of open files.\n * On ubuntu this was 4096 for me, so we use half of that as maxParallelWrites default.\n */\n if (!options.node.maxParallelWrites) options.node.maxParallelWrites = 2048;\n if (typeof options.node.useFastPath === 'undefined') options.node.useFastPath = true;\n return options;\n}","/**\n * this method uses indexeddb to store the messages\n * There is currently no observerAPI for idb\n * @link https://github.com/w3c/IndexedDB/issues/51\n * \n * When working on this, ensure to use these performance optimizations:\n * @link https://rxdb.info/slow-indexeddb.html\n */\n\nimport { sleep, randomInt, randomToken, microSeconds as micro, PROMISE_RESOLVED_VOID } from '../util.js';\nexport var microSeconds = micro;\nimport { ObliviousSet } from 'oblivious-set';\nimport { fillOptionsWithDefaults } from '../options.js';\nvar DB_PREFIX = 'pubkey.broadcast-channel-0-';\nvar OBJECT_STORE_ID = 'messages';\n\n/**\n * Use relaxed durability for faster performance on all transactions.\n * @link https://nolanlawson.com/2021/08/22/speeding-up-indexeddb-reads-and-writes/\n */\nexport var TRANSACTION_SETTINGS = {\n durability: 'relaxed'\n};\nexport var type = 'idb';\nexport function getIdb() {\n if (typeof indexedDB !== 'undefined') return indexedDB;\n if (typeof window !== 'undefined') {\n if (typeof window.mozIndexedDB !== 'undefined') return window.mozIndexedDB;\n if (typeof window.webkitIndexedDB !== 'undefined') return window.webkitIndexedDB;\n if (typeof window.msIndexedDB !== 'undefined') return window.msIndexedDB;\n }\n return false;\n}\n\n/**\n * If possible, we should explicitly commit IndexedDB transactions\n * for better performance.\n * @link https://nolanlawson.com/2021/08/22/speeding-up-indexeddb-reads-and-writes/\n */\nexport function commitIndexedDBTransaction(tx) {\n if (tx.commit) {\n tx.commit();\n }\n}\nexport function createDatabase(channelName) {\n var IndexedDB = getIdb();\n\n // create table\n var dbName = DB_PREFIX + channelName;\n\n /**\n * All IndexedDB databases are opened without version\n * because it is a bit faster, especially on firefox\n * @link http://nparashuram.com/IndexedDB/perf/#Open%20Database%20with%20version\n */\n var openRequest = IndexedDB.open(dbName);\n openRequest.onupgradeneeded = function (ev) {\n var db = ev.target.result;\n db.createObjectStore(OBJECT_STORE_ID, {\n keyPath: 'id',\n autoIncrement: true\n });\n };\n return new Promise(function (res, rej) {\n openRequest.onerror = function (ev) {\n return rej(ev);\n };\n openRequest.onsuccess = function () {\n res(openRequest.result);\n };\n });\n}\n\n/**\n * writes the new message to the database\n * so other readers can find it\n */\nexport function writeMessage(db, readerUuid, messageJson) {\n var time = new Date().getTime();\n var writeObject = {\n uuid: readerUuid,\n time: time,\n data: messageJson\n };\n var tx = db.transaction([OBJECT_STORE_ID], 'readwrite', TRANSACTION_SETTINGS);\n return new Promise(function (res, rej) {\n tx.oncomplete = function () {\n return res();\n };\n tx.onerror = function (ev) {\n return rej(ev);\n };\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n objectStore.add(writeObject);\n commitIndexedDBTransaction(tx);\n });\n}\nexport function getAllMessages(db) {\n var tx = db.transaction(OBJECT_STORE_ID, 'readonly', TRANSACTION_SETTINGS);\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n var ret = [];\n return new Promise(function (res) {\n objectStore.openCursor().onsuccess = function (ev) {\n var cursor = ev.target.result;\n if (cursor) {\n ret.push(cursor.value);\n //alert(\"Name for SSN \" + cursor.key + \" is \" + cursor.value.name);\n cursor[\"continue\"]();\n } else {\n commitIndexedDBTransaction(tx);\n res(ret);\n }\n };\n });\n}\nexport function getMessagesHigherThan(db, lastCursorId) {\n var tx = db.transaction(OBJECT_STORE_ID, 'readonly', TRANSACTION_SETTINGS);\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n var ret = [];\n var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity);\n\n /**\n * Optimization shortcut,\n * if getAll() can be used, do not use a cursor.\n * @link https://rxdb.info/slow-indexeddb.html\n */\n if (objectStore.getAll) {\n var getAllRequest = objectStore.getAll(keyRangeValue);\n return new Promise(function (res, rej) {\n getAllRequest.onerror = function (err) {\n return rej(err);\n };\n getAllRequest.onsuccess = function (e) {\n res(e.target.result);\n };\n });\n }\n function openCursor() {\n // Occasionally Safari will fail on IDBKeyRange.bound, this\n // catches that error, having it open the cursor to the first\n // item. When it gets data it will advance to the desired key.\n try {\n keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity);\n return objectStore.openCursor(keyRangeValue);\n } catch (e) {\n return objectStore.openCursor();\n }\n }\n return new Promise(function (res, rej) {\n var openCursorRequest = openCursor();\n openCursorRequest.onerror = function (err) {\n return rej(err);\n };\n openCursorRequest.onsuccess = function (ev) {\n var cursor = ev.target.result;\n if (cursor) {\n if (cursor.value.id < lastCursorId + 1) {\n cursor[\"continue\"](lastCursorId + 1);\n } else {\n ret.push(cursor.value);\n cursor[\"continue\"]();\n }\n } else {\n commitIndexedDBTransaction(tx);\n res(ret);\n }\n };\n });\n}\nexport function removeMessagesById(channelState, ids) {\n if (channelState.closed) {\n return Promise.resolve([]);\n }\n var tx = channelState.db.transaction(OBJECT_STORE_ID, 'readwrite', TRANSACTION_SETTINGS);\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n return Promise.all(ids.map(function (id) {\n var deleteRequest = objectStore[\"delete\"](id);\n return new Promise(function (res) {\n deleteRequest.onsuccess = function () {\n return res();\n };\n });\n }));\n}\nexport function getOldMessages(db, ttl) {\n var olderThen = new Date().getTime() - ttl;\n var tx = db.transaction(OBJECT_STORE_ID, 'readonly', TRANSACTION_SETTINGS);\n var objectStore = tx.objectStore(OBJECT_STORE_ID);\n var ret = [];\n return new Promise(function (res) {\n objectStore.openCursor().onsuccess = function (ev) {\n var cursor = ev.target.result;\n if (cursor) {\n var msgObk = cursor.value;\n if (msgObk.time < olderThen) {\n ret.push(msgObk);\n //alert(\"Name for SSN \" + cursor.key + \" is \" + cursor.value.name);\n cursor[\"continue\"]();\n } else {\n // no more old messages,\n commitIndexedDBTransaction(tx);\n res(ret);\n }\n } else {\n res(ret);\n }\n };\n });\n}\nexport function cleanOldMessages(channelState) {\n return getOldMessages(channelState.db, channelState.options.idb.ttl).then(function (tooOld) {\n return removeMessagesById(channelState, tooOld.map(function (msg) {\n return msg.id;\n }));\n });\n}\nexport function create(channelName, options) {\n options = fillOptionsWithDefaults(options);\n return createDatabase(channelName).then(function (db) {\n var state = {\n closed: false,\n lastCursorId: 0,\n channelName: channelName,\n options: options,\n uuid: randomToken(),\n /**\n * emittedMessagesIds\n * contains all messages that have been emitted before\n * @type {ObliviousSet}\n */\n eMIs: new ObliviousSet(options.idb.ttl * 2),\n // ensures we do not read messages in parallel\n writeBlockPromise: PROMISE_RESOLVED_VOID,\n messagesCallback: null,\n readQueuePromises: [],\n db: db\n };\n\n /**\n * Handle abrupt closes that do not originate from db.close().\n * This could happen, for example, if the underlying storage is\n * removed or if the user clears the database in the browser's\n * history preferences.\n */\n db.onclose = function () {\n state.closed = true;\n if (options.idb.onclose) options.idb.onclose();\n };\n\n /**\n * if service-workers are used,\n * we have no 'storage'-event if they post a message,\n * therefore we also have to set an interval\n */\n _readLoop(state);\n return state;\n });\n}\nfunction _readLoop(state) {\n if (state.closed) return;\n readNewMessages(state).then(function () {\n return sleep(state.options.idb.fallbackInterval);\n }).then(function () {\n return _readLoop(state);\n });\n}\nfunction _filterMessage(msgObj, state) {\n if (msgObj.uuid === state.uuid) return false; // send by own\n if (state.eMIs.has(msgObj.id)) return false; // already emitted\n if (msgObj.data.time < state.messagesCallbackTime) return false; // older then onMessageCallback\n return true;\n}\n\n/**\n * reads all new messages from the database and emits them\n */\nfunction readNewMessages(state) {\n // channel already closed\n if (state.closed) return PROMISE_RESOLVED_VOID;\n\n // if no one is listening, we do not need to scan for new messages\n if (!state.messagesCallback) return PROMISE_RESOLVED_VOID;\n return getMessagesHigherThan(state.db, state.lastCursorId).then(function (newerMessages) {\n var useMessages = newerMessages\n /**\n * there is a bug in iOS where the msgObj can be undefined sometimes\n * so we filter them out\n * @link https://github.com/pubkey/broadcast-channel/issues/19\n */.filter(function (msgObj) {\n return !!msgObj;\n }).map(function (msgObj) {\n if (msgObj.id > state.lastCursorId) {\n state.lastCursorId = msgObj.id;\n }\n return msgObj;\n }).filter(function (msgObj) {\n return _filterMessage(msgObj, state);\n }).sort(function (msgObjA, msgObjB) {\n return msgObjA.time - msgObjB.time;\n }); // sort by time\n useMessages.forEach(function (msgObj) {\n if (state.messagesCallback) {\n state.eMIs.add(msgObj.id);\n state.messagesCallback(msgObj.data);\n }\n });\n return PROMISE_RESOLVED_VOID;\n });\n}\nexport function close(channelState) {\n channelState.closed = true;\n channelState.db.close();\n}\nexport function postMessage(channelState, messageJson) {\n channelState.writeBlockPromise = channelState.writeBlockPromise.then(function () {\n return writeMessage(channelState.db, channelState.uuid, messageJson);\n }).then(function () {\n if (randomInt(0, 10) === 0) {\n /* await (do not await) */\n cleanOldMessages(channelState);\n }\n });\n return channelState.writeBlockPromise;\n}\nexport function onMessage(channelState, fn, time) {\n channelState.messagesCallbackTime = time;\n channelState.messagesCallback = fn;\n readNewMessages(channelState);\n}\nexport function canBeUsed() {\n return !!getIdb();\n}\nexport function averageResponseTime(options) {\n return options.idb.fallbackInterval * 2;\n}\nexport var IndexedDBMethod = {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};","/**\n * A localStorage-only method which uses localstorage and its 'storage'-event\n * This does not work inside webworkers because they have no access to localstorage\n * This is basically implemented to support IE9 or your grandmother's toaster.\n * @link https://caniuse.com/#feat=namevalue-storage\n * @link https://caniuse.com/#feat=indexeddb\n */\n\nimport { ObliviousSet } from 'oblivious-set';\nimport { fillOptionsWithDefaults } from '../options.js';\nimport { sleep, randomToken, microSeconds as micro } from '../util.js';\nexport var microSeconds = micro;\nvar KEY_PREFIX = 'pubkey.broadcastChannel-';\nexport var type = 'localstorage';\n\n/**\n * copied from crosstab\n * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32\n */\nexport function getLocalStorage() {\n var localStorage;\n if (typeof window === 'undefined') return null;\n try {\n localStorage = window.localStorage;\n localStorage = window['ie8-eventlistener/storage'] || window.localStorage;\n } catch (e) {\n // New versions of Firefox throw a Security exception\n // if cookies are disabled. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153\n }\n return localStorage;\n}\nexport function storageKey(channelName) {\n return KEY_PREFIX + channelName;\n}\n\n/**\n* writes the new message to the storage\n* and fires the storage-event so other readers can find it\n*/\nexport function postMessage(channelState, messageJson) {\n return new Promise(function (res) {\n sleep().then(function () {\n var key = storageKey(channelState.channelName);\n var writeObj = {\n token: randomToken(),\n time: new Date().getTime(),\n data: messageJson,\n uuid: channelState.uuid\n };\n var value = JSON.stringify(writeObj);\n getLocalStorage().setItem(key, value);\n\n /**\n * StorageEvent does not fire the 'storage' event\n * in the window that changes the state of the local storage.\n * So we fire it manually\n */\n var ev = document.createEvent('Event');\n ev.initEvent('storage', true, true);\n ev.key = key;\n ev.newValue = value;\n window.dispatchEvent(ev);\n res();\n });\n });\n}\nexport function addStorageEventListener(channelName, fn) {\n var key = storageKey(channelName);\n var listener = function listener(ev) {\n if (ev.key === key) {\n fn(JSON.parse(ev.newValue));\n }\n };\n window.addEventListener('storage', listener);\n return listener;\n}\nexport function removeStorageEventListener(listener) {\n window.removeEventListener('storage', listener);\n}\nexport function create(channelName, options) {\n options = fillOptionsWithDefaults(options);\n if (!canBeUsed()) {\n throw new Error('BroadcastChannel: localstorage cannot be used');\n }\n var uuid = randomToken();\n\n /**\n * eMIs\n * contains all messages that have been emitted before\n * @type {ObliviousSet}\n */\n var eMIs = new ObliviousSet(options.localstorage.removeTimeout);\n var state = {\n channelName: channelName,\n uuid: uuid,\n eMIs: eMIs // emittedMessagesIds\n };\n\n state.listener = addStorageEventListener(channelName, function (msgObj) {\n if (!state.messagesCallback) return; // no listener\n if (msgObj.uuid === uuid) return; // own message\n if (!msgObj.token || eMIs.has(msgObj.token)) return; // already emitted\n if (msgObj.data.time && msgObj.data.time < state.messagesCallbackTime) return; // too old\n\n eMIs.add(msgObj.token);\n state.messagesCallback(msgObj.data);\n });\n return state;\n}\nexport function close(channelState) {\n removeStorageEventListener(channelState.listener);\n}\nexport function onMessage(channelState, fn, time) {\n channelState.messagesCallbackTime = time;\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n var ls = getLocalStorage();\n if (!ls) return false;\n try {\n var key = '__broadcastchannel_check';\n ls.setItem(key, 'works');\n ls.removeItem(key);\n } catch (e) {\n // Safari 10 in private mode will not allow write access to local\n // storage and fail with a QuotaExceededError. See\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API#Private_Browsing_Incognito_modes\n return false;\n }\n return true;\n}\nexport function averageResponseTime() {\n var defaultTime = 120;\n var userAgent = navigator.userAgent.toLowerCase();\n if (userAgent.includes('safari') && !userAgent.includes('chrome')) {\n // safari is much slower so this time is higher\n return defaultTime * 2;\n }\n return defaultTime;\n}\nexport var LocalstorageMethod = {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};","import { microSeconds as micro } from '../util.js';\nexport var microSeconds = micro;\nexport var type = 'simulate';\nvar SIMULATE_CHANNELS = new Set();\nexport function create(channelName) {\n var state = {\n name: channelName,\n messagesCallback: null\n };\n SIMULATE_CHANNELS.add(state);\n return state;\n}\nexport function close(channelState) {\n SIMULATE_CHANNELS[\"delete\"](channelState);\n}\nexport function postMessage(channelState, messageJson) {\n return new Promise(function (res) {\n return setTimeout(function () {\n var channelArray = Array.from(SIMULATE_CHANNELS);\n channelArray.filter(function (channel) {\n return channel.name === channelState.name;\n }).filter(function (channel) {\n return channel !== channelState;\n }).filter(function (channel) {\n return !!channel.messagesCallback;\n }).forEach(function (channel) {\n return channel.messagesCallback(messageJson);\n });\n res();\n }, 5);\n });\n}\nexport function onMessage(channelState, fn) {\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n return true;\n}\nexport function averageResponseTime() {\n return 5;\n}\nexport var SimulateMethod = {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};","import { NativeMethod } from './methods/native.js';\nimport { IndexedDBMethod } from './methods/indexed-db.js';\nimport { LocalstorageMethod } from './methods/localstorage.js';\nimport { SimulateMethod } from './methods/simulate.js';\n// the line below will be removed from es5/browser builds\n\n// order is important\nvar METHODS = [NativeMethod,\n// fastest\nIndexedDBMethod, LocalstorageMethod];\nexport function chooseMethod(options) {\n var chooseMethods = [].concat(options.methods, METHODS).filter(Boolean);\n\n // the line below will be removed from es5/browser builds\n\n // directly chosen\n if (options.type) {\n if (options.type === 'simulate') {\n // only use simulate-method if directly chosen\n return SimulateMethod;\n }\n var ret = chooseMethods.find(function (m) {\n return m.type === options.type;\n });\n if (!ret) throw new Error('method-type ' + options.type + ' not found');else return ret;\n }\n\n /**\n * if no webworker support is needed,\n * remove idb from the list so that localstorage will be chosen\n */\n if (!options.webWorkerSupport) {\n chooseMethods = chooseMethods.filter(function (m) {\n return m.type !== 'idb';\n });\n }\n var useMethod = chooseMethods.find(function (method) {\n return method.canBeUsed();\n });\n if (!useMethod) throw new Error(\"No usable method found in \" + JSON.stringify(METHODS.map(function (m) {\n return m.type;\n })));else return useMethod;\n}","import { isPromise, PROMISE_RESOLVED_FALSE, PROMISE_RESOLVED_VOID } from './util.js';\nimport { chooseMethod } from './method-chooser.js';\nimport { fillOptionsWithDefaults } from './options.js';\n\n/**\n * Contains all open channels,\n * used in tests to ensure everything is closed.\n */\nexport var OPEN_BROADCAST_CHANNELS = new Set();\nvar lastId = 0;\nexport var BroadcastChannel = function BroadcastChannel(name, options) {\n // identifier of the channel to debug stuff\n this.id = lastId++;\n OPEN_BROADCAST_CHANNELS.add(this);\n this.name = name;\n if (ENFORCED_OPTIONS) {\n options = ENFORCED_OPTIONS;\n }\n this.options = fillOptionsWithDefaults(options);\n this.method = chooseMethod(this.options);\n\n // isListening\n this._iL = false;\n\n /**\n * _onMessageListener\n * setting onmessage twice,\n * will overwrite the first listener\n */\n this._onML = null;\n\n /**\n * _addEventListeners\n */\n this._addEL = {\n message: [],\n internal: []\n };\n\n /**\n * Unsent message promises\n * where the sending is still in progress\n * @type {Set<Promise>}\n */\n this._uMP = new Set();\n\n /**\n * _beforeClose\n * array of promises that will be awaited\n * before the channel is closed\n */\n this._befC = [];\n\n /**\n * _preparePromise\n */\n this._prepP = null;\n _prepareChannel(this);\n};\n\n// STATICS\n\n/**\n * used to identify if someone overwrites\n * window.BroadcastChannel with this\n * See methods/native.js\n */\nBroadcastChannel._pubkey = true;\n\n/**\n * clears the tmp-folder if is node\n * @return {Promise<boolean>} true if has run, false if not node\n */\nexport function clearNodeFolder(options) {\n options = fillOptionsWithDefaults(options);\n var method = chooseMethod(options);\n if (method.type === 'node') {\n return method.clearNodeFolder().then(function () {\n return true;\n });\n } else {\n return PROMISE_RESOLVED_FALSE;\n }\n}\n\n/**\n * if set, this method is enforced,\n * no mather what the options are\n */\nvar ENFORCED_OPTIONS;\nexport function enforceOptions(options) {\n ENFORCED_OPTIONS = options;\n}\n\n// PROTOTYPE\nBroadcastChannel.prototype = {\n postMessage: function postMessage(msg) {\n if (this.closed) {\n throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed ' +\n /**\n * In the past when this error appeared, it was really hard to debug.\n * So now we log the msg together with the error so it at least\n * gives some clue about where in your application this happens.\n */\n JSON.stringify(msg));\n }\n return _post(this, 'message', msg);\n },\n postInternal: function postInternal(msg) {\n return _post(this, 'internal', msg);\n },\n set onmessage(fn) {\n var time = this.method.microSeconds();\n var listenObj = {\n time: time,\n fn: fn\n };\n _removeListenerObject(this, 'message', this._onML);\n if (fn && typeof fn === 'function') {\n this._onML = listenObj;\n _addListenerObject(this, 'message', listenObj);\n } else {\n this._onML = null;\n }\n },\n addEventListener: function addEventListener(type, fn) {\n var time = this.method.microSeconds();\n var listenObj = {\n time: time,\n fn: fn\n };\n _addListenerObject(this, type, listenObj);\n },\n removeEventListener: function removeEventListener(type, fn) {\n var obj = this._addEL[type].find(function (obj) {\n return obj.fn === fn;\n });\n _removeListenerObject(this, type, obj);\n },\n close: function close() {\n var _this = this;\n if (this.closed) {\n return;\n }\n OPEN_BROADCAST_CHANNELS[\"delete\"](this);\n this.closed = true;\n var awaitPrepare = this._prepP ? this._prepP : PROMISE_RESOLVED_VOID;\n this._onML = null;\n this._addEL.message = [];\n return awaitPrepare\n // wait until all current sending are processed\n .then(function () {\n return Promise.all(Array.from(_this._uMP));\n })\n // run before-close hooks\n .then(function () {\n return Promise.all(_this._befC.map(function (fn) {\n return fn();\n }));\n })\n // close the channel\n .then(function () {\n return _this.method.close(_this._state);\n });\n },\n get type() {\n return this.method.type;\n },\n get isClosed() {\n return this.closed;\n }\n};\n\n/**\n * Post a message over the channel\n * @returns {Promise} that resolved when the message sending is done\n */\nfunction _post(broadcastChannel, type, msg) {\n var time = broadcastChannel.method.microSeconds();\n var msgObj = {\n time: time,\n type: type,\n data: msg\n };\n var awaitPrepare = broadcastChannel._prepP ? broadcastChannel._prepP : PROMISE_RESOLVED_VOID;\n return awaitPrepare.then(function () {\n var sendPromise = broadcastChannel.method.postMessage(broadcastChannel._state, msgObj);\n\n // add/remove to unsent messages list\n broadcastChannel._uMP.add(sendPromise);\n sendPromise[\"catch\"]().then(function () {\n return broadcastChannel._uMP[\"delete\"](sendPromise);\n });\n return sendPromise;\n });\n}\nfunction _prepareChannel(channel) {\n var maybePromise = channel.method.create(channel.name, channel.options);\n if (isPromise(maybePromise)) {\n channel._prepP = maybePromise;\n maybePromise.then(function (s) {\n // used in tests to simulate slow runtime\n /*if (channel.options.prepareDelay) {\n await new Promise(res => setTimeout(res, this.options.prepareDelay));\n }*/\n channel._state = s;\n });\n } else {\n channel._state = maybePromise;\n }\n}\nfunction _hasMessageListeners(channel) {\n if (channel._addEL.message.length > 0) return true;\n if (channel._addEL.internal.length > 0) return true;\n return false;\n}\nfunction _addListenerObject(channel, type, obj) {\n channel._addEL[type].push(obj);\n _startListening(channel);\n}\nfunction _removeListenerObject(channel, type, obj) {\n channel._addEL[type] = channel._addEL[type].filter(function (o) {\n return o !== obj;\n });\n _stopListening(channel);\n}\nfunction _startListening(channel) {\n if (!channel._iL && _hasMessageListeners(channel)) {\n // someone is listening, start subscribing\n\n var listenerFn = function listenerFn(msgObj) {\n channel._addEL[msgObj.type].forEach(function (listenerObject) {\n /**\n * Getting the current time in JavaScript has no good precision.\n * So instead of only listening to events that happened 'after' the listener\n * was added, we also listen to events that happened 100ms before it.\n * This ensures that when another process, like a WebWorker, sends events\n * we do not miss them out because their timestamp is a bit off compared to the main process.\n * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response.\n * @link https://johnresig.com/blog/accuracy-of-javascript-time/\n */\n var hundredMsInMicro = 100 * 1000;\n var minMessageTime = listenerObject.time - hundredMsInMicro;\n if (msgObj.time >= minMessageTime) {\n listenerObject.fn(msgObj.data);\n }\n });\n };\n var time = channel.method.microSeconds();\n if (channel._prepP) {\n channel._prepP.then(function () {\n channel._iL = true;\n channel.method.onMessage(channel._state, listenerFn, time);\n });\n } else {\n channel._iL = true;\n channel.method.onMessage(channel._state, listenerFn, time);\n }\n }\n}\nfunction _stopListening(channel) {\n if (channel._iL && !_hasMessageListeners(channel)) {\n // no one is listening, stop subscribing\n channel._iL = false;\n var time = channel.method.microSeconds();\n channel.method.onMessage(channel._state, null, time);\n }\n}","/** @type {Record<string, string>} */\nexport const escaped = {\n\t'<': '\\\\u003C',\n\t'\\\\': '\\\\\\\\',\n\t'\\b': '\\\\b',\n\t'\\f': '\\\\f',\n\t'\\n': '\\\\n',\n\t'\\r': '\\\\r',\n\t'\\t': '\\\\t',\n\t'\\u2028': '\\\\u2028',\n\t'\\u2029': '\\\\u2029'\n};\n\nexport class DevalueError extends Error {\n\t/**\n\t * @param {string} message\n\t * @param {string[]} keys\n\t */\n\tconstructor(message, keys) {\n\t\tsuper(message);\n\t\tthis.name = 'DevalueError';\n\t\tthis.path = keys.join('');\n\t}\n}\n\n/** @param {any} thing */\nexport function is_primitive(thing) {\n\treturn Object(thing) !== thing;\n}\n\nconst object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(\n\tObject.prototype\n)\n\t.sort()\n\t.join('\\0');\n\n/** @param {any} thing */\nexport function is_plain_object(thing) {\n\tconst proto = Object.getPrototypeOf(thing);\n\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getOwnPropertyNames(proto).sort().join('\\0') === object_proto_names\n\t);\n}\n\n/** @param {any} thing */\nexport function get_type(thing) {\n\treturn Object.prototype.toString.call(thing).slice(8, -1);\n}\n\n/** @param {string} char */\nfunction get_escaped_char(char) {\n\tswitch (char) {\n\t\tcase '\"':\n\t\t\treturn '\\\\\"';\n\t\tcase '<':\n\t\t\treturn '\\\\u003C';\n\t\tcase '\\\\':\n\t\t\treturn '\\\\\\\\';\n\t\tcase '\\n':\n\t\t\treturn '\\\\n';\n\t\tcase '\\r':\n\t\t\treturn '\\\\r';\n\t\tcase '\\t':\n\t\t\treturn '\\\\t';\n\t\tcase '\\b':\n\t\t\treturn '\\\\b';\n\t\tcase '\\f':\n\t\t\treturn '\\\\f';\n\t\tcase '\\u2028':\n\t\t\treturn '\\\\u2028';\n\t\tcase '\\u2029':\n\t\t\treturn '\\\\u2029';\n\t\tdefault:\n\t\t\treturn char < ' '\n\t\t\t\t? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`\n\t\t\t\t: '';\n\t}\n}\n\n/** @param {string} str */\nexport function stringify_string(str) {\n\tlet result = '';\n\tlet last_pos = 0;\n\tconst len = str.length;\n\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst char = str[i];\n\t\tconst replacement = get_escaped_char(char);\n\t\tif (replacement) {\n\t\t\tresult += str.slice(last_pos, i) + replacement;\n\t\t\tlast_pos = i + 1;\n\t\t}\n\t}\n\n\treturn `\"${last_pos === 0 ? str : result + str.slice(last_pos)}\"`;\n}\n","export const UNDEFINED = -1;\nexport const HOLE = -2;\nexport const NAN = -3;\nexport const POSITIVE_INFINITY = -4;\nexport const NEGATIVE_INFINITY = -5;\nexport const NEGATIVE_ZERO = -6;\n","import {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Revive a value serialized with `devalue.stringify`\n * @param {string} serialized\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function parse(serialized, revivers) {\n\treturn unflatten(JSON.parse(serialized), revivers);\n}\n\n/**\n * Revive a value flattened with `devalue.stringify`\n * @param {number | any[]} parsed\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function unflatten(parsed, revivers) {\n\tif (typeof parsed === 'number') return hydrate(parsed, true);\n\n\tif (!Array.isArray(parsed) || parsed.length === 0) {\n\t\tthrow new Error('Invalid input');\n\t}\n\n\tconst values = /** @type {any[]} */ (parsed);\n\n\tconst hydrated = Array(values.length);\n\n\t/**\n\t * @param {number} index\n\t * @returns {any}\n\t */\n\tfunction hydrate(index, standalone = false) {\n\t\tif (index === UNDEFINED) return undefined;\n\t\tif (index === NAN) return NaN;\n\t\tif (index === POSITIVE_INFINITY) return Infinity;\n\t\tif (index === NEGATIVE_INFINITY) return -Infinity;\n\t\tif (index === NEGATIVE_ZERO) return -0;\n\n\t\tif (standalone) throw new Error(`Invalid input`);\n\n\t\tif (index in hydrated) return hydrated[index];\n\n\t\tconst value = values[index];\n\n\t\tif (!value || typeof value !== 'object') {\n\t\t\thydrated[index] = value;\n\t\t} else if (Array.isArray(value)) {\n\t\t\tif (typeof value[0] === 'string') {\n\t\t\t\tconst type = value[0];\n\n\t\t\t\tconst reviver = revivers?.[type];\n\t\t\t\tif (reviver) {\n\t\t\t\t\treturn (hydrated[index] = reviver(hydrate(value[1])));\n\t\t\t\t}\n\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase 'Date':\n\t\t\t\t\t\thydrated[index] = new Date(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Set':\n\t\t\t\t\t\tconst set = new Set();\n\t\t\t\t\t\thydrated[index] = set;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 1) {\n\t\t\t\t\t\t\tset.add(hydrate(value[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Map':\n\t\t\t\t\t\tconst map = new Map();\n\t\t\t\t\t\thydrated[index] = map;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tmap.set(hydrate(value[i]), hydrate(value[i + 1]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'RegExp':\n\t\t\t\t\t\thydrated[index] = new RegExp(value[1], value[2]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Object':\n\t\t\t\t\t\thydrated[index] = Object(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'BigInt':\n\t\t\t\t\t\thydrated[index] = BigInt(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'null':\n\t\t\t\t\t\tconst obj = Object.create(null);\n\t\t\t\t\t\thydrated[index] = obj;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tobj[value[i]] = hydrate(value[i + 1]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error(`Unknown type ${type}`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst array = new Array(value.length);\n\t\t\t\thydrated[index] = array;\n\n\t\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\t\tconst n = value[i];\n\t\t\t\t\tif (n === HOLE) continue;\n\n\t\t\t\t\tarray[i] = hydrate(n);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t/** @type {Record<string, any>} */\n\t\t\tconst object = {};\n\t\t\thydrated[index] = object;\n\n\t\t\tfor (const key in value) {\n\t\t\t\tconst n = value[key];\n\t\t\t\tobject[key] = hydrate(n);\n\t\t\t}\n\t\t}\n\n\t\treturn hydrated[index];\n\t}\n\n\treturn hydrate(0);\n}\n","import {\n\tDevalueError,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_string\n} from './utils.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Turn a value into a JSON string that can be parsed with `devalue.parse`\n * @param {any} value\n * @param {Record<string, (value: any) => any>} [reducers]\n */\nexport function stringify(value, reducers) {\n\t/** @type {any[]} */\n\tconst stringified = [];\n\n\t/** @type {Map<any, number>} */\n\tconst indexes = new Map();\n\n\t/** @type {Array<{ key: string, fn: (value: any) => any }>} */\n\tconst custom = [];\n\tfor (const key in reducers) {\n\t\tcustom.push({ key, fn: reducers[key] });\n\t}\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tlet p = 0;\n\n\t/** @param {any} thing */\n\tfunction flatten(thing) {\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys);\n\t\t}\n\n\t\tif (indexes.has(thing)) return indexes.get(thing);\n\n\t\tif (thing === undefined) return UNDEFINED;\n\t\tif (Number.isNaN(thing)) return NAN;\n\t\tif (thing === Infinity) return POSITIVE_INFINITY;\n\t\tif (thing === -Infinity) return NEGATIVE_INFINITY;\n\t\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;\n\n\t\tconst index = p++;\n\t\tindexes.set(thing, index);\n\n\t\tfor (const { key, fn } of custom) {\n\t\t\tconst value = fn(thing);\n\t\t\tif (value) {\n\t\t\t\tstringified[index] = `[\"${key}\",${flatten(value)}]`;\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\tlet str = '';\n\n\t\tif (is_primitive(thing)) {\n\t\t\tstr = stringify_primitive(thing);\n\t\t} else {\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tstr = `[\"Object\",${stringify_primitive(thing)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'BigInt':\n\t\t\t\t\tstr = `[\"BigInt\",${thing}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tconst valid = !isNaN(thing.getDate());\n\t\t\t\t\tstr = `[\"Date\",\"${valid ? thing.toISOString() : ''}\"]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tconst { source, flags } = thing;\n\t\t\t\t\tstr = flags\n\t\t\t\t\t\t? `[\"RegExp\",${stringify_string(source)},\"${flags}\"]`\n\t\t\t\t\t\t: `[\"RegExp\",${stringify_string(source)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\tstr = '[';\n\n\t\t\t\t\tfor (let i = 0; i < thing.length; i += 1) {\n\t\t\t\t\t\tif (i > 0) str += ',';\n\n\t\t\t\t\t\tif (i in thing) {\n\t\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\t\tstr += flatten(thing[i]);\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tstr = '[\"Set\"';\n\n\t\t\t\t\tfor (const value of thing) {\n\t\t\t\t\t\tstr += `,${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tstr = '[\"Map\"';\n\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstr += `,${flatten(key)},${flatten(value)}`;\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getOwnPropertySymbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getPrototypeOf(thing) === null) {\n\t\t\t\t\t\tstr = '[\"null\"';\n\t\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\t\tstr += `,${stringify_string(key)},${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += ']';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr = '{';\n\t\t\t\t\t\tlet started = false;\n\t\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\t\tif (started) str += ',';\n\t\t\t\t\t\t\tstarted = true;\n\t\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\t\tstr += `${stringify_string(key)}:${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += '}';\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstringified[index] = str;\n\t\treturn index;\n\t}\n\n\tconst index = flatten(value);\n\n\t// special case — value is represented as a negative index\n\tif (index < 0) return `${index}`;\n\n\treturn `[${stringified.join(',')}]`;\n}\n\n/**\n * @param {any} thing\n * @returns {string}\n */\nfunction stringify_primitive(thing) {\n\tconst type = typeof thing;\n\tif (type === 'string') return stringify_string(thing);\n\tif (thing instanceof String) return stringify_string(thing.toString());\n\tif (thing === void 0) return UNDEFINED.toString();\n\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();\n\tif (type === 'bigint') return `[\"BigInt\",\"${thing}\"]`;\n\treturn String(thing);\n}\n","import{watch as c}from\"vue-demi\";import{BroadcastChannel as f}from\"broadcast-channel\";import*as s from\"devalue\";function m(t,a,{initialize:d,type:r}){let o=`${a.$id}-${t.toString()}`,n=new f(o,{type:r}),l=!1,e=0;c(()=>a[t],i=>{l||(e=Date.now(),n.postMessage({timestamp:e,state:s.parse(s.stringify(i))})),l=!1},{deep:!0}),n.onmessage=i=>{if(i===void 0){n.postMessage({timestamp:e,state:s.parse(s.stringify(a[t]))});return}i.timestamp<=e||(l=!0,e=i.timestamp,a[t]=i.state)};let u=()=>n.postMessage(void 0),p=()=>n.close();return d&&u(),{sync:u,unshare:p}}var h=(t,a)=>Object.keys(a).includes(t),g=({initialize:t=!0,enable:a=!0,type:d})=>({store:r,options:o})=>{let n=o?.share?.enable??a,l=o?.share?.omit??[];!n||Object.keys(r.$state).forEach(e=>{l.includes(e)||!h(e,r.$state)||m(e,r,{initialize:o?.share?.initialize??t,type:d})})};export{g as PiniaSharedState,m as share};\n","import { createPinia } from 'pinia'\nimport { PiniaSharedState } from 'pinia-shared-state'\n// import { PiniaUndo } from 'pinia-undo'\n\nconst pinia = createPinia()\n\n// Pass the plugin to your application's pinia plugin\npinia.use(\n\tPiniaSharedState({\n\t\tenable: true,\n\t\tinitialize: true,\n\t})\n)\n// pinia.use(PiniaUndo)\n\nexport { pinia }\n","import { App, type Plugin } from 'vue'\n\nimport Registry from '../registry'\nimport { pinia } from '../stores'\nimport type { InstallOptions } from '../types'\n\n/**\n * Stonecrop Vue plugin\n * @param app - The Vue app instance\n * @param options - The plugin options\n * @example\n * ```ts\n *\n * import { createApp } from 'vue'\n * import Stonecrop from 'stonecrop'\n *\n * import App from './App.vue'\n *\n * const app = createApp(App)\n * app.use(Stonecrop, {\n * router,\n * components: {\n * // register custom components\n * },\n * getMeta: async (doctype: string) => {\n * // fetch doctype meta from API\n * },\n * })\n *\n * app.mount('#app')\n * ```\n *\n * @public\n */\nconst plugin: Plugin = {\n\tinstall: (app: App, options?: InstallOptions) => {\n\t\t// check if the router is already installed via another plugin\n\t\tconst existingRouter = app.config.globalProperties.$router\n\t\tconst appRouter = existingRouter || options?.router\n\t\tconst registry = new Registry(appRouter, options?.getMeta)\n\n\t\tif (!existingRouter && appRouter) {\n\t\t\tapp.use(appRouter)\n\t\t}\n\n\t\tapp.use(pinia)\n\t\tapp.provide('$registry', registry)\n\n\t\tif (options?.components) {\n\t\t\tfor (const [tag, component] of Object.entries(options.components)) {\n\t\t\t\tapp.component(tag, component)\n\t\t\t}\n\t\t}\n\t},\n}\n\nexport default plugin\n"],"names":["NotImplementedError","message","_Stonecrop","registry","store","schema","workflow","actions","__publicField","doctype","doctypeRegistry","filters","data","id","action","_a","initialState","Stonecrop","isVue2","set","target","key","val","del","getDevtoolsGlobalHook","getTarget","isProxyAvailable","HOOK_SETUP","HOOK_PLUGIN_SETTINGS_SET","supported","perf","isPerformanceSupported","now","ApiProxy","plugin","hook","defaultSettings","item","localSettingsSaveId","currentSettings","raw","value","pluginId","_target","prop","args","resolve","setupDevtoolsPlugin","pluginDescriptor","setupFn","descriptor","enableProxy","proxy","activePinia","setActivePinia","pinia","piniaSymbol","isPlainObject","o","MutationType","IS_CLIENT","_global","bom","blob","autoBom","download","url","name","opts","xhr","saveAs","corsEnabled","click","node","evt","_navigator","isMacOSWebView","downloadSaveAs","msSaveAs","fileSaverSaveAs","a","popup","force","isSafari","isChromeIOS","reader","toastMessage","type","piniaMessage","isPinia","checkClipboardAccess","checkNotFocusedError","error","actionGlobalCopyState","actionGlobalPasteState","loadStoresState","actionGlobalSaveState","fileInput","getFileOpener","openFile","reject","files","file","actionGlobalOpenStateFile","result","text","state","storeState","formatDisplay","display","PINIA_ROOT_LABEL","PINIA_ROOT_ID","formatStoreForInspectorTree","formatStoreForInspectorState","storeNames","storeMap","storeId","getters","getterName","formatEventData","events","event","formatMutationType","isTimelineActive","componentStateTypes","MUTATIONS_LAYER_ID","INSPECTOR_ID","assign$1","getStoreType","registerPiniaDevtools","app","api","nodeId","payload","ctx","piniaStores","toRaw","stores","inspectedStore","path","addStoreToDevtools","after","onError","groupId","runningActionId","activeAction","watch","unref","newValue","oldValue","eventData","hotUpdate","markRaw","newStore","$dispose","patchActionForGrouping","actionNames","wrapWithProxy","storeActions","actionName","_actionId","trackedStore","retValue","devtoolsPlugin","options","originalHotUpdate","createPinia","scope","effectScope","ref","_p","toBeInstalled","patchObject","newState","oldState","subPatch","targetValue","isRef","isReactive","noop","addSubscription","subscriptions","callback","detached","onCleanup","removeSubscription","idx","getCurrentScope","onScopeDispose","triggerSubscriptions","fallbackRunWithContext","fn","ACTION_MARKER","ACTION_NAME","mergeReactiveObjects","patchToApply","skipHydrateSymbol","shouldHydrate","obj","assign","isComputed","createOptionsStore","hot","setup","localState","toRefs","computedGetters","computed","createSetupStore","$id","isOptionsStore","optionsForPlugin","$subscribeOptions","isListening","debuggerEvents","isSyncListening","actionSubscriptions","hotState","activeListener","$patch","partialStateOrMutator","subscriptionMutation","myListenerId","nextTick","$reset","$state","wrappedAction","afterCallbackList","onErrorCallbackList","ret","_hmrPayload","partialStore","stopWatcher","reactive","setupStore","toRef","actionValue","stateKey","newStateTarget","oldStateSource","actionFn","getter","getterValue","nonEnumerable","p","extender","extensions","defineStore","idOrOptions","setupOptions","isSetupStore","useStore","hasContext","hasInjectionContext","inject","hotId","currentInstance","getCurrentInstance","vm","cache","useDataStore","records","record","useStonecrop","stonecrop","onMounted","route","doctypeSlug","recordId","_b","_c","DoctypeMeta","component","_Registry","router","getMeta","Registry","isPromise","PROMISE_RESOLVED_VOID","sleep","time","resolveWith","res","randomInt","min","max","randomToken","lastMs","additional","microSeconds","ms","micro","create","channelName","msg","close","channelState","postMessage","messageJson","err","onMessage","canBeUsed","averageResponseTime","NativeMethod","ObliviousSet","ttl","_this","removeTooOldValues","obliviousSet","olderThen","iterator","next","fillOptionsWithDefaults","originalOptions","DB_PREFIX","OBJECT_STORE_ID","TRANSACTION_SETTINGS","getIdb","commitIndexedDBTransaction","tx","createDatabase","IndexedDB","dbName","openRequest","ev","db","rej","writeMessage","readerUuid","writeObject","objectStore","getMessagesHigherThan","lastCursorId","keyRangeValue","getAllRequest","e","openCursor","openCursorRequest","cursor","removeMessagesById","ids","deleteRequest","getOldMessages","msgObk","cleanOldMessages","tooOld","_readLoop","readNewMessages","_filterMessage","msgObj","newerMessages","useMessages","msgObjA","msgObjB","IndexedDBMethod","KEY_PREFIX","getLocalStorage","localStorage","storageKey","writeObj","addStorageEventListener","listener","removeStorageEventListener","uuid","eMIs","ls","defaultTime","userAgent","LocalstorageMethod","SIMULATE_CHANNELS","channelArray","channel","SimulateMethod","METHODS","chooseMethod","chooseMethods","m","useMethod","method","OPEN_BROADCAST_CHANNELS","lastId","BroadcastChannel","ENFORCED_OPTIONS","_prepareChannel","BroadcastChannel$1","_post","listenObj","_removeListenerObject","_addListenerObject","awaitPrepare","broadcastChannel","sendPromise","maybePromise","s","_hasMessageListeners","_startListening","_stopListening","listenerFn","listenerObject","hundredMsInMicro","minMessageTime","DevalueError","keys","is_primitive","thing","object_proto_names","is_plain_object","proto","get_type","get_escaped_char","char","stringify_string","str","last_pos","len","i","replacement","UNDEFINED","HOLE","NAN","POSITIVE_INFINITY","NEGATIVE_INFINITY","NEGATIVE_ZERO","parse","serialized","revivers","unflatten","parsed","hydrate","values","hydrated","index","standalone","map","array","n","object","stringify","reducers","stringified","indexes","custom","flatten","stringify_primitive","source","flags","started","t","d","r","f","l","c","s.parse","s.stringify","h","g","PiniaSharedState","existingRouter","appRouter","tag"],"mappings":"obAUO,SAASA,EAAoBC,EAAiB,CACpD,KAAK,QAAUA,GAAW,EAC3B,CAEAD,EAAoB,UAAY,OAAO,OAAO,MAAM,UAAW,CAC9D,YAAa,CAAE,MAAOA,CAAoB,EAC1C,KAAM,CAAE,MAAO,gBAAiB,EAChC,MAAO,CACN,IAAK,UAAY,CACT,OAAA,IAAI,MAAQ,EAAA,KACpB,CACD,CACD,CAAC,ECZM,MAAME,EAAN,MAAMA,CAAU,CAmFtB,YACCC,EACAC,EACAC,EACAC,EACAC,EACC,CA7EOC,EAAA,YAAO,aAqBPA,EAAA,iBAKTA,EAAA,cAmBAA,EAAA,eAKAA,EAAA,iBAKAA,EAAA,gBAuBC,GAAIN,EAAU,MACb,OAAOA,EAAU,MAElBA,EAAU,MAAQ,KAClB,KAAK,SAAWC,EAChB,KAAK,MAAQC,EACb,KAAK,OAASC,EACd,KAAK,SAAWC,EAChB,KAAK,QAAUC,CAChB,CAWA,MAAME,EAA4B,CAC5B,KAAK,QAAQA,CAAO,EACzB,KAAK,YAAYA,CAAO,EACxB,KAAK,WAAWA,CAAO,CACxB,CAcA,QAAQA,EAAkE,CACzE,OAAO,KAAK,SAAS,QAAU,KAAK,SAAS,QAAQA,EAAQ,OAAO,EAAI,IAAIT,EAAoBS,EAAQ,OAAO,CAChH,CAWA,YAAYA,EAA4B,CACvC,MAAMC,EAAkB,KAAK,SAAS,SAASD,EAAQ,IAAI,EAC3D,KAAK,SAAWC,EAAgB,QACjC,CAWA,WAAWD,EAA4B,CACtC,MAAMC,EAAkB,KAAK,SAAS,SAASD,EAAQ,IAAI,EAC3D,KAAK,QAAUC,EAAgB,OAChC,CAkBA,MAAM,WAAWD,EAAsBE,EAAsC,CAC5E,KAAK,MAAM,OAAO,CAAE,QAAS,C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