@wvkit/skevdb 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/README.md +68 -0
  2. package/bin/aldb.js +58 -0
  3. package/build/client/_app/immutable/assets/0.4921WYCN.css +2 -0
  4. package/build/client/_app/immutable/assets/0.4921WYCN.css.br +0 -0
  5. package/build/client/_app/immutable/assets/0.4921WYCN.css.gz +0 -0
  6. package/build/client/_app/immutable/assets/codicon.ngg6Pgfi.ttf +0 -0
  7. package/build/client/_app/immutable/assets/editor.DV6jjE6F.css +1 -0
  8. package/build/client/_app/immutable/assets/editor.DV6jjE6F.css.br +0 -0
  9. package/build/client/_app/immutable/assets/editor.DV6jjE6F.css.gz +0 -0
  10. package/build/client/_app/immutable/assets/geist-cyrillic-ext-wght-normal.DjL33-gN.woff2 +0 -0
  11. package/build/client/_app/immutable/assets/geist-cyrillic-wght-normal.BEAKL7Jp.woff2 +0 -0
  12. package/build/client/_app/immutable/assets/geist-latin-ext-wght-normal.DC-KSUi6.woff2 +0 -0
  13. package/build/client/_app/immutable/assets/geist-latin-wght-normal.BgDaEnEv.woff2 +0 -0
  14. package/build/client/_app/immutable/assets/geist-vietnamese-wght-normal.6IgcOCM7.woff2 +0 -0
  15. package/build/client/_app/immutable/assets/inter-cyrillic-ext-wght-normal.BOeWTOD4.woff2 +0 -0
  16. package/build/client/_app/immutable/assets/inter-cyrillic-wght-normal.DqGufNeO.woff2 +0 -0
  17. package/build/client/_app/immutable/assets/inter-greek-ext-wght-normal.DlzME5K_.woff2 +0 -0
  18. package/build/client/_app/immutable/assets/inter-greek-wght-normal.CkhJZR-_.woff2 +0 -0
  19. package/build/client/_app/immutable/assets/inter-latin-ext-wght-normal.DO1Apj_S.woff2 +0 -0
  20. package/build/client/_app/immutable/assets/inter-latin-wght-normal.Dx4kXJAl.woff2 +0 -0
  21. package/build/client/_app/immutable/assets/inter-vietnamese-wght-normal.CBcvBZtf.woff2 +0 -0
  22. package/build/client/_app/immutable/assets/noto-sans-cyrillic-ext-wght-normal.DSNfmdVt.woff2 +0 -0
  23. package/build/client/_app/immutable/assets/noto-sans-cyrillic-wght-normal.B2hlT84T.woff2 +0 -0
  24. package/build/client/_app/immutable/assets/noto-sans-devanagari-wght-normal.Cv-Vwajv.woff2 +0 -0
  25. package/build/client/_app/immutable/assets/noto-sans-greek-ext-wght-normal.12T8GTDR.woff2 +0 -0
  26. package/build/client/_app/immutable/assets/noto-sans-greek-wght-normal.Ymb6dZNd.woff2 +0 -0
  27. package/build/client/_app/immutable/assets/noto-sans-latin-ext-wght-normal.W1qJv59z.woff2 +0 -0
  28. package/build/client/_app/immutable/assets/noto-sans-latin-wght-normal.BYSzYMf3.woff2 +0 -0
  29. package/build/client/_app/immutable/assets/noto-sans-vietnamese-wght-normal.DLTJy58D.woff2 +0 -0
  30. package/build/client/_app/immutable/assets/sql.FmGBn3YN.css +1 -0
  31. package/build/client/_app/immutable/assets/sql.FmGBn3YN.css.br +0 -0
  32. package/build/client/_app/immutable/assets/sql.FmGBn3YN.css.gz +0 -0
  33. package/build/client/_app/immutable/chunks/-u0aF6D6.js +1 -0
  34. package/build/client/_app/immutable/chunks/-u0aF6D6.js.br +2 -0
  35. package/build/client/_app/immutable/chunks/-u0aF6D6.js.gz +0 -0
  36. package/build/client/_app/immutable/chunks/BZYon8uW.js +1 -0
  37. package/build/client/_app/immutable/chunks/BZYon8uW.js.br +0 -0
  38. package/build/client/_app/immutable/chunks/BZYon8uW.js.gz +0 -0
  39. package/build/client/_app/immutable/chunks/CT_ExraQ.js +820 -0
  40. package/build/client/_app/immutable/chunks/CT_ExraQ.js.br +0 -0
  41. package/build/client/_app/immutable/chunks/CT_ExraQ.js.gz +0 -0
  42. package/build/client/_app/immutable/chunks/CUXBnqxM.js +53 -0
  43. package/build/client/_app/immutable/chunks/CUXBnqxM.js.br +0 -0
  44. package/build/client/_app/immutable/chunks/CUXBnqxM.js.gz +0 -0
  45. package/build/client/_app/immutable/chunks/CqQuHtWb.js +1 -0
  46. package/build/client/_app/immutable/chunks/CqQuHtWb.js.br +0 -0
  47. package/build/client/_app/immutable/chunks/CqQuHtWb.js.gz +0 -0
  48. package/build/client/_app/immutable/chunks/DDJ7Hsqn.js +1 -0
  49. package/build/client/_app/immutable/chunks/DDJ7Hsqn.js.br +0 -0
  50. package/build/client/_app/immutable/chunks/DDJ7Hsqn.js.gz +0 -0
  51. package/build/client/_app/immutable/chunks/D_beq-47.js +3 -0
  52. package/build/client/_app/immutable/chunks/D_beq-47.js.br +0 -0
  53. package/build/client/_app/immutable/chunks/D_beq-47.js.gz +0 -0
  54. package/build/client/_app/immutable/chunks/NEE52Syq.js +1 -0
  55. package/build/client/_app/immutable/chunks/NEE52Syq.js.br +0 -0
  56. package/build/client/_app/immutable/chunks/NEE52Syq.js.gz +0 -0
  57. package/build/client/_app/immutable/chunks/h8jGUf5s.js +1 -0
  58. package/build/client/_app/immutable/chunks/h8jGUf5s.js.br +0 -0
  59. package/build/client/_app/immutable/chunks/h8jGUf5s.js.gz +0 -0
  60. package/build/client/_app/immutable/chunks/kNaey6uv.js +1 -0
  61. package/build/client/_app/immutable/chunks/kNaey6uv.js.br +0 -0
  62. package/build/client/_app/immutable/chunks/kNaey6uv.js.gz +0 -0
  63. package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
  64. package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
  65. package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
  66. package/build/client/_app/immutable/entry/app.DmcKZPoo.js +2 -0
  67. package/build/client/_app/immutable/entry/app.DmcKZPoo.js.br +0 -0
  68. package/build/client/_app/immutable/entry/app.DmcKZPoo.js.gz +0 -0
  69. package/build/client/_app/immutable/entry/start.AWD7U8zX.js +1 -0
  70. package/build/client/_app/immutable/entry/start.AWD7U8zX.js.br +1 -0
  71. package/build/client/_app/immutable/entry/start.AWD7U8zX.js.gz +0 -0
  72. package/build/client/_app/immutable/nodes/0.D42BAFic.js +46 -0
  73. package/build/client/_app/immutable/nodes/0.D42BAFic.js.br +0 -0
  74. package/build/client/_app/immutable/nodes/0.D42BAFic.js.gz +0 -0
  75. package/build/client/_app/immutable/nodes/1.EnR_repC.js +1 -0
  76. package/build/client/_app/immutable/nodes/1.EnR_repC.js.br +0 -0
  77. package/build/client/_app/immutable/nodes/1.EnR_repC.js.gz +0 -0
  78. package/build/client/_app/immutable/nodes/2.Daii4oR8.js +1 -0
  79. package/build/client/_app/immutable/nodes/2.Daii4oR8.js.br +0 -0
  80. package/build/client/_app/immutable/nodes/2.Daii4oR8.js.gz +0 -0
  81. package/build/client/_app/immutable/workers/editor.worker-Cn2oRESe.js +26 -0
  82. package/build/client/_app/immutable/workers/editor.worker-Cn2oRESe.js.br +0 -0
  83. package/build/client/_app/immutable/workers/editor.worker-Cn2oRESe.js.gz +0 -0
  84. package/build/client/_app/version.json +1 -0
  85. package/build/client/_app/version.json.br +0 -0
  86. package/build/client/_app/version.json.gz +0 -0
  87. package/build/client/robots.txt +3 -0
  88. package/build/client/robots.txt.br +0 -0
  89. package/build/client/robots.txt.gz +0 -0
  90. package/build/env.js +94 -0
  91. package/build/handler.js +1494 -0
  92. package/build/index.js +345 -0
  93. package/build/server/chunks/0-2tF2h-sW.js +13 -0
  94. package/build/server/chunks/0-2tF2h-sW.js.map +1 -0
  95. package/build/server/chunks/1-uqT1he7Y.js +9 -0
  96. package/build/server/chunks/1-uqT1he7Y.js.map +1 -0
  97. package/build/server/chunks/2-WinpGkOi.js +9 -0
  98. package/build/server/chunks/2-WinpGkOi.js.map +1 -0
  99. package/build/server/chunks/_layout.svelte-BO0NOSiE.js +43521 -0
  100. package/build/server/chunks/_layout.svelte-BO0NOSiE.js.map +1 -0
  101. package/build/server/chunks/_page.svelte-BP2EdQl3.js +5 -0
  102. package/build/server/chunks/_page.svelte-BP2EdQl3.js.map +1 -0
  103. package/build/server/chunks/_server.ts-6mqhv5WM.js +30 -0
  104. package/build/server/chunks/_server.ts-6mqhv5WM.js.map +1 -0
  105. package/build/server/chunks/_server.ts-B7evxvHU.js +61 -0
  106. package/build/server/chunks/_server.ts-B7evxvHU.js.map +1 -0
  107. package/build/server/chunks/_server.ts-BN5QAzfI.js +89 -0
  108. package/build/server/chunks/_server.ts-BN5QAzfI.js.map +1 -0
  109. package/build/server/chunks/_server.ts-BWe0PPhA.js +26 -0
  110. package/build/server/chunks/_server.ts-BWe0PPhA.js.map +1 -0
  111. package/build/server/chunks/_server.ts-BgrwjIyE.js +84 -0
  112. package/build/server/chunks/_server.ts-BgrwjIyE.js.map +1 -0
  113. package/build/server/chunks/_server.ts-CFzBDuF1.js +52 -0
  114. package/build/server/chunks/_server.ts-CFzBDuF1.js.map +1 -0
  115. package/build/server/chunks/_server.ts-CHBba1cE.js +55 -0
  116. package/build/server/chunks/_server.ts-CHBba1cE.js.map +1 -0
  117. package/build/server/chunks/_server.ts-ChxeqJr9.js +23 -0
  118. package/build/server/chunks/_server.ts-ChxeqJr9.js.map +1 -0
  119. package/build/server/chunks/_server.ts-Cq27_8sR.js +40 -0
  120. package/build/server/chunks/_server.ts-Cq27_8sR.js.map +1 -0
  121. package/build/server/chunks/_server.ts-DGK-tW9e.js +26 -0
  122. package/build/server/chunks/_server.ts-DGK-tW9e.js.map +1 -0
  123. package/build/server/chunks/_server.ts-DNbiBQKI.js +107 -0
  124. package/build/server/chunks/_server.ts-DNbiBQKI.js.map +1 -0
  125. package/build/server/chunks/_server.ts-LPl3rTE2.js +42 -0
  126. package/build/server/chunks/_server.ts-LPl3rTE2.js.map +1 -0
  127. package/build/server/chunks/_server.ts-WS7E0dC9.js +20 -0
  128. package/build/server/chunks/_server.ts-WS7E0dC9.js.map +1 -0
  129. package/build/server/chunks/_server.ts-o5h153l6.js +22 -0
  130. package/build/server/chunks/_server.ts-o5h153l6.js.map +1 -0
  131. package/build/server/chunks/error.svelte-WWFmDYfs.js +77 -0
  132. package/build/server/chunks/error.svelte-WWFmDYfs.js.map +1 -0
  133. package/build/server/chunks/index-DBqjc0Yf.js +77 -0
  134. package/build/server/chunks/index-DBqjc0Yf.js.map +1 -0
  135. package/build/server/chunks/index-Dq7YP_jO.js +134 -0
  136. package/build/server/chunks/index-Dq7YP_jO.js.map +1 -0
  137. package/build/server/chunks/internal2-R0fapQ2T.js +1164 -0
  138. package/build/server/chunks/internal2-R0fapQ2T.js.map +1 -0
  139. package/build/server/chunks/legacy-client-DEBQKXfT.js +5174 -0
  140. package/build/server/chunks/legacy-client-DEBQKXfT.js.map +1 -0
  141. package/build/server/chunks/mysql-DX3ct8Wa.js +74 -0
  142. package/build/server/chunks/mysql-DX3ct8Wa.js.map +1 -0
  143. package/build/server/chunks/plantuml-BT_hcRqZ.js +32 -0
  144. package/build/server/chunks/plantuml-BT_hcRqZ.js.map +1 -0
  145. package/build/server/chunks/shared-server-DkccXZBX.js +22 -0
  146. package/build/server/chunks/shared-server-DkccXZBX.js.map +1 -0
  147. package/build/server/index.js +4421 -0
  148. package/build/server/index.js.map +1 -0
  149. package/build/server/manifest.js +144 -0
  150. package/build/server/manifest.js.map +1 -0
  151. package/build/shims.js +32 -0
  152. package/package.json +61 -0
