mapomodule 1.0.0-alpha.53 → 1.0.0-alpha.55

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.
Files changed (40) hide show
  1. package/.nuxt/app.config.mjs +18 -0
  2. package/.nuxt/component-chunk.mjs +1 -0
  3. package/.nuxt/components.d.ts +174 -0
  4. package/.nuxt/dev/index.mjs +2228 -0
  5. package/.nuxt/dev/index.mjs.map +1 -0
  6. package/.nuxt/dist/server/client.manifest.json +18 -0
  7. package/.nuxt/dist/server/client.manifest.mjs +1 -0
  8. package/.nuxt/dist/server/server.mjs +1 -0
  9. package/.nuxt/eslint.config.d.mts +9 -0
  10. package/.nuxt/eslint.config.mjs +52 -0
  11. package/.nuxt/i18n.options.mjs +212 -0
  12. package/.nuxt/imports.d.ts +41 -0
  13. package/.nuxt/nitro.json +17 -0
  14. package/.nuxt/nuxt-i18n-logger.mjs +1 -0
  15. package/.nuxt/nuxt.d.ts +37 -0
  16. package/.nuxt/nuxt.json +9 -0
  17. package/.nuxt/schema/nuxt.schema.d.ts +17 -0
  18. package/.nuxt/schema/nuxt.schema.json +3 -0
  19. package/.nuxt/tsconfig.json +253 -0
  20. package/.nuxt/tsconfig.server.json +171 -0
  21. package/.nuxt/types/app-defaults.d.ts +7 -0
  22. package/.nuxt/types/app.config.d.ts +31 -0
  23. package/.nuxt/types/build.d.ts +26 -0
  24. package/.nuxt/types/builder-env.d.ts +1 -0
  25. package/.nuxt/types/i18n-plugin.d.ts +104 -0
  26. package/.nuxt/types/imports.d.ts +413 -0
  27. package/.nuxt/types/layouts.d.ts +7 -0
  28. package/.nuxt/types/middleware.d.ts +7 -0
  29. package/.nuxt/types/nitro-config.d.ts +14 -0
  30. package/.nuxt/types/nitro-imports.d.ts +144 -0
  31. package/.nuxt/types/nitro-middleware.d.ts +6 -0
  32. package/.nuxt/types/nitro-nuxt.d.ts +34 -0
  33. package/.nuxt/types/nitro-routes.d.ts +14 -0
  34. package/.nuxt/types/nitro.d.ts +3 -0
  35. package/.nuxt/types/plugins.d.ts +49 -0
  36. package/.nuxt/types/schema.d.ts +264 -0
  37. package/.nuxt/types/view-transitions.d.ts +6 -0
  38. package/.nuxt/types/vue-shim.d.ts +0 -0
  39. package/CHANGELOG.md +16 -0
  40. package/package.json +3 -3
