1import { H as hasInjectionContext, L as getCurrentInstance, an as getCurrentScope, gn as reactive, in as effectScope, yn as shallowReactive } from "./DDznFIea.js"; 2import { o as chunkErrorEvent } from "./BEWSzIu5.js"; 3//#region node_modules/nostics/dist/index.mjs 4var captureStackTrace = Error.captureStackTrace; 5var Diagnostic = class Diagnostic extends Error { 6 name; 7 /** 8 * The diagnostic code, e.g. `MATH_E001`. 9 * Also appears as the `name` property. 10 */ 11 code; 12 /** 13 * URL to extended documentation for this diagnostic code. 14 * Auto-generated from {@link DefineDiagnosticsOptions.docsBase}. 15 */ 16 docs; 17 /** 18 * Optional actionable instructions on how to resolve the problem. 19 */ 20 fix; 21 /** 22 * Locations in user code that contributed to this diagnostic, in 23 * `file:line:column` format. Relevant when the stack trace doesn't reflect 24 * the user's source (e.g. compilers, bundlers), otherwise redundant with the 25 * stack and should be omitted. 26 */ 27 sources; 28 /** 29 * Structured information associated with this diagnostic code. 30 */ 31 data; 32 /** 33 * Alias for {@link Error.message}: the reason this diagnostic was raised. 34 */ 35 get why() { 36 return this.message; 37 } 38 /** 39 * @param init structured initializer; `why` is required 40 * @param captureFrom V8 stack-cutoff frame. Defaults to {@link Diagnostic} 41 * so the top of the trace is the `new Diagnostic(...)` call site. 42 * `defineDiagnostics` passes its action method to strip its own frames too. 43 * Ignored on engines without `Error.captureStackTrace`. 44 */ 45 constructor(init, captureFrom = Diagnostic) { 46 super(init.why, { cause: init.cause }); 47 this.code = this.name = init.code; 48 this.fix = init.fix; 49 this.docs = init.docs; 50 this.sources = init.sources; 51 this.data = init.data; 52 captureStackTrace?.(this, captureFrom); 53 } 54 /** 55 * Converts the diagnostic into a serializable structured object. 56 */ 57 toJSON() { 58 return { 59 name: this.name, 60 why: this.why, 61 fix: this.fix, 62 docs: this.docs, 63 sources: this.sources, 64 cause: this.cause, 65 data: this.data, 66 stack: this.stack 67 }; 68 } 69}; 70/** 71* Resolves the docs URL for a code from a `docsBase` (string template or 72* resolver function). Shared by {@link defineDiagnostics} and 73* {@link defineProdDiagnostics}. Per-code `docs` overrides are handled by the 74* caller; this only covers the `docsBase`-derived case. 75* 76* @internal 77*/ 78function deriveDocs(docsBase, code) { 79 return typeof docsBase === "string" ? `${docsBase}/${code.toLowerCase()}` : docsBase?.(code); 80} 81/** 82* Production counterpart to {@link defineDiagnostics}. Returns a `Proxy` that 83* builds a minimal {@link Diagnostic} for any accessed code: the code becomes 84* the instance `name`, `docs` is derived from `docsBase`, and `why` points to 85* the docs URL when one exists (empty otherwise, so the thrown header is just 86* the code). It carries no catalog text or data, so it stays tiny in a bundle. 87* 88* The strip plugin (`@nostics/unplugin`) can rewrite a `defineDiagnostics()` 89* call into a `process.env.NODE_ENV === 'production'` ternary that selects this 90* factory in production, dropping every `why`/`fix` string from the bundle. 91* 92* @example 93* ```ts 94* const diagnostics = defineProdDiagnostics({ docsBase: 'https://docs.example.com' }) 95* throw diagnostics.NUXT_B2011() // NUXT_B2011: https://docs.example.com/nuxt_b2011 96* ``` 97*/ 98/* @__NO_SIDE_EFFECTS__ */ 99function defineProdDiagnostics(options = {}) { 100 const { docsBase, reporters = [] } = options; 101 return new Proxy({}, { get(_target, code) { 102 if (typeof code !== "string") return void 0; 103 const handle = (params = {}, reporterOptions = {}) => { 104 const docs = deriveDocs(docsBase, code); 105 const diagnostic = new Diagnostic({ 106 code, 107 why: docs ?? "", 108 docs, 109 cause: params.cause, 110 sources: params.sources 111 }, handle); 112 for (const reporter of reporters) reporter(diagnostic, reporterOptions); 113 return diagnostic; 114 }; 115 return handle; 116 } }); 117} 118//#endregion 119//#region node_modules/nuxt/dist/app/diagnostics/_shared.js 120/** 121* Shared configuration for the runtime (E<N>xxx) diagnostics catalogs. 122* 123* Catalogs are split by domain and imported directly where used (no barrel), 124* so the browser bundle only pulls in the codes a module references. Pair the 125* pure-call annotations on each `defineDiagnostics()` with dev-guarded, 126* statement-level report calls so report-only diagnostics strip from production. 127* 128* Codes are stable, fully-qualified `NUXT_E<NNNN>` identifiers. Codes with a 129* dedicated docs page resolve a `see:` URL via {@link docsBase}; the rest opt
130* out with `docs: false`. 131*/ 132function docsBase(code) { 133 return `https://nuxt.com/docs/4.x/errors/${code.replace("NUXT_", "").toLowerCase()}`; 134} 135var prodReporter = (diagnostic) => { 136 console.error(`[${diagnostic.name}]`); 137}; 138var prodReporters = [prodReporter]; 139//#endregion 140//#region node_modules/nuxt/dist/app/diagnostics/core.js 141/** 142* E1xxx 143* Core / Nuxt-instance / lifecycle runtime diagnostics. 144*/ 145var appDiagnostics = /* #__PURE__ */ defineProdDiagnostics({ 146 docsBase, 147 reporters: prodReporters 148}); 149//#endregion 150//#region node_modules/nuxt/node_modules/hookable/dist/index.mjs 151function flatHooks(configHooks, hooks = {}, parentName) { 152 for (const key in configHooks) { 153 const subHook = configHooks[key]; 154 const name = parentName ? `${parentName}:${key}` : key; 155 if (typeof subHook === "object" && subHook !== null) flatHooks(subHook, hooks, name); 156 else if (typeof subHook === "function") hooks[name] = subHook; 157 } 158 return hooks; 159} 160var createTask = /* @__PURE__ */ (() => { 161 if (console.createTask) return console.createTask; 162 const defaultTask = { run: (fn) => fn() }; 163 return () => defaultTask; 164})(); 165function callHooks(hooks, args, startIndex, task) { 166 for (let i = startIndex; i < hooks.length; i += 1) try { 167 const result = task ? task.run(() => hooks[i](...args)) : hooks[i](...args); 168 if (result && typeof result.then === "function") return Promise.resolve(result).then(() => callHooks(hooks, args, i + 1, task)); 169 } catch (error) { 170 return Promise.reject(error); 171 } 172} 173function serialTaskCaller(hooks, args, name) { 174 if (hooks.length > 0) return callHooks(hooks, args, 0, createTask(name)); 175} 176function parallelTaskCaller(hooks, args, name) { 177 if (hooks.length > 0) { 178 const task = createTask(name); 179 return Promise.all(hooks.map((hook) => task.run(() => hook(...args)))); 180 } 181} 182function callEachWith(callbacks, arg0) { 183 for (const callback of [...callbacks]) callback(arg0); 184} 185var Hookable = class { 186 _hooks; 187 _before; 188 _after; 189 _deprecatedHooks; 190 _deprecatedMessages; 191 constructor() { 192 this._hooks = {}; 193 this._before = void 0; 194 this._after = void 0; 195 this._deprecatedMessages = void 0; 196 this._deprecatedHooks = {}; 197 this.hook = this.hook.bind(this); 198 this.callHook = this.callHook.bind(this); 199 this.callHookWith = this.callHookWith.bind(this); 200 } 201 hook(name, function_, options = {}) { 202 if (!name || typeof function_ !== "function") return () => {}; 203 const originalName = name; 204 let dep; 205 while (this._deprecatedHooks[name]) { 206 dep = this._deprecatedHooks[name]; 207 name = dep.to; 208 } 209 if (dep && !options.allowDeprecated) { 210 let message = dep.message; 211 if (!message) message = `${originalName} hook has been deprecated` + (dep.to ? `, please use ${dep.to}` : ""); 212 if (!this._deprecatedMessages) this._deprecatedMessages = /* @__PURE__ */ new Set(); 213 if (!this._deprecatedMessages.has(message)) { 214 console.warn(message); 215 this._deprecatedMessages.add(message); 216 } 217 } 218 if (!function_.name) try { 219 Object.defineProperty(function_, "name", { 220 get: () => "_" + name.replace(/\W+/g, "_") + "_hook_cb", 221 configurable: true 222 }); 223 } catch {} 224 this._hooks[name] = this._hooks[name] || []; 225 this._hooks[name].push(function_); 226 return () => { 227 if (function_) { 228 this.removeHook(name, function_); 229 function_ = void 0; 230 } 231 }; 232 } 233 hookOnce(name, function_) { 234 let _unreg; 235 let _function = (...arguments_) => { 236 if (typeof _unreg === "function") _unreg(); 237 _unreg = void 0; 238 _function = void 0; 239 return function_(...arguments_); 240 }; 241 _unreg = this.hook(name, _function); 242 return _unreg; 243 } 244 removeHook(name, function_) { 245 const hooks = this._hooks[name]; 246 if (hooks) { 247 const index = hooks.indexOf(function_); 248 if (index !== -1) hooks.splice(index, 1); 249 if (hooks.length === 0) this._hooks[name] = void 0; 250 } 251 } 252 clearHook(name) { 253 this._hooks[name] = void 0; 254 } 255 deprecateHook(name, deprecated) { 256 this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated; 257 const _hooks = this._hooks[name] || []; 258 this._hooks[name] = void 0; 259 for (const hook of _hooks) this.hook(name, hook); 260 } 261 deprecateHooks(deprecatedHooks) { 262 for (const name in deprecatedHooks) this.deprecateHook(name, deprecatedHooks[name]); 263 } 264 addHooks(configHooks) { 265 const hooks = flatHooks(configHooks); 266 const removeFns = Object.keys(hooks).map((key) => this.hook(key, hooks[key])); 267 return () => { 268 for (const unreg of removeFns) unreg(); 269 removeFns.length = 0; 270 }; 271 } 272 removeHooks(configHooks) { 273 const hooks = flatHooks(configHooks); 274 for (const key in hooks) this.removeHook(key, hooks[key]); 275 } 276 removeAllHooks() { 277 this._hooks = {}; 278 } 279 callHook(name, ...args) { 280 return this.callHookWith(serialTaskCaller, name, args); 281 } 282 callHookParallel(name, ...args) { 283 return this.callHookWith(parallelTaskCaller, name, args); 284 } 285 callHookWith(caller, name, args) { 286 const event = this._before || this._after ? { 287 name, 288 args, 289 context: {} 290 } : void 0; 291 if (this._before) callEachWith(this._before, event); 292 const result = caller(this._hooks[name] ? [...this._hooks[name]] : [], args, name); 293 if (result instanceof Promise) return result.finally(() => { 294 if (this._after && event) callEachWith(this._after, event); 295 }); 296 if (this._after && event) callEachWith(this._after, event); 297 return result; 298 } 299 beforeEach(function_) { 300 this._before = this._before || []; 301 this._before.push(function_); 302 return () => { 303 if (this._before !== void 0) { 304 const index = this._before.indexOf(function_); 305 if (index !== -1) this._before.splice(index, 1); 306 } 307 }; 308 } 309 afterEach(function_) { 310 this._after = this._after || []; 311 this._after.push(function_); 312 return () => { 313 if (this._after !== void 0) { 314 const index = this._after.indexOf(function_); 315 if (index !== -1) this._after.splice(index, 1); 316 } 317 }; 318 } 319}; 320function createHooks() { 321 return new Hookable(); 322} 323//#endregion 324//#region node_modules/unctx/dist/index.mjs 325function _getAsyncLocalStorage() { 326 return globalThis.AsyncLocalStorage || globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncLocalStorage; 327} 328var _WeakRef = globalThis.WeakRef || class StrongRef { 329 #value; 330 constructor(value) { 331 this.#value = value; 332 } 333 deref() { 334 return this.#value; 335 } 336}; 337function createContext(opts = {}) { 338 let currentInstance; 339 let isSingleton = false;
340 const checkConflict = (instance) => { 341 if (currentInstance && currentInstance !== instance) throw new Error("Context conflict"); 342 }; 343 let als; 344 if (opts.asyncContext) { 345 const _AsyncLocalStorage = opts.AsyncLocalStorage || _getAsyncLocalStorage(); 346 if (_AsyncLocalStorage) als = new _AsyncLocalStorage(); 347 else console.warn("[unctx] `AsyncLocalStorage` is not provided."); 348 } 349 const _wrapInstance = (instance) => als && instance !== null && typeof instance === "object" ? { __unctx_weak: new _WeakRef(instance) } : instance; 350 const _unwrapInstance = (store) => store && store.__unctx_weak ? store.__unctx_weak.deref() : store; 351 const _getCurrentInstance = () => { 352 if (als) { 353 const store = als.getStore(); 354 if (store !== void 0) return _unwrapInstance(store); 355 } 356 return currentInstance; 357 }; 358 return { 359 use: () => { 360 const _instance = _getCurrentInstance(); 361 if (_instance === void 0) throw new Error("Context is not available"); 362 return _instance; 363 }, 364 tryUse: () => { 365 return _getCurrentInstance() ?? null; 366 }, 367 set: (instance, replace) => { 368 if (!replace) checkConflict(instance); 369 currentInstance = instance; 370 isSingleton = true; 371 }, 372 unset: () => { 373 currentInstance = void 0; 374 isSingleton = false; 375 }, 376 call: (instance, callback) => { 377 checkConflict(instance); 378 currentInstance = instance; 379 try { 380 return als ? als.run(_wrapInstance(instance), callback) : callback(); 381 } finally { 382 if (!isSingleton) currentInstance = void 0; 383 } 384 }, 385 async callAsync(instance, callback) { 386 currentInstance = instance; 387 const onRestore = () => { 388 currentInstance = instance; 389 }; 390 const onLeave = () => currentInstance === instance ? onRestore : void 0; 391 asyncHandlers.add(onLeave); 392 try { 393 const r = als ? als.run(_wrapInstance(instance), callback) : callback(); 394 if (!isSingleton) currentInstance = void 0; 395 return await r; 396 } finally { 397 asyncHandlers.delete(onLeave); 398 } 399 } 400 }; 401} 402function createNamespace(defaultOpts = {}) { 403 const contexts = {}; 404 return { get(key, opts = {}) { 405 if (!contexts[key]) contexts[key] = createContext({ 406 ...defaultOpts, 407 ...opts 408 }); 409 return contexts[key]; 410 } }; 411} 412var _globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {}; 413var globalKey = "__unctx__"; 414var defaultNamespace = _globalThis[globalKey] || (_globalThis[globalKey] = createNamespace()); 415var getContext = (key, opts = {}) => defaultNamespace.get(key, opts); 416var asyncHandlersKey = "__unctx_async_handlers__"; 417var asyncHandlers = _globalThis[asyncHandlersKey] || (_globalThis[asyncHandlersKey] = /* @__PURE__ */ new Set()); 418function executeAsync(function_) { 419 const restores = []; 420 for (const leaveHandler of asyncHandlers) { 421 const restore = leaveHandler(); 422 if (restore) restores.push(restore); 423 } 424 const restore = () => { 425 for (const restore of restores) restore(); 426 }; 427 let awaitable = function_(); 428 if (awaitable && typeof awaitable === "object" && "catch" in awaitable) awaitable = awaitable.catch((error) => { 429 restore(); 430 throw error; 431 }); 432 return [awaitable, restore]; 433} 434//#endregion 435//#region node_modules/nuxt/dist/app/nuxt.js 436function getNuxtAppCtx(id = "nuxt-app") { 437 return getContext(id, { asyncContext: false }); 438} 439var NuxtPluginIndicator = "__nuxt_plugin"; 440/** @since 3.0.0 */ 441function createNuxtApp(options) { 442 let hydratingCount = 0; 443 const nuxtApp = { 444 _id: options.id || "nuxt-app", 445 _scope: effectScope(), 446 provide: void 0, 447 versions: { 448 get nuxt() { 449 return "4.5.2"; 450 }, 451 get vue() { 452 return nuxtApp.vueApp.version; 453 } 454 }, 455 payload: shallowReactive({ 456 ...options.ssrContext?.payload || {}, 457 data: shallowReactive({}), 458 state: reactive({}), 459 once: /* @__PURE__ */ new Set(), 460 _errors: shallowReactive({}) 461 }), 462 static: { data: {} }, 463 runWithContext(fn) { 464 if (nuxtApp._scope.active && !getCurrentScope()) return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn)); 465 return callWithNuxt(nuxtApp, fn); 466 }, 467 isHydrating: true, 468 deferHydration() { 469 if (!nuxtApp.isHydrating) return () => {}; 470 hydratingCount++; 471 let called = false;
472 return () => { 473 if (called) return; 474 called = true; 475 hydratingCount--; 476 if (hydratingCount === 0) { 477 nuxtApp.isHydrating = false; 478 return nuxtApp.callHook("app:suspense:resolve"); 479 } 480 }; 481 }, 482 _asyncDataPromises: {}, 483 _asyncData: shallowReactive({}), 484 _state: shallowReactive({}), 485 _payloadRevivers: {}, 486 ...options 487 }; 488 { 489 const __NUXT__ = window.__NUXT__; 490 if (__NUXT__) for (const key in __NUXT__) switch (key) { 491 case "data": 492 case "state": 493 case "_errors": 494 Object.assign(nuxtApp.payload[key], __NUXT__[key]); 495 break; 496 default: nuxtApp.payload[key] = __NUXT__[key]; 497 } 498 } 499 nuxtApp.hooks = createHooks(); 500 nuxtApp.hook = nuxtApp.hooks.hook; 501 { 502 const _callHook = nuxtApp.hooks.callHook; 503 nuxtApp.hooks.callHook = (name, ...args) => Promise.resolve().then(() => _callHook(name, ...args)); 504 } 505 nuxtApp.callHook = nuxtApp.hooks.callHook; 506 nuxtApp.provide = (name, value) => { 507 const $name = "$" + name; 508 defineGetter(nuxtApp, $name, value); 509 defineGetter(nuxtApp.vueApp.config.globalProperties, $name, value); 510 }; 511 defineGetter(nuxtApp.vueApp, "$nuxt", nuxtApp); 512 defineGetter(nuxtApp.vueApp.config.globalProperties, "$nuxt", nuxtApp); 513 { 514 window.addEventListener(chunkErrorEvent, (event) => { 515 nuxtApp.callHook("app:chunkError", { error: event.payload }); 516 if (event.payload?.message?.includes("Unable to preload CSS")) event.preventDefault(); 517 }); 518 window.useNuxtApp ||= useNuxtApp; 519 const unreg = nuxtApp.hook("app:error", (...args) => { 520 appDiagnostics.NUXT_E1005({ cause: args.length > 1 ? args : args[0] }); 521 }); 522 nuxtApp.hook("app:mounted", unreg); 523 } 524 const runtimeConfig = nuxtApp.payload.config; 525 nuxtApp.provide("config", runtimeConfig); 526 return nuxtApp; 527} 528/** @since 3.0.0 */ 529async function applyPlugin(nuxtApp, plugin) { 530 if (typeof plugin === "function") { 531 const run = () => nuxtApp.runWithContext(() => plugin(nuxtApp)); 532 const { provide } = await run() || {}; 533 if (provide && typeof provide === "object") for (const key in provide) nuxtApp.provide(key, provide[key]); 534 } 535} 536/** @since 3.0.0 */ 537async function applyPlugins(nuxtApp, plugins) { 538 return applyPluginsWithDependencies(nuxtApp, plugins); 539} 540async function applyPluginsWithDependencies(nuxtApp, plugins) { 541 const resolvedPlugins = /* @__PURE__ */ new Set(); 542 const unresolvedPlugins = []; 543 const parallels = []; 544 let error; 545 let promiseDepth = 0; 546 async function executePlugin(plugin) { 547 const unresolvedPluginsForThisPlugin = plugin.dependsOn?.filter((name) => plugins.some((p) => p._name === name) && !resolvedPlugins.has(name)) ?? []; 548 if (unresolvedPluginsForThisPlugin.length > 0) unresolvedPlugins.push([new Set(unresolvedPluginsForThisPlugin), plugin]); 549 else { 550 const promise = applyPlugin(nuxtApp, plugin).then(async () => { 551 if (plugin._name) { 552 resolvedPlugins.add(plugin._name); 553 await Promise.all(unresolvedPlugins.map(async ([dependsOn, unexecutedPlugin]) => { 554 if (dependsOn.has(plugin._name)) { 555 dependsOn.delete(plugin._name); 556 if (dependsOn.size === 0) { 557 promiseDepth++; 558 await executePlugin(unexecutedPlugin); 559 } 560 } 561 })); 562 } 563 }).catch((e) => { 564 if (!plugin.parallel && !nuxtApp.payload.error) throw e; 565 error ||= e; 566 }); 567 if (plugin.parallel) parallels.push(promise); 568 else await promise; 569 } 570 } 571 for (const plugin of plugins) await executePlugin(plugin); 572 await Promise.all(parallels); 573 if (promiseDepth) for (let i = 0; i < promiseDepth; i++) await Promise.all(parallels); 574 if (error) throw nuxtApp.payload.error || error; 575} 576/** @since 3.0.0 */ 577/* @__NO_SIDE_EFFECTS__ */ 578function defineNuxtPlugin(plugin) { 579 if (typeof plugin === "function") return plugin; 580 const _name = plugin._name || plugin.name; 581 delete plugin.name; 582 return Object.assign(plugin.setup || (() => {}), plugin, { 583 [NuxtPluginIndicator]: true, 584 _name 585 }); 586} 587/** 588* Ensures that the setup function passed in has access to the Nuxt instance via `useNuxtApp`. 589* @param nuxt A Nuxt instance 590* @param setup The function to call 591* @since 3.0.0 592*/ 593function callWithNuxt(nuxt, setup, args) { 594 const fn = () => args ? setup(...args) : setup(); 595 getNuxtAppCtx(nuxt._id).set(nuxt); 596 return nuxt.vueApp.runWithContext(fn); 597} 598function tryUseNuxtApp(id) { 599 let nuxtAppInstance; 600 if (hasInjectionContext()) nuxtAppInstance = getCurrentInstance()?.appContext.app.$nuxt; 601 nuxtAppInstance ||= getNuxtAppCtx(id).tryUse(); 602 return nuxtAppInstance || null; 603} 604function useNuxtApp(id) { 605 const nuxtAppInstance = tryUseNuxtApp(id); 606 if (!nuxtAppInstance) throw appDiagnostics.NUXT_E1001(); 607 return nuxtAppInstance; 608} 609/** @since 3.0.0 */ 610/* @__NO_SIDE_EFFECTS__ */ 611function useRuntimeConfig(_event) { 612 return useNuxtApp().$config; 613} 614function defineGetter(obj, key, val) { 615 Object.defineProperty(obj, key, { get: () => val }); 616} 617//#endregion 618export { useNuxtApp as a, appDiagnostics as c, defineProdDiagnostics as d, tryUseNuxtApp as i, docsBase as l, createNuxtApp as n, useRuntimeConfig as o, defineNuxtPlugin as r, executeAsync as s, applyPlugins as t, prodReporters as u };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.