@celsoft/coordinator 0.0.0 → 0.1.0
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.
- package/CHANGELOG.md +11 -0
- package/README.md +107 -0
- package/THIRD_PARTY_NOTICES.md +2005 -0
- package/agents/console.md +20 -0
- package/agents/free.md +110 -0
- package/build/0-JP6XL6LB.js +17 -0
- package/build/1-A52YZWNS.js +17 -0
- package/build/2-CLH2NM6F.js +32 -0
- package/build/3-4N467IB6.js +45 -0
- package/build/4-WL5H4LUW.js +29 -0
- package/build/_layout.svelte-KPUSX7LQ.js +27 -0
- package/build/_page.svelte-22H56UR6.js +7972 -0
- package/build/_page.svelte-CVWUNRQC.js +135 -0
- package/build/_page.svelte-LTZXBHMT.js +57 -0
- package/build/_server.ts-3KVBYN6P.js +20 -0
- package/build/_server.ts-3POPKVEM.js +47 -0
- package/build/_server.ts-5735T2V5.js +31 -0
- package/build/_server.ts-5VXGNWV2.js +38 -0
- package/build/_server.ts-645KP7WP.js +42 -0
- package/build/_server.ts-A3AA24Z2.js +28 -0
- package/build/_server.ts-CITUOEM6.js +58 -0
- package/build/_server.ts-I7HMTPOA.js +25 -0
- package/build/_server.ts-M5BQ4LLX.js +30 -0
- package/build/_server.ts-OB4O27HF.js +683 -0
- package/build/_server.ts-OJT7HE7M.js +15 -0
- package/build/_server.ts-OYGWVLZM.js +12 -0
- package/build/_server.ts-T75UVMQP.js +38 -0
- package/build/_server.ts-WYZYNHUZ.js +28 -0
- package/build/_server.ts-Z26EB47B.js +486 -0
- package/build/chunk-4CIG53L5.js +33 -0
- package/build/chunk-BJTJS3XY.js +338 -0
- package/build/chunk-F2CNWJZM.js +14 -0
- package/build/chunk-HGYE3UTU.js +416 -0
- package/build/chunk-KAYW2W7H.js +1311 -0
- package/build/chunk-LFP3UPCM.js +10 -0
- package/build/chunk-M44JEFEH.js +62 -0
- package/build/chunk-MC5AGLMY.js +39 -0
- package/build/chunk-NCZ77J5E.js +19798 -0
- package/build/chunk-NVNLDPUJ.js +2122 -0
- package/build/chunk-PDCON4KS.js +494 -0
- package/build/chunk-Q4OQNY5M.js +25 -0
- package/build/chunk-QCUOR2U5.js +75 -0
- package/build/chunk-R6RYZZWA.js +46 -0
- package/build/chunk-SOJTASZC.js +51 -0
- package/build/chunk-SU26PJVX.js +410 -0
- package/build/chunk-U5BSBG4R.js +506 -0
- package/build/chunk-UEKOZGRO.js +37 -0
- package/build/chunk-W6EFUWJ2.js +9 -0
- package/build/chunk-WOPREK6Q.js +117 -0
- package/build/chunk-WWJ3F4QS.js +127 -0
- package/build/chunk-ZGZJEEE3.js +1091 -0
- package/build/client/_app/immutable/assets/0.BGa5ZNDM.css +1 -0
- package/build/client/_app/immutable/chunks/BUrrLYDt.js +2 -0
- package/build/client/_app/immutable/chunks/BgFr_EyZ.js +4 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js +82 -0
- package/build/client/_app/immutable/chunks/C8qZab0y.js +56 -0
- package/build/client/_app/immutable/chunks/C90fLsA5.js +4 -0
- package/build/client/_app/immutable/chunks/CRzLMJPS.js +1 -0
- package/build/client/_app/immutable/chunks/DLT1iIlz.js +2 -0
- package/build/client/_app/immutable/chunks/pIrVVOVY.js +2 -0
- package/build/client/_app/immutable/entry/app.0DERehLW.js +3 -0
- package/build/client/_app/immutable/entry/payload.DSmR2FwN.js +2 -0
- package/build/client/_app/immutable/entry/start.B7srFiqh.js +3 -0
- package/build/client/_app/immutable/nodes/0.aD9vJoxR.js +2 -0
- package/build/client/_app/immutable/nodes/1.Br4FL91i.js +2 -0
- package/build/client/_app/immutable/nodes/2.vl6OYfu3.js +8 -0
- package/build/client/_app/immutable/nodes/3.VYqJOLAF.js +2 -0
- package/build/client/_app/immutable/nodes/4.jF9UVlFN.js +2 -0
- package/build/client/_app/version.json +1 -0
- package/build/client/apple-touch-icon.png +0 -0
- package/build/client/favicon.ico +0 -0
- package/build/client/favicon.svg +48 -0
- package/build/client/icon-192.png +0 -0
- package/build/client/icon-512.png +0 -0
- package/build/client/icon-maskable-512.png +0 -0
- package/build/client/icon.svg +44 -0
- package/build/client/manifest.webmanifest +15 -0
- package/build/error.svelte-JXZDY65F.js +51 -0
- package/build/handler.js +716 -0
- package/build/hooks.server-34IMHRKC.js +43 -0
- package/build/instance-NP3FJIWW.js +2967 -0
- package/client/client.mjs +28 -0
- package/client/hooks.mjs +7 -0
- package/client/register.mjs +5 -0
- package/dist/cli.js +62826 -0
- package/dist/port.js +36691 -0
- package/package.json +20 -1
- package/skills/agents/.claude-plugin/plugin.json +5 -0
- package/skills/agents/hooks/hooks.json +1 -0
- package/skills/agents/hooks/register.ts +57 -0
- package/skills/agents/skills/bus-work/SKILL.md +66 -0
- package/skills/agents/skills/plan/SKILL.md +98 -0
- package/skills/console/.claude-plugin/plugin.json +5 -0
- package/skills/console/hooks/hooks.json +1 -0
- package/skills/console/hooks/register.ts +10 -0
- package/skills/console/skills/bus/SKILL.md +61 -0
- package/skills/default/.claude-plugin/plugin.json +5 -0
- package/skills/default/skills/git-workflow/SKILL.md +294 -0
- package/skills/default/skills/git-workflow/mise-tasks/_lib.sh +107 -0
- package/skills/default/skills/git-workflow/mise-tasks/clone +36 -0
- package/skills/default/skills/git-workflow/mise-tasks/repo-list +8 -0
- package/skills/default/skills/git-workflow/mise-tasks/unpushed +26 -0
- package/skills/default/skills/git-workflow/mise-tasks/worktree-add +60 -0
- package/skills/default/skills/github/SKILL.md +208 -0
- package/skills/default/skills/github/scripts/gh-org +196 -0
- package/skills/default/skills/plan-page/SKILL.md +300 -0
- package/skills/default/skills/plan-page/assets/index.html +854 -0
- package/skills/default/skills/plan-page/scripts/inline +46 -0
- package/skills/default/skills/plan-page/scripts/stage +26 -0
- package/skills/default/skills/secrets/SKILL.md +134 -0
- package/skills/default/skills/secrets/scripts/secrets-check +87 -0
- package/skills/default/skills/writing-style/SKILL.md +45 -0
- package/skills/extra/.claude-plugin/plugin.json +5 -0
- package/skills/extra/skills/artifacts/SKILL.md +52 -0
- package/skills/extra/skills/github-actions/SKILL.md +78 -0
- package/skills/extra/skills/github-actions/scan +32 -0
- package/skills/extra/skills/markdown-review/SKILL.md +70 -0
- package/skills/extra/skills/markdown-review/assets/index.html +201 -0
- package/skills/extra/skills/markdown-review/scripts/stage +36 -0
- package/skills/extra/skills/mise-usage/SKILL.md +155 -0
- package/skills/extra/skills/plugin-authoring/SKILL.md +317 -0
- package/skills/extra/skills/project-conventions/SKILL.md +64 -0
- package/skills/extra/skills/questions/SKILL.md +156 -0
- package/skills/extra/skills/questions/assets/index.html +376 -0
- package/skills/extra/skills/questions/scripts/stage +26 -0
- package/skills/extra/skills/serve/SKILL.md +165 -0
- package/skills/extra/skills/serve/scripts/serve +268 -0
- package/skills/extra/skills/serve/scripts/server.py +345 -0
- package/skills/extra/skills/skill-dependencies/SKILL.md +65 -0
- package/skills/extra/skills/skill-maintenance/SKILL.md +101 -0
- package/skills/extra/skills/ticketing/SKILL.md +125 -0
|
@@ -0,0 +1,2122 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ActionFailure,
|
|
4
|
+
HandledHttpError,
|
|
5
|
+
HttpError,
|
|
6
|
+
Redirect,
|
|
7
|
+
SvelteKitError,
|
|
8
|
+
ValidationError,
|
|
9
|
+
error,
|
|
10
|
+
merge_tracing,
|
|
11
|
+
record_span,
|
|
12
|
+
text,
|
|
13
|
+
with_request_store
|
|
14
|
+
} from "./chunk-SU26PJVX.js";
|
|
15
|
+
import {
|
|
16
|
+
action_data_not_serializable,
|
|
17
|
+
action_default_with_named,
|
|
18
|
+
action_name_reserved,
|
|
19
|
+
action_response_not_serializable,
|
|
20
|
+
action_throw_fail,
|
|
21
|
+
capture_error,
|
|
22
|
+
handle_error_hook_failed,
|
|
23
|
+
load_not_plain_object,
|
|
24
|
+
load_not_serializable,
|
|
25
|
+
server_api_unavailable,
|
|
26
|
+
url_search_unavailable_prerender
|
|
27
|
+
} from "./chunk-WWJ3F4QS.js";
|
|
28
|
+
import {
|
|
29
|
+
DevalueError,
|
|
30
|
+
MAX_ARRAY_INDEX,
|
|
31
|
+
enumerable_symbols,
|
|
32
|
+
get_type,
|
|
33
|
+
is_buffer,
|
|
34
|
+
is_plain_object,
|
|
35
|
+
is_valid_array_index,
|
|
36
|
+
is_valid_array_len,
|
|
37
|
+
stringify_key,
|
|
38
|
+
stringify_string,
|
|
39
|
+
uneval,
|
|
40
|
+
valid_array_indices
|
|
41
|
+
} from "./chunk-U5BSBG4R.js";
|
|
42
|
+
|
|
43
|
+
// build/server/chunks/internal.js
|
|
44
|
+
var verbose = false;
|
|
45
|
+
function enable_verbose_errors() {
|
|
46
|
+
verbose = true;
|
|
47
|
+
}
|
|
48
|
+
function throw_error(code, message, caller) {
|
|
49
|
+
const error2 = /* @__PURE__ */ new Error(`${code}
|
|
50
|
+
${message}
|
|
51
|
+
https://svelte.dev/e/kit/${code}`);
|
|
52
|
+
error2.name = "SvelteKit error";
|
|
53
|
+
Error.captureStackTrace?.(error2, caller);
|
|
54
|
+
throw error2;
|
|
55
|
+
}
|
|
56
|
+
var assets = "";
|
|
57
|
+
var app_dir = "_app";
|
|
58
|
+
function set_assets(path2) {
|
|
59
|
+
assets = path2;
|
|
60
|
+
}
|
|
61
|
+
var symbol = Symbol.for("sveltekit.global_state");
|
|
62
|
+
var state = globalThis[symbol] ??= {};
|
|
63
|
+
var text_encoder = new TextEncoder();
|
|
64
|
+
function stream_from_iterable(iterable) {
|
|
65
|
+
if (ReadableStream.from) return ReadableStream.from(iterable);
|
|
66
|
+
const iterator = iterable[Symbol.asyncIterator]();
|
|
67
|
+
return new ReadableStream({
|
|
68
|
+
async pull(controller) {
|
|
69
|
+
const { value, done } = await iterator.next();
|
|
70
|
+
if (done) controller.close();
|
|
71
|
+
else controller.enqueue(value);
|
|
72
|
+
},
|
|
73
|
+
async cancel(reason) {
|
|
74
|
+
await iterator.return?.(reason);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function stream_text(head, chunks) {
|
|
79
|
+
return stream_from_iterable((async function* () {
|
|
80
|
+
yield text_encoder.encode(head);
|
|
81
|
+
for await (const chunk of chunks) if (chunk) yield text_encoder.encode(chunk);
|
|
82
|
+
})());
|
|
83
|
+
}
|
|
84
|
+
var text_decoder = new TextDecoder();
|
|
85
|
+
function base64_encode(bytes) {
|
|
86
|
+
if (globalThis.Buffer) return globalThis.Buffer.from(bytes).toString("base64");
|
|
87
|
+
let binary = "";
|
|
88
|
+
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
89
|
+
return btoa(binary);
|
|
90
|
+
}
|
|
91
|
+
function base64_decode(encoded) {
|
|
92
|
+
if (globalThis.Buffer) {
|
|
93
|
+
const buffer2 = globalThis.Buffer.from(encoded, "base64");
|
|
94
|
+
return new Uint8Array(buffer2);
|
|
95
|
+
}
|
|
96
|
+
const binary = atob(encoded);
|
|
97
|
+
const bytes = new Uint8Array(binary.length);
|
|
98
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
99
|
+
return bytes;
|
|
100
|
+
}
|
|
101
|
+
var DATA_SUFFIX = "/__data.json";
|
|
102
|
+
var HTML_DATA_SUFFIX = ".html__data.json";
|
|
103
|
+
function has_data_suffix(pathname) {
|
|
104
|
+
return pathname.endsWith(DATA_SUFFIX) || pathname.endsWith(HTML_DATA_SUFFIX);
|
|
105
|
+
}
|
|
106
|
+
function add_data_suffix(pathname) {
|
|
107
|
+
if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_DATA_SUFFIX);
|
|
108
|
+
return pathname.replace(/\/$/, "") + DATA_SUFFIX;
|
|
109
|
+
}
|
|
110
|
+
function strip_data_suffix(pathname) {
|
|
111
|
+
if (pathname.endsWith(HTML_DATA_SUFFIX)) return pathname.slice(0, -16) + ".html";
|
|
112
|
+
return pathname.slice(0, -12);
|
|
113
|
+
}
|
|
114
|
+
var ROUTE_SUFFIX = "/__route.js";
|
|
115
|
+
var HTML_ROUTE_SUFFIX = ".html__route.js";
|
|
116
|
+
function has_resolution_suffix(pathname) {
|
|
117
|
+
return pathname.endsWith(ROUTE_SUFFIX) || pathname.endsWith(HTML_ROUTE_SUFFIX);
|
|
118
|
+
}
|
|
119
|
+
function add_resolution_suffix(pathname) {
|
|
120
|
+
if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_ROUTE_SUFFIX);
|
|
121
|
+
return pathname.replace(/\/$/, "") + ROUTE_SUFFIX;
|
|
122
|
+
}
|
|
123
|
+
function strip_resolution_suffix(pathname) {
|
|
124
|
+
if (pathname.endsWith(HTML_ROUTE_SUFFIX)) return pathname.slice(0, -15) + ".html";
|
|
125
|
+
return pathname.slice(0, -11);
|
|
126
|
+
}
|
|
127
|
+
function form_field_array_conflict(_values) {
|
|
128
|
+
if (verbose) throw_error("form_field_array_conflict", `Invalid array key \`${_values.key}\``, form_field_array_conflict);
|
|
129
|
+
throw new Error("https://svelte.dev/e/kit/form_field_array_conflict");
|
|
130
|
+
}
|
|
131
|
+
function form_field_duplicate(_values) {
|
|
132
|
+
if (verbose) throw_error("form_field_duplicate", `Form cannot contain duplicated keys \u2014 \`${_values.name}\` has ${_values.count} values`, form_field_duplicate);
|
|
133
|
+
throw new Error("https://svelte.dev/e/kit/form_field_duplicate");
|
|
134
|
+
}
|
|
135
|
+
function form_field_forbidden_key(_values) {
|
|
136
|
+
if (verbose) throw_error("form_field_forbidden_key", `Invalid key \`${_values.key}\`: This key is not allowed to prevent prototype pollution.`, form_field_forbidden_key);
|
|
137
|
+
throw new Error("https://svelte.dev/e/kit/form_field_forbidden_key");
|
|
138
|
+
}
|
|
139
|
+
function form_field_invalid_name(_values) {
|
|
140
|
+
if (verbose) throw_error("form_field_invalid_name", `Invalid field name \`${_values.name}\`: field names are written in JS object notation, so keys that would need quoting are not supported. See https://svelte.dev/docs/kit/remote-functions#form-Fields`, form_field_invalid_name);
|
|
141
|
+
throw new Error("https://svelte.dev/e/kit/form_field_invalid_name");
|
|
142
|
+
}
|
|
143
|
+
function form_field_unbound(_values) {
|
|
144
|
+
if (verbose) throw_error("form_field_unbound", `Form contained a field that wasn't created with \`form.fields.as(...)\`: \`${_values.name}\``, form_field_unbound);
|
|
145
|
+
throw new Error("https://svelte.dev/e/kit/form_field_unbound");
|
|
146
|
+
}
|
|
147
|
+
function invalid_export(_values) {
|
|
148
|
+
if (verbose) throw_error("invalid_export", _values?.file !== void 0 ? `Invalid export \`${_values.key}\` in \`${_values.file}\` (valid exports are ${_values.exports}, or anything with a \`'_'\` prefix)` : `Invalid export \`${_values.key}\` (valid exports are ${_values.exports}, or anything with a \`'_'\` prefix)`, invalid_export);
|
|
149
|
+
throw new Error("https://svelte.dev/e/kit/invalid_export");
|
|
150
|
+
}
|
|
151
|
+
function invalid_export_location(_values) {
|
|
152
|
+
if (verbose) throw_error("invalid_export_location", _values?.file !== void 0 ? `Invalid export \`${_values.key}\` in \`${_values.file}\` (\`${_values.key}\` is a valid export in ${_values.locations})` : `Invalid export \`${_values.key}\` (\`${_values.key}\` is a valid export in ${_values.locations})`, invalid_export_location);
|
|
153
|
+
throw new Error("https://svelte.dev/e/kit/invalid_export_location");
|
|
154
|
+
}
|
|
155
|
+
function param_matcher_async(_values) {
|
|
156
|
+
if (verbose) throw_error("param_matcher_async", `Async param matchers are not supported`, param_matcher_async);
|
|
157
|
+
throw new Error("https://svelte.dev/e/kit/param_matcher_async");
|
|
158
|
+
}
|
|
159
|
+
function param_matcher_result_invalid(_values) {
|
|
160
|
+
if (verbose) throw_error("param_matcher_result_invalid", `Param matcher must return a string, number, boolean, or bigint`, param_matcher_result_invalid);
|
|
161
|
+
throw new Error("https://svelte.dev/e/kit/param_matcher_result_invalid");
|
|
162
|
+
}
|
|
163
|
+
function url_hash_unavailable(_values) {
|
|
164
|
+
if (verbose) throw_error("url_hash_unavailable", `Cannot access \`event.url.hash\`. Consider using \`page.url.hash\` inside a component instead`, url_hash_unavailable);
|
|
165
|
+
throw new Error("https://svelte.dev/e/kit/url_hash_unavailable");
|
|
166
|
+
}
|
|
167
|
+
var escape_sequence_pattern = /\[([ux])\+([^\]]+)\]/;
|
|
168
|
+
function run_matcher(matcher, value) {
|
|
169
|
+
const result = matcher["~standard"].validate(value);
|
|
170
|
+
if (result instanceof Promise) param_matcher_async();
|
|
171
|
+
if (result.issues) return { success: false };
|
|
172
|
+
const parsed = result.value;
|
|
173
|
+
if (typeof parsed !== "string" && typeof parsed !== "number" && typeof parsed !== "boolean" && typeof parsed !== "bigint") param_matcher_result_invalid();
|
|
174
|
+
return {
|
|
175
|
+
success: true,
|
|
176
|
+
value: parsed
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function exec(match, params, matchers) {
|
|
180
|
+
const result = {};
|
|
181
|
+
const values = match.slice(1);
|
|
182
|
+
const values_needing_match = values.filter((value) => value !== void 0);
|
|
183
|
+
let buffered = 0;
|
|
184
|
+
for (let i = 0; i < params.length; i += 1) {
|
|
185
|
+
const param = params[i];
|
|
186
|
+
let value = values[i - buffered];
|
|
187
|
+
if (param.chained && param.rest && buffered) {
|
|
188
|
+
value = values.slice(i - buffered, i + 1).filter((s) => s).join("/");
|
|
189
|
+
buffered = 0;
|
|
190
|
+
}
|
|
191
|
+
if (value === void 0) {
|
|
192
|
+
if (param.rest) value = "";
|
|
193
|
+
else continue;
|
|
194
|
+
}
|
|
195
|
+
const decoded = decodeURIComponent(value);
|
|
196
|
+
if (param.matcher) {
|
|
197
|
+
const outcome = run_matcher(matchers[param.matcher], decoded);
|
|
198
|
+
if (!outcome.success) {
|
|
199
|
+
if (param.optional && param.chained) {
|
|
200
|
+
buffered++;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
result[param.name] = outcome.value;
|
|
206
|
+
} else result[param.name] = decoded;
|
|
207
|
+
const next_param = params[i + 1];
|
|
208
|
+
const next_value = values[i + 1];
|
|
209
|
+
if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) buffered = 0;
|
|
210
|
+
if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) buffered = 0;
|
|
211
|
+
}
|
|
212
|
+
if (buffered) return;
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
new RegExp(`${escape_sequence_pattern.source}|${/\[(\[)?(\.\.\.)?([\w-]+?)(?:=([\w-]+))?\]\]?/g.source}`, "g");
|
|
216
|
+
function find_route(path2, routes, matchers) {
|
|
217
|
+
for (const route of routes) {
|
|
218
|
+
const match = route.pattern.exec(path2);
|
|
219
|
+
if (!match) continue;
|
|
220
|
+
const matched = exec(match, route.params, matchers);
|
|
221
|
+
if (matched) return {
|
|
222
|
+
route,
|
|
223
|
+
params: matched
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
var internal = new URL("a://");
|
|
229
|
+
function resolve(base, path2) {
|
|
230
|
+
if (path2[0] === "/" && path2[1] === "/") return path2;
|
|
231
|
+
let url2 = new URL(base, internal);
|
|
232
|
+
url2 = new URL(path2, url2);
|
|
233
|
+
return url2.protocol === internal.protocol ? url2.pathname + url2.search + url2.hash : url2.href;
|
|
234
|
+
}
|
|
235
|
+
function relative_pathname(from, to) {
|
|
236
|
+
const segment = to.replace(/\/$/, "").split("/").at(-1);
|
|
237
|
+
return from.endsWith("/") ? `../${segment}` : `./${segment}/`;
|
|
238
|
+
}
|
|
239
|
+
function normalize_path(path2, trailing_slash) {
|
|
240
|
+
if (path2 === "/" || trailing_slash === "ignore") return path2;
|
|
241
|
+
if (trailing_slash === "never") return path2.endsWith("/") ? path2.slice(0, -1) : path2;
|
|
242
|
+
else if (trailing_slash === "always" && !path2.endsWith("/")) return path2 + "/";
|
|
243
|
+
return path2;
|
|
244
|
+
}
|
|
245
|
+
function decode_pathname(pathname) {
|
|
246
|
+
return pathname.split("%25").map(decodeURI).join("%25");
|
|
247
|
+
}
|
|
248
|
+
function make_trackable(url2, callback, search_params_callback, allow_hash = false) {
|
|
249
|
+
const tracked = new URL(url2);
|
|
250
|
+
Object.defineProperty(tracked, "searchParams", {
|
|
251
|
+
value: new Proxy(tracked.searchParams, { get(obj, key) {
|
|
252
|
+
if (key === "get" || key === "getAll" || key === "has") return (param, ...rest) => {
|
|
253
|
+
search_params_callback(param);
|
|
254
|
+
return obj[key](param, ...rest);
|
|
255
|
+
};
|
|
256
|
+
callback();
|
|
257
|
+
const value = Reflect.get(obj, key);
|
|
258
|
+
return typeof value === "function" ? value.bind(obj) : value;
|
|
259
|
+
} }),
|
|
260
|
+
enumerable: true,
|
|
261
|
+
configurable: true
|
|
262
|
+
});
|
|
263
|
+
const tracked_url_properties = [
|
|
264
|
+
"href",
|
|
265
|
+
"pathname",
|
|
266
|
+
"search",
|
|
267
|
+
"toString",
|
|
268
|
+
"toJSON"
|
|
269
|
+
];
|
|
270
|
+
if (allow_hash) tracked_url_properties.push("hash");
|
|
271
|
+
for (const property of tracked_url_properties) Object.defineProperty(tracked, property, {
|
|
272
|
+
get() {
|
|
273
|
+
callback();
|
|
274
|
+
return url2[property];
|
|
275
|
+
},
|
|
276
|
+
enumerable: true,
|
|
277
|
+
configurable: true
|
|
278
|
+
});
|
|
279
|
+
tracked[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
280
|
+
return inspect(url2, opts);
|
|
281
|
+
};
|
|
282
|
+
tracked.searchParams[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
283
|
+
return inspect(url2.searchParams, opts);
|
|
284
|
+
};
|
|
285
|
+
if (!allow_hash) disable_hash(tracked);
|
|
286
|
+
return tracked;
|
|
287
|
+
}
|
|
288
|
+
function disable_hash(url2) {
|
|
289
|
+
allow_nodejs_console_log(url2);
|
|
290
|
+
Object.defineProperty(url2, "hash", { get() {
|
|
291
|
+
return url_hash_unavailable();
|
|
292
|
+
} });
|
|
293
|
+
}
|
|
294
|
+
function disable_search(url2) {
|
|
295
|
+
allow_nodejs_console_log(url2);
|
|
296
|
+
for (const property of ["search", "searchParams"]) Object.defineProperty(url2, property, { get() {
|
|
297
|
+
return url_search_unavailable_prerender({ property });
|
|
298
|
+
} });
|
|
299
|
+
}
|
|
300
|
+
function allow_nodejs_console_log(url2) {
|
|
301
|
+
url2[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
|
|
302
|
+
return inspect(new URL(url2), opts);
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
var error_template_default = ({ status, message }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
|
|
306
|
+
|
|
307
|
+
<style>
|
|
308
|
+
body {
|
|
309
|
+
--bg: white;
|
|
310
|
+
--fg: #222;
|
|
311
|
+
--divider: #ccc;
|
|
312
|
+
background: var(--bg);
|
|
313
|
+
color: var(--fg);
|
|
314
|
+
font-family:
|
|
315
|
+
system-ui,
|
|
316
|
+
-apple-system,
|
|
317
|
+
BlinkMacSystemFont,
|
|
318
|
+
'Segoe UI',
|
|
319
|
+
Roboto,
|
|
320
|
+
Oxygen,
|
|
321
|
+
Ubuntu,
|
|
322
|
+
Cantarell,
|
|
323
|
+
'Open Sans',
|
|
324
|
+
'Helvetica Neue',
|
|
325
|
+
sans-serif;
|
|
326
|
+
display: flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
justify-content: center;
|
|
329
|
+
height: 100vh;
|
|
330
|
+
margin: 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.error {
|
|
334
|
+
display: flex;
|
|
335
|
+
align-items: center;
|
|
336
|
+
max-width: 32rem;
|
|
337
|
+
margin: 0 1rem;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.status {
|
|
341
|
+
font-weight: 200;
|
|
342
|
+
font-size: 3rem;
|
|
343
|
+
line-height: 1;
|
|
344
|
+
position: relative;
|
|
345
|
+
top: -0.05rem;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.message {
|
|
349
|
+
border-left: 1px solid var(--divider);
|
|
350
|
+
padding: 0 0 0 1rem;
|
|
351
|
+
margin: 0 0 0 1rem;
|
|
352
|
+
min-height: 2.5rem;
|
|
353
|
+
display: flex;
|
|
354
|
+
align-items: center;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.message h1 {
|
|
358
|
+
font-weight: 400;
|
|
359
|
+
font-size: 1em;
|
|
360
|
+
margin: 0;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
@media (prefers-color-scheme: dark) {
|
|
364
|
+
body {
|
|
365
|
+
--bg: #222;
|
|
366
|
+
--fg: #ddd;
|
|
367
|
+
--divider: #666;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
</style>
|
|
371
|
+
</head>
|
|
372
|
+
<body>
|
|
373
|
+
<div class="error">
|
|
374
|
+
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n";
|
|
375
|
+
var options = {
|
|
376
|
+
app_template_contains_nonce: false,
|
|
377
|
+
csp: {
|
|
378
|
+
"mode": "auto",
|
|
379
|
+
"directives": {
|
|
380
|
+
"upgrade-insecure-requests": false,
|
|
381
|
+
"block-all-mixed-content": false
|
|
382
|
+
},
|
|
383
|
+
"reportOnly": {
|
|
384
|
+
"upgrade-insecure-requests": false,
|
|
385
|
+
"block-all-mixed-content": false
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
csrf_trusted_origins: [],
|
|
389
|
+
service_worker_options: void 0,
|
|
390
|
+
templates: {
|
|
391
|
+
app: ({ head, body, assets: assets2, nonce, env }) => '<!doctype html>\n<html lang="en" data-theme="dark">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width,initial-scale=1" />\n <meta name="color-scheme" content="dark light" />\n <link rel="icon" href="' + assets2 + '/favicon.ico" sizes="48x48" />\n <link rel="icon" href="' + assets2 + '/favicon.svg" type="image/svg+xml" />\n <link rel="apple-touch-icon" href="' + assets2 + '/apple-touch-icon.png" />\n <link rel="manifest" href="' + assets2 + `/manifest.webmanifest" />
|
|
392
|
+
<script>
|
|
393
|
+
// Service Dark is dark first; light only when the system prefers it.
|
|
394
|
+
if (matchMedia('(prefers-color-scheme: light)').matches) document.documentElement.dataset.theme = 'light';
|
|
395
|
+
</script>
|
|
396
|
+
` + head + '\n </head>\n <body data-sveltekit-preload-data="off">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
|
|
397
|
+
error: error_template_default
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
async function get_hooks() {
|
|
401
|
+
let handle;
|
|
402
|
+
let handleFetch;
|
|
403
|
+
let handleError;
|
|
404
|
+
let init;
|
|
405
|
+
({ handle, handleFetch, handleError, init } = await import("./hooks.server-34IMHRKC.js"));
|
|
406
|
+
let reroute;
|
|
407
|
+
let transport;
|
|
408
|
+
return {
|
|
409
|
+
handle,
|
|
410
|
+
handleFetch,
|
|
411
|
+
handleError,
|
|
412
|
+
init,
|
|
413
|
+
reroute,
|
|
414
|
+
transport
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function encode_native(array_buffer) {
|
|
418
|
+
return new Uint8Array(array_buffer).toBase64();
|
|
419
|
+
}
|
|
420
|
+
function decode_native(base64) {
|
|
421
|
+
return Uint8Array.fromBase64(base64).buffer;
|
|
422
|
+
}
|
|
423
|
+
function encode_buffer(array_buffer) {
|
|
424
|
+
return Buffer.from(array_buffer).toString("base64");
|
|
425
|
+
}
|
|
426
|
+
function decode_buffer(base64) {
|
|
427
|
+
return Uint8Array.from(Buffer.from(base64, "base64")).buffer;
|
|
428
|
+
}
|
|
429
|
+
function encode_legacy(array_buffer) {
|
|
430
|
+
const array = new Uint8Array(array_buffer);
|
|
431
|
+
let binary = "";
|
|
432
|
+
const chunk_size = 32768;
|
|
433
|
+
for (let i = 0; i < array.length; i += chunk_size) {
|
|
434
|
+
const chunk = array.subarray(i, i + chunk_size);
|
|
435
|
+
binary += String.fromCharCode.apply(null, chunk);
|
|
436
|
+
}
|
|
437
|
+
return btoa(binary);
|
|
438
|
+
}
|
|
439
|
+
function decode_legacy(base64) {
|
|
440
|
+
const binary_string = atob(base64);
|
|
441
|
+
const len = binary_string.length;
|
|
442
|
+
const array = new Uint8Array(len);
|
|
443
|
+
for (let i = 0; i < len; i++) array[i] = binary_string.charCodeAt(i);
|
|
444
|
+
return array.buffer;
|
|
445
|
+
}
|
|
446
|
+
var native = typeof Uint8Array.fromBase64 === "function";
|
|
447
|
+
var buffer = typeof process === "object" && process.versions?.node !== void 0;
|
|
448
|
+
var encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
|
|
449
|
+
var decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
|
|
450
|
+
function merge_operations(defaults, overrides) {
|
|
451
|
+
if (!overrides) return defaults;
|
|
452
|
+
const merged = {};
|
|
453
|
+
for (const key of Object.keys(defaults)) merged[key] = overrides[key] ?? defaults[key];
|
|
454
|
+
return merged;
|
|
455
|
+
}
|
|
456
|
+
var NOT_PLAIN = /* @__PURE__ */ Object.freeze({ kind: "not-plain" });
|
|
457
|
+
var SYMBOL_KEYS = /* @__PURE__ */ Object.freeze({ kind: "symbol-keys" });
|
|
458
|
+
var default_stringify_operations = /* @__PURE__ */ Object.freeze({
|
|
459
|
+
identify: (value) => value,
|
|
460
|
+
typeOf: (value) => value === null ? "null" : typeof value,
|
|
461
|
+
toPrimitive: (value) => value,
|
|
462
|
+
tagOf: (value) => get_type(value),
|
|
463
|
+
isThenable: (value) => typeof value.then === "function",
|
|
464
|
+
toPromise: (thenable) => Promise.resolve(thenable),
|
|
465
|
+
unbox: (boxed) => boxed.valueOf(),
|
|
466
|
+
toISOString: (date) => isNaN(date.getDate()) ? "" : date.toISOString(),
|
|
467
|
+
toStringValue: (value) => value.toString(),
|
|
468
|
+
regExpInfo: (regexp) => ({
|
|
469
|
+
source: regexp.source,
|
|
470
|
+
flags: regexp.flags
|
|
471
|
+
}),
|
|
472
|
+
valuesOf: (set) => set,
|
|
473
|
+
entriesOf: (map) => map,
|
|
474
|
+
viewInfo: (view) => {
|
|
475
|
+
if (is_buffer(view)) view = new Uint8Array(view);
|
|
476
|
+
return {
|
|
477
|
+
buffer: view.buffer,
|
|
478
|
+
byteOffset: view.byteOffset,
|
|
479
|
+
byteLength: view.byteLength,
|
|
480
|
+
length: view.length,
|
|
481
|
+
bufferByteLength: view.buffer.byteLength
|
|
482
|
+
};
|
|
483
|
+
},
|
|
484
|
+
toArrayBuffer: (buffer2) => buffer2,
|
|
485
|
+
lengthOf: (array) => array.length,
|
|
486
|
+
hasOwn: (value, key) => Object.hasOwn(value, key),
|
|
487
|
+
indicesOf: (array) => valid_array_indices(array),
|
|
488
|
+
shapeOf: (value) => {
|
|
489
|
+
if (!is_plain_object(value)) return NOT_PLAIN;
|
|
490
|
+
if (enumerable_symbols(value).length > 0) return SYMBOL_KEYS;
|
|
491
|
+
return {
|
|
492
|
+
kind: Object.getPrototypeOf(value) === null ? "null-proto" : "plain",
|
|
493
|
+
keys: Object.keys(value)
|
|
494
|
+
};
|
|
495
|
+
},
|
|
496
|
+
get: (value, key) => value[key]
|
|
497
|
+
});
|
|
498
|
+
var array_buffer_byte_length = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
499
|
+
var shared_array_buffer_byte_length = typeof SharedArrayBuffer === "undefined" ? void 0 : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get;
|
|
500
|
+
var default_parse_operations = /* @__PURE__ */ Object.freeze({
|
|
501
|
+
fromPrimitive: (primitive) => primitive,
|
|
502
|
+
fromISOString: (iso) => new Date(iso),
|
|
503
|
+
fromStringValue: (tag, text2) => {
|
|
504
|
+
if (tag === "URL") return new URL(text2);
|
|
505
|
+
if (tag === "URLSearchParams") return new URLSearchParams(text2);
|
|
506
|
+
return Temporal[tag.slice(9)].from(text2);
|
|
507
|
+
},
|
|
508
|
+
fromArrayBuffer: (buffer2) => buffer2,
|
|
509
|
+
fromRegExpInfo: (source, flags) => new RegExp(source, flags),
|
|
510
|
+
fromViewInfo: (tag, buffer2, byteOffset, length) => {
|
|
511
|
+
try {
|
|
512
|
+
array_buffer_byte_length.call(buffer2);
|
|
513
|
+
} catch (error2) {
|
|
514
|
+
if (!shared_array_buffer_byte_length) throw error2;
|
|
515
|
+
shared_array_buffer_byte_length.call(buffer2);
|
|
516
|
+
}
|
|
517
|
+
const Constructor = globalThis[tag];
|
|
518
|
+
return byteOffset !== void 0 ? new Constructor(buffer2, byteOffset, length) : new Constructor(buffer2);
|
|
519
|
+
},
|
|
520
|
+
box: (value) => Object(value),
|
|
521
|
+
createArray: (length) => new Array(length),
|
|
522
|
+
createSparseArray: (length) => {
|
|
523
|
+
const array = [];
|
|
524
|
+
array[MAX_ARRAY_INDEX] = void 0;
|
|
525
|
+
delete array[MAX_ARRAY_INDEX];
|
|
526
|
+
array.length = length;
|
|
527
|
+
return array;
|
|
528
|
+
},
|
|
529
|
+
createObject: () => ({}),
|
|
530
|
+
createNullPrototypeObject: () => /* @__PURE__ */ Object.create(null),
|
|
531
|
+
createSet: () => /* @__PURE__ */ new Set(),
|
|
532
|
+
createMap: () => /* @__PURE__ */ new Map(),
|
|
533
|
+
set: (target, key, value) => {
|
|
534
|
+
target[key] = value;
|
|
535
|
+
},
|
|
536
|
+
addValue: (set, value) => {
|
|
537
|
+
set.add(value);
|
|
538
|
+
},
|
|
539
|
+
addEntry: (map, key, value) => {
|
|
540
|
+
map.set(key, value);
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
function parse$1(serialized, revivers, options2) {
|
|
544
|
+
return unflatten(JSON.parse(serialized), revivers, options2);
|
|
545
|
+
}
|
|
546
|
+
function unflatten(parsed, revivers, options2) {
|
|
547
|
+
const ops = merge_operations(default_parse_operations, options2?.operations);
|
|
548
|
+
if (typeof parsed === "number") return hydrate(parsed, true);
|
|
549
|
+
if (!Array.isArray(parsed) || parsed.length === 0) throw new Error("Invalid input");
|
|
550
|
+
const values = parsed;
|
|
551
|
+
const hydrated = Array(values.length);
|
|
552
|
+
let hydrating = null;
|
|
553
|
+
function hydrate(index, standalone = false) {
|
|
554
|
+
if (index === -1) return ops.fromPrimitive(void 0);
|
|
555
|
+
if (index === -3) return ops.fromPrimitive(NaN);
|
|
556
|
+
if (index === -4) return ops.fromPrimitive(Infinity);
|
|
557
|
+
if (index === -5) return ops.fromPrimitive(-Infinity);
|
|
558
|
+
if (index === -6) return ops.fromPrimitive(-0);
|
|
559
|
+
if (standalone || typeof index !== "number") throw new Error(`Invalid input`);
|
|
560
|
+
if (index in hydrated) return hydrated[index];
|
|
561
|
+
if (index >= values.length) throw new Error(`Invalid input`);
|
|
562
|
+
const value = values[index];
|
|
563
|
+
if (!value || typeof value !== "object") hydrated[index] = ops.fromPrimitive(value);
|
|
564
|
+
else if (Array.isArray(value)) {
|
|
565
|
+
if (typeof value[0] === "string") {
|
|
566
|
+
const type = value[0];
|
|
567
|
+
const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : void 0;
|
|
568
|
+
if (reviver) {
|
|
569
|
+
let i = value[1];
|
|
570
|
+
if (typeof i !== "number") i = values.push(value[1]) - 1;
|
|
571
|
+
if (Object.hasOwn(hydrated, i)) return hydrated[index] = reviver(hydrated[i]);
|
|
572
|
+
hydrating ??= /* @__PURE__ */ new Set();
|
|
573
|
+
if (hydrating.has(i)) throw new Error("Invalid circular reference");
|
|
574
|
+
hydrating.add(i);
|
|
575
|
+
hydrated[index] = reviver(hydrate(i));
|
|
576
|
+
hydrating.delete(i);
|
|
577
|
+
return hydrated[index];
|
|
578
|
+
}
|
|
579
|
+
switch (type) {
|
|
580
|
+
case "Date":
|
|
581
|
+
hydrated[index] = ops.fromISOString(value[1]);
|
|
582
|
+
break;
|
|
583
|
+
case "Set":
|
|
584
|
+
const set = ops.createSet();
|
|
585
|
+
hydrated[index] = set;
|
|
586
|
+
for (let i = 1; i < value.length; i += 1) ops.addValue(set, hydrate(value[i]));
|
|
587
|
+
break;
|
|
588
|
+
case "Map":
|
|
589
|
+
const map = ops.createMap();
|
|
590
|
+
hydrated[index] = map;
|
|
591
|
+
for (let i = 1; i < value.length; i += 2) ops.addEntry(map, hydrate(value[i]), hydrate(value[i + 1]));
|
|
592
|
+
break;
|
|
593
|
+
case "RegExp":
|
|
594
|
+
hydrated[index] = ops.fromRegExpInfo(value[1], value[2]);
|
|
595
|
+
break;
|
|
596
|
+
case "Object": {
|
|
597
|
+
const wrapped_index = value[1];
|
|
598
|
+
if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") throw new Error("Invalid input");
|
|
599
|
+
hydrated[index] = ops.box(hydrate(wrapped_index));
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
case "BigInt":
|
|
603
|
+
hydrated[index] = ops.fromPrimitive(BigInt(value[1]));
|
|
604
|
+
break;
|
|
605
|
+
case "null":
|
|
606
|
+
const obj = ops.createNullPrototypeObject();
|
|
607
|
+
hydrated[index] = obj;
|
|
608
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
609
|
+
const key = value[i];
|
|
610
|
+
if (typeof key !== "string") throw new Error("Cannot parse an object with a non-string key");
|
|
611
|
+
if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
|
|
612
|
+
ops.set(obj, key, hydrate(value[i + 1]));
|
|
613
|
+
}
|
|
614
|
+
break;
|
|
615
|
+
case "Int8Array":
|
|
616
|
+
case "Uint8Array":
|
|
617
|
+
case "Uint8ClampedArray":
|
|
618
|
+
case "Int16Array":
|
|
619
|
+
case "Uint16Array":
|
|
620
|
+
case "Float16Array":
|
|
621
|
+
case "Int32Array":
|
|
622
|
+
case "Uint32Array":
|
|
623
|
+
case "Float32Array":
|
|
624
|
+
case "Float64Array":
|
|
625
|
+
case "BigInt64Array":
|
|
626
|
+
case "BigUint64Array":
|
|
627
|
+
case "DataView": {
|
|
628
|
+
if (values[value[1]][0] !== "ArrayBuffer") throw new Error("Invalid data");
|
|
629
|
+
const buffer2 = hydrate(value[1]);
|
|
630
|
+
hydrated[index] = ops.fromViewInfo(type, buffer2, value[2], value[3]);
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
case "ArrayBuffer": {
|
|
634
|
+
const base64 = value[1];
|
|
635
|
+
if (typeof base64 !== "string") throw new Error("Invalid ArrayBuffer encoding");
|
|
636
|
+
hydrated[index] = ops.fromArrayBuffer(decode64(base64));
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
case "URL":
|
|
640
|
+
case "URLSearchParams":
|
|
641
|
+
case "Temporal.Duration":
|
|
642
|
+
case "Temporal.Instant":
|
|
643
|
+
case "Temporal.PlainDate":
|
|
644
|
+
case "Temporal.PlainTime":
|
|
645
|
+
case "Temporal.PlainDateTime":
|
|
646
|
+
case "Temporal.PlainMonthDay":
|
|
647
|
+
case "Temporal.PlainYearMonth":
|
|
648
|
+
case "Temporal.ZonedDateTime":
|
|
649
|
+
hydrated[index] = ops.fromStringValue(type, value[1]);
|
|
650
|
+
break;
|
|
651
|
+
default:
|
|
652
|
+
throw new Error(`Unknown type ${type}`);
|
|
653
|
+
}
|
|
654
|
+
} else if (value[0] === -7) {
|
|
655
|
+
const len = value[1];
|
|
656
|
+
if (!is_valid_array_len(len)) throw new Error("Invalid input");
|
|
657
|
+
const array = ops.createSparseArray(len);
|
|
658
|
+
hydrated[index] = array;
|
|
659
|
+
for (let i = 2; i < value.length; i += 2) {
|
|
660
|
+
const idx = value[i];
|
|
661
|
+
if (!is_valid_array_index(idx) || idx >= len) throw new Error("Invalid input");
|
|
662
|
+
ops.set(array, idx, hydrate(value[i + 1]));
|
|
663
|
+
}
|
|
664
|
+
} else {
|
|
665
|
+
const array = ops.createArray(value.length);
|
|
666
|
+
hydrated[index] = array;
|
|
667
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
668
|
+
const n = value[i];
|
|
669
|
+
if (n === -2) continue;
|
|
670
|
+
ops.set(array, i, hydrate(n));
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
} else {
|
|
674
|
+
const object = ops.createObject();
|
|
675
|
+
hydrated[index] = object;
|
|
676
|
+
for (const key of Object.keys(value)) {
|
|
677
|
+
if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
|
|
678
|
+
ops.set(object, key, hydrate(value[key]));
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return hydrated[index];
|
|
682
|
+
}
|
|
683
|
+
return hydrate(0);
|
|
684
|
+
}
|
|
685
|
+
function stringify$1(value, reducers, options2) {
|
|
686
|
+
const stringified = run(false, value, reducers, options2);
|
|
687
|
+
return typeof stringified === "string" ? stringified : `[${stringified.join(",")}]`;
|
|
688
|
+
}
|
|
689
|
+
function run(async, value, reducers, options2) {
|
|
690
|
+
const ops = merge_operations(default_stringify_operations, options2?.operations);
|
|
691
|
+
const stringified = [];
|
|
692
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
693
|
+
const custom = [];
|
|
694
|
+
if (reducers) for (const key of Object.getOwnPropertyNames(reducers)) custom.push({
|
|
695
|
+
key,
|
|
696
|
+
fn: reducers[key]
|
|
697
|
+
});
|
|
698
|
+
const keys = [];
|
|
699
|
+
let p = 0;
|
|
700
|
+
function flatten(thing, index2) {
|
|
701
|
+
const type = ops.typeOf(thing);
|
|
702
|
+
if (type === "undefined") return -1;
|
|
703
|
+
let number;
|
|
704
|
+
if (type === "number") {
|
|
705
|
+
number = ops.toPrimitive(thing);
|
|
706
|
+
if (Number.isNaN(number)) return -3;
|
|
707
|
+
if (number === Infinity) return -4;
|
|
708
|
+
if (number === -Infinity) return -5;
|
|
709
|
+
if (number === 0 && 1 / number < 0) return -6;
|
|
710
|
+
}
|
|
711
|
+
const id = ops.identify(thing);
|
|
712
|
+
if (indexes.has(id)) return indexes.get(id);
|
|
713
|
+
index2 ??= p++;
|
|
714
|
+
indexes.set(id, index2);
|
|
715
|
+
for (const { key, fn } of custom) {
|
|
716
|
+
const value2 = fn(thing);
|
|
717
|
+
if (value2) {
|
|
718
|
+
stringified[index2] = `["${key}",${flatten(value2)}]`;
|
|
719
|
+
return index2;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
if (type === "function") throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
|
|
723
|
+
else if (type === "symbol") throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
|
|
724
|
+
let str = "";
|
|
725
|
+
if (type !== "object") str = stringify_primitive(type === "number" ? number : ops.toPrimitive(thing));
|
|
726
|
+
else if (ops.isThenable(thing)) {
|
|
727
|
+
if (!async) throw new DevalueError(`Cannot stringify a Promise or thenable \u2014 use stringifyAsync instead`, keys, thing, value);
|
|
728
|
+
str = ops.toPromise(thing).then((value2) => {
|
|
729
|
+
const i = flatten(value2, index2);
|
|
730
|
+
if (i < 0) stringified[index2] = i;
|
|
731
|
+
});
|
|
732
|
+
str.catch(() => {
|
|
733
|
+
});
|
|
734
|
+
} else {
|
|
735
|
+
const tag = ops.tagOf(thing);
|
|
736
|
+
switch (tag) {
|
|
737
|
+
case "Number":
|
|
738
|
+
case "String":
|
|
739
|
+
case "Boolean":
|
|
740
|
+
case "BigInt":
|
|
741
|
+
str = `["Object",${flatten(ops.unbox(thing))}]`;
|
|
742
|
+
break;
|
|
743
|
+
case "Date":
|
|
744
|
+
str = `["Date","${ops.toISOString(thing)}"]`;
|
|
745
|
+
break;
|
|
746
|
+
case "URL":
|
|
747
|
+
str = `["URL",${stringify_string(ops.toStringValue(thing))}]`;
|
|
748
|
+
break;
|
|
749
|
+
case "URLSearchParams":
|
|
750
|
+
str = `["URLSearchParams",${stringify_string(ops.toStringValue(thing))}]`;
|
|
751
|
+
break;
|
|
752
|
+
case "RegExp":
|
|
753
|
+
const { source, flags } = ops.regExpInfo(thing);
|
|
754
|
+
str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
|
|
755
|
+
break;
|
|
756
|
+
case "Array": {
|
|
757
|
+
let mostly_dense = false;
|
|
758
|
+
const length = ops.lengthOf(thing);
|
|
759
|
+
str = "[";
|
|
760
|
+
for (let i = 0; i < length; i += 1) {
|
|
761
|
+
if (i > 0) str += ",";
|
|
762
|
+
if (ops.hasOwn(thing, i)) {
|
|
763
|
+
keys.push(`[${i}]`);
|
|
764
|
+
str += flatten(ops.get(thing, i));
|
|
765
|
+
keys.pop();
|
|
766
|
+
} else if (mostly_dense) str += -2;
|
|
767
|
+
else {
|
|
768
|
+
const populated_keys = ops.indicesOf(thing);
|
|
769
|
+
const population = populated_keys.length;
|
|
770
|
+
const d = String(length).length;
|
|
771
|
+
if ((length - population) * 3 > 4 + d + population * (d + 1)) {
|
|
772
|
+
str = "[-7," + length;
|
|
773
|
+
for (let j = 0; j < populated_keys.length; j++) {
|
|
774
|
+
const key = populated_keys[j];
|
|
775
|
+
keys.push(`[${key}]`);
|
|
776
|
+
str += "," + key + "," + flatten(ops.get(thing, key));
|
|
777
|
+
keys.pop();
|
|
778
|
+
}
|
|
779
|
+
break;
|
|
780
|
+
} else {
|
|
781
|
+
mostly_dense = true;
|
|
782
|
+
str += -2;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
str += "]";
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
case "Set":
|
|
790
|
+
str = '["Set"';
|
|
791
|
+
for (const value2 of ops.valuesOf(thing)) str += `,${flatten(value2)}`;
|
|
792
|
+
str += "]";
|
|
793
|
+
break;
|
|
794
|
+
case "Map":
|
|
795
|
+
str = '["Map"';
|
|
796
|
+
for (const [key, value2] of ops.entriesOf(thing)) {
|
|
797
|
+
const key_type = ops.typeOf(key);
|
|
798
|
+
const key_is_primitive = key_type !== "object" && key_type !== "function" && key_type !== "symbol";
|
|
799
|
+
keys.push(`.get(${key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : "..."})`);
|
|
800
|
+
str += `,${flatten(key)},${flatten(value2)}`;
|
|
801
|
+
keys.pop();
|
|
802
|
+
}
|
|
803
|
+
str += "]";
|
|
804
|
+
break;
|
|
805
|
+
case "Int8Array":
|
|
806
|
+
case "Uint8Array":
|
|
807
|
+
case "Uint8ClampedArray":
|
|
808
|
+
case "Int16Array":
|
|
809
|
+
case "Uint16Array":
|
|
810
|
+
case "Float16Array":
|
|
811
|
+
case "Int32Array":
|
|
812
|
+
case "Uint32Array":
|
|
813
|
+
case "Float32Array":
|
|
814
|
+
case "Float64Array":
|
|
815
|
+
case "BigInt64Array":
|
|
816
|
+
case "BigUint64Array": {
|
|
817
|
+
const info = ops.viewInfo(thing);
|
|
818
|
+
str = '["' + tag + '",' + flatten(info.buffer);
|
|
819
|
+
if (info.byteLength !== info.bufferByteLength) str += `,${info.byteOffset},${info.length}`;
|
|
820
|
+
str += "]";
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
case "DataView": {
|
|
824
|
+
const info = ops.viewInfo(thing);
|
|
825
|
+
str = '["' + tag + '",' + flatten(info.buffer);
|
|
826
|
+
if (info.byteLength !== info.bufferByteLength) str += `,${info.byteOffset},${info.byteLength}`;
|
|
827
|
+
str += "]";
|
|
828
|
+
break;
|
|
829
|
+
}
|
|
830
|
+
case "ArrayBuffer":
|
|
831
|
+
str = `["ArrayBuffer","${encode64(ops.toArrayBuffer(thing))}"]`;
|
|
832
|
+
break;
|
|
833
|
+
case "Temporal.Duration":
|
|
834
|
+
case "Temporal.Instant":
|
|
835
|
+
case "Temporal.PlainDate":
|
|
836
|
+
case "Temporal.PlainTime":
|
|
837
|
+
case "Temporal.PlainDateTime":
|
|
838
|
+
case "Temporal.PlainMonthDay":
|
|
839
|
+
case "Temporal.PlainYearMonth":
|
|
840
|
+
case "Temporal.ZonedDateTime":
|
|
841
|
+
str = `["${tag}",${stringify_string(ops.toStringValue(thing))}]`;
|
|
842
|
+
break;
|
|
843
|
+
default: {
|
|
844
|
+
const shape = ops.shapeOf(thing);
|
|
845
|
+
if (shape.kind === "not-plain") throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
|
|
846
|
+
if (shape.kind === "symbol-keys") throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
|
|
847
|
+
if (shape.kind === "null-proto") {
|
|
848
|
+
str = '["null"';
|
|
849
|
+
for (const key of shape.keys) {
|
|
850
|
+
if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value);
|
|
851
|
+
keys.push(stringify_key(key));
|
|
852
|
+
str += `,${stringify_string(key)},${flatten(ops.get(thing, key))}`;
|
|
853
|
+
keys.pop();
|
|
854
|
+
}
|
|
855
|
+
str += "]";
|
|
856
|
+
} else {
|
|
857
|
+
str = "{";
|
|
858
|
+
let started = false;
|
|
859
|
+
for (const key of shape.keys) {
|
|
860
|
+
if (key === "__proto__") throw new DevalueError(`Cannot stringify objects with __proto__ keys`, keys, thing, value);
|
|
861
|
+
if (started) str += ",";
|
|
862
|
+
started = true;
|
|
863
|
+
keys.push(stringify_key(key));
|
|
864
|
+
str += `${stringify_string(key)}:${flatten(ops.get(thing, key))}`;
|
|
865
|
+
keys.pop();
|
|
866
|
+
}
|
|
867
|
+
str += "}";
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
stringified[index2] = str;
|
|
873
|
+
return index2;
|
|
874
|
+
}
|
|
875
|
+
const index = flatten(value);
|
|
876
|
+
if (index < 0) return `${index}`;
|
|
877
|
+
return stringified;
|
|
878
|
+
}
|
|
879
|
+
function stringify_primitive(thing) {
|
|
880
|
+
const type = typeof thing;
|
|
881
|
+
if (type === "string") return stringify_string(thing);
|
|
882
|
+
if (thing === void 0) return (-1).toString();
|
|
883
|
+
if (thing === 0 && 1 / thing < 0) return (-6).toString();
|
|
884
|
+
if (type === "bigint") return `["BigInt","${thing}"]`;
|
|
885
|
+
return String(thing);
|
|
886
|
+
}
|
|
887
|
+
function noop() {
|
|
888
|
+
}
|
|
889
|
+
function once(fn) {
|
|
890
|
+
let done = false;
|
|
891
|
+
let result;
|
|
892
|
+
return () => {
|
|
893
|
+
if (done) return result;
|
|
894
|
+
done = true;
|
|
895
|
+
return result = fn();
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function disallow_on_server(name, parens = "(...)") {
|
|
899
|
+
return () => {
|
|
900
|
+
server_api_unavailable({ name: `${name}${parens}` });
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
function set_nested_value(object, field, value) {
|
|
904
|
+
deep_set(object, split_path(field.name), value);
|
|
905
|
+
}
|
|
906
|
+
function parse_form_key(form_id, key) {
|
|
907
|
+
const suffix = "/" + form_id;
|
|
908
|
+
let name = key;
|
|
909
|
+
let image_coordinate = "";
|
|
910
|
+
if (name.startsWith("i:") && (name.endsWith(suffix + ".x") || name.endsWith(suffix + ".y"))) {
|
|
911
|
+
image_coordinate = name[name.length - 1];
|
|
912
|
+
name = name.slice(0, -2);
|
|
913
|
+
}
|
|
914
|
+
if (!name.endsWith(suffix)) form_field_unbound({ name });
|
|
915
|
+
name = name.slice(0, -suffix.length);
|
|
916
|
+
let type = null;
|
|
917
|
+
if (name.startsWith("n:")) {
|
|
918
|
+
name = name.slice(2);
|
|
919
|
+
type = "number";
|
|
920
|
+
} else if (name.startsWith("b:")) {
|
|
921
|
+
name = name.slice(2);
|
|
922
|
+
type = "boolean";
|
|
923
|
+
} else if (name.startsWith("i:")) {
|
|
924
|
+
name = name.slice(2);
|
|
925
|
+
type = "number";
|
|
926
|
+
}
|
|
927
|
+
const is_array = name.endsWith("[]");
|
|
928
|
+
if (is_array) name = name.slice(0, -2);
|
|
929
|
+
if (image_coordinate) name += "." + image_coordinate;
|
|
930
|
+
return {
|
|
931
|
+
name,
|
|
932
|
+
type,
|
|
933
|
+
is_array
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function coerce_form_value(type, value) {
|
|
937
|
+
if (Array.isArray(value)) return value.map((value2) => coerce_form_value(type, value2));
|
|
938
|
+
if (type === "number") return value === "" ? void 0 : parseFloat(value);
|
|
939
|
+
if (type === "boolean") return value === "on";
|
|
940
|
+
return value;
|
|
941
|
+
}
|
|
942
|
+
var DELETE_KEY = {};
|
|
943
|
+
function group_formdata(data) {
|
|
944
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
945
|
+
for (const [name, value] of data) {
|
|
946
|
+
const values = grouped.get(name);
|
|
947
|
+
if (values) values.push(value);
|
|
948
|
+
else grouped.set(name, [value]);
|
|
949
|
+
}
|
|
950
|
+
return grouped;
|
|
951
|
+
}
|
|
952
|
+
function convert_formdata(form_id, data) {
|
|
953
|
+
const result = {};
|
|
954
|
+
for (const [field_name, values] of group_formdata(data)) {
|
|
955
|
+
const field = parse_form_key(form_id, field_name);
|
|
956
|
+
const entries = values.filter((entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0);
|
|
957
|
+
if (entries.length === 0 && !field.is_array) continue;
|
|
958
|
+
if (entries.length > 1 && !field.is_array) form_field_duplicate({
|
|
959
|
+
name: field.name,
|
|
960
|
+
count: String(entries.length)
|
|
961
|
+
});
|
|
962
|
+
set_nested_value(result, field, coerce_form_value(field.type, field.is_array ? entries : entries[0]));
|
|
963
|
+
}
|
|
964
|
+
return result;
|
|
965
|
+
}
|
|
966
|
+
var BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
|
|
967
|
+
var BINARY_FORM_VERSION = 0;
|
|
968
|
+
var HEADER_BYTES = 7;
|
|
969
|
+
async function deserialize_binary_form(request, form_id) {
|
|
970
|
+
if (request.headers.get("content-type") !== "application/x-sveltekit-formdata") {
|
|
971
|
+
const form_data = await request.formData();
|
|
972
|
+
return {
|
|
973
|
+
data: convert_formdata(form_id, form_data),
|
|
974
|
+
meta: {},
|
|
975
|
+
form_data
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
if (!request.body) throw deserialize_error("no body");
|
|
979
|
+
const reader = request.body.getReader();
|
|
980
|
+
const chunks = [];
|
|
981
|
+
function get_chunk(index) {
|
|
982
|
+
if (index in chunks) return chunks[index];
|
|
983
|
+
let i = chunks.length;
|
|
984
|
+
while (i <= index) {
|
|
985
|
+
const previous = chunks[i - 1] ?? Promise.resolve(void 0);
|
|
986
|
+
chunks[i] = previous.then(() => reader.read()).then((chunk) => chunk.value);
|
|
987
|
+
i++;
|
|
988
|
+
}
|
|
989
|
+
return chunks[index];
|
|
990
|
+
}
|
|
991
|
+
async function get_buffer(offset, length) {
|
|
992
|
+
const parts = [];
|
|
993
|
+
let total = 0;
|
|
994
|
+
for await (const part of read_range(get_chunk, offset, length)) {
|
|
995
|
+
parts.push(part);
|
|
996
|
+
total += part.byteLength;
|
|
997
|
+
}
|
|
998
|
+
if (total < length || parts.length === 0) return null;
|
|
999
|
+
if (parts.length === 1) return parts[0];
|
|
1000
|
+
const buffer2 = new Uint8Array(length);
|
|
1001
|
+
let cursor = 0;
|
|
1002
|
+
for (const part of parts) {
|
|
1003
|
+
buffer2.set(part, cursor);
|
|
1004
|
+
cursor += part.byteLength;
|
|
1005
|
+
}
|
|
1006
|
+
return buffer2;
|
|
1007
|
+
}
|
|
1008
|
+
const header = await get_buffer(0, HEADER_BYTES);
|
|
1009
|
+
if (!header) throw deserialize_error("too short");
|
|
1010
|
+
if (header[0] !== BINARY_FORM_VERSION) throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
|
|
1011
|
+
const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
1012
|
+
const data_length = header_view.getUint32(1, true);
|
|
1013
|
+
const file_offsets_length = header_view.getUint16(5, true);
|
|
1014
|
+
const data_buffer = await get_buffer(HEADER_BYTES, data_length);
|
|
1015
|
+
if (!data_buffer) throw deserialize_error("data too short");
|
|
1016
|
+
let file_offsets;
|
|
1017
|
+
let files_start_offset;
|
|
1018
|
+
if (file_offsets_length > 0) {
|
|
1019
|
+
const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
|
|
1020
|
+
if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
|
|
1021
|
+
const parsed_offsets = JSON.parse(text_decoder.decode(file_offsets_buffer));
|
|
1022
|
+
if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) throw deserialize_error("invalid file offset table");
|
|
1023
|
+
file_offsets = parsed_offsets;
|
|
1024
|
+
files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
|
|
1025
|
+
}
|
|
1026
|
+
const file_spans = [];
|
|
1027
|
+
const [data, meta] = parse$1(text_decoder.decode(data_buffer), { File: ([name, type, size, last_modified, index]) => {
|
|
1028
|
+
if (typeof name !== "string" || typeof type !== "string" || !Number.isSafeInteger(size) || size < 0 || !Number.isSafeInteger(last_modified) || !Number.isSafeInteger(index) || index < 0) throw deserialize_error("invalid file metadata");
|
|
1029
|
+
let offset = file_offsets[index];
|
|
1030
|
+
if (offset === void 0) throw deserialize_error("duplicate file offset table index");
|
|
1031
|
+
file_offsets[index] = void 0;
|
|
1032
|
+
offset += files_start_offset;
|
|
1033
|
+
file_spans.push({
|
|
1034
|
+
offset,
|
|
1035
|
+
size
|
|
1036
|
+
});
|
|
1037
|
+
return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), { getPrototypeOf() {
|
|
1038
|
+
return File.prototype;
|
|
1039
|
+
} });
|
|
1040
|
+
} });
|
|
1041
|
+
file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
|
|
1042
|
+
for (let i = 1; i < file_spans.length; i++) {
|
|
1043
|
+
const previous = file_spans[i - 1];
|
|
1044
|
+
const current = file_spans[i];
|
|
1045
|
+
const previous_end = previous.offset + previous.size;
|
|
1046
|
+
if (previous_end < current.offset) throw deserialize_error("gaps in file data");
|
|
1047
|
+
if (previous_end > current.offset) throw deserialize_error("overlapping file data");
|
|
1048
|
+
}
|
|
1049
|
+
(async () => {
|
|
1050
|
+
let has_more = true;
|
|
1051
|
+
while (has_more) has_more = !!await get_chunk(chunks.length);
|
|
1052
|
+
})().catch(noop);
|
|
1053
|
+
return {
|
|
1054
|
+
data,
|
|
1055
|
+
meta,
|
|
1056
|
+
form_data: null
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
function deserialize_error(message) {
|
|
1060
|
+
return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
|
|
1061
|
+
}
|
|
1062
|
+
async function* read_range(get_chunk, offset, length) {
|
|
1063
|
+
let chunk_start = 0;
|
|
1064
|
+
for (let index = 0; ; index++) {
|
|
1065
|
+
const chunk = await get_chunk(index);
|
|
1066
|
+
if (!chunk) return;
|
|
1067
|
+
const chunk_end = chunk_start + chunk.byteLength;
|
|
1068
|
+
if (chunk_end > offset) {
|
|
1069
|
+
yield chunk.subarray(Math.max(0, offset - chunk_start), Math.min(chunk.byteLength, offset + length - chunk_start));
|
|
1070
|
+
if (offset + length <= chunk_end) return;
|
|
1071
|
+
}
|
|
1072
|
+
chunk_start = chunk_end;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
var LazyFile = class LazyFile2 {
|
|
1076
|
+
/** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
|
|
1077
|
+
#get_chunk;
|
|
1078
|
+
/** @type {number} */
|
|
1079
|
+
#offset;
|
|
1080
|
+
/**
|
|
1081
|
+
* @param {string} name
|
|
1082
|
+
* @param {string} type
|
|
1083
|
+
* @param {number} size
|
|
1084
|
+
* @param {number} last_modified
|
|
1085
|
+
* @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
|
|
1086
|
+
* @param {number} offset
|
|
1087
|
+
*/
|
|
1088
|
+
constructor(name, type, size, last_modified, get_chunk, offset) {
|
|
1089
|
+
this.name = name;
|
|
1090
|
+
this.type = type;
|
|
1091
|
+
this.size = size;
|
|
1092
|
+
this.lastModified = last_modified;
|
|
1093
|
+
this.webkitRelativePath = "";
|
|
1094
|
+
this.#get_chunk = get_chunk;
|
|
1095
|
+
this.#offset = offset;
|
|
1096
|
+
this.arrayBuffer = this.arrayBuffer.bind(this);
|
|
1097
|
+
this.bytes = this.bytes.bind(this);
|
|
1098
|
+
this.slice = this.slice.bind(this);
|
|
1099
|
+
this.stream = this.stream.bind(this);
|
|
1100
|
+
this.text = this.text.bind(this);
|
|
1101
|
+
}
|
|
1102
|
+
/** @type {ArrayBuffer | undefined} */
|
|
1103
|
+
#buffer;
|
|
1104
|
+
async arrayBuffer() {
|
|
1105
|
+
this.#buffer ??= await new Response(this.stream()).arrayBuffer();
|
|
1106
|
+
return this.#buffer;
|
|
1107
|
+
}
|
|
1108
|
+
async bytes() {
|
|
1109
|
+
return new Uint8Array(await this.arrayBuffer());
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* @param {number=} start
|
|
1113
|
+
* @param {number=} end
|
|
1114
|
+
* @param {string=} contentType
|
|
1115
|
+
*/
|
|
1116
|
+
slice(start = 0, end = this.size, contentType = this.type) {
|
|
1117
|
+
if (start < 0) start = Math.max(this.size + start, 0);
|
|
1118
|
+
else start = Math.min(start, this.size);
|
|
1119
|
+
if (end < 0) end = Math.max(this.size + end, 0);
|
|
1120
|
+
else end = Math.min(end, this.size);
|
|
1121
|
+
const size = Math.max(end - start, 0);
|
|
1122
|
+
return new LazyFile2(this.name, contentType, size, this.lastModified, this.#get_chunk, this.#offset + start);
|
|
1123
|
+
}
|
|
1124
|
+
stream() {
|
|
1125
|
+
const range = read_range(this.#get_chunk, this.#offset, this.size);
|
|
1126
|
+
const size = this.size;
|
|
1127
|
+
return stream_from_iterable((async function* () {
|
|
1128
|
+
let cursor = 0;
|
|
1129
|
+
for await (const chunk of range) {
|
|
1130
|
+
cursor += chunk.byteLength;
|
|
1131
|
+
yield chunk;
|
|
1132
|
+
}
|
|
1133
|
+
if (cursor < size) throw new Error("incomplete file data");
|
|
1134
|
+
})());
|
|
1135
|
+
}
|
|
1136
|
+
async text() {
|
|
1137
|
+
return text_decoder.decode(await this.arrayBuffer());
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
var path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;
|
|
1141
|
+
function split_path(path2) {
|
|
1142
|
+
if (!path_regex.test(path2)) form_field_invalid_name({ name: path2 });
|
|
1143
|
+
return path2.split(/\.|\[|\]/).filter(Boolean);
|
|
1144
|
+
}
|
|
1145
|
+
function check_prototype_pollution(key) {
|
|
1146
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") form_field_forbidden_key({ key });
|
|
1147
|
+
}
|
|
1148
|
+
function deep_set(object, keys, value) {
|
|
1149
|
+
let current = object;
|
|
1150
|
+
for (let i = 0; i < keys.length - 1; i += 1) {
|
|
1151
|
+
const key = keys[i];
|
|
1152
|
+
check_prototype_pollution(key);
|
|
1153
|
+
const is_array = /^\d+$/.test(keys[i + 1]);
|
|
1154
|
+
const inner = Object.hasOwn(current, key) ? current[key] : void 0;
|
|
1155
|
+
const exists = inner != null;
|
|
1156
|
+
if (exists && is_array !== Array.isArray(inner)) form_field_array_conflict({ key: keys[i + 1] });
|
|
1157
|
+
if (!exists) {
|
|
1158
|
+
if (value === DELETE_KEY) return;
|
|
1159
|
+
current[key] = is_array ? [] : {};
|
|
1160
|
+
}
|
|
1161
|
+
current = current[key];
|
|
1162
|
+
}
|
|
1163
|
+
const final_key = keys[keys.length - 1];
|
|
1164
|
+
check_prototype_pollution(final_key);
|
|
1165
|
+
if (value === DELETE_KEY) delete current[final_key];
|
|
1166
|
+
else current[final_key] = value;
|
|
1167
|
+
}
|
|
1168
|
+
function negotiate(accept, types) {
|
|
1169
|
+
const parts = [];
|
|
1170
|
+
accept.split(",").forEach((str, i) => {
|
|
1171
|
+
const match = /^[ \t]*([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
|
|
1172
|
+
if (match) {
|
|
1173
|
+
const [, type, subtype, q = "1"] = match;
|
|
1174
|
+
parts.push({
|
|
1175
|
+
type,
|
|
1176
|
+
subtype,
|
|
1177
|
+
q: +q,
|
|
1178
|
+
i
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
parts.sort((a, b) => {
|
|
1183
|
+
if (a.q !== b.q) return b.q - a.q;
|
|
1184
|
+
if (a.subtype === "*" !== (b.subtype === "*")) return a.subtype === "*" ? 1 : -1;
|
|
1185
|
+
if (a.type === "*" !== (b.type === "*")) return a.type === "*" ? 1 : -1;
|
|
1186
|
+
return a.i - b.i;
|
|
1187
|
+
});
|
|
1188
|
+
let accepted;
|
|
1189
|
+
let min_priority = Infinity;
|
|
1190
|
+
for (const mimetype of types) {
|
|
1191
|
+
const [type, subtype] = mimetype.split("/");
|
|
1192
|
+
const priority = parts.findIndex((part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*"));
|
|
1193
|
+
if (priority !== -1 && priority < min_priority) {
|
|
1194
|
+
accepted = mimetype;
|
|
1195
|
+
min_priority = priority;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
return accepted;
|
|
1199
|
+
}
|
|
1200
|
+
function matches_content_type(header, ...types) {
|
|
1201
|
+
const type = header?.split(";", 1)[0].trim() ?? "";
|
|
1202
|
+
return types.includes(type.toLowerCase());
|
|
1203
|
+
}
|
|
1204
|
+
function is_form_content_type(request) {
|
|
1205
|
+
return matches_content_type(request.headers.get("content-type"), "application/x-www-form-urlencoded", "multipart/form-data", "text/plain", BINARY_FORM_CONTENT_TYPE);
|
|
1206
|
+
}
|
|
1207
|
+
var uneval2 = () => {
|
|
1208
|
+
throw new Error("");
|
|
1209
|
+
};
|
|
1210
|
+
var stringify = () => {
|
|
1211
|
+
throw new Error("");
|
|
1212
|
+
};
|
|
1213
|
+
var parse = () => {
|
|
1214
|
+
throw new Error("");
|
|
1215
|
+
};
|
|
1216
|
+
var encoders = {};
|
|
1217
|
+
var decoders = {};
|
|
1218
|
+
var has_custom_transporters = false;
|
|
1219
|
+
function init_transport(transport) {
|
|
1220
|
+
const transporters = Object.entries(transport);
|
|
1221
|
+
has_custom_transporters = transporters.length > 0;
|
|
1222
|
+
const replacer = (thing) => {
|
|
1223
|
+
for (const key of Object.keys(transport)) {
|
|
1224
|
+
const encoded = transport[key].encode(thing);
|
|
1225
|
+
if (encoded) return `app.decode('${key}', ${uneval(encoded, replacer)})`;
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
encoders = Object.fromEntries(transporters.map(([k, v]) => [k, v.encode]));
|
|
1229
|
+
decoders = Object.fromEntries(transporters.map(([k, v]) => [k, v.decode]));
|
|
1230
|
+
uneval2 = (data) => uneval(data, replacer);
|
|
1231
|
+
stringify = (data) => stringify$1(data, encoders);
|
|
1232
|
+
parse = (data) => parse$1(data, decoders);
|
|
1233
|
+
}
|
|
1234
|
+
function fetch_cache_url(url2, page) {
|
|
1235
|
+
return url2.origin === page.origin ? url2.href.slice(page.origin.length) : url2.href;
|
|
1236
|
+
}
|
|
1237
|
+
var INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
|
1238
|
+
var TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
|
1239
|
+
var remote_object = "__skrao";
|
|
1240
|
+
var remote_map = "__skram";
|
|
1241
|
+
var remote_set = "__skras";
|
|
1242
|
+
var remote_file = "__skraf";
|
|
1243
|
+
var remote_arg_marker = Symbol(remote_object);
|
|
1244
|
+
function create_remote_arg_revivers() {
|
|
1245
|
+
const remote_fns_revivers = {
|
|
1246
|
+
/** @type {(value: unknown) => unknown} */
|
|
1247
|
+
[remote_object]: (value) => value,
|
|
1248
|
+
/** @type {(value: unknown) => Map<unknown, unknown>} */
|
|
1249
|
+
[remote_map]: (value) => {
|
|
1250
|
+
if (!Array.isArray(value)) throw new Error("Invalid data for Map reviver");
|
|
1251
|
+
const map = /* @__PURE__ */ new Map();
|
|
1252
|
+
for (const item of value) {
|
|
1253
|
+
if (!Array.isArray(item) || item.length !== 2 || typeof item[0] !== "string" || typeof item[1] !== "string") throw new Error("Invalid data for Map reviver");
|
|
1254
|
+
const [key, val] = item;
|
|
1255
|
+
map.set(parse2(key), parse2(val));
|
|
1256
|
+
}
|
|
1257
|
+
return map;
|
|
1258
|
+
},
|
|
1259
|
+
/** @type {(value: unknown) => Set<unknown>} */
|
|
1260
|
+
[remote_set]: (value) => {
|
|
1261
|
+
if (!Array.isArray(value)) throw new Error("Invalid data for Set reviver");
|
|
1262
|
+
const set = /* @__PURE__ */ new Set();
|
|
1263
|
+
for (const item of value) {
|
|
1264
|
+
if (typeof item !== "string") throw new Error("Invalid data for Set reviver");
|
|
1265
|
+
set.add(parse2(item));
|
|
1266
|
+
}
|
|
1267
|
+
return set;
|
|
1268
|
+
},
|
|
1269
|
+
/** @type {(value: any) => File} */
|
|
1270
|
+
[remote_file]: (value) => {
|
|
1271
|
+
if (!value || typeof value !== "object" || typeof value.name !== "string" || typeof value.type !== "string" || typeof value.size !== "number" || typeof value.lastModified !== "number" || !(value.data instanceof ArrayBuffer)) throw new Error("Invalid data for File reviver");
|
|
1272
|
+
const { data, name, ...meta } = value;
|
|
1273
|
+
return new File([data], name, meta);
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
const all_revivers = {
|
|
1277
|
+
...decoders,
|
|
1278
|
+
...remote_fns_revivers
|
|
1279
|
+
};
|
|
1280
|
+
const parse2 = (data) => parse$1(data, all_revivers);
|
|
1281
|
+
return all_revivers;
|
|
1282
|
+
}
|
|
1283
|
+
function parse_remote_arg(string) {
|
|
1284
|
+
if (!string) return void 0;
|
|
1285
|
+
return parse$1(text_decoder.decode(base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))), create_remote_arg_revivers());
|
|
1286
|
+
}
|
|
1287
|
+
function create_remote_key(id, payload) {
|
|
1288
|
+
return id + "/" + payload;
|
|
1289
|
+
}
|
|
1290
|
+
function split_remote_key(key) {
|
|
1291
|
+
const i = key.lastIndexOf("/");
|
|
1292
|
+
if (i === -1) throw new Error(`Invalid remote key: ${key}`);
|
|
1293
|
+
return {
|
|
1294
|
+
id: key.slice(0, i),
|
|
1295
|
+
payload: key.slice(i + 1)
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
function set_error_stack(error2, stack) {
|
|
1299
|
+
try {
|
|
1300
|
+
Reflect.set(error2, "stack", stack);
|
|
1301
|
+
} catch {
|
|
1302
|
+
}
|
|
1303
|
+
return error2.stack;
|
|
1304
|
+
}
|
|
1305
|
+
function coalesce_to_error(err) {
|
|
1306
|
+
return err instanceof Error || err && err.name && err.message ? err : new Error(JSON.stringify(err));
|
|
1307
|
+
}
|
|
1308
|
+
function normalize_error(error2) {
|
|
1309
|
+
return error2;
|
|
1310
|
+
}
|
|
1311
|
+
function get_status(error2) {
|
|
1312
|
+
return error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500;
|
|
1313
|
+
}
|
|
1314
|
+
function handle_error_async_without_async_svelte(_values) {
|
|
1315
|
+
console.warn("https://svelte.dev/e/kit/handle_error_async_without_async_svelte");
|
|
1316
|
+
}
|
|
1317
|
+
function handle_error_and_jsonify(event, state2, error2) {
|
|
1318
|
+
if (error2 instanceof HandledHttpError) return error2.body;
|
|
1319
|
+
let caught;
|
|
1320
|
+
if (error2 instanceof HttpError) caught = {
|
|
1321
|
+
kind: "app",
|
|
1322
|
+
error: error2.body
|
|
1323
|
+
};
|
|
1324
|
+
else if (error2 instanceof SvelteKitError) caught = {
|
|
1325
|
+
kind: "framework",
|
|
1326
|
+
error: {
|
|
1327
|
+
status: error2.status,
|
|
1328
|
+
message: error2.text
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
else if (error2 instanceof ValidationError) caught = {
|
|
1332
|
+
kind: "validation",
|
|
1333
|
+
error: {
|
|
1334
|
+
status: 400,
|
|
1335
|
+
message: "Bad Request"
|
|
1336
|
+
},
|
|
1337
|
+
issues: error2.issues
|
|
1338
|
+
};
|
|
1339
|
+
else {
|
|
1340
|
+
caught = {
|
|
1341
|
+
kind: "unknown",
|
|
1342
|
+
error: error2
|
|
1343
|
+
};
|
|
1344
|
+
let e = error2;
|
|
1345
|
+
while (e instanceof Error) {
|
|
1346
|
+
fix_stack_trace(e);
|
|
1347
|
+
e = e.cause;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
const fallback = caught.kind === "unknown" ? {
|
|
1351
|
+
status: 500,
|
|
1352
|
+
message: "Internal Error"
|
|
1353
|
+
} : caught.error;
|
|
1354
|
+
function merge(body) {
|
|
1355
|
+
return {
|
|
1356
|
+
...fallback,
|
|
1357
|
+
...body
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
let result;
|
|
1361
|
+
try {
|
|
1362
|
+
const input = {
|
|
1363
|
+
...caught,
|
|
1364
|
+
event
|
|
1365
|
+
};
|
|
1366
|
+
result = with_request_store({
|
|
1367
|
+
event,
|
|
1368
|
+
state: state2
|
|
1369
|
+
}, () => hooks.handleError(input));
|
|
1370
|
+
} catch (hook_error) {
|
|
1371
|
+
log_handle_error_hook_failure(error2, hook_error);
|
|
1372
|
+
return {
|
|
1373
|
+
status: fallback.status,
|
|
1374
|
+
message: "Internal Error"
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
if (result instanceof Promise) {
|
|
1378
|
+
if (state2.is_in_render) {
|
|
1379
|
+
handle_error_async_without_async_svelte();
|
|
1380
|
+
result.catch((hook_error) => log_handle_error_hook_failure(error2, hook_error));
|
|
1381
|
+
return {
|
|
1382
|
+
status: fallback.status,
|
|
1383
|
+
message: "Internal Error"
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
return result.then(merge, (hook_error) => {
|
|
1387
|
+
log_handle_error_hook_failure(error2, hook_error);
|
|
1388
|
+
return {
|
|
1389
|
+
status: fallback.status,
|
|
1390
|
+
message: "Internal Error"
|
|
1391
|
+
};
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
return merge(result);
|
|
1395
|
+
}
|
|
1396
|
+
function log_handle_error_hook_failure(error2, hook_error) {
|
|
1397
|
+
const failure = capture_error(() => handle_error_hook_failed(void 0, { cause: coalesce_to_error(hook_error) }));
|
|
1398
|
+
failure.stack = `${failure.name}: ${failure.message}`;
|
|
1399
|
+
console.error(failure);
|
|
1400
|
+
if (error2 instanceof SvelteKitError) console.error(`Original error: ${error2.status} ${error2.text}: ${error2.message}`);
|
|
1401
|
+
else console.error("Original error:", error2);
|
|
1402
|
+
}
|
|
1403
|
+
var ENDPOINT_METHODS = [
|
|
1404
|
+
"GET",
|
|
1405
|
+
"POST",
|
|
1406
|
+
"PUT",
|
|
1407
|
+
"PATCH",
|
|
1408
|
+
"DELETE",
|
|
1409
|
+
"OPTIONS",
|
|
1410
|
+
"HEAD",
|
|
1411
|
+
"QUERY"
|
|
1412
|
+
];
|
|
1413
|
+
var MUTATIVE_METHODS = [
|
|
1414
|
+
"POST",
|
|
1415
|
+
"PUT",
|
|
1416
|
+
"PATCH",
|
|
1417
|
+
"DELETE"
|
|
1418
|
+
];
|
|
1419
|
+
var BODY_DEPENDENT_METHODS = [...MUTATIVE_METHODS, "QUERY"];
|
|
1420
|
+
var PAGE_METHODS = [
|
|
1421
|
+
"GET",
|
|
1422
|
+
"POST",
|
|
1423
|
+
"HEAD"
|
|
1424
|
+
];
|
|
1425
|
+
import.meta.dirname;
|
|
1426
|
+
var IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
|
|
1427
|
+
var REROUTED_URL_HEADER = "x-sveltekit-rerouted-url";
|
|
1428
|
+
function method_not_allowed(mod, method) {
|
|
1429
|
+
return text(`${method} method not allowed`, {
|
|
1430
|
+
status: 405,
|
|
1431
|
+
headers: { allow: allowed_methods(mod).join(", ") }
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
function allowed_methods(mod) {
|
|
1435
|
+
const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
|
|
1436
|
+
if ("GET" in mod && !("HEAD" in mod)) allowed.push("HEAD");
|
|
1437
|
+
return allowed;
|
|
1438
|
+
}
|
|
1439
|
+
function redirect_response(status, location) {
|
|
1440
|
+
return new Response(void 0, {
|
|
1441
|
+
status,
|
|
1442
|
+
headers: { location }
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
function with_version_header(response) {
|
|
1446
|
+
response.headers.set("x-sveltekit-version", "1794327600754");
|
|
1447
|
+
return response;
|
|
1448
|
+
}
|
|
1449
|
+
function throw_devalue_error(event, error2) {
|
|
1450
|
+
const id = event.route.id;
|
|
1451
|
+
if (error2.path) load_not_serializable({
|
|
1452
|
+
id,
|
|
1453
|
+
message: error2.message,
|
|
1454
|
+
path: error2.path
|
|
1455
|
+
}, { cause: error2 });
|
|
1456
|
+
if (error2.path === "") load_not_plain_object({ id }, { cause: error2 });
|
|
1457
|
+
throw new Error(error2.message, { cause: error2 });
|
|
1458
|
+
}
|
|
1459
|
+
function serialize_uses(node) {
|
|
1460
|
+
const uses = {};
|
|
1461
|
+
if (node.uses && node.uses.dependencies.size > 0) uses.dependencies = Array.from(node.uses.dependencies);
|
|
1462
|
+
if (node.uses && node.uses.search_params.size > 0) uses.search_params = Array.from(node.uses.search_params);
|
|
1463
|
+
if (node.uses && node.uses.params.size > 0) uses.params = Array.from(node.uses.params);
|
|
1464
|
+
if (node.uses?.parent) uses.parent = 1;
|
|
1465
|
+
if (node.uses?.route) uses.route = 1;
|
|
1466
|
+
if (node.uses?.url) uses.url = 1;
|
|
1467
|
+
return uses;
|
|
1468
|
+
}
|
|
1469
|
+
function has_prerendered_path(pathname) {
|
|
1470
|
+
return manifest.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest.prerendered_routes.has(pathname.slice(0, -1));
|
|
1471
|
+
}
|
|
1472
|
+
function get_node_type(node_id) {
|
|
1473
|
+
const filename = node_id?.split("/")?.at(-1);
|
|
1474
|
+
if (!filename) return "unknown";
|
|
1475
|
+
return filename.split(".").slice(0, -1).join(".");
|
|
1476
|
+
}
|
|
1477
|
+
function is_action_json_request(event) {
|
|
1478
|
+
return negotiate(event.request.headers.get("accept") ?? "*/*", ["application/json", "text/html"]) === "application/json" && event.request.method === "POST";
|
|
1479
|
+
}
|
|
1480
|
+
async function handle_action_json_request(event, state2, server) {
|
|
1481
|
+
return action_result_json(event, state2, await handle_action_request(event, state2, server));
|
|
1482
|
+
}
|
|
1483
|
+
async function action_result_json(event, state2, result) {
|
|
1484
|
+
if (result.type === "redirect") return action_json(result);
|
|
1485
|
+
if (result.type === "error") {
|
|
1486
|
+
const error2 = await handle_error_and_jsonify(event, state2, result.error);
|
|
1487
|
+
return action_json({
|
|
1488
|
+
...result,
|
|
1489
|
+
error: error2
|
|
1490
|
+
}, { status: error2.status });
|
|
1491
|
+
}
|
|
1492
|
+
if (result.type === "success" && !result.data) return action_json({
|
|
1493
|
+
...result,
|
|
1494
|
+
status: 204,
|
|
1495
|
+
data: void 0
|
|
1496
|
+
});
|
|
1497
|
+
try {
|
|
1498
|
+
return action_json({
|
|
1499
|
+
...result,
|
|
1500
|
+
data: try_serialize(result.data, stringify, event.route.id)
|
|
1501
|
+
}, { status: result.status });
|
|
1502
|
+
} catch (error2) {
|
|
1503
|
+
return action_result_json(event, state2, action_error_result(error2, result.location));
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
function get_action_location(url2) {
|
|
1507
|
+
const location = new URL(url2);
|
|
1508
|
+
for (const key of location.searchParams.keys()) if (key.startsWith("/")) {
|
|
1509
|
+
location.searchParams.delete(key);
|
|
1510
|
+
break;
|
|
1511
|
+
}
|
|
1512
|
+
return (location.pathname.startsWith("//") ? "/." + location.pathname : location.pathname) + location.search;
|
|
1513
|
+
}
|
|
1514
|
+
function method_not_allowed_result(event, location) {
|
|
1515
|
+
event.setHeaders({ allow: "GET" });
|
|
1516
|
+
return {
|
|
1517
|
+
type: "error",
|
|
1518
|
+
location,
|
|
1519
|
+
error: new SvelteKitError(405, "Method Not Allowed", `POST method not allowed. No form actions exist for this page`)
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
function action_error_result(error2, location) {
|
|
1523
|
+
const err = normalize_error(error2);
|
|
1524
|
+
if (err instanceof Redirect) return {
|
|
1525
|
+
type: "redirect",
|
|
1526
|
+
status: err.status,
|
|
1527
|
+
location: err.location
|
|
1528
|
+
};
|
|
1529
|
+
return {
|
|
1530
|
+
type: "error",
|
|
1531
|
+
location,
|
|
1532
|
+
error: err
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
function action_json_redirect(redirect) {
|
|
1536
|
+
return action_json({
|
|
1537
|
+
type: "redirect",
|
|
1538
|
+
status: redirect.status,
|
|
1539
|
+
location: redirect.location
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
function action_json(data, init) {
|
|
1543
|
+
return with_version_header(Response.json(data, init));
|
|
1544
|
+
}
|
|
1545
|
+
function is_action_request(event) {
|
|
1546
|
+
return event.request.method === "POST";
|
|
1547
|
+
}
|
|
1548
|
+
async function handle_action_request(event, state2, server) {
|
|
1549
|
+
const actions = server?.actions;
|
|
1550
|
+
const location = get_action_location(event.url);
|
|
1551
|
+
if (!actions) return method_not_allowed_result(event, location);
|
|
1552
|
+
check_named_default_separate(actions);
|
|
1553
|
+
try {
|
|
1554
|
+
const data = await call_action(event, state2, actions);
|
|
1555
|
+
if (data instanceof ActionFailure) return {
|
|
1556
|
+
type: "failure",
|
|
1557
|
+
status: data.status,
|
|
1558
|
+
location,
|
|
1559
|
+
data: data.data
|
|
1560
|
+
};
|
|
1561
|
+
else return {
|
|
1562
|
+
type: "success",
|
|
1563
|
+
status: 200,
|
|
1564
|
+
location,
|
|
1565
|
+
data
|
|
1566
|
+
};
|
|
1567
|
+
} catch (error2) {
|
|
1568
|
+
return action_error_result(error2 instanceof ActionFailure ? capture_error(() => action_throw_fail()) : error2, location);
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
function check_named_default_separate(actions) {
|
|
1572
|
+
if (actions.default && Object.keys(actions).length > 1) action_default_with_named();
|
|
1573
|
+
}
|
|
1574
|
+
async function call_action(event, state2, actions) {
|
|
1575
|
+
const url2 = new URL(event.request.url);
|
|
1576
|
+
let name = "default";
|
|
1577
|
+
for (const param of url2.searchParams) if (param[0].startsWith("/")) {
|
|
1578
|
+
name = param[0].slice(1);
|
|
1579
|
+
if (name === "default") action_name_reserved();
|
|
1580
|
+
break;
|
|
1581
|
+
}
|
|
1582
|
+
if (!Object.hasOwn(actions, name)) throw new SvelteKitError(404, "Not Found", `No action with name '${name}' found`);
|
|
1583
|
+
const action = actions[name];
|
|
1584
|
+
if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `Form actions expect form-encoded data \u2014 received ${event.request.headers.get("content-type")}`);
|
|
1585
|
+
return record_span({
|
|
1586
|
+
name: "sveltekit.form_action",
|
|
1587
|
+
attributes: {
|
|
1588
|
+
"sveltekit.form_action.name": name,
|
|
1589
|
+
"http.route": event.route.id || "unknown"
|
|
1590
|
+
},
|
|
1591
|
+
fn: async (current) => {
|
|
1592
|
+
const traced_event = merge_tracing(event, current);
|
|
1593
|
+
const result = await with_request_store({
|
|
1594
|
+
event: traced_event,
|
|
1595
|
+
state: state2
|
|
1596
|
+
}, () => action(traced_event));
|
|
1597
|
+
if (result instanceof ActionFailure) current.setAttributes({
|
|
1598
|
+
"sveltekit.form_action.result.type": "failure",
|
|
1599
|
+
"sveltekit.form_action.result.status": result.status
|
|
1600
|
+
});
|
|
1601
|
+
return result;
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
function uneval_action_response(data, route_id) {
|
|
1606
|
+
return try_serialize(data, uneval2, route_id);
|
|
1607
|
+
}
|
|
1608
|
+
function try_serialize(data, fn, route_id) {
|
|
1609
|
+
try {
|
|
1610
|
+
return fn(data);
|
|
1611
|
+
} catch (error2) {
|
|
1612
|
+
if (data instanceof Response) action_response_not_serializable({ id: route_id }, { cause: error2 });
|
|
1613
|
+
if ("path" in error2) {
|
|
1614
|
+
const values = {
|
|
1615
|
+
id: route_id,
|
|
1616
|
+
message: error2.message
|
|
1617
|
+
};
|
|
1618
|
+
action_data_not_serializable(error2.path === "" ? values : {
|
|
1619
|
+
...values,
|
|
1620
|
+
path: `data${error2.path}`
|
|
1621
|
+
}, { cause: error2 });
|
|
1622
|
+
}
|
|
1623
|
+
throw error2;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
var KEEP_ALIVE_INTERVAL = 3e4;
|
|
1627
|
+
function create_live_query_response(event, state2, internals, arg) {
|
|
1628
|
+
const cancellation = new AbortController();
|
|
1629
|
+
const live_event = {
|
|
1630
|
+
...event,
|
|
1631
|
+
request: new Request(event.request, { signal: AbortSignal.any([event.request.signal, cancellation.signal]) })
|
|
1632
|
+
};
|
|
1633
|
+
const generator = internals.run(live_event, state2, arg);
|
|
1634
|
+
let open = true;
|
|
1635
|
+
let pulling = false;
|
|
1636
|
+
let stream_controller;
|
|
1637
|
+
let keep_alive;
|
|
1638
|
+
let result;
|
|
1639
|
+
function schedule_keep_alive() {
|
|
1640
|
+
clearTimeout(keep_alive);
|
|
1641
|
+
keep_alive = setTimeout(() => {
|
|
1642
|
+
if (!open) return;
|
|
1643
|
+
if ((stream_controller.desiredSize ?? 0) > 0) stream_controller.enqueue(text_encoder.encode(": keep-alive\n\n"));
|
|
1644
|
+
schedule_keep_alive();
|
|
1645
|
+
}, KEEP_ALIVE_INTERVAL);
|
|
1646
|
+
}
|
|
1647
|
+
function send(data) {
|
|
1648
|
+
if (!open) return;
|
|
1649
|
+
stream_controller.enqueue(text_encoder.encode("data: " + JSON.stringify(data) + "\n\n"));
|
|
1650
|
+
schedule_keep_alive();
|
|
1651
|
+
}
|
|
1652
|
+
function teardown(cancelled) {
|
|
1653
|
+
if (!open) return;
|
|
1654
|
+
open = false;
|
|
1655
|
+
clearTimeout(keep_alive);
|
|
1656
|
+
cancellation.abort();
|
|
1657
|
+
if (!cancelled) stream_controller.close();
|
|
1658
|
+
generator.return(void 0).catch(() => {
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
event.request.signal.addEventListener("abort", () => teardown(true), { once: true });
|
|
1662
|
+
return new Response(new ReadableStream({
|
|
1663
|
+
start(controller) {
|
|
1664
|
+
stream_controller = controller;
|
|
1665
|
+
schedule_keep_alive();
|
|
1666
|
+
},
|
|
1667
|
+
async pull() {
|
|
1668
|
+
if (!open || pulling) return;
|
|
1669
|
+
pulling = true;
|
|
1670
|
+
try {
|
|
1671
|
+
while (open) {
|
|
1672
|
+
const { value, done } = await generator.next();
|
|
1673
|
+
if (!open) return;
|
|
1674
|
+
if (done) {
|
|
1675
|
+
teardown(false);
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
if (result !== (result = stringify(value))) {
|
|
1679
|
+
send({
|
|
1680
|
+
type: "result",
|
|
1681
|
+
result
|
|
1682
|
+
});
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
} catch (error2) {
|
|
1687
|
+
if (!open) return;
|
|
1688
|
+
if (error2 instanceof Redirect) send({
|
|
1689
|
+
type: "redirect",
|
|
1690
|
+
location: error2.location
|
|
1691
|
+
});
|
|
1692
|
+
else send({
|
|
1693
|
+
type: "error",
|
|
1694
|
+
error: await handle_error_and_jsonify(event, state2, error2)
|
|
1695
|
+
});
|
|
1696
|
+
teardown(false);
|
|
1697
|
+
} finally {
|
|
1698
|
+
pulling = false;
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
cancel() {
|
|
1702
|
+
teardown(true);
|
|
1703
|
+
}
|
|
1704
|
+
}), { headers: {
|
|
1705
|
+
"cache-control": "private, no-store",
|
|
1706
|
+
"content-type": "text/event-stream"
|
|
1707
|
+
} });
|
|
1708
|
+
}
|
|
1709
|
+
async function handle_remote_call(event, state2, id) {
|
|
1710
|
+
return record_span({
|
|
1711
|
+
name: "sveltekit.remote.call",
|
|
1712
|
+
attributes: { "sveltekit.remote.call.id": id },
|
|
1713
|
+
fn: async (current) => {
|
|
1714
|
+
const traced_event = merge_tracing(event, current);
|
|
1715
|
+
return with_version_header(await with_request_store({
|
|
1716
|
+
event: traced_event,
|
|
1717
|
+
state: state2
|
|
1718
|
+
}, () => handle_remote_call_internal(traced_event, state2, id)));
|
|
1719
|
+
}
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
async function handle_remote_call_internal(event, state2, id) {
|
|
1723
|
+
const [hash, name, additional_args] = id.split("/");
|
|
1724
|
+
const remotes = manifest.remotes;
|
|
1725
|
+
if (!Object.hasOwn(remotes, hash)) error(404);
|
|
1726
|
+
const module2 = await remotes[hash]();
|
|
1727
|
+
const fn = Object.hasOwn(module2.default, name) ? module2.default[name] : void 0;
|
|
1728
|
+
if (!fn) error(404);
|
|
1729
|
+
const internals = fn.__;
|
|
1730
|
+
event.tracing.current.setAttributes({
|
|
1731
|
+
"sveltekit.remote.call.type": internals.type,
|
|
1732
|
+
"sveltekit.remote.call.name": internals.name
|
|
1733
|
+
});
|
|
1734
|
+
const headers = state2.prerendering ? void 0 : { "cache-control": "private, no-store" };
|
|
1735
|
+
try {
|
|
1736
|
+
const data = {};
|
|
1737
|
+
switch (internals.type) {
|
|
1738
|
+
case "query_live":
|
|
1739
|
+
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}`);
|
|
1740
|
+
return create_live_query_response(event, state2, internals, parse_remote_arg(new URL(event.request.url).searchParams.get("payload")));
|
|
1741
|
+
case "query_batch": {
|
|
1742
|
+
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}`);
|
|
1743
|
+
const { payloads } = await event.request.json();
|
|
1744
|
+
const args = await Promise.all(payloads.map((payload) => parse_remote_arg(payload)));
|
|
1745
|
+
data._ = await with_request_store({
|
|
1746
|
+
event,
|
|
1747
|
+
state: state2
|
|
1748
|
+
}, () => internals.run(args));
|
|
1749
|
+
break;
|
|
1750
|
+
}
|
|
1751
|
+
case "form": {
|
|
1752
|
+
if (event.request.method !== "POST") throw new SvelteKitError(405, "Method Not Allowed", `\`form\` functions must be invoked via POST request, not ${event.request.method}`);
|
|
1753
|
+
if (!is_form_content_type(event.request)) throw new SvelteKitError(415, "Unsupported Media Type", `\`form\` functions expect form-encoded data \u2014 received ${event.request.headers.get("content-type")}`);
|
|
1754
|
+
const { data: input, meta, form_data } = await deserialize_binary_form(event.request, internals.id);
|
|
1755
|
+
state2.remote.requested = create_requested_map(meta.remote_refreshes);
|
|
1756
|
+
if (additional_args && !("id" in input)) input.id = JSON.parse(decodeURIComponent(additional_args));
|
|
1757
|
+
const fn2 = internals.fn;
|
|
1758
|
+
data._ = await with_request_store({
|
|
1759
|
+
event,
|
|
1760
|
+
state: {
|
|
1761
|
+
...state2,
|
|
1762
|
+
is_in_remote_form_or_command: true
|
|
1763
|
+
}
|
|
1764
|
+
}, () => fn2(input, meta, form_data));
|
|
1765
|
+
if (data._.issues) return Response.json({
|
|
1766
|
+
type: "result",
|
|
1767
|
+
data: stringify(data)
|
|
1768
|
+
}, { headers });
|
|
1769
|
+
break;
|
|
1770
|
+
}
|
|
1771
|
+
case "command": {
|
|
1772
|
+
const { payload, refreshes } = await event.request.json();
|
|
1773
|
+
state2.remote.requested = create_requested_map(refreshes);
|
|
1774
|
+
const arg = parse_remote_arg(payload);
|
|
1775
|
+
data._ = await with_request_store({
|
|
1776
|
+
event,
|
|
1777
|
+
state: {
|
|
1778
|
+
...state2,
|
|
1779
|
+
is_in_remote_form_or_command: true
|
|
1780
|
+
}
|
|
1781
|
+
}, () => fn(arg));
|
|
1782
|
+
break;
|
|
1783
|
+
}
|
|
1784
|
+
case "prerender":
|
|
1785
|
+
data._ = await with_request_store({
|
|
1786
|
+
event,
|
|
1787
|
+
state: state2
|
|
1788
|
+
}, () => fn(parse_remote_arg(additional_args)));
|
|
1789
|
+
break;
|
|
1790
|
+
case "query": {
|
|
1791
|
+
const payload = new URL(event.request.url).searchParams.get("payload");
|
|
1792
|
+
data._ = await with_request_store({
|
|
1793
|
+
event,
|
|
1794
|
+
state: state2
|
|
1795
|
+
}, () => fn(parse_remote_arg(payload)));
|
|
1796
|
+
break;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
await collect_remote_data(data, event, state2);
|
|
1800
|
+
if (state2.remote.ignored?.size) data.i = Array.from(state2.remote.ignored);
|
|
1801
|
+
return Response.json({
|
|
1802
|
+
type: "result",
|
|
1803
|
+
data: stringify(data)
|
|
1804
|
+
}, { headers });
|
|
1805
|
+
} catch (error2) {
|
|
1806
|
+
if (error2 instanceof Redirect) {
|
|
1807
|
+
const data = await collect_remote_data({ redirect: error2.location }, event, state2);
|
|
1808
|
+
return Response.json({
|
|
1809
|
+
type: "result",
|
|
1810
|
+
data: stringify(data)
|
|
1811
|
+
}, { headers });
|
|
1812
|
+
}
|
|
1813
|
+
const transformed = await handle_error_and_jsonify(event, state2, error2);
|
|
1814
|
+
return Response.json({
|
|
1815
|
+
type: "error",
|
|
1816
|
+
error: transformed
|
|
1817
|
+
}, {
|
|
1818
|
+
status: state2.prerendering ? transformed.status : void 0,
|
|
1819
|
+
headers: { "cache-control": "private, no-store" }
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
async function collect_remote_data(data, event, state2) {
|
|
1824
|
+
function convert_error(error2) {
|
|
1825
|
+
return Promise.resolve(handle_error_and_jsonify(event, state2, error2));
|
|
1826
|
+
}
|
|
1827
|
+
const promises = [];
|
|
1828
|
+
const processed = /* @__PURE__ */ new Set();
|
|
1829
|
+
if (state2.remote.explicit) {
|
|
1830
|
+
const { explicit } = state2.remote;
|
|
1831
|
+
const inflight = [];
|
|
1832
|
+
const drain = () => {
|
|
1833
|
+
for (const [remote_key, { internals, fn }] of explicit) {
|
|
1834
|
+
explicit.delete(remote_key);
|
|
1835
|
+
if (processed.has(remote_key)) continue;
|
|
1836
|
+
processed.add(remote_key);
|
|
1837
|
+
data.r = true;
|
|
1838
|
+
const type = internals.type === "query_live" ? "l" : internals.type[0];
|
|
1839
|
+
inflight.push(fn().then((v) => {
|
|
1840
|
+
(data[type] ??= {})[remote_key] = { v };
|
|
1841
|
+
drain();
|
|
1842
|
+
}, async (e) => {
|
|
1843
|
+
if (!(e instanceof Redirect)) (data[type] ??= {})[remote_key] = { e: await convert_error(e) };
|
|
1844
|
+
drain();
|
|
1845
|
+
}));
|
|
1846
|
+
}
|
|
1847
|
+
};
|
|
1848
|
+
drain();
|
|
1849
|
+
for (const promise of inflight) await promise;
|
|
1850
|
+
}
|
|
1851
|
+
if (state2.remote.implicit) for (const [internals, record] of state2.remote.implicit) {
|
|
1852
|
+
if (!internals.id) continue;
|
|
1853
|
+
for (const key in record) {
|
|
1854
|
+
const remote_key = internals.type === "form" ? key : create_remote_key(internals.id, key);
|
|
1855
|
+
if (processed.has(remote_key)) continue;
|
|
1856
|
+
const type = internals.type === "query_live" ? "l" : internals.type[0];
|
|
1857
|
+
const promise = state2.remote.data?.get(internals)?.[key] ?? record[key]();
|
|
1858
|
+
let resolved = true;
|
|
1859
|
+
await Promise.race([Promise.resolve(promise).then((v) => {
|
|
1860
|
+
if (resolved) ((data[type] ??= {})[remote_key] ??= {}).v = v;
|
|
1861
|
+
}, (e) => {
|
|
1862
|
+
if (e instanceof Redirect) return;
|
|
1863
|
+
if (resolved) promises.push(convert_error(e).then((e2) => {
|
|
1864
|
+
((data[type] ??= {})[remote_key] ??= {}).e = e2;
|
|
1865
|
+
}));
|
|
1866
|
+
}), Promise.resolve().then(() => resolved = false)]);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
await Promise.all(promises);
|
|
1870
|
+
return data;
|
|
1871
|
+
}
|
|
1872
|
+
function create_requested_map(refreshes) {
|
|
1873
|
+
const requested = /* @__PURE__ */ new Map();
|
|
1874
|
+
for (const key of refreshes ?? []) {
|
|
1875
|
+
const parts = split_remote_key(key);
|
|
1876
|
+
const existing = requested.get(parts.id);
|
|
1877
|
+
if (existing) existing.add(parts.payload);
|
|
1878
|
+
else requested.set(parts.id, /* @__PURE__ */ new Set([parts.payload]));
|
|
1879
|
+
}
|
|
1880
|
+
return requested;
|
|
1881
|
+
}
|
|
1882
|
+
async function handle_remote_form_post(event, state2, id) {
|
|
1883
|
+
return record_span({
|
|
1884
|
+
name: "sveltekit.remote.form.post",
|
|
1885
|
+
attributes: { "sveltekit.remote.form.post.id": id },
|
|
1886
|
+
fn: (current) => {
|
|
1887
|
+
const traced_event = merge_tracing(event, current);
|
|
1888
|
+
return with_request_store({
|
|
1889
|
+
event: traced_event,
|
|
1890
|
+
state: state2
|
|
1891
|
+
}, () => handle_remote_form_post_internal(traced_event, state2, id));
|
|
1892
|
+
}
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
async function handle_remote_form_post_internal(event, state2, id) {
|
|
1896
|
+
const location = get_action_location(event.url);
|
|
1897
|
+
const [hash, name, ...rest] = id.split("/");
|
|
1898
|
+
const action_id = rest.join("/");
|
|
1899
|
+
const remotes = manifest.remotes;
|
|
1900
|
+
const module2 = Object.hasOwn(remotes, hash) ? await remotes[hash]() : void 0;
|
|
1901
|
+
let form = module2 && Object.hasOwn(module2.default, name) ? module2.default[name] : void 0;
|
|
1902
|
+
if (!form) return method_not_allowed_result(event, location);
|
|
1903
|
+
if (action_id) form = with_request_store({
|
|
1904
|
+
event,
|
|
1905
|
+
state: state2
|
|
1906
|
+
}, () => form.for(JSON.parse(action_id)));
|
|
1907
|
+
try {
|
|
1908
|
+
const __ = form.__;
|
|
1909
|
+
const { data, meta, form_data } = await deserialize_binary_form(event.request, __.id);
|
|
1910
|
+
if (action_id && !("id" in data)) data.id = JSON.parse(decodeURIComponent(action_id));
|
|
1911
|
+
await with_request_store({
|
|
1912
|
+
event,
|
|
1913
|
+
state: {
|
|
1914
|
+
...state2,
|
|
1915
|
+
is_in_remote_form_or_command: true
|
|
1916
|
+
}
|
|
1917
|
+
}, () => __.fn(data, meta, form_data));
|
|
1918
|
+
return {
|
|
1919
|
+
type: "success",
|
|
1920
|
+
status: 200,
|
|
1921
|
+
location
|
|
1922
|
+
};
|
|
1923
|
+
} catch (e) {
|
|
1924
|
+
return action_error_result(e, location);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
function has_remote_prefix(url2) {
|
|
1928
|
+
return url2.pathname.startsWith(`/${app_dir}/remote/`);
|
|
1929
|
+
}
|
|
1930
|
+
function strip_remote_prefix(url2) {
|
|
1931
|
+
return url2.pathname.replace(`/${app_dir}/remote/`, "");
|
|
1932
|
+
}
|
|
1933
|
+
function get_remote_id(url2) {
|
|
1934
|
+
return has_remote_prefix(url2) && strip_remote_prefix(url2);
|
|
1935
|
+
}
|
|
1936
|
+
function get_remote_action(url2) {
|
|
1937
|
+
return url2.searchParams.get("/remote");
|
|
1938
|
+
}
|
|
1939
|
+
var fs = globalThis.process?.getBuiltinModule?.("node:fs");
|
|
1940
|
+
var url = globalThis.process?.getBuiltinModule?.("node:url");
|
|
1941
|
+
var path = globalThis.process?.getBuiltinModule?.("node:path");
|
|
1942
|
+
var module = globalThis.process?.getBuiltinModule?.("node:module");
|
|
1943
|
+
var cwd = globalThis.process?.cwd?.();
|
|
1944
|
+
var relative = cwd ? (file) => path.relative(cwd, file) : (file) => file;
|
|
1945
|
+
var fix_stack_trace = (error2) => {
|
|
1946
|
+
if (!error2.stack || !fs) return;
|
|
1947
|
+
let end = 0;
|
|
1948
|
+
set_error_stack(error2, error2.stack.split("\n").map((line, i) => {
|
|
1949
|
+
const match = line.match(/^ {4}at.+(file:\/\/\/.*):(\d+):(\d+)(\)?)$/);
|
|
1950
|
+
if (!match) {
|
|
1951
|
+
if (!line.includes("node:internal/")) end = i + 1;
|
|
1952
|
+
return line;
|
|
1953
|
+
}
|
|
1954
|
+
const file = url.fileURLToPath(match[1]);
|
|
1955
|
+
const traced = trace(file, Number(match[2]) - 1, Number(match[3]) - 1);
|
|
1956
|
+
if (!/[\\/]node_modules[\\/]/.test(traced?.file ?? file)) end = i + 1;
|
|
1957
|
+
if (traced?.line) {
|
|
1958
|
+
const location = `${match[1]}:${match[2]}:${match[3]}`;
|
|
1959
|
+
const original = `${relative(traced.file)}:${traced.line}:${traced.column}`;
|
|
1960
|
+
return line.replace(location, original);
|
|
1961
|
+
}
|
|
1962
|
+
if (traced) return `${line.replace(match[1], relative(file))} [${traced.file}]`;
|
|
1963
|
+
return line;
|
|
1964
|
+
}).slice(0, end).join("\n"));
|
|
1965
|
+
};
|
|
1966
|
+
function set_fix_stack_trace(fn) {
|
|
1967
|
+
fix_stack_trace = fn;
|
|
1968
|
+
}
|
|
1969
|
+
var source_maps = /* @__PURE__ */ new Map();
|
|
1970
|
+
var source_regions = /* @__PURE__ */ new Map();
|
|
1971
|
+
function get_source_map(file) {
|
|
1972
|
+
if (source_maps.has(file)) return source_maps.get(file);
|
|
1973
|
+
try {
|
|
1974
|
+
let source;
|
|
1975
|
+
let directory = path.dirname(file);
|
|
1976
|
+
const code = fs.readFileSync(file, "utf8");
|
|
1977
|
+
const url2 = Array.from(code.matchAll(/\/\/[#@]\s*sourceMappingURL=(\S+)/g)).at(-1)?.[1];
|
|
1978
|
+
if (url2?.startsWith("data:")) {
|
|
1979
|
+
const comma = url2.indexOf(",");
|
|
1980
|
+
const metadata = url2.slice(5, comma);
|
|
1981
|
+
const data = url2.slice(comma + 1);
|
|
1982
|
+
source = metadata.endsWith(";base64") ? Buffer.from(data, "base64").toString() : decodeURIComponent(data);
|
|
1983
|
+
} else {
|
|
1984
|
+
const map_file = url2 ? path.resolve(path.dirname(file), decodeURIComponent(url2)) : `${file}.map`;
|
|
1985
|
+
if (fs.existsSync(map_file)) {
|
|
1986
|
+
directory = path.dirname(map_file);
|
|
1987
|
+
source = fs.readFileSync(map_file, "utf8");
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
if (source) {
|
|
1991
|
+
const source_map = {
|
|
1992
|
+
map: new module.SourceMap(JSON.parse(source)),
|
|
1993
|
+
directory
|
|
1994
|
+
};
|
|
1995
|
+
source_maps.set(file, source_map);
|
|
1996
|
+
return source_map;
|
|
1997
|
+
}
|
|
1998
|
+
} catch {
|
|
1999
|
+
}
|
|
2000
|
+
source_maps.set(file, null);
|
|
2001
|
+
return null;
|
|
2002
|
+
}
|
|
2003
|
+
function trace(file, line, column) {
|
|
2004
|
+
const source_map = get_source_map(file);
|
|
2005
|
+
if (!source_map) return null;
|
|
2006
|
+
const entry = source_map.map.findEntry(line, column);
|
|
2007
|
+
if (entry && "originalSource" in entry && entry.originalSource && typeof entry.originalLine === "number" && typeof entry.originalColumn === "number") {
|
|
2008
|
+
const traced = {
|
|
2009
|
+
file: entry.originalSource.startsWith("file:") ? url.fileURLToPath(entry.originalSource) : path.resolve(source_map.directory, entry.originalSource),
|
|
2010
|
+
line: entry.originalLine + 1,
|
|
2011
|
+
column: entry.originalColumn + 1
|
|
2012
|
+
};
|
|
2013
|
+
return trace(traced.file, traced.line - 1, traced.column - 1) ?? traced;
|
|
2014
|
+
}
|
|
2015
|
+
let regions = source_regions.get(file);
|
|
2016
|
+
if (!regions) {
|
|
2017
|
+
let source2;
|
|
2018
|
+
regions = fs.readFileSync(file, "utf8").split("\n").map((line2) => {
|
|
2019
|
+
const start = line2.match(/^\/\/#region (.+)$/);
|
|
2020
|
+
if (start) source2 = start[1];
|
|
2021
|
+
if (line2 === "//#endregion") source2 = void 0;
|
|
2022
|
+
return source2;
|
|
2023
|
+
});
|
|
2024
|
+
source_regions.set(file, regions);
|
|
2025
|
+
}
|
|
2026
|
+
const source = regions[line];
|
|
2027
|
+
if (source) return { file: source };
|
|
2028
|
+
return null;
|
|
2029
|
+
}
|
|
2030
|
+
var styleText = globalThis.process?.getBuiltinModule?.("node:util")?.styleText ?? ((_format, text2) => text2);
|
|
2031
|
+
var read_implementation = false;
|
|
2032
|
+
var manifest = false;
|
|
2033
|
+
var hooks = false;
|
|
2034
|
+
function set_read_implementation(read) {
|
|
2035
|
+
read_implementation = (file) => {
|
|
2036
|
+
const result = read(file);
|
|
2037
|
+
if (result instanceof ReadableStream) return result;
|
|
2038
|
+
return stream_from_iterable((async function* () {
|
|
2039
|
+
const stream = await result;
|
|
2040
|
+
if (stream) yield* stream;
|
|
2041
|
+
})());
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
function set_manifest(value) {
|
|
2045
|
+
manifest = value;
|
|
2046
|
+
}
|
|
2047
|
+
function set_hooks(value) {
|
|
2048
|
+
hooks = value;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
export {
|
|
2052
|
+
enable_verbose_errors,
|
|
2053
|
+
assets,
|
|
2054
|
+
app_dir,
|
|
2055
|
+
set_assets,
|
|
2056
|
+
text_encoder,
|
|
2057
|
+
stream_text,
|
|
2058
|
+
base64_encode,
|
|
2059
|
+
has_data_suffix,
|
|
2060
|
+
add_data_suffix,
|
|
2061
|
+
strip_data_suffix,
|
|
2062
|
+
has_resolution_suffix,
|
|
2063
|
+
add_resolution_suffix,
|
|
2064
|
+
strip_resolution_suffix,
|
|
2065
|
+
invalid_export,
|
|
2066
|
+
invalid_export_location,
|
|
2067
|
+
find_route,
|
|
2068
|
+
resolve,
|
|
2069
|
+
relative_pathname,
|
|
2070
|
+
normalize_path,
|
|
2071
|
+
decode_pathname,
|
|
2072
|
+
make_trackable,
|
|
2073
|
+
disable_search,
|
|
2074
|
+
options,
|
|
2075
|
+
get_hooks,
|
|
2076
|
+
stringify$1,
|
|
2077
|
+
noop,
|
|
2078
|
+
once,
|
|
2079
|
+
disallow_on_server,
|
|
2080
|
+
negotiate,
|
|
2081
|
+
is_form_content_type,
|
|
2082
|
+
uneval2 as uneval,
|
|
2083
|
+
encoders,
|
|
2084
|
+
has_custom_transporters,
|
|
2085
|
+
init_transport,
|
|
2086
|
+
fetch_cache_url,
|
|
2087
|
+
INVALIDATED_PARAM,
|
|
2088
|
+
TRAILING_SLASH_PARAM,
|
|
2089
|
+
normalize_error,
|
|
2090
|
+
get_status,
|
|
2091
|
+
handle_error_and_jsonify,
|
|
2092
|
+
ENDPOINT_METHODS,
|
|
2093
|
+
BODY_DEPENDENT_METHODS,
|
|
2094
|
+
PAGE_METHODS,
|
|
2095
|
+
IN_WEBCONTAINER,
|
|
2096
|
+
REROUTED_URL_HEADER,
|
|
2097
|
+
method_not_allowed,
|
|
2098
|
+
redirect_response,
|
|
2099
|
+
with_version_header,
|
|
2100
|
+
throw_devalue_error,
|
|
2101
|
+
serialize_uses,
|
|
2102
|
+
has_prerendered_path,
|
|
2103
|
+
get_node_type,
|
|
2104
|
+
is_action_json_request,
|
|
2105
|
+
handle_action_json_request,
|
|
2106
|
+
action_json_redirect,
|
|
2107
|
+
is_action_request,
|
|
2108
|
+
handle_action_request,
|
|
2109
|
+
uneval_action_response,
|
|
2110
|
+
handle_remote_call,
|
|
2111
|
+
collect_remote_data,
|
|
2112
|
+
handle_remote_form_post,
|
|
2113
|
+
get_remote_id,
|
|
2114
|
+
get_remote_action,
|
|
2115
|
+
set_fix_stack_trace,
|
|
2116
|
+
read_implementation,
|
|
2117
|
+
manifest,
|
|
2118
|
+
hooks,
|
|
2119
|
+
set_read_implementation,
|
|
2120
|
+
set_manifest,
|
|
2121
|
+
set_hooks
|
|
2122
|
+
};
|