@@ -0,0 +1,2228 @@
1
+ import process from 'node:process';globalThis._importMeta_={url:import.meta.url,env:process.env};import { tmpdir } from 'node:os';
2
+ import { defineEventHandler, handleCacheHeaders, splitCookiesString, createEvent, fetchWithEvent, isEvent, eventHandler, setHeaders, sendRedirect, proxyRequest, getRequestHeader, setResponseHeaders, setResponseStatus, send, getRequestHeaders, setResponseHeader, getRequestURL, getResponseHeader, getQuery as getQuery$1, readBody, createApp, createRouter as createRouter$1, toNodeListener, lazyEventHandler, getResponseStatus, createError, getRouterParam, getResponseStatusText } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/h3@1.15.3/node_modules/h3/dist/index.mjs';
3
+ import { Server } from 'node:http';
4
+ import { resolve, dirname, join } from 'node:path';
5
+ import nodeCrypto from 'node:crypto';
6
+ import { parentPort, threadId } from 'node:worker_threads';
7
+ import { escapeHtml } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/@vue+shared@3.5.16/node_modules/@vue/shared/dist/shared.cjs.js';
8
+ import { createRenderer, getRequestDependencies, getPreloadLinks, getPrefetchLinks } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/vue-bundle-renderer@2.1.1/node_modules/vue-bundle-renderer/dist/runtime.mjs';
9
+ import { renderToString } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/vue@3.5.16_typescript@5.8.3/node_modules/vue/server-renderer/index.mjs';
10
+ import destr, { destr as destr$1 } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs';
11
+ import { createHooks } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs';
12
+ import { createFetch, Headers as Headers$1 } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/ofetch@1.4.1/node_modules/ofetch/dist/node.mjs';
13
+ import { fetchNodeRequestHandler, callNodeRequestHandler } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/node-mock-http@1.0.0/node_modules/node-mock-http/dist/index.mjs';
14
+ import { createStorage, prefixStorage } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unstorage@1.16.0_db0@0.3.2_ioredis@5.6.1/node_modules/unstorage/dist/index.mjs';
15
+ import unstorage_47drivers_47fs from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unstorage@1.16.0_db0@0.3.2_ioredis@5.6.1/node_modules/unstorage/drivers/fs.mjs';
16
+ import { digest } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.mjs';
17
+ import { klona } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/klona@2.0.6/node_modules/klona/dist/index.mjs';
18
+ import defu, { defuFn } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs';
19
+ import { snakeCase } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs';
20
+ import { getContext } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unctx@2.4.1/node_modules/unctx/dist/index.mjs';
21
+ import { toRouteMatcher, createRouter } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/radix3@1.1.2/node_modules/radix3/dist/index.mjs';
22
+ import { readFile } from 'node:fs/promises';
23
+ import consola, { consola as consola$1 } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs';
24
+ import { ErrorParser } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/youch-core@0.3.2/node_modules/youch-core/build/index.js';
25
+ import { Youch } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/youch@4.1.0-beta.8/node_modules/youch/build/index.js';
26
+ import { SourceMapConsumer } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/source-map.js';
27
+ import { AsyncLocalStorage } from 'node:async_hooks';
28
+ import { stringify, uneval } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/devalue@5.1.1/node_modules/devalue/index.js';
29
+ import { captureRawStackTrace, parseRawStackTrace } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/errx@0.1.0/node_modules/errx/dist/index.js';
30
+ import { isVNode, toValue, isRef } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/vue@3.5.16_typescript@5.8.3/node_modules/vue/index.mjs';
31
+ import { createHead as createHead$1, propsToString, renderSSRHead } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unhead@2.0.10/node_modules/unhead/dist/server.mjs';
32
+ import { DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unhead@2.0.10/node_modules/unhead/dist/plugins.mjs';
33
+ import { walkResolver } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unhead@2.0.10/node_modules/unhead/dist/utils.mjs';
34
+
35
+ const HASH_RE = /#/g;
36
+ const AMPERSAND_RE = /&/g;
37
+ const SLASH_RE = /\//g;
38
+ const EQUAL_RE = /=/g;
39
+ const PLUS_RE = /\+/g;
40
+ const ENC_CARET_RE = /%5e/gi;
41
+ const ENC_BACKTICK_RE = /%60/gi;
42
+ const ENC_PIPE_RE = /%7c/gi;
43
+ const ENC_SPACE_RE = /%20/gi;
44
+ function encode(text) {
45
+ return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
46
+ }
47
+ function encodeQueryValue(input) {
48
+ return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
49
+ }
50
+ function encodeQueryKey(text) {
51
+ return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
52
+ }
53
+ function decode(text = "") {
54
+ try {
55
+ return decodeURIComponent("" + text);
56
+ } catch {
57
+ return "" + text;
58
+ }
59
+ }
60
+ function decodeQueryKey(text) {
61
+ return decode(text.replace(PLUS_RE, " "));
62
+ }
63
+ function decodeQueryValue(text) {
64
+ return decode(text.replace(PLUS_RE, " "));
65
+ }
66
+
67
+ function parseQuery(parametersString = "") {
68
+ const object = /* @__PURE__ */ Object.create(null);
69
+ if (parametersString[0] === "?") {
70
+ parametersString = parametersString.slice(1);
71
+ }
72
+ for (const parameter of parametersString.split("&")) {
73
+ const s = parameter.match(/([^=]+)=?(.*)/) || [];
74
+ if (s.length < 2) {
75
+ continue;
76
+ }
77
+ const key = decodeQueryKey(s[1]);
78
+ if (key === "__proto__" || key === "constructor") {
79
+ continue;
80
+ }
81
+ const value = decodeQueryValue(s[2] || "");
82
+ if (object[key] === void 0) {
83
+ object[key] = value;
84
+ } else if (Array.isArray(object[key])) {
85
+ object[key].push(value);
86
+ } else {
87
+ object[key] = [object[key], value];
88
+ }
89
+ }
90
+ return object;
91
+ }
92
+ function encodeQueryItem(key, value) {
93
+ if (typeof value === "number" || typeof value === "boolean") {
94
+ value = String(value);
95
+ }
96
+ if (!value) {
97
+ return encodeQueryKey(key);
98
+ }
99
+ if (Array.isArray(value)) {
100
+ return value.map(
101
+ (_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`
102
+ ).join("&");
103
+ }
104
+ return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
105
+ }
106
+ function stringifyQuery(query) {
107
+ return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
108
+ }
109
+
110
+ const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
111
+ const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
112
+ const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
113
+ const JOIN_LEADING_SLASH_RE = /^\.?\//;
114
+ function hasProtocol(inputString, opts = {}) {
115
+ if (typeof opts === "boolean") {
116
+ opts = { acceptRelative: opts };
117
+ }
118
+ if (opts.strict) {
119
+ return PROTOCOL_STRICT_REGEX.test(inputString);
120
+ }
121
+ return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
122
+ }
123
+ function hasTrailingSlash(input = "", respectQueryAndFragment) {
124
+ {
125
+ return input.endsWith("/");
126
+ }
127
+ }
128
+ function withoutTrailingSlash(input = "", respectQueryAndFragment) {
129
+ {
130
+ return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
131
+ }
132
+ }
133
+ function withTrailingSlash(input = "", respectQueryAndFragment) {
134
+ {
135
+ return input.endsWith("/") ? input : input + "/";
136
+ }
137
+ }
138
+ function withoutBase(input, base) {
139
+ if (isEmptyURL(base)) {
140
+ return input;
141
+ }
142
+ const _base = withoutTrailingSlash(base);
143
+ if (!input.startsWith(_base)) {
144
+ return input;
145
+ }
146
+ const trimmed = input.slice(_base.length);
147
+ return trimmed[0] === "/" ? trimmed : "/" + trimmed;
148
+ }
149
+ function withQuery(input, query) {
150
+ const parsed = parseURL(input);
151
+ const mergedQuery = { ...parseQuery(parsed.search), ...query };
152
+ parsed.search = stringifyQuery(mergedQuery);
153
+ return stringifyParsedURL(parsed);
154
+ }
155
+ function getQuery(input) {
156
+ return parseQuery(parseURL(input).search);
157
+ }
158
+ function isEmptyURL(url) {
159
+ return !url || url === "/";
160
+ }
161
+ function isNonEmptyURL(url) {
162
+ return url && url !== "/";
163
+ }
164
+ function joinURL(base, ...input) {
165
+ let url = base || "";
166
+ for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
167
+ if (url) {
168
+ const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
169
+ url = withTrailingSlash(url) + _segment;
170
+ } else {
171
+ url = segment;
172
+ }
173
+ }
174
+ return url;
175
+ }
176
+ function joinRelativeURL(..._input) {
177
+ const JOIN_SEGMENT_SPLIT_RE = /\/(?!\/)/;
178
+ const input = _input.filter(Boolean);
179
+ const segments = [];
180
+ let segmentsDepth = 0;
181
+ for (const i of input) {
182
+ if (!i || i === "/") {
183
+ continue;
184
+ }
185
+ for (const [sindex, s] of i.split(JOIN_SEGMENT_SPLIT_RE).entries()) {
186
+ if (!s || s === ".") {
187
+ continue;
188
+ }
189
+ if (s === "..") {
190
+ if (segments.length === 1 && hasProtocol(segments[0])) {
191
+ continue;
192
+ }
193
+ segments.pop();
194
+ segmentsDepth--;
195
+ continue;
196
+ }
197
+ if (sindex === 1 && segments[segments.length - 1]?.endsWith(":/")) {
198
+ segments[segments.length - 1] += "/" + s;
199
+ continue;
200
+ }
201
+ segments.push(s);
202
+ segmentsDepth++;
203
+ }
204
+ }
205
+ let url = segments.join("/");
206
+ if (segmentsDepth >= 0) {
207
+ if (input[0]?.startsWith("/") && !url.startsWith("/")) {
208
+ url = "/" + url;
209
+ } else if (input[0]?.startsWith("./") && !url.startsWith("./")) {
210
+ url = "./" + url;
211
+ }
212
+ } else {
213
+ url = "../".repeat(-1 * segmentsDepth) + url;
214
+ }
215
+ if (input[input.length - 1]?.endsWith("/") && !url.endsWith("/")) {
216
+ url += "/";
217
+ }
218
+ return url;
219
+ }
220
+
221
+ const protocolRelative = Symbol.for("ufo:protocolRelative");
222
+ function parseURL(input = "", defaultProto) {
223
+ const _specialProtoMatch = input.match(
224
+ /^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
225
+ );
226
+ if (_specialProtoMatch) {
227
+ const [, _proto, _pathname = ""] = _specialProtoMatch;
228
+ return {
229
+ protocol: _proto.toLowerCase(),
230
+ pathname: _pathname,
231
+ href: _proto + _pathname,
232
+ auth: "",
233
+ host: "",
234
+ search: "",
235
+ hash: ""
236
+ };
237
+ }
238
+ if (!hasProtocol(input, { acceptRelative: true })) {
239
+ return parsePath(input);
240
+ }
241
+ const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
242
+ let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
243
+ if (protocol === "file:") {
244
+ path = path.replace(/\/(?=[A-Za-z]:)/, "");
245
+ }
246
+ const { pathname, search, hash } = parsePath(path);
247
+ return {
248
+ protocol: protocol.toLowerCase(),
249
+ auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
250
+ host,
251
+ pathname,
252
+ search,
253
+ hash,
254
+ [protocolRelative]: !protocol
255
+ };
256
+ }
257
+ function parsePath(input = "") {
258
+ const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
259
+ return {
260
+ pathname,
261
+ search,
262
+ hash
263
+ };
264
+ }
265
+ function stringifyParsedURL(parsed) {
266
+ const pathname = parsed.pathname || "";
267
+ const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
268
+ const hash = parsed.hash || "";
269
+ const auth = parsed.auth ? parsed.auth + "@" : "";
270
+ const host = parsed.host || "";
271
+ const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
272
+ return proto + auth + host + pathname + search + hash;
273
+ }
274
+
275
+ const serverAssets = [{"baseName":"server","dir":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/server/assets"}];
276
+
277
+ const assets = createStorage();
278
+
279
+ for (const asset of serverAssets) {
280
+ assets.mount(asset.baseName, unstorage_47drivers_47fs({ base: asset.dir, ignore: (asset?.ignore || []) }));
281
+ }
282
+
283
+ const storage = createStorage({});
284
+
285
+ storage.mount('/assets', assets);
286
+
287
+ storage.mount('root', unstorage_47drivers_47fs({"driver":"fs","readOnly":true,"base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule","watchOptions":{"ignored":[null]}}));
288
+ storage.mount('src', unstorage_47drivers_47fs({"driver":"fs","readOnly":true,"base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/server","watchOptions":{"ignored":[null]}}));
289
+ storage.mount('build', unstorage_47drivers_47fs({"driver":"fs","readOnly":false,"base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/.nuxt"}));
290
+ storage.mount('cache', unstorage_47drivers_47fs({"driver":"fs","readOnly":false,"base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/.nuxt/cache"}));
291
+ storage.mount('data', unstorage_47drivers_47fs({"driver":"fs","base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/.data/kv"}));
292
+
293
+ function useStorage(base = "") {
294
+ return base ? prefixStorage(storage, base) : storage;
295
+ }
296
+
297
+ const Hasher = /* @__PURE__ */ (() => {
298
+ class Hasher2 {
299
+ buff = "";
300
+ #context = /* @__PURE__ */ new Map();
301
+ write(str) {
302
+ this.buff += str;
303
+ }
304
+ dispatch(value) {
305
+ const type = value === null ? "null" : typeof value;
306
+ return this[type](value);
307
+ }
308
+ object(object) {
309
+ if (object && typeof object.toJSON === "function") {
310
+ return this.object(object.toJSON());
311
+ }
312
+ const objString = Object.prototype.toString.call(object);
313
+ let objType = "";
314
+ const objectLength = objString.length;
315
+ objType = objectLength < 10 ? "unknown:[" + objString + "]" : objString.slice(8, objectLength - 1);
316
+ objType = objType.toLowerCase();
317
+ let objectNumber = null;
318
+ if ((objectNumber = this.#context.get(object)) === void 0) {
319
+ this.#context.set(object, this.#context.size);
320
+ } else {
321
+ return this.dispatch("[CIRCULAR:" + objectNumber + "]");
322
+ }
323
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
324
+ this.write("buffer:");
325
+ return this.write(object.toString("utf8"));
326
+ }
327
+ if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
328
+ if (this[objType]) {
329
+ this[objType](object);
330
+ } else {
331
+ this.unknown(object, objType);
332
+ }
333
+ } else {
334
+ const keys = Object.keys(object).sort();
335
+ const extraKeys = [];
336
+ this.write("object:" + (keys.length + extraKeys.length) + ":");
337
+ const dispatchForKey = (key) => {
338
+ this.dispatch(key);
339
+ this.write(":");
340
+ this.dispatch(object[key]);
341
+ this.write(",");
342
+ };
343
+ for (const key of keys) {
344
+ dispatchForKey(key);
345
+ }
346
+ for (const key of extraKeys) {
347
+ dispatchForKey(key);
348
+ }
349
+ }
350
+ }
351
+ array(arr, unordered) {
352
+ unordered = unordered === void 0 ? false : unordered;
353
+ this.write("array:" + arr.length + ":");
354
+ if (!unordered || arr.length <= 1) {
355
+ for (const entry of arr) {
356
+ this.dispatch(entry);
357
+ }
358
+ return;
359
+ }
360
+ const contextAdditions = /* @__PURE__ */ new Map();
361
+ const entries = arr.map((entry) => {
362
+ const hasher = new Hasher2();
363
+ hasher.dispatch(entry);
364
+ for (const [key, value] of hasher.#context) {
365
+ contextAdditions.set(key, value);
366
+ }
367
+ return hasher.toString();
368
+ });
369
+ this.#context = contextAdditions;
370
+ entries.sort();
371
+ return this.array(entries, false);
372
+ }
373
+ date(date) {
374
+ return this.write("date:" + date.toJSON());
375
+ }
376
+ symbol(sym) {
377
+ return this.write("symbol:" + sym.toString());
378
+ }
379
+ unknown(value, type) {
380
+ this.write(type);
381
+ if (!value) {
382
+ return;
383
+ }
384
+ this.write(":");
385
+ if (value && typeof value.entries === "function") {
386
+ return this.array(
387
+ [...value.entries()],
388
+ true
389
+ /* ordered */
390
+ );
391
+ }
392
+ }
393
+ error(err) {
394
+ return this.write("error:" + err.toString());
395
+ }
396
+ boolean(bool) {
397
+ return this.write("bool:" + bool);
398
+ }
399
+ string(string) {
400
+ this.write("string:" + string.length + ":");
401
+ this.write(string);
402
+ }
403
+ function(fn) {
404
+ this.write("fn:");
405
+ if (isNativeFunction(fn)) {
406
+ this.dispatch("[native]");
407
+ } else {
408
+ this.dispatch(fn.toString());
409
+ }
410
+ }
411
+ number(number) {
412
+ return this.write("number:" + number);
413
+ }
414
+ null() {
415
+ return this.write("Null");
416
+ }
417
+ undefined() {
418
+ return this.write("Undefined");
419
+ }
420
+ regexp(regex) {
421
+ return this.write("regex:" + regex.toString());
422
+ }
423
+ arraybuffer(arr) {
424
+ this.write("arraybuffer:");
425
+ return this.dispatch(new Uint8Array(arr));
426
+ }
427
+ url(url) {
428
+ return this.write("url:" + url.toString());
429
+ }
430
+ map(map) {
431
+ this.write("map:");
432
+ const arr = [...map];
433
+ return this.array(arr, false);
434
+ }
435
+ set(set) {
436
+ this.write("set:");
437
+ const arr = [...set];
438
+ return this.array(arr, false);
439
+ }
440
+ bigint(number) {
441
+ return this.write("bigint:" + number.toString());
442
+ }
443
+ }
444
+ for (const type of [
445
+ "uint8array",
446
+ "uint8clampedarray",
447
+ "unt8array",
448
+ "uint16array",
449
+ "unt16array",
450
+ "uint32array",
451
+ "unt32array",
452
+ "float32array",
453
+ "float64array"
454
+ ]) {
455
+ Hasher2.prototype[type] = function(arr) {
456
+ this.write(type + ":");
457
+ return this.array([...arr], false);
458
+ };
459
+ }
460
+ function isNativeFunction(f) {
461
+ if (typeof f !== "function") {
462
+ return false;
463
+ }
464
+ return Function.prototype.toString.call(f).slice(
465
+ -15
466
+ /* "[native code] }".length */
467
+ ) === "[native code] }";
468
+ }
469
+ return Hasher2;
470
+ })();
471
+ function serialize(object) {
472
+ const hasher = new Hasher();
473
+ hasher.dispatch(object);
474
+ return hasher.buff;
475
+ }
476
+ function hash(value) {
477
+ return digest(typeof value === "string" ? value : serialize(value)).replace(/[-_]/g, "").slice(0, 10);
478
+ }
479
+
480
+ function defaultCacheOptions() {
481
+ return {
482
+ name: "_",
483
+ base: "/cache",
484
+ swr: true,
485
+ maxAge: 1
486
+ };
487
+ }
488
+ function defineCachedFunction(fn, opts = {}) {
489
+ opts = { ...defaultCacheOptions(), ...opts };
490
+ const pending = {};
491
+ const group = opts.group || "nitro/functions";
492
+ const name = opts.name || fn.name || "_";
493
+ const integrity = opts.integrity || hash([fn, opts]);
494
+ const validate = opts.validate || ((entry) => entry.value !== void 0);
495
+ async function get(key, resolver, shouldInvalidateCache, event) {
496
+ const cacheKey = [opts.base, group, name, key + ".json"].filter(Boolean).join(":").replace(/:\/$/, ":index");
497
+ let entry = await useStorage().getItem(cacheKey).catch((error) => {
498
+ console.error(`[cache] Cache read error.`, error);
499
+ useNitroApp().captureError(error, { event, tags: ["cache"] });
500
+ }) || {};
501
+ if (typeof entry !== "object") {
502
+ entry = {};
503
+ const error = new Error("Malformed data read from cache.");
504
+ console.error("[cache]", error);
505
+ useNitroApp().captureError(error, { event, tags: ["cache"] });
506
+ }
507
+ const ttl = (opts.maxAge ?? 0) * 1e3;
508
+ if (ttl) {
509
+ entry.expires = Date.now() + ttl;
510
+ }
511
+ const expired = shouldInvalidateCache || entry.integrity !== integrity || ttl && Date.now() - (entry.mtime || 0) > ttl || validate(entry) === false;
512
+ const _resolve = async () => {
513
+ const isPending = pending[key];
514
+ if (!isPending) {
515
+ if (entry.value !== void 0 && (opts.staleMaxAge || 0) >= 0 && opts.swr === false) {
516
+ entry.value = void 0;
517
+ entry.integrity = void 0;
518
+ entry.mtime = void 0;
519
+ entry.expires = void 0;
520
+ }
521
+ pending[key] = Promise.resolve(resolver());
522
+ }
523
+ try {
524
+ entry.value = await pending[key];
525
+ } catch (error) {
526
+ if (!isPending) {
527
+ delete pending[key];
528
+ }
529
+ throw error;
530
+ }
531
+ if (!isPending) {
532
+ entry.mtime = Date.now();
533
+ entry.integrity = integrity;
534
+ delete pending[key];
535
+ if (validate(entry) !== false) {
536
+ let setOpts;
537
+ if (opts.maxAge && !opts.swr) {
538
+ setOpts = { ttl: opts.maxAge };
539
+ }
540
+ const promise = useStorage().setItem(cacheKey, entry, setOpts).catch((error) => {
541
+ console.error(`[cache] Cache write error.`, error);
542
+ useNitroApp().captureError(error, { event, tags: ["cache"] });
543
+ });
544
+ if (event?.waitUntil) {
545
+ event.waitUntil(promise);
546
+ }
547
+ }
548
+ }
549
+ };
550
+ const _resolvePromise = expired ? _resolve() : Promise.resolve();
551
+ if (entry.value === void 0) {
552
+ await _resolvePromise;
553
+ } else if (expired && event && event.waitUntil) {
554
+ event.waitUntil(_resolvePromise);
555
+ }
556
+ if (opts.swr && validate(entry) !== false) {
557
+ _resolvePromise.catch((error) => {
558
+ console.error(`[cache] SWR handler error.`, error);
559
+ useNitroApp().captureError(error, { event, tags: ["cache"] });
560
+ });
561
+ return entry;
562
+ }
563
+ return _resolvePromise.then(() => entry);
564
+ }
565
+ return async (...args) => {
566
+ const shouldBypassCache = await opts.shouldBypassCache?.(...args);
567
+ if (shouldBypassCache) {
568
+ return fn(...args);
569
+ }
570
+ const key = await (opts.getKey || getKey)(...args);
571
+ const shouldInvalidateCache = await opts.shouldInvalidateCache?.(...args);
572
+ const entry = await get(
573
+ key,
574
+ () => fn(...args),
575
+ shouldInvalidateCache,
576
+ args[0] && isEvent(args[0]) ? args[0] : void 0
577
+ );
578
+ let value = entry.value;
579
+ if (opts.transform) {
580
+ value = await opts.transform(entry, ...args) || value;
581
+ }
582
+ return value;
583
+ };
584
+ }
585
+ function cachedFunction(fn, opts = {}) {
586
+ return defineCachedFunction(fn, opts);
587
+ }
588
+ function getKey(...args) {
589
+ return args.length > 0 ? hash(args) : "";
590
+ }
591
+ function escapeKey(key) {
592
+ return String(key).replace(/\W/g, "");
593
+ }
594
+ function defineCachedEventHandler(handler, opts = defaultCacheOptions()) {
595
+ const variableHeaderNames = (opts.varies || []).filter(Boolean).map((h) => h.toLowerCase()).sort();
596
+ const _opts = {
597
+ ...opts,
598
+ getKey: async (event) => {
599
+ const customKey = await opts.getKey?.(event);
600
+ if (customKey) {
601
+ return escapeKey(customKey);
602
+ }
603
+ const _path = event.node.req.originalUrl || event.node.req.url || event.path;
604
+ let _pathname;
605
+ try {
606
+ _pathname = escapeKey(decodeURI(parseURL(_path).pathname)).slice(0, 16) || "index";
607
+ } catch {
608
+ _pathname = "-";
609
+ }
610
+ const _hashedPath = `${_pathname}.${hash(_path)}`;
611
+ const _headers = variableHeaderNames.map((header) => [header, event.node.req.headers[header]]).map(([name, value]) => `${escapeKey(name)}.${hash(value)}`);
612
+ return [_hashedPath, ..._headers].join(":");
613
+ },
614
+ validate: (entry) => {
615
+ if (!entry.value) {
616
+ return false;
617
+ }
618
+ if (entry.value.code >= 400) {
619
+ return false;
620
+ }
621
+ if (entry.value.body === void 0) {
622
+ return false;
623
+ }
624
+ if (entry.value.headers.etag === "undefined" || entry.value.headers["last-modified"] === "undefined") {
625
+ return false;
626
+ }
627
+ return true;
628
+ },
629
+ group: opts.group || "nitro/handlers",
630
+ integrity: opts.integrity || hash([handler, opts])
631
+ };
632
+ const _cachedHandler = cachedFunction(
633
+ async (incomingEvent) => {
634
+ const variableHeaders = {};
635
+ for (const header of variableHeaderNames) {
636
+ const value = incomingEvent.node.req.headers[header];
637
+ if (value !== void 0) {
638
+ variableHeaders[header] = value;
639
+ }
640
+ }
641
+ const reqProxy = cloneWithProxy(incomingEvent.node.req, {
642
+ headers: variableHeaders
643
+ });
644
+ const resHeaders = {};
645
+ let _resSendBody;
646
+ const resProxy = cloneWithProxy(incomingEvent.node.res, {
647
+ statusCode: 200,
648
+ writableEnded: false,
649
+ writableFinished: false,
650
+ headersSent: false,
651
+ closed: false,
652
+ getHeader(name) {
653
+ return resHeaders[name];
654
+ },
655
+ setHeader(name, value) {
656
+ resHeaders[name] = value;
657
+ return this;
658
+ },
659
+ getHeaderNames() {
660
+ return Object.keys(resHeaders);
661
+ },
662
+ hasHeader(name) {
663
+ return name in resHeaders;
664
+ },
665
+ removeHeader(name) {
666
+ delete resHeaders[name];
667
+ },
668
+ getHeaders() {
669
+ return resHeaders;
670
+ },
671
+ end(chunk, arg2, arg3) {
672
+ if (typeof chunk === "string") {
673
+ _resSendBody = chunk;
674
+ }
675
+ if (typeof arg2 === "function") {
676
+ arg2();
677
+ }
678
+ if (typeof arg3 === "function") {
679
+ arg3();
680
+ }
681
+ return this;
682
+ },
683
+ write(chunk, arg2, arg3) {
684
+ if (typeof chunk === "string") {
685
+ _resSendBody = chunk;
686
+ }
687
+ if (typeof arg2 === "function") {
688
+ arg2(void 0);
689
+ }
690
+ if (typeof arg3 === "function") {
691
+ arg3();
692
+ }
693
+ return true;
694
+ },
695
+ writeHead(statusCode, headers2) {
696
+ this.statusCode = statusCode;
697
+ if (headers2) {
698
+ if (Array.isArray(headers2) || typeof headers2 === "string") {
699
+ throw new TypeError("Raw headers is not supported.");
700
+ }
701
+ for (const header in headers2) {
702
+ const value = headers2[header];
703
+ if (value !== void 0) {
704
+ this.setHeader(
705
+ header,
706
+ value
707
+ );
708
+ }
709
+ }
710
+ }
711
+ return this;
712
+ }
713
+ });
714
+ const event = createEvent(reqProxy, resProxy);
715
+ event.fetch = (url, fetchOptions) => fetchWithEvent(event, url, fetchOptions, {
716
+ fetch: useNitroApp().localFetch
717
+ });
718
+ event.$fetch = (url, fetchOptions) => fetchWithEvent(event, url, fetchOptions, {
719
+ fetch: globalThis.$fetch
720
+ });
721
+ event.waitUntil = incomingEvent.waitUntil;
722
+ event.context = incomingEvent.context;
723
+ event.context.cache = {
724
+ options: _opts
725
+ };
726
+ const body = await handler(event) || _resSendBody;
727
+ const headers = event.node.res.getHeaders();
728
+ headers.etag = String(
729
+ headers.Etag || headers.etag || `W/"${hash(body)}"`
730
+ );
731
+ headers["last-modified"] = String(
732
+ headers["Last-Modified"] || headers["last-modified"] || (/* @__PURE__ */ new Date()).toUTCString()
733
+ );
734
+ const cacheControl = [];
735
+ if (opts.swr) {
736
+ if (opts.maxAge) {
737
+ cacheControl.push(`s-maxage=${opts.maxAge}`);
738
+ }
739
+ if (opts.staleMaxAge) {
740
+ cacheControl.push(`stale-while-revalidate=${opts.staleMaxAge}`);
741
+ } else {
742
+ cacheControl.push("stale-while-revalidate");
743
+ }
744
+ } else if (opts.maxAge) {
745
+ cacheControl.push(`max-age=${opts.maxAge}`);
746
+ }
747
+ if (cacheControl.length > 0) {
748
+ headers["cache-control"] = cacheControl.join(", ");
749
+ }
750
+ const cacheEntry = {
751
+ code: event.node.res.statusCode,
752
+ headers,
753
+ body
754
+ };
755
+ return cacheEntry;
756
+ },
757
+ _opts
758
+ );
759
+ return defineEventHandler(async (event) => {
760
+ if (opts.headersOnly) {
761
+ if (handleCacheHeaders(event, { maxAge: opts.maxAge })) {
762
+ return;
763
+ }
764
+ return handler(event);
765
+ }
766
+ const response = await _cachedHandler(
767
+ event
768
+ );
769
+ if (event.node.res.headersSent || event.node.res.writableEnded) {
770
+ return response.body;
771
+ }
772
+ if (handleCacheHeaders(event, {
773
+ modifiedTime: new Date(response.headers["last-modified"]),
774
+ etag: response.headers.etag,
775
+ maxAge: opts.maxAge
776
+ })) {
777
+ return;
778
+ }
779
+ event.node.res.statusCode = response.code;
780
+ for (const name in response.headers) {
781
+ const value = response.headers[name];
782
+ if (name === "set-cookie") {
783
+ event.node.res.appendHeader(
784
+ name,
785
+ splitCookiesString(value)
786
+ );
787
+ } else {
788
+ if (value !== void 0) {
789
+ event.node.res.setHeader(name, value);
790
+ }
791
+ }
792
+ }
793
+ return response.body;
794
+ });
795
+ }
796
+ function cloneWithProxy(obj, overrides) {
797
+ return new Proxy(obj, {
798
+ get(target, property, receiver) {
799
+ if (property in overrides) {
800
+ return overrides[property];
801
+ }
802
+ return Reflect.get(target, property, receiver);
803
+ },
804
+ set(target, property, value, receiver) {
805
+ if (property in overrides) {
806
+ overrides[property] = value;
807
+ return true;
808
+ }
809
+ return Reflect.set(target, property, value, receiver);
810
+ }
811
+ });
812
+ }
813
+ const cachedEventHandler = defineCachedEventHandler;
814
+
815
+ const inlineAppConfig = {
816
+ "nuxt": {}
817
+ };
818
+
819
+
820
+
821
+ const appConfig = defuFn(inlineAppConfig);
822
+
823
+ function getEnv(key, opts) {
824
+ const envKey = snakeCase(key).toUpperCase();
825
+ return destr(
826
+ process.env[opts.prefix + envKey] ?? process.env[opts.altPrefix + envKey]
827
+ );
828
+ }
829
+ function _isObject(input) {
830
+ return typeof input === "object" && !Array.isArray(input);
831
+ }
832
+ function applyEnv(obj, opts, parentKey = "") {
833
+ for (const key in obj) {
834
+ const subKey = parentKey ? `${parentKey}_${key}` : key;
835
+ const envValue = getEnv(subKey, opts);
836
+ if (_isObject(obj[key])) {
837
+ if (_isObject(envValue)) {
838
+ obj[key] = { ...obj[key], ...envValue };
839
+ applyEnv(obj[key], opts, subKey);
840
+ } else if (envValue === void 0) {
841
+ applyEnv(obj[key], opts, subKey);
842
+ } else {
843
+ obj[key] = envValue ?? obj[key];
844
+ }
845
+ } else {
846
+ obj[key] = envValue ?? obj[key];
847
+ }
848
+ if (opts.envExpansion && typeof obj[key] === "string") {
849
+ obj[key] = _expandFromEnv(obj[key]);
850
+ }
851
+ }
852
+ return obj;
853
+ }
854
+ const envExpandRx = /\{\{([^{}]*)\}\}/g;
855
+ function _expandFromEnv(value) {
856
+ return value.replace(envExpandRx, (match, key) => {
857
+ return process.env[key] || match;
858
+ });
859
+ }
860
+
861
+ const _inlineRuntimeConfig = {
862
+ "app": {
863
+ "baseURL": "/",
864
+ "buildId": "dev",
865
+ "buildAssetsDir": "/_nuxt/",
866
+ "cdnURL": ""
867
+ },
868
+ "nitro": {
869
+ "envPrefix": "NUXT_",
870
+ "routeRules": {
871
+ "/__nuxt_error": {
872
+ "cache": false
873
+ }
874
+ }
875
+ },
876
+ "public": {
877
+ "i18n": {
878
+ "baseUrl": "",
879
+ "defaultLocale": "en",
880
+ "defaultDirection": "ltr",
881
+ "strategy": "no_prefix",
882
+ "lazy": true,
883
+ "rootRedirect": "",
884
+ "routesNameSeparator": "___",
885
+ "defaultLocaleRouteNameSuffix": "default",
886
+ "skipSettingLocaleOnNavigate": false,
887
+ "differentDomains": false,
888
+ "trailingSlash": false,
889
+ "locales": [
890
+ {
891
+ "code": "en",
892
+ "name": "English",
893
+ "iso": "en-US",
894
+ "files": [
895
+ "/Volumes/Development/Lotrek/Projects/mapo/packages/@mapomodule/uikit/i18n/locales/en-US.ts"
896
+ ]
897
+ },
898
+ {
899
+ "code": "it",
900
+ "name": "Italiano",
901
+ "iso": "it-IT",
902
+ "files": [
903
+ "/Volumes/Development/Lotrek/Projects/mapo/packages/@mapomodule/uikit/i18n/locales/it-IT.ts"
904
+ ]
905
+ }
906
+ ],
907
+ "detectBrowserLanguage": {
908
+ "alwaysRedirect": false,
909
+ "cookieCrossOrigin": false,
910
+ "cookieDomain": "",
911
+ "cookieKey": "i18n_redirected",
912
+ "cookieSecure": false,
913
+ "fallbackLocale": "",
914
+ "redirectOn": "root",
915
+ "useCookie": true
916
+ },
917
+ "experimental": {
918
+ "localeDetector": "",
919
+ "switchLocalePathLinkSSR": false,
920
+ "autoImportTranslationFunctions": false,
921
+ "typedPages": true,
922
+ "typedOptionsAndMessages": false,
923
+ "generatedLocaleFilePathFormat": "absolute",
924
+ "alternateLinkCanonicalQueries": false,
925
+ "hmr": true
926
+ },
927
+ "multiDomainLocales": false
928
+ }
929
+ }
930
+ };
931
+ const envOptions = {
932
+ prefix: "NITRO_",
933
+ altPrefix: _inlineRuntimeConfig.nitro.envPrefix ?? process.env.NITRO_ENV_PREFIX ?? "_",
934
+ envExpansion: _inlineRuntimeConfig.nitro.envExpansion ?? process.env.NITRO_ENV_EXPANSION ?? false
935
+ };
936
+ const _sharedRuntimeConfig = _deepFreeze(
937
+ applyEnv(klona(_inlineRuntimeConfig), envOptions)
938
+ );
939
+ function useRuntimeConfig(event) {
940
+ if (!event) {
941
+ return _sharedRuntimeConfig;
942
+ }
943
+ if (event.context.nitro.runtimeConfig) {
944
+ return event.context.nitro.runtimeConfig;
945
+ }
946
+ const runtimeConfig = klona(_inlineRuntimeConfig);
947
+ applyEnv(runtimeConfig, envOptions);
948
+ event.context.nitro.runtimeConfig = runtimeConfig;
949
+ return runtimeConfig;
950
+ }
951
+ _deepFreeze(klona(appConfig));
952
+ function _deepFreeze(object) {
953
+ const propNames = Object.getOwnPropertyNames(object);
954
+ for (const name of propNames) {
955
+ const value = object[name];
956
+ if (value && typeof value === "object") {
957
+ _deepFreeze(value);
958
+ }
959
+ }
960
+ return Object.freeze(object);
961
+ }
962
+ new Proxy(/* @__PURE__ */ Object.create(null), {
963
+ get: (_, prop) => {
964
+ console.warn(
965
+ "Please use `useRuntimeConfig()` instead of accessing config directly."
966
+ );
967
+ const runtimeConfig = useRuntimeConfig();
968
+ if (prop in runtimeConfig) {
969
+ return runtimeConfig[prop];
970
+ }
971
+ return void 0;
972
+ }
973
+ });
974
+
975
+ getContext("nitro-app", {
976
+ asyncContext: false,
977
+ AsyncLocalStorage: void 0
978
+ });
979
+
980
+ const config = useRuntimeConfig();
981
+ const _routeRulesMatcher = toRouteMatcher(
982
+ createRouter({ routes: config.nitro.routeRules })
983
+ );
984
+ function createRouteRulesHandler(ctx) {
985
+ return eventHandler((event) => {
986
+ const routeRules = getRouteRules(event);
987
+ if (routeRules.headers) {
988
+ setHeaders(event, routeRules.headers);
989
+ }
990
+ if (routeRules.redirect) {
991
+ let target = routeRules.redirect.to;
992
+ if (target.endsWith("/**")) {
993
+ let targetPath = event.path;
994
+ const strpBase = routeRules.redirect._redirectStripBase;
995
+ if (strpBase) {
996
+ targetPath = withoutBase(targetPath, strpBase);
997
+ }
998
+ target = joinURL(target.slice(0, -3), targetPath);
999
+ } else if (event.path.includes("?")) {
1000
+ const query = getQuery(event.path);
1001
+ target = withQuery(target, query);
1002
+ }
1003
+ return sendRedirect(event, target, routeRules.redirect.statusCode);
1004
+ }
1005
+ if (routeRules.proxy) {
1006
+ let target = routeRules.proxy.to;
1007
+ if (target.endsWith("/**")) {
1008
+ let targetPath = event.path;
1009
+ const strpBase = routeRules.proxy._proxyStripBase;
1010
+ if (strpBase) {
1011
+ targetPath = withoutBase(targetPath, strpBase);
1012
+ }
1013
+ target = joinURL(target.slice(0, -3), targetPath);
1014
+ } else if (event.path.includes("?")) {
1015
+ const query = getQuery(event.path);
1016
+ target = withQuery(target, query);
1017
+ }
1018
+ return proxyRequest(event, target, {
1019
+ fetch: ctx.localFetch,
1020
+ ...routeRules.proxy
1021
+ });
1022
+ }
1023
+ });
1024
+ }
1025
+ function getRouteRules(event) {
1026
+ event.context._nitro = event.context._nitro || {};
1027
+ if (!event.context._nitro.routeRules) {
1028
+ event.context._nitro.routeRules = getRouteRulesForPath(
1029
+ withoutBase(event.path.split("?")[0], useRuntimeConfig().app.baseURL)
1030
+ );
1031
+ }
1032
+ return event.context._nitro.routeRules;
1033
+ }
1034
+ function getRouteRulesForPath(path) {
1035
+ return defu({}, ..._routeRulesMatcher.matchAll(path).reverse());
1036
+ }
1037
+
1038
+ function _captureError(error, type) {
1039
+ console.error(`[${type}]`, error);
1040
+ useNitroApp().captureError(error, { tags: [type] });
1041
+ }
1042
+ function trapUnhandledNodeErrors() {
1043
+ process.on(
1044
+ "unhandledRejection",
1045
+ (error) => _captureError(error, "unhandledRejection")
1046
+ );
1047
+ process.on(
1048
+ "uncaughtException",
1049
+ (error) => _captureError(error, "uncaughtException")
1050
+ );
1051
+ }
1052
+ function joinHeaders(value) {
1053
+ return Array.isArray(value) ? value.join(", ") : String(value);
1054
+ }
1055
+ function normalizeFetchResponse(response) {
1056
+ if (!response.headers.has("set-cookie")) {
1057
+ return response;
1058
+ }
1059
+ return new Response(response.body, {
1060
+ status: response.status,
1061
+ statusText: response.statusText,
1062
+ headers: normalizeCookieHeaders(response.headers)
1063
+ });
1064
+ }
1065
+ function normalizeCookieHeader(header = "") {
1066
+ return splitCookiesString(joinHeaders(header));
1067
+ }
1068
+ function normalizeCookieHeaders(headers) {
1069
+ const outgoingHeaders = new Headers();
1070
+ for (const [name, header] of headers) {
1071
+ if (name === "set-cookie") {
1072
+ for (const cookie of normalizeCookieHeader(header)) {
1073
+ outgoingHeaders.append("set-cookie", cookie);
1074
+ }
1075
+ } else {
1076
+ outgoingHeaders.set(name, joinHeaders(header));
1077
+ }
1078
+ }
1079
+ return outgoingHeaders;
1080
+ }
1081
+
1082
+ function isJsonRequest(event) {
1083
+ if (hasReqHeader(event, "accept", "text/html")) {
1084
+ return false;
1085
+ }
1086
+ return hasReqHeader(event, "accept", "application/json") || hasReqHeader(event, "user-agent", "curl/") || hasReqHeader(event, "user-agent", "httpie/") || hasReqHeader(event, "sec-fetch-mode", "cors") || event.path.startsWith("/api/") || event.path.endsWith(".json");
1087
+ }
1088
+ function hasReqHeader(event, name, includes) {
1089
+ const value = getRequestHeader(event, name);
1090
+ return value && typeof value === "string" && value.toLowerCase().includes(includes);
1091
+ }
1092
+
1093
+ const errorHandler$0 = (async function errorhandler(error, event, { defaultHandler }) {
1094
+ if (event.handled || isJsonRequest(event)) {
1095
+ return;
1096
+ }
1097
+ const defaultRes = await defaultHandler(error, event, { json: true });
1098
+ const statusCode = error.statusCode || 500;
1099
+ if (statusCode === 404 && defaultRes.status === 302) {
1100
+ setResponseHeaders(event, defaultRes.headers);
1101
+ setResponseStatus(event, defaultRes.status, defaultRes.statusText);
1102
+ return send(event, JSON.stringify(defaultRes.body, null, 2));
1103
+ }
1104
+ if (typeof defaultRes.body !== "string" && Array.isArray(defaultRes.body.stack)) {
1105
+ defaultRes.body.stack = defaultRes.body.stack.join("\n");
1106
+ }
1107
+ const errorObject = defaultRes.body;
1108
+ const url = new URL(errorObject.url);
1109
+ errorObject.url = withoutBase(url.pathname, useRuntimeConfig(event).app.baseURL) + url.search + url.hash;
1110
+ errorObject.message ||= "Server Error";
1111
+ errorObject.data ||= error.data;
1112
+ errorObject.statusMessage ||= error.statusMessage;
1113
+ delete defaultRes.headers["content-type"];
1114
+ delete defaultRes.headers["content-security-policy"];
1115
+ setResponseHeaders(event, defaultRes.headers);
1116
+ const reqHeaders = getRequestHeaders(event);
1117
+ const isRenderingError = event.path.startsWith("/__nuxt_error") || !!reqHeaders["x-nuxt-error"];
1118
+ const res = isRenderingError ? null : await useNitroApp().localFetch(
1119
+ withQuery(joinURL(useRuntimeConfig(event).app.baseURL, "/__nuxt_error"), errorObject),
1120
+ {
1121
+ headers: { ...reqHeaders, "x-nuxt-error": "true" },
1122
+ redirect: "manual"
1123
+ }
1124
+ ).catch(() => null);
1125
+ if (event.handled) {
1126
+ return;
1127
+ }
1128
+ if (!res) {
1129
+ const { template } = await Promise.resolve().then(function () { return errorDev; }) ;
1130
+ {
1131
+ errorObject.description = errorObject.message;
1132
+ }
1133
+ setResponseHeader(event, "Content-Type", "text/html;charset=UTF-8");
1134
+ return send(event, template(errorObject));
1135
+ }
1136
+ const html = await res.text();
1137
+ for (const [header, value] of res.headers.entries()) {
1138
+ setResponseHeader(event, header, value);
1139
+ }
1140
+ setResponseStatus(event, res.status && res.status !== 200 ? res.status : defaultRes.status, res.statusText || defaultRes.statusText);
1141
+ return send(event, html);
1142
+ });
1143
+
1144
+ function defineNitroErrorHandler(handler) {
1145
+ return handler;
1146
+ }
1147
+
1148
+ const errorHandler$1 = defineNitroErrorHandler(
1149
+ async function defaultNitroErrorHandler(error, event) {
1150
+ const res = await defaultHandler(error, event);
1151
+ if (!event.node?.res.headersSent) {
1152
+ setResponseHeaders(event, res.headers);
1153
+ }
1154
+ setResponseStatus(event, res.status, res.statusText);
1155
+ return send(
1156
+ event,
1157
+ typeof res.body === "string" ? res.body : JSON.stringify(res.body, null, 2)
1158
+ );
1159
+ }
1160
+ );
1161
+ async function defaultHandler(error, event, opts) {
1162
+ const isSensitive = error.unhandled || error.fatal;
1163
+ const statusCode = error.statusCode || 500;
1164
+ const statusMessage = error.statusMessage || "Server Error";
1165
+ const url = getRequestURL(event, { xForwardedHost: true, xForwardedProto: true });
1166
+ if (statusCode === 404) {
1167
+ const baseURL = "/";
1168
+ if (/^\/[^/]/.test(baseURL) && !url.pathname.startsWith(baseURL)) {
1169
+ const redirectTo = `${baseURL}${url.pathname.slice(1)}${url.search}`;
1170
+ return {
1171
+ status: 302,
1172
+ statusText: "Found",
1173
+ headers: { location: redirectTo },
1174
+ body: `Redirecting...`
1175
+ };
1176
+ }
1177
+ }
1178
+ await loadStackTrace(error).catch(consola.error);
1179
+ const youch = new Youch();
1180
+ if (isSensitive && !opts?.silent) {
1181
+ const tags = [error.unhandled && "[unhandled]", error.fatal && "[fatal]"].filter(Boolean).join(" ");
1182
+ const ansiError = await (await youch.toANSI(error)).replaceAll(process.cwd(), ".");
1183
+ consola.error(
1184
+ `[request error] ${tags} [${event.method}] ${url}
1185
+
1186
+ `,
1187
+ ansiError
1188
+ );
1189
+ }
1190
+ const useJSON = opts?.json || !getRequestHeader(event, "accept")?.includes("text/html");
1191
+ const headers = {
1192
+ "content-type": useJSON ? "application/json" : "text/html",
1193
+ // Prevent browser from guessing the MIME types of resources.
1194
+ "x-content-type-options": "nosniff",
1195
+ // Prevent error page from being embedded in an iframe
1196
+ "x-frame-options": "DENY",
1197
+ // Prevent browsers from sending the Referer header
1198
+ "referrer-policy": "no-referrer",
1199
+ // Disable the execution of any js
1200
+ "content-security-policy": "script-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self';"
1201
+ };
1202
+ if (statusCode === 404 || !getResponseHeader(event, "cache-control")) {
1203
+ headers["cache-control"] = "no-cache";
1204
+ }
1205
+ const body = useJSON ? {
1206
+ error: true,
1207
+ url,
1208
+ statusCode,
1209
+ statusMessage,
1210
+ message: error.message,
1211
+ data: error.data,
1212
+ stack: error.stack?.split("\n").map((line) => line.trim())
1213
+ } : await youch.toHTML(error, {
1214
+ request: {
1215
+ url: url.href,
1216
+ method: event.method,
1217
+ headers: getRequestHeaders(event)
1218
+ }
1219
+ });
1220
+ return {
1221
+ status: statusCode,
1222
+ statusText: statusMessage,
1223
+ headers,
1224
+ body
1225
+ };
1226
+ }
1227
+ async function loadStackTrace(error) {
1228
+ if (!(error instanceof Error)) {
1229
+ return;
1230
+ }
1231
+ const parsed = await new ErrorParser().defineSourceLoader(sourceLoader).parse(error);
1232
+ const stack = error.message + "\n" + parsed.frames.map((frame) => fmtFrame(frame)).join("\n");
1233
+ Object.defineProperty(error, "stack", { value: stack });
1234
+ if (error.cause) {
1235
+ await loadStackTrace(error.cause).catch(consola.error);
1236
+ }
1237
+ }
1238
+ async function sourceLoader(frame) {
1239
+ if (!frame.fileName || frame.fileType !== "fs" || frame.type === "native") {
1240
+ return;
1241
+ }
1242
+ if (frame.type === "app") {
1243
+ const rawSourceMap = await readFile(`${frame.fileName}.map`, "utf8").catch(() => {
1244
+ });
1245
+ if (rawSourceMap) {
1246
+ const consumer = await new SourceMapConsumer(rawSourceMap);
1247
+ const originalPosition = consumer.originalPositionFor({ line: frame.lineNumber, column: frame.columnNumber });
1248
+ if (originalPosition.source && originalPosition.line) {
1249
+ frame.fileName = resolve(dirname(frame.fileName), originalPosition.source);
1250
+ frame.lineNumber = originalPosition.line;
1251
+ frame.columnNumber = originalPosition.column || 0;
1252
+ }
1253
+ }
1254
+ }
1255
+ const contents = await readFile(frame.fileName, "utf8").catch(() => {
1256
+ });
1257
+ return contents ? { contents } : void 0;
1258
+ }
1259
+ function fmtFrame(frame) {
1260
+ if (frame.type === "native") {
1261
+ return frame.raw;
1262
+ }
1263
+ const src = `${frame.fileName || ""}:${frame.lineNumber}:${frame.columnNumber})`;
1264
+ return frame.functionName ? `at ${frame.functionName} (${src}` : `at ${src}`;
1265
+ }
1266
+
1267
+ const errorHandlers = [errorHandler$0, errorHandler$1];
1268
+
1269
+ async function errorHandler(error, event) {
1270
+ for (const handler of errorHandlers) {
1271
+ try {
1272
+ await handler(error, event, { defaultHandler });
1273
+ if (event.handled) {
1274
+ return; // Response handled
1275
+ }
1276
+ } catch(error) {
1277
+ // Handler itself thrown, log and continue
1278
+ console.error(error);
1279
+ }
1280
+ }
1281
+ // H3 will handle fallback
1282
+ }
1283
+
1284
+ const script = `
1285
+ if (!window.__NUXT_DEVTOOLS_TIME_METRIC__) {
1286
+ Object.defineProperty(window, '__NUXT_DEVTOOLS_TIME_METRIC__', {
1287
+ value: {},
1288
+ enumerable: false,
1289
+ configurable: true,
1290
+ })
1291
+ }
1292
+ window.__NUXT_DEVTOOLS_TIME_METRIC__.appInit = Date.now()
1293
+ `;
1294
+
1295
+ const _yajFGiX8skDovnI5iDQnPqZ2oQtcYr27GmTd3wik120 = (function(nitro) {
1296
+ nitro.hooks.hook("render:html", (htmlContext) => {
1297
+ htmlContext.head.push(`<script>${script}<\/script>`);
1298
+ });
1299
+ });
1300
+
1301
+ const rootDir = "/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule";
1302
+
1303
+ const appHead = {"meta":[{"name":"viewport","content":"width=device-width, initial-scale=1"},{"charset":"utf-8"}],"link":[{"key":"mdi","rel":"stylesheet","href":"https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css","type":"text/css","crossorigin":"anonymous"}],"style":[],"script":[],"noscript":[]};
1304
+
1305
+ const appRootTag = "div";
1306
+
1307
+ const appRootAttrs = {"id":"__nuxt"};
1308
+
1309
+ const appTeleportTag = "div";
1310
+
1311
+ const appTeleportAttrs = {"id":"teleports"};
1312
+
1313
+ const appId = "nuxt-app";
1314
+
1315
+ const devReducers = {
1316
+ VNode: (data) => isVNode(data) ? { type: data.type, props: data.props } : void 0,
1317
+ URL: (data) => data instanceof URL ? data.toString() : void 0
1318
+ };
1319
+ const asyncContext = getContext("nuxt-dev", { asyncContext: true, AsyncLocalStorage });
1320
+ const _PejS63RTf2m4v0XYgNLlCeOKdJwEriWcs7hohQOAwBQ = (nitroApp) => {
1321
+ const handler = nitroApp.h3App.handler;
1322
+ nitroApp.h3App.handler = (event) => {
1323
+ return asyncContext.callAsync({ logs: [], event }, () => handler(event));
1324
+ };
1325
+ onConsoleLog((_log) => {
1326
+ const ctx = asyncContext.tryUse();
1327
+ if (!ctx) {
1328
+ return;
1329
+ }
1330
+ const rawStack = captureRawStackTrace();
1331
+ if (!rawStack || rawStack.includes("runtime/vite-node.mjs")) {
1332
+ return;
1333
+ }
1334
+ const trace = [];
1335
+ let filename = "";
1336
+ for (const entry of parseRawStackTrace(rawStack)) {
1337
+ if (entry.source === globalThis._importMeta_.url) {
1338
+ continue;
1339
+ }
1340
+ if (EXCLUDE_TRACE_RE.test(entry.source)) {
1341
+ continue;
1342
+ }
1343
+ filename ||= entry.source.replace(withTrailingSlash(rootDir), "");
1344
+ trace.push({
1345
+ ...entry,
1346
+ source: entry.source.startsWith("file://") ? entry.source.replace("file://", "") : entry.source
1347
+ });
1348
+ }
1349
+ const log = {
1350
+ ..._log,
1351
+ // Pass along filename to allow the client to display more info about where log comes from
1352
+ filename,
1353
+ // Clean up file names in stack trace
1354
+ stack: trace
1355
+ };
1356
+ ctx.logs.push(log);
1357
+ });
1358
+ nitroApp.hooks.hook("afterResponse", () => {
1359
+ const ctx = asyncContext.tryUse();
1360
+ if (!ctx) {
1361
+ return;
1362
+ }
1363
+ return nitroApp.hooks.callHook("dev:ssr-logs", { logs: ctx.logs, path: ctx.event.path });
1364
+ });
1365
+ nitroApp.hooks.hook("render:html", (htmlContext) => {
1366
+ const ctx = asyncContext.tryUse();
1367
+ if (!ctx) {
1368
+ return;
1369
+ }
1370
+ try {
1371
+ const reducers = Object.assign(/* @__PURE__ */ Object.create(null), devReducers, ctx.event.context._payloadReducers);
1372
+ htmlContext.bodyAppend.unshift(`<script type="application/json" data-nuxt-logs="${appId}">${stringify(ctx.logs, reducers)}<\/script>`);
1373
+ } catch (e) {
1374
+ const shortError = e instanceof Error && "toString" in e ? ` Received \`${e.toString()}\`.` : "";
1375
+ console.warn(`[nuxt] Failed to stringify dev server logs.${shortError} You can define your own reducer/reviver for rich types following the instructions in https://nuxt.com/docs/api/composables/use-nuxt-app#payload.`);
1376
+ }
1377
+ });
1378
+ };
1379
+ const EXCLUDE_TRACE_RE = /\/node_modules\/(?:.*\/)?(?:nuxt|nuxt-nightly|nuxt-edge|nuxt3|consola|@vue)\/|core\/runtime\/nitro/;
1380
+ function onConsoleLog(callback) {
1381
+ consola$1.addReporter({
1382
+ log(logObj) {
1383
+ callback(logObj);
1384
+ }
1385
+ });
1386
+ consola$1.wrapConsole();
1387
+ }
1388
+
1389
+ const plugins = [
1390
+ _yajFGiX8skDovnI5iDQnPqZ2oQtcYr27GmTd3wik120,
1391
+ _PejS63RTf2m4v0XYgNLlCeOKdJwEriWcs7hohQOAwBQ
1392
+ ];
1393
+
1394
+ const VueResolver = (_, value) => {
1395
+ return isRef(value) ? toValue(value) : value;
1396
+ };
1397
+
1398
+ const headSymbol = "usehead";
1399
+ function vueInstall(head) {
1400
+ const plugin = {
1401
+ install(app) {
1402
+ app.config.globalProperties.$unhead = head;
1403
+ app.config.globalProperties.$head = head;
1404
+ app.provide(headSymbol, head);
1405
+ }
1406
+ };
1407
+ return plugin.install;
1408
+ }
1409
+
1410
+ function resolveUnrefHeadInput(input) {
1411
+ return walkResolver(input, VueResolver);
1412
+ }
1413
+
1414
+ function createHead(options = {}) {
1415
+ const head = createHead$1({
1416
+ ...options,
1417
+ propResolvers: [VueResolver]
1418
+ });
1419
+ head.install = vueInstall(head);
1420
+ return head;
1421
+ }
1422
+
1423
+ const unheadOptions = {
1424
+ disableDefaults: true,
1425
+ disableCapoSorting: false,
1426
+ plugins: [DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin],
1427
+ };
1428
+
1429
+ function createSSRContext(event) {
1430
+ const ssrContext = {
1431
+ url: event.path,
1432
+ event,
1433
+ runtimeConfig: useRuntimeConfig(event),
1434
+ noSSR: event.context.nuxt?.noSSR || (false),
1435
+ head: createHead(unheadOptions),
1436
+ error: false,
1437
+ nuxt: void 0,
1438
+ /* NuxtApp */
1439
+ payload: {},
1440
+ _payloadReducers: /* @__PURE__ */ Object.create(null),
1441
+ modules: /* @__PURE__ */ new Set()
1442
+ };
1443
+ return ssrContext;
1444
+ }
1445
+ function setSSRError(ssrContext, error) {
1446
+ ssrContext.error = true;
1447
+ ssrContext.payload = { error };
1448
+ ssrContext.url = error.url;
1449
+ }
1450
+
1451
+ function buildAssetsDir() {
1452
+ return useRuntimeConfig().app.buildAssetsDir;
1453
+ }
1454
+ function buildAssetsURL(...path) {
1455
+ return joinRelativeURL(publicAssetsURL(), buildAssetsDir(), ...path);
1456
+ }
1457
+ function publicAssetsURL(...path) {
1458
+ const app = useRuntimeConfig().app;
1459
+ const publicBase = app.cdnURL || app.baseURL;
1460
+ return path.length ? joinRelativeURL(publicBase, ...path) : publicBase;
1461
+ }
1462
+
1463
+ const APP_ROOT_OPEN_TAG = `<${appRootTag}${propsToString(appRootAttrs)}>`;
1464
+ const APP_ROOT_CLOSE_TAG = `</${appRootTag}>`;
1465
+ const getServerEntry = () => import('file:///Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/.nuxt/dist/server/server.mjs').then((r) => r.default || r);
1466
+ const getClientManifest = () => import('file:///Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/.nuxt/dist/server/client.manifest.mjs').then((r) => r.default || r).then((r) => typeof r === "function" ? r() : r);
1467
+ const getSSRRenderer = lazyCachedFunction(async () => {
1468
+ const manifest = await getClientManifest();
1469
+ if (!manifest) {
1470
+ throw new Error("client.manifest is not available");
1471
+ }
1472
+ const createSSRApp = await getServerEntry();
1473
+ if (!createSSRApp) {
1474
+ throw new Error("Server bundle is not available");
1475
+ }
1476
+ const options = {
1477
+ manifest,
1478
+ renderToString: renderToString$1,
1479
+ buildAssetsURL
1480
+ };
1481
+ const renderer = createRenderer(createSSRApp, options);
1482
+ async function renderToString$1(input, context) {
1483
+ const html = await renderToString(input, context);
1484
+ if (process.env.NUXT_VITE_NODE_OPTIONS) {
1485
+ renderer.rendererContext.updateManifest(await getClientManifest());
1486
+ }
1487
+ return APP_ROOT_OPEN_TAG + html + APP_ROOT_CLOSE_TAG;
1488
+ }
1489
+ return renderer;
1490
+ });
1491
+ const getSPARenderer = lazyCachedFunction(async () => {
1492
+ const manifest = await getClientManifest();
1493
+ const spaTemplate = await Promise.resolve().then(function () { return _virtual__spaTemplate; }).then((r) => r.template).catch(() => "").then((r) => {
1494
+ {
1495
+ return APP_ROOT_OPEN_TAG + r + APP_ROOT_CLOSE_TAG;
1496
+ }
1497
+ });
1498
+ const options = {
1499
+ manifest,
1500
+ renderToString: () => spaTemplate,
1501
+ buildAssetsURL
1502
+ };
1503
+ const renderer = createRenderer(() => () => {
1504
+ }, options);
1505
+ const result = await renderer.renderToString({});
1506
+ const renderToString = (ssrContext) => {
1507
+ const config = useRuntimeConfig(ssrContext.event);
1508
+ ssrContext.modules ||= /* @__PURE__ */ new Set();
1509
+ ssrContext.payload.serverRendered = false;
1510
+ ssrContext.config = {
1511
+ public: config.public,
1512
+ app: config.app
1513
+ };
1514
+ return Promise.resolve(result);
1515
+ };
1516
+ return {
1517
+ rendererContext: renderer.rendererContext,
1518
+ renderToString
1519
+ };
1520
+ });
1521
+ function lazyCachedFunction(fn) {
1522
+ let res = null;
1523
+ return () => {
1524
+ if (res === null) {
1525
+ res = fn().catch((err) => {
1526
+ res = null;
1527
+ throw err;
1528
+ });
1529
+ }
1530
+ return res;
1531
+ };
1532
+ }
1533
+ function getRenderer(ssrContext) {
1534
+ return ssrContext.noSSR ? getSPARenderer() : getSSRRenderer();
1535
+ }
1536
+ const getSSRStyles = lazyCachedFunction(() => Promise.resolve().then(function () { return styles$1; }).then((r) => r.default || r));
1537
+
1538
+ async function renderInlineStyles(usedModules) {
1539
+ const styleMap = await getSSRStyles();
1540
+ const inlinedStyles = /* @__PURE__ */ new Set();
1541
+ for (const mod of usedModules) {
1542
+ if (mod in styleMap && styleMap[mod]) {
1543
+ for (const style of await styleMap[mod]()) {
1544
+ inlinedStyles.add(style);
1545
+ }
1546
+ }
1547
+ }
1548
+ return Array.from(inlinedStyles).map((style) => ({ innerHTML: style }));
1549
+ }
1550
+
1551
+ const ROOT_NODE_REGEX = new RegExp(`^<${appRootTag}[^>]*>([\\s\\S]*)<\\/${appRootTag}>$`);
1552
+ function getServerComponentHTML(body) {
1553
+ const match = body.match(ROOT_NODE_REGEX);
1554
+ return match?.[1] || body;
1555
+ }
1556
+ const SSR_SLOT_TELEPORT_MARKER = /^uid=([^;]*);slot=(.*)$/;
1557
+ const SSR_CLIENT_TELEPORT_MARKER = /^uid=([^;]*);client=(.*)$/;
1558
+ const SSR_CLIENT_SLOT_MARKER = /^island-slot=([^;]*);(.*)$/;
1559
+ function getSlotIslandResponse(ssrContext) {
1560
+ if (!ssrContext.islandContext || !Object.keys(ssrContext.islandContext.slots).length) {
1561
+ return void 0;
1562
+ }
1563
+ const response = {};
1564
+ for (const [name, slot] of Object.entries(ssrContext.islandContext.slots)) {
1565
+ response[name] = {
1566
+ ...slot,
1567
+ fallback: ssrContext.teleports?.[`island-fallback=${name}`]
1568
+ };
1569
+ }
1570
+ return response;
1571
+ }
1572
+ function getClientIslandResponse(ssrContext) {
1573
+ if (!ssrContext.islandContext || !Object.keys(ssrContext.islandContext.components).length) {
1574
+ return void 0;
1575
+ }
1576
+ const response = {};
1577
+ for (const [clientUid, component] of Object.entries(ssrContext.islandContext.components)) {
1578
+ const html = ssrContext.teleports?.[clientUid]?.replaceAll("<!--teleport start anchor-->", "") || "";
1579
+ response[clientUid] = {
1580
+ ...component,
1581
+ html,
1582
+ slots: getComponentSlotTeleport(clientUid, ssrContext.teleports ?? {})
1583
+ };
1584
+ }
1585
+ return response;
1586
+ }
1587
+ function getComponentSlotTeleport(clientUid, teleports) {
1588
+ const entries = Object.entries(teleports);
1589
+ const slots = {};
1590
+ for (const [key, value] of entries) {
1591
+ const match = key.match(SSR_CLIENT_SLOT_MARKER);
1592
+ if (match) {
1593
+ const [, id, slot] = match;
1594
+ if (!slot || clientUid !== id) {
1595
+ continue;
1596
+ }
1597
+ slots[slot] = value;
1598
+ }
1599
+ }
1600
+ return slots;
1601
+ }
1602
+ function replaceIslandTeleports(ssrContext, html) {
1603
+ const { teleports, islandContext } = ssrContext;
1604
+ if (islandContext || !teleports) {
1605
+ return html;
1606
+ }
1607
+ for (const key in teleports) {
1608
+ const matchClientComp = key.match(SSR_CLIENT_TELEPORT_MARKER);
1609
+ if (matchClientComp) {
1610
+ const [, uid, clientId] = matchClientComp;
1611
+ if (!uid || !clientId) {
1612
+ continue;
1613
+ }
1614
+ html = html.replace(new RegExp(` data-island-uid="${uid}" data-island-component="${clientId}"[^>]*>`), (full) => {
1615
+ return full + teleports[key];
1616
+ });
1617
+ continue;
1618
+ }
1619
+ const matchSlot = key.match(SSR_SLOT_TELEPORT_MARKER);
1620
+ if (matchSlot) {
1621
+ const [, uid, slot] = matchSlot;
1622
+ if (!uid || !slot) {
1623
+ continue;
1624
+ }
1625
+ html = html.replace(new RegExp(` data-island-uid="${uid}" data-island-slot="${slot}"[^>]*>`), (full) => {
1626
+ return full + teleports[key];
1627
+ });
1628
+ }
1629
+ }
1630
+ return html;
1631
+ }
1632
+
1633
+ const ISLAND_SUFFIX_RE = /\.json(\?.*)?$/;
1634
+ const _SxA8c9 = defineEventHandler(async (event) => {
1635
+ const nitroApp = useNitroApp();
1636
+ setResponseHeaders(event, {
1637
+ "content-type": "application/json;charset=utf-8",
1638
+ "x-powered-by": "Nuxt"
1639
+ });
1640
+ const islandContext = await getIslandContext(event);
1641
+ const ssrContext = {
1642
+ ...createSSRContext(event),
1643
+ islandContext,
1644
+ noSSR: false,
1645
+ url: islandContext.url
1646
+ };
1647
+ const renderer = await getSSRRenderer();
1648
+ const renderResult = await renderer.renderToString(ssrContext).catch(async (error) => {
1649
+ await ssrContext.nuxt?.hooks.callHook("app:error", error);
1650
+ throw error;
1651
+ });
1652
+ const inlinedStyles = await renderInlineStyles(ssrContext.modules ?? []);
1653
+ await ssrContext.nuxt?.hooks.callHook("app:rendered", { ssrContext, renderResult });
1654
+ if (inlinedStyles.length) {
1655
+ ssrContext.head.push({ style: inlinedStyles });
1656
+ }
1657
+ {
1658
+ const { styles } = getRequestDependencies(ssrContext, renderer.rendererContext);
1659
+ const link = [];
1660
+ for (const resource of Object.values(styles)) {
1661
+ if ("inline" in getQuery(resource.file)) {
1662
+ continue;
1663
+ }
1664
+ if (resource.file.includes("scoped") && !resource.file.includes("pages/")) {
1665
+ link.push({ rel: "stylesheet", href: renderer.rendererContext.buildAssetsURL(resource.file), crossorigin: "" });
1666
+ }
1667
+ }
1668
+ if (link.length) {
1669
+ ssrContext.head.push({ link }, { mode: "server" });
1670
+ }
1671
+ }
1672
+ const islandHead = {};
1673
+ for (const entry of ssrContext.head.entries.values()) {
1674
+ for (const [key, value] of Object.entries(resolveUnrefHeadInput(entry.input))) {
1675
+ const currentValue = islandHead[key];
1676
+ if (Array.isArray(currentValue)) {
1677
+ currentValue.push(...value);
1678
+ }
1679
+ islandHead[key] = value;
1680
+ }
1681
+ }
1682
+ islandHead.link ||= [];
1683
+ islandHead.style ||= [];
1684
+ const islandResponse = {
1685
+ id: islandContext.id,
1686
+ head: islandHead,
1687
+ html: getServerComponentHTML(renderResult.html),
1688
+ components: getClientIslandResponse(ssrContext),
1689
+ slots: getSlotIslandResponse(ssrContext)
1690
+ };
1691
+ await nitroApp.hooks.callHook("render:island", islandResponse, { event, islandContext });
1692
+ return islandResponse;
1693
+ });
1694
+ async function getIslandContext(event) {
1695
+ let url = event.path || "";
1696
+ const componentParts = url.substring("/__nuxt_island".length + 1).replace(ISLAND_SUFFIX_RE, "").split("_");
1697
+ const hashId = componentParts.length > 1 ? componentParts.pop() : void 0;
1698
+ const componentName = componentParts.join("_");
1699
+ const context = event.method === "GET" ? getQuery$1(event) : await readBody(event);
1700
+ const ctx = {
1701
+ url: "/",
1702
+ ...context,
1703
+ id: hashId,
1704
+ name: componentName,
1705
+ props: destr$1(context.props) || {},
1706
+ slots: {},
1707
+ components: {}
1708
+ };
1709
+ return ctx;
1710
+ }
1711
+
1712
+ const _lazy_KnD_S6 = () => Promise.resolve().then(function () { return renderer$1; });
1713
+
1714
+ const handlers = [
1715
+ { route: '/__nuxt_error', handler: _lazy_KnD_S6, lazy: true, middleware: false, method: undefined },
1716
+ { route: '/__nuxt_island/**', handler: _SxA8c9, lazy: false, middleware: false, method: undefined },
1717
+ { route: '/**', handler: _lazy_KnD_S6, lazy: true, middleware: false, method: undefined }
1718
+ ];
1719
+
1720
+ function createNitroApp() {
1721
+ const config = useRuntimeConfig();
1722
+ const hooks = createHooks();
1723
+ const captureError = (error, context = {}) => {
1724
+ const promise = hooks.callHookParallel("error", error, context).catch((error_) => {
1725
+ console.error("Error while capturing another error", error_);
1726
+ });
1727
+ if (context.event && isEvent(context.event)) {
1728
+ const errors = context.event.context.nitro?.errors;
1729
+ if (errors) {
1730
+ errors.push({ error, context });
1731
+ }
1732
+ if (context.event.waitUntil) {
1733
+ context.event.waitUntil(promise);
1734
+ }
1735
+ }
1736
+ };
1737
+ const h3App = createApp({
1738
+ debug: destr(true),
1739
+ onError: (error, event) => {
1740
+ captureError(error, { event, tags: ["request"] });
1741
+ return errorHandler(error, event);
1742
+ },
1743
+ onRequest: async (event) => {
1744
+ event.context.nitro = event.context.nitro || { errors: [] };
1745
+ const fetchContext = event.node.req?.__unenv__;
1746
+ if (fetchContext?._platform) {
1747
+ event.context = {
1748
+ _platform: fetchContext?._platform,
1749
+ // #3335
1750
+ ...fetchContext._platform,
1751
+ ...event.context
1752
+ };
1753
+ }
1754
+ if (!event.context.waitUntil && fetchContext?.waitUntil) {
1755
+ event.context.waitUntil = fetchContext.waitUntil;
1756
+ }
1757
+ event.fetch = (req, init) => fetchWithEvent(event, req, init, { fetch: localFetch });
1758
+ event.$fetch = (req, init) => fetchWithEvent(event, req, init, {
1759
+ fetch: $fetch
1760
+ });
1761
+ event.waitUntil = (promise) => {
1762
+ if (!event.context.nitro._waitUntilPromises) {
1763
+ event.context.nitro._waitUntilPromises = [];
1764
+ }
1765
+ event.context.nitro._waitUntilPromises.push(promise);
1766
+ if (event.context.waitUntil) {
1767
+ event.context.waitUntil(promise);
1768
+ }
1769
+ };
1770
+ event.captureError = (error, context) => {
1771
+ captureError(error, { event, ...context });
1772
+ };
1773
+ await nitroApp$1.hooks.callHook("request", event).catch((error) => {
1774
+ captureError(error, { event, tags: ["request"] });
1775
+ });
1776
+ },
1777
+ onBeforeResponse: async (event, response) => {
1778
+ await nitroApp$1.hooks.callHook("beforeResponse", event, response).catch((error) => {
1779
+ captureError(error, { event, tags: ["request", "response"] });
1780
+ });
1781
+ },
1782
+ onAfterResponse: async (event, response) => {
1783
+ await nitroApp$1.hooks.callHook("afterResponse", event, response).catch((error) => {
1784
+ captureError(error, { event, tags: ["request", "response"] });
1785
+ });
1786
+ }
1787
+ });
1788
+ const router = createRouter$1({
1789
+ preemptive: true
1790
+ });
1791
+ const nodeHandler = toNodeListener(h3App);
1792
+ const localCall = (aRequest) => callNodeRequestHandler(nodeHandler, aRequest);
1793
+ const localFetch = (input, init) => {
1794
+ if (!input.toString().startsWith("/")) {
1795
+ return globalThis.fetch(input, init);
1796
+ }
1797
+ return fetchNodeRequestHandler(
1798
+ nodeHandler,
1799
+ input,
1800
+ init
1801
+ ).then((response) => normalizeFetchResponse(response));
1802
+ };
1803
+ const $fetch = createFetch({
1804
+ fetch: localFetch,
1805
+ Headers: Headers$1,
1806
+ defaults: { baseURL: config.app.baseURL }
1807
+ });
1808
+ globalThis.$fetch = $fetch;
1809
+ h3App.use(createRouteRulesHandler({ localFetch }));
1810
+ for (const h of handlers) {
1811
+ let handler = h.lazy ? lazyEventHandler(h.handler) : h.handler;
1812
+ if (h.middleware || !h.route) {
1813
+ const middlewareBase = (config.app.baseURL + (h.route || "/")).replace(
1814
+ /\/+/g,
1815
+ "/"
1816
+ );
1817
+ h3App.use(middlewareBase, handler);
1818
+ } else {
1819
+ const routeRules = getRouteRulesForPath(
1820
+ h.route.replace(/:\w+|\*\*/g, "_")
1821
+ );
1822
+ if (routeRules.cache) {
1823
+ handler = cachedEventHandler(handler, {
1824
+ group: "nitro/routes",
1825
+ ...routeRules.cache
1826
+ });
1827
+ }
1828
+ router.use(h.route, handler, h.method);
1829
+ }
1830
+ }
1831
+ h3App.use(config.app.baseURL, router.handler);
1832
+ const app = {
1833
+ hooks,
1834
+ h3App,
1835
+ router,
1836
+ localCall,
1837
+ localFetch,
1838
+ captureError
1839
+ };
1840
+ return app;
1841
+ }
1842
+ function runNitroPlugins(nitroApp2) {
1843
+ for (const plugin of plugins) {
1844
+ try {
1845
+ plugin(nitroApp2);
1846
+ } catch (error) {
1847
+ nitroApp2.captureError(error, { tags: ["plugin"] });
1848
+ throw error;
1849
+ }
1850
+ }
1851
+ }
1852
+ const nitroApp$1 = createNitroApp();
1853
+ function useNitroApp() {
1854
+ return nitroApp$1;
1855
+ }
1856
+ runNitroPlugins(nitroApp$1);
1857
+
1858
+ function defineRenderHandler(render) {
1859
+ const runtimeConfig = useRuntimeConfig();
1860
+ return eventHandler(async (event) => {
1861
+ const nitroApp = useNitroApp();
1862
+ const ctx = { event, render, response: void 0 };
1863
+ await nitroApp.hooks.callHook("render:before", ctx);
1864
+ if (!ctx.response) {
1865
+ if (event.path === `${runtimeConfig.app.baseURL}favicon.ico`) {
1866
+ setResponseHeader(event, "Content-Type", "image/x-icon");
1867
+ return send(
1868
+ event,
1869
+ "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
1870
+ );
1871
+ }
1872
+ ctx.response = await ctx.render(event);
1873
+ if (!ctx.response) {
1874
+ const _currentStatus = getResponseStatus(event);
1875
+ setResponseStatus(event, _currentStatus === 200 ? 500 : _currentStatus);
1876
+ return send(
1877
+ event,
1878
+ "No response returned from render handler: " + event.path
1879
+ );
1880
+ }
1881
+ }
1882
+ await nitroApp.hooks.callHook("render:response", ctx.response, ctx);
1883
+ if (ctx.response.headers) {
1884
+ setResponseHeaders(event, ctx.response.headers);
1885
+ }
1886
+ if (ctx.response.statusCode || ctx.response.statusMessage) {
1887
+ setResponseStatus(
1888
+ event,
1889
+ ctx.response.statusCode,
1890
+ ctx.response.statusMessage
1891
+ );
1892
+ }
1893
+ return ctx.response.body;
1894
+ });
1895
+ }
1896
+
1897
+ const scheduledTasks = false;
1898
+
1899
+ const tasks = {
1900
+
1901
+ };
1902
+
1903
+ const __runningTasks__ = {};
1904
+ async function runTask(name, {
1905
+ payload = {},
1906
+ context = {}
1907
+ } = {}) {
1908
+ if (__runningTasks__[name]) {
1909
+ return __runningTasks__[name];
1910
+ }
1911
+ if (!(name in tasks)) {
1912
+ throw createError({
1913
+ message: `Task \`${name}\` is not available!`,
1914
+ statusCode: 404
1915
+ });
1916
+ }
1917
+ if (!tasks[name].resolve) {
1918
+ throw createError({
1919
+ message: `Task \`${name}\` is not implemented!`,
1920
+ statusCode: 501
1921
+ });
1922
+ }
1923
+ const handler = await tasks[name].resolve();
1924
+ const taskEvent = { name, payload, context };
1925
+ __runningTasks__[name] = handler.run(taskEvent);
1926
+ try {
1927
+ const res = await __runningTasks__[name];
1928
+ return res;
1929
+ } finally {
1930
+ delete __runningTasks__[name];
1931
+ }
1932
+ }
1933
+
1934
+ if (!globalThis.crypto) {
1935
+ globalThis.crypto = nodeCrypto;
1936
+ }
1937
+ const { NITRO_NO_UNIX_SOCKET, NITRO_DEV_WORKER_ID } = process.env;
1938
+ trapUnhandledNodeErrors();
1939
+ parentPort?.on("message", (msg) => {
1940
+ if (msg && msg.event === "shutdown") {
1941
+ shutdown();
1942
+ }
1943
+ });
1944
+ const nitroApp = useNitroApp();
1945
+ const server = new Server(toNodeListener(nitroApp.h3App));
1946
+ let listener;
1947
+ listen().catch(() => listen(
1948
+ true
1949
+ /* use random port */
1950
+ )).catch((error) => {
1951
+ console.error("Dev worker failed to listen:", error);
1952
+ return shutdown();
1953
+ });
1954
+ nitroApp.router.get(
1955
+ "/_nitro/tasks",
1956
+ defineEventHandler(async (event) => {
1957
+ const _tasks = await Promise.all(
1958
+ Object.entries(tasks).map(async ([name, task]) => {
1959
+ const _task = await task.resolve?.();
1960
+ return [name, { description: _task?.meta?.description }];
1961
+ })
1962
+ );
1963
+ return {
1964
+ tasks: Object.fromEntries(_tasks),
1965
+ scheduledTasks
1966
+ };
1967
+ })
1968
+ );
1969
+ nitroApp.router.use(
1970
+ "/_nitro/tasks/:name",
1971
+ defineEventHandler(async (event) => {
1972
+ const name = getRouterParam(event, "name");
1973
+ const payload = {
1974
+ ...getQuery$1(event),
1975
+ ...await readBody(event).then((r) => r?.payload).catch(() => ({}))
1976
+ };
1977
+ return await runTask(name, { payload });
1978
+ })
1979
+ );
1980
+ function listen(useRandomPort = Boolean(
1981
+ NITRO_NO_UNIX_SOCKET || process.versions.webcontainer || "Bun" in globalThis && process.platform === "win32"
1982
+ )) {
1983
+ return new Promise((resolve, reject) => {
1984
+ try {
1985
+ listener = server.listen(useRandomPort ? 0 : getSocketAddress(), () => {
1986
+ const address = server.address();
1987
+ parentPort?.postMessage({
1988
+ event: "listen",
1989
+ address: typeof address === "string" ? { socketPath: address } : { host: "localhost", port: address?.port }
1990
+ });
1991
+ resolve();
1992
+ });
1993
+ } catch (error) {
1994
+ reject(error);
1995
+ }
1996
+ });
1997
+ }
1998
+ function getSocketAddress() {
1999
+ const socketName = `nitro-worker-${process.pid}-${threadId}-${NITRO_DEV_WORKER_ID}-${Math.round(Math.random() * 1e4)}.sock`;
2000
+ if (process.platform === "win32") {
2001
+ return join(String.raw`\\.\pipe`, socketName);
2002
+ }
2003
+ if (process.platform === "linux") {
2004
+ const nodeMajor = Number.parseInt(process.versions.node.split(".")[0], 10);
2005
+ if (nodeMajor >= 20) {
2006
+ return `\0${socketName}`;
2007
+ }
2008
+ }
2009
+ return join(tmpdir(), socketName);
2010
+ }
2011
+ async function shutdown() {
2012
+ server.closeAllConnections?.();
2013
+ await Promise.all([
2014
+ new Promise((resolve) => listener?.close(resolve)),
2015
+ nitroApp.hooks.callHook("close").catch(console.error)
2016
+ ]);
2017
+ parentPort?.postMessage({ event: "exit" });
2018
+ }
2019
+
2020
+ const _messages = { "appName": "Nuxt", "version": "", "statusCode": 500, "statusMessage": "Server error", "description": "An error occurred in the application and the page could not be served. If you are the application owner, check your server logs for details.", "stack": "" };
2021
+ const template$1 = (messages) => {
2022
+ messages = { ..._messages, ...messages };
2023
+ return '<!DOCTYPE html><html lang="en"><head><title>' + escapeHtml(messages.statusCode) + " - " + escapeHtml(messages.statusMessage || "Internal Server Error") + `</title><meta charset="utf-8"><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0" name="viewport"><style>.spotlight{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-40vh;filter:blur(30vh);height:60vh;opacity:.8}*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.pointer-events-none{pointer-events:none}.fixed{position:fixed}.left-0{left:0}.right-0{right:0}.z-10{z-index:10}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.h-auto{height:auto}.min-h-screen{min-height:100vh}.flex{display:flex}.flex-1{flex:1 1 0%}.flex-col{flex-direction:column}.overflow-y-auto{overflow-y:auto}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.bg-black\\/5{background-color:#0000000d}.bg-white{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.p-8{padding:2rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.pt-14{padding-top:3.5rem}.text-6xl{font-size:3.75rem;line-height:1}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-black{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light{font-weight:300}.font-medium{font-weight:500}.leading-tight{line-height:1.25}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\\:bg-black{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\\:bg-white\\/10{background-color:#ffffff1a}.dark\\:text-white{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\\:text-8xl{font-size:6rem;line-height:1}}</style><script>!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();<\/script></head><body class="antialiased bg-white dark:bg-black dark:text-white flex flex-col font-sans min-h-screen pt-14 px-10 text-black"><div class="fixed left-0 pointer-events-none right-0 spotlight"></div><h1 class="font-medium mb-6 sm:text-8xl text-6xl">` + escapeHtml(messages.statusCode) + '</h1><p class="font-light leading-tight mb-8 sm:text-2xl text-xl">' + escapeHtml(messages.description) + '</p><div class="bg-black/5 bg-white dark:bg-white/10 flex-1 h-auto overflow-y-auto rounded-t-md"><div class="font-light leading-tight p-8 text-xl z-10">' + escapeHtml(messages.stack) + "</div></div></body></html>";
2024
+ };
2025
+
2026
+ const errorDev = /*#__PURE__*/Object.freeze({
2027
+ __proto__: null,
2028
+ template: template$1
2029
+ });
2030
+
2031
+ const template = "";
2032
+
2033
+ const _virtual__spaTemplate = /*#__PURE__*/Object.freeze({
2034
+ __proto__: null,
2035
+ template: template
2036
+ });
2037
+
2038
+ const styles = {};
2039
+
2040
+ const styles$1 = /*#__PURE__*/Object.freeze({
2041
+ __proto__: null,
2042
+ default: styles
2043
+ });
2044
+
2045
+ function renderPayloadResponse(ssrContext) {
2046
+ return {
2047
+ body: stringify(splitPayload(ssrContext).payload, ssrContext._payloadReducers) ,
2048
+ statusCode: getResponseStatus(ssrContext.event),
2049
+ statusMessage: getResponseStatusText(ssrContext.event),
2050
+ headers: {
2051
+ "content-type": "application/json;charset=utf-8" ,
2052
+ "x-powered-by": "Nuxt"
2053
+ }
2054
+ };
2055
+ }
2056
+ function renderPayloadJsonScript(opts) {
2057
+ const contents = opts.data ? stringify(opts.data, opts.ssrContext._payloadReducers) : "";
2058
+ const payload = {
2059
+ "type": "application/json",
2060
+ "innerHTML": contents,
2061
+ "data-nuxt-data": appId,
2062
+ "data-ssr": !(opts.ssrContext.noSSR)
2063
+ };
2064
+ {
2065
+ payload.id = "__NUXT_DATA__";
2066
+ }
2067
+ if (opts.src) {
2068
+ payload["data-src"] = opts.src;
2069
+ }
2070
+ const config = uneval(opts.ssrContext.config);
2071
+ return [
2072
+ payload,
2073
+ {
2074
+ innerHTML: `window.__NUXT__={};window.__NUXT__.config=${config}`
2075
+ }
2076
+ ];
2077
+ }
2078
+ function splitPayload(ssrContext) {
2079
+ const { data, prerenderedAt, ...initial } = ssrContext.payload;
2080
+ return {
2081
+ initial: { ...initial, prerenderedAt },
2082
+ payload: { data, prerenderedAt }
2083
+ };
2084
+ }
2085
+
2086
+ const renderSSRHeadOptions = {"omitLineBreaks":false};
2087
+
2088
+ globalThis.__buildAssetsURL = buildAssetsURL;
2089
+ globalThis.__publicAssetsURL = publicAssetsURL;
2090
+ const HAS_APP_TELEPORTS = !!(appTeleportAttrs.id);
2091
+ const APP_TELEPORT_OPEN_TAG = HAS_APP_TELEPORTS ? `<${appTeleportTag}${propsToString(appTeleportAttrs)}>` : "";
2092
+ const APP_TELEPORT_CLOSE_TAG = HAS_APP_TELEPORTS ? `</${appTeleportTag}>` : "";
2093
+ const PAYLOAD_URL_RE = /^[^?]*\/_payload.json(?:\?.*)?$/ ;
2094
+ const renderer = defineRenderHandler(async (event) => {
2095
+ const nitroApp = useNitroApp();
2096
+ const ssrError = event.path.startsWith("/__nuxt_error") ? getQuery$1(event) : null;
2097
+ if (ssrError && !("__unenv__" in event.node.req)) {
2098
+ throw createError({
2099
+ statusCode: 404,
2100
+ statusMessage: "Page Not Found: /__nuxt_error"
2101
+ });
2102
+ }
2103
+ const ssrContext = createSSRContext(event);
2104
+ const headEntryOptions = { mode: "server" };
2105
+ ssrContext.head.push(appHead, headEntryOptions);
2106
+ if (ssrError) {
2107
+ ssrError.statusCode &&= Number.parseInt(ssrError.statusCode);
2108
+ setSSRError(ssrContext, ssrError);
2109
+ }
2110
+ const isRenderingPayload = PAYLOAD_URL_RE.test(ssrContext.url);
2111
+ if (isRenderingPayload) {
2112
+ const url = ssrContext.url.substring(0, ssrContext.url.lastIndexOf("/")) || "/";
2113
+ ssrContext.url = url;
2114
+ event._path = event.node.req.url = url;
2115
+ }
2116
+ const routeOptions = getRouteRules(event);
2117
+ if (routeOptions.ssr === false) {
2118
+ ssrContext.noSSR = true;
2119
+ }
2120
+ const renderer = await getRenderer(ssrContext);
2121
+ const _rendered = await renderer.renderToString(ssrContext).catch(async (error) => {
2122
+ if (ssrContext._renderResponse && error.message === "skipping render") {
2123
+ return {};
2124
+ }
2125
+ const _err = !ssrError && ssrContext.payload?.error || error;
2126
+ await ssrContext.nuxt?.hooks.callHook("app:error", _err);
2127
+ throw _err;
2128
+ });
2129
+ const inlinedStyles = [];
2130
+ await ssrContext.nuxt?.hooks.callHook("app:rendered", { ssrContext, renderResult: _rendered });
2131
+ if (ssrContext._renderResponse) {
2132
+ return ssrContext._renderResponse;
2133
+ }
2134
+ if (ssrContext.payload?.error && !ssrError) {
2135
+ throw ssrContext.payload.error;
2136
+ }
2137
+ if (isRenderingPayload) {
2138
+ const response = renderPayloadResponse(ssrContext);
2139
+ return response;
2140
+ }
2141
+ const NO_SCRIPTS = routeOptions.noScripts;
2142
+ const { styles, scripts } = getRequestDependencies(ssrContext, renderer.rendererContext);
2143
+ if (inlinedStyles.length) {
2144
+ ssrContext.head.push({ style: inlinedStyles });
2145
+ }
2146
+ const link = [];
2147
+ for (const resource of Object.values(styles)) {
2148
+ if ("inline" in getQuery(resource.file)) {
2149
+ continue;
2150
+ }
2151
+ link.push({ rel: "stylesheet", href: renderer.rendererContext.buildAssetsURL(resource.file), crossorigin: "" });
2152
+ }
2153
+ if (link.length) {
2154
+ ssrContext.head.push({ link }, headEntryOptions);
2155
+ }
2156
+ if (!NO_SCRIPTS) {
2157
+ ssrContext.head.push({
2158
+ link: getPreloadLinks(ssrContext, renderer.rendererContext)
2159
+ }, headEntryOptions);
2160
+ ssrContext.head.push({
2161
+ link: getPrefetchLinks(ssrContext, renderer.rendererContext)
2162
+ }, headEntryOptions);
2163
+ ssrContext.head.push({
2164
+ script: renderPayloadJsonScript({ ssrContext, data: ssrContext.payload })
2165
+ }, {
2166
+ ...headEntryOptions,
2167
+ // this should come before another end of body scripts
2168
+ tagPosition: "bodyClose",
2169
+ tagPriority: "high"
2170
+ });
2171
+ }
2172
+ if (!routeOptions.noScripts) {
2173
+ ssrContext.head.push({
2174
+ script: Object.values(scripts).map((resource) => ({
2175
+ type: resource.module ? "module" : null,
2176
+ src: renderer.rendererContext.buildAssetsURL(resource.file),
2177
+ defer: resource.module ? null : true,
2178
+ // if we are rendering script tag payloads that import an async payload
2179
+ // we need to ensure this resolves before executing the Nuxt entry
2180
+ tagPosition: "head",
2181
+ crossorigin: ""
2182
+ }))
2183
+ }, headEntryOptions);
2184
+ }
2185
+ const { headTags, bodyTags, bodyTagsOpen, htmlAttrs, bodyAttrs } = await renderSSRHead(ssrContext.head, renderSSRHeadOptions);
2186
+ const htmlContext = {
2187
+ htmlAttrs: htmlAttrs ? [htmlAttrs] : [],
2188
+ head: normalizeChunks([headTags]),
2189
+ bodyAttrs: bodyAttrs ? [bodyAttrs] : [],
2190
+ bodyPrepend: normalizeChunks([bodyTagsOpen, ssrContext.teleports?.body]),
2191
+ body: [
2192
+ replaceIslandTeleports(ssrContext, _rendered.html) ,
2193
+ APP_TELEPORT_OPEN_TAG + (HAS_APP_TELEPORTS ? joinTags([ssrContext.teleports?.[`#${appTeleportAttrs.id}`]]) : "") + APP_TELEPORT_CLOSE_TAG
2194
+ ],
2195
+ bodyAppend: [bodyTags]
2196
+ };
2197
+ await nitroApp.hooks.callHook("render:html", htmlContext, { event });
2198
+ return {
2199
+ body: renderHTMLDocument(htmlContext),
2200
+ statusCode: getResponseStatus(event),
2201
+ statusMessage: getResponseStatusText(event),
2202
+ headers: {
2203
+ "content-type": "text/html;charset=utf-8",
2204
+ "x-powered-by": "Nuxt"
2205
+ }
2206
+ };
2207
+ });
2208
+ function normalizeChunks(chunks) {
2209
+ return chunks.filter(Boolean).map((i) => i.trim());
2210
+ }
2211
+ function joinTags(tags) {
2212
+ return tags.join("");
2213
+ }
2214
+ function joinAttrs(chunks) {
2215
+ if (chunks.length === 0) {
2216
+ return "";
2217
+ }
2218
+ return " " + chunks.join(" ");
2219
+ }
2220
+ function renderHTMLDocument(html) {
2221
+ return `<!DOCTYPE html><html${joinAttrs(html.htmlAttrs)}><head>${joinTags(html.head)}</head><body${joinAttrs(html.bodyAttrs)}>${joinTags(html.bodyPrepend)}${joinTags(html.body)}${joinTags(html.bodyAppend)}</body></html>`;
2222
+ }
2223
+
2224
+ const renderer$1 = /*#__PURE__*/Object.freeze({
2225
+ __proto__: null,
2226
+ default: renderer
2227
+ });
2228
+ //# sourceMappingURL=index.mjs.map