@@ -0,0 +1,4421 @@
1
+ import { u as uneval, _ as __commonJSMin, w as writable, r as readable } from './chunks/legacy-client-DEBQKXfT.js';
2
+ import { c as coalesce_to_error, g as get_status, a as get_message, w as with_request_store, p as parse, o as options, b as get_hooks, n as noop, h as has_resolution_suffix, d as has_data_suffix, s as strip_resolution_suffix, e as strip_data_suffix, T as TRAILING_SLASH_PARAM, I as INVALIDATED_PARAM, f as decode_pathname, i as add_data_suffix, j as add_resolution_suffix, k as find_route, l as normalize_path, m as disable_search, v as validate_layout_server_exports, q as validate_layout_exports, r as validate_page_server_exports, t as validate_page_exports, u as noop_span, x as resolve, y as read_implementation, z as get_relative_path, A as set_read_implementation, B as create_remote_key, C as hash, D as text_encoder, E as compact, F as once, G as normalize_error, H as make_trackable, J as parse_remote_arg, K as stringify, L as stringify$1, M as split_remote_key, N as base64_encode } from './chunks/internal2-R0fapQ2T.js';
3
+ import { j as json, t as text, i as isRedirect, e as error } from './chunks/index-Dq7YP_jO.js';
4
+ import { H as HttpError, S as SvelteKitError, R as Redirect, A as ActionFailure } from './chunks/index-DBqjc0Yf.js';
5
+ import { s as set_private_env, a as set_public_env, p as public_env } from './chunks/shared-server-DkccXZBX.js';
6
+
7
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/app/paths/internal/server.js
8
+ var base = "";
9
+ var assets = base;
10
+ var app_dir = "_app";
11
+ var initial = {
12
+ base,
13
+ assets
14
+ };
15
+ /**
16
+ * @param {{ base: string, assets: string }} paths
17
+ */
18
+ function override(paths) {
19
+ base = paths.base;
20
+ assets = paths.assets;
21
+ }
22
+ function reset() {
23
+ base = initial.base;
24
+ assets = initial.assets;
25
+ }
26
+
27
+ /**
28
+ * @template {{ tracing: { enabled: boolean, root: import('@opentelemetry/api').Span, current: import('@opentelemetry/api').Span } }} T
29
+ * @param {T} event_like
30
+ * @param {import('@opentelemetry/api').Span} current
31
+ * @returns {T}
32
+ */
33
+ function merge_tracing(event_like, current) {
34
+ return {
35
+ ...event_like,
36
+ tracing: {
37
+ ...event_like.tracing,
38
+ current
39
+ }
40
+ };
41
+ }
42
+
43
+ var ENDPOINT_METHODS = [
44
+ "GET",
45
+ "POST",
46
+ "PUT",
47
+ "PATCH",
48
+ "DELETE",
49
+ "OPTIONS",
50
+ "HEAD"
51
+ ];
52
+ var PAGE_METHODS = [
53
+ "GET",
54
+ "POST",
55
+ "HEAD"
56
+ ];
57
+ //#endregion
58
+ //#region node_modules/.pnpm/set-cookie-parser@3.1.0/node_modules/set-cookie-parser/lib/set-cookie.js
59
+ var defaultParseOptions = {
60
+ decodeValues: true,
61
+ map: false,
62
+ silent: false,
63
+ split: "auto"
64
+ };
65
+ function isForbiddenKey(key) {
66
+ return typeof key !== "string" || key in {};
67
+ }
68
+ function createNullObj() {
69
+ return Object.create(null);
70
+ }
71
+ function isNonEmptyString(str) {
72
+ return typeof str === "string" && !!str.trim();
73
+ }
74
+ function parseString(setCookieValue, options) {
75
+ var parts = setCookieValue.split(";").filter(isNonEmptyString);
76
+ var parsed = parseNameValuePair(parts.shift());
77
+ var name = parsed.name;
78
+ var value = parsed.value;
79
+ options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
80
+ if (isForbiddenKey(name)) return null;
81
+ try {
82
+ value = options.decodeValues ? decodeURIComponent(value) : value;
83
+ } catch (e) {
84
+ console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.", e);
85
+ }
86
+ var cookie = createNullObj();
87
+ cookie.name = name;
88
+ cookie.value = value;
89
+ parts.forEach(function(part) {
90
+ var sides = part.split("=");
91
+ var key = sides.shift().trimLeft().toLowerCase();
92
+ if (isForbiddenKey(key)) return;
93
+ var value = sides.join("=");
94
+ if (key === "expires") cookie.expires = new Date(value);
95
+ else if (key === "max-age") {
96
+ var n = parseInt(value, 10);
97
+ if (!Number.isNaN(n)) cookie.maxAge = n;
98
+ } else if (key === "secure") cookie.secure = true;
99
+ else if (key === "httponly") cookie.httpOnly = true;
100
+ else if (key === "samesite") cookie.sameSite = value;
101
+ else if (key === "partitioned") cookie.partitioned = true;
102
+ else if (key) cookie[key] = value;
103
+ });
104
+ return cookie;
105
+ }
106
+ function parseNameValuePair(nameValuePairStr) {
107
+ var name = "";
108
+ var value = "";
109
+ var nameValueArr = nameValuePairStr.split("=");
110
+ if (nameValueArr.length > 1) {
111
+ name = nameValueArr.shift();
112
+ value = nameValueArr.join("=");
113
+ } else value = nameValuePairStr;
114
+ return {
115
+ name,
116
+ value
117
+ };
118
+ }
119
+ function parseSetCookie(input, options) {
120
+ options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
121
+ if (!input) if (!options.map) return [];
122
+ else return createNullObj();
123
+ if (input.headers) if (typeof input.headers.getSetCookie === "function") input = input.headers.getSetCookie();
124
+ else if (input.headers["set-cookie"]) input = input.headers["set-cookie"];
125
+ else {
126
+ var sch = input.headers[Object.keys(input.headers).find(function(key) {
127
+ return key.toLowerCase() === "set-cookie";
128
+ })];
129
+ if (!sch && input.headers.cookie && !options.silent) console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning.");
130
+ input = sch;
131
+ }
132
+ var split = options.split;
133
+ var isArray = Array.isArray(input);
134
+ if (split === "auto") split = !isArray;
135
+ if (!isArray) input = [input];
136
+ input = input.filter(isNonEmptyString);
137
+ if (split) input = input.map(splitCookiesString).flat();
138
+ if (!options.map) return input.map(function(str) {
139
+ return parseString(str, options);
140
+ }).filter(Boolean);
141
+ else {
142
+ var cookies = createNullObj();
143
+ return input.reduce(function(cookies, str) {
144
+ var cookie = parseString(str, options);
145
+ if (cookie && !isForbiddenKey(cookie.name)) cookies[cookie.name] = cookie;
146
+ return cookies;
147
+ }, cookies);
148
+ }
149
+ }
150
+ function splitCookiesString(cookiesString) {
151
+ if (Array.isArray(cookiesString)) return cookiesString;
152
+ if (typeof cookiesString !== "string") return [];
153
+ var cookiesStrings = [];
154
+ var pos = 0;
155
+ var start;
156
+ var ch;
157
+ var lastComma;
158
+ var nextStart;
159
+ var cookiesSeparatorFound;
160
+ function skipWhitespace() {
161
+ while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
162
+ return pos < cookiesString.length;
163
+ }
164
+ function notSpecialChar() {
165
+ ch = cookiesString.charAt(pos);
166
+ return ch !== "=" && ch !== ";" && ch !== ",";
167
+ }
168
+ while (pos < cookiesString.length) {
169
+ start = pos;
170
+ cookiesSeparatorFound = false;
171
+ while (skipWhitespace()) {
172
+ ch = cookiesString.charAt(pos);
173
+ if (ch === ",") {
174
+ lastComma = pos;
175
+ pos += 1;
176
+ skipWhitespace();
177
+ nextStart = pos;
178
+ while (pos < cookiesString.length && notSpecialChar()) pos += 1;
179
+ if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
180
+ cookiesSeparatorFound = true;
181
+ pos = nextStart;
182
+ cookiesStrings.push(cookiesString.substring(start, lastComma));
183
+ start = pos;
184
+ } else pos = lastComma + 1;
185
+ } else pos += 1;
186
+ }
187
+ if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
188
+ }
189
+ return cookiesStrings;
190
+ }
191
+ parseSetCookie.parseSetCookie = parseSetCookie;
192
+ parseSetCookie.parse = parseSetCookie;
193
+ parseSetCookie.parseString = parseString;
194
+ parseSetCookie.splitCookiesString = splitCookiesString;
195
+ //#endregion
196
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/form-utils.js
197
+ /** @import { RemoteForm } from '@sveltejs/kit' */
198
+ /** @import { BinaryFormMeta, InternalRemoteFormIssue } from 'types' */
199
+ /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
200
+ var decoder = new TextDecoder();
201
+ /**
202
+ * Sets a value in a nested object using a path string, mutating the original object
203
+ * @param {Record<string, any>} object
204
+ * @param {string} path_string
205
+ * @param {any} value
206
+ */
207
+ function set_nested_value(object, path_string, value) {
208
+ if (path_string.startsWith("n:")) {
209
+ path_string = path_string.slice(2);
210
+ value = value === "" ? void 0 : parseFloat(value);
211
+ } else if (path_string.startsWith("b:")) {
212
+ path_string = path_string.slice(2);
213
+ value = value === "on";
214
+ }
215
+ deep_set(object, split_path(path_string), value);
216
+ }
217
+ /**
218
+ * Convert `FormData` into a POJO
219
+ * @param {FormData} data
220
+ */
221
+ function convert_formdata(data) {
222
+ /** @type {Record<string, any>} */
223
+ const result = {};
224
+ for (let key of data.keys()) {
225
+ const is_array = key.endsWith("[]");
226
+ /** @type {any[]} */
227
+ let values = data.getAll(key);
228
+ if (is_array) key = key.slice(0, -2);
229
+ if (values.length > 1 && !is_array) throw new Error(`Form cannot contain duplicated keys — "${key}" has ${values.length} values`);
230
+ values = values.filter((entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0);
231
+ if (key.startsWith("n:")) {
232
+ key = key.slice(2);
233
+ values = values.map((v) => v === "" ? void 0 : parseFloat(v));
234
+ } else if (key.startsWith("b:")) {
235
+ key = key.slice(2);
236
+ values = values.map((v) => v === "on");
237
+ }
238
+ set_nested_value(result, key, is_array ? values : values[0]);
239
+ }
240
+ return result;
241
+ }
242
+ var BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
243
+ var BINARY_FORM_VERSION = 0;
244
+ var HEADER_BYTES = 7;
245
+ /**
246
+ * @param {Request} request
247
+ * @returns {Promise<{ data: Record<string, any>; meta: BinaryFormMeta; form_data: FormData | null }>}
248
+ */
249
+ async function deserialize_binary_form(request) {
250
+ if (request.headers.get("content-type") !== "application/x-sveltekit-formdata") {
251
+ const form_data = await request.formData();
252
+ return {
253
+ data: convert_formdata(form_data),
254
+ meta: {},
255
+ form_data
256
+ };
257
+ }
258
+ if (!request.body) throw deserialize_error("no body");
259
+ const reader = request.body.getReader();
260
+ /** @type {Array<Promise<Uint8Array<ArrayBuffer> | undefined>>} */
261
+ const chunks = [];
262
+ /**
263
+ * @param {number} index
264
+ * @returns {Promise<Uint8Array<ArrayBuffer> | undefined>}
265
+ */
266
+ function get_chunk(index) {
267
+ if (index in chunks) return chunks[index];
268
+ let i = chunks.length;
269
+ while (i <= index) {
270
+ chunks[i] = reader.read().then((chunk) => chunk.value);
271
+ i++;
272
+ }
273
+ return chunks[index];
274
+ }
275
+ /**
276
+ * @param {number} offset
277
+ * @param {number} length
278
+ * @returns {Promise<Uint8Array | null>}
279
+ */
280
+ async function get_buffer(offset, length) {
281
+ /** @type {Uint8Array} */
282
+ let start_chunk;
283
+ let chunk_start = 0;
284
+ /** @type {number} */
285
+ let chunk_index;
286
+ for (chunk_index = 0;; chunk_index++) {
287
+ const chunk = await get_chunk(chunk_index);
288
+ if (!chunk) return null;
289
+ const chunk_end = chunk_start + chunk.byteLength;
290
+ if (offset >= chunk_start && offset < chunk_end) {
291
+ start_chunk = chunk;
292
+ break;
293
+ }
294
+ chunk_start = chunk_end;
295
+ }
296
+ if (offset + length <= chunk_start + start_chunk.byteLength) return start_chunk.subarray(offset - chunk_start, offset + length - chunk_start);
297
+ const chunks = [start_chunk.subarray(offset - chunk_start)];
298
+ let cursor = start_chunk.byteLength - offset + chunk_start;
299
+ while (cursor < length) {
300
+ chunk_index++;
301
+ let chunk = await get_chunk(chunk_index);
302
+ if (!chunk) return null;
303
+ if (chunk.byteLength > length - cursor) chunk = chunk.subarray(0, length - cursor);
304
+ chunks.push(chunk);
305
+ cursor += chunk.byteLength;
306
+ }
307
+ const buffer = new Uint8Array(length);
308
+ cursor = 0;
309
+ for (const chunk of chunks) {
310
+ buffer.set(chunk, cursor);
311
+ cursor += chunk.byteLength;
312
+ }
313
+ return buffer;
314
+ }
315
+ const header = await get_buffer(0, HEADER_BYTES);
316
+ if (!header) throw deserialize_error("too short");
317
+ if (header[0] !== BINARY_FORM_VERSION) throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
318
+ const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
319
+ const data_length = header_view.getUint32(1, true);
320
+ const file_offsets_length = header_view.getUint16(5, true);
321
+ const data_buffer = await get_buffer(HEADER_BYTES, data_length);
322
+ if (!data_buffer) throw deserialize_error("data too short");
323
+ /** @type {Array<number | undefined>} */
324
+ let file_offsets;
325
+ /** @type {number} */
326
+ let files_start_offset;
327
+ if (file_offsets_length > 0) {
328
+ const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
329
+ if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
330
+ const parsed_offsets = JSON.parse(decoder.decode(file_offsets_buffer));
331
+ if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) throw deserialize_error("invalid file offset table");
332
+ file_offsets = parsed_offsets;
333
+ files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
334
+ }
335
+ /** @type {Array<{ offset: number, size: number }>} */
336
+ const file_spans = [];
337
+ const [data, meta] = parse(decoder.decode(data_buffer), { File: ([name, type, size, last_modified, index]) => {
338
+ if (typeof name !== "string" || typeof type !== "string" || typeof size !== "number" || typeof last_modified !== "number" || typeof index !== "number") throw deserialize_error("invalid file metadata");
339
+ let offset = file_offsets[index];
340
+ if (offset === void 0) throw deserialize_error("duplicate file offset table index");
341
+ file_offsets[index] = void 0;
342
+ offset += files_start_offset;
343
+ file_spans.push({
344
+ offset,
345
+ size
346
+ });
347
+ return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), { getPrototypeOf() {
348
+ return File.prototype;
349
+ } });
350
+ } });
351
+ file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
352
+ for (let i = 1; i < file_spans.length; i++) {
353
+ const previous = file_spans[i - 1];
354
+ const current = file_spans[i];
355
+ const previous_end = previous.offset + previous.size;
356
+ if (previous_end < current.offset) throw deserialize_error("gaps in file data");
357
+ if (previous_end > current.offset) throw deserialize_error("overlapping file data");
358
+ }
359
+ (async () => {
360
+ let has_more = true;
361
+ while (has_more) has_more = !!await get_chunk(chunks.length);
362
+ })();
363
+ return {
364
+ data,
365
+ meta,
366
+ form_data: null
367
+ };
368
+ }
369
+ /**
370
+ * @param {string} message
371
+ */
372
+ function deserialize_error(message) {
373
+ return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
374
+ }
375
+ /** @implements {File} */
376
+ var LazyFile = class LazyFile {
377
+ /** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
378
+ #get_chunk;
379
+ /** @type {number} */
380
+ #offset;
381
+ /**
382
+ * @param {string} name
383
+ * @param {string} type
384
+ * @param {number} size
385
+ * @param {number} last_modified
386
+ * @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
387
+ * @param {number} offset
388
+ */
389
+ constructor(name, type, size, last_modified, get_chunk, offset) {
390
+ this.name = name;
391
+ this.type = type;
392
+ this.size = size;
393
+ this.lastModified = last_modified;
394
+ this.webkitRelativePath = "";
395
+ this.#get_chunk = get_chunk;
396
+ this.#offset = offset;
397
+ this.arrayBuffer = this.arrayBuffer.bind(this);
398
+ this.bytes = this.bytes.bind(this);
399
+ this.slice = this.slice.bind(this);
400
+ this.stream = this.stream.bind(this);
401
+ this.text = this.text.bind(this);
402
+ }
403
+ /** @type {ArrayBuffer | undefined} */
404
+ #buffer;
405
+ async arrayBuffer() {
406
+ this.#buffer ??= await new Response(this.stream()).arrayBuffer();
407
+ return this.#buffer;
408
+ }
409
+ async bytes() {
410
+ return new Uint8Array(await this.arrayBuffer());
411
+ }
412
+ /**
413
+ * @param {number=} start
414
+ * @param {number=} end
415
+ * @param {string=} contentType
416
+ */
417
+ slice(start = 0, end = this.size, contentType = this.type) {
418
+ if (start < 0) start = Math.max(this.size + start, 0);
419
+ else start = Math.min(start, this.size);
420
+ if (end < 0) end = Math.max(this.size + end, 0);
421
+ else end = Math.min(end, this.size);
422
+ const size = Math.max(end - start, 0);
423
+ return new LazyFile(this.name, contentType, size, this.lastModified, this.#get_chunk, this.#offset + start);
424
+ }
425
+ stream() {
426
+ let cursor = 0;
427
+ let chunk_index = 0;
428
+ return new ReadableStream({
429
+ start: async (controller) => {
430
+ let chunk_start = 0;
431
+ /** @type {Uint8Array} */
432
+ let start_chunk;
433
+ for (chunk_index = 0;; chunk_index++) {
434
+ const chunk = await this.#get_chunk(chunk_index);
435
+ if (!chunk) return null;
436
+ const chunk_end = chunk_start + chunk.byteLength;
437
+ if (this.#offset >= chunk_start && this.#offset < chunk_end) {
438
+ start_chunk = chunk;
439
+ break;
440
+ }
441
+ chunk_start = chunk_end;
442
+ }
443
+ if (this.#offset + this.size <= chunk_start + start_chunk.byteLength) {
444
+ controller.enqueue(start_chunk.subarray(this.#offset - chunk_start, this.#offset + this.size - chunk_start));
445
+ controller.close();
446
+ } else {
447
+ controller.enqueue(start_chunk.subarray(this.#offset - chunk_start));
448
+ cursor = start_chunk.byteLength - this.#offset + chunk_start;
449
+ }
450
+ },
451
+ pull: async (controller) => {
452
+ chunk_index++;
453
+ let chunk = await this.#get_chunk(chunk_index);
454
+ if (!chunk) {
455
+ controller.error("incomplete file data");
456
+ controller.close();
457
+ return;
458
+ }
459
+ if (chunk.byteLength > this.size - cursor) chunk = chunk.subarray(0, this.size - cursor);
460
+ controller.enqueue(chunk);
461
+ cursor += chunk.byteLength;
462
+ if (cursor >= this.size) controller.close();
463
+ }
464
+ });
465
+ }
466
+ async text() {
467
+ return decoder.decode(await this.arrayBuffer());
468
+ }
469
+ };
470
+ var path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;
471
+ /**
472
+ * @param {string} path
473
+ */
474
+ function split_path(path) {
475
+ if (!path_regex.test(path)) throw new Error(`Invalid path ${path}`);
476
+ return path.split(/\.|\[|\]/).filter(Boolean);
477
+ }
478
+ /**
479
+ * Check if a property key is dangerous and could lead to prototype pollution
480
+ * @param {string} key
481
+ */
482
+ function check_prototype_pollution(key) {
483
+ if (key === "__proto__" || key === "constructor" || key === "prototype") throw new Error(`Invalid key "${key}"`);
484
+ }
485
+ /**
486
+ * Sets a value in a nested object using an array of keys, mutating the original object.
487
+ * @param {Record<string, any>} object
488
+ * @param {string[]} keys
489
+ * @param {any} value
490
+ */
491
+ function deep_set(object, keys, value) {
492
+ let current = object;
493
+ for (let i = 0; i < keys.length - 1; i += 1) {
494
+ const key = keys[i];
495
+ check_prototype_pollution(key);
496
+ const is_array = /^\d+$/.test(keys[i + 1]);
497
+ const inner = Object.hasOwn(current, key) ? current[key] : void 0;
498
+ const exists = inner != null;
499
+ if (exists && is_array !== Array.isArray(inner)) throw new Error(`Invalid array key ${keys[i + 1]}`);
500
+ if (!exists) current[key] = is_array ? [] : {};
501
+ current = current[key];
502
+ }
503
+ const final_key = keys[keys.length - 1];
504
+ check_prototype_pollution(final_key);
505
+ current[final_key] = value;
506
+ }
507
+ //#endregion
508
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/utils/http.js
509
+ /**
510
+ * Given an Accept header and a list of possible content types, pick
511
+ * the most suitable one to respond with
512
+ * @param {string} accept
513
+ * @param {string[]} types
514
+ */
515
+ function negotiate(accept, types) {
516
+ /** @type {Array<{ type: string, subtype: string, q: number, i: number }>} */
517
+ const parts = [];
518
+ accept.split(",").forEach((str, i) => {
519
+ const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
520
+ if (match) {
521
+ const [, type, subtype, q = "1"] = match;
522
+ parts.push({
523
+ type,
524
+ subtype,
525
+ q: +q,
526
+ i
527
+ });
528
+ }
529
+ });
530
+ parts.sort((a, b) => {
531
+ if (a.q !== b.q) return b.q - a.q;
532
+ if (a.subtype === "*" !== (b.subtype === "*")) return a.subtype === "*" ? 1 : -1;
533
+ if (a.type === "*" !== (b.type === "*")) return a.type === "*" ? 1 : -1;
534
+ return a.i - b.i;
535
+ });
536
+ let accepted;
537
+ let min_priority = Infinity;
538
+ for (const mimetype of types) {
539
+ const [type, subtype] = mimetype.split("/");
540
+ const priority = parts.findIndex((part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*"));
541
+ if (priority !== -1 && priority < min_priority) {
542
+ accepted = mimetype;
543
+ min_priority = priority;
544
+ }
545
+ }
546
+ return accepted;
547
+ }
548
+ /**
549
+ * Reads all `Set-Cookie` headers as separate values. `Headers.get('set-cookie')`
550
+ * collapses them into a single comma-joined string that browsers cannot parse, so
551
+ * we use `Headers.getSetCookie()` where available and fall back to splitting the
552
+ * joined string otherwise.
553
+ *
554
+ * TODO 3.0 `getSetCookie` is available in Node 19.7+; once we drop support for
555
+ * older versions we can use it directly and remove the `splitCookiesString` fallback
556
+ * @param {Headers} headers
557
+ * @returns {string[]}
558
+ */
559
+ function get_set_cookies(headers) {
560
+ if (typeof headers.getSetCookie === "function") return headers.getSetCookie();
561
+ const set_cookie = headers.get("set-cookie");
562
+ return set_cookie ? splitCookiesString(set_cookie) : [];
563
+ }
564
+ /**
565
+ * Returns `true` if the request contains a `content-type` header with the given type
566
+ * @param {Request} request
567
+ * @param {...string} types
568
+ */
569
+ function is_content_type(request, ...types) {
570
+ const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
571
+ return types.includes(type.toLowerCase());
572
+ }
573
+ /**
574
+ * @param {Request} request
575
+ */
576
+ function is_form_content_type(request) {
577
+ return is_content_type(request, "application/x-www-form-urlencoded", "multipart/form-data", "text/plain", BINARY_FORM_CONTENT_TYPE);
578
+ }
579
+ //#endregion
580
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/utils/misc.js
581
+ var s = JSON.stringify;
582
+ //#endregion
583
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/utils/escape.js
584
+ /**
585
+ * When inside a double-quoted attribute value, only `&` and `"` hold special meaning.
586
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#attribute-value-(double-quoted)-state
587
+ * @type {Record<string, string>}
588
+ */
589
+ var escape_html_attr_dict = {
590
+ "&": "&amp;",
591
+ "\"": "&quot;"
592
+ };
593
+ /**
594
+ * @type {Record<string, string>}
595
+ */
596
+ var escape_html_dict = {
597
+ "&": "&amp;",
598
+ "<": "&lt;"
599
+ };
600
+ var escape_html_attr_regex = new RegExp(`[${Object.keys(escape_html_attr_dict).join("")}]|[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]`, "g");
601
+ var escape_html_regex = new RegExp(`[${Object.keys(escape_html_dict).join("")}]|[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]`, "g");
602
+ /**
603
+ * Escapes unpaired surrogates (which are allowed in js strings but invalid in HTML) and
604
+ * escapes characters that are special.
605
+ *
606
+ * @param {string} str
607
+ * @param {boolean} [is_attr]
608
+ * @returns {string} escaped string
609
+ * @example const html = `<tag data-value="${escape_html('value', true)}">...</tag>`;
610
+ */
611
+ function escape_html(str, is_attr) {
612
+ const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
613
+ return str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
614
+ if (match.length === 2) return match;
615
+ return dict[match] ?? `&#${match.charCodeAt(0)};`;
616
+ });
617
+ }
618
+ //#endregion
619
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/utils.js
620
+ /** @import { ServerHooks } from 'types' */
621
+ /**
622
+ * @param {Partial<Record<import('types').HttpMethod, any>>} mod
623
+ * @param {import('types').HttpMethod} method
624
+ */
625
+ function method_not_allowed(mod, method) {
626
+ return text(`${method} method not allowed`, {
627
+ status: 405,
628
+ headers: { allow: allowed_methods(mod).join(", ") }
629
+ });
630
+ }
631
+ /** @param {Partial<Record<import('types').HttpMethod, any>>} mod */
632
+ function allowed_methods(mod) {
633
+ const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
634
+ if ("GET" in mod && !("HEAD" in mod)) allowed.push("HEAD");
635
+ return allowed;
636
+ }
637
+ /**
638
+ * @param {import('types').SSROptions} options
639
+ */
640
+ function get_global_name(options) {
641
+ return `__sveltekit_${options.version_hash}`;
642
+ }
643
+ /**
644
+ * Return as a response that renders the error.html
645
+ *
646
+ * @param {import('types').SSROptions} options
647
+ * @param {number} status
648
+ * @param {string} message
649
+ */
650
+ function static_error_page(options, status, message) {
651
+ return text(options.templates.error({
652
+ status,
653
+ message: escape_html(message)
654
+ }), {
655
+ headers: { "content-type": "text/html; charset=utf-8" },
656
+ status
657
+ });
658
+ }
659
+ /**
660
+ * @param {import('@sveltejs/kit').RequestEvent} event
661
+ * @param {import('types').RequestState} state
662
+ * @param {import('types').SSROptions} options
663
+ * @param {unknown} error
664
+ */
665
+ async function handle_fatal_error(event, state, options, error) {
666
+ error = error instanceof HttpError ? error : coalesce_to_error(error);
667
+ const status = get_status(error);
668
+ const body = await handle_error_and_jsonify(event, state, options, error);
669
+ const type = negotiate(event.request.headers.get("accept") || "text/html", ["application/json", "text/html"]);
670
+ if (event.isDataRequest || type === "application/json") return json(body, { status });
671
+ return static_error_page(options, status, body.message);
672
+ }
673
+ /**
674
+ * @param {import('@sveltejs/kit').RequestEvent} event
675
+ * @param {import('types').RequestState} state
676
+ * @param {import('types').SSROptions} options
677
+ * @param {any} error
678
+ * @returns {Promise<App.Error>}
679
+ */
680
+ async function handle_error_and_jsonify(event, state, options, error) {
681
+ if (error instanceof HttpError) return {
682
+ message: "Unknown Error",
683
+ ...error.body
684
+ };
685
+ const status = get_status(error);
686
+ const message = get_message(error);
687
+ return await with_request_store({
688
+ event,
689
+ state
690
+ }, () => options.hooks.handleError({
691
+ error,
692
+ event,
693
+ status,
694
+ message
695
+ })) ?? { message };
696
+ }
697
+ /**
698
+ * @param {number} status
699
+ * @param {string} location
700
+ */
701
+ function redirect_response(status, location) {
702
+ return new Response(void 0, {
703
+ status,
704
+ headers: { location }
705
+ });
706
+ }
707
+ /**
708
+ * @param {import('@sveltejs/kit').RequestEvent} event
709
+ * @param {Error & { path: string }} error
710
+ */
711
+ function clarify_devalue_error(event, error) {
712
+ if (error.path) return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`;
713
+ if (error.path === "") return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
714
+ return error.message;
715
+ }
716
+ /**
717
+ * @param {import('types').ServerDataNode} node
718
+ */
719
+ function serialize_uses(node) {
720
+ const uses = {};
721
+ if (node.uses && node.uses.dependencies.size > 0) uses.dependencies = Array.from(node.uses.dependencies);
722
+ if (node.uses && node.uses.search_params.size > 0) uses.search_params = Array.from(node.uses.search_params);
723
+ if (node.uses && node.uses.params.size > 0) uses.params = Array.from(node.uses.params);
724
+ if (node.uses?.parent) uses.parent = 1;
725
+ if (node.uses?.route) uses.route = 1;
726
+ if (node.uses?.url) uses.url = 1;
727
+ return uses;
728
+ }
729
+ /**
730
+ * Returns `true` if the given path was prerendered
731
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
732
+ * @param {string} pathname Should include the base and be decoded
733
+ */
734
+ function has_prerendered_path(manifest, pathname) {
735
+ return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
736
+ }
737
+ /**
738
+ * Formats the error into a nice message with sanitized stack trace
739
+ * @param {number} status
740
+ * @param {Error} error
741
+ * @param {import('@sveltejs/kit').RequestEvent} event
742
+ */
743
+ function format_server_error(status, error, event) {
744
+ const formatted_text = `\n\x1b[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1b[0m`;
745
+ if (status === 404) return formatted_text;
746
+ return `${formatted_text}\n${error.stack}`;
747
+ }
748
+ /**
749
+ * Returns the filename without the extension. e.g., `+page.server`, `+page`, etc.
750
+ * @param {string | undefined} node_id
751
+ * @returns {string}
752
+ */
753
+ function get_node_type(node_id) {
754
+ const filename = (node_id?.split("/"))?.at(-1);
755
+ if (!filename) return "unknown";
756
+ return filename.split(".").slice(0, -1).join(".");
757
+ }
758
+ /**
759
+ * Creates a serialiser for non-arbitrary POJOs using the app's transport hook
760
+ * @param {ServerHooks['transport']} transport
761
+ * @returns {(thing: unknown) => string | undefined}
762
+ */
763
+ function create_replacer(transport) {
764
+ /** @param {unknown} thing */
765
+ const replacer = (thing) => {
766
+ for (const key in transport) {
767
+ const encoded = transport[key].encode(thing);
768
+ if (encoded) return `app.decode('${key}', ${uneval(encoded, replacer)})`;
769
+ }
770
+ };
771
+ return replacer;
772
+ }
773
+
774
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/utils/promise.js
775
+ /** @see https://github.com/microsoft/TypeScript/blob/904e7dd97dc8da1352c8e05d70829dff17c73214/src/lib/es2024.promise.d.ts */
776
+ /**
777
+ * @template T
778
+ * @typedef {{
779
+ * promise: Promise<T>;
780
+ * resolve: (value: T | PromiseLike<T>) => void;
781
+ * reject: (reason?: any) => void;
782
+ * }} PromiseWithResolvers<T>
783
+ */
784
+ /**
785
+ * TODO: Whenever Node >21 is minimum supported version, we can use `Promise.withResolvers` to avoid this ceremony
786
+ *
787
+ * @template T
788
+ * @returns {PromiseWithResolvers<T>}
789
+ */
790
+ function with_resolvers() {
791
+ let resolve;
792
+ let reject;
793
+ return {
794
+ promise: new Promise((res, rej) => {
795
+ resolve = res;
796
+ reject = rej;
797
+ }),
798
+ resolve,
799
+ reject
800
+ };
801
+ }
802
+ //#endregion
803
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/constants.js
804
+ var NULL_BODY_STATUS = [
805
+ 101,
806
+ 103,
807
+ 204,
808
+ 205,
809
+ 304
810
+ ];
811
+ var IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
812
+ //#endregion
813
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/endpoint.js
814
+ /**
815
+ * @param {import('@sveltejs/kit').RequestEvent} event
816
+ * @param {import('types').RequestState} event_state
817
+ * @param {import('types').SSREndpoint} mod
818
+ * @param {import('types').SSRState} state
819
+ * @returns {Promise<Response>}
820
+ */
821
+ async function render_endpoint(event, event_state, mod, state) {
822
+ const method = event.request.method;
823
+ let handler = mod[method] || mod.fallback;
824
+ if (method === "HEAD" && !mod.HEAD && mod.GET) handler = mod.GET;
825
+ if (!handler) return method_not_allowed(mod, method);
826
+ const prerender = mod.prerender ?? state.prerender_default;
827
+ if (prerender && (mod.POST || mod.PATCH || mod.PUT || mod.DELETE)) throw new Error("Cannot prerender endpoints that have mutative methods");
828
+ if (state.prerendering && !state.prerendering.inside_reroute && !prerender) if (state.depth > 0) throw new Error(`${event.route.id} is not prerenderable`);
829
+ else return new Response(void 0, { status: 204 });
830
+ try {
831
+ const response = await with_request_store({
832
+ event,
833
+ state: event_state
834
+ }, () => handler(event));
835
+ if (!(response instanceof Response)) throw new Error(`Invalid response from route ${event.url.pathname}: handler should return a Response object`);
836
+ if (state.prerendering && (!state.prerendering.inside_reroute || prerender)) {
837
+ const cloned = new Response(response.clone().body, {
838
+ status: response.status,
839
+ statusText: response.statusText,
840
+ headers: new Headers(response.headers)
841
+ });
842
+ cloned.headers.set("x-sveltekit-prerender", String(prerender));
843
+ if (state.prerendering.inside_reroute && prerender) {
844
+ cloned.headers.set("x-sveltekit-routeid", encodeURI(event.route.id));
845
+ state.prerendering.dependencies.set(event.url.pathname, {
846
+ response: cloned,
847
+ body: null
848
+ });
849
+ } else return cloned;
850
+ }
851
+ return response;
852
+ } catch (e) {
853
+ if (e instanceof Redirect) return new Response(void 0, {
854
+ status: e.status,
855
+ headers: { location: e.location }
856
+ });
857
+ throw e;
858
+ }
859
+ }
860
+ /**
861
+ * @param {import('@sveltejs/kit').RequestEvent} event
862
+ */
863
+ function is_endpoint_request(event) {
864
+ const { method, headers } = event.request;
865
+ if (ENDPOINT_METHODS.includes(method) && !PAGE_METHODS.includes(method)) return true;
866
+ if (method === "POST" && headers.get("x-sveltekit-action") === "true") return false;
867
+ return negotiate(event.request.headers.get("accept") ?? "*/*", ["*", "text/html"]) !== "text/html";
868
+ }
869
+ //#endregion
870
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/telemetry/record_span.js
871
+ /** @import { RecordSpan } from 'types' */
872
+ /** @type {RecordSpan} */
873
+ async function record_span({ name, attributes, fn }) {
874
+ return fn(noop_span);
875
+ }
876
+ //#endregion
877
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/actions.js
878
+ /** @import { RequestEvent, ActionResult, Actions } from '@sveltejs/kit' */
879
+ /** @import { SSROptions, SSRNode, ServerNode, ServerHooks } from 'types' */
880
+ /** @param {RequestEvent} event */
881
+ function is_action_json_request(event) {
882
+ return negotiate(event.request.headers.get("accept") ?? "*/*", ["application/json", "text/html"]) === "application/json" && event.request.method === "POST";
883
+ }
884
+ /**
885
+ * @param {RequestEvent} event
886
+ * @param {import('types').RequestState} event_state
887
+ * @param {SSROptions} options
888
+ * @param {SSRNode['server'] | undefined} server
889
+ */
890
+ async function handle_action_json_request(event, event_state, options, server) {
891
+ const actions = server?.actions;
892
+ if (!actions) {
893
+ const no_actions_error = new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`);
894
+ return action_json({
895
+ type: "error",
896
+ error: await handle_error_and_jsonify(event, event_state, options, no_actions_error)
897
+ }, {
898
+ status: no_actions_error.status,
899
+ headers: { allow: "GET" }
900
+ });
901
+ }
902
+ check_named_default_separate(actions);
903
+ try {
904
+ const data = await call_action(event, event_state, actions);
905
+ if (data instanceof ActionFailure) return action_json({
906
+ type: "failure",
907
+ status: data.status,
908
+ data: stringify_action_response(data.data, event.route.id, options.hooks.transport)
909
+ });
910
+ else return action_json({
911
+ type: "success",
912
+ status: data ? 200 : 204,
913
+ data: stringify_action_response(data, event.route.id, options.hooks.transport)
914
+ });
915
+ } catch (e) {
916
+ const err = normalize_error(e);
917
+ if (err instanceof Redirect) return action_json_redirect(err);
918
+ return action_json({
919
+ type: "error",
920
+ error: await handle_error_and_jsonify(event, event_state, options, check_incorrect_fail_use(err))
921
+ }, { status: get_status(err) });
922
+ }
923
+ }
924
+ /**
925
+ * @param {HttpError | Error} error
926
+ */
927
+ function check_incorrect_fail_use(error) {
928
+ return error instanceof ActionFailure ? /* @__PURE__ */ new Error("Cannot \"throw fail()\". Use \"return fail()\"") : error;
929
+ }
930
+ /**
931
+ * @param {Redirect} redirect
932
+ */
933
+ function action_json_redirect(redirect) {
934
+ return action_json({
935
+ type: "redirect",
936
+ status: redirect.status,
937
+ location: redirect.location
938
+ });
939
+ }
940
+ /**
941
+ * @param {ActionResult} data
942
+ * @param {ResponseInit} [init]
943
+ */
944
+ function action_json(data, init) {
945
+ return json(data, init);
946
+ }
947
+ /**
948
+ * @param {RequestEvent} event
949
+ */
950
+ function is_action_request(event) {
951
+ return event.request.method === "POST";
952
+ }
953
+ /**
954
+ * @param {RequestEvent} event
955
+ * @param {import('types').RequestState} event_state
956
+ * @param {SSRNode['server'] | undefined} server
957
+ * @returns {Promise<ActionResult>}
958
+ */
959
+ async function handle_action_request(event, event_state, server) {
960
+ const actions = server?.actions;
961
+ if (!actions) {
962
+ event.setHeaders({ allow: "GET" });
963
+ return {
964
+ type: "error",
965
+ error: new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`)
966
+ };
967
+ }
968
+ check_named_default_separate(actions);
969
+ try {
970
+ const data = await call_action(event, event_state, actions);
971
+ if (data instanceof ActionFailure) return {
972
+ type: "failure",
973
+ status: data.status,
974
+ data: data.data
975
+ };
976
+ else return {
977
+ type: "success",
978
+ status: 200,
979
+ data
980
+ };
981
+ } catch (e) {
982
+ const err = normalize_error(e);
983
+ if (err instanceof Redirect) return {
984
+ type: "redirect",
985
+ status: err.status,
986
+ location: err.location
987
+ };
988
+ return {
989
+ type: "error",
990
+ error: check_incorrect_fail_use(err)
991
+ };
992
+ }
993
+ }
994
+ /**
995
+ * @param {Actions} actions
996
+ */
997
+ function check_named_default_separate(actions) {
998
+ if (actions.default && Object.keys(actions).length > 1) throw new Error("When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions");
999
+ }
1000
+ /**
1001
+ * @param {RequestEvent} event
1002
+ * @param {import('types').RequestState} event_state
1003
+ * @param {NonNullable<ServerNode['actions']>} actions
1004
+ * @throws {Redirect | HttpError | SvelteKitError | Error}
1005
+ */
1006
+ async function call_action(event, event_state, actions) {
1007
+ const url = new URL(event.request.url);
1008
+ let name = "default";
1009
+ for (const param of url.searchParams) if (param[0].startsWith("/")) {
1010
+ name = param[0].slice(1);
1011
+ if (name === "default") throw new Error("Cannot use reserved action name \"default\"");
1012
+ break;
1013
+ }
1014
+ const action = actions[name];
1015
+ if (!action) throw new SvelteKitError(404, "Not Found", `No action with name '${name}' found`);
1016
+ if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `Form actions expect form-encoded data — received ${event.request.headers.get("content-type")}`);
1017
+ return record_span({
1018
+ name: "sveltekit.form_action",
1019
+ attributes: {
1020
+ "http.route": event.route.id || "unknown"
1021
+ },
1022
+ fn: async (current) => {
1023
+ const traced_event = merge_tracing(event, current);
1024
+ const result = await with_request_store({
1025
+ event: traced_event,
1026
+ state: event_state
1027
+ }, () => action(traced_event));
1028
+ if (result instanceof ActionFailure) current.setAttributes({
1029
+ "sveltekit.form_action.result.type": "failure",
1030
+ "sveltekit.form_action.result.status": result.status
1031
+ });
1032
+ return result;
1033
+ }
1034
+ });
1035
+ }
1036
+ /**
1037
+ * Try to `devalue.uneval` the data object, and if it fails, return a proper Error with context
1038
+ * @param {any} data
1039
+ * @param {string} route_id
1040
+ * @param {ServerHooks['transport']} transport
1041
+ */
1042
+ function uneval_action_response(data, route_id, transport) {
1043
+ const replacer = create_replacer(transport);
1044
+ return try_serialize(data, (value) => uneval(value, replacer), route_id);
1045
+ }
1046
+ /**
1047
+ * Try to `devalue.stringify` the data object, and if it fails, return a proper Error with context
1048
+ * @param {any} data
1049
+ * @param {string} route_id
1050
+ * @param {ServerHooks['transport']} transport
1051
+ */
1052
+ function stringify_action_response(data, route_id, transport) {
1053
+ const encoders = Object.fromEntries(Object.entries(transport).map(([key, value]) => [key, value.encode]));
1054
+ return try_serialize(data, (value) => stringify$1(value, encoders), route_id);
1055
+ }
1056
+ /**
1057
+ * @param {any} data
1058
+ * @param {(data: any) => string} fn
1059
+ * @param {string} route_id
1060
+ */
1061
+ function try_serialize(data, fn, route_id) {
1062
+ try {
1063
+ return fn(data);
1064
+ } catch (e) {
1065
+ const error = e;
1066
+ if (data instanceof Response) throw new Error(`Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`, { cause: e });
1067
+ if ("path" in error) {
1068
+ let message = `Data returned from action inside ${route_id} is not serializable: ${error.message}`;
1069
+ if (error.path !== "") message += ` (data.${error.path})`;
1070
+ throw new Error(message, { cause: e });
1071
+ }
1072
+ throw error;
1073
+ }
1074
+ }
1075
+ //#endregion
1076
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/utils/streaming.js
1077
+ /**
1078
+ * Create an async iterator and a function to push values into it
1079
+ * @template T
1080
+ * @returns {{
1081
+ * iterate: (transform?: (input: T) => T) => AsyncIterable<T>;
1082
+ * add: (promise: Promise<T>) => void;
1083
+ * }}
1084
+ */
1085
+ function create_async_iterator() {
1086
+ let resolved = -1;
1087
+ let returned = -1;
1088
+ /** @type {import('./promise.js').PromiseWithResolvers<T>[]} */
1089
+ const deferred = [];
1090
+ return {
1091
+ iterate: (transform = (x) => x) => {
1092
+ return { [Symbol.asyncIterator]() {
1093
+ return { next: async () => {
1094
+ const next = deferred[++returned];
1095
+ if (!next) return {
1096
+ value: null,
1097
+ done: true
1098
+ };
1099
+ return {
1100
+ value: transform(await next.promise),
1101
+ done: false
1102
+ };
1103
+ } };
1104
+ } };
1105
+ },
1106
+ add: (promise) => {
1107
+ deferred.push(with_resolvers());
1108
+ promise.then((value) => {
1109
+ deferred[++resolved].resolve(value);
1110
+ });
1111
+ }
1112
+ };
1113
+ }
1114
+ //#endregion
1115
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/data_serializer.js
1116
+ /**
1117
+ * If the serialized data contains promises, `chunks` will be an
1118
+ * async iterable containing their resolutions
1119
+ * @param {import('@sveltejs/kit').RequestEvent} event
1120
+ * @param {import('types').RequestState} event_state
1121
+ * @param {import('types').SSROptions} options
1122
+ * @returns {import('./types.js').ServerDataSerializer}
1123
+ */
1124
+ function server_data_serializer(event, event_state, options) {
1125
+ let promise_id = 1;
1126
+ let max_nodes = -1;
1127
+ const iterator = create_async_iterator();
1128
+ const global = get_global_name(options);
1129
+ /** @param {number} index */
1130
+ function get_replacer(index) {
1131
+ /** @param {any} thing */
1132
+ return function replacer(thing) {
1133
+ if (typeof thing?.then === "function") {
1134
+ const id = promise_id++;
1135
+ const promise = thing.then(
1136
+ /** @param {any} data */
1137
+ (data) => ({ data })
1138
+ ).catch(
1139
+ /** @param {any} error */
1140
+ async (error) => ({ error: await handle_error_and_jsonify(event, event_state, options, error) })
1141
+ ).then(
1142
+ /**
1143
+ * @param {{data: any; error: any}} result
1144
+ */
1145
+ async ({ data, error }) => {
1146
+ let str;
1147
+ try {
1148
+ str = uneval(error ? [, error] : [data], replacer);
1149
+ } catch {
1150
+ error = await handle_error_and_jsonify(event, event_state, options, /* @__PURE__ */ new Error(`Failed to serialize promise while rendering ${event.route.id}`));
1151
+ str = uneval([, error], replacer);
1152
+ }
1153
+ return {
1154
+ index,
1155
+ str: `${global}.resolve(${id}, ${str.includes("app.decode") ? `(app) => ${str}` : `() => ${str}`})`
1156
+ };
1157
+ }
1158
+ );
1159
+ iterator.add(promise);
1160
+ return `${global}.defer(${id})`;
1161
+ } else for (const key in options.hooks.transport) {
1162
+ const encoded = options.hooks.transport[key].encode(thing);
1163
+ if (encoded) return `app.decode('${key}', ${uneval(encoded, replacer)})`;
1164
+ }
1165
+ };
1166
+ }
1167
+ const strings = [];
1168
+ return {
1169
+ set_max_nodes(i) {
1170
+ max_nodes = i;
1171
+ },
1172
+ add_node(i, node) {
1173
+ try {
1174
+ if (!node) {
1175
+ strings[i] = "null";
1176
+ return;
1177
+ }
1178
+ /** @type {any} */
1179
+ const payload = {
1180
+ type: "data",
1181
+ data: node.data,
1182
+ uses: serialize_uses(node)
1183
+ };
1184
+ if (node.slash) payload.slash = node.slash;
1185
+ strings[i] = uneval(payload, get_replacer(i));
1186
+ } catch (e) {
1187
+ e.path = e.path.slice(1);
1188
+ throw new Error(clarify_devalue_error(event, e), { cause: e });
1189
+ }
1190
+ },
1191
+ get_data(csp) {
1192
+ const open = `<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>`;
1193
+ const close = `<\/script>\n`;
1194
+ return {
1195
+ data: `[${compact(max_nodes > -1 ? strings.slice(0, max_nodes) : strings).join(",")}]`,
1196
+ chunks: promise_id > 1 ? iterator.iterate(({ index, str }) => {
1197
+ if (max_nodes > -1 && index >= max_nodes) return "";
1198
+ return open + str + close;
1199
+ }) : null
1200
+ };
1201
+ }
1202
+ };
1203
+ }
1204
+ /**
1205
+ * If the serialized data contains promises, `chunks` will be an
1206
+ * async iterable containing their resolutions
1207
+ * @param {import('@sveltejs/kit').RequestEvent} event
1208
+ * @param {import('types').RequestState} event_state
1209
+ * @param {import('types').SSROptions} options
1210
+ * @returns {import('./types.js').ServerDataSerializerJson}
1211
+ */
1212
+ function server_data_serializer_json(event, event_state, options) {
1213
+ let promise_id = 1;
1214
+ const iterator = create_async_iterator();
1215
+ const reducers = {
1216
+ ...Object.fromEntries(Object.entries(options.hooks.transport).map(([key, value]) => [key, value.encode])),
1217
+ /** @param {any} thing */
1218
+ Promise: (thing) => {
1219
+ if (typeof thing?.then !== "function") return;
1220
+ const id = promise_id++;
1221
+ /** @type {'data' | 'error'} */
1222
+ let key = "data";
1223
+ const promise = thing.catch(
1224
+ /** @param {any} e */
1225
+ async (e) => {
1226
+ key = "error";
1227
+ return handle_error_and_jsonify(event, event_state, options, e);
1228
+ }
1229
+ ).then(
1230
+ /** @param {any} value */
1231
+ async (value) => {
1232
+ let str;
1233
+ try {
1234
+ str = stringify$1(value, reducers);
1235
+ } catch {
1236
+ const error = await handle_error_and_jsonify(event, event_state, options, /* @__PURE__ */ new Error(`Failed to serialize promise while rendering ${event.route.id}`));
1237
+ key = "error";
1238
+ str = stringify$1(error, reducers);
1239
+ }
1240
+ return `{"type":"chunk","id":${id},"${key}":${str}}\n`;
1241
+ }
1242
+ );
1243
+ iterator.add(promise);
1244
+ return id;
1245
+ }
1246
+ };
1247
+ const strings = [];
1248
+ return {
1249
+ add_node(i, node) {
1250
+ try {
1251
+ if (!node) {
1252
+ strings[i] = "null";
1253
+ return;
1254
+ }
1255
+ if (node.type === "error" || node.type === "skip") {
1256
+ strings[i] = JSON.stringify(node);
1257
+ return;
1258
+ }
1259
+ strings[i] = `{"type":"data","data":${stringify$1(node.data, reducers)},"uses":${JSON.stringify(serialize_uses(node))}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ""}}`;
1260
+ } catch (e) {
1261
+ e.path = "data" + e.path;
1262
+ throw new Error(clarify_devalue_error(event, e), { cause: e });
1263
+ }
1264
+ },
1265
+ get_data() {
1266
+ return {
1267
+ data: `{"type":"data","nodes":[${strings.join(",")}]}\n`,
1268
+ chunks: promise_id > 1 ? iterator.iterate() : null
1269
+ };
1270
+ }
1271
+ };
1272
+ }
1273
+ //#endregion
1274
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/load_data.js
1275
+ /**
1276
+ * Calls the user's server `load` function.
1277
+ * @param {{
1278
+ * event: import('@sveltejs/kit').RequestEvent;
1279
+ * event_state: import('types').RequestState;
1280
+ * state: import('types').SSRState;
1281
+ * node: import('types').SSRNode | undefined;
1282
+ * parent: () => Promise<Record<string, any>>;
1283
+ * }} opts
1284
+ * @returns {Promise<import('types').ServerDataNode | null>}
1285
+ */
1286
+ async function load_server_data({ event, event_state, state, node, parent }) {
1287
+ if (!node?.server) return null;
1288
+ let is_tracking = true;
1289
+ const uses = {
1290
+ dependencies: /* @__PURE__ */ new Set(),
1291
+ params: /* @__PURE__ */ new Set(),
1292
+ parent: false,
1293
+ route: false,
1294
+ url: false,
1295
+ search_params: /* @__PURE__ */ new Set()
1296
+ };
1297
+ const load = node.server.load;
1298
+ const slash = node.server.trailingSlash;
1299
+ if (!load) return {
1300
+ type: "data",
1301
+ data: null,
1302
+ uses,
1303
+ slash
1304
+ };
1305
+ const url = make_trackable(event.url, () => {
1306
+ if (is_tracking) uses.url = true;
1307
+ }, (param) => {
1308
+ if (is_tracking) uses.search_params.add(param);
1309
+ });
1310
+ if (state.prerendering) disable_search(url);
1311
+ return {
1312
+ type: "data",
1313
+ data: await record_span({
1314
+ name: "sveltekit.load",
1315
+ attributes: {
1316
+ "sveltekit.load.node_id": node.server_id || "unknown",
1317
+ "sveltekit.load.node_type": get_node_type(node.server_id),
1318
+ "http.route": event.route.id || "unknown"
1319
+ },
1320
+ fn: async (current) => {
1321
+ const traced_event = merge_tracing(event, current);
1322
+ return await with_request_store({
1323
+ event: traced_event,
1324
+ state: event_state
1325
+ }, () => load.call(null, {
1326
+ ...traced_event,
1327
+ fetch: (info, init) => {
1328
+ new URL(info instanceof Request ? info.url : info, event.url);
1329
+ return event.fetch(info, init);
1330
+ },
1331
+ /** @param {string[]} deps */
1332
+ depends: (...deps) => {
1333
+ for (const dep of deps) {
1334
+ const { href } = new URL(dep, event.url);
1335
+ uses.dependencies.add(href);
1336
+ }
1337
+ },
1338
+ params: new Proxy(event.params, { get: (target, key) => {
1339
+ if (is_tracking) uses.params.add(key);
1340
+ return target[key];
1341
+ } }),
1342
+ parent: async () => {
1343
+ if (is_tracking) uses.parent = true;
1344
+ return parent();
1345
+ },
1346
+ route: new Proxy(event.route, { get: (target, key) => {
1347
+ if (is_tracking) uses.route = true;
1348
+ return target[key];
1349
+ } }),
1350
+ url,
1351
+ untrack(fn) {
1352
+ is_tracking = false;
1353
+ try {
1354
+ return fn();
1355
+ } finally {
1356
+ is_tracking = true;
1357
+ }
1358
+ }
1359
+ }));
1360
+ }
1361
+ }) ?? null,
1362
+ uses,
1363
+ slash
1364
+ };
1365
+ }
1366
+ /**
1367
+ * Calls the user's `load` function.
1368
+ * @param {{
1369
+ * event: import('@sveltejs/kit').RequestEvent;
1370
+ * event_state: import('types').RequestState;
1371
+ * fetched: import('./types.js').Fetched[];
1372
+ * node: import('types').SSRNode | undefined;
1373
+ * parent: () => Promise<Record<string, any>>;
1374
+ * resolve_opts: import('types').RequiredResolveOptions;
1375
+ * server_data_promise: Promise<import('types').ServerDataNode | null>;
1376
+ * state: import('types').SSRState;
1377
+ * csr: boolean;
1378
+ * }} opts
1379
+ * @returns {Promise<Record<string, any | Promise<any>> | null>}
1380
+ */
1381
+ async function load_data({ event, event_state, fetched, node, parent, server_data_promise, state, resolve_opts, csr }) {
1382
+ const server_data_node = await server_data_promise;
1383
+ const load = node?.universal?.load;
1384
+ if (!load) return server_data_node?.data ?? null;
1385
+ return await record_span({
1386
+ name: "sveltekit.load",
1387
+ attributes: {
1388
+ "sveltekit.load.node_id": node.universal_id || "unknown",
1389
+ "sveltekit.load.node_type": get_node_type(node.universal_id),
1390
+ "http.route": event.route.id || "unknown"
1391
+ },
1392
+ fn: async (current) => {
1393
+ const traced_event = merge_tracing(event, current);
1394
+ return await with_request_store({
1395
+ event: traced_event,
1396
+ state: {
1397
+ ...event_state,
1398
+ is_in_universal_load: true
1399
+ }
1400
+ }, () => load.call(null, {
1401
+ url: event.url,
1402
+ params: event.params,
1403
+ data: server_data_node?.data ?? null,
1404
+ route: event.route,
1405
+ fetch: create_universal_fetch(event, state, fetched, csr, resolve_opts),
1406
+ setHeaders: event.setHeaders,
1407
+ depends: noop,
1408
+ parent,
1409
+ untrack: (fn) => fn(),
1410
+ tracing: traced_event.tracing
1411
+ }));
1412
+ }
1413
+ }) ?? null;
1414
+ }
1415
+ /**
1416
+ * @param {Pick<import('@sveltejs/kit').RequestEvent, 'fetch' | 'url' | 'request' | 'route'>} event
1417
+ * @param {import('types').SSRState} state
1418
+ * @param {import('./types.js').Fetched[]} fetched
1419
+ * @param {boolean} csr
1420
+ * @param {Pick<Required<import('@sveltejs/kit').ResolveOptions>, 'filterSerializedResponseHeaders'>} resolve_opts
1421
+ * @returns {typeof fetch}
1422
+ */
1423
+ function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
1424
+ /**
1425
+ * @param {URL | RequestInfo} input
1426
+ * @param {RequestInit} [init]
1427
+ */
1428
+ const universal_fetch = async (input, init) => {
1429
+ const cloned_body = input instanceof Request && input.body ? input.clone().body : null;
1430
+ const cloned_headers = input instanceof Request && [...input.headers].length ? new Headers(input.headers) : init?.headers;
1431
+ let response = await event.fetch(input, init);
1432
+ const url = new URL(input instanceof Request ? input.url : input, event.url);
1433
+ const same_origin = url.origin === event.url.origin;
1434
+ /** @type {import('types').PrerenderDependency} */
1435
+ let dependency;
1436
+ if (same_origin) {
1437
+ if (state.prerendering) {
1438
+ dependency = {
1439
+ response,
1440
+ body: null
1441
+ };
1442
+ state.prerendering.dependencies.set(url.pathname, dependency);
1443
+ }
1444
+ } else if (url.protocol === "https:" || url.protocol === "http:") if ((input instanceof Request ? input.mode : init?.mode ?? "cors") === "no-cors") response = new Response("", {
1445
+ status: response.status,
1446
+ statusText: response.statusText,
1447
+ headers: response.headers
1448
+ });
1449
+ else {
1450
+ const acao = response.headers.get("access-control-allow-origin");
1451
+ if (!acao || acao !== event.url.origin && acao !== "*") throw new Error(`CORS error: ${acao ? "Incorrect" : "No"} 'Access-Control-Allow-Origin' header is present on the requested resource`);
1452
+ }
1453
+ /** @type {ReadableStream<Uint8Array>} */
1454
+ let teed_body;
1455
+ const proxy = new Proxy(response, { get(response, key, receiver) {
1456
+ /**
1457
+ * @param {string | undefined} body
1458
+ * @param {boolean} is_b64
1459
+ */
1460
+ async function push_fetched(body, is_b64) {
1461
+ const status_number = Number(response.status);
1462
+ if (isNaN(status_number)) throw new Error(`response.status is not a number. value: "${response.status}" type: ${typeof response.status}`);
1463
+ fetched.push({
1464
+ url: same_origin ? url.href.slice(event.url.origin.length) : url.href,
1465
+ method: event.request.method,
1466
+ request_body: input instanceof Request && cloned_body ? await stream_to_string(cloned_body) : init?.body,
1467
+ request_headers: cloned_headers,
1468
+ response_body: body,
1469
+ response,
1470
+ is_b64
1471
+ });
1472
+ }
1473
+ if (key === "body") {
1474
+ if (response.body === null) return null;
1475
+ if (teed_body) return teed_body;
1476
+ const [a, b] = response.body.tee();
1477
+ (async () => {
1478
+ let result = new Uint8Array();
1479
+ for await (const chunk of a) {
1480
+ const combined = new Uint8Array(result.length + chunk.length);
1481
+ combined.set(result, 0);
1482
+ combined.set(chunk, result.length);
1483
+ result = combined;
1484
+ }
1485
+ if (dependency) dependency.body = new Uint8Array(result);
1486
+ push_fetched(base64_encode(result), true);
1487
+ })();
1488
+ return teed_body = b;
1489
+ }
1490
+ if (key === "arrayBuffer") return async () => {
1491
+ const buffer = await response.arrayBuffer();
1492
+ const bytes = new Uint8Array(buffer);
1493
+ if (dependency) dependency.body = bytes;
1494
+ if (buffer instanceof ArrayBuffer) await push_fetched(base64_encode(bytes), true);
1495
+ return buffer;
1496
+ };
1497
+ async function text() {
1498
+ const body = await response.text();
1499
+ if (body === "" && NULL_BODY_STATUS.includes(response.status)) {
1500
+ await push_fetched(void 0, false);
1501
+ return;
1502
+ }
1503
+ if (!body || typeof body === "string") await push_fetched(body, false);
1504
+ if (dependency) dependency.body = body;
1505
+ return body;
1506
+ }
1507
+ if (key === "text") return text;
1508
+ if (key === "json") return async () => {
1509
+ const body = await text();
1510
+ return body ? JSON.parse(body) : void 0;
1511
+ };
1512
+ const value = Reflect.get(response, key, response);
1513
+ if (value instanceof Function) return Object.defineProperties(
1514
+ /**
1515
+ * @this {any}
1516
+ */
1517
+ function() {
1518
+ return Reflect.apply(value, this === receiver ? response : this, arguments);
1519
+ },
1520
+ {
1521
+ name: { value: value.name },
1522
+ length: { value: value.length }
1523
+ }
1524
+ );
1525
+ return value;
1526
+ } });
1527
+ if (csr) {
1528
+ const get = response.headers.get;
1529
+ response.headers.get = (key) => {
1530
+ const lower = key.toLowerCase();
1531
+ const value = get.call(response.headers, lower);
1532
+ if (value && !lower.startsWith("x-sveltekit-")) {
1533
+ if (!resolve_opts.filterSerializedResponseHeaders(lower, value)) throw new Error(`Failed to get response header "${lower}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://svelte.dev/docs/kit/hooks#Server-hooks-handle (at ${event.route.id})`);
1534
+ }
1535
+ return value;
1536
+ };
1537
+ }
1538
+ return proxy;
1539
+ };
1540
+ return (input, init) => {
1541
+ const response = universal_fetch(input, init);
1542
+ response.catch(noop);
1543
+ return response;
1544
+ };
1545
+ }
1546
+ /**
1547
+ * @param {ReadableStream<Uint8Array>} stream
1548
+ */
1549
+ async function stream_to_string(stream) {
1550
+ let result = "";
1551
+ const reader = stream.getReader();
1552
+ const decoder = new TextDecoder();
1553
+ while (true) {
1554
+ const { done, value } = await reader.read();
1555
+ if (done) {
1556
+ result += decoder.decode();
1557
+ break;
1558
+ }
1559
+ result += decoder.decode(value, { stream: true });
1560
+ }
1561
+ return result;
1562
+ }
1563
+ //#endregion
1564
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/serialize_data.js
1565
+ /**
1566
+ * Inside a script element, only `<\/script` and `<!--` hold special meaning to the HTML parser.
1567
+ *
1568
+ * The first closes the script element, so everything after is treated as raw HTML.
1569
+ * The second disables further parsing until `-->`, so the script element might be unexpectedly
1570
+ * kept open up until an unrelated HTML comment in the page.
1571
+ *
1572
+ * U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are escaped for the sake of pre-2018
1573
+ * browsers.
1574
+ *
1575
+ * @see tests for unsafe parsing examples.
1576
+ * @see https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
1577
+ * @see https://html.spec.whatwg.org/multipage/syntax.html#cdata-rcdata-restrictions
1578
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-state
1579
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-double-escaped-state
1580
+ * @see https://github.com/tc39/proposal-json-superset
1581
+ * @type {Record<string, string>}
1582
+ */
1583
+ var replacements = {
1584
+ "<": "\\u003C",
1585
+ "\u2028": "\\u2028",
1586
+ "\u2029": "\\u2029"
1587
+ };
1588
+ var pattern = new RegExp(`[${Object.keys(replacements).join("")}]`, "g");
1589
+ /**
1590
+ * Generates a raw HTML string containing a safe script element carrying data and associated attributes.
1591
+ *
1592
+ * It escapes all the special characters needed to guarantee the element is unbroken, but care must
1593
+ * be taken to ensure it is inserted in the document at an acceptable position for a script element,
1594
+ * and that the resulting string isn't further modified.
1595
+ *
1596
+ * @param {import('./types.js').Fetched} fetched
1597
+ * @param {(name: string, value: string) => boolean} filter
1598
+ * @param {boolean} [prerendering]
1599
+ * @returns {string} The raw HTML of a script element carrying the JSON payload.
1600
+ * @example const html = serialize_data('/data.json', null, { foo: 'bar' });
1601
+ */
1602
+ function serialize_data(fetched, filter, prerendering = false) {
1603
+ /** @type {Record<string, string>} */
1604
+ const headers = {};
1605
+ let cache_control = null;
1606
+ let age = null;
1607
+ let varyAny = false;
1608
+ for (const [key, value] of fetched.response.headers) {
1609
+ if (filter(key, value)) headers[key] = value;
1610
+ if (key === "cache-control") cache_control = value;
1611
+ else if (key === "age") age = value;
1612
+ else if (key === "vary" && value.trim() === "*") varyAny = true;
1613
+ }
1614
+ const payload = {
1615
+ status: fetched.response.status,
1616
+ statusText: fetched.response.statusText,
1617
+ headers,
1618
+ body: fetched.response_body
1619
+ };
1620
+ const safe_payload = JSON.stringify(payload).replace(pattern, (match) => replacements[match]);
1621
+ const attrs = [
1622
+ "type=\"application/json\"",
1623
+ "data-sveltekit-fetched",
1624
+ `data-url="${escape_html(fetched.url, true)}"`
1625
+ ];
1626
+ if (fetched.is_b64) attrs.push("data-b64");
1627
+ if (fetched.request_headers || fetched.request_body) {
1628
+ /** @type {import('types').StrictBody[]} */
1629
+ const values = [];
1630
+ if (fetched.request_headers) values.push([...new Headers(fetched.request_headers)].join(","));
1631
+ if (fetched.request_body) values.push(fetched.request_body);
1632
+ attrs.push(`data-hash="${hash(...values)}"`);
1633
+ }
1634
+ if (!prerendering && fetched.method === "GET" && cache_control && !varyAny) {
1635
+ const match = /s-maxage=(\d+)/g.exec(cache_control) ?? /max-age=(\d+)/g.exec(cache_control);
1636
+ if (match) {
1637
+ const ttl = +match[1] - +(age ?? "0");
1638
+ attrs.push(`data-ttl="${ttl}"`);
1639
+ }
1640
+ }
1641
+ return `<script ${attrs.join(" ")}>${safe_payload}<\/script>`;
1642
+ }
1643
+ //#endregion
1644
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/crypto.js
1645
+ /**
1646
+ * SHA-256 hashing function adapted from https://bitwiseshiftleft.github.io/sjcl
1647
+ * modified and redistributed under BSD license
1648
+ * @param {string} data
1649
+ */
1650
+ function sha256(data) {
1651
+ if (!key[0]) precompute();
1652
+ const out = init.slice(0);
1653
+ const array = encode(data);
1654
+ for (let i = 0; i < array.length; i += 16) {
1655
+ const w = array.subarray(i, i + 16);
1656
+ let tmp;
1657
+ let a;
1658
+ let b;
1659
+ let out0 = out[0];
1660
+ let out1 = out[1];
1661
+ let out2 = out[2];
1662
+ let out3 = out[3];
1663
+ let out4 = out[4];
1664
+ let out5 = out[5];
1665
+ let out6 = out[6];
1666
+ let out7 = out[7];
1667
+ for (let i = 0; i < 64; i++) {
1668
+ if (i < 16) tmp = w[i];
1669
+ else {
1670
+ a = w[i + 1 & 15];
1671
+ b = w[i + 14 & 15];
1672
+ tmp = w[i & 15] = (a >>> 7 ^ a >>> 18 ^ a >>> 3 ^ a << 25 ^ a << 14) + (b >>> 17 ^ b >>> 19 ^ b >>> 10 ^ b << 15 ^ b << 13) + w[i & 15] + w[i + 9 & 15] | 0;
1673
+ }
1674
+ tmp = tmp + out7 + (out4 >>> 6 ^ out4 >>> 11 ^ out4 >>> 25 ^ out4 << 26 ^ out4 << 21 ^ out4 << 7) + (out6 ^ out4 & (out5 ^ out6)) + key[i];
1675
+ out7 = out6;
1676
+ out6 = out5;
1677
+ out5 = out4;
1678
+ out4 = out3 + tmp | 0;
1679
+ out3 = out2;
1680
+ out2 = out1;
1681
+ out1 = out0;
1682
+ out0 = tmp + (out1 & out2 ^ out3 & (out1 ^ out2)) + (out1 >>> 2 ^ out1 >>> 13 ^ out1 >>> 22 ^ out1 << 30 ^ out1 << 19 ^ out1 << 10) | 0;
1683
+ }
1684
+ out[0] = out[0] + out0 | 0;
1685
+ out[1] = out[1] + out1 | 0;
1686
+ out[2] = out[2] + out2 | 0;
1687
+ out[3] = out[3] + out3 | 0;
1688
+ out[4] = out[4] + out4 | 0;
1689
+ out[5] = out[5] + out5 | 0;
1690
+ out[6] = out[6] + out6 | 0;
1691
+ out[7] = out[7] + out7 | 0;
1692
+ }
1693
+ const bytes = new Uint8Array(out.buffer);
1694
+ reverse_endianness(bytes);
1695
+ return btoa(String.fromCharCode(...bytes));
1696
+ }
1697
+ /** The SHA-256 initialization vector */
1698
+ var init = new Uint32Array(8);
1699
+ /** The SHA-256 hash key */
1700
+ var key = new Uint32Array(64);
1701
+ /** Function to precompute init and key. */
1702
+ function precompute() {
1703
+ /** @param {number} x */
1704
+ function frac(x) {
1705
+ return (x - Math.floor(x)) * 4294967296;
1706
+ }
1707
+ let prime = 2;
1708
+ for (let i = 0; i < 64; prime++) {
1709
+ let is_prime = true;
1710
+ for (let factor = 2; factor * factor <= prime; factor++) if (prime % factor === 0) {
1711
+ is_prime = false;
1712
+ break;
1713
+ }
1714
+ if (is_prime) {
1715
+ if (i < 8) init[i] = frac(prime ** (1 / 2));
1716
+ key[i] = frac(prime ** (1 / 3));
1717
+ i++;
1718
+ }
1719
+ }
1720
+ }
1721
+ /** @param {Uint8Array} bytes */
1722
+ function reverse_endianness(bytes) {
1723
+ for (let i = 0; i < bytes.length; i += 4) {
1724
+ const a = bytes[i + 0];
1725
+ const b = bytes[i + 1];
1726
+ const c = bytes[i + 2];
1727
+ const d = bytes[i + 3];
1728
+ bytes[i + 0] = d;
1729
+ bytes[i + 1] = c;
1730
+ bytes[i + 2] = b;
1731
+ bytes[i + 3] = a;
1732
+ }
1733
+ }
1734
+ /** @param {string} str */
1735
+ function encode(str) {
1736
+ const encoded = text_encoder.encode(str);
1737
+ const length = encoded.length * 8;
1738
+ const size = 512 * Math.ceil((length + 65) / 512);
1739
+ const bytes = new Uint8Array(size / 8);
1740
+ bytes.set(encoded);
1741
+ bytes[encoded.length] = 128;
1742
+ reverse_endianness(bytes);
1743
+ const words = new Uint32Array(bytes.buffer);
1744
+ words[words.length - 2] = Math.floor(length / 4294967296);
1745
+ words[words.length - 1] = length;
1746
+ return words;
1747
+ }
1748
+ //#endregion
1749
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/csp.js
1750
+ var array = new Uint8Array(16);
1751
+ function generate_nonce() {
1752
+ crypto.getRandomValues(array);
1753
+ return btoa(String.fromCharCode(...array));
1754
+ }
1755
+ var quoted = new Set([
1756
+ "self",
1757
+ "unsafe-eval",
1758
+ "unsafe-hashes",
1759
+ "unsafe-inline",
1760
+ "none",
1761
+ "strict-dynamic",
1762
+ "report-sample",
1763
+ "wasm-unsafe-eval",
1764
+ "script"
1765
+ ]);
1766
+ var crypto_pattern = /^(nonce|sha\d\d\d)-/;
1767
+ var BaseProvider = class {
1768
+ /** @type {boolean} */
1769
+ #use_hashes;
1770
+ /** @type {boolean} */
1771
+ #script_needs_csp;
1772
+ /** @type {boolean} */
1773
+ #script_src_needs_csp;
1774
+ /** @type {boolean} */
1775
+ #script_src_elem_needs_csp;
1776
+ /** @type {boolean} */
1777
+ #style_needs_csp;
1778
+ /** @type {boolean} */
1779
+ #style_src_needs_csp;
1780
+ /** @type {boolean} */
1781
+ #style_src_attr_needs_csp;
1782
+ /** @type {boolean} */
1783
+ #style_src_elem_needs_csp;
1784
+ /** @type {import('types').CspDirectives} */
1785
+ #directives;
1786
+ /** @type {Set<import('types').Csp.Source>} */
1787
+ #script_src;
1788
+ /** @type {Set<import('types').Csp.Source>} */
1789
+ #script_src_elem;
1790
+ /** @type {Set<import('types').Csp.Source>} */
1791
+ #style_src;
1792
+ /** @type {Set<import('types').Csp.Source>} */
1793
+ #style_src_attr;
1794
+ /** @type {Set<import('types').Csp.Source>} */
1795
+ #style_src_elem;
1796
+ /** @type {boolean} */
1797
+ script_needs_nonce;
1798
+ /** @type {boolean} */
1799
+ style_needs_nonce;
1800
+ /** @type {boolean} */
1801
+ script_needs_hash;
1802
+ /** @type {string} */
1803
+ #nonce;
1804
+ /**
1805
+ * @param {boolean} use_hashes
1806
+ * @param {import('types').CspDirectives} directives
1807
+ * @param {string} nonce
1808
+ */
1809
+ constructor(use_hashes, directives, nonce) {
1810
+ this.#use_hashes = use_hashes;
1811
+ this.#directives = directives;
1812
+ const d = this.#directives;
1813
+ this.#script_src = /* @__PURE__ */ new Set();
1814
+ this.#script_src_elem = /* @__PURE__ */ new Set();
1815
+ this.#style_src = /* @__PURE__ */ new Set();
1816
+ this.#style_src_attr = /* @__PURE__ */ new Set();
1817
+ this.#style_src_elem = /* @__PURE__ */ new Set();
1818
+ const effective_script_src = d["script-src"] || d["default-src"];
1819
+ const script_src_elem = d["script-src-elem"];
1820
+ const effective_style_src = d["style-src"] || d["default-src"];
1821
+ const style_src_attr = d["style-src-attr"];
1822
+ const style_src_elem = d["style-src-elem"];
1823
+ /** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
1824
+ const style_needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
1825
+ /** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
1826
+ const script_needs_csp = (directive) => !!directive && (!directive.some((value) => value === "unsafe-inline") || directive.some((value) => value === "strict-dynamic"));
1827
+ this.#script_src_needs_csp = script_needs_csp(effective_script_src);
1828
+ this.#script_src_elem_needs_csp = script_needs_csp(script_src_elem);
1829
+ this.#style_src_needs_csp = style_needs_csp(effective_style_src);
1830
+ this.#style_src_attr_needs_csp = style_needs_csp(style_src_attr);
1831
+ this.#style_src_elem_needs_csp = style_needs_csp(style_src_elem);
1832
+ this.#script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
1833
+ this.#style_needs_csp = this.#style_src_needs_csp || this.#style_src_attr_needs_csp || this.#style_src_elem_needs_csp;
1834
+ this.script_needs_nonce = this.#script_needs_csp && !this.#use_hashes;
1835
+ this.style_needs_nonce = this.#style_needs_csp && !this.#use_hashes;
1836
+ this.script_needs_hash = this.#script_needs_csp && this.#use_hashes;
1837
+ this.#nonce = nonce;
1838
+ }
1839
+ /** @param {string} content */
1840
+ add_script(content) {
1841
+ if (!this.#script_needs_csp) return;
1842
+ /** @type {`nonce-${string}` | `sha256-${string}`} */
1843
+ const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
1844
+ if (this.#script_src_needs_csp) this.#script_src.add(source);
1845
+ if (this.#script_src_elem_needs_csp) this.#script_src_elem.add(source);
1846
+ }
1847
+ /** @param {`sha256-${string}`[]} hashes */
1848
+ add_script_hashes(hashes) {
1849
+ for (const hash of hashes) {
1850
+ if (this.#script_src_needs_csp) this.#script_src.add(hash);
1851
+ if (this.#script_src_elem_needs_csp) this.#script_src_elem.add(hash);
1852
+ }
1853
+ }
1854
+ /** @param {string} content */
1855
+ add_style(content) {
1856
+ if (!this.#style_needs_csp) return;
1857
+ /** @type {`nonce-${string}` | `sha256-${string}`} */
1858
+ const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
1859
+ if (this.#style_src_needs_csp) this.#style_src.add(source);
1860
+ if (this.#style_src_attr_needs_csp) this.#style_src_attr.add(source);
1861
+ if (this.#style_src_elem_needs_csp) {
1862
+ const sha256_empty_comment_hash = "sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=";
1863
+ const d = this.#directives;
1864
+ if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.has(sha256_empty_comment_hash)) this.#style_src_elem.add(sha256_empty_comment_hash);
1865
+ if (source !== sha256_empty_comment_hash) this.#style_src_elem.add(source);
1866
+ }
1867
+ }
1868
+ /**
1869
+ * @param {boolean} [is_meta]
1870
+ */
1871
+ get_header(is_meta = false) {
1872
+ const header = [];
1873
+ const directives = { ...this.#directives };
1874
+ if (this.#style_src.size > 0) directives["style-src"] = [...directives["style-src"] || directives["default-src"] || [], ...this.#style_src];
1875
+ if (this.#style_src_attr.size > 0) directives["style-src-attr"] = [...directives["style-src-attr"] || [], ...this.#style_src_attr];
1876
+ if (this.#style_src_elem.size > 0) directives["style-src-elem"] = [...directives["style-src-elem"] || [], ...this.#style_src_elem];
1877
+ if (this.#script_src.size > 0) directives["script-src"] = [...directives["script-src"] || directives["default-src"] || [], ...this.#script_src];
1878
+ if (this.#script_src_elem.size > 0) directives["script-src-elem"] = [...directives["script-src-elem"] || [], ...this.#script_src_elem];
1879
+ for (const key in directives) {
1880
+ if (is_meta && (key === "frame-ancestors" || key === "report-uri" || key === "sandbox")) continue;
1881
+ const value = directives[key];
1882
+ if (!value) continue;
1883
+ const directive = [key];
1884
+ if (Array.isArray(value)) value.forEach((value) => {
1885
+ if (quoted.has(value) || crypto_pattern.test(value)) directive.push(`'${value}'`);
1886
+ else directive.push(value);
1887
+ });
1888
+ header.push(directive.join(" "));
1889
+ }
1890
+ return header.join("; ");
1891
+ }
1892
+ };
1893
+ var CspProvider = class extends BaseProvider {
1894
+ get_meta() {
1895
+ const content = this.get_header(true);
1896
+ if (!content) return;
1897
+ return `<meta http-equiv="content-security-policy" content="${escape_html(content, true)}">`;
1898
+ }
1899
+ };
1900
+ var CspReportOnlyProvider = class extends BaseProvider {
1901
+ /**
1902
+ * @param {boolean} use_hashes
1903
+ * @param {import('types').CspDirectives} directives
1904
+ * @param {string} nonce
1905
+ */
1906
+ constructor(use_hashes, directives, nonce) {
1907
+ super(use_hashes, directives, nonce);
1908
+ if (Object.values(directives).filter((v) => !!v).length > 0) {
1909
+ const has_report_to = directives["report-to"]?.length ?? false;
1910
+ const has_report_uri = directives["report-uri"]?.length ?? false;
1911
+ if (!has_report_to && !has_report_uri) throw Error("`content-security-policy-report-only` must be specified with either the `report-to` or `report-uri` directives, or both");
1912
+ }
1913
+ }
1914
+ };
1915
+ var Csp = class {
1916
+ /** @readonly */
1917
+ nonce = generate_nonce();
1918
+ /** @type {CspProvider} */
1919
+ csp_provider;
1920
+ /** @type {CspReportOnlyProvider} */
1921
+ report_only_provider;
1922
+ /**
1923
+ * @param {import('./types.js').CspConfig} config
1924
+ * @param {import('./types.js').CspOpts} opts
1925
+ */
1926
+ constructor({ mode, directives, reportOnly }, { prerender }) {
1927
+ const use_hashes = mode === "hash" || mode === "auto" && prerender;
1928
+ this.csp_provider = new CspProvider(use_hashes, directives, this.nonce);
1929
+ this.report_only_provider = new CspReportOnlyProvider(use_hashes, reportOnly, this.nonce);
1930
+ }
1931
+ get script_needs_hash() {
1932
+ return this.csp_provider.script_needs_hash || this.report_only_provider.script_needs_hash;
1933
+ }
1934
+ get script_needs_nonce() {
1935
+ return this.csp_provider.script_needs_nonce || this.report_only_provider.script_needs_nonce;
1936
+ }
1937
+ get style_needs_nonce() {
1938
+ return this.csp_provider.style_needs_nonce || this.report_only_provider.style_needs_nonce;
1939
+ }
1940
+ /** @param {string} content */
1941
+ add_script(content) {
1942
+ this.csp_provider.add_script(content);
1943
+ this.report_only_provider.add_script(content);
1944
+ }
1945
+ /** @param {`sha256-${string}`[]} hashes */
1946
+ add_script_hashes(hashes) {
1947
+ this.csp_provider.add_script_hashes(hashes);
1948
+ this.report_only_provider.add_script_hashes(hashes);
1949
+ }
1950
+ /** @param {string} content */
1951
+ add_style(content) {
1952
+ this.csp_provider.add_style(content);
1953
+ this.report_only_provider.add_style(content);
1954
+ }
1955
+ };
1956
+ //#endregion
1957
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/server_routing.js
1958
+ /**
1959
+ * @param {import('types').SSRClientRoute} route
1960
+ * @param {URL} url
1961
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
1962
+ * @returns {string}
1963
+ */
1964
+ function generate_route_object(route, url, manifest) {
1965
+ const { errors, layouts, leaf } = route;
1966
+ const nodes = [
1967
+ ...errors,
1968
+ ...layouts.map((l) => l?.[1]),
1969
+ leaf[1]
1970
+ ].filter((n) => typeof n === "number").map((n) => `'${n}': () => ${create_client_import(manifest._.client.nodes?.[n], url)}`).join(",\n ");
1971
+ /** @type {import('types').CSRRouteServer} */
1972
+ return [
1973
+ `{\n\tid: ${s(route.id)}`,
1974
+ `errors: ${s(route.errors)}`,
1975
+ `layouts: ${s(route.layouts)}`,
1976
+ `leaf: ${s(route.leaf)}`,
1977
+ `nodes: {\n\t\t${nodes}\n\t}\n}`
1978
+ ].join(",\n ");
1979
+ }
1980
+ /**
1981
+ * @param {string | undefined} import_path
1982
+ * @param {URL} url
1983
+ */
1984
+ function create_client_import(import_path, url) {
1985
+ if (!import_path) return "Promise.resolve({})";
1986
+ if (import_path[0] === "/") return `import('${import_path}')`;
1987
+ if (assets !== "") return `import('${assets}/${import_path}')`;
1988
+ let path = get_relative_path(url.pathname, `${base}/${import_path}`);
1989
+ if (path[0] !== ".") path = `./${path}`;
1990
+ return `import('${path}')`;
1991
+ }
1992
+ /**
1993
+ * @param {string} resolved_path
1994
+ * @param {URL} url
1995
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
1996
+ * @returns {Promise<Response>}
1997
+ */
1998
+ async function resolve_route(resolved_path, url, manifest) {
1999
+ if (!manifest._.client.routes) return text("Server-side route resolution disabled", { status: 400 });
2000
+ const matchers = await manifest._.matchers();
2001
+ const result = find_route(resolved_path, manifest._.client.routes, matchers);
2002
+ return create_server_routing_response(result?.route ?? null, result?.params ?? {}, url, manifest).response;
2003
+ }
2004
+ /**
2005
+ * @param {import('types').SSRClientRoute | null} route
2006
+ * @param {Partial<Record<string, string>>} params
2007
+ * @param {URL} url
2008
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
2009
+ * @returns {{response: Response, body: string}}
2010
+ */
2011
+ function create_server_routing_response(route, params, url, manifest) {
2012
+ const headers = new Headers({ "content-type": "application/javascript; charset=utf-8" });
2013
+ if (route) {
2014
+ const csr_route = generate_route_object(route, url, manifest);
2015
+ const body = `${create_css_import(route, url, manifest)}\nexport const route = ${csr_route}; export const params = ${JSON.stringify(params)};`;
2016
+ return {
2017
+ response: text(body, { headers }),
2018
+ body
2019
+ };
2020
+ } else return {
2021
+ response: text("", { headers }),
2022
+ body: ""
2023
+ };
2024
+ }
2025
+ /**
2026
+ * This function generates the client-side import for the CSS files that are
2027
+ * associated with the current route. Vite takes care of that when using
2028
+ * client-side route resolution, but for server-side resolution it does
2029
+ * not know about the CSS files automatically.
2030
+ *
2031
+ * @param {import('types').SSRClientRoute} route
2032
+ * @param {URL} url
2033
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
2034
+ * @returns {string}
2035
+ */
2036
+ function create_css_import(route, url, manifest) {
2037
+ const { errors, layouts, leaf } = route;
2038
+ let css = "";
2039
+ for (const node of [
2040
+ ...errors,
2041
+ ...layouts.map((l) => l?.[1]),
2042
+ leaf[1]
2043
+ ]) {
2044
+ if (typeof node !== "number") continue;
2045
+ const node_css = manifest._.client.css?.[node];
2046
+ for (const css_path of node_css ?? []) css += `'${assets || base}/${css_path}',`;
2047
+ }
2048
+ if (!css) return "";
2049
+ return `${create_client_import(manifest._.client.start, url)}.then(x => x.load_css([${css}]));`;
2050
+ }
2051
+ //#endregion
2052
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/render.js
2053
+ var updated = {
2054
+ ...readable(false),
2055
+ check: () => false
2056
+ };
2057
+ /**
2058
+ * Creates the HTML response.
2059
+ * @param {{
2060
+ * branch: Array<import('./types.js').Loaded>;
2061
+ * fetched: Array<import('./types.js').Fetched>;
2062
+ * options: import('types').SSROptions;
2063
+ * manifest: import('@sveltejs/kit').SSRManifest;
2064
+ * state: import('types').SSRState;
2065
+ * page_config: { ssr: boolean; csr: boolean };
2066
+ * status: number;
2067
+ * error: App.Error | null;
2068
+ * event: import('@sveltejs/kit').RequestEvent;
2069
+ * event_state: import('types').RequestState;
2070
+ * resolve_opts: import('types').RequiredResolveOptions;
2071
+ * action_result?: import('@sveltejs/kit').ActionResult;
2072
+ * data_serializer: import('./types.js').ServerDataSerializer;
2073
+ * error_components?: Array<import('types').SSRComponent | undefined>
2074
+ * }} opts
2075
+ */
2076
+ async function render_response({ branch, fetched, options, manifest, state, page_config, status, error = null, event, event_state, resolve_opts, action_result, data_serializer, error_components }) {
2077
+ if (state.prerendering) {
2078
+ if (options.csp.mode === "nonce") throw new Error("Cannot use prerendering if config.kit.csp.mode === \"nonce\"");
2079
+ if (options.app_template_contains_nonce) throw new Error("Cannot use prerendering if page template contains %sveltekit.nonce%");
2080
+ }
2081
+ const { client } = manifest._;
2082
+ const modulepreloads = new Set(client.imports);
2083
+ const stylesheets = new Set(client.stylesheets);
2084
+ const fonts = new Set(client.fonts);
2085
+ /**
2086
+ * The value of the Link header that is added to the response when not prerendering
2087
+ * @type {Set<string>}
2088
+ */
2089
+ const link_headers = /* @__PURE__ */ new Set();
2090
+ /** @type {Map<string, string>} */
2091
+ const inline_styles = /* @__PURE__ */ new Map();
2092
+ /** @type {ReturnType<typeof options.root.render>} */
2093
+ let rendered;
2094
+ const form_value = action_result?.type === "success" || action_result?.type === "failure" ? action_result.data ?? null : null;
2095
+ /** @type {string} */
2096
+ let base$1 = base;
2097
+ /** @type {string} */
2098
+ let assets$1 = assets;
2099
+ /**
2100
+ * An expression that will evaluate in the client to determine the resolved base path.
2101
+ * We use a relative path when possible to support IPFS, the internet archive, etc.
2102
+ */
2103
+ let base_expression = s(base);
2104
+ const csp = new Csp(options.csp, { prerender: !!state.prerendering });
2105
+ if (!state.prerendering?.fallback) {
2106
+ base$1 = event.url.pathname.slice(base.length).split("/").slice(2).map(() => "..").join("/") || ".";
2107
+ base_expression = `new URL(${s(base$1)}, location).pathname.slice(0, -1)`;
2108
+ if (!assets || assets[0] === "/" && assets !== "/_svelte_kit_assets") assets$1 = base$1;
2109
+ } else if (options.hash_routing) base_expression = "new URL('.', location).pathname.slice(0, -1)";
2110
+ if (page_config.ssr) {
2111
+ /** @type {Record<string, any>} */
2112
+ const props = {
2113
+ stores: {
2114
+ page: writable(null),
2115
+ navigating: writable(null),
2116
+ updated
2117
+ },
2118
+ constructors: await Promise.all(branch.map(({ node }) => {
2119
+ if (!node.component) throw new Error(`Missing +page.svelte component for route ${event.route.id}`);
2120
+ return node.component();
2121
+ })),
2122
+ form: form_value
2123
+ };
2124
+ if (error_components) {
2125
+ if (error) props.error = error;
2126
+ props.errors = error_components;
2127
+ }
2128
+ let data = {};
2129
+ for (let i = 0; i < branch.length; i += 1) {
2130
+ data = {
2131
+ ...data,
2132
+ ...branch[i].data
2133
+ };
2134
+ props[`data_${i}`] = data;
2135
+ }
2136
+ props.page = {
2137
+ error,
2138
+ params: event.params,
2139
+ route: event.route,
2140
+ status,
2141
+ url: event.url,
2142
+ data,
2143
+ form: form_value,
2144
+ state: {}
2145
+ };
2146
+ const render_opts = {
2147
+ context: new Map([["__request__", { page: props.page }]]),
2148
+ csp: csp.script_needs_nonce ? { nonce: csp.nonce } : { hash: csp.script_needs_hash },
2149
+ transformError: error_components ? async (e) => {
2150
+ if (isRedirect(e)) throw e;
2151
+ const transformed = await handle_error_and_jsonify(event, event_state, options, e);
2152
+ props.page.error = props.error = error = transformed;
2153
+ props.page.status = status = get_status(e);
2154
+ return transformed;
2155
+ } : void 0
2156
+ };
2157
+ try {
2158
+ rendered = await with_request_store({
2159
+ event,
2160
+ state: {
2161
+ ...event_state,
2162
+ is_in_render: true
2163
+ }
2164
+ }, async () => {
2165
+ override({
2166
+ base: base$1,
2167
+ assets: assets$1
2168
+ });
2169
+ const maybe_promise = options.root.render(props, render_opts);
2170
+ const rendered = options.async && "then" in maybe_promise ? maybe_promise.then((r) => r) : maybe_promise;
2171
+ if (options.async) reset();
2172
+ const { head, html, css, hashes } = options.async ? await rendered : rendered;
2173
+ if (hashes) csp.add_script_hashes(hashes.script);
2174
+ return {
2175
+ head,
2176
+ html,
2177
+ css,
2178
+ hashes
2179
+ };
2180
+ });
2181
+ } finally {
2182
+ reset();
2183
+ }
2184
+ } else rendered = {
2185
+ head: "",
2186
+ html: "",
2187
+ css: {
2188
+ code: "",
2189
+ map: null
2190
+ },
2191
+ hashes: { script: [] }
2192
+ };
2193
+ for (const { node } of branch) {
2194
+ for (const url of node.imports) modulepreloads.add(url);
2195
+ for (const url of node.stylesheets) stylesheets.add(url);
2196
+ for (const url of node.fonts) fonts.add(url);
2197
+ if (node.inline_styles && !client.inline) Object.entries(await node.inline_styles()).forEach(([filename, css]) => {
2198
+ if (typeof css === "string") {
2199
+ inline_styles.set(filename, css);
2200
+ return;
2201
+ }
2202
+ inline_styles.set(filename, css(`${assets$1}/${app_dir}/immutable/assets`, assets$1));
2203
+ });
2204
+ }
2205
+ const head = new Head(rendered.head, !!state.prerendering);
2206
+ let body = rendered.html;
2207
+ /** @param {string} path */
2208
+ const prefixed = (path) => {
2209
+ if (path.startsWith("/")) return base + path;
2210
+ return `${assets$1}/${path}`;
2211
+ };
2212
+ const style = client.inline ? client.inline?.style : Array.from(inline_styles.values()).join("\n");
2213
+ if (style) {
2214
+ const attributes = [];
2215
+ if (csp.style_needs_nonce) attributes.push(`nonce="${csp.nonce}"`);
2216
+ csp.add_style(style);
2217
+ head.add_style(style, attributes);
2218
+ }
2219
+ for (const dep of stylesheets) {
2220
+ const path = prefixed(dep);
2221
+ const attributes = ["rel=\"stylesheet\""];
2222
+ if (inline_styles.has(dep)) attributes.push("disabled", "media=\"(max-width: 0)\"");
2223
+ else if (resolve_opts.preload({
2224
+ type: "css",
2225
+ path
2226
+ })) link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="style"; nopush`);
2227
+ head.add_stylesheet(path, attributes);
2228
+ }
2229
+ for (const dep of fonts) {
2230
+ const path = prefixed(dep);
2231
+ if (resolve_opts.preload({
2232
+ type: "font",
2233
+ path
2234
+ })) {
2235
+ const ext = dep.slice(dep.lastIndexOf(".") + 1);
2236
+ head.add_link_tag(path, [
2237
+ "rel=\"preload\"",
2238
+ "as=\"font\"",
2239
+ `type="font/${ext}"`,
2240
+ "crossorigin"
2241
+ ]);
2242
+ link_headers.add(`<${encodeURI(path)}>; rel="preload"; as="font"; type="font/${ext}"; crossorigin; nopush`);
2243
+ }
2244
+ }
2245
+ const global = get_global_name(options);
2246
+ const { data, chunks } = data_serializer.get_data(csp);
2247
+ if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!state.prerendering)).join("\n ")}`;
2248
+ if (page_config.csr) {
2249
+ const route = manifest._.client.routes?.find((r) => r.id === event.route.id) ?? null;
2250
+ if (client.uses_env_dynamic_public && state.prerendering) modulepreloads.add(`${app_dir}/env.js`);
2251
+ if (!client.inline) {
2252
+ const included_modulepreloads = Array.from(modulepreloads, (dep) => prefixed(dep)).filter((path) => resolve_opts.preload({
2253
+ type: "js",
2254
+ path
2255
+ }));
2256
+ for (const path of included_modulepreloads) {
2257
+ link_headers.add(`<${encodeURI(path)}>; rel="modulepreload"; nopush`);
2258
+ if (options.preload_strategy !== "modulepreload") head.add_script_preload(path);
2259
+ else head.add_link_tag(path, ["rel=\"modulepreload\""]);
2260
+ }
2261
+ }
2262
+ if (manifest._.client.routes && state.prerendering && !state.prerendering.fallback) {
2263
+ const pathname = add_resolution_suffix(event.url.pathname);
2264
+ state.prerendering.dependencies.set(pathname, create_server_routing_response(route, event.params, new URL(pathname, event.url), manifest));
2265
+ }
2266
+ const blocks = [];
2267
+ const load_env_eagerly = client.uses_env_dynamic_public && state.prerendering;
2268
+ const properties = [`base: ${base_expression}`];
2269
+ if (assets) properties.push(`assets: ${s(assets)}`);
2270
+ if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : s(public_env)}`);
2271
+ if (chunks) {
2272
+ blocks.push("const deferred = new Map();");
2273
+ properties.push(`defer: (id) => new Promise((fulfil, reject) => {
2274
+ deferred.set(id, { fulfil, reject });
2275
+ })`);
2276
+ let app_declaration = "";
2277
+ if (Object.keys(options.hooks.transport).length > 0) if (client.inline) app_declaration = `const app = __sveltekit_${options.version_hash}.app.app;`;
2278
+ else if (client.app) app_declaration = `const app = await import(${s(prefixed(client.app))});`;
2279
+ else app_declaration = `const { app } = await import(${s(prefixed(client.start))});`;
2280
+ const prelude = app_declaration ? `${app_declaration}
2281
+ const [data, error] = fn(app);` : `const [data, error] = fn();`;
2282
+ properties.push(`resolve: async (id, fn) => {
2283
+ ${prelude}
2284
+
2285
+ const try_to_resolve = () => {
2286
+ if (!deferred.has(id)) {
2287
+ setTimeout(try_to_resolve, 0);
2288
+ return;
2289
+ }
2290
+ const { fulfil, reject } = deferred.get(id);
2291
+ deferred.delete(id);
2292
+ if (error) reject(error);
2293
+ else fulfil(data);
2294
+ }
2295
+ try_to_resolve();
2296
+ }`);
2297
+ }
2298
+ blocks.push(`${global} = {
2299
+ ${properties.join(",\n ")}
2300
+ };`);
2301
+ const args = ["element"];
2302
+ blocks.push("const element = document.currentScript.parentElement;");
2303
+ if (page_config.ssr) {
2304
+ const serialized = {
2305
+ form: "null",
2306
+ error: "null"
2307
+ };
2308
+ if (form_value) serialized.form = uneval_action_response(form_value, event.route.id, options.hooks.transport);
2309
+ if (error) serialized.error = uneval(error);
2310
+ const hydrate = [
2311
+ `node_ids: [${branch.map(({ node }) => node.index).join(", ")}]`,
2312
+ `data: ${data}`,
2313
+ `form: ${serialized.form}`,
2314
+ `error: ${serialized.error}`
2315
+ ];
2316
+ if (status !== 200) hydrate.push(`status: ${status}`);
2317
+ if (manifest._.client.routes) {
2318
+ if (route) {
2319
+ const stringified = generate_route_object(route, event.url, manifest).replaceAll("\n", "\n ");
2320
+ hydrate.push(`params: ${uneval(event.params)}`, `server_route: ${stringified}`);
2321
+ }
2322
+ } else if (options.embedded) hydrate.push(`params: ${uneval(event.params)}`, `route: ${s(event.route)}`);
2323
+ const indent = " ".repeat(load_env_eagerly ? 7 : 6);
2324
+ args.push(`{\n${indent}\t${hydrate.join(`,\n${indent}\t`)}\n${indent}}`);
2325
+ }
2326
+ const { remote } = event_state;
2327
+ let serialized_query_data = "";
2328
+ let serialized_prerender_data = "";
2329
+ if (remote.data) {
2330
+ /** @type {Record<string, any>} */
2331
+ const query = {};
2332
+ /** @type {Record<string, any>} */
2333
+ const prerender = {};
2334
+ for (const [internals, cache] of remote.data) {
2335
+ if (!internals.id) continue;
2336
+ for (const key in cache) {
2337
+ const entry = cache[key];
2338
+ if (!entry.serialize) continue;
2339
+ const remote_key = create_remote_key(internals.id, key);
2340
+ const store = internals.type === "prerender" ? prerender : query;
2341
+ if (event_state.remote.refreshes?.has(remote_key) || event_state.remote.reconnects?.has(remote_key)) store[remote_key] = await entry.data;
2342
+ else {
2343
+ const result = await Promise.race([Promise.resolve(entry.data).then((v) => ({
2344
+ settled: true,
2345
+ value: v
2346
+ }), (e) => ({
2347
+ settled: true,
2348
+ error: e
2349
+ })), new Promise((resolve) => {
2350
+ queueMicrotask(() => resolve({ settled: false }));
2351
+ })]);
2352
+ if (result.settled) {
2353
+ if ("error" in result) throw result.error;
2354
+ store[remote_key] = result.value;
2355
+ }
2356
+ }
2357
+ }
2358
+ }
2359
+ const replacer = create_replacer(options.hooks.transport);
2360
+ if (Object.keys(query).length > 0) serialized_query_data = `${global}.query = ${uneval(query, replacer)};\n\n\t\t\t\t\t\t`;
2361
+ if (Object.keys(prerender).length > 0) serialized_prerender_data = `${global}.prerender = ${uneval(prerender, replacer)};\n\n\t\t\t\t\t\t`;
2362
+ }
2363
+ const serialized_remote_data = `${serialized_query_data}${serialized_prerender_data}`;
2364
+ const boot = client.inline ? `${client.inline.script}
2365
+
2366
+ ${serialized_remote_data}${global}.app.start(${args.join(", ")});` : client.app ? `Promise.all([
2367
+ import(${s(prefixed(client.start))}),
2368
+ import(${s(prefixed(client.app))})
2369
+ ]).then(([kit, app]) => {
2370
+ ${serialized_remote_data}kit.start(app, ${args.join(", ")});
2371
+ });` : `import(${s(prefixed(client.start))}).then((app) => {
2372
+ ${serialized_remote_data}app.start(${args.join(", ")})
2373
+ });`;
2374
+ if (load_env_eagerly) blocks.push(`import(${s(`${base$1}/${app_dir}/env.js`)}).then(({ env }) => {
2375
+ ${global}.env = env;
2376
+
2377
+ ${boot.replace(/\n/g, "\n ")}
2378
+ });`);
2379
+ else blocks.push(boot);
2380
+ if (options.service_worker) {
2381
+ let opts = "";
2382
+ if (options.service_worker_options != null) opts = `, ${s({ ...options.service_worker_options })}`;
2383
+ blocks.push(`if ('serviceWorker' in navigator) {
2384
+ const script_url = '${prefixed("service-worker.js")}';
2385
+ const policy = globalThis?.window?.trustedTypes?.createPolicy(
2386
+ 'sveltekit-trusted-url',
2387
+ { createScriptURL(url) { return url; } }
2388
+ );
2389
+ const sanitised = policy?.createScriptURL(script_url) ?? script_url;
2390
+ addEventListener('load', function () {
2391
+ navigator.serviceWorker.register(sanitised${opts});
2392
+ });
2393
+ }`);
2394
+ }
2395
+ const init_app = `
2396
+ {
2397
+
2398
+ ${blocks.join("\n\n ")}
2399
+ }
2400
+ `;
2401
+ csp.add_script(init_app);
2402
+ body += `\n\t\t\t<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>${init_app}<\/script>\n\t\t`;
2403
+ }
2404
+ const headers = new Headers({
2405
+ "x-sveltekit-page": "true",
2406
+ "content-type": "text/html"
2407
+ });
2408
+ if (state.prerendering) {
2409
+ const csp_headers = csp.csp_provider.get_meta();
2410
+ if (csp_headers) head.add_http_equiv(csp_headers);
2411
+ if (state.prerendering.cache) head.add_http_equiv(`<meta http-equiv="cache-control" content="${state.prerendering.cache}">`);
2412
+ } else {
2413
+ const csp_header = csp.csp_provider.get_header();
2414
+ if (csp_header) headers.set("content-security-policy", csp_header);
2415
+ const report_only_header = csp.report_only_provider.get_header();
2416
+ if (report_only_header) headers.set("content-security-policy-report-only", report_only_header);
2417
+ if (link_headers.size) headers.set("link", Array.from(link_headers).join(", "));
2418
+ }
2419
+ const html = options.templates.app({
2420
+ head: head.build(),
2421
+ body,
2422
+ assets: assets$1,
2423
+ nonce: csp.nonce,
2424
+ env: public_env
2425
+ });
2426
+ const transformed = await resolve_opts.transformPageChunk({
2427
+ html,
2428
+ done: true
2429
+ }) || "";
2430
+ if (!chunks) headers.set("etag", `"${hash(transformed)}"`);
2431
+ return !chunks ? text(transformed, {
2432
+ status,
2433
+ headers
2434
+ }) : new Response(new ReadableStream({
2435
+ async start(controller) {
2436
+ controller.enqueue(text_encoder.encode(transformed + "\n"));
2437
+ for await (const chunk of chunks) if (chunk.length) controller.enqueue(text_encoder.encode(chunk));
2438
+ controller.close();
2439
+ },
2440
+ type: "bytes"
2441
+ }), { headers });
2442
+ }
2443
+ var Head = class {
2444
+ #rendered;
2445
+ #prerendering;
2446
+ /** @type {string[]} */
2447
+ #http_equiv = [];
2448
+ /** @type {string[]} */
2449
+ #link_tags = [];
2450
+ /** @type {string[]} */
2451
+ #script_preloads = [];
2452
+ /** @type {string[]} */
2453
+ #style_tags = [];
2454
+ /** @type {string[]} */
2455
+ #stylesheet_links = [];
2456
+ /**
2457
+ * @param {string} rendered
2458
+ * @param {boolean} prerendering
2459
+ */
2460
+ constructor(rendered, prerendering) {
2461
+ this.#rendered = rendered;
2462
+ this.#prerendering = prerendering;
2463
+ }
2464
+ build() {
2465
+ return [
2466
+ ...this.#http_equiv,
2467
+ ...this.#link_tags,
2468
+ ...this.#script_preloads,
2469
+ this.#rendered,
2470
+ ...this.#style_tags,
2471
+ ...this.#stylesheet_links
2472
+ ].join("\n ");
2473
+ }
2474
+ /**
2475
+ * @param {string} style
2476
+ * @param {string[]} attributes
2477
+ */
2478
+ add_style(style, attributes) {
2479
+ this.#style_tags.push(`<style${attributes.length ? " " + attributes.join(" ") : ""}>${style}</style>`);
2480
+ }
2481
+ /**
2482
+ * @param {string} href
2483
+ * @param {string[]} attributes
2484
+ */
2485
+ add_stylesheet(href, attributes) {
2486
+ this.#stylesheet_links.push(`<link href="${href}" ${attributes.join(" ")}>`);
2487
+ }
2488
+ /** @param {string} href */
2489
+ add_script_preload(href) {
2490
+ this.#script_preloads.push(`<link rel="preload" as="script" crossorigin="anonymous" href="${href}">`);
2491
+ }
2492
+ /**
2493
+ * @param {string} href
2494
+ * @param {string[]} attributes
2495
+ */
2496
+ add_link_tag(href, attributes) {
2497
+ if (!this.#prerendering) return;
2498
+ this.#link_tags.push(`<link href="${href}" ${attributes.join(" ")}>`);
2499
+ }
2500
+ /** @param {string} tag */
2501
+ add_http_equiv(tag) {
2502
+ if (!this.#prerendering) return;
2503
+ this.#http_equiv.push(tag);
2504
+ }
2505
+ };
2506
+ //#endregion
2507
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/utils/page_nodes.js
2508
+ var PageNodes = class {
2509
+ /** All layout nodes and the page node, if any */
2510
+ data;
2511
+ /**
2512
+ * @param {Array<import('types').SSRNode | undefined>} nodes
2513
+ */
2514
+ constructor(nodes) {
2515
+ this.data = nodes;
2516
+ }
2517
+ layouts() {
2518
+ return this.data.slice(0, -1);
2519
+ }
2520
+ page() {
2521
+ return this.data.at(-1);
2522
+ }
2523
+ validate() {
2524
+ for (const layout of this.layouts()) if (layout) {
2525
+ validate_layout_server_exports(layout.server, layout.server_id);
2526
+ validate_layout_exports(layout.universal, layout.universal_id);
2527
+ }
2528
+ const page = this.page();
2529
+ if (page) {
2530
+ validate_page_server_exports(page.server, page.server_id);
2531
+ validate_page_exports(page.universal, page.universal_id);
2532
+ }
2533
+ }
2534
+ /**
2535
+ * @template {'prerender' | 'ssr' | 'csr' | 'trailingSlash'} Option
2536
+ * @param {Option} option
2537
+ * @returns {Value | undefined}
2538
+ */
2539
+ #get_option(option) {
2540
+ /** @typedef {(import('types').UniversalNode | import('types').ServerNode)[Option]} Value */
2541
+ return this.data.reduce((value, node) => {
2542
+ return node?.universal?.[option] ?? node?.server?.[option] ?? value;
2543
+ }, void 0);
2544
+ }
2545
+ csr() {
2546
+ return this.#get_option("csr") ?? true;
2547
+ }
2548
+ ssr() {
2549
+ return this.#get_option("ssr") ?? true;
2550
+ }
2551
+ prerender() {
2552
+ return this.#get_option("prerender") ?? false;
2553
+ }
2554
+ trailing_slash() {
2555
+ return this.#get_option("trailingSlash") ?? "never";
2556
+ }
2557
+ get_config() {
2558
+ /** @type {any} */
2559
+ let current = {};
2560
+ for (const node of this.data) {
2561
+ if (!node?.universal?.config && !node?.server?.config) continue;
2562
+ current = {
2563
+ ...current,
2564
+ ...node?.universal?.config,
2565
+ ...node?.server?.config
2566
+ };
2567
+ }
2568
+ return Object.keys(current).length ? current : void 0;
2569
+ }
2570
+ should_prerender_data() {
2571
+ return this.data.some((node) => node?.server?.load || node?.server?.trailingSlash !== void 0);
2572
+ }
2573
+ };
2574
+ //#endregion
2575
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/respond_with_error.js
2576
+ /**
2577
+ * @typedef {import('./types.js').Loaded} Loaded
2578
+ */
2579
+ /**
2580
+ * @param {{
2581
+ * event: import('@sveltejs/kit').RequestEvent;
2582
+ * event_state: import('types').RequestState;
2583
+ * options: import('types').SSROptions;
2584
+ * manifest: import('@sveltejs/kit').SSRManifest;
2585
+ * state: import('types').SSRState;
2586
+ * status: number;
2587
+ * error: unknown;
2588
+ * resolve_opts: import('types').RequiredResolveOptions;
2589
+ * }} opts
2590
+ */
2591
+ async function respond_with_error({ event, event_state, options, manifest, state, status, error, resolve_opts }) {
2592
+ if (event.request.headers.get("x-sveltekit-error")) return static_error_page(
2593
+ options,
2594
+ status,
2595
+ /** @type {Error} */
2596
+ error.message
2597
+ );
2598
+ /** @type {import('./types.js').Fetched[]} */
2599
+ const fetched = [];
2600
+ try {
2601
+ const branch = [];
2602
+ const default_layout = await manifest._.nodes[0]();
2603
+ const nodes = new PageNodes([default_layout]);
2604
+ const ssr = nodes.ssr();
2605
+ const csr = nodes.csr();
2606
+ const data_serializer = server_data_serializer(event, event_state, options);
2607
+ if (ssr) {
2608
+ state.error = true;
2609
+ const server_data_promise = load_server_data({
2610
+ event,
2611
+ event_state,
2612
+ state,
2613
+ node: default_layout,
2614
+ parent: async () => ({})
2615
+ });
2616
+ const server_data = await server_data_promise;
2617
+ data_serializer.add_node(0, server_data);
2618
+ const data = await load_data({
2619
+ event,
2620
+ event_state,
2621
+ fetched,
2622
+ node: default_layout,
2623
+ parent: async () => ({}),
2624
+ resolve_opts,
2625
+ server_data_promise,
2626
+ state,
2627
+ csr
2628
+ });
2629
+ branch.push({
2630
+ node: default_layout,
2631
+ server_data,
2632
+ data
2633
+ }, {
2634
+ node: await manifest._.nodes[1](),
2635
+ data: null,
2636
+ server_data: null
2637
+ });
2638
+ }
2639
+ return await render_response({
2640
+ options,
2641
+ manifest,
2642
+ state,
2643
+ page_config: {
2644
+ ssr,
2645
+ csr
2646
+ },
2647
+ status,
2648
+ error: await handle_error_and_jsonify(event, event_state, options, error),
2649
+ branch,
2650
+ error_components: [],
2651
+ fetched,
2652
+ event,
2653
+ event_state,
2654
+ resolve_opts,
2655
+ data_serializer
2656
+ });
2657
+ } catch (e) {
2658
+ if (e instanceof Redirect) return redirect_response(e.status, e.location);
2659
+ return static_error_page(options, get_status(e), (await handle_error_and_jsonify(event, event_state, options, e)).message);
2660
+ }
2661
+ }
2662
+ //#endregion
2663
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/remote.js
2664
+ /** @import { ActionResult, RemoteForm, RequestEvent, SSRManifest } from '@sveltejs/kit' */
2665
+ /** @import { RemoteFormInternals, RemoteFunctionResponse, RemoteInternals, RequestState, SSROptions } from 'types' */
2666
+ /** @type {typeof handle_remote_call_internal} */
2667
+ async function handle_remote_call(event, state, options, manifest, id) {
2668
+ return record_span({
2669
+ name: "sveltekit.remote.call",
2670
+ attributes: { },
2671
+ fn: (current) => {
2672
+ const traced_event = merge_tracing(event, current);
2673
+ return with_request_store({
2674
+ event: traced_event,
2675
+ state
2676
+ }, () => handle_remote_call_internal(traced_event, state, options, manifest, id));
2677
+ }
2678
+ });
2679
+ }
2680
+ /**
2681
+ * @param {RequestEvent} event
2682
+ * @param {RequestState} state
2683
+ * @param {SSROptions} options
2684
+ * @param {SSRManifest} manifest
2685
+ * @param {string} id
2686
+ */
2687
+ async function handle_remote_call_internal(event, state, options, manifest, id) {
2688
+ const [hash, name, additional_args] = id.split("/");
2689
+ const remotes = manifest._.remotes;
2690
+ if (!remotes[hash]) error(404);
2691
+ const fn = (await remotes[hash]()).default[name];
2692
+ if (!fn) error(404);
2693
+ /** @type {RemoteInternals} */
2694
+ const internals = fn.__;
2695
+ const transport = options.hooks.transport;
2696
+ event.tracing.current.setAttributes({
2697
+ "sveltekit.remote.call.type": internals.type,
2698
+ "sveltekit.remote.call.name": internals.name
2699
+ });
2700
+ try {
2701
+ if (internals.type === "query_batch") {
2702
+ if (event.request.method !== "POST") throw new SvelteKitError(405, "Method Not Allowed", `\`query.batch\` functions must be invoked via POST request, not ${event.request.method}`);
2703
+ /** @type {{ payloads: string[] }} */
2704
+ const { payloads } = await event.request.json();
2705
+ const args = await Promise.all(payloads.map((payload) => parse_remote_arg(payload, transport)));
2706
+ return json({
2707
+ type: "result",
2708
+ result: stringify(await with_request_store({
2709
+ event,
2710
+ state
2711
+ }, () => internals.run(args, options)), transport)
2712
+ });
2713
+ }
2714
+ if (internals.type === "form") {
2715
+ if (event.request.method !== "POST") throw new SvelteKitError(405, "Method Not Allowed", `\`form\` functions must be invoked via POST request, not ${event.request.method}`);
2716
+ if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `\`form\` functions expect form-encoded data — received ${event.request.headers.get("content-type")}`);
2717
+ const { data, meta, form_data } = await deserialize_binary_form(event.request);
2718
+ state.remote.requested = create_requested_map(meta.remote_refreshes);
2719
+ if (additional_args && !("id" in data)) data.id = JSON.parse(decodeURIComponent(additional_args));
2720
+ const fn = internals.fn;
2721
+ const result = await with_request_store({
2722
+ event,
2723
+ state
2724
+ }, () => fn(data, meta, form_data));
2725
+ return json({
2726
+ type: "result",
2727
+ result: stringify(result, transport),
2728
+ refreshes: result.issues ? void 0 : await serialize_singleflight(state.remote.refreshes),
2729
+ reconnects: result.issues ? void 0 : await serialize_singleflight(state.remote.reconnects)
2730
+ });
2731
+ }
2732
+ if (internals.type === "command") {
2733
+ /** @type {{ payload: string, refreshes?: string[] }} */
2734
+ const { payload, refreshes } = await event.request.json();
2735
+ state.remote.requested = create_requested_map(refreshes);
2736
+ const arg = parse_remote_arg(payload, transport);
2737
+ return json({
2738
+ type: "result",
2739
+ result: stringify(await with_request_store({
2740
+ event,
2741
+ state
2742
+ }, () => fn(arg)), transport),
2743
+ refreshes: await serialize_singleflight(state.remote.refreshes),
2744
+ reconnects: await serialize_singleflight(state.remote.reconnects)
2745
+ });
2746
+ }
2747
+ if (internals.type === "query_live") {
2748
+ if (event.request.method !== "GET") throw new SvelteKitError(405, "Method Not Allowed", `\`query.live\` functions must be invoked via GET request, not ${event.request.method}`);
2749
+ const payload = new URL(event.request.url).searchParams.get("payload");
2750
+ const generator = internals.run(event, state, parse_remote_arg(payload, transport));
2751
+ const encoder = new TextEncoder();
2752
+ /**
2753
+ * @param {ReadableStreamDefaultController} controller
2754
+ * @param {any} payload
2755
+ */
2756
+ function send(controller, payload) {
2757
+ controller.enqueue(encoder.encode("data: " + JSON.stringify(payload) + "\n\n"));
2758
+ }
2759
+ let closed = false;
2760
+ /** @type {string | undefined} */
2761
+ let result = void 0;
2762
+ async function cancel() {
2763
+ if (closed) return;
2764
+ closed = true;
2765
+ await generator.return(void 0);
2766
+ }
2767
+ event.request.signal.addEventListener("abort", cancel, { once: true });
2768
+ return new Response(new ReadableStream({
2769
+ async pull(controller) {
2770
+ if (event.request.signal.aborted) {
2771
+ await cancel();
2772
+ controller.close();
2773
+ return;
2774
+ }
2775
+ try {
2776
+ while (true) {
2777
+ const { value, done } = await generator.next();
2778
+ if (done) {
2779
+ await cancel();
2780
+ controller.close();
2781
+ return;
2782
+ }
2783
+ if (result !== (result = stringify(value, transport))) {
2784
+ send(controller, {
2785
+ type: "result",
2786
+ result
2787
+ });
2788
+ return;
2789
+ }
2790
+ }
2791
+ } catch (error) {
2792
+ if (!event.request.signal.aborted) if (error instanceof Redirect) send(controller, {
2793
+ type: "redirect",
2794
+ location: error.location
2795
+ });
2796
+ else {
2797
+ const status = error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
2798
+ send(controller, {
2799
+ type: "error",
2800
+ error: await handle_error_and_jsonify(event, state, options, error),
2801
+ status
2802
+ });
2803
+ }
2804
+ await cancel();
2805
+ controller.close();
2806
+ }
2807
+ },
2808
+ cancel
2809
+ }), { headers: {
2810
+ "cache-control": "private, no-store",
2811
+ "content-type": "text/event-stream"
2812
+ } });
2813
+ }
2814
+ const payload = internals.type === "prerender" ? additional_args : new URL(event.request.url).searchParams.get("payload");
2815
+ return json({
2816
+ type: "result",
2817
+ result: stringify(await with_request_store({
2818
+ event,
2819
+ state
2820
+ }, () => fn(parse_remote_arg(payload, transport))), transport)
2821
+ });
2822
+ } catch (error) {
2823
+ if (error instanceof Redirect) return json({
2824
+ type: "redirect",
2825
+ location: error.location,
2826
+ refreshes: await serialize_singleflight(state.remote.refreshes),
2827
+ reconnects: await serialize_singleflight(state.remote.reconnects)
2828
+ });
2829
+ const status = error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
2830
+ return json({
2831
+ type: "error",
2832
+ error: await handle_error_and_jsonify(event, state, options, error),
2833
+ status
2834
+ }, {
2835
+ status: state.prerendering ? status : void 0,
2836
+ headers: { "cache-control": "private, no-store" }
2837
+ });
2838
+ }
2839
+ /** @param {Map<string, Promise<any>> | null} map */
2840
+ async function serialize_singleflight(map) {
2841
+ if (!map || map.size === 0) return;
2842
+ const results = await Promise.all(Array.from(map, async ([key, promise]) => {
2843
+ try {
2844
+ return [key, {
2845
+ type: "result",
2846
+ data: await promise
2847
+ }];
2848
+ } catch (error) {
2849
+ return [key, {
2850
+ type: "error",
2851
+ status: error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500,
2852
+ error: await handle_error_and_jsonify(event, state, options, error)
2853
+ }];
2854
+ }
2855
+ }));
2856
+ return stringify(Object.fromEntries(results), transport);
2857
+ }
2858
+ }
2859
+ /**
2860
+ * @param {string[] | undefined} refreshes
2861
+ */
2862
+ function create_requested_map(refreshes) {
2863
+ /** @type {Map<string, string[]>} */
2864
+ const requested = /* @__PURE__ */ new Map();
2865
+ for (const key of refreshes ?? []) {
2866
+ const parts = split_remote_key(key);
2867
+ const existing = requested.get(parts.id);
2868
+ if (existing) existing.push(parts.payload);
2869
+ else requested.set(parts.id, [parts.payload]);
2870
+ }
2871
+ return requested;
2872
+ }
2873
+ /** @type {typeof handle_remote_form_post_internal} */
2874
+ async function handle_remote_form_post(event, state, manifest, id) {
2875
+ return record_span({
2876
+ name: "sveltekit.remote.form.post",
2877
+ attributes: { },
2878
+ fn: (current) => {
2879
+ const traced_event = merge_tracing(event, current);
2880
+ return with_request_store({
2881
+ event: traced_event,
2882
+ state
2883
+ }, () => handle_remote_form_post_internal(traced_event, state, manifest, id));
2884
+ }
2885
+ });
2886
+ }
2887
+ /**
2888
+ * @param {RequestEvent} event
2889
+ * @param {RequestState} state
2890
+ * @param {SSRManifest} manifest
2891
+ * @param {string} id
2892
+ * @returns {Promise<ActionResult>}
2893
+ */
2894
+ async function handle_remote_form_post_internal(event, state, manifest, id) {
2895
+ const [hash, name, action_id] = id.split("/");
2896
+ let form = (await manifest._.remotes[hash]?.())?.default[name];
2897
+ if (!form) {
2898
+ event.setHeaders({ allow: "GET" });
2899
+ return {
2900
+ type: "error",
2901
+ error: new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`)
2902
+ };
2903
+ }
2904
+ if (action_id) form = with_request_store({
2905
+ event,
2906
+ state
2907
+ }, () => form.for(JSON.parse(action_id)));
2908
+ try {
2909
+ const fn = form.__.fn;
2910
+ const { data, meta, form_data } = await deserialize_binary_form(event.request);
2911
+ if (action_id && !("id" in data)) data.id = JSON.parse(decodeURIComponent(action_id));
2912
+ await with_request_store({
2913
+ event,
2914
+ state
2915
+ }, () => fn(data, meta, form_data));
2916
+ return {
2917
+ type: "success",
2918
+ status: 200
2919
+ };
2920
+ } catch (e) {
2921
+ const err = normalize_error(e);
2922
+ if (err instanceof Redirect) return {
2923
+ type: "redirect",
2924
+ status: err.status,
2925
+ location: err.location
2926
+ };
2927
+ return {
2928
+ type: "error",
2929
+ error: check_incorrect_fail_use(err)
2930
+ };
2931
+ }
2932
+ }
2933
+ /**
2934
+ * @param {URL} url
2935
+ */
2936
+ function get_remote_id(url) {
2937
+ return url.pathname.startsWith(`${base}/_app/remote/`) && url.pathname.replace(`${base}/_app/remote/`, "");
2938
+ }
2939
+ /**
2940
+ * @param {URL} url
2941
+ */
2942
+ function get_remote_action(url) {
2943
+ return url.searchParams.get("/remote");
2944
+ }
2945
+ //#endregion
2946
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/page/index.js
2947
+ /** @import { ActionResult, RequestEvent, SSRManifest } from '@sveltejs/kit' */
2948
+ /** @import { PageNodeIndexes, RequestState, RequiredResolveOptions, ServerDataNode, SSRComponent, SSRNode, SSROptions, SSRState } from 'types' */
2949
+ /**
2950
+ * The maximum request depth permitted before assuming we're stuck in an infinite loop
2951
+ */
2952
+ var MAX_DEPTH = 10;
2953
+ /**
2954
+ * @param {RequestEvent} event
2955
+ * @param {RequestState} event_state
2956
+ * @param {PageNodeIndexes} page
2957
+ * @param {SSROptions} options
2958
+ * @param {SSRManifest} manifest
2959
+ * @param {SSRState} state
2960
+ * @param {import('../../../utils/page_nodes.js').PageNodes} nodes
2961
+ * @param {RequiredResolveOptions} resolve_opts
2962
+ * @returns {Promise<Response>}
2963
+ */
2964
+ async function render_page(event, event_state, page, options, manifest, state, nodes, resolve_opts) {
2965
+ if (state.depth > MAX_DEPTH) return text(`Not found: ${event.url.pathname}`, { status: 404 });
2966
+ if (is_action_json_request(event)) return handle_action_json_request(event, event_state, options, (await manifest._.nodes[page.leaf]())?.server);
2967
+ try {
2968
+ const leaf_node = nodes.page();
2969
+ let status = 200;
2970
+ /** @type {ActionResult | undefined} */
2971
+ let action_result = void 0;
2972
+ if (is_action_request(event)) {
2973
+ const remote_id = get_remote_action(event.url);
2974
+ if (remote_id) action_result = await handle_remote_form_post(event, event_state, manifest, remote_id);
2975
+ else action_result = await handle_action_request(event, event_state, leaf_node.server);
2976
+ if (action_result?.type === "redirect") return redirect_response(action_result.status, action_result.location);
2977
+ if (action_result?.type === "error") status = get_status(action_result.error);
2978
+ if (action_result?.type === "failure") status = action_result.status;
2979
+ }
2980
+ const should_prerender = nodes.prerender();
2981
+ if (should_prerender) {
2982
+ if (leaf_node.server?.actions) throw new Error("Cannot prerender pages with actions");
2983
+ } else if (state.prerendering) return new Response(void 0, { status: 204 });
2984
+ state.prerender_default = should_prerender;
2985
+ const should_prerender_data = nodes.should_prerender_data();
2986
+ const data_pathname = add_data_suffix(event.url.pathname);
2987
+ /** @type {import('./types.js').Fetched[]} */
2988
+ const fetched = [];
2989
+ const ssr = nodes.ssr();
2990
+ const csr = nodes.csr();
2991
+ if (ssr === false && !(state.prerendering && should_prerender_data)) return await render_response({
2992
+ branch: compact(nodes.data).map((node) => {
2993
+ return {
2994
+ node,
2995
+ data: null,
2996
+ server_data: null
2997
+ };
2998
+ }),
2999
+ fetched,
3000
+ page_config: {
3001
+ ssr: false,
3002
+ csr
3003
+ },
3004
+ status,
3005
+ error: null,
3006
+ event,
3007
+ event_state,
3008
+ options,
3009
+ manifest,
3010
+ state,
3011
+ resolve_opts,
3012
+ data_serializer: server_data_serializer(event, event_state, options)
3013
+ });
3014
+ /** @type {Array<import('./types.js').Loaded | null>} */
3015
+ const branch = [];
3016
+ /** @type {Error | null} */
3017
+ let load_error = null;
3018
+ const data_serializer = server_data_serializer(event, event_state, options);
3019
+ const data_serializer_json = state.prerendering && should_prerender_data ? server_data_serializer_json(event, event_state, options) : null;
3020
+ /** @type {Array<Promise<ServerDataNode | null>>} */
3021
+ const server_promises = nodes.data.map((node, i) => {
3022
+ if (load_error) throw load_error;
3023
+ return Promise.resolve().then(async () => {
3024
+ try {
3025
+ if (node === leaf_node && action_result?.type === "error") throw action_result.error;
3026
+ const server_data = await load_server_data({
3027
+ event,
3028
+ event_state,
3029
+ state,
3030
+ node,
3031
+ parent: async () => {
3032
+ /** @type {Record<string, any>} */
3033
+ const data = {};
3034
+ for (let j = 0; j < i; j += 1) {
3035
+ const parent = await server_promises[j];
3036
+ if (parent) Object.assign(data, parent.data);
3037
+ }
3038
+ return data;
3039
+ }
3040
+ });
3041
+ if (node) data_serializer.add_node(i, server_data);
3042
+ data_serializer_json?.add_node(i, server_data);
3043
+ return server_data;
3044
+ } catch (e) {
3045
+ load_error = e;
3046
+ throw load_error;
3047
+ }
3048
+ });
3049
+ });
3050
+ /** @type {Array<Promise<Record<string, any> | null>>} */
3051
+ const load_promises = nodes.data.map((node, i) => {
3052
+ if (load_error) throw load_error;
3053
+ return Promise.resolve().then(async () => {
3054
+ try {
3055
+ return await load_data({
3056
+ event,
3057
+ event_state,
3058
+ fetched,
3059
+ node,
3060
+ parent: async () => {
3061
+ const data = {};
3062
+ for (let j = 0; j < i; j += 1) Object.assign(data, await load_promises[j]);
3063
+ return data;
3064
+ },
3065
+ resolve_opts,
3066
+ server_data_promise: server_promises[i],
3067
+ state,
3068
+ csr
3069
+ });
3070
+ } catch (e) {
3071
+ load_error = e;
3072
+ throw load_error;
3073
+ }
3074
+ });
3075
+ });
3076
+ for (const p of server_promises) p.catch(noop);
3077
+ for (const p of load_promises) p.catch(noop);
3078
+ for (let i = 0; i < nodes.data.length; i += 1) {
3079
+ const node = nodes.data[i];
3080
+ if (node) try {
3081
+ const server_data = await server_promises[i];
3082
+ const data = await load_promises[i];
3083
+ branch.push({
3084
+ node,
3085
+ server_data,
3086
+ data
3087
+ });
3088
+ } catch (e) {
3089
+ const err = normalize_error(e);
3090
+ if (err instanceof Redirect) {
3091
+ if (state.prerendering && should_prerender_data) {
3092
+ const body = JSON.stringify({
3093
+ type: "redirect",
3094
+ location: err.location
3095
+ });
3096
+ state.prerendering.dependencies.set(data_pathname, {
3097
+ response: text(body),
3098
+ body
3099
+ });
3100
+ }
3101
+ return redirect_response(err.status, err.location);
3102
+ }
3103
+ const status = get_status(err);
3104
+ const error = await handle_error_and_jsonify(event, event_state, options, err);
3105
+ while (i--) if (page.errors[i]) {
3106
+ const index = page.errors[i];
3107
+ const node = await manifest._.nodes[index]();
3108
+ let j = i;
3109
+ while (!branch[j]) j -= 1;
3110
+ data_serializer.set_max_nodes(j + 1);
3111
+ const layouts = compact(branch.slice(0, j + 1));
3112
+ const nodes = new PageNodes(layouts.map((layout) => layout.node));
3113
+ const error_branch = layouts.concat({
3114
+ node,
3115
+ data: null,
3116
+ server_data: null
3117
+ });
3118
+ return await render_response({
3119
+ event,
3120
+ event_state,
3121
+ options,
3122
+ manifest,
3123
+ state,
3124
+ resolve_opts,
3125
+ page_config: {
3126
+ ssr: nodes.ssr(),
3127
+ csr: nodes.csr()
3128
+ },
3129
+ status,
3130
+ error,
3131
+ error_components: await load_error_components(options, ssr, error_branch, page, manifest),
3132
+ branch: error_branch,
3133
+ fetched,
3134
+ data_serializer
3135
+ });
3136
+ }
3137
+ return static_error_page(options, status, error.message);
3138
+ }
3139
+ else branch.push(null);
3140
+ }
3141
+ if (state.prerendering && data_serializer_json) {
3142
+ let { data, chunks } = data_serializer_json.get_data();
3143
+ if (chunks) for await (const chunk of chunks) data += chunk;
3144
+ state.prerendering.dependencies.set(data_pathname, {
3145
+ response: text(data),
3146
+ body: data
3147
+ });
3148
+ }
3149
+ return await render_response({
3150
+ event,
3151
+ event_state,
3152
+ options,
3153
+ manifest,
3154
+ state,
3155
+ resolve_opts,
3156
+ page_config: {
3157
+ csr,
3158
+ ssr
3159
+ },
3160
+ status,
3161
+ error: null,
3162
+ branch: compact(branch),
3163
+ action_result,
3164
+ fetched,
3165
+ data_serializer: !ssr ? server_data_serializer(event, event_state, options) : data_serializer,
3166
+ error_components: await load_error_components(options, ssr, branch, page, manifest)
3167
+ });
3168
+ } catch (e) {
3169
+ if (e instanceof Redirect) return redirect_response(e.status, e.location);
3170
+ return await respond_with_error({
3171
+ event,
3172
+ event_state,
3173
+ options,
3174
+ manifest,
3175
+ state,
3176
+ status: e instanceof HttpError ? e.status : 500,
3177
+ error: e,
3178
+ resolve_opts
3179
+ });
3180
+ }
3181
+ }
3182
+ /**
3183
+ *
3184
+ * @param {SSROptions} options
3185
+ * @param {boolean} ssr
3186
+ * @param {Array<import('./types.js').Loaded | null>} branch
3187
+ * @param {PageNodeIndexes} page
3188
+ * @param {SSRManifest} manifest
3189
+ */
3190
+ async function load_error_components(options, ssr, branch, page, manifest) {
3191
+ /** @type {Array<SSRComponent | undefined> | undefined} */
3192
+ let error_components;
3193
+ if (options.server_error_boundaries && ssr) {
3194
+ let last_idx = -1;
3195
+ error_components = await Promise.all(branch.map((b, i) => {
3196
+ if (i === 0) return void 0;
3197
+ if (!b) return null;
3198
+ i--;
3199
+ while (i > last_idx + 1 && page.errors[i] === void 0) i -= 1;
3200
+ last_idx = i;
3201
+ const idx = page.errors[i];
3202
+ if (idx == null) return void 0;
3203
+ return manifest._.nodes[idx]?.().then((e) => e.component?.()).catch(() => void 0);
3204
+ }).filter((e) => e !== null));
3205
+ }
3206
+ return error_components;
3207
+ }
3208
+ //#endregion
3209
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/data/index.js
3210
+ /**
3211
+ * @param {import('@sveltejs/kit').RequestEvent} event
3212
+ * @param {import('types').RequestState} event_state
3213
+ * @param {import('types').SSRRoute} route
3214
+ * @param {import('types').SSROptions} options
3215
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3216
+ * @param {import('types').SSRState} state
3217
+ * @param {boolean[] | undefined} invalidated_data_nodes
3218
+ * @param {import('types').TrailingSlash} trailing_slash
3219
+ * @returns {Promise<Response>}
3220
+ */
3221
+ async function render_data(event, event_state, route, options, manifest, state, invalidated_data_nodes, trailing_slash) {
3222
+ if (!route.page) return new Response(void 0, { status: 404 });
3223
+ try {
3224
+ const node_ids = [...route.page.layouts, route.page.leaf];
3225
+ const invalidated = invalidated_data_nodes ?? node_ids.map(() => true);
3226
+ let aborted = false;
3227
+ const url = new URL(event.url);
3228
+ url.pathname = normalize_path(url.pathname, trailing_slash);
3229
+ const new_event = {
3230
+ ...event,
3231
+ url
3232
+ };
3233
+ const functions = node_ids.map((n, i) => {
3234
+ return once(async () => {
3235
+ try {
3236
+ if (aborted) return { type: "skip" };
3237
+ return load_server_data({
3238
+ event: new_event,
3239
+ event_state,
3240
+ state,
3241
+ node: n == void 0 ? n : await manifest._.nodes[n](),
3242
+ parent: async () => {
3243
+ /** @type {Record<string, any>} */
3244
+ const data = {};
3245
+ for (let j = 0; j < i; j += 1) {
3246
+ const parent = await functions[j]();
3247
+ if (parent) Object.assign(data, parent.data);
3248
+ }
3249
+ return data;
3250
+ }
3251
+ });
3252
+ } catch (e) {
3253
+ aborted = true;
3254
+ throw e;
3255
+ }
3256
+ });
3257
+ });
3258
+ const promises = functions.map(async (fn, i) => {
3259
+ if (!invalidated[i]) return { type: "skip" };
3260
+ return fn();
3261
+ });
3262
+ let length = promises.length;
3263
+ const nodes = await Promise.all(promises.map((p, i) => p.catch(async (error) => {
3264
+ if (error instanceof Redirect) throw error;
3265
+ length = Math.min(length, i + 1);
3266
+ return {
3267
+ type: "error",
3268
+ error: await handle_error_and_jsonify(event, event_state, options, error),
3269
+ status: error instanceof HttpError || error instanceof SvelteKitError ? error.status : void 0
3270
+ };
3271
+ })));
3272
+ const data_serializer = server_data_serializer_json(event, event_state, options);
3273
+ for (let i = 0; i < nodes.length; i++) data_serializer.add_node(i, nodes[i]);
3274
+ const { data, chunks } = data_serializer.get_data();
3275
+ if (!chunks) return json_response(data);
3276
+ return new Response(new ReadableStream({
3277
+ async start(controller) {
3278
+ controller.enqueue(text_encoder.encode(data));
3279
+ for await (const chunk of chunks) controller.enqueue(text_encoder.encode(chunk));
3280
+ controller.close();
3281
+ },
3282
+ type: "bytes"
3283
+ }), { headers: {
3284
+ "content-type": "text/sveltekit-data",
3285
+ "cache-control": "private, no-store"
3286
+ } });
3287
+ } catch (e) {
3288
+ const error = normalize_error(e);
3289
+ if (error instanceof Redirect) return redirect_json_response(error);
3290
+ else return json_response(await handle_error_and_jsonify(event, event_state, options, error), 500);
3291
+ }
3292
+ }
3293
+ /**
3294
+ * @param {Record<string, any> | string} json
3295
+ * @param {number} [status]
3296
+ */
3297
+ function json_response(json, status = 200) {
3298
+ return text(typeof json === "string" ? json : JSON.stringify(json), {
3299
+ status,
3300
+ headers: {
3301
+ "content-type": "application/json",
3302
+ "cache-control": "private, no-store"
3303
+ }
3304
+ });
3305
+ }
3306
+ /**
3307
+ * @param {Redirect} redirect
3308
+ */
3309
+ function redirect_json_response(redirect) {
3310
+ return json_response({
3311
+ type: "redirect",
3312
+ location: redirect.location
3313
+ });
3314
+ }
3315
+ /*!
3316
+ * cookie
3317
+ * Copyright(c) 2012-2014 Roman Shtylman
3318
+ * Copyright(c) 2015 Douglas Christopher Wilson
3319
+ * MIT Licensed
3320
+ */
3321
+ //#endregion
3322
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/cookie.js
3323
+ var import_cookie = (/* @__PURE__ */ __commonJSMin(((exports) => {
3324
+ /**
3325
+ * Module exports.
3326
+ * @public
3327
+ */
3328
+ exports.parse = parse;
3329
+ exports.serialize = serialize;
3330
+ /**
3331
+ * Module variables.
3332
+ * @private
3333
+ */
3334
+ var __toString = Object.prototype.toString;
3335
+ /**
3336
+ * RegExp to match field-content in RFC 7230 sec 3.2
3337
+ *
3338
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
3339
+ * field-vchar = VCHAR / obs-text
3340
+ * obs-text = %x80-FF
3341
+ */
3342
+ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
3343
+ /**
3344
+ * Parse a cookie header.
3345
+ *
3346
+ * Parse the given cookie header string into an object
3347
+ * The object has the various cookies as keys(names) => values
3348
+ *
3349
+ * @param {string} str
3350
+ * @param {object} [options]
3351
+ * @return {object}
3352
+ * @public
3353
+ */
3354
+ function parse(str, options) {
3355
+ if (typeof str !== "string") throw new TypeError("argument str must be a string");
3356
+ var obj = {};
3357
+ var dec = (options || {}).decode || decode;
3358
+ var index = 0;
3359
+ while (index < str.length) {
3360
+ var eqIdx = str.indexOf("=", index);
3361
+ if (eqIdx === -1) break;
3362
+ var endIdx = str.indexOf(";", index);
3363
+ if (endIdx === -1) endIdx = str.length;
3364
+ else if (endIdx < eqIdx) {
3365
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
3366
+ continue;
3367
+ }
3368
+ var key = str.slice(index, eqIdx).trim();
3369
+ if (void 0 === obj[key]) {
3370
+ var val = str.slice(eqIdx + 1, endIdx).trim();
3371
+ if (val.charCodeAt(0) === 34) val = val.slice(1, -1);
3372
+ obj[key] = tryDecode(val, dec);
3373
+ }
3374
+ index = endIdx + 1;
3375
+ }
3376
+ return obj;
3377
+ }
3378
+ /**
3379
+ * Serialize data into a cookie header.
3380
+ *
3381
+ * Serialize the a name value pair into a cookie string suitable for
3382
+ * http headers. An optional options object specified cookie parameters.
3383
+ *
3384
+ * serialize('foo', 'bar', { httpOnly: true })
3385
+ * => "foo=bar; httpOnly"
3386
+ *
3387
+ * @param {string} name
3388
+ * @param {string} val
3389
+ * @param {object} [options]
3390
+ * @return {string}
3391
+ * @public
3392
+ */
3393
+ function serialize(name, val, options) {
3394
+ var opt = options || {};
3395
+ var enc = opt.encode || encode;
3396
+ if (typeof enc !== "function") throw new TypeError("option encode is invalid");
3397
+ if (!fieldContentRegExp.test(name)) throw new TypeError("argument name is invalid");
3398
+ var value = enc(val);
3399
+ if (value && !fieldContentRegExp.test(value)) throw new TypeError("argument val is invalid");
3400
+ var str = name + "=" + value;
3401
+ if (null != opt.maxAge) {
3402
+ var maxAge = opt.maxAge - 0;
3403
+ if (isNaN(maxAge) || !isFinite(maxAge)) throw new TypeError("option maxAge is invalid");
3404
+ str += "; Max-Age=" + Math.floor(maxAge);
3405
+ }
3406
+ if (opt.domain) {
3407
+ if (!fieldContentRegExp.test(opt.domain)) throw new TypeError("option domain is invalid");
3408
+ str += "; Domain=" + opt.domain;
3409
+ }
3410
+ if (opt.path) {
3411
+ if (!fieldContentRegExp.test(opt.path)) throw new TypeError("option path is invalid");
3412
+ str += "; Path=" + opt.path;
3413
+ }
3414
+ if (opt.expires) {
3415
+ var expires = opt.expires;
3416
+ if (!isDate(expires) || isNaN(expires.valueOf())) throw new TypeError("option expires is invalid");
3417
+ str += "; Expires=" + expires.toUTCString();
3418
+ }
3419
+ if (opt.httpOnly) str += "; HttpOnly";
3420
+ if (opt.secure) str += "; Secure";
3421
+ if (opt.partitioned) str += "; Partitioned";
3422
+ if (opt.priority) switch (typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority) {
3423
+ case "low":
3424
+ str += "; Priority=Low";
3425
+ break;
3426
+ case "medium":
3427
+ str += "; Priority=Medium";
3428
+ break;
3429
+ case "high":
3430
+ str += "; Priority=High";
3431
+ break;
3432
+ default: throw new TypeError("option priority is invalid");
3433
+ }
3434
+ if (opt.sameSite) switch (typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite) {
3435
+ case true:
3436
+ str += "; SameSite=Strict";
3437
+ break;
3438
+ case "lax":
3439
+ str += "; SameSite=Lax";
3440
+ break;
3441
+ case "strict":
3442
+ str += "; SameSite=Strict";
3443
+ break;
3444
+ case "none":
3445
+ str += "; SameSite=None";
3446
+ break;
3447
+ default: throw new TypeError("option sameSite is invalid");
3448
+ }
3449
+ return str;
3450
+ }
3451
+ /**
3452
+ * URL-decode string value. Optimized to skip native call when no %.
3453
+ *
3454
+ * @param {string} str
3455
+ * @returns {string}
3456
+ */
3457
+ function decode(str) {
3458
+ return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
3459
+ }
3460
+ /**
3461
+ * URL-encode value.
3462
+ *
3463
+ * @param {string} val
3464
+ * @returns {string}
3465
+ */
3466
+ function encode(val) {
3467
+ return encodeURIComponent(val);
3468
+ }
3469
+ /**
3470
+ * Determine if value is a Date.
3471
+ *
3472
+ * @param {*} val
3473
+ * @private
3474
+ */
3475
+ function isDate(val) {
3476
+ return __toString.call(val) === "[object Date]" || val instanceof Date;
3477
+ }
3478
+ /**
3479
+ * Try decoding a string using a decoding function.
3480
+ *
3481
+ * @param {string} str
3482
+ * @param {function} decode
3483
+ * @private
3484
+ */
3485
+ function tryDecode(str, decode) {
3486
+ try {
3487
+ return decode(str);
3488
+ } catch (e) {
3489
+ return str;
3490
+ }
3491
+ }
3492
+ })))();
3493
+ var INVALID_COOKIE_CHARACTER_REGEX = /[\x00-\x1F\x7F()<>@,;:"/[\]?={} \t]/;
3494
+ /** @param {import('./page/types.js').Cookie['options']} options */
3495
+ function validate_options(options) {
3496
+ if (options?.path === void 0) throw new Error("You must specify a `path` when setting, deleting or serializing cookies");
3497
+ }
3498
+ /**
3499
+ * Generates a unique key for a cookie based on its domain, path, and name in
3500
+ * the format: `<domain>/<path>?<name>`.
3501
+ * If domain is undefined, it will be omitted.
3502
+ * For example: `/?name`, `example.com/foo?name`.
3503
+ *
3504
+ * @param {string | undefined} domain
3505
+ * @param {string} path
3506
+ * @param {string} name
3507
+ * @returns {string}
3508
+ */
3509
+ function generate_cookie_key(domain, path, name) {
3510
+ return `${domain || ""}${path}?${encodeURIComponent(name)}`;
3511
+ }
3512
+ /**
3513
+ * @param {Request} request
3514
+ * @param {URL} url
3515
+ */
3516
+ function get_cookies(request, url) {
3517
+ const header = request.headers.get("cookie") ?? "";
3518
+ const initial_cookies = (0, import_cookie.parse)(header, { decode: (value) => value });
3519
+ /** @type {string | undefined} */
3520
+ let normalized_url;
3521
+ /** @type {Map<string, import('./page/types.js').Cookie>} */
3522
+ const new_cookies = /* @__PURE__ */ new Map();
3523
+ /** @type {import('cookie').CookieSerializeOptions} */
3524
+ const defaults = {
3525
+ httpOnly: true,
3526
+ sameSite: "lax",
3527
+ secure: url.hostname === "localhost" && url.protocol === "http:" ? false : true
3528
+ };
3529
+ /** @type {import('@sveltejs/kit').Cookies} */
3530
+ const cookies = {
3531
+ /**
3532
+ * @param {string} name
3533
+ * @param {import('cookie').CookieParseOptions} [opts]
3534
+ */
3535
+ get(name, opts) {
3536
+ const best_match = Array.from(new_cookies.values()).filter((c) => {
3537
+ return c.name === name && domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path);
3538
+ }).sort((a, b) => b.options.path.length - a.options.path.length)[0];
3539
+ if (best_match) return best_match.options.maxAge === 0 ? void 0 : best_match.value;
3540
+ return (0, import_cookie.parse)(header, { decode: opts?.decode })[name];
3541
+ },
3542
+ /**
3543
+ * @param {import('cookie').CookieParseOptions} [opts]
3544
+ */
3545
+ getAll(opts) {
3546
+ const cookies = (0, import_cookie.parse)(header, { decode: opts?.decode });
3547
+ const lookup = /* @__PURE__ */ new Map();
3548
+ for (const c of new_cookies.values()) if (domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path)) {
3549
+ const existing = lookup.get(c.name);
3550
+ if (!existing || c.options.path.length > existing.options.path.length) lookup.set(c.name, c);
3551
+ }
3552
+ for (const c of lookup.values()) cookies[c.name] = c.value;
3553
+ return Object.entries(cookies).map(([name, value]) => ({
3554
+ name,
3555
+ value
3556
+ }));
3557
+ },
3558
+ /**
3559
+ * @param {string} name
3560
+ * @param {string} value
3561
+ * @param {import('./page/types.js').Cookie['options']} options
3562
+ */
3563
+ set(name, value, options) {
3564
+ const illegal_characters = name.match(INVALID_COOKIE_CHARACTER_REGEX);
3565
+ if (illegal_characters) console.warn(`The cookie name "${name}" will be invalid in SvelteKit 3.0 as it contains ${illegal_characters.join(" and ")}. See RFC 2616 for more details https://datatracker.ietf.org/doc/html/rfc2616#section-2.2`);
3566
+ validate_options(options);
3567
+ set_internal(name, value, {
3568
+ ...defaults,
3569
+ ...options
3570
+ });
3571
+ },
3572
+ /**
3573
+ * @param {string} name
3574
+ * @param {import('./page/types.js').Cookie['options']} options
3575
+ */
3576
+ delete(name, options) {
3577
+ validate_options(options);
3578
+ cookies.set(name, "", {
3579
+ ...options,
3580
+ maxAge: 0
3581
+ });
3582
+ },
3583
+ /**
3584
+ * @param {string} name
3585
+ * @param {string} value
3586
+ * @param {import('./page/types.js').Cookie['options']} options
3587
+ */
3588
+ serialize(name, value, options) {
3589
+ validate_options(options);
3590
+ let path = options.path;
3591
+ if (!options.domain || options.domain === url.hostname) {
3592
+ if (!normalized_url) throw new Error("Cannot serialize cookies until after the route is determined");
3593
+ path = resolve(normalized_url, path);
3594
+ }
3595
+ return (0, import_cookie.serialize)(name, value, {
3596
+ ...defaults,
3597
+ ...options,
3598
+ path
3599
+ });
3600
+ }
3601
+ };
3602
+ /**
3603
+ * @param {URL} destination
3604
+ * @param {string | null} header
3605
+ */
3606
+ function get_cookie_header(destination, header) {
3607
+ /** @type {Record<string, string>} */
3608
+ const combined_cookies = { ...initial_cookies };
3609
+ for (const cookie of new_cookies.values()) {
3610
+ if (!domain_matches(destination.hostname, cookie.options.domain)) continue;
3611
+ if (!path_matches(destination.pathname, cookie.options.path)) continue;
3612
+ const encoder = cookie.options.encode || encodeURIComponent;
3613
+ combined_cookies[cookie.name] = encoder(cookie.value);
3614
+ }
3615
+ if (header) {
3616
+ const parsed = (0, import_cookie.parse)(header, { decode: (value) => value });
3617
+ for (const name in parsed) combined_cookies[name] = parsed[name];
3618
+ }
3619
+ return Object.entries(combined_cookies).map(([name, value]) => `${name}=${value}`).join("; ");
3620
+ }
3621
+ /** @type {Array<() => void>} */
3622
+ const internal_queue = [];
3623
+ /**
3624
+ * @param {string} name
3625
+ * @param {string} value
3626
+ * @param {import('./page/types.js').Cookie['options']} options
3627
+ */
3628
+ function set_internal(name, value, options) {
3629
+ if (!normalized_url) {
3630
+ internal_queue.push(() => set_internal(name, value, options));
3631
+ return;
3632
+ }
3633
+ let path = options.path;
3634
+ if (!options.domain || options.domain === url.hostname) path = resolve(normalized_url, path);
3635
+ const cookie_key = generate_cookie_key(options.domain, path, name);
3636
+ const cookie = {
3637
+ name,
3638
+ value,
3639
+ options: {
3640
+ ...options,
3641
+ path
3642
+ }
3643
+ };
3644
+ new_cookies.set(cookie_key, cookie);
3645
+ }
3646
+ /**
3647
+ * @param {import('types').TrailingSlash} trailing_slash
3648
+ */
3649
+ function set_trailing_slash(trailing_slash) {
3650
+ normalized_url = normalize_path(url.pathname, trailing_slash);
3651
+ internal_queue.forEach((fn) => fn());
3652
+ }
3653
+ return {
3654
+ cookies,
3655
+ new_cookies,
3656
+ get_cookie_header,
3657
+ set_internal,
3658
+ set_trailing_slash
3659
+ };
3660
+ }
3661
+ /**
3662
+ * @param {string} hostname
3663
+ * @param {string} [constraint]
3664
+ */
3665
+ function domain_matches(hostname, constraint) {
3666
+ if (!constraint) return true;
3667
+ const normalized = constraint[0] === "." ? constraint.slice(1) : constraint;
3668
+ if (hostname === normalized) return true;
3669
+ return hostname.endsWith("." + normalized);
3670
+ }
3671
+ /**
3672
+ * @param {string} path
3673
+ * @param {string} [constraint]
3674
+ */
3675
+ function path_matches(path, constraint) {
3676
+ if (!constraint) return true;
3677
+ const normalized = constraint.endsWith("/") ? constraint.slice(0, -1) : constraint;
3678
+ if (path === normalized) return true;
3679
+ return path.startsWith(normalized + "/");
3680
+ }
3681
+ /**
3682
+ * @param {Headers} headers
3683
+ * @param {MapIterator<import('./page/types.js').Cookie>} cookies
3684
+ */
3685
+ function add_cookies_to_headers(headers, cookies) {
3686
+ for (const new_cookie of cookies) {
3687
+ const { name, value, options } = new_cookie;
3688
+ headers.append("set-cookie", (0, import_cookie.serialize)(name, value, options));
3689
+ if (options.path.endsWith(".html")) {
3690
+ const path = add_data_suffix(options.path);
3691
+ headers.append("set-cookie", (0, import_cookie.serialize)(name, value, {
3692
+ ...options,
3693
+ path
3694
+ }));
3695
+ }
3696
+ }
3697
+ }
3698
+ //#endregion
3699
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/fetch.js
3700
+ /**
3701
+ * @param {{
3702
+ * event: import('@sveltejs/kit').RequestEvent;
3703
+ * options: import('types').SSROptions;
3704
+ * manifest: import('@sveltejs/kit').SSRManifest;
3705
+ * state: import('types').SSRState;
3706
+ * get_cookie_header: (url: URL, header: string | null) => string;
3707
+ * set_internal: (name: string, value: string, opts: import('./page/types.js').Cookie['options']) => void;
3708
+ * }} opts
3709
+ * @returns {typeof fetch}
3710
+ */
3711
+ function create_fetch({ event, options, manifest, state, get_cookie_header, set_internal }) {
3712
+ /**
3713
+ * @type {typeof fetch}
3714
+ */
3715
+ const server_fetch = async (info, init) => {
3716
+ const original_request = normalize_fetch_input(info, init, event.url);
3717
+ let mode = (info instanceof Request ? info.mode : init?.mode) ?? "cors";
3718
+ let credentials = (info instanceof Request ? info.credentials : init?.credentials) ?? "same-origin";
3719
+ return options.hooks.handleFetch({
3720
+ event,
3721
+ request: original_request,
3722
+ fetch: async (info, init) => {
3723
+ const request = normalize_fetch_input(info, init, event.url);
3724
+ const url = new URL(request.url);
3725
+ if (!request.headers.has("origin")) request.headers.set("origin", event.url.origin);
3726
+ if (info !== original_request) {
3727
+ mode = (info instanceof Request ? info.mode : init?.mode) ?? "cors";
3728
+ credentials = (info instanceof Request ? info.credentials : init?.credentials) ?? "same-origin";
3729
+ }
3730
+ if ((request.method === "GET" || request.method === "HEAD") && (mode === "no-cors" && url.origin !== event.url.origin || url.origin === event.url.origin)) request.headers.delete("origin");
3731
+ const decoded = decodeURIComponent(url.pathname);
3732
+ if (url.origin !== event.url.origin || base && decoded !== base && !decoded.startsWith(`${base}/`)) {
3733
+ if (`.${url.hostname}`.endsWith(`.${event.url.hostname}`) && credentials !== "omit") {
3734
+ const cookie = get_cookie_header(url, request.headers.get("cookie"));
3735
+ if (cookie) request.headers.set("cookie", cookie);
3736
+ }
3737
+ return fetch(request);
3738
+ }
3739
+ const prefix = assets || base;
3740
+ const filename = (decoded.startsWith(prefix) ? decoded.slice(prefix.length) : decoded).slice(1);
3741
+ const filename_html = `${filename}/index.html`;
3742
+ const is_asset = manifest.assets.has(filename) || filename in manifest._.server_assets;
3743
+ const is_asset_html = manifest.assets.has(filename_html) || filename_html in manifest._.server_assets;
3744
+ if (is_asset || is_asset_html) {
3745
+ const file = is_asset ? filename : filename_html;
3746
+ if (state.read) {
3747
+ const type = is_asset ? manifest.mimeTypes[filename.slice(filename.lastIndexOf("."))] : "text/html";
3748
+ return new Response(state.read(file), { headers: type ? { "content-type": type } : {} });
3749
+ } else if (read_implementation && file in manifest._.server_assets) {
3750
+ const length = manifest._.server_assets[file];
3751
+ const type = manifest.mimeTypes[file.slice(file.lastIndexOf("."))];
3752
+ return new Response(read_implementation(file), { headers: {
3753
+ "Content-Length": "" + length,
3754
+ "Content-Type": type
3755
+ } });
3756
+ }
3757
+ return await fetch(request);
3758
+ }
3759
+ if (has_prerendered_path(manifest, base + decoded)) return await fetch(request);
3760
+ if (credentials !== "omit") {
3761
+ const cookie = get_cookie_header(url, request.headers.get("cookie"));
3762
+ if (cookie) request.headers.set("cookie", cookie);
3763
+ const authorization = event.request.headers.get("authorization");
3764
+ if (authorization && !request.headers.has("authorization")) request.headers.set("authorization", authorization);
3765
+ }
3766
+ if (!request.headers.has("accept")) request.headers.set("accept", "*/*");
3767
+ if (!request.headers.has("accept-language")) request.headers.set("accept-language", event.request.headers.get("accept-language"));
3768
+ const response = await internal_fetch(request, options, manifest, state);
3769
+ for (const str of get_set_cookies(response.headers)) {
3770
+ const { name, value, ...options } = parseString(str, { decodeValues: false });
3771
+ set_internal(name, value, {
3772
+ path: options.path ?? (url.pathname.split("/").slice(0, -1).join("/") || "/"),
3773
+ encode: (value) => value,
3774
+ ...options
3775
+ });
3776
+ }
3777
+ return response;
3778
+ }
3779
+ });
3780
+ };
3781
+ return (input, init) => {
3782
+ const response = server_fetch(input, init);
3783
+ response.catch(noop);
3784
+ return response;
3785
+ };
3786
+ }
3787
+ /**
3788
+ * @param {RequestInfo | URL} info
3789
+ * @param {RequestInit | undefined} init
3790
+ * @param {URL} url
3791
+ */
3792
+ function normalize_fetch_input(info, init, url) {
3793
+ if (info instanceof Request) return info;
3794
+ return new Request(typeof info === "string" ? new URL(info, url) : info, init);
3795
+ }
3796
+ /**
3797
+ * @param {Request} request
3798
+ * @param {import('types').SSROptions} options
3799
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3800
+ * @param {import('types').SSRState} state
3801
+ * @returns {Promise<Response>}
3802
+ */
3803
+ async function internal_fetch(request, options, manifest, state) {
3804
+ if (request.signal) {
3805
+ if (request.signal.aborted) throw new DOMException("The operation was aborted.", "AbortError");
3806
+ let remove_abort_listener = noop;
3807
+ /** @type {Promise<never>} */
3808
+ const abort_promise = new Promise((_, reject) => {
3809
+ const on_abort = () => {
3810
+ reject(new DOMException("The operation was aborted.", "AbortError"));
3811
+ };
3812
+ request.signal.addEventListener("abort", on_abort, { once: true });
3813
+ remove_abort_listener = () => request.signal.removeEventListener("abort", on_abort);
3814
+ });
3815
+ const result = await Promise.race([respond(request, options, manifest, {
3816
+ ...state,
3817
+ depth: state.depth + 1
3818
+ }), abort_promise]);
3819
+ remove_abort_listener();
3820
+ return result;
3821
+ } else return await respond(request, options, manifest, {
3822
+ ...state,
3823
+ depth: state.depth + 1
3824
+ });
3825
+ }
3826
+ //#endregion
3827
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/env_module.js
3828
+ /** @type {string} */
3829
+ var payload;
3830
+ /** @type {string} */
3831
+ var etag;
3832
+ /** @type {Headers} */
3833
+ var headers;
3834
+ /**
3835
+ * @param {Request} request
3836
+ * @returns {Response}
3837
+ */
3838
+ function get_public_env(request) {
3839
+ const script = request.url.endsWith(".script.js");
3840
+ payload ??= uneval(public_env);
3841
+ etag ??= `W/${Date.now()}`;
3842
+ headers ??= new Headers({
3843
+ "content-type": "application/javascript; charset=utf-8",
3844
+ etag
3845
+ });
3846
+ if (request.headers.get("if-none-match") === etag) return new Response(void 0, {
3847
+ status: 304,
3848
+ headers
3849
+ });
3850
+ if (script) return new Response(`globalThis.__sveltekit_sw={env:${payload}}`, { headers });
3851
+ return new Response(`export const env=${payload}`, { headers });
3852
+ }
3853
+ //#endregion
3854
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/respond.js
3855
+ /** @import { RequestState, SSRNode } from 'types' */
3856
+ /** @type {import('types').RequiredResolveOptions['transformPageChunk']} */
3857
+ var default_transform = ({ html }) => html;
3858
+ /** @type {import('types').RequiredResolveOptions['filterSerializedResponseHeaders']} */
3859
+ var default_filter = () => false;
3860
+ /** @type {import('types').RequiredResolveOptions['preload']} */
3861
+ var default_preload = ({ type }) => type === "js" || type === "css";
3862
+ var page_methods = new Set([
3863
+ "GET",
3864
+ "HEAD",
3865
+ "POST"
3866
+ ]);
3867
+ var allowed_page_methods = new Set([
3868
+ "GET",
3869
+ "HEAD",
3870
+ "OPTIONS"
3871
+ ]);
3872
+ var respond = propagate_context(internal_respond);
3873
+ /**
3874
+ * @param {Request} request
3875
+ * @param {import('types').SSROptions} options
3876
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
3877
+ * @param {import('types').SSRState} state
3878
+ * @returns {Promise<Response>}
3879
+ */
3880
+ async function internal_respond(request, options, manifest, state) {
3881
+ /** URL but stripped from the potential `/__data.json` suffix and its search param */
3882
+ const url = new URL(request.url);
3883
+ const is_route_resolution_request = has_resolution_suffix(url.pathname);
3884
+ const is_data_request = has_data_suffix(url.pathname);
3885
+ const remote_id = get_remote_id(url);
3886
+ {
3887
+ const request_origin = request.headers.get("origin");
3888
+ if (remote_id) {
3889
+ if (request.method !== "GET" && request_origin !== url.origin) return json({ message: "Cross-site remote requests are forbidden" }, { status: 403 });
3890
+ } else if (options.csrf_check_origin) {
3891
+ if (is_form_content_type(request) && (request.method === "POST" || request.method === "PUT" || request.method === "PATCH" || request.method === "DELETE") && request_origin !== url.origin && (!request_origin || !options.csrf_trusted_origins.includes(request_origin))) {
3892
+ const message = `Cross-site ${request.method} form submissions are forbidden`;
3893
+ const opts = { status: 403 };
3894
+ if (request.headers.get("accept") === "application/json") return json({ message }, opts);
3895
+ return text(message, opts);
3896
+ }
3897
+ }
3898
+ }
3899
+ if (options.hash_routing && url.pathname !== base + "/" && url.pathname !== "/[fallback]") return text("Not found", { status: 404 });
3900
+ /** @type {boolean[] | undefined} */
3901
+ let invalidated_data_nodes;
3902
+ if (is_route_resolution_request)
3903
+ /**
3904
+ * If the request is for a route resolution, first modify the URL, then continue as normal
3905
+ * for path resolution, then return the route object as a JS file.
3906
+ */
3907
+ url.pathname = strip_resolution_suffix(url.pathname);
3908
+ else if (is_data_request) {
3909
+ url.pathname = strip_data_suffix(url.pathname) + (url.searchParams.get("x-sveltekit-trailing-slash") === "1" ? "/" : "") || "/";
3910
+ url.searchParams.delete(TRAILING_SLASH_PARAM);
3911
+ invalidated_data_nodes = url.searchParams.get(INVALIDATED_PARAM)?.split("").map((node) => node === "1");
3912
+ url.searchParams.delete(INVALIDATED_PARAM);
3913
+ } else if (remote_id) {
3914
+ url.pathname = request.headers.get("x-sveltekit-pathname") ?? base;
3915
+ url.search = request.headers.get("x-sveltekit-search") ?? "";
3916
+ }
3917
+ /** @type {Record<string, string>} */
3918
+ const headers = {};
3919
+ const { cookies, new_cookies, get_cookie_header, set_internal, set_trailing_slash } = get_cookies(request, url);
3920
+ /** @type {RequestState} */
3921
+ const event_state = {
3922
+ prerendering: state.prerendering,
3923
+ transport: options.hooks.transport,
3924
+ handleValidationError: options.hooks.handleValidationError,
3925
+ tracing: { record_span },
3926
+ remote: {
3927
+ data: null,
3928
+ forms: null,
3929
+ refreshes: null,
3930
+ requested: null,
3931
+ reconnects: null,
3932
+ batches: null,
3933
+ live_iterators: null
3934
+ },
3935
+ is_in_remote_function: false,
3936
+ is_in_render: false,
3937
+ is_in_universal_load: false
3938
+ };
3939
+ /** @type {import('@sveltejs/kit').RequestEvent} */
3940
+ const event = {
3941
+ cookies,
3942
+ fetch: null,
3943
+ getClientAddress: state.getClientAddress || (() => {
3944
+ throw new Error(`@sveltejs/adapter-node does not specify getClientAddress. Please raise an issue`);
3945
+ }),
3946
+ locals: {},
3947
+ params: {},
3948
+ platform: state.platform,
3949
+ request,
3950
+ route: { id: null },
3951
+ setHeaders: (new_headers) => {
3952
+ for (const key in new_headers) {
3953
+ const lower = key.toLowerCase();
3954
+ const value = new_headers[key];
3955
+ if (lower === "set-cookie") throw new Error("Use `event.cookies.set(name, value, options)` instead of `event.setHeaders` to set cookies");
3956
+ else if (lower in headers) if (lower === "server-timing") headers[lower] += ", " + value;
3957
+ else throw new Error(`"${key}" header is already set`);
3958
+ else {
3959
+ headers[lower] = value;
3960
+ if (state.prerendering && lower === "cache-control") state.prerendering.cache = value;
3961
+ }
3962
+ }
3963
+ },
3964
+ url,
3965
+ isDataRequest: is_data_request,
3966
+ isSubRequest: state.depth > 0,
3967
+ isRemoteRequest: !!remote_id
3968
+ };
3969
+ event.fetch = create_fetch({
3970
+ event,
3971
+ options,
3972
+ manifest,
3973
+ state,
3974
+ get_cookie_header,
3975
+ set_internal
3976
+ });
3977
+ if (state.emulator?.platform) event.platform = await state.emulator.platform({
3978
+ config: {},
3979
+ prerender: !!state.prerendering?.fallback
3980
+ });
3981
+ /** @type {string | null} */
3982
+ let resolved_path = url.pathname;
3983
+ if (!remote_id) {
3984
+ const prerendering_reroute_state = state.prerendering?.inside_reroute;
3985
+ try {
3986
+ if (state.prerendering) state.prerendering.inside_reroute = true;
3987
+ resolved_path = await options.hooks.reroute({
3988
+ url: new URL(url),
3989
+ fetch: event.fetch
3990
+ }) ?? url.pathname;
3991
+ } catch {
3992
+ return text("Internal Server Error", { status: 500 });
3993
+ } finally {
3994
+ if (state.prerendering) state.prerendering.inside_reroute = prerendering_reroute_state;
3995
+ }
3996
+ }
3997
+ /** @type {import('types').RequiredResolveOptions} */
3998
+ let resolve_opts = {
3999
+ transformPageChunk: default_transform,
4000
+ filterSerializedResponseHeaders: default_filter,
4001
+ preload: default_preload
4002
+ };
4003
+ /** @type {import('types').TrailingSlash} */
4004
+ let trailing_slash = "never";
4005
+ /** @type {PageNodes | undefined} */
4006
+ let page_nodes;
4007
+ try {
4008
+ resolved_path = decode_pathname(resolved_path);
4009
+ } catch {
4010
+ resolved_path = null;
4011
+ return await handle();
4012
+ }
4013
+ if (resolved_path !== decode_pathname(url.pathname) && !state.prerendering?.fallback && has_prerendered_path(manifest, resolved_path)) {
4014
+ const url = new URL(request.url);
4015
+ url.pathname = is_data_request ? add_data_suffix(resolved_path) : is_route_resolution_request ? add_resolution_suffix(resolved_path) : resolved_path;
4016
+ try {
4017
+ const response = await fetch(url, request);
4018
+ const headers = new Headers(response.headers);
4019
+ if (headers.has("content-encoding")) {
4020
+ headers.delete("content-encoding");
4021
+ headers.delete("content-length");
4022
+ }
4023
+ return new Response(response.body, {
4024
+ headers,
4025
+ status: response.status,
4026
+ statusText: response.statusText
4027
+ });
4028
+ } catch (error) {
4029
+ return await handle_fatal_error(event, event_state, options, error);
4030
+ }
4031
+ }
4032
+ /** @type {import('types').SSRRoute | null} */
4033
+ let route = null;
4034
+ if (base && !state.prerendering?.fallback) {
4035
+ if (!resolved_path.startsWith(base)) return text("Not found", { status: 404 });
4036
+ resolved_path = resolved_path.slice(base.length) || "/";
4037
+ }
4038
+ if (is_route_resolution_request) return resolve_route(resolved_path, new URL(request.url), manifest);
4039
+ if (resolved_path === `/_app/env.js` || resolved_path === `/_app/env.script.js`) return get_public_env(request);
4040
+ if (!remote_id && resolved_path.startsWith(`/_app`)) {
4041
+ const headers = new Headers();
4042
+ headers.set("cache-control", "public, max-age=0, must-revalidate");
4043
+ return text("Not found", {
4044
+ status: 404,
4045
+ headers
4046
+ });
4047
+ }
4048
+ if (!state.prerendering?.fallback) {
4049
+ const matchers = await manifest._.matchers();
4050
+ const result = find_route(resolved_path, manifest._.routes, matchers);
4051
+ if (result) {
4052
+ route = result.route;
4053
+ event.route = { id: route.id };
4054
+ event.params = result.params;
4055
+ }
4056
+ }
4057
+ try {
4058
+ page_nodes = route?.page ? new PageNodes(await load_page_nodes(route.page, manifest)) : void 0;
4059
+ if (route && !remote_id) {
4060
+ if (url.pathname === base || url.pathname === base + "/") trailing_slash = "always";
4061
+ else if (page_nodes) trailing_slash = page_nodes.trailing_slash();
4062
+ else if (route.endpoint) trailing_slash = (await route.endpoint()).trailingSlash ?? "never";
4063
+ if (!is_data_request) {
4064
+ const normalized = normalize_path(url.pathname, trailing_slash);
4065
+ if (normalized !== url.pathname && !state.prerendering?.fallback) return new Response(void 0, {
4066
+ status: 308,
4067
+ headers: {
4068
+ "x-sveltekit-normalize": "1",
4069
+ location: (normalized.startsWith("//") ? url.origin + normalized : normalized) + (url.search === "?" ? "" : url.search)
4070
+ }
4071
+ });
4072
+ }
4073
+ if (state.before_handle || state.emulator?.platform) {
4074
+ let config = {};
4075
+ /** @type {import('types').PrerenderOption} */
4076
+ let prerender = false;
4077
+ if (route.endpoint) {
4078
+ const node = await route.endpoint();
4079
+ config = node.config ?? config;
4080
+ prerender = node.prerender ?? prerender;
4081
+ } else if (page_nodes) {
4082
+ config = page_nodes.get_config() ?? config;
4083
+ prerender = page_nodes.prerender();
4084
+ }
4085
+ if (state.emulator?.platform) event.platform = await state.emulator.platform({
4086
+ config,
4087
+ prerender
4088
+ });
4089
+ if (state.before_handle) return await state.before_handle(event, config, prerender, handle);
4090
+ }
4091
+ }
4092
+ return await handle();
4093
+ } catch (e) {
4094
+ if (e instanceof Redirect) try {
4095
+ const response = is_data_request || remote_id ? redirect_json_response(e) : route?.page && is_action_json_request(event) ? action_json_redirect(e) : redirect_response(e.status, e.location);
4096
+ add_cookies_to_headers(response.headers, new_cookies.values());
4097
+ return response;
4098
+ } catch (err) {
4099
+ return await handle_fatal_error(event, event_state, options, err);
4100
+ }
4101
+ return await handle_fatal_error(event, event_state, options, e);
4102
+ }
4103
+ async function handle() {
4104
+ set_trailing_slash(trailing_slash);
4105
+ if (state.prerendering && !state.prerendering.fallback && !state.prerendering.inside_reroute) disable_search(url);
4106
+ const response = await record_span({
4107
+ name: "sveltekit.handle.root",
4108
+ attributes: {
4109
+ "http.route": event.route.id || "unknown",
4110
+ "http.method": event.request.method,
4111
+ "http.url": event.url.href,
4112
+ "sveltekit.is_sub_request": event.isSubRequest
4113
+ },
4114
+ fn: async (root_span) => {
4115
+ const traced_event = {
4116
+ ...event,
4117
+ tracing: {
4118
+ enabled: false,
4119
+ root: root_span,
4120
+ current: root_span
4121
+ }
4122
+ };
4123
+ return await with_request_store({
4124
+ event: traced_event,
4125
+ state: event_state
4126
+ }, () => options.hooks.handle({
4127
+ event: traced_event,
4128
+ resolve: (event, opts) => {
4129
+ return record_span({
4130
+ name: "sveltekit.resolve",
4131
+ attributes: { "http.route": event.route.id || "unknown" },
4132
+ fn: (resolve_span) => {
4133
+ return with_request_store(null, () => resolve(merge_tracing(event, resolve_span), page_nodes, opts).then((response) => {
4134
+ for (const key in headers) {
4135
+ const value = headers[key];
4136
+ response.headers.set(key, value);
4137
+ }
4138
+ add_cookies_to_headers(response.headers, new_cookies.values());
4139
+ if (state.prerendering && event.route.id !== null) response.headers.set("x-sveltekit-routeid", encodeURI(event.route.id));
4140
+ resolve_span.setAttributes({
4141
+ "http.response.status_code": response.status,
4142
+ "http.response.body.size": response.headers.get("content-length") || "unknown"
4143
+ });
4144
+ return response;
4145
+ }));
4146
+ }
4147
+ });
4148
+ }
4149
+ }));
4150
+ }
4151
+ });
4152
+ if (response.status === 200 && response.headers.has("etag")) {
4153
+ let if_none_match_value = request.headers.get("if-none-match");
4154
+ if (if_none_match_value?.startsWith("W/\"")) if_none_match_value = if_none_match_value.substring(2);
4155
+ const etag = response.headers.get("etag");
4156
+ if (if_none_match_value === etag) {
4157
+ const headers = new Headers({ etag });
4158
+ for (const key of [
4159
+ "cache-control",
4160
+ "content-location",
4161
+ "date",
4162
+ "expires",
4163
+ "vary"
4164
+ ]) {
4165
+ const value = response.headers.get(key);
4166
+ if (value) headers.set(key, value);
4167
+ }
4168
+ for (const cookie of get_set_cookies(response.headers)) headers.append("set-cookie", cookie);
4169
+ return new Response(void 0, {
4170
+ status: 304,
4171
+ headers
4172
+ });
4173
+ }
4174
+ }
4175
+ if (is_data_request && response.status >= 300 && response.status <= 308) {
4176
+ const location = response.headers.get("location");
4177
+ if (location) return redirect_json_response(new Redirect(response.status, location));
4178
+ }
4179
+ return response;
4180
+ }
4181
+ /**
4182
+ * @param {import('@sveltejs/kit').RequestEvent} event
4183
+ * @param {PageNodes | undefined} page_nodes
4184
+ * @param {import('@sveltejs/kit').ResolveOptions} [opts]
4185
+ */
4186
+ async function resolve(event, page_nodes, opts) {
4187
+ try {
4188
+ if (opts) resolve_opts = {
4189
+ transformPageChunk: opts.transformPageChunk || default_transform,
4190
+ filterSerializedResponseHeaders: opts.filterSerializedResponseHeaders || default_filter,
4191
+ preload: opts.preload || default_preload
4192
+ };
4193
+ if (resolved_path === null) return await respond_with_error({
4194
+ event,
4195
+ event_state,
4196
+ options,
4197
+ manifest,
4198
+ state,
4199
+ status: 400,
4200
+ error: new SvelteKitError(400, "Malformed URI", `Failed to decode URI: ${event.url.pathname}`),
4201
+ resolve_opts
4202
+ });
4203
+ if (options.hash_routing || state.prerendering?.fallback) return await render_response({
4204
+ event,
4205
+ event_state,
4206
+ options,
4207
+ manifest,
4208
+ state,
4209
+ page_config: {
4210
+ ssr: false,
4211
+ csr: true
4212
+ },
4213
+ status: 200,
4214
+ error: null,
4215
+ branch: [{
4216
+ node: await manifest._.nodes[0](),
4217
+ data: null,
4218
+ server_data: null
4219
+ }],
4220
+ fetched: [],
4221
+ resolve_opts,
4222
+ data_serializer: server_data_serializer(event, event_state, options)
4223
+ });
4224
+ if (remote_id) return await handle_remote_call(event, event_state, options, manifest, remote_id);
4225
+ if (route) {
4226
+ const method = event.request.method;
4227
+ /** @type {Response} */
4228
+ let response;
4229
+ if (is_data_request) response = await render_data(event, event_state, route, options, manifest, state, invalidated_data_nodes, trailing_slash);
4230
+ else if (route.endpoint && (!route.page || is_endpoint_request(event))) response = await render_endpoint(event, event_state, await route.endpoint(), state);
4231
+ else if (route.page) if (!page_nodes) throw new Error("page_nodes not found. This should never happen");
4232
+ else if (page_methods.has(method)) response = await render_page(event, event_state, route.page, options, manifest, state, page_nodes, resolve_opts);
4233
+ else {
4234
+ const allowed_methods = new Set(allowed_page_methods);
4235
+ if ((await manifest._.nodes[route.page.leaf]())?.server?.actions) allowed_methods.add("POST");
4236
+ if (method === "OPTIONS") response = new Response(null, {
4237
+ status: 204,
4238
+ headers: { allow: Array.from(allowed_methods.values()).join(", ") }
4239
+ });
4240
+ else response = method_not_allowed([...allowed_methods].reduce((acc, curr) => {
4241
+ acc[curr] = true;
4242
+ return acc;
4243
+ }, {}), method);
4244
+ }
4245
+ else throw new Error("Route is neither page nor endpoint. This should never happen");
4246
+ if (request.method === "GET" && route.page && route.endpoint) {
4247
+ const vary = response.headers.get("vary")?.split(",")?.map((v) => v.trim().toLowerCase());
4248
+ if (!(vary?.includes("accept") || vary?.includes("*"))) {
4249
+ response = new Response(response.body, {
4250
+ status: response.status,
4251
+ statusText: response.statusText,
4252
+ headers: new Headers(response.headers)
4253
+ });
4254
+ response.headers.append("Vary", "Accept");
4255
+ }
4256
+ }
4257
+ return response;
4258
+ }
4259
+ if (state.error && event.isSubRequest) {
4260
+ const headers = new Headers(request.headers);
4261
+ headers.set("x-sveltekit-error", "true");
4262
+ return await fetch(request, { headers });
4263
+ }
4264
+ if (state.error) return text("Internal Server Error", { status: 500 });
4265
+ if (state.depth === 0) return await respond_with_error({
4266
+ event,
4267
+ event_state,
4268
+ options,
4269
+ manifest,
4270
+ state,
4271
+ status: 404,
4272
+ error: new SvelteKitError(404, "Not Found", `Not found: ${event.url.pathname}`),
4273
+ resolve_opts
4274
+ });
4275
+ if (state.prerendering) return text("not found", { status: 404 });
4276
+ const response = await fetch(request);
4277
+ return new Response(response.body, response);
4278
+ } catch (e) {
4279
+ return await handle_fatal_error(event, event_state, options, e);
4280
+ } finally {
4281
+ event.cookies.set = () => {
4282
+ throw new Error("Cannot use `cookies.set(...)` after the response has been generated");
4283
+ };
4284
+ event.setHeaders = () => {
4285
+ throw new Error("Cannot use `setHeaders(...)` after the response has been generated");
4286
+ };
4287
+ }
4288
+ }
4289
+ }
4290
+ /**
4291
+ * @param {import('types').PageNodeIndexes} page
4292
+ * @param {import('@sveltejs/kit').SSRManifest} manifest
4293
+ */
4294
+ function load_page_nodes(page, manifest) {
4295
+ return Promise.all([...page.layouts.map((n) => n == void 0 ? n : manifest._.nodes[n]()), manifest._.nodes[page.leaf]()]);
4296
+ }
4297
+ /**
4298
+ * It's likely that, in a distributed system, there are spans starting outside the SvelteKit server -- eg.
4299
+ * started on the frontend client, or in a service that calls the SvelteKit server. There are standardized
4300
+ * ways to represent this context in HTTP headers, so we can extract that context and run our tracing inside of it
4301
+ * so that when our traces are exported, they are associated with the correct parent context.
4302
+ * @param {typeof internal_respond} fn
4303
+ * @returns {typeof internal_respond}
4304
+ */
4305
+ function propagate_context(fn) {
4306
+ return async (req, ...rest) => {
4307
+ return fn(req, ...rest);
4308
+ };
4309
+ }
4310
+ //#endregion
4311
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/utils/env.js
4312
+ /**
4313
+ * @param {Record<string, string>} env
4314
+ * @param {string} allowed
4315
+ * @param {string} disallowed
4316
+ * @returns {Record<string, string>}
4317
+ */
4318
+ function filter_env(env, allowed, disallowed) {
4319
+ return Object.fromEntries(Object.entries(env).filter(([k]) => k.startsWith(allowed) && (disallowed === "" || !k.startsWith(disallowed))));
4320
+ }
4321
+ //#endregion
4322
+ //#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/server/index.js
4323
+ /** @import { PromiseWithResolvers } from '../../utils/promise.js' */
4324
+ /** @type {Promise<any>} */
4325
+ var init_promise;
4326
+ /** @type {Promise<void> | null} */
4327
+ var current = null;
4328
+ var Server = class {
4329
+ /** @type {import('types').SSROptions} */
4330
+ #options;
4331
+ /** @type {import('@sveltejs/kit').SSRManifest} */
4332
+ #manifest;
4333
+ /** @param {import('@sveltejs/kit').SSRManifest} manifest */
4334
+ constructor(manifest) {
4335
+ /** @type {import('types').SSROptions} */
4336
+ this.#options = options;
4337
+ this.#manifest = manifest;
4338
+ if (IN_WEBCONTAINER) {
4339
+ const respond = this.respond.bind(this);
4340
+ /** @type {typeof respond} */
4341
+ this.respond = async (...args) => {
4342
+ const { promise, resolve } = with_resolvers();
4343
+ const previous = current;
4344
+ current = promise;
4345
+ await previous;
4346
+ return respond(...args).finally(resolve);
4347
+ };
4348
+ }
4349
+ }
4350
+ /**
4351
+ * @param {import('@sveltejs/kit').ServerInitOptions} opts
4352
+ */
4353
+ async init({ env, read }) {
4354
+ const { env_public_prefix, env_private_prefix } = this.#options;
4355
+ set_private_env(filter_env(env, env_private_prefix, env_public_prefix));
4356
+ set_public_env(filter_env(env, env_public_prefix, env_private_prefix));
4357
+ if (read) {
4358
+ /** @param {string} file */
4359
+ const wrapped_read = (file) => {
4360
+ const result = read(file);
4361
+ if (result instanceof ReadableStream) return result;
4362
+ else return new ReadableStream({ async start(controller) {
4363
+ try {
4364
+ const stream = await Promise.resolve(result);
4365
+ if (!stream) {
4366
+ controller.close();
4367
+ return;
4368
+ }
4369
+ const reader = stream.getReader();
4370
+ while (true) {
4371
+ const { done, value } = await reader.read();
4372
+ if (done) break;
4373
+ controller.enqueue(value);
4374
+ }
4375
+ controller.close();
4376
+ } catch (error) {
4377
+ controller.error(error);
4378
+ }
4379
+ } });
4380
+ };
4381
+ set_read_implementation(wrapped_read);
4382
+ }
4383
+ await (init_promise ??= (async () => {
4384
+ try {
4385
+ const module = await get_hooks();
4386
+ this.#options.hooks = {
4387
+ handle: module.handle || (({ event, resolve }) => resolve(event)),
4388
+ handleError: module.handleError || (({ status, error, event }) => {
4389
+ const error_message = format_server_error(status, error, event);
4390
+ console.error(error_message);
4391
+ }),
4392
+ handleFetch: module.handleFetch || (({ request, fetch }) => fetch(request)),
4393
+ handleValidationError: module.handleValidationError || (({ issues }) => {
4394
+ console.error("Remote function schema validation failed:", issues);
4395
+ return { message: "Bad Request" };
4396
+ }),
4397
+ reroute: module.reroute || noop,
4398
+ transport: module.transport || {}
4399
+ };
4400
+ module.transport && Object.fromEntries(Object.entries(module.transport).map(([k, v]) => [k, v.decode]));
4401
+ if (module.init) await module.init();
4402
+ } catch (e) {
4403
+ throw e;
4404
+ }
4405
+ })());
4406
+ }
4407
+ /**
4408
+ * @param {Request} request
4409
+ * @param {import('types').RequestOptions} options
4410
+ */
4411
+ async respond(request, options) {
4412
+ return respond(request, this.#options, this.#manifest, {
4413
+ ...options,
4414
+ error: false,
4415
+ depth: 0
4416
+ });
4417
+ }
4418
+ };
4419
+
4420
+ export { Server };
4421
+ //# sourceMappingURL=index.js.map