screenreader-speech-capture 0.1.0-feat-playwright-supervisor.1 → 0.2.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.
Files changed (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -0
  3. package/dist/cli.mjs +3728 -1248
  4. package/dist/ui/adapter-node.js +11 -0
  5. package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js +3 -0
  6. package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js.br +0 -0
  7. package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js.gz +0 -0
  8. package/dist/ui/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
  9. package/dist/ui/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
  10. package/dist/ui/client/_app/immutable/chunks/Bjy-W4x2.js.gz +0 -0
  11. package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js +2 -0
  12. package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js.br +0 -0
  13. package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js.gz +0 -0
  14. package/dist/ui/client/_app/immutable/chunks/DclECHGd.js +1 -0
  15. package/dist/ui/client/_app/immutable/chunks/DclECHGd.js.br +0 -0
  16. package/dist/ui/client/_app/immutable/chunks/DclECHGd.js.gz +0 -0
  17. package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js +1 -0
  18. package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js.br +0 -0
  19. package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js.gz +0 -0
  20. package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js +2 -0
  21. package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js.br +0 -0
  22. package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js.gz +0 -0
  23. package/dist/ui/client/_app/immutable/entry/payload.DSmR2FwN.js +1 -0
  24. package/dist/ui/client/_app/immutable/entry/payload.DSmR2FwN.js.br +0 -0
  25. package/dist/ui/client/_app/immutable/entry/payload.DSmR2FwN.js.gz +0 -0
  26. package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js +2 -0
  27. package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js.br +0 -0
  28. package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js.gz +0 -0
  29. package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js +1 -0
  30. package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js.br +0 -0
  31. package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js.gz +0 -0
  32. package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js +1 -0
  33. package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js.br +0 -0
  34. package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js.gz +0 -0
  35. package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js +1 -0
  36. package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js.br +0 -0
  37. package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js.gz +0 -0
  38. package/dist/ui/client/_app/version.json +1 -0
  39. package/dist/ui/client/_app/version.json.br +0 -0
  40. package/dist/ui/client/_app/version.json.gz +0 -0
  41. package/dist/ui/client/robots.txt +3 -0
  42. package/dist/ui/client/robots.txt.br +0 -0
  43. package/dist/ui/client/robots.txt.gz +0 -0
  44. package/dist/ui/handler.js +1 -0
  45. package/dist/ui/index.js +1 -0
  46. package/dist/ui/server/.vite/manifest.json +186 -0
  47. package/dist/ui/server/adapter-env.js +1 -0
  48. package/dist/ui/server/adapter-index.js +73 -0
  49. package/dist/ui/server/adapter-index.js.map +1 -0
  50. package/dist/ui/server/adapter-node-env.js +63 -0
  51. package/dist/ui/server/adapter-node-env.js.map +1 -0
  52. package/dist/ui/server/adapter-node-handler.js +616 -0
  53. package/dist/ui/server/adapter-node-handler.js.map +1 -0
  54. package/dist/ui/server/chunks/config.js +9 -0
  55. package/dist/ui/server/chunks/config.js.map +1 -0
  56. package/dist/ui/server/chunks/exports.js +484 -0
  57. package/dist/ui/server/chunks/exports.js.map +1 -0
  58. package/dist/ui/server/chunks/functions.js +29 -0
  59. package/dist/ui/server/chunks/functions.js.map +1 -0
  60. package/dist/ui/server/chunks/instance.js +3568 -0
  61. package/dist/ui/server/chunks/instance.js.map +1 -0
  62. package/dist/ui/server/chunks/internal.js +2900 -0
  63. package/dist/ui/server/chunks/internal.js.map +1 -0
  64. package/dist/ui/server/chunks/server-errors.js +487 -0
  65. package/dist/ui/server/chunks/server-errors.js.map +1 -0
  66. package/dist/ui/server/chunks/server.js +8 -0
  67. package/dist/ui/server/chunks/server.js.map +1 -0
  68. package/dist/ui/server/chunks/server2.js +1368 -0
  69. package/dist/ui/server/chunks/server2.js.map +1 -0
  70. package/dist/ui/server/chunks/shared.js +85 -0
  71. package/dist/ui/server/chunks/shared.js.map +1 -0
  72. package/dist/ui/server/chunks/uneval.js +534 -0
  73. package/dist/ui/server/chunks/uneval.js.map +1 -0
  74. package/dist/ui/server/entries/fallbacks/error.svelte.js +44 -0
  75. package/dist/ui/server/entries/fallbacks/error.svelte.js.map +1 -0
  76. package/dist/ui/server/entries/pages/_layout.server.ts.js +987 -0
  77. package/dist/ui/server/entries/pages/_layout.server.ts.js.map +1 -0
  78. package/dist/ui/server/entries/pages/_layout.svelte.js +15 -0
  79. package/dist/ui/server/entries/pages/_layout.svelte.js.map +1 -0
  80. package/dist/ui/server/entries/pages/_page.svelte.js +11 -0
  81. package/dist/ui/server/entries/pages/_page.svelte.js.map +1 -0
  82. package/dist/ui/server/env.js +1 -0
  83. package/dist/ui/server/handler.js +1 -0
  84. package/dist/ui/server/index.js +67 -0
  85. package/dist/ui/server/index.js.map +1 -0
  86. package/dist/ui/server/manifest-full.js +37 -0
  87. package/dist/ui/server/manifest.js +37 -0
  88. package/dist/ui/server/nodes/0.js +10 -0
  89. package/dist/ui/server/nodes/1.js +8 -0
  90. package/dist/ui/server/nodes/2.js +8 -0
  91. package/dist/ui/server/remote-entry.js +1565 -0
  92. package/dist/ui/server/remote-entry.js.map +1 -0
  93. package/dist/ui/server/server.js +39 -0
  94. package/package.json +14 -3
@@ -0,0 +1,1368 @@
1
+ import { t as uneval } from "./uneval.js";
2
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/constants.js
3
+ var UNINITIALIZED = Symbol("uninitialized");
4
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/escaping.js
5
+ var ATTR_REGEX = /[&"<]/g;
6
+ var CONTENT_REGEX = /[&<]/g;
7
+ /**
8
+ * @template V
9
+ * @param {V} value
10
+ * @param {boolean} [is_attr]
11
+ */
12
+ function escape_html(value, is_attr) {
13
+ const str = String(value ?? "");
14
+ const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
15
+ pattern.lastIndex = 0;
16
+ let escaped = "";
17
+ let last = 0;
18
+ while (pattern.test(str)) {
19
+ const i = pattern.lastIndex - 1;
20
+ const ch = str[i];
21
+ escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === "\"" ? "&quot;" : "&lt;");
22
+ last = i + 1;
23
+ }
24
+ return escaped + str.substring(last);
25
+ }
26
+ // ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
27
+ function r(e) {
28
+ var t, f, n = "";
29
+ if ("string" == typeof e || "number" == typeof e) n += e;
30
+ else if ("object" == typeof e) if (Array.isArray(e)) {
31
+ var o = e.length;
32
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
33
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
34
+ return n;
35
+ }
36
+ function clsx$1() {
37
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
38
+ return n;
39
+ }
40
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/shared/utils.js
41
+ var is_array = Array.isArray;
42
+ Array.prototype.indexOf;
43
+ Array.prototype.includes;
44
+ Array.from;
45
+ Array.prototype;
46
+ var has_own_property = Object.prototype.hasOwnProperty;
47
+ var noop = () => {};
48
+ /**
49
+ * TODO replace with Promise.withResolvers once supported widely enough
50
+ * @template [T=void]
51
+ */
52
+ function deferred() {
53
+ /** @type {(value: T) => void} */
54
+ var resolve;
55
+ /** @type {(reason: any) => void} */
56
+ var reject;
57
+ return {
58
+ promise: new Promise((res, rej) => {
59
+ resolve = res;
60
+ reject = rej;
61
+ }),
62
+ resolve,
63
+ reject
64
+ };
65
+ }
66
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/shared/attributes.js
67
+ /**
68
+ * `<div translate={false}>` should be rendered as `<div translate="no">` and _not_
69
+ * `<div translate="false">`, which is equivalent to `<div translate="yes">`. There
70
+ * may be other odd cases that need to be added to this list in future
71
+ * @type {Record<string, Map<any, string>>}
72
+ */
73
+ var replacements = { translate: /* @__PURE__ */ new Map([[true, "yes"], [false, "no"]]) };
74
+ /**
75
+ * @template V
76
+ * @param {string} name
77
+ * @param {V} value
78
+ * @param {boolean} [is_boolean]
79
+ * @returns {string}
80
+ */
81
+ function attr(name, value, is_boolean = false) {
82
+ if (name === "hidden" && value !== "until-found") is_boolean = true;
83
+ if (value == null || is_boolean && !value && value !== "") return "";
84
+ const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
85
+ return ` ${name}${is_boolean ? `=""` : `="${escape_html(normalized, true)}"`}`;
86
+ }
87
+ /**
88
+ * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.
89
+ * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)
90
+ * @param {any} value
91
+ */
92
+ function clsx(value) {
93
+ if (typeof value === "object") return clsx$1(value);
94
+ else return value ?? "";
95
+ }
96
+ var whitespace = [..." \n\r\f\xA0\v"];
97
+ /**
98
+ * @param {any} value
99
+ * @param {string | null} [hash]
100
+ * @param {Record<string, boolean>} [directives]
101
+ * @returns {string | null}
102
+ */
103
+ function to_class(value, hash, directives) {
104
+ var classname = value == null ? "" : "" + value;
105
+ if (hash) classname = classname ? classname + " " + hash : hash;
106
+ if (directives) {
107
+ for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key;
108
+ else if (classname.length) {
109
+ var len = key.length;
110
+ var a = 0;
111
+ while ((a = classname.indexOf(key, a)) >= 0) {
112
+ var b = a + len;
113
+ if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
114
+ else a = b;
115
+ }
116
+ }
117
+ }
118
+ return classname === "" ? null : classname;
119
+ }
120
+ /**
121
+ *
122
+ * @param {Record<string,any>} styles
123
+ * @param {boolean} important
124
+ */
125
+ function append_styles(styles, important = false) {
126
+ var separator = important ? " !important;" : ";";
127
+ var css = "";
128
+ for (var key of Object.keys(styles)) {
129
+ var value = styles[key];
130
+ if (value != null && value !== "") css += " " + key + ": " + value + separator;
131
+ }
132
+ return css;
133
+ }
134
+ /**
135
+ * @param {string} name
136
+ * @returns {string}
137
+ */
138
+ function to_css_name(name) {
139
+ if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase();
140
+ return name;
141
+ }
142
+ /**
143
+ * @param {any} value
144
+ * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]
145
+ * @returns {string | null}
146
+ */
147
+ function to_style(value, styles) {
148
+ if (styles) {
149
+ var new_style = "";
150
+ /** @type {Record<string,any> | undefined} */
151
+ var normal_styles;
152
+ /** @type {Record<string,any> | undefined} */
153
+ var important_styles;
154
+ if (Array.isArray(styles)) {
155
+ normal_styles = styles[0];
156
+ important_styles = styles[1];
157
+ } else normal_styles = styles;
158
+ if (value) {
159
+ value = String(value).replaceAll(/\/\*.*?\*\//g, "").trim();
160
+ /** @type {boolean | '"' | "'"} */
161
+ var in_str = false;
162
+ var in_apo = 0;
163
+ var in_comment = false;
164
+ var reserved_names = [];
165
+ if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
166
+ if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name));
167
+ var start_index = 0;
168
+ var name_index = -1;
169
+ const len = value.length;
170
+ for (var i = 0; i < len; i++) {
171
+ var c = value[i];
172
+ if (in_comment) {
173
+ if (c === "/" && value[i - 1] === "*") in_comment = false;
174
+ } else if (in_str) {
175
+ if (in_str === c) in_str = false;
176
+ } else if (c === "/" && value[i + 1] === "*") in_comment = true;
177
+ else if (c === "\"" || c === "'") in_str = c;
178
+ else if (c === "(") in_apo++;
179
+ else if (c === ")") in_apo--;
180
+ if (!in_comment && in_str === false && in_apo === 0) {
181
+ if (c === ":" && name_index === -1) name_index = i;
182
+ else if (c === ";" || i === len - 1) {
183
+ if (name_index !== -1) {
184
+ var name = to_css_name(value.substring(start_index, name_index).trim());
185
+ if (!reserved_names.includes(name)) {
186
+ if (c !== ";") i++;
187
+ var property = value.substring(start_index, i).trim();
188
+ new_style += " " + property + ";";
189
+ }
190
+ }
191
+ start_index = i + 1;
192
+ name_index = -1;
193
+ }
194
+ }
195
+ }
196
+ }
197
+ if (normal_styles) new_style += append_styles(normal_styles);
198
+ if (important_styles) new_style += append_styles(important_styles, true);
199
+ new_style = new_style.trim();
200
+ return new_style === "" ? null : new_style;
201
+ }
202
+ return value == null ? null : String(value);
203
+ }
204
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/constants.js
205
+ /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
206
+ var STALE_REACTION = new class StaleReactionError extends Error {
207
+ name = "StaleReactionError";
208
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
209
+ }();
210
+ globalThis.document?.contentType;
211
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/shared/errors.js
212
+ /**
213
+ * `%name%(...)` can only be used during component initialisation
214
+ * @param {string} name
215
+ * @returns {never}
216
+ */
217
+ function lifecycle_outside_component(name) {
218
+ throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
219
+ }
220
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/flags/index.js
221
+ /** True if experimental.async=true */
222
+ var async_mode_flag = false;
223
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/shared/context.js
224
+ /**
225
+ * @typedef {{ p: Context | null, c: Map<unknown, unknown> | null }} Context
226
+ */
227
+ /**
228
+ * @param {Context} context
229
+ * @returns {Map<unknown, unknown> | null}
230
+ */
231
+ function get_parent_context(context) {
232
+ let parent = context.p;
233
+ while (parent !== null && parent.c === null) parent = parent.p;
234
+ return parent?.c ?? null;
235
+ }
236
+ /**
237
+ * @param {Context | null} context
238
+ * @param {string} name
239
+ * @returns {Map<unknown, unknown>}
240
+ */
241
+ function get_or_init_context_map(context, name) {
242
+ if (context === null) lifecycle_outside_component(name);
243
+ return context.c ??= new Map(get_parent_context(context) || void 0);
244
+ }
245
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/hydration.js
246
+ var BLOCK_OPEN = `<!--[-->`;
247
+ var BLOCK_CLOSE = `<!--]-->`;
248
+ var EMPTY_COMMENT = `<!---->`;
249
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/utils.js
250
+ /**
251
+ * Attributes that are boolean, i.e. they are present or not present.
252
+ */
253
+ var DOM_BOOLEAN_ATTRIBUTES = [
254
+ "allowfullscreen",
255
+ "async",
256
+ "autofocus",
257
+ "autoplay",
258
+ "checked",
259
+ "controls",
260
+ "default",
261
+ "disabled",
262
+ "formnovalidate",
263
+ "indeterminate",
264
+ "inert",
265
+ "ismap",
266
+ "loop",
267
+ "multiple",
268
+ "muted",
269
+ "nomodule",
270
+ "novalidate",
271
+ "open",
272
+ "playsinline",
273
+ "readonly",
274
+ "required",
275
+ "reversed",
276
+ "seamless",
277
+ "selected",
278
+ "webkitdirectory",
279
+ "defer",
280
+ "disablepictureinpicture",
281
+ "disableremoteplayback"
282
+ ];
283
+ /**
284
+ * Returns `true` if `name` is a boolean attribute
285
+ * @param {string} name
286
+ */
287
+ function is_boolean_attribute(name) {
288
+ return DOM_BOOLEAN_ATTRIBUTES.includes(name);
289
+ }
290
+ [...DOM_BOOLEAN_ATTRIBUTES];
291
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/errors.js
292
+ /**
293
+ * The node API `AsyncLocalStorage` is not available, but is required to use async server rendering.
294
+ * @returns {never}
295
+ */
296
+ function async_local_storage_unavailable() {
297
+ const error = /* @__PURE__ */ new Error(`async_local_storage_unavailable\nThe node API \`AsyncLocalStorage\` is not available, but is required to use async server rendering.\nhttps://svelte.dev/e/async_local_storage_unavailable`);
298
+ error.name = "Svelte error";
299
+ throw error;
300
+ }
301
+ /**
302
+ * Encountered asynchronous work while rendering synchronously.
303
+ * @returns {never}
304
+ */
305
+ function await_invalid() {
306
+ const error = /* @__PURE__ */ new Error(`await_invalid\nEncountered asynchronous work while rendering synchronously.\nhttps://svelte.dev/e/await_invalid`);
307
+ error.name = "Svelte error";
308
+ throw error;
309
+ }
310
+ /**
311
+ * The `html` property of server render results has been deprecated. Use `body` instead.
312
+ * @returns {never}
313
+ */
314
+ function html_deprecated() {
315
+ const error = /* @__PURE__ */ new Error(`html_deprecated\nThe \`html\` property of server render results has been deprecated. Use \`body\` instead.\nhttps://svelte.dev/e/html_deprecated`);
316
+ error.name = "Svelte error";
317
+ throw error;
318
+ }
319
+ /**
320
+ * `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
321
+ * @returns {never}
322
+ */
323
+ function invalid_csp() {
324
+ const error = /* @__PURE__ */ new Error(`invalid_csp\n\`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.\nhttps://svelte.dev/e/invalid_csp`);
325
+ error.name = "Svelte error";
326
+ throw error;
327
+ }
328
+ /**
329
+ * The `idPrefix` option cannot include `--`.
330
+ * @returns {never}
331
+ */
332
+ function invalid_id_prefix() {
333
+ const error = /* @__PURE__ */ new Error(`invalid_id_prefix\nThe \`idPrefix\` option cannot include \`--\`.\nhttps://svelte.dev/e/invalid_id_prefix`);
334
+ error.name = "Svelte error";
335
+ throw error;
336
+ }
337
+ /**
338
+ * Could not resolve `render` context.
339
+ * @returns {never}
340
+ */
341
+ function server_context_required() {
342
+ const error = /* @__PURE__ */ new Error(`server_context_required\nCould not resolve \`render\` context.\nhttps://svelte.dev/e/server_context_required`);
343
+ error.name = "Svelte error";
344
+ throw error;
345
+ }
346
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/context.js
347
+ /** @import { SSRContext } from '#server' */
348
+ /** @type {SSRContext | null} */
349
+ var ssr_context = null;
350
+ /** @param {SSRContext | null} v */
351
+ function set_ssr_context(v) {
352
+ ssr_context = v;
353
+ }
354
+ /**
355
+ * @template T
356
+ * @param {any} key
357
+ * @returns {T}
358
+ */
359
+ function getContext(key) {
360
+ return get_or_init_context_map(ssr_context, "getContext").get(key);
361
+ }
362
+ /**
363
+ * @param {Function} [fn]
364
+ */
365
+ function push(fn) {
366
+ ssr_context = {
367
+ p: ssr_context,
368
+ c: null,
369
+ r: null,
370
+ i: false
371
+ };
372
+ }
373
+ function pop() {
374
+ ssr_context = ssr_context.p;
375
+ }
376
+ /**
377
+ * A `hydratable` value with key `%key%` was created, but at least part of it was not used during the render.
378
+ *
379
+ * The `hydratable` was initialized in:
380
+ * %stack%
381
+ * @param {string} key
382
+ * @param {string} stack
383
+ */
384
+ function unresolved_hydratable(key, stack) {
385
+ console.warn(`https://svelte.dev/e/unresolved_hydratable`);
386
+ }
387
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/render-context.js
388
+ /** @import { AsyncLocalStorage } from 'node:async_hooks' */
389
+ /** @import { RenderContext } from '#server' */
390
+ /** @type {Promise<void> | null} */
391
+ var current_render = null;
392
+ /** @type {RenderContext | null} */
393
+ var context = null;
394
+ /** @returns {RenderContext} */
395
+ function get_render_context() {
396
+ const store = context ?? als?.getStore();
397
+ if (!store) server_context_required();
398
+ return store;
399
+ }
400
+ /**
401
+ * @template T
402
+ * @param {() => Promise<T>} fn
403
+ * @returns {Promise<T>}
404
+ */
405
+ async function with_render_context(fn) {
406
+ context = { hydratable: {
407
+ lookup: /* @__PURE__ */ new Map(),
408
+ comparisons: [],
409
+ unresolved_promises: /* @__PURE__ */ new Map()
410
+ } };
411
+ if (in_webcontainer()) {
412
+ const { promise, resolve } = deferred();
413
+ const previous_render = current_render;
414
+ current_render = promise;
415
+ await previous_render;
416
+ return fn().finally(resolve);
417
+ }
418
+ try {
419
+ if (als === null) async_local_storage_unavailable();
420
+ return als.run(context, fn);
421
+ } finally {
422
+ context = null;
423
+ }
424
+ }
425
+ /** @type {AsyncLocalStorage<RenderContext | null> | null} */
426
+ var als = null;
427
+ /** @type {Promise<void> | null} */
428
+ var als_import = null;
429
+ /**
430
+ *
431
+ * @returns {Promise<void>}
432
+ */
433
+ function init_render_context() {
434
+ als_import ??= import("node:async_hooks").then((hooks) => {
435
+ als = new hooks.AsyncLocalStorage();
436
+ }).then(noop, noop);
437
+ return als_import;
438
+ }
439
+ function in_webcontainer() {
440
+ return !!globalThis.process?.versions?.webcontainer;
441
+ }
442
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/crypto.js
443
+ var text_encoder;
444
+ var crypto;
445
+ /** @param {string} module_name */
446
+ var obfuscated_import = (module_name) => import(
447
+ /* @vite-ignore */
448
+ module_name
449
+ );
450
+ /** @param {string} data */
451
+ async function sha256(data) {
452
+ text_encoder ??= new TextEncoder();
453
+ crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (await obfuscated_import("node:crypto")).webcrypto;
454
+ return base64_encode(await crypto.subtle.digest("SHA-256", text_encoder.encode(data)));
455
+ }
456
+ /**
457
+ * @param {Uint8Array} bytes
458
+ * @returns {string}
459
+ */
460
+ function base64_encode(bytes) {
461
+ if (globalThis.Buffer) return globalThis.Buffer.from(bytes).toString("base64");
462
+ let binary = "";
463
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
464
+ return btoa(binary);
465
+ }
466
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/renderer.js
467
+ /** @import { Component } from 'svelte' */
468
+ /** @import { HydratableContext, SSRContext } from './types.js' */
469
+ /** @import { Csp, RenderOutput, SyncRenderOutput, Sha256Source } from '../../server/public.js' */
470
+ /** @import { MaybePromise } from '#shared' */
471
+ /** @typedef {'head' | 'body'} RendererType */
472
+ /** @typedef {{ [key in RendererType]: string }} AccumulatedContent */
473
+ /**
474
+ * @typedef {string | Renderer} RendererItem
475
+ */
476
+ var RenderResult = class {
477
+ /** @type {() => AccumulatedContent} */
478
+ #render;
479
+ /** @type {() => Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>} */
480
+ #render_async;
481
+ /** @type {AccumulatedContent | undefined} */
482
+ #sync;
483
+ /** @type {{ script: '' }} */
484
+ #hashes = { script: "" };
485
+ /** @type {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }> | undefined} */
486
+ #promise;
487
+ /**
488
+ * @param {() => AccumulatedContent} render
489
+ * @param {() => Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>} render_async
490
+ */
491
+ constructor(render, render_async) {
492
+ this.#render = render;
493
+ this.#render_async = render_async;
494
+ }
495
+ #get() {
496
+ return this.#sync ??= this.#render();
497
+ }
498
+ get html() {
499
+ return this.#get().body;
500
+ }
501
+ get head() {
502
+ return this.#get().head;
503
+ }
504
+ get body() {
505
+ return this.#get().body;
506
+ }
507
+ get hashes() {
508
+ return this.#hashes;
509
+ }
510
+ /**
511
+ * This is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
512
+ *
513
+ * @template TResult1
514
+ * @template [TResult2=never]
515
+ * @param {(value: SyncRenderOutput) => TResult1} onfulfilled
516
+ * @param {(reason: unknown) => TResult2} onrejected
517
+ */
518
+ then(onfulfilled, onrejected) {
519
+ if (!async_mode_flag) {
520
+ const result = this.#get();
521
+ const user_result = onfulfilled({
522
+ head: result.head,
523
+ body: result.body,
524
+ html: result.body,
525
+ hashes: { script: [] }
526
+ });
527
+ return Promise.resolve(user_result);
528
+ }
529
+ this.#promise ??= this.#render_async().then((result) => {
530
+ Object.defineProperty(result, "html", { get: () => {
531
+ html_deprecated();
532
+ } });
533
+ return result;
534
+ });
535
+ return this.#promise.then((result) => onfulfilled(result), onrejected);
536
+ }
537
+ };
538
+ /**
539
+ * Renderers are basically a tree of `string | Renderer`s, where each `Renderer` in the tree represents
540
+ * work that may or may not have completed. A renderer can be {@link collect}ed to aggregate the
541
+ * content from itself and all of its children, but this will throw if any of the children are
542
+ * performing asynchronous work. To asynchronously collect a renderer, just `await` it.
543
+ *
544
+ * The `string` values within a renderer are always associated with the {@link type} of that renderer. To switch types,
545
+ * call {@link child} with a different `type` argument.
546
+ */
547
+ var Renderer = class Renderer {
548
+ /**
549
+ * The contents of the renderer.
550
+ * @type {RendererItem[]}
551
+ */
552
+ #out = [];
553
+ /**
554
+ * Any `onDestroy` callbacks registered during execution of this renderer.
555
+ * @type {(() => void)[] | undefined}
556
+ */
557
+ #on_destroy = void 0;
558
+ /**
559
+ * Whether this renderer is a component body.
560
+ * @type {boolean}
561
+ */
562
+ #is_component_body = false;
563
+ /**
564
+ * If set, this renderer is an error boundary. When async collection
565
+ * of the children fails, the failed snippet is rendered instead.
566
+ * @type {{
567
+ * failed: (renderer: Renderer, error: unknown, reset: () => void) => void;
568
+ * transformError: (error: unknown) => unknown;
569
+ * context: SSRContext | null;
570
+ * } | null}
571
+ */
572
+ #boundary = null;
573
+ /**
574
+ * The type of string content that this renderer is accumulating.
575
+ * @type {RendererType}
576
+ */
577
+ type;
578
+ /** @type {Renderer | undefined} */
579
+ #parent;
580
+ /**
581
+ * Asynchronous work associated with this renderer
582
+ * @type {Promise<void> | undefined}
583
+ */
584
+ promise = void 0;
585
+ /**
586
+ * State which is associated with the content tree as a whole.
587
+ * It will be re-exposed, uncopied, on all children.
588
+ * @type {SSRState}
589
+ * @readonly
590
+ */
591
+ global;
592
+ /**
593
+ * State that is local to the branch it is declared in.
594
+ * It will be shallow-copied to all children.
595
+ *
596
+ * @type {{ select_value: any, multiple: boolean }}
597
+ */
598
+ local;
599
+ /**
600
+ * @param {SSRState} global
601
+ * @param {Renderer | undefined} [parent]
602
+ */
603
+ constructor(global, parent) {
604
+ this.#parent = parent;
605
+ this.global = global;
606
+ this.local = parent ? { ...parent.local } : {
607
+ select_value: void 0,
608
+ multiple: false
609
+ };
610
+ this.type = parent ? parent.type : "body";
611
+ }
612
+ /**
613
+ * @param {(renderer: Renderer) => void} fn
614
+ */
615
+ head(fn) {
616
+ const head = new Renderer(this.global, this);
617
+ head.type = "head";
618
+ this.#out.push(head);
619
+ head.child(fn);
620
+ }
621
+ /**
622
+ * @param {Array<Promise<void>>} blockers
623
+ * @param {(renderer: Renderer) => void} fn
624
+ */
625
+ async_block(blockers, fn) {
626
+ this.#out.push(BLOCK_OPEN);
627
+ this.async(blockers, fn);
628
+ this.#out.push(BLOCK_CLOSE);
629
+ }
630
+ /**
631
+ * @param {Array<Promise<void>>} blockers
632
+ * @param {(renderer: Renderer) => void} fn
633
+ */
634
+ async(blockers, fn) {
635
+ let callback = fn;
636
+ if (blockers.length > 0) {
637
+ const context = ssr_context;
638
+ callback = (renderer) => {
639
+ return Promise.all(blockers).then(() => {
640
+ const previous_context = ssr_context;
641
+ try {
642
+ set_ssr_context(context);
643
+ return fn(renderer);
644
+ } finally {
645
+ set_ssr_context(previous_context);
646
+ }
647
+ });
648
+ };
649
+ }
650
+ this.child(callback);
651
+ }
652
+ /**
653
+ * @param {Array<() => void>} thunks
654
+ */
655
+ run(thunks) {
656
+ const context = ssr_context;
657
+ let promise = Promise.resolve(thunks[0]());
658
+ const promises = [promise];
659
+ if (context !== null && thunks.length > 1) context.i = true;
660
+ for (const fn of thunks.slice(1)) {
661
+ promise = promise.then(() => {
662
+ const previous_context = ssr_context;
663
+ set_ssr_context(context);
664
+ try {
665
+ return fn();
666
+ } finally {
667
+ set_ssr_context(previous_context);
668
+ }
669
+ });
670
+ promises.push(promise);
671
+ }
672
+ promise.catch(noop);
673
+ this.promise = this.global.track(promise);
674
+ return promises;
675
+ }
676
+ /**
677
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
678
+ */
679
+ child_block(fn) {
680
+ this.#out.push(BLOCK_OPEN);
681
+ this.child(fn);
682
+ this.#out.push(BLOCK_CLOSE);
683
+ }
684
+ /**
685
+ * Create a child renderer. The child renderer inherits the state from the parent,
686
+ * but has its own content.
687
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
688
+ */
689
+ child(fn) {
690
+ const child = new Renderer(this.global, this);
691
+ this.#out.push(child);
692
+ const parent = ssr_context;
693
+ set_ssr_context({
694
+ ...ssr_context,
695
+ p: parent,
696
+ c: null,
697
+ r: child,
698
+ i: ssr_context?.i ?? false
699
+ });
700
+ const result = fn(child);
701
+ set_ssr_context(parent);
702
+ if (result instanceof Promise) {
703
+ result.catch(noop);
704
+ result.finally(() => set_ssr_context(null)).catch(noop);
705
+ if (child.global.mode === "sync") await_invalid();
706
+ child.promise = child.global.track(result);
707
+ }
708
+ return child;
709
+ }
710
+ /**
711
+ * Render children inside an error boundary. If the children throw and the API-level
712
+ * `transformError` transform handles the error (doesn't re-throw), the `failed` snippet is
713
+ * rendered instead. Otherwise the error propagates.
714
+ *
715
+ * @param {{ failed?: (renderer: Renderer, error: unknown, reset: () => void) => void }} props
716
+ * @param {(renderer: Renderer) => MaybePromise<void>} children_fn
717
+ */
718
+ boundary(props, children_fn) {
719
+ const child = new Renderer(this.global, this);
720
+ this.#out.push(child);
721
+ const parent_context = ssr_context;
722
+ if (props.failed) child.#boundary = {
723
+ failed: props.failed,
724
+ transformError: this.global.transformError,
725
+ context: parent_context
726
+ };
727
+ set_ssr_context({
728
+ ...ssr_context,
729
+ p: parent_context,
730
+ c: null,
731
+ r: child,
732
+ i: ssr_context?.i ?? false
733
+ });
734
+ try {
735
+ const result = children_fn(child);
736
+ set_ssr_context(parent_context);
737
+ if (result instanceof Promise) {
738
+ if (child.global.mode === "sync") await_invalid();
739
+ result.catch(noop);
740
+ child.promise = child.global.track(result);
741
+ }
742
+ } catch (error) {
743
+ set_ssr_context(parent_context);
744
+ const failed_snippet = props.failed;
745
+ if (!failed_snippet) throw error;
746
+ const result = this.global.transformError(error);
747
+ child.#out.length = 0;
748
+ child.#boundary = null;
749
+ if (result instanceof Promise) {
750
+ if (this.global.mode === "sync") await_invalid();
751
+ child.promise = child.global.track(
752
+ /** @type {Promise<unknown>} */
753
+ result.then((transformed) => {
754
+ set_ssr_context(parent_context);
755
+ child.#out.push(Renderer.#serialize_failed_boundary(transformed));
756
+ failed_snippet(child, transformed, noop);
757
+ child.#out.push(BLOCK_CLOSE);
758
+ })
759
+ );
760
+ child.promise.catch(noop);
761
+ } else {
762
+ child.#out.push(Renderer.#serialize_failed_boundary(result));
763
+ failed_snippet(child, result, noop);
764
+ child.#out.push(BLOCK_CLOSE);
765
+ }
766
+ }
767
+ }
768
+ /**
769
+ * Create a component renderer. The component renderer inherits the state from the parent,
770
+ * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
771
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
772
+ * @param {Function} [component_fn]
773
+ * @returns {void}
774
+ */
775
+ component(fn, component_fn) {
776
+ push(component_fn);
777
+ this.child((renderer) => {
778
+ renderer.#is_component_body = true;
779
+ return fn(renderer);
780
+ });
781
+ pop();
782
+ }
783
+ /**
784
+ * @param {Record<string, any>} attrs
785
+ * @param {(renderer: Renderer) => void} fn
786
+ * @param {string | undefined} [css_hash]
787
+ * @param {Record<string, boolean> | undefined} [classes]
788
+ * @param {Record<string, string> | undefined} [styles]
789
+ * @param {number | undefined} [flags]
790
+ * @param {boolean | undefined} [is_rich]
791
+ * @returns {void}
792
+ */
793
+ select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
794
+ const { value, defaultValue, ...select_attrs } = attrs;
795
+ if (select_attrs.multiple === "") select_attrs.multiple = true;
796
+ this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
797
+ this.child((renderer) => {
798
+ renderer.local.select_value = value === void 0 ? defaultValue : value;
799
+ renderer.local.multiple = !!select_attrs.multiple;
800
+ fn(renderer);
801
+ });
802
+ this.push(`${is_rich ? "<!>" : ""}</select>`);
803
+ }
804
+ /**
805
+ * @param {Record<string, any>} attrs
806
+ * @param {string | number | boolean | ((renderer: Renderer) => void)} body
807
+ * @param {string | undefined} [css_hash]
808
+ * @param {Record<string, boolean> | undefined} [classes]
809
+ * @param {Record<string, string> | undefined} [styles]
810
+ * @param {number | undefined} [flags]
811
+ * @param {boolean | undefined} [is_rich]
812
+ */
813
+ option(attrs, body, css_hash, classes, styles, flags, is_rich) {
814
+ this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
815
+ /**
816
+ * @param {Renderer} renderer
817
+ * @param {any} value
818
+ * @param {{ head?: string, body: any }} content
819
+ */
820
+ const close = (renderer, value, { head, body }) => {
821
+ if (has_own_property.call(attrs, "value")) value = attrs.value;
822
+ var select_value = this.local.select_value;
823
+ if (this.local.multiple && is_array(select_value) ? select_value.includes(value) : value === select_value) renderer.#out.push(" selected=\"\"");
824
+ renderer.#out.push(`>${body}${is_rich ? "<!>" : ""}</option>`);
825
+ if (head) renderer.head((child) => child.push(head));
826
+ };
827
+ if (typeof body === "function") this.child((renderer) => {
828
+ const r = new Renderer(this.global, this);
829
+ body(r);
830
+ if (this.global.mode === "async") return r.#collect_content_async().then((content) => {
831
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
832
+ });
833
+ else {
834
+ const content = r.#collect_content();
835
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
836
+ }
837
+ });
838
+ else close(this, body, { body: escape_html(body) });
839
+ }
840
+ /**
841
+ * @param {(renderer: Renderer) => void} fn
842
+ */
843
+ title(fn) {
844
+ const path = this.get_path();
845
+ /** @param {string} head */
846
+ const close = (head) => {
847
+ this.global.set_title(head, path);
848
+ };
849
+ this.child((renderer) => {
850
+ const r = new Renderer(renderer.global, renderer);
851
+ fn(r);
852
+ if (renderer.global.mode === "async") return r.#collect_content_async().then((content) => {
853
+ close(content.head);
854
+ });
855
+ else {
856
+ const content = r.#collect_content();
857
+ close(content.head);
858
+ }
859
+ });
860
+ }
861
+ /**
862
+ * @param {string | (() => Promise<string>)} content
863
+ */
864
+ push(content) {
865
+ if (typeof content === "function") this.child(async (renderer) => renderer.push(await content()));
866
+ else this.#out.push(content);
867
+ }
868
+ /**
869
+ * @param {() => void} fn
870
+ */
871
+ on_destroy(fn) {
872
+ (this.#on_destroy ??= []).push(fn);
873
+ }
874
+ /**
875
+ * @returns {number[]}
876
+ */
877
+ get_path() {
878
+ return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
879
+ }
880
+ /**
881
+ * @deprecated this is needed for legacy component bindings
882
+ */
883
+ copy() {
884
+ const copy = new Renderer(this.global, this.#parent);
885
+ copy.type = this.type;
886
+ copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
887
+ copy.promise = this.promise;
888
+ return copy;
889
+ }
890
+ /**
891
+ * @param {Renderer} other
892
+ * @deprecated this is needed for legacy component bindings
893
+ */
894
+ subsume(other) {
895
+ if (this.global.mode !== other.global.mode) throw new Error("invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!");
896
+ this.local = other.local;
897
+ this.#out = other.#out.map((item, i) => {
898
+ const current = this.#out[i];
899
+ if (current instanceof Renderer && item instanceof Renderer) {
900
+ current.subsume(item);
901
+ return current;
902
+ }
903
+ return item;
904
+ });
905
+ this.promise = other.promise;
906
+ this.type = other.type;
907
+ }
908
+ get length() {
909
+ return this.#out.length;
910
+ }
911
+ /**
912
+ * Creates the hydration comment that marks the start of a failed boundary.
913
+ * The error is JSON-serialized and embedded inside an HTML comment for the client
914
+ * to parse during hydration. The JSON is escaped to prevent `-->` or `<!--` sequences
915
+ * from breaking out of the comment (XSS). Uses unicode escapes which `JSON.parse()`
916
+ * handles transparently.
917
+ * @param {unknown} error
918
+ * @returns {string}
919
+ */
920
+ static #serialize_failed_boundary(error) {
921
+ return `<!--[?${JSON.stringify(error).replace(/>/g, "\\u003e").replace(/</g, "\\u003c")}-->`;
922
+ }
923
+ /**
924
+ * Only available on the server and when compiling with the `server` option.
925
+ * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
926
+ * @template {Record<string, any>} Props
927
+ * @param {Component<Props>} component
928
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} [options]
929
+ * @returns {RenderOutput}
930
+ */
931
+ static render(component, options = {}) {
932
+ return new RenderResult(() => Renderer.#render(component, options), () => init_render_context().then(() => with_render_context(() => Renderer.#render_async(component, options))));
933
+ }
934
+ /**
935
+ * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
936
+ * after awaiting `collect_async`.
937
+ *
938
+ * Child renderers are "porous" and don't affect execution order, but component body renderers
939
+ * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
940
+ * @returns {Iterable<() => void>}
941
+ */
942
+ *#collect_on_destroy() {
943
+ for (const component of this.#traverse_components()) yield* component.#collect_ondestroy();
944
+ }
945
+ /**
946
+ * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
947
+ * @returns {Iterable<Renderer>}
948
+ */
949
+ *#traverse_components() {
950
+ for (const child of this.#out) if (typeof child !== "string") yield* child.#traverse_components();
951
+ if (this.#is_component_body) yield this;
952
+ }
953
+ /**
954
+ * @returns {Iterable<() => void>}
955
+ */
956
+ *#collect_ondestroy() {
957
+ if (this.#on_destroy) for (const fn of this.#on_destroy) yield fn;
958
+ for (const child of this.#out) if (child instanceof Renderer && !child.#is_component_body) yield* child.#collect_ondestroy();
959
+ }
960
+ /**
961
+ * Runs every `onDestroy` callback in this renderer tree. On a failed render,
962
+ * cleanup errors are suppressed so they do not mask the render error.
963
+ * @param {boolean} suppress_errors
964
+ */
965
+ #run_on_destroy(suppress_errors) {
966
+ let first_error;
967
+ let has_error = false;
968
+ for (const cleanup of this.#collect_on_destroy()) try {
969
+ cleanup();
970
+ } catch (error) {
971
+ if (!suppress_errors && !has_error) {
972
+ first_error = error;
973
+ has_error = true;
974
+ }
975
+ }
976
+ if (has_error) throw first_error;
977
+ }
978
+ /**
979
+ * @param {'sync' | 'async'} mode
980
+ * @param {{ idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
981
+ * @returns {Renderer}
982
+ */
983
+ static #create(mode, options) {
984
+ if (options.idPrefix?.includes("--")) invalid_id_prefix();
985
+ return new Renderer(new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp, options.transformError));
986
+ }
987
+ /**
988
+ * Render a component. Throws if any of the children are performing asynchronous work.
989
+ *
990
+ * @template {Record<string, any>} Props
991
+ * @param {Component<Props>} component
992
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
993
+ * @returns {AccumulatedContent}
994
+ */
995
+ static #render(component, options) {
996
+ var previous_context = ssr_context;
997
+ const renderer = Renderer.#create("sync", options);
998
+ /** @type {AccumulatedContent | undefined} */
999
+ let result;
1000
+ let render_error;
1001
+ let failed = false;
1002
+ try {
1003
+ try {
1004
+ Renderer.#open_render(renderer, component, options);
1005
+ result = Renderer.#close_render(renderer.#collect_content(), renderer);
1006
+ } catch (error) {
1007
+ render_error = error;
1008
+ failed = true;
1009
+ }
1010
+ renderer.#run_on_destroy(failed);
1011
+ if (failed) throw render_error;
1012
+ return result;
1013
+ } finally {
1014
+ renderer.global.abort();
1015
+ set_ssr_context(previous_context);
1016
+ }
1017
+ }
1018
+ /**
1019
+ * Render a component.
1020
+ *
1021
+ * @template {Record<string, any>} Props
1022
+ * @param {Component<Props>} component
1023
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
1024
+ * @returns {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>}
1025
+ */
1026
+ static async #render_async(component, options) {
1027
+ const previous_context = ssr_context;
1028
+ const renderer = Renderer.#create("async", options);
1029
+ /** @type {(AccumulatedContent & { hashes: { script: Sha256Source[] } }) | undefined} */
1030
+ let result;
1031
+ let render_error;
1032
+ let failed = false;
1033
+ try {
1034
+ try {
1035
+ Renderer.#open_render(renderer, component, options);
1036
+ const content = await renderer.#collect_content_async();
1037
+ const hydratables = await renderer.#collect_hydratables();
1038
+ if (hydratables !== null) content.head = hydratables + content.head;
1039
+ result = Renderer.#close_render(content, renderer);
1040
+ } catch (error) {
1041
+ render_error = error;
1042
+ failed = true;
1043
+ renderer.global.abort();
1044
+ await renderer.global.settle();
1045
+ }
1046
+ renderer.#run_on_destroy(failed);
1047
+ if (failed) throw render_error;
1048
+ return result;
1049
+ } finally {
1050
+ set_ssr_context(previous_context);
1051
+ renderer.global.abort();
1052
+ }
1053
+ }
1054
+ /**
1055
+ * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
1056
+ * @param {AccumulatedContent} content
1057
+ * @returns {AccumulatedContent}
1058
+ */
1059
+ #collect_content(content = {
1060
+ head: "",
1061
+ body: ""
1062
+ }) {
1063
+ for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
1064
+ else if (item instanceof Renderer) item.#collect_content(content);
1065
+ return content;
1066
+ }
1067
+ /**
1068
+ * Collect all of the code from the `out` array and return it as a string.
1069
+ * @param {AccumulatedContent} content
1070
+ * @returns {Promise<AccumulatedContent>}
1071
+ */
1072
+ async #collect_content_async(content = {
1073
+ head: "",
1074
+ body: ""
1075
+ }) {
1076
+ await this.promise;
1077
+ for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
1078
+ else if (item instanceof Renderer) {
1079
+ if (item.#boundary) {
1080
+ /** @type {AccumulatedContent} */
1081
+ const boundary_content = {
1082
+ head: "",
1083
+ body: ""
1084
+ };
1085
+ try {
1086
+ await item.#collect_content_async(boundary_content);
1087
+ content.head += boundary_content.head;
1088
+ content.body += boundary_content.body;
1089
+ } catch (error) {
1090
+ const { context, failed, transformError } = item.#boundary;
1091
+ set_ssr_context(context);
1092
+ let promise = transformError(error);
1093
+ set_ssr_context(null);
1094
+ let transformed = await promise;
1095
+ set_ssr_context(context);
1096
+ const failed_renderer = new Renderer(item.global, item);
1097
+ failed_renderer.type = item.type;
1098
+ failed_renderer.#out.push(Renderer.#serialize_failed_boundary(transformed));
1099
+ failed(failed_renderer, transformed, noop);
1100
+ failed_renderer.#out.push(BLOCK_CLOSE);
1101
+ await failed_renderer.#collect_content_async(content);
1102
+ }
1103
+ } else await item.#collect_content_async(content);
1104
+ }
1105
+ return content;
1106
+ }
1107
+ async #collect_hydratables() {
1108
+ const ctx = get_render_context().hydratable;
1109
+ for (const [_, key] of ctx.unresolved_promises) unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
1110
+ for (const comparison of ctx.comparisons) await comparison;
1111
+ return await this.#hydratable_block(ctx);
1112
+ }
1113
+ /**
1114
+ * @template {Record<string, any>} Props
1115
+ * @param {Renderer} renderer
1116
+ * @param {import('svelte').Component<Props>} component
1117
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
1118
+ * @returns {void}
1119
+ */
1120
+ static #open_render(renderer, component, options) {
1121
+ var previous_context = ssr_context;
1122
+ try {
1123
+ set_ssr_context({
1124
+ p: null,
1125
+ c: options.context ?? null,
1126
+ r: renderer,
1127
+ i: false
1128
+ });
1129
+ renderer.push(BLOCK_OPEN);
1130
+ component(renderer, options.props ?? {});
1131
+ renderer.push(BLOCK_CLOSE);
1132
+ } finally {
1133
+ set_ssr_context(previous_context);
1134
+ }
1135
+ }
1136
+ /**
1137
+ * @param {AccumulatedContent} content
1138
+ * @param {Renderer} renderer
1139
+ * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
1140
+ */
1141
+ static #close_render(content, renderer) {
1142
+ let head = content.head + renderer.global.get_title();
1143
+ let body = content.body;
1144
+ for (const { hash, code } of renderer.global.css) head += `<style id="${hash}">${code}</style>`;
1145
+ return {
1146
+ head,
1147
+ body,
1148
+ hashes: { script: renderer.global.csp.script_hashes }
1149
+ };
1150
+ }
1151
+ /**
1152
+ * @param {HydratableContext} ctx
1153
+ */
1154
+ async #hydratable_block(ctx) {
1155
+ if (ctx.lookup.size === 0) return null;
1156
+ let entries = [];
1157
+ let has_promises = false;
1158
+ for (const [k, v] of ctx.lookup) {
1159
+ if (v.promises) {
1160
+ has_promises = true;
1161
+ for (const p of v.promises) await p;
1162
+ }
1163
+ entries.push(`[${uneval(k)},${v.serialized}]`);
1164
+ }
1165
+ let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
1166
+ if (has_promises) prelude = `const r = (v) => Promise.resolve(v);
1167
+ ${prelude}`;
1168
+ const body = `
1169
+ {
1170
+ ${prelude}
1171
+
1172
+ for (const [k, v] of [
1173
+ ${entries.join(",\n ")}
1174
+ ]) {
1175
+ h.set(k, v);
1176
+ }
1177
+ }
1178
+ `;
1179
+ let csp_attr = "";
1180
+ if (this.global.csp.nonce) csp_attr = ` nonce="${this.global.csp.nonce}"`;
1181
+ else if (this.global.csp.hash) {
1182
+ const hash = await sha256(body);
1183
+ this.global.csp.script_hashes.push(`sha256-${hash}`);
1184
+ }
1185
+ return `\n\t\t<script${csp_attr}>${body}<\/script>`;
1186
+ }
1187
+ };
1188
+ var SSRState = class {
1189
+ /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */
1190
+ csp;
1191
+ /** @readonly @type {'sync' | 'async'} */
1192
+ mode;
1193
+ /** @readonly @type {() => string} */
1194
+ uid;
1195
+ /** @readonly @type {Set<{ hash: string; code: string }>} */
1196
+ css = /* @__PURE__ */ new Set();
1197
+ /** @type {Set<Promise<unknown>>} */
1198
+ #pending = /* @__PURE__ */ new Set();
1199
+ /** @type {AbortController | null} */
1200
+ #controller = null;
1201
+ #aborted = false;
1202
+ /**
1203
+ * `transformError` passed to `render`. Called when an error boundary catches an error.
1204
+ * Throws by default if unset in `render`.
1205
+ * @type {(error: unknown) => unknown}
1206
+ */
1207
+ transformError;
1208
+ /** @type {{ path: number[], value: string }} */
1209
+ #title = {
1210
+ path: [],
1211
+ value: ""
1212
+ };
1213
+ /**
1214
+ * @param {'sync' | 'async'} mode
1215
+ * @param {string} id_prefix
1216
+ * @param {Csp} csp
1217
+ * @param {((error: unknown) => unknown) | undefined} [transformError]
1218
+ */
1219
+ constructor(mode, id_prefix = "", csp = { hash: false }, transformError) {
1220
+ this.mode = mode;
1221
+ this.csp = {
1222
+ ...csp,
1223
+ script_hashes: []
1224
+ };
1225
+ this.transformError = transformError ?? ((error) => {
1226
+ throw error;
1227
+ });
1228
+ let uid = 1;
1229
+ this.uid = () => `${id_prefix}s${uid++}`;
1230
+ }
1231
+ /**
1232
+ * @template T
1233
+ * @param {Promise<T>} promise
1234
+ * @returns {Promise<T>}
1235
+ */
1236
+ track(promise) {
1237
+ this.#pending.add(promise);
1238
+ promise.then(() => this.#pending.delete(promise), () => this.#pending.delete(promise));
1239
+ return promise;
1240
+ }
1241
+ async settle() {
1242
+ while (this.#pending.size > 0) await Promise.allSettled([...this.#pending]);
1243
+ }
1244
+ abort() {
1245
+ if (this.#aborted) return;
1246
+ this.#aborted = true;
1247
+ this.#controller?.abort(STALE_REACTION);
1248
+ }
1249
+ get_abort_signal() {
1250
+ const controller = this.#controller ??= new AbortController();
1251
+ if (this.#aborted) controller.abort(STALE_REACTION);
1252
+ return controller.signal;
1253
+ }
1254
+ get_title() {
1255
+ return this.#title.value;
1256
+ }
1257
+ /**
1258
+ * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
1259
+ * from earlier than or equal to the current value.
1260
+ * @param {string} value
1261
+ * @param {number[]} path
1262
+ */
1263
+ set_title(value, path) {
1264
+ const current = this.#title.path;
1265
+ let i = 0;
1266
+ let l = Math.min(path.length, current.length);
1267
+ while (i < l && path[i] === current[i]) i += 1;
1268
+ if (path[i] === void 0) return;
1269
+ if (current[i] === void 0 || path[i] > current[i]) {
1270
+ this.#title.path = path;
1271
+ this.#title.value = value;
1272
+ }
1273
+ }
1274
+ };
1275
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/index.js
1276
+ var INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
1277
+ /**
1278
+ * Only available on the server and when compiling with the `server` option.
1279
+ * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
1280
+ * @template {Record<string, any>} Props
1281
+ * @param {Component<Props> | ComponentType<SvelteComponent<Props>>} component
1282
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} [options]
1283
+ * @returns {RenderOutput}
1284
+ */
1285
+ function render(component, options = {}) {
1286
+ if (options.csp?.hash && options.csp.nonce) invalid_csp();
1287
+ return Renderer.render(component, options);
1288
+ }
1289
+ /**
1290
+ * @param {string} hash
1291
+ * @param {Renderer} renderer
1292
+ * @param {(renderer: Renderer) => Promise<void> | void} fn
1293
+ * @returns {void}
1294
+ */
1295
+ function head(hash, renderer, fn) {
1296
+ renderer.head((renderer) => {
1297
+ renderer.push(`<!--${hash}-->`);
1298
+ renderer.child(fn);
1299
+ renderer.push(EMPTY_COMMENT);
1300
+ });
1301
+ }
1302
+ /**
1303
+ * @param {Record<string, unknown>} attrs
1304
+ * @param {string} [css_hash]
1305
+ * @param {Record<string, boolean>} [classes]
1306
+ * @param {Record<string, string>} [styles]
1307
+ * @param {number} [flags]
1308
+ * @returns {string}
1309
+ */
1310
+ function attributes(attrs, css_hash, classes, styles, flags = 0) {
1311
+ if (styles) attrs.style = to_style(attrs.style, styles);
1312
+ if (attrs.class) attrs.class = clsx(attrs.class);
1313
+ if (css_hash || classes) attrs.class = to_class(attrs.class, css_hash, classes);
1314
+ let attr_str = "";
1315
+ let name;
1316
+ const is_html = (flags & 1) === 0;
1317
+ const lowercase = (flags & 2) === 0;
1318
+ const is_input = (flags & 4) !== 0;
1319
+ const names = Object.keys(attrs);
1320
+ outer: for (let i = 0; i < names.length; i++) {
1321
+ name = names[i];
1322
+ if (typeof attrs[name] === "function") continue;
1323
+ if (name[0] === "$" && name[1] === "$") continue;
1324
+ if (name === "" || INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
1325
+ var value = attrs[name];
1326
+ var lower = name.toLowerCase();
1327
+ if (lowercase) name = lower;
1328
+ if (lower.length > 2 && lower.startsWith("on")) continue;
1329
+ if (is_input) {
1330
+ if (name === "defaultvalue" || name === "defaultchecked") {
1331
+ name = name === "defaultvalue" ? "value" : "checked";
1332
+ if (name in attrs) continue;
1333
+ for (let j = 0; j < names.length; j++) if (names[j].toLowerCase() === name) continue outer;
1334
+ }
1335
+ }
1336
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
1337
+ }
1338
+ return attr_str;
1339
+ }
1340
+ /**
1341
+ * @template V
1342
+ * @param {() => V} get_value
1343
+ */
1344
+ function once(get_value) {
1345
+ let value = UNINITIALIZED;
1346
+ return () => {
1347
+ if (value === UNINITIALIZED) value = get_value();
1348
+ return value;
1349
+ };
1350
+ }
1351
+ /**
1352
+ * @template T
1353
+ * @param {()=>T} fn
1354
+ * @returns {(new_value?: T) => (T | void)}
1355
+ */
1356
+ function derived(fn) {
1357
+ const get_value = ssr_context === null ? fn : once(fn);
1358
+ /** @type {T | undefined} */
1359
+ let updated_value;
1360
+ return function(new_value) {
1361
+ if (arguments.length === 0) return updated_value ?? get_value();
1362
+ updated_value = new_value;
1363
+ return updated_value;
1364
+ };
1365
+ }
1366
+ export { attr as a, getContext as i, head as n, escape_html as o, render as r, derived as t };
1367
+
1368
+ //# sourceMappingURL=server2.js.map