watch-tail 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.
Files changed (110) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +210 -0
  3. package/build/client/_app/immutable/assets/0.B1NsRRrX.css +2 -0
  4. package/build/client/_app/immutable/assets/0.B1NsRRrX.css.br +0 -0
  5. package/build/client/_app/immutable/assets/0.B1NsRRrX.css.gz +0 -0
  6. package/build/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
  7. package/build/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
  8. package/build/client/_app/immutable/chunks/Bjy-W4x2.js.gz +0 -0
  9. package/build/client/_app/immutable/chunks/DCKWcE8r.js +1 -0
  10. package/build/client/_app/immutable/chunks/DCKWcE8r.js.br +0 -0
  11. package/build/client/_app/immutable/chunks/DCKWcE8r.js.gz +0 -0
  12. package/build/client/_app/immutable/chunks/DDRhiz1-.js +1 -0
  13. package/build/client/_app/immutable/chunks/DDRhiz1-.js.br +0 -0
  14. package/build/client/_app/immutable/chunks/DDRhiz1-.js.gz +0 -0
  15. package/build/client/_app/immutable/chunks/ZAD2y5xJ.js +3 -0
  16. package/build/client/_app/immutable/chunks/ZAD2y5xJ.js.br +0 -0
  17. package/build/client/_app/immutable/chunks/ZAD2y5xJ.js.gz +0 -0
  18. package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
  19. package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
  20. package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
  21. package/build/client/_app/immutable/entry/app.DIoggGwf.js +2 -0
  22. package/build/client/_app/immutable/entry/app.DIoggGwf.js.br +0 -0
  23. package/build/client/_app/immutable/entry/app.DIoggGwf.js.gz +0 -0
  24. package/build/client/_app/immutable/entry/start._YXgjuSB.js +1 -0
  25. package/build/client/_app/immutable/entry/start._YXgjuSB.js.br +0 -0
  26. package/build/client/_app/immutable/entry/start._YXgjuSB.js.gz +0 -0
  27. package/build/client/_app/immutable/nodes/0.D5bYt7iX.js +1 -0
  28. package/build/client/_app/immutable/nodes/0.D5bYt7iX.js.br +0 -0
  29. package/build/client/_app/immutable/nodes/0.D5bYt7iX.js.gz +0 -0
  30. package/build/client/_app/immutable/nodes/1.DBX83mYX.js +1 -0
  31. package/build/client/_app/immutable/nodes/1.DBX83mYX.js.br +0 -0
  32. package/build/client/_app/immutable/nodes/1.DBX83mYX.js.gz +0 -0
  33. package/build/client/_app/immutable/nodes/2.DiH-2moC.js +5 -0
  34. package/build/client/_app/immutable/nodes/2.DiH-2moC.js.br +0 -0
  35. package/build/client/_app/immutable/nodes/2.DiH-2moC.js.gz +0 -0
  36. package/build/client/_app/version.json +1 -0
  37. package/build/client/_app/version.json.br +0 -0
  38. package/build/client/_app/version.json.gz +0 -0
  39. package/build/client/robots.txt +3 -0
  40. package/build/client/robots.txt.br +0 -0
  41. package/build/client/robots.txt.gz +0 -0
  42. package/build/env.js +70 -0
  43. package/build/env.js.map +1 -0
  44. package/build/handler.js +24 -0
  45. package/build/handler.js.map +1 -0
  46. package/build/index.js +147 -0
  47. package/build/index.js.map +1 -0
  48. package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
  49. package/build/server/chunks/chunks/env.js-l0sNRNKZ.js.map +1 -0
  50. package/build/server/chunks/chunks/env2.js-D7xrfc37.js +316 -0
  51. package/build/server/chunks/chunks/env2.js-D7xrfc37.js.map +1 -0
  52. package/build/server/chunks/chunks/exports.js-CvFPPbaH.js +263 -0
  53. package/build/server/chunks/chunks/exports.js-CvFPPbaH.js.map +1 -0
  54. package/build/server/chunks/chunks/internal.js-DdmUz1r3.js +1191 -0
  55. package/build/server/chunks/chunks/internal.js-DdmUz1r3.js.map +1 -0
  56. package/build/server/chunks/chunks/internal2.js-DZ8ZzzjN.js +22 -0
  57. package/build/server/chunks/chunks/internal2.js-DZ8ZzzjN.js.map +1 -0
  58. package/build/server/chunks/chunks/regions.js-IQPMyP5C.js +52 -0
  59. package/build/server/chunks/chunks/regions.js-IQPMyP5C.js.map +1 -0
  60. package/build/server/chunks/chunks/server.js-ByNB8uti.js +3659 -0
  61. package/build/server/chunks/chunks/server.js-ByNB8uti.js.map +1 -0
  62. package/build/server/chunks/chunks/shared-server.js-Dn5XheXH.js +22 -0
  63. package/build/server/chunks/chunks/shared-server.js-Dn5XheXH.js.map +1 -0
  64. package/build/server/chunks/chunks/shared.js-CgjUIvRK.js +776 -0
  65. package/build/server/chunks/chunks/shared.js-CgjUIvRK.js.map +1 -0
  66. package/build/server/chunks/chunks/state.js-ClLTNPGs.js +86 -0
  67. package/build/server/chunks/chunks/state.js-ClLTNPGs.js.map +1 -0
  68. package/build/server/chunks/chunks/time-range.js-BLMT8aU3.js +102 -0
  69. package/build/server/chunks/chunks/time-range.js-BLMT8aU3.js.map +1 -0
  70. package/build/server/chunks/chunks/uneval.js-DaakSYFQ.js +488 -0
  71. package/build/server/chunks/chunks/uneval.js-DaakSYFQ.js.map +1 -0
  72. package/build/server/chunks/chunks/utils.js-BIlHjgGW.js +933 -0
  73. package/build/server/chunks/chunks/utils.js-BIlHjgGW.js.map +1 -0
  74. package/build/server/chunks/entries/endpoints/api/health/_server.ts.js-aiNZfkco.js +41 -0
  75. package/build/server/chunks/entries/endpoints/api/health/_server.ts.js-aiNZfkco.js.map +1 -0
  76. package/build/server/chunks/entries/endpoints/api/log-groups/_server.ts.js-D143-vRl.js +120 -0
  77. package/build/server/chunks/entries/endpoints/api/log-groups/_server.ts.js-D143-vRl.js.map +1 -0
  78. package/build/server/chunks/entries/endpoints/api/regions/_server.ts.js-CDNL7msU.js +88 -0
  79. package/build/server/chunks/entries/endpoints/api/regions/_server.ts.js-CDNL7msU.js.map +1 -0
  80. package/build/server/chunks/entries/endpoints/api/stream/_server.ts.js-D_i-xW6_.js +610 -0
  81. package/build/server/chunks/entries/endpoints/api/stream/_server.ts.js-D_i-xW6_.js.map +1 -0
  82. package/build/server/chunks/entries/fallbacks/error.svelte.js-qFLa8EVy.js +17 -0
  83. package/build/server/chunks/entries/fallbacks/error.svelte.js-qFLa8EVy.js.map +1 -0
  84. package/build/server/chunks/entries/pages/_layout.svelte.js-Bx7lXkAi.js +22 -0
  85. package/build/server/chunks/entries/pages/_layout.svelte.js-Bx7lXkAi.js.map +1 -0
  86. package/build/server/chunks/entries/pages/_page.svelte.js-BsvaKqbk.js +1264 -0
  87. package/build/server/chunks/entries/pages/_page.svelte.js-BsvaKqbk.js.map +1 -0
  88. package/build/server/chunks/handler-nVqa-QPz.js +1735 -0
  89. package/build/server/chunks/handler-nVqa-QPz.js.map +1 -0
  90. package/build/server/chunks/index.js-CtbhHm7L.js +3803 -0
  91. package/build/server/chunks/index.js-CtbhHm7L.js.map +1 -0
  92. package/build/server/chunks/manifest.js-BwUys8gK.js +70 -0
  93. package/build/server/chunks/manifest.js-BwUys8gK.js.map +1 -0
  94. package/build/server/chunks/nodes/0.js-Dl0J9d3p.js +9 -0
  95. package/build/server/chunks/nodes/0.js-Dl0J9d3p.js.map +1 -0
  96. package/build/server/chunks/nodes/1.js-dXZVW92o.js +9 -0
  97. package/build/server/chunks/nodes/1.js-dXZVW92o.js.map +1 -0
  98. package/build/server/chunks/nodes/2.js-aMMUenQc.js +9 -0
  99. package/build/server/chunks/nodes/2.js-aMMUenQc.js.map +1 -0
  100. package/build/shims.js +33 -0
  101. package/build/shims.js.map +1 -0
  102. package/dist/cli/bin.js +9 -0
  103. package/dist/cli/completions.js +99 -0
  104. package/dist/cli/index.js +183 -0
  105. package/dist/cli/options.js +171 -0
  106. package/dist/cli/server.js +126 -0
  107. package/dist/cli/ui.js +75 -0
  108. package/dist/lib/cli/aws.js +264 -0
  109. package/dist/lib/time-range.js +106 -0
  110. package/package.json +106 -0
@@ -0,0 +1,3659 @@
1
+ import { u as uneval } from './uneval.js-DaakSYFQ.js';
2
+
3
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/shared/utils.js
4
+ var is_array = Array.isArray;
5
+ var index_of = Array.prototype.indexOf;
6
+ var includes = Array.prototype.includes;
7
+ var array_from = Array.from;
8
+ var define_property = Object.defineProperty;
9
+ var get_descriptor = Object.getOwnPropertyDescriptor;
10
+ var object_prototype = Object.prototype;
11
+ var array_prototype = Array.prototype;
12
+ var get_prototype_of = Object.getPrototypeOf;
13
+ var is_extensible = Object.isExtensible;
14
+ var has_own_property = Object.prototype.hasOwnProperty;
15
+ var noop = () => {};
16
+ /** @param {Function} fn */
17
+ function run(fn) {
18
+ return fn();
19
+ }
20
+ /** @param {Array<() => void>} arr */
21
+ function run_all(arr) {
22
+ for (var i = 0; i < arr.length; i++) arr[i]();
23
+ }
24
+ /**
25
+ * TODO replace with Promise.withResolvers once supported widely enough
26
+ * @template [T=void]
27
+ */
28
+ function deferred() {
29
+ /** @type {(value: T) => void} */
30
+ var resolve;
31
+ /** @type {(reason: any) => void} */
32
+ var reject;
33
+ return {
34
+ promise: new Promise((res, rej) => {
35
+ resolve = res;
36
+ reject = rej;
37
+ }),
38
+ resolve,
39
+ reject
40
+ };
41
+ }
42
+ //#endregion
43
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/equality.js
44
+ /** @import { Equals } from '#client' */
45
+ /** @type {Equals} */
46
+ function equals(value) {
47
+ return value === this.v;
48
+ }
49
+ /**
50
+ * @param {unknown} a
51
+ * @param {unknown} b
52
+ * @returns {boolean}
53
+ */
54
+ function safe_not_equal(a, b) {
55
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
56
+ }
57
+ /** @type {Equals} */
58
+ function safe_equals(value) {
59
+ return !safe_not_equal(value, this.v);
60
+ }
61
+ var CLEAN = 1024;
62
+ var DIRTY = 2048;
63
+ var MAYBE_DIRTY = 4096;
64
+ var INERT = 8192;
65
+ var DESTROYED = 16384;
66
+ /** Set once a reaction has run for the first time */
67
+ var REACTION_RAN = 32768;
68
+ /** Effect is in the process of getting destroyed. Can be observed in child teardown functions */
69
+ var DESTROYING = 1 << 25;
70
+ /**
71
+ * 'Transparent' effects do not create a transition boundary.
72
+ * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned
73
+ */
74
+ var EFFECT_TRANSPARENT = 65536;
75
+ var EFFECT_PRESERVED = 1 << 19;
76
+ var USER_EFFECT = 1 << 20;
77
+ /**
78
+ * Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
79
+ * Will be lifted during execution of the derived and during checking its dirty state (both are necessary
80
+ * because a derived might be checked but not executed). This is a pure performance optimization flag and
81
+ * should not be used for any other purpose!
82
+ */
83
+ var WAS_MARKED = 65536;
84
+ var REACTION_IS_UPDATING = 1 << 21;
85
+ var ERROR_VALUE = 1 << 23;
86
+ var STATE_SYMBOL = Symbol("$state");
87
+ /** Marks component export objects, so that `proxy(...)` leaves them untouched */
88
+ var COMPONENT_SYMBOL = Symbol("component");
89
+ var LEGACY_PROPS = Symbol("legacy props");
90
+ var ATTRIBUTES_CACHE = Symbol("attributes");
91
+ var CLASS_CACHE = Symbol("class");
92
+ var STYLE_CACHE = Symbol("style");
93
+ var TEXT_CACHE = Symbol("text");
94
+ /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
95
+ var STALE_REACTION = new class StaleReactionError extends Error {
96
+ name = "StaleReactionError";
97
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
98
+ }();
99
+ //#endregion
100
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/constants.js
101
+ var HYDRATION_ERROR = {};
102
+ var UNINITIALIZED = Symbol("uninitialized");
103
+ /**
104
+ * Reading a derived belonging to a now-destroyed effect may result in stale values
105
+ */
106
+ function derived_inert() {
107
+ console.warn(`https://svelte.dev/e/derived_inert`);
108
+ }
109
+ /**
110
+ * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%
111
+ * @param {string | undefined | null} [location]
112
+ */
113
+ function hydration_mismatch(location) {
114
+ console.warn(`https://svelte.dev/e/hydration_mismatch`);
115
+ }
116
+ /**
117
+ * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called
118
+ */
119
+ function svelte_boundary_reset_noop() {
120
+ console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
121
+ }
122
+ //#endregion
123
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/hydration.js
124
+ /** @import { TemplateNode } from '#client' */
125
+ /**
126
+ * Use this variable to guard everything related to hydration code so it can be treeshaken out
127
+ * if the user doesn't use the `hydrate` method and these code paths are therefore not needed.
128
+ */
129
+ var hydrating = false;
130
+ /** @param {boolean} value */
131
+ function set_hydrating(value) {
132
+ hydrating = value;
133
+ }
134
+ /**
135
+ * The node that is currently being hydrated. This starts out as the first node inside the opening
136
+ * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.
137
+ * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the
138
+ * time we leave the block it is the closing comment, which serves as the block's anchor.
139
+ * @type {TemplateNode}
140
+ */
141
+ var hydrate_node;
142
+ /** @param {TemplateNode | null} node */
143
+ function set_hydrate_node(node) {
144
+ if (node === null) {
145
+ hydration_mismatch();
146
+ throw HYDRATION_ERROR;
147
+ }
148
+ return hydrate_node = node;
149
+ }
150
+ function hydrate_next() {
151
+ return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node));
152
+ }
153
+ function next(count = 1) {
154
+ if (hydrating) {
155
+ var i = count;
156
+ var node = hydrate_node;
157
+ while (i--) node = /* @__PURE__ */ get_next_sibling(node);
158
+ hydrate_node = node;
159
+ }
160
+ }
161
+ /**
162
+ * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment
163
+ * @param {boolean} remove
164
+ */
165
+ function skip_nodes(remove = true) {
166
+ var depth = 0;
167
+ var node = hydrate_node;
168
+ while (true) {
169
+ if (node.nodeType === 8) {
170
+ var data = node.data;
171
+ if (data === "]") {
172
+ if (depth === 0) return node;
173
+ depth -= 1;
174
+ } else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1;
175
+ }
176
+ var next = /* @__PURE__ */ get_next_sibling(node);
177
+ if (remove) node.remove();
178
+ node = next;
179
+ }
180
+ }
181
+ //#endregion
182
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/shared/errors.js
183
+ /**
184
+ * Cannot use `%name%(...)` unless the `experimental.async` compiler option is `true`
185
+ * @param {string} name
186
+ * @returns {never}
187
+ */
188
+ function experimental_async_required(name) {
189
+ throw new Error(`https://svelte.dev/e/experimental_async_required`);
190
+ }
191
+ /**
192
+ * `%name%(...)` can only be used during component initialisation
193
+ * @param {string} name
194
+ * @returns {never}
195
+ */
196
+ function lifecycle_outside_component(name) {
197
+ throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
198
+ }
199
+ /**
200
+ * Context was not set in the current component or any of its ancestors
201
+ * @returns {never}
202
+ */
203
+ function missing_context() {
204
+ throw new Error(`https://svelte.dev/e/missing_context`);
205
+ }
206
+ /**
207
+ * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
208
+ * @returns {never}
209
+ */
210
+ function effect_update_depth_exceeded() {
211
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
212
+ }
213
+ /**
214
+ * Failed to hydrate the application
215
+ * @returns {never}
216
+ */
217
+ function hydration_failed() {
218
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
219
+ }
220
+ /**
221
+ * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
222
+ * @returns {never}
223
+ */
224
+ function state_descriptors_fixed() {
225
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
226
+ }
227
+ /**
228
+ * Cannot set prototype of `$state` object
229
+ * @returns {never}
230
+ */
231
+ function state_prototype_fixed() {
232
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
233
+ }
234
+ /**
235
+ * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
236
+ * @returns {never}
237
+ */
238
+ function state_unsafe_mutation() {
239
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
240
+ }
241
+ /**
242
+ * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
243
+ * @returns {never}
244
+ */
245
+ function svelte_boundary_reset_onerror() {
246
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
247
+ }
248
+ //#endregion
249
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/shared/context.js
250
+ /**
251
+ * @template T
252
+ * @param {(key: object) => T} get_context
253
+ * @param {(key: object, context: T) => T} set_context
254
+ * @param {(key: object) => boolean} has_context
255
+ * @returns {[() => T, (context: T) => T, () => boolean]}
256
+ */
257
+ function create_context(get_context, set_context, has_context) {
258
+ const key = {};
259
+ return [
260
+ () => {
261
+ if (!has_context(key)) missing_context();
262
+ return get_context(key);
263
+ },
264
+ (context) => set_context(key, context),
265
+ () => has_context(key)
266
+ ];
267
+ }
268
+ /**
269
+ * @typedef {{ p: Context | null, c: Map<unknown, unknown> | null }} Context
270
+ */
271
+ /**
272
+ * @param {Context} context
273
+ * @returns {Map<unknown, unknown> | null}
274
+ */
275
+ function get_parent_context(context) {
276
+ let parent = context.p;
277
+ while (parent !== null && parent.c === null) parent = parent.p;
278
+ return parent?.c ?? null;
279
+ }
280
+ /**
281
+ * @param {Context | null} context
282
+ * @param {string} name
283
+ * @returns {Map<unknown, unknown>}
284
+ */
285
+ function get_or_init_context_map(context, name) {
286
+ if (context === null) lifecycle_outside_component();
287
+ return context.c ??= new Map(get_parent_context(context) || void 0);
288
+ }
289
+ //#endregion
290
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/context.js
291
+ /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
292
+ /** @type {ComponentContext | null} */
293
+ var component_context = null;
294
+ /** @param {ComponentContext | null} context */
295
+ function set_component_context(context) {
296
+ component_context = context;
297
+ }
298
+ /**
299
+ * @param {Record<string, unknown>} props
300
+ * @param {any} runes
301
+ * @param {Function} [fn]
302
+ * @returns {void}
303
+ */
304
+ function push$1(props, runes = false, fn) {
305
+ component_context = {
306
+ p: component_context,
307
+ i: false,
308
+ c: null,
309
+ e: null,
310
+ s: props,
311
+ x: null,
312
+ r: active_effect,
313
+ l: null
314
+ };
315
+ }
316
+ /**
317
+ * @template {Record<string, any>} T
318
+ * @param {T} [component]
319
+ * @returns {T}
320
+ */
321
+ function pop$1(component) {
322
+ var context = component_context;
323
+ var effects = context.e;
324
+ if (effects !== null) {
325
+ context.e = null;
326
+ for (var fn of effects) create_user_effect(fn);
327
+ }
328
+ context.i = true;
329
+ component_context = context.p;
330
+ return mark_as_component(component);
331
+ }
332
+ /**
333
+ * Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.
334
+ * @param {any} component
335
+ */
336
+ function mark_as_component(component = {}) {
337
+ define_property(component, COMPONENT_SYMBOL, { value: true });
338
+ return component;
339
+ }
340
+ /** @returns {boolean} */
341
+ function is_runes() {
342
+ return true;
343
+ }
344
+ //#endregion
345
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/task.js
346
+ /** @type {Array<() => void>} */
347
+ var micro_tasks = [];
348
+ function run_micro_tasks() {
349
+ var tasks = micro_tasks;
350
+ micro_tasks = [];
351
+ run_all(tasks);
352
+ }
353
+ /**
354
+ * @param {() => void} fn
355
+ */
356
+ function queue_micro_task(fn) {
357
+ if (micro_tasks.length === 0 && !is_flushing_sync) {
358
+ var tasks = micro_tasks;
359
+ queueMicrotask(() => {
360
+ if (tasks === micro_tasks) run_micro_tasks();
361
+ });
362
+ }
363
+ micro_tasks.push(fn);
364
+ }
365
+ /**
366
+ * Synchronously run any queued tasks.
367
+ */
368
+ function flush_tasks() {
369
+ while (micro_tasks.length > 0) run_micro_tasks();
370
+ }
371
+ //#endregion
372
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/status.js
373
+ /** @import { Derived, Signal } from '#client' */
374
+ var STATUS_MASK = -7169;
375
+ /**
376
+ * @param {Signal} signal
377
+ * @param {number} status
378
+ */
379
+ function set_signal_status(signal, status) {
380
+ signal.f = signal.f & STATUS_MASK | status;
381
+ }
382
+ /**
383
+ * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.
384
+ * @param {Derived} derived
385
+ */
386
+ function update_derived_status(derived) {
387
+ if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN);
388
+ else set_signal_status(derived, MAYBE_DIRTY);
389
+ }
390
+ //#endregion
391
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/utils.js
392
+ /** @import { Derived, Effect, Value } from '#client' */
393
+ /**
394
+ * @param {Value[] | null} deps
395
+ */
396
+ function clear_marked(deps) {
397
+ if (deps === null) return;
398
+ for (const dep of deps) {
399
+ if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue;
400
+ dep.f ^= WAS_MARKED;
401
+ clear_marked(
402
+ /** @type {Derived} */
403
+ dep.deps
404
+ );
405
+ }
406
+ }
407
+ /**
408
+ * @param {Effect} effect
409
+ * @param {Set<Effect>} dirty_effects
410
+ * @param {Set<Effect>} maybe_dirty_effects
411
+ */
412
+ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
413
+ if ((effect.f & 2048) !== 0) dirty_effects.add(effect);
414
+ else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect);
415
+ clear_marked(effect.deps);
416
+ set_signal_status(effect, CLEAN);
417
+ }
418
+ //#endregion
419
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
420
+ /**
421
+ * @template T
422
+ * @param {() => T} fn
423
+ */
424
+ function without_reactive_context(fn) {
425
+ var previous_reaction = active_reaction;
426
+ var previous_effect = active_effect;
427
+ set_active_reaction(null);
428
+ set_active_effect(null);
429
+ try {
430
+ return fn();
431
+ } finally {
432
+ set_active_reaction(previous_reaction);
433
+ set_active_effect(previous_effect);
434
+ }
435
+ }
436
+ var OBSOLETE = Symbol("obsolete");
437
+ /**
438
+ * @param {Derived} derived
439
+ * @returns {void}
440
+ */
441
+ function destroy_derived_effects(derived) {
442
+ var effects = derived.effects;
443
+ if (effects !== null) {
444
+ derived.effects = null;
445
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
446
+ }
447
+ }
448
+ /**
449
+ * @template T
450
+ * @param {Derived} derived
451
+ * @returns {T}
452
+ */
453
+ function execute_derived(derived) {
454
+ var value;
455
+ var prev_active_effect = active_effect;
456
+ var parent = derived.parent;
457
+ if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
458
+ derived_inert();
459
+ return derived.v;
460
+ }
461
+ set_active_effect(parent);
462
+ try {
463
+ derived.f &= ~WAS_MARKED;
464
+ destroy_derived_effects(derived);
465
+ value = update_reaction(derived);
466
+ } finally {
467
+ set_active_effect(prev_active_effect);
468
+ }
469
+ return value;
470
+ }
471
+ /**
472
+ * @param {Derived} derived
473
+ * @returns {void}
474
+ */
475
+ function update_derived(derived) {
476
+ var value = execute_derived(derived);
477
+ if (!derived.equals(value)) {
478
+ derived.wv = increment_write_version();
479
+ if (!current_batch?.is_fork || derived.deps === null) {
480
+ if (current_batch !== null) {
481
+ current_batch.capture(derived, value, true);
482
+ previous_batch?.capture(derived, value, true);
483
+ } else derived.v = value;
484
+ if (derived.deps === null) {
485
+ set_signal_status(derived, CLEAN);
486
+ return;
487
+ }
488
+ }
489
+ }
490
+ if (is_destroying_effect) return;
491
+ if (batch_values !== null) {
492
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
493
+ } else update_derived_status(derived);
494
+ }
495
+ /**
496
+ * @param {Derived} derived
497
+ */
498
+ function freeze_derived_effects(derived) {
499
+ if (derived.effects === null) return;
500
+ for (const e of derived.effects) if (e.teardown || e.ac) {
501
+ e.teardown?.();
502
+ if (e.ac !== null) without_reactive_context(() => {
503
+ /** @type {AbortController} */ e.ac.abort(STALE_REACTION);
504
+ e.ac = null;
505
+ });
506
+ if (e.fn !== null) e.teardown = noop;
507
+ remove_reactions(e, 0);
508
+ destroy_effect_children(e);
509
+ }
510
+ }
511
+ /**
512
+ * @param {Derived} derived
513
+ */
514
+ function unfreeze_derived_effects(derived) {
515
+ if (derived.effects === null) return;
516
+ for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
517
+ }
518
+ //#endregion
519
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/batch.js
520
+ /** @import { Fork } from 'svelte' */
521
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
522
+ /** @type {Batch | null} */
523
+ var first_batch = null;
524
+ /** @type {Batch | null} */
525
+ var last_batch = null;
526
+ /** @type {Batch | null} */
527
+ var current_batch = null;
528
+ /**
529
+ * This is needed to avoid overwriting inputs
530
+ * @type {Batch | null}
531
+ */
532
+ var previous_batch = null;
533
+ /**
534
+ * When time travelling (i.e. working in one batch, while other batches
535
+ * still have ongoing work), we ignore the real values of affected
536
+ * signals in favour of their values within the batch
537
+ * @type {Map<Value, any> | null}
538
+ */
539
+ var batch_values = null;
540
+ /** @type {Effect | null} */
541
+ var last_scheduled_effect = null;
542
+ var is_flushing_sync = false;
543
+ var is_processing = false;
544
+ /**
545
+ * During traversal, this is an array. Newly created effects are (if not immediately
546
+ * executed) pushed to this array, rather than going through the scheduling
547
+ * rigamarole that would cause another turn of the flush loop.
548
+ * @type {Effect[] | null}
549
+ */
550
+ var collected_effects = null;
551
+ /**
552
+ * An array of effects that are marked during traversal as a result of a `set`
553
+ * (not `internal_set`) call. These will be added to the next batch and
554
+ * trigger another `batch.process()`
555
+ * @type {Effect[] | null}
556
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
557
+ */
558
+ var legacy_updates = null;
559
+ var flush_count = 0;
560
+ var uid = 1;
561
+ var Batch = class Batch {
562
+ id = uid++;
563
+ /** True as soon as `#process` was called */
564
+ #started = false;
565
+ linked = true;
566
+ /** @type {Batch | null} */
567
+ #prev = null;
568
+ /** @type {Batch | null} */
569
+ #next = null;
570
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
571
+ async_deriveds = /* @__PURE__ */ new Map();
572
+ /**
573
+ * The current values of any signals that are updated in this batch.
574
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
575
+ * They keys of this map are identical to `this.#previous`
576
+ * @type {Map<Value, [any, boolean]>}
577
+ */
578
+ current = /* @__PURE__ */ new Map();
579
+ /**
580
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
581
+ * They keys of this map are identical to `this.#current`
582
+ * @type {Map<Value, any>}
583
+ */
584
+ previous = /* @__PURE__ */ new Map();
585
+ /**
586
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
587
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
588
+ * @type {Set<(batch: Batch) => void>}
589
+ */
590
+ #commit_callbacks = /* @__PURE__ */ new Set();
591
+ /**
592
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
593
+ * @type {Set<(batch: Batch) => void>}
594
+ */
595
+ #discard_callbacks = /* @__PURE__ */ new Set();
596
+ /**
597
+ * The number of async effects that are currently in flight
598
+ */
599
+ #pending = 0;
600
+ /**
601
+ * Async effects that are currently in flight, _not_ inside a pending boundary
602
+ * @type {Map<Effect, number>}
603
+ */
604
+ #blocking_pending = /* @__PURE__ */ new Map();
605
+ /**
606
+ * A deferred that resolves when the batch is committed, used with `settled()`
607
+ * TODO replace with Promise.withResolvers once supported widely enough
608
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
609
+ */
610
+ #deferred = null;
611
+ /**
612
+ * The root effects that need to be flushed
613
+ * @type {Effect[]}
614
+ */
615
+ #roots = [];
616
+ /**
617
+ * Effects created while this batch was active.
618
+ * @type {Effect[]}
619
+ */
620
+ #new_effects = [];
621
+ /**
622
+ * Deferred effects (which run after async work has completed) that are DIRTY
623
+ * @type {Set<Effect>}
624
+ */
625
+ #dirty_effects = /* @__PURE__ */ new Set();
626
+ /**
627
+ * Deferred effects that are MAYBE_DIRTY
628
+ * @type {Set<Effect>}
629
+ */
630
+ #maybe_dirty_effects = /* @__PURE__ */ new Set();
631
+ /**
632
+ * A map of branches that still exist, but will be destroyed when this batch
633
+ * is committed — we skip over these during `process`.
634
+ * The value contains child effects that were dirty/maybe_dirty before being reset,
635
+ * so they can be rescheduled if the branch survives.
636
+ * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
637
+ */
638
+ #skipped_branches = /* @__PURE__ */ new Map();
639
+ /**
640
+ * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
641
+ * @type {Set<Effect>}
642
+ */
643
+ #unskipped_branches = /* @__PURE__ */ new Set();
644
+ is_fork = false;
645
+ #decrement_queued = false;
646
+ constructor() {
647
+ if (last_batch === null) first_batch = last_batch = this;
648
+ else {
649
+ last_batch.#next = this;
650
+ this.#prev = last_batch;
651
+ }
652
+ last_batch = this;
653
+ }
654
+ #is_deferred() {
655
+ if (this.is_fork) return true;
656
+ for (const effect of this.#blocking_pending.keys()) {
657
+ var e = effect;
658
+ var skipped = false;
659
+ while (e.parent !== null) {
660
+ if (this.#skipped_branches.has(e)) {
661
+ skipped = true;
662
+ break;
663
+ }
664
+ e = e.parent;
665
+ }
666
+ if (!skipped) return true;
667
+ }
668
+ return false;
669
+ }
670
+ /**
671
+ * Add an effect to the #skipped_branches map and reset its children
672
+ * @param {Effect} effect
673
+ */
674
+ skip_effect(effect) {
675
+ if (!this.#skipped_branches.has(effect)) this.#skipped_branches.set(effect, {
676
+ d: [],
677
+ m: []
678
+ });
679
+ this.#unskipped_branches.delete(effect);
680
+ }
681
+ /**
682
+ * Remove an effect from the #skipped_branches map and reschedule
683
+ * any tracked dirty/maybe_dirty child effects
684
+ * @param {Effect} effect
685
+ * @param {(e: Effect) => void} callback
686
+ */
687
+ unskip_effect(effect, callback = (e) => this.schedule(e)) {
688
+ var tracked = this.#skipped_branches.get(effect);
689
+ if (tracked) {
690
+ this.#skipped_branches.delete(effect);
691
+ for (var e of tracked.d) {
692
+ set_signal_status(e, DIRTY);
693
+ callback(e);
694
+ }
695
+ for (e of tracked.m) {
696
+ set_signal_status(e, MAYBE_DIRTY);
697
+ callback(e);
698
+ }
699
+ }
700
+ this.#unskipped_branches.add(effect);
701
+ }
702
+ #process() {
703
+ this.#started = true;
704
+ if (flush_count++ > 1e3) {
705
+ this.#unlink();
706
+ infinite_loop_guard();
707
+ }
708
+ for (const e of this.#dirty_effects) {
709
+ this.#maybe_dirty_effects.delete(e);
710
+ set_signal_status(e, DIRTY);
711
+ this.schedule(e);
712
+ }
713
+ for (const e of this.#maybe_dirty_effects) {
714
+ set_signal_status(e, MAYBE_DIRTY);
715
+ this.schedule(e);
716
+ }
717
+ const roots = this.#roots;
718
+ this.#roots = [];
719
+ this.apply();
720
+ /** @type {Effect[]} */
721
+ var effects = collected_effects = [];
722
+ /** @type {Effect[]} */
723
+ var render_effects = [];
724
+ /**
725
+ * @type {Effect[]}
726
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
727
+ */
728
+ var updates = legacy_updates = [];
729
+ for (const root of roots) try {
730
+ this.#traverse(root, effects, render_effects);
731
+ } catch (e) {
732
+ reset_all(root);
733
+ if (!this.#is_deferred()) this.discard();
734
+ throw e;
735
+ }
736
+ current_batch = null;
737
+ if (updates.length > 0) {
738
+ var batch = Batch.ensure();
739
+ for (const e of updates) batch.schedule(e);
740
+ }
741
+ collected_effects = null;
742
+ legacy_updates = null;
743
+ if (this.#is_deferred()) {
744
+ this.#defer_effects(render_effects);
745
+ this.#defer_effects(effects);
746
+ for (const [e, t] of this.#skipped_branches) reset_branch(e, t);
747
+ if (updates.length > 0)
748
+ /** @type {Batch} */ current_batch.#process();
749
+ return;
750
+ }
751
+ const earlier_batch = this.#find_earlier_batch();
752
+ if (earlier_batch) {
753
+ this.#defer_effects(render_effects);
754
+ this.#defer_effects(effects);
755
+ earlier_batch.#merge(this);
756
+ return;
757
+ }
758
+ this.#dirty_effects.clear();
759
+ this.#maybe_dirty_effects.clear();
760
+ for (const fn of this.#commit_callbacks) fn(this);
761
+ this.#commit_callbacks.clear();
762
+ previous_batch = this;
763
+ flush_queued_effects(render_effects);
764
+ flush_queued_effects(effects);
765
+ previous_batch = null;
766
+ this.#deferred?.resolve();
767
+ var next_batch = current_batch;
768
+ if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) {
769
+ this.#unlink();
770
+ }
771
+ if (this.#roots.length > 0) {
772
+ if (next_batch !== null) {
773
+ const batch = next_batch;
774
+ batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));
775
+ } else next_batch = this;
776
+ }
777
+ if (next_batch !== null) {
778
+ old_values.clear();
779
+ next_batch.#process();
780
+ }
781
+ }
782
+ /**
783
+ * Traverse the effect tree, executing effects or stashing
784
+ * them for later execution as appropriate
785
+ * @param {Effect} root
786
+ * @param {Effect[]} effects
787
+ * @param {Effect[]} render_effects
788
+ */
789
+ #traverse(root, effects, render_effects) {
790
+ root.f ^= CLEAN;
791
+ var effect = root.first;
792
+ while (effect !== null) {
793
+ var flags = effect.f;
794
+ var is_branch = (flags & 96) !== 0;
795
+ if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || this.#skipped_branches.has(effect)) && effect.fn !== null) {
796
+ if (is_branch) effect.f ^= CLEAN;
797
+ else if ((flags & 4) !== 0) effects.push(effect);
798
+ else if (is_dirty(effect)) {
799
+ if ((flags & 16) !== 0) this.#maybe_dirty_effects.add(effect);
800
+ update_effect(effect);
801
+ }
802
+ var child = effect.first;
803
+ if (child !== null) {
804
+ effect = child;
805
+ continue;
806
+ }
807
+ }
808
+ while (effect !== null) {
809
+ var next = effect.next;
810
+ if (next !== null) {
811
+ effect = next;
812
+ break;
813
+ }
814
+ effect = effect.parent;
815
+ }
816
+ }
817
+ }
818
+ #find_earlier_batch() {
819
+ var batch = this.#prev;
820
+ while (batch !== null) {
821
+ if (!batch.is_fork) {
822
+ for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
823
+ }
824
+ batch = batch.#prev;
825
+ }
826
+ return null;
827
+ }
828
+ /**
829
+ * @param {Batch} batch
830
+ */
831
+ #merge(batch) {
832
+ for (const [source, value] of batch.current) {
833
+ if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
834
+ this.current.set(source, value);
835
+ }
836
+ for (const [effect, deferred] of batch.async_deriveds) {
837
+ const d = this.async_deriveds.get(effect);
838
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
839
+ }
840
+ batch.async_deriveds.clear();
841
+ this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);
842
+ /**
843
+ * mark all effects that depend on `batch.current`, except the
844
+ * async effects that we just resolved (TODO unless they depend
845
+ * on values in this batch that are NOT in the later batch?).
846
+ * Through this we also will populate the correct #skipped_branches,
847
+ * oncommit callbacks etc, so we don't need to merge them separately.
848
+ * @param {Value} value
849
+ */
850
+ const mark = (value) => {
851
+ var reactions = value.reactions;
852
+ if (reactions === null) return;
853
+ if ((value.f & 2) !== 0 && (value.f & 6144) === 0) return;
854
+ for (const reaction of reactions) {
855
+ var flags = reaction.f;
856
+ if ((flags & 2) !== 0) mark(reaction);
857
+ else {
858
+ var effect = reaction;
859
+ if (flags & 4194320 && !this.async_deriveds.has(effect)) {
860
+ this.#maybe_dirty_effects.delete(effect);
861
+ set_signal_status(effect, DIRTY);
862
+ this.schedule(effect);
863
+ }
864
+ }
865
+ }
866
+ };
867
+ for (const source of this.current.keys()) mark(source);
868
+ this.oncommit(() => batch.discard());
869
+ batch.#unlink();
870
+ current_batch = this;
871
+ this.#process();
872
+ }
873
+ /**
874
+ * @param {Effect[]} effects
875
+ */
876
+ #defer_effects(effects) {
877
+ for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
878
+ }
879
+ /**
880
+ * Associate a change to a given source with the current
881
+ * batch, noting its previous and current values
882
+ * @param {Value} source
883
+ * @param {any} value
884
+ * @param {boolean} [is_derived]
885
+ */
886
+ capture(source, value, is_derived = false) {
887
+ if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
888
+ if ((source.f & 8388608) === 0) {
889
+ this.current.set(source, [value, is_derived]);
890
+ batch_values?.set(source, value);
891
+ }
892
+ if (!this.is_fork) source.v = value;
893
+ }
894
+ activate() {
895
+ current_batch = this;
896
+ }
897
+ deactivate() {
898
+ current_batch = null;
899
+ batch_values = null;
900
+ }
901
+ flush() {
902
+ try {
903
+ is_processing = true;
904
+ current_batch = this;
905
+ this.#process();
906
+ } finally {
907
+ flush_count = 0;
908
+ last_scheduled_effect = null;
909
+ collected_effects = null;
910
+ legacy_updates = null;
911
+ is_processing = false;
912
+ current_batch = null;
913
+ batch_values = null;
914
+ old_values.clear();
915
+ }
916
+ }
917
+ discard() {
918
+ for (const fn of this.#discard_callbacks) fn(this);
919
+ this.#discard_callbacks.clear();
920
+ for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE);
921
+ this.#unlink();
922
+ this.#deferred?.resolve();
923
+ }
924
+ /**
925
+ * @param {Effect} effect
926
+ */
927
+ register_created_effect(effect) {
928
+ this.#new_effects.push(effect);
929
+ }
930
+ #commit() {
931
+ for (let batch = first_batch; batch !== null; batch = batch.#next) {
932
+ var is_earlier = batch.id < this.id;
933
+ /** @type {Source[]} */
934
+ var sources = [];
935
+ for (const [source, [value, is_derived]] of this.current) {
936
+ if (batch.current.has(source)) {
937
+ var batch_value = batch.current.get(source)[0];
938
+ if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
939
+ else continue;
940
+ }
941
+ sources.push(source);
942
+ }
943
+ if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
944
+ const d = batch.async_deriveds.get(effect);
945
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
946
+ }
947
+ var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]);
948
+ if (!batch.#started || current.length === 0) continue;
949
+ var others = current.filter((source) => !this.current.has(source));
950
+ if (others.length === 0) {
951
+ if (is_earlier) batch.discard();
952
+ } else if (sources.length > 0) {
953
+ if (is_earlier) for (const unskipped of this.#unskipped_branches) batch.unskip_effect(unskipped, (e) => {
954
+ if ((e.f & 4194320) !== 0) batch.schedule(e);
955
+ else batch.#defer_effects([e]);
956
+ });
957
+ batch.activate();
958
+ /** @type {Set<Value>} */
959
+ var marked = /* @__PURE__ */ new Set();
960
+ /** @type {Map<Reaction, boolean>} */
961
+ var checked = /* @__PURE__ */ new Map();
962
+ for (var source of sources) mark_effects(source, others, marked, checked);
963
+ checked = /* @__PURE__ */ new Map();
964
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
965
+ const v2 = this.current.get(c);
966
+ if (!v2) return true;
967
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
968
+ }).map(([c]) => c);
969
+ if (current_unequal.length > 0) {
970
+ for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) {
971
+ if ((effect.f & 4194320) !== 0) {
972
+ set_signal_status(effect, DIRTY);
973
+ batch.schedule(effect);
974
+ } else batch.#dirty_effects.add(effect);
975
+ }
976
+ }
977
+ if (batch.#roots.length > 0 && !batch.#decrement_queued) {
978
+ batch.apply();
979
+ for (var root of batch.#roots) batch.#traverse(root, [], []);
980
+ batch.#roots = [];
981
+ }
982
+ batch.deactivate();
983
+ }
984
+ }
985
+ }
986
+ /**
987
+ * @param {boolean} blocking
988
+ * @param {Effect} effect
989
+ */
990
+ increment(blocking, effect) {
991
+ this.#pending += 1;
992
+ if (blocking) {
993
+ let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
994
+ this.#blocking_pending.set(effect, blocking_pending_count + 1);
995
+ }
996
+ }
997
+ /**
998
+ * @param {boolean} blocking
999
+ * @param {Effect} effect
1000
+ */
1001
+ decrement(blocking, effect) {
1002
+ this.#pending -= 1;
1003
+ if (blocking) {
1004
+ let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
1005
+ if (blocking_pending_count === 1) this.#blocking_pending.delete(effect);
1006
+ else this.#blocking_pending.set(effect, blocking_pending_count - 1);
1007
+ }
1008
+ if (this.#decrement_queued) return;
1009
+ this.#decrement_queued = true;
1010
+ queue_micro_task(() => {
1011
+ this.#decrement_queued = false;
1012
+ if (this.linked) this.flush();
1013
+ });
1014
+ }
1015
+ /**
1016
+ * @param {Set<Effect>} dirty_effects
1017
+ * @param {Set<Effect>} maybe_dirty_effects
1018
+ */
1019
+ transfer_effects(dirty_effects, maybe_dirty_effects) {
1020
+ for (const e of dirty_effects) this.#dirty_effects.add(e);
1021
+ for (const e of maybe_dirty_effects) this.#maybe_dirty_effects.add(e);
1022
+ dirty_effects.clear();
1023
+ maybe_dirty_effects.clear();
1024
+ }
1025
+ /** @param {(batch: Batch) => void} fn */
1026
+ oncommit(fn) {
1027
+ this.#commit_callbacks.add(fn);
1028
+ }
1029
+ /** @param {(batch: Batch) => void} fn */
1030
+ ondiscard(fn) {
1031
+ this.#discard_callbacks.add(fn);
1032
+ }
1033
+ settled() {
1034
+ return (this.#deferred ??= deferred()).promise;
1035
+ }
1036
+ static ensure() {
1037
+ if (current_batch === null) {
1038
+ const batch = current_batch = new Batch();
1039
+ if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
1040
+ if (!batch.#started) batch.flush();
1041
+ });
1042
+ }
1043
+ return current_batch;
1044
+ }
1045
+ apply() {
1046
+ {
1047
+ batch_values = null;
1048
+ return;
1049
+ }
1050
+ }
1051
+ /**
1052
+ *
1053
+ * @param {Effect} effect
1054
+ */
1055
+ schedule(effect) {
1056
+ last_scheduled_effect = effect;
1057
+ if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
1058
+ effect.b.defer_effect(effect);
1059
+ return;
1060
+ }
1061
+ var e = effect;
1062
+ while (e.parent !== null) {
1063
+ e = e.parent;
1064
+ var flags = e.f;
1065
+ if (collected_effects !== null && e === active_effect) {
1066
+ if ((active_reaction === null || (active_reaction.f & 2) === 0) && true) return;
1067
+ }
1068
+ if ((flags & 96) !== 0) {
1069
+ if ((flags & 1024) === 0) return;
1070
+ e.f ^= CLEAN;
1071
+ }
1072
+ }
1073
+ this.#roots.push(e);
1074
+ }
1075
+ #unlink() {
1076
+ if (!this.linked) return;
1077
+ var prev = this.#prev;
1078
+ var next = this.#next;
1079
+ if (prev === null) first_batch = next;
1080
+ else prev.#next = next;
1081
+ if (next === null) last_batch = prev;
1082
+ else next.#prev = prev;
1083
+ this.linked = false;
1084
+ }
1085
+ };
1086
+ /**
1087
+ * Synchronously flush any pending updates.
1088
+ * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1089
+ * @template [T=void]
1090
+ * @param {(() => T) | undefined} [fn]
1091
+ * @returns {T}
1092
+ */
1093
+ function flushSync(fn) {
1094
+ var was_flushing_sync = is_flushing_sync;
1095
+ is_flushing_sync = true;
1096
+ try {
1097
+ var result;
1098
+ if (fn) ;
1099
+ while (true) {
1100
+ flush_tasks();
1101
+ if (current_batch === null) return result;
1102
+ current_batch.flush();
1103
+ }
1104
+ } finally {
1105
+ is_flushing_sync = was_flushing_sync;
1106
+ }
1107
+ }
1108
+ function infinite_loop_guard() {
1109
+ try {
1110
+ effect_update_depth_exceeded();
1111
+ } catch (error) {
1112
+ invoke_error_boundary(error, last_scheduled_effect);
1113
+ }
1114
+ }
1115
+ /** @type {Set<Effect> | null} */
1116
+ var eager_block_effects = null;
1117
+ /**
1118
+ * @param {Array<Effect>} effects
1119
+ * @returns {void}
1120
+ */
1121
+ function flush_queued_effects(effects) {
1122
+ var length = effects.length;
1123
+ if (length === 0) return;
1124
+ var i = 0;
1125
+ while (i < length) {
1126
+ var effect = effects[i++];
1127
+ if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1128
+ eager_block_effects = /* @__PURE__ */ new Set();
1129
+ update_effect(effect);
1130
+ if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1131
+ if (eager_block_effects?.size > 0) {
1132
+ old_values.clear();
1133
+ for (const e of eager_block_effects) {
1134
+ if ((e.f & 24576) !== 0) continue;
1135
+ /** @type {Effect[]} */
1136
+ const ordered_effects = [e];
1137
+ let ancestor = e.parent;
1138
+ while (ancestor !== null) {
1139
+ if (eager_block_effects.has(ancestor)) {
1140
+ eager_block_effects.delete(ancestor);
1141
+ ordered_effects.push(ancestor);
1142
+ }
1143
+ ancestor = ancestor.parent;
1144
+ }
1145
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
1146
+ const e = ordered_effects[j];
1147
+ if ((e.f & 24576) !== 0) continue;
1148
+ update_effect(e);
1149
+ }
1150
+ }
1151
+ eager_block_effects.clear();
1152
+ }
1153
+ }
1154
+ }
1155
+ eager_block_effects = null;
1156
+ }
1157
+ /**
1158
+ * This is similar to `mark_reactions`, but it only marks async/block effects
1159
+ * depending on `value` and at least one of the other `sources`, so that
1160
+ * these effects can re-run after another batch has been committed
1161
+ * @param {Value} value
1162
+ * @param {Source[]} sources
1163
+ * @param {Set<Value>} marked
1164
+ * @param {Map<Reaction, boolean>} checked
1165
+ */
1166
+ function mark_effects(value, sources, marked, checked) {
1167
+ if (marked.has(value)) return;
1168
+ marked.add(value);
1169
+ if (value.reactions !== null) for (const reaction of value.reactions) {
1170
+ const flags = reaction.f;
1171
+ if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1172
+ else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1173
+ set_signal_status(reaction, DIRTY);
1174
+ schedule_effect(reaction);
1175
+ }
1176
+ }
1177
+ }
1178
+ /**
1179
+ * @param {Reaction} reaction
1180
+ * @param {Source[]} sources
1181
+ * @param {Map<Reaction, boolean>} checked
1182
+ */
1183
+ function depends_on(reaction, sources, checked) {
1184
+ const depends = checked.get(reaction);
1185
+ if (depends !== void 0) return depends;
1186
+ if (reaction.deps !== null) for (const dep of reaction.deps) {
1187
+ if (includes.call(sources, dep)) return true;
1188
+ if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1189
+ checked.set(dep, true);
1190
+ return true;
1191
+ }
1192
+ }
1193
+ checked.set(reaction, false);
1194
+ return false;
1195
+ }
1196
+ /**
1197
+ * @param {Effect} effect
1198
+ * @returns {void}
1199
+ */
1200
+ function schedule_effect(effect) {
1201
+ /** @type {Batch} */ current_batch.schedule(effect);
1202
+ }
1203
+ /**
1204
+ * Mark all the effects inside a skipped branch CLEAN, so that
1205
+ * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1206
+ * effects so they can be rescheduled if the branch survives.
1207
+ * @param {Effect} effect
1208
+ * @param {{ d: Effect[], m: Effect[] }} tracked
1209
+ */
1210
+ function reset_branch(effect, tracked) {
1211
+ if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1212
+ if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1213
+ else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1214
+ set_signal_status(effect, CLEAN);
1215
+ var e = effect.first;
1216
+ while (e !== null) {
1217
+ reset_branch(e, tracked);
1218
+ e = e.next;
1219
+ }
1220
+ }
1221
+ /**
1222
+ * Mark an entire effect tree clean following an error
1223
+ * @param {Effect} effect
1224
+ */
1225
+ function reset_all(effect) {
1226
+ set_signal_status(effect, CLEAN);
1227
+ var e = effect.first;
1228
+ while (e !== null) {
1229
+ reset_all(e);
1230
+ e = e.next;
1231
+ }
1232
+ }
1233
+ //#endregion
1234
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/sources.js
1235
+ /** @import { Derived, Effect, Source, Value } from '#client' */
1236
+ /** @type {Set<Effect>} */
1237
+ var eager_effects = /* @__PURE__ */ new Set();
1238
+ /** @type {Map<Source, any>} */
1239
+ var old_values = /* @__PURE__ */ new Map();
1240
+ var eager_effects_deferred = false;
1241
+ /**
1242
+ * @template V
1243
+ * @param {V} v
1244
+ * @param {Error | null} [stack]
1245
+ * @returns {Source<V>}
1246
+ */
1247
+ function source(v, stack) {
1248
+ return {
1249
+ f: 0,
1250
+ v,
1251
+ reactions: null,
1252
+ equals,
1253
+ rv: 0,
1254
+ wv: 0
1255
+ };
1256
+ }
1257
+ /**
1258
+ * @template V
1259
+ * @param {V} v
1260
+ * @param {Error | null} [stack]
1261
+ */
1262
+ /*#__NO_SIDE_EFFECTS__*/
1263
+ function state(v, stack) {
1264
+ const s = source(v);
1265
+ push_reaction_value(s);
1266
+ return s;
1267
+ }
1268
+ /**
1269
+ * @template V
1270
+ * @param {V} initial_value
1271
+ * @param {boolean} [immutable]
1272
+ * @returns {Source<V>}
1273
+ */
1274
+ /*#__NO_SIDE_EFFECTS__*/
1275
+ function mutable_source(initial_value, immutable = false, trackable = true) {
1276
+ const s = source(initial_value);
1277
+ if (!immutable) s.equals = safe_equals;
1278
+ return s;
1279
+ }
1280
+ /**
1281
+ * @template V
1282
+ * @param {Source<V>} source
1283
+ * @param {V} value
1284
+ * @param {boolean} [should_proxy]
1285
+ * @returns {V}
1286
+ */
1287
+ function set(source, value, should_proxy = false) {
1288
+ if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !current_sources.has(source))) state_unsafe_mutation();
1289
+ return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1290
+ }
1291
+ /**
1292
+ * @template V
1293
+ * @param {Source<V>} source
1294
+ * @param {V} value
1295
+ * @param {Effect[] | null} [updated_during_traversal]
1296
+ * @returns {V}
1297
+ */
1298
+ function internal_set(source, value, updated_during_traversal = null) {
1299
+ if (!source.equals(value)) {
1300
+ if (is_destroying_effect) old_values.set(source, value);
1301
+ else if (!old_values.has(source)) old_values.set(source, source.v);
1302
+ var batch = Batch.ensure();
1303
+ batch.capture(source, value);
1304
+ if ((source.f & 2) !== 0) {
1305
+ const derived = source;
1306
+ if ((source.f & 2048) !== 0) execute_derived(derived);
1307
+ if (batch_values === null) update_derived_status(derived);
1308
+ }
1309
+ source.wv = increment_write_version();
1310
+ mark_reactions(source, DIRTY, updated_during_traversal);
1311
+ if (active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) {
1312
+ if (untracked_writes === null) set_untracked_writes([source]);
1313
+ else untracked_writes.push(source);
1314
+ }
1315
+ if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
1316
+ }
1317
+ return value;
1318
+ }
1319
+ function flush_eager_effects() {
1320
+ eager_effects_deferred = false;
1321
+ for (const effect of eager_effects) {
1322
+ if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1323
+ let dirty;
1324
+ try {
1325
+ dirty = is_dirty(effect);
1326
+ } catch {
1327
+ dirty = true;
1328
+ }
1329
+ if (dirty) update_effect(effect);
1330
+ }
1331
+ eager_effects.clear();
1332
+ }
1333
+ /**
1334
+ * Silently (without using `get`) increment a source
1335
+ * @param {Source<number>} source
1336
+ */
1337
+ function increment(source) {
1338
+ set(source, source.v + 1);
1339
+ }
1340
+ /**
1341
+ * @param {Value} signal
1342
+ * @param {number} status should be DIRTY or MAYBE_DIRTY
1343
+ * @param {Effect[] | null} updated_during_traversal
1344
+ * @returns {void}
1345
+ */
1346
+ function mark_reactions(signal, status, updated_during_traversal) {
1347
+ var reactions = signal.reactions;
1348
+ if (reactions === null) return;
1349
+ var length = reactions.length;
1350
+ for (var i = 0; i < length; i++) {
1351
+ var reaction = reactions[i];
1352
+ var flags = reaction.f;
1353
+ var not_dirty = (flags & DIRTY) === 0;
1354
+ if (not_dirty) set_signal_status(reaction, status);
1355
+ if ((flags & 131072) !== 0) eager_effects.add(reaction);
1356
+ else if ((flags & 2) !== 0) {
1357
+ var derived = reaction;
1358
+ batch_values?.delete(derived);
1359
+ if ((flags & 65536) === 0) {
1360
+ if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED;
1361
+ mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1362
+ }
1363
+ } else if (not_dirty) {
1364
+ var effect = reaction;
1365
+ if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
1366
+ if (updated_during_traversal !== null) updated_during_traversal.push(effect);
1367
+ else schedule_effect(effect);
1368
+ }
1369
+ }
1370
+ }
1371
+ /**
1372
+ * @template T
1373
+ * @param {T} value
1374
+ * @returns {T}
1375
+ */
1376
+ function proxy(value) {
1377
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value || COMPONENT_SYMBOL in value) return value;
1378
+ const prototype = get_prototype_of(value);
1379
+ if (prototype !== object_prototype && prototype !== array_prototype) return value;
1380
+ /** @type {Map<any, Source<any>>} */
1381
+ var sources = /* @__PURE__ */ new Map();
1382
+ var is_proxied_array = is_array(value);
1383
+ var version = /* @__PURE__ */ state(0);
1384
+ var parent_version = update_version;
1385
+ /**
1386
+ * Executes the proxy in the context of the reaction it was originally created in, if any
1387
+ * @template T
1388
+ * @param {() => T} fn
1389
+ */
1390
+ var with_parent = (fn) => {
1391
+ if (update_version === parent_version) return fn();
1392
+ var reaction = active_reaction;
1393
+ var version = update_version;
1394
+ set_active_reaction(null);
1395
+ set_update_version(parent_version);
1396
+ var result = fn();
1397
+ set_active_reaction(reaction);
1398
+ set_update_version(version);
1399
+ return result;
1400
+ };
1401
+ if (is_proxied_array) sources.set("length", /* @__PURE__ */ state(
1402
+ /** @type {any[]} */
1403
+ value.length));
1404
+ return new Proxy(value, {
1405
+ defineProperty(_, prop, descriptor) {
1406
+ if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
1407
+ var s = sources.get(prop);
1408
+ if (s === void 0) with_parent(() => {
1409
+ var s = /* @__PURE__ */ state(descriptor.value);
1410
+ sources.set(prop, s);
1411
+ return s;
1412
+ });
1413
+ else set(s, descriptor.value, true);
1414
+ return true;
1415
+ },
1416
+ deleteProperty(target, prop) {
1417
+ var s = sources.get(prop);
1418
+ if (s === void 0) {
1419
+ if (prop in target) {
1420
+ const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
1421
+ sources.set(prop, s);
1422
+ increment(version);
1423
+ }
1424
+ } else {
1425
+ set(s, UNINITIALIZED);
1426
+ increment(version);
1427
+ }
1428
+ return true;
1429
+ },
1430
+ get(target, prop, receiver) {
1431
+ if (prop === STATE_SYMBOL) return value;
1432
+ var s = sources.get(prop);
1433
+ var exists = prop in target;
1434
+ if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
1435
+ s = with_parent(() => {
1436
+ return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED));
1437
+ });
1438
+ sources.set(prop, s);
1439
+ }
1440
+ if (s !== void 0) {
1441
+ var v = get(s);
1442
+ return v === UNINITIALIZED ? void 0 : v;
1443
+ }
1444
+ return Reflect.get(target, prop, receiver);
1445
+ },
1446
+ getOwnPropertyDescriptor(target, prop) {
1447
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1448
+ if (descriptor && "value" in descriptor) {
1449
+ var s = sources.get(prop);
1450
+ if (s) descriptor.value = get(s);
1451
+ } else if (descriptor === void 0) {
1452
+ var source = sources.get(prop);
1453
+ var value = source?.v;
1454
+ if (source !== void 0 && value !== UNINITIALIZED) return {
1455
+ enumerable: true,
1456
+ configurable: true,
1457
+ value,
1458
+ writable: true
1459
+ };
1460
+ }
1461
+ return descriptor;
1462
+ },
1463
+ has(target, prop) {
1464
+ if (prop === STATE_SYMBOL) return true;
1465
+ var s = sources.get(prop);
1466
+ var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
1467
+ if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
1468
+ if (s === void 0) {
1469
+ s = with_parent(() => {
1470
+ return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED);
1471
+ });
1472
+ sources.set(prop, s);
1473
+ }
1474
+ if (get(s) === UNINITIALIZED) return false;
1475
+ }
1476
+ return has;
1477
+ },
1478
+ set(target, prop, value, receiver) {
1479
+ var s = sources.get(prop);
1480
+ var has = prop in target;
1481
+ if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
1482
+ var other_s = sources.get(i + "");
1483
+ if (other_s !== void 0) set(other_s, UNINITIALIZED);
1484
+ else if (i in target) {
1485
+ other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
1486
+ sources.set(i + "", other_s);
1487
+ }
1488
+ }
1489
+ if (s === void 0) {
1490
+ if (!has || get_descriptor(target, prop)?.writable) {
1491
+ s = with_parent(() => /* @__PURE__ */ state(void 0));
1492
+ set(s, proxy(value));
1493
+ sources.set(prop, s);
1494
+ }
1495
+ } else {
1496
+ has = s.v !== UNINITIALIZED;
1497
+ var p = with_parent(() => proxy(value));
1498
+ set(s, p);
1499
+ }
1500
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1501
+ if (descriptor?.set) descriptor.set.call(receiver, value);
1502
+ if (!has) {
1503
+ if (is_proxied_array && typeof prop === "string") {
1504
+ var ls = sources.get("length");
1505
+ var n = Number(prop);
1506
+ if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
1507
+ }
1508
+ increment(version);
1509
+ }
1510
+ return true;
1511
+ },
1512
+ ownKeys(target) {
1513
+ get(version);
1514
+ var own_keys = Reflect.ownKeys(target).filter((key) => {
1515
+ var source = sources.get(key);
1516
+ return source === void 0 || source.v !== UNINITIALIZED;
1517
+ });
1518
+ for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
1519
+ return own_keys;
1520
+ },
1521
+ setPrototypeOf() {
1522
+ state_prototype_fixed();
1523
+ }
1524
+ });
1525
+ }
1526
+ //#endregion
1527
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/operations.js
1528
+ /** @type {Window} */
1529
+ var $window;
1530
+ /** @type {() => Node | null} */
1531
+ var first_child_getter;
1532
+ /** @type {() => Node | null} */
1533
+ var next_sibling_getter;
1534
+ /**
1535
+ * Initialize these lazily to avoid issues when using the runtime in a server context
1536
+ * where these globals are not available while avoiding a separate server entry point
1537
+ */
1538
+ function init_operations() {
1539
+ if ($window !== void 0) return;
1540
+ $window = window;
1541
+ var element_prototype = Element.prototype;
1542
+ var node_prototype = Node.prototype;
1543
+ var text_prototype = Text.prototype;
1544
+ first_child_getter = get_descriptor(node_prototype, "firstChild").get;
1545
+ next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
1546
+ if (is_extensible(element_prototype)) {
1547
+ /** @type {any} */ element_prototype[CLASS_CACHE] = void 0;
1548
+ /** @type {any} */ element_prototype[ATTRIBUTES_CACHE] = null;
1549
+ /** @type {any} */ element_prototype[STYLE_CACHE] = void 0;
1550
+ element_prototype.__e = void 0;
1551
+ }
1552
+ if (is_extensible(text_prototype))
1553
+ /** @type {any} */ text_prototype[TEXT_CACHE] = void 0;
1554
+ }
1555
+ /**
1556
+ * @param {string} value
1557
+ * @returns {Text}
1558
+ */
1559
+ function create_text(value = "") {
1560
+ return document.createTextNode(value);
1561
+ }
1562
+ /**
1563
+ * @template {Node} N
1564
+ * @param {N} node
1565
+ */
1566
+ /*@__NO_SIDE_EFFECTS__*/
1567
+ function get_first_child(node) {
1568
+ return first_child_getter.call(node);
1569
+ }
1570
+ /**
1571
+ * @template {Node} N
1572
+ * @param {N} node
1573
+ */
1574
+ /*@__NO_SIDE_EFFECTS__*/
1575
+ function get_next_sibling(node) {
1576
+ return next_sibling_getter.call(node);
1577
+ }
1578
+ /**
1579
+ * @template {Node} N
1580
+ * @param {N} node
1581
+ * @returns {void}
1582
+ */
1583
+ function clear_text_content(node) {
1584
+ node.textContent = "";
1585
+ }
1586
+ /**
1587
+ * @param {unknown} error
1588
+ */
1589
+ function handle_error(error) {
1590
+ var effect = active_effect;
1591
+ if (effect === null) {
1592
+ /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
1593
+ return error;
1594
+ }
1595
+ if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
1596
+ invoke_error_boundary(error, effect);
1597
+ }
1598
+ /**
1599
+ * @param {unknown} error
1600
+ * @param {Effect | null} effect
1601
+ */
1602
+ function invoke_error_boundary(error, effect) {
1603
+ if (effect !== null && (effect.f & 16384) !== 0) return;
1604
+ while (effect !== null) {
1605
+ if ((effect.f & 128) !== 0 && (effect.f & 33570816) === 0) {
1606
+ if ((effect.f & 32768) === 0) throw error;
1607
+ try {
1608
+ /** @type {Boundary} */ effect.b.error(error);
1609
+ return;
1610
+ } catch (e) {
1611
+ error = e;
1612
+ }
1613
+ }
1614
+ effect = effect.parent;
1615
+ }
1616
+ throw error;
1617
+ }
1618
+ //#endregion
1619
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/effects.js
1620
+ /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
1621
+ /**
1622
+ * @param {Effect} effect
1623
+ * @param {Effect} parent_effect
1624
+ */
1625
+ function push_effect(effect, parent_effect) {
1626
+ var parent_last = parent_effect.last;
1627
+ if (parent_last === null) parent_effect.last = parent_effect.first = effect;
1628
+ else {
1629
+ parent_last.next = effect;
1630
+ effect.prev = parent_last;
1631
+ parent_effect.last = effect;
1632
+ }
1633
+ }
1634
+ /**
1635
+ * @param {number} type
1636
+ * @param {null | (() => void | (() => void))} fn
1637
+ * @returns {Effect}
1638
+ */
1639
+ function create_effect(type, fn) {
1640
+ var parent = active_effect;
1641
+ if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
1642
+ /** @type {Effect} */
1643
+ var effect = {
1644
+ ctx: component_context,
1645
+ deps: null,
1646
+ nodes: null,
1647
+ f: type | DIRTY | 512,
1648
+ first: null,
1649
+ fn,
1650
+ last: null,
1651
+ next: null,
1652
+ parent,
1653
+ b: parent && parent.b,
1654
+ prev: null,
1655
+ teardown: null,
1656
+ wv: 0,
1657
+ ac: null
1658
+ };
1659
+ current_batch?.register_created_effect(effect);
1660
+ /** @type {Effect | null} */
1661
+ var e = effect;
1662
+ if ((type & 4) !== 0) {
1663
+ if (collected_effects !== null) collected_effects.push(effect);
1664
+ else Batch.ensure().schedule(effect);
1665
+ } else if (fn !== null) {
1666
+ try {
1667
+ update_effect(effect);
1668
+ } catch (e) {
1669
+ destroy_effect(effect);
1670
+ throw e;
1671
+ }
1672
+ if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
1673
+ e = e.first;
1674
+ if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
1675
+ }
1676
+ }
1677
+ if (e !== null) {
1678
+ e.parent = parent;
1679
+ if (parent !== null) push_effect(e, parent);
1680
+ if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
1681
+ var derived = active_reaction;
1682
+ (derived.effects ??= []).push(e);
1683
+ }
1684
+ }
1685
+ return effect;
1686
+ }
1687
+ /**
1688
+ * Internal representation of `$effect.tracking()`
1689
+ * @returns {boolean}
1690
+ */
1691
+ function effect_tracking() {
1692
+ return active_reaction !== null && !untracking;
1693
+ }
1694
+ /**
1695
+ * @param {() => void | (() => void)} fn
1696
+ */
1697
+ function create_user_effect(fn) {
1698
+ return create_effect(4 | USER_EFFECT, fn);
1699
+ }
1700
+ /**
1701
+ * An effect root whose children can transition out
1702
+ * @param {() => void} fn
1703
+ * @returns {(options?: { outro?: boolean }) => Promise<void>}
1704
+ */
1705
+ function component_root(fn) {
1706
+ Batch.ensure();
1707
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
1708
+ return (options = {}) => {
1709
+ return new Promise((fulfil) => {
1710
+ if (options.outro) pause_effect(effect, () => {
1711
+ destroy_effect(effect);
1712
+ fulfil(void 0);
1713
+ });
1714
+ else {
1715
+ destroy_effect(effect);
1716
+ fulfil(void 0);
1717
+ }
1718
+ });
1719
+ };
1720
+ }
1721
+ /**
1722
+ * @param {() => void | (() => void)} fn
1723
+ * @returns {Effect}
1724
+ */
1725
+ function render_effect(fn, flags = 0) {
1726
+ return create_effect(8 | flags, fn);
1727
+ }
1728
+ /**
1729
+ * @param {(() => void)} fn
1730
+ * @param {number} flags
1731
+ */
1732
+ function block(fn, flags = 0) {
1733
+ return create_effect(16 | flags, fn);
1734
+ }
1735
+ /**
1736
+ * @param {(() => void)} fn
1737
+ */
1738
+ function branch(fn) {
1739
+ return create_effect(32 | EFFECT_PRESERVED, fn);
1740
+ }
1741
+ /**
1742
+ * @param {Effect} effect
1743
+ */
1744
+ function execute_effect_teardown(effect) {
1745
+ var teardown = effect.teardown;
1746
+ if (teardown !== null) {
1747
+ const previously_destroying_effect = is_destroying_effect;
1748
+ const previous_reaction = active_reaction;
1749
+ set_is_destroying_effect(true);
1750
+ set_active_reaction(null);
1751
+ try {
1752
+ teardown.call(null);
1753
+ } catch (error) {
1754
+ invoke_error_boundary(error, effect.parent);
1755
+ } finally {
1756
+ set_is_destroying_effect(previously_destroying_effect);
1757
+ set_active_reaction(previous_reaction);
1758
+ }
1759
+ }
1760
+ }
1761
+ /**
1762
+ * @param {Effect} signal
1763
+ * @param {boolean} remove_dom
1764
+ * @returns {void}
1765
+ */
1766
+ function destroy_effect_children(signal, remove_dom = false) {
1767
+ var effect = signal.first;
1768
+ signal.first = signal.last = null;
1769
+ while (effect !== null) {
1770
+ const controller = effect.ac;
1771
+ if (controller !== null) without_reactive_context(() => {
1772
+ controller.abort(STALE_REACTION);
1773
+ });
1774
+ var next = effect.next;
1775
+ if ((effect.f & 64) !== 0) effect.parent = null;
1776
+ else destroy_effect(effect, remove_dom);
1777
+ effect = next;
1778
+ }
1779
+ }
1780
+ /**
1781
+ * @param {Effect} signal
1782
+ * @returns {void}
1783
+ */
1784
+ function destroy_block_effect_children(signal) {
1785
+ var effect = signal.first;
1786
+ while (effect !== null) {
1787
+ var next = effect.next;
1788
+ if ((effect.f & 32) === 0) destroy_effect(effect);
1789
+ effect = next;
1790
+ }
1791
+ }
1792
+ /**
1793
+ * @param {Effect} effect
1794
+ * @param {boolean} [remove_dom]
1795
+ * @returns {void}
1796
+ */
1797
+ function destroy_effect(effect, remove_dom = true) {
1798
+ var removed = false;
1799
+ if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
1800
+ remove_effect_dom(effect.nodes.start, effect.nodes.end);
1801
+ removed = true;
1802
+ }
1803
+ effect.f |= DESTROYING;
1804
+ destroy_effect_children(effect, remove_dom && !removed);
1805
+ remove_reactions(effect, 0);
1806
+ var transitions = effect.nodes && effect.nodes.t;
1807
+ if (transitions !== null) for (const transition of transitions) transition.stop();
1808
+ execute_effect_teardown(effect);
1809
+ effect.f ^= DESTROYING;
1810
+ effect.f |= DESTROYED;
1811
+ var parent = effect.parent;
1812
+ if (parent !== null && parent.first !== null) unlink_effect(effect);
1813
+ effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null;
1814
+ }
1815
+ /**
1816
+ *
1817
+ * @param {TemplateNode | null} node
1818
+ * @param {TemplateNode} end
1819
+ */
1820
+ function remove_effect_dom(node, end) {
1821
+ while (node !== null) {
1822
+ /** @type {TemplateNode | null} */
1823
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
1824
+ node.remove();
1825
+ node = next;
1826
+ }
1827
+ }
1828
+ /**
1829
+ * Detach an effect from the effect tree, freeing up memory and
1830
+ * reducing the amount of work that happens on subsequent traversals
1831
+ * @param {Effect} effect
1832
+ */
1833
+ function unlink_effect(effect) {
1834
+ var parent = effect.parent;
1835
+ var prev = effect.prev;
1836
+ var next = effect.next;
1837
+ if (prev !== null) prev.next = next;
1838
+ if (next !== null) next.prev = prev;
1839
+ if (parent !== null) {
1840
+ if (parent.first === effect) parent.first = next;
1841
+ if (parent.last === effect) parent.last = prev;
1842
+ }
1843
+ }
1844
+ /**
1845
+ * When a block effect is removed, we don't immediately destroy it or yank it
1846
+ * out of the DOM, because it might have transitions. Instead, we 'pause' it.
1847
+ * It stays around (in memory, and in the DOM) until outro transitions have
1848
+ * completed, and if the state change is reversed then we _resume_ it.
1849
+ * A paused effect does not update, and the DOM subtree becomes inert.
1850
+ * @param {Effect} effect
1851
+ * @param {() => void} [callback]
1852
+ * @param {boolean} [destroy]
1853
+ */
1854
+ function pause_effect(effect, callback, destroy = true) {
1855
+ /** @type {TransitionManager[]} */
1856
+ var transitions = [];
1857
+ effect.f |= 256;
1858
+ pause_children(effect, transitions, true);
1859
+ var fn = () => {
1860
+ if (destroy) destroy_effect(effect);
1861
+ if (callback) callback();
1862
+ };
1863
+ var remaining = transitions.length;
1864
+ if (remaining > 0) {
1865
+ var check = () => --remaining || fn();
1866
+ for (var transition of transitions) transition.out(check);
1867
+ } else fn();
1868
+ }
1869
+ /**
1870
+ * @param {Effect} effect
1871
+ * @param {TransitionManager[]} transitions
1872
+ * @param {boolean} local
1873
+ */
1874
+ function pause_children(effect, transitions, local) {
1875
+ if ((effect.f & 8192) !== 0) return;
1876
+ effect.f ^= INERT;
1877
+ var t = effect.nodes && effect.nodes.t;
1878
+ if (t !== null) {
1879
+ for (const transition of t) if (transition.is_global || local) transitions.push(transition);
1880
+ }
1881
+ var child = effect.first;
1882
+ while (child !== null) {
1883
+ var sibling = child.next;
1884
+ if ((child.f & 64) === 0) {
1885
+ var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
1886
+ pause_children(child, transitions, transparent ? local : false);
1887
+ }
1888
+ child = sibling;
1889
+ }
1890
+ }
1891
+ /**
1892
+ * @param {Effect} effect
1893
+ * @param {DocumentFragment} fragment
1894
+ */
1895
+ function move_effect(effect, fragment) {
1896
+ if (!effect.nodes) return;
1897
+ /** @type {TemplateNode | null} */
1898
+ var node = effect.nodes.start;
1899
+ var end = effect.nodes.end;
1900
+ while (node !== null) {
1901
+ /** @type {TemplateNode | null} */
1902
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
1903
+ fragment.append(node);
1904
+ node = next;
1905
+ }
1906
+ }
1907
+ //#endregion
1908
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/client/runtime.js
1909
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
1910
+ /**
1911
+ * True if updating in an effect context that is reactive (i.e. not branch/root effects)
1912
+ */
1913
+ var is_updating_effect = false;
1914
+ var is_destroying_effect = false;
1915
+ /** @param {boolean} value */
1916
+ function set_is_destroying_effect(value) {
1917
+ is_destroying_effect = value;
1918
+ }
1919
+ /** @type {null | Reaction} */
1920
+ var active_reaction = null;
1921
+ var untracking = false;
1922
+ /** @param {null | Reaction} reaction */
1923
+ function set_active_reaction(reaction) {
1924
+ active_reaction = reaction;
1925
+ }
1926
+ /** @type {null | Effect} */
1927
+ var active_effect = null;
1928
+ /** @param {null | Effect} effect */
1929
+ function set_active_effect(effect) {
1930
+ active_effect = effect;
1931
+ }
1932
+ /**
1933
+ * When sources are created within a reaction, reading and writing
1934
+ * them within that reaction should not cause a re-run
1935
+ * @type {null | Set<Source>}
1936
+ */
1937
+ var current_sources = null;
1938
+ /** @param {Value} value */
1939
+ function push_reaction_value(value) {
1940
+ if (active_reaction !== null && (true)) (current_sources ??= /* @__PURE__ */ new Set()).add(value);
1941
+ }
1942
+ /**
1943
+ * The dependencies of the reaction that is currently being executed. In many cases,
1944
+ * the dependencies are unchanged between runs, and so this will be `null` unless
1945
+ * and until a new dependency is accessed — we track this via `skipped_deps`
1946
+ * @type {null | Value[]}
1947
+ */
1948
+ var new_deps = null;
1949
+ var skipped_deps = 0;
1950
+ /**
1951
+ * Tracks writes that the effect it's executed in doesn't listen to yet,
1952
+ * so that the dependency can be added to the effect later on if it then reads it
1953
+ * @type {null | Source[]}
1954
+ */
1955
+ var untracked_writes = null;
1956
+ /** @param {null | Source[]} value */
1957
+ function set_untracked_writes(value) {
1958
+ untracked_writes = value;
1959
+ }
1960
+ /**
1961
+ * @type {number} Used by sources and deriveds for handling updates.
1962
+ * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
1963
+ **/
1964
+ var write_version = 1;
1965
+ /** @type {number} Used to version each read of a source of derived to avoid duplicating dependencies inside a reaction */
1966
+ var read_version = 0;
1967
+ var update_version = read_version;
1968
+ /** @param {number} value */
1969
+ function set_update_version(value) {
1970
+ update_version = value;
1971
+ }
1972
+ function increment_write_version() {
1973
+ return ++write_version;
1974
+ }
1975
+ /**
1976
+ * Determines whether a derived or effect is dirty.
1977
+ * If it is MAYBE_DIRTY, will set the status to CLEAN
1978
+ * @param {Reaction} reaction
1979
+ * @returns {boolean}
1980
+ */
1981
+ function is_dirty(reaction) {
1982
+ var flags = reaction.f;
1983
+ if ((flags & 2048) !== 0) return true;
1984
+ if (flags & 2) reaction.f &= ~WAS_MARKED;
1985
+ if ((flags & 4096) !== 0) {
1986
+ var dependencies = reaction.deps;
1987
+ var length = dependencies.length;
1988
+ for (var i = 0; i < length; i++) {
1989
+ var dependency = dependencies[i];
1990
+ if (is_dirty(dependency)) update_derived(dependency);
1991
+ if (dependency.wv > reaction.wv) return true;
1992
+ }
1993
+ if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
1994
+ }
1995
+ return false;
1996
+ }
1997
+ /**
1998
+ * @param {Value} signal
1999
+ * @param {Effect} effect
2000
+ * @param {boolean} [root]
2001
+ */
2002
+ function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
2003
+ var reactions = signal.reactions;
2004
+ if (reactions === null) return;
2005
+ if (current_sources !== null && current_sources.has(signal)) return;
2006
+ for (var i = 0; i < reactions.length; i++) {
2007
+ var reaction = reactions[i];
2008
+ if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
2009
+ else if (effect === reaction) {
2010
+ if (root) set_signal_status(reaction, DIRTY);
2011
+ else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY);
2012
+ schedule_effect(reaction);
2013
+ }
2014
+ }
2015
+ }
2016
+ /** @param {Reaction} reaction */
2017
+ function update_reaction(reaction) {
2018
+ var previous_deps = new_deps;
2019
+ var previous_skipped_deps = skipped_deps;
2020
+ var previous_untracked_writes = untracked_writes;
2021
+ var previous_reaction = active_reaction;
2022
+ var previous_sources = current_sources;
2023
+ var previous_component_context = component_context;
2024
+ var previous_untracking = untracking;
2025
+ var previous_update_version = update_version;
2026
+ var flags = reaction.f;
2027
+ new_deps = null;
2028
+ skipped_deps = 0;
2029
+ untracked_writes = null;
2030
+ active_reaction = (flags & 96) === 0 ? reaction : null;
2031
+ current_sources = null;
2032
+ set_component_context(reaction.ctx);
2033
+ untracking = false;
2034
+ update_version = ++read_version;
2035
+ if (reaction.ac !== null) {
2036
+ without_reactive_context(() => {
2037
+ /** @type {AbortController} */ reaction.ac.abort(STALE_REACTION);
2038
+ });
2039
+ reaction.ac = null;
2040
+ }
2041
+ try {
2042
+ reaction.f |= REACTION_IS_UPDATING;
2043
+ var fn = reaction.fn;
2044
+ var result = fn();
2045
+ reaction.f |= REACTION_RAN;
2046
+ var deps = update_dependencies(reaction);
2047
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (var i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
2048
+ if (previous_reaction !== null && previous_reaction !== reaction) {
2049
+ read_version++;
2050
+ if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
2051
+ if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version;
2052
+ if (untracked_writes !== null) {
2053
+ if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
2054
+ else previous_untracked_writes.push(...untracked_writes);
2055
+ }
2056
+ }
2057
+ if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
2058
+ return result;
2059
+ } catch (error) {
2060
+ update_dependencies(reaction);
2061
+ return handle_error(error);
2062
+ } finally {
2063
+ reaction.f ^= REACTION_IS_UPDATING;
2064
+ new_deps = previous_deps;
2065
+ skipped_deps = previous_skipped_deps;
2066
+ untracked_writes = previous_untracked_writes;
2067
+ active_reaction = previous_reaction;
2068
+ current_sources = previous_sources;
2069
+ set_component_context(previous_component_context);
2070
+ untracking = previous_untracking;
2071
+ update_version = previous_update_version;
2072
+ }
2073
+ }
2074
+ /**
2075
+ * @param {Reaction} reaction
2076
+ */
2077
+ function update_dependencies(reaction) {
2078
+ var deps = reaction.deps;
2079
+ var is_fork = current_batch?.is_fork;
2080
+ if (new_deps !== null) {
2081
+ var i;
2082
+ if (!is_fork) remove_reactions(reaction, skipped_deps);
2083
+ if (deps !== null && skipped_deps > 0) {
2084
+ deps.length = skipped_deps + new_deps.length;
2085
+ for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
2086
+ } else reaction.deps = deps = new_deps;
2087
+ if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) (deps[i].reactions ??= []).push(reaction);
2088
+ } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
2089
+ remove_reactions(reaction, skipped_deps);
2090
+ deps.length = skipped_deps;
2091
+ }
2092
+ return deps;
2093
+ }
2094
+ /**
2095
+ * @template V
2096
+ * @param {Reaction} signal
2097
+ * @param {Value<V>} dependency
2098
+ * @returns {void}
2099
+ */
2100
+ function remove_reaction(signal, dependency) {
2101
+ let reactions = dependency.reactions;
2102
+ if (reactions !== null) {
2103
+ var index = index_of.call(reactions, signal);
2104
+ if (index !== -1) {
2105
+ var new_length = reactions.length - 1;
2106
+ if (new_length === 0) reactions = dependency.reactions = null;
2107
+ else {
2108
+ reactions[index] = reactions[new_length];
2109
+ reactions.pop();
2110
+ }
2111
+ }
2112
+ }
2113
+ if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2114
+ var derived = dependency;
2115
+ if ((derived.f & 512) !== 0) {
2116
+ derived.f ^= 512;
2117
+ derived.f &= ~WAS_MARKED;
2118
+ }
2119
+ if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2120
+ if (derived.ac !== null) without_reactive_context(() => {
2121
+ /** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
2122
+ derived.ac = null;
2123
+ set_signal_status(derived, DIRTY);
2124
+ });
2125
+ freeze_derived_effects(derived);
2126
+ remove_reactions(derived, 0);
2127
+ }
2128
+ }
2129
+ /**
2130
+ * @param {Reaction} signal
2131
+ * @param {number} start_index
2132
+ * @returns {void}
2133
+ */
2134
+ function remove_reactions(signal, start_index) {
2135
+ var dependencies = signal.deps;
2136
+ if (dependencies === null) return;
2137
+ for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
2138
+ }
2139
+ /**
2140
+ * @param {Effect} effect
2141
+ * @returns {void}
2142
+ */
2143
+ function update_effect(effect) {
2144
+ var flags = effect.f;
2145
+ if ((flags & 16384) !== 0) return;
2146
+ set_signal_status(effect, CLEAN);
2147
+ var previous_effect = active_effect;
2148
+ var was_updating_effect = is_updating_effect;
2149
+ active_effect = effect;
2150
+ is_updating_effect = (flags & 96) === 0;
2151
+ try {
2152
+ if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2153
+ else destroy_effect_children(effect);
2154
+ execute_effect_teardown(effect);
2155
+ var teardown = update_reaction(effect);
2156
+ effect.teardown = typeof teardown === "function" ? teardown : null;
2157
+ effect.wv = write_version;
2158
+ } finally {
2159
+ is_updating_effect = was_updating_effect;
2160
+ active_effect = previous_effect;
2161
+ }
2162
+ }
2163
+ /**
2164
+ * @template V
2165
+ * @param {Value<V>} signal
2166
+ * @returns {V}
2167
+ */
2168
+ function get(signal) {
2169
+ var is_derived = (signal.f & 2) !== 0;
2170
+ if (active_reaction !== null && !untracking) {
2171
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
2172
+ var deps = active_reaction.deps;
2173
+ if ((active_reaction.f & 2097152) !== 0) {
2174
+ if (signal.rv < read_version) {
2175
+ signal.rv = read_version;
2176
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
2177
+ else if (new_deps === null) new_deps = [signal];
2178
+ else new_deps.push(signal);
2179
+ }
2180
+ } else {
2181
+ active_reaction.deps ??= [];
2182
+ if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
2183
+ var reactions = signal.reactions;
2184
+ if (reactions === null) signal.reactions = [active_reaction];
2185
+ else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
2186
+ }
2187
+ }
2188
+ }
2189
+ if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
2190
+ if (is_derived) {
2191
+ var derived = signal;
2192
+ if (is_destroying_effect) {
2193
+ var value = derived.v;
2194
+ if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
2195
+ old_values.set(derived, value);
2196
+ return value;
2197
+ }
2198
+ var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
2199
+ var is_new = (derived.f & REACTION_RAN) === 0;
2200
+ if (is_dirty(derived)) {
2201
+ if (should_connect) derived.f |= 512;
2202
+ update_derived(derived);
2203
+ }
2204
+ if (should_connect && !is_new) {
2205
+ unfreeze_derived_effects(derived);
2206
+ reconnect(derived);
2207
+ }
2208
+ }
2209
+ if (batch_values?.has(signal)) return batch_values.get(signal);
2210
+ if ((signal.f & 8388608) !== 0) throw signal.v;
2211
+ return signal.v;
2212
+ }
2213
+ /**
2214
+ * (Re)connect a disconnected derived, so that it is notified
2215
+ * of changes in `mark_reactions`
2216
+ * @param {Derived} derived
2217
+ */
2218
+ function reconnect(derived) {
2219
+ derived.f |= 512;
2220
+ if (derived.deps === null) return;
2221
+ for (const dep of derived.deps) {
2222
+ (dep.reactions ??= []).push(derived);
2223
+ if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
2224
+ unfreeze_derived_effects(dep);
2225
+ reconnect(dep);
2226
+ }
2227
+ }
2228
+ }
2229
+ /** @param {Derived} derived */
2230
+ function depends_on_old_values(derived) {
2231
+ if (derived.v === UNINITIALIZED) return true;
2232
+ if (derived.deps === null) return false;
2233
+ for (const dep of derived.deps) {
2234
+ if (old_values.has(dep)) return true;
2235
+ if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
2236
+ }
2237
+ return false;
2238
+ }
2239
+ /**
2240
+ * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
2241
+ * any state read inside `fn` will not be treated as a dependency.
2242
+ *
2243
+ * ```ts
2244
+ * $effect(() => {
2245
+ * // this will run when `data` changes, but not when `time` changes
2246
+ * save(data, {
2247
+ * timestamp: untrack(() => time)
2248
+ * });
2249
+ * });
2250
+ * ```
2251
+ * @template T
2252
+ * @param {() => T} fn
2253
+ * @returns {T}
2254
+ */
2255
+ function untrack(fn) {
2256
+ var previous_untracking = untracking;
2257
+ try {
2258
+ untracking = true;
2259
+ return fn();
2260
+ } finally {
2261
+ untracking = previous_untracking;
2262
+ }
2263
+ }
2264
+ //#endregion
2265
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/store/shared/index.js
2266
+ /** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */
2267
+ /** @import { Stores, StoresValues, SubscribeInvalidateTuple } from '../private.js' */
2268
+ /**
2269
+ * @type {Array<SubscribeInvalidateTuple<any> | any>}
2270
+ */
2271
+ var subscriber_queue = [];
2272
+ /**
2273
+ * Creates a `Readable` store that allows reading by subscription.
2274
+ *
2275
+ * @template T
2276
+ * @param {T} [value] initial value
2277
+ * @param {StartStopNotifier<T>} [start]
2278
+ * @returns {Readable<T>}
2279
+ */
2280
+ function readable(value, start) {
2281
+ return { subscribe: writable(value, start).subscribe };
2282
+ }
2283
+ /**
2284
+ * Create a `Writable` store that allows both updating and reading by subscription.
2285
+ *
2286
+ * @template T
2287
+ * @param {T} [value] initial value
2288
+ * @param {StartStopNotifier<T>} [start]
2289
+ * @returns {Writable<T>}
2290
+ */
2291
+ function writable(value, start = noop) {
2292
+ /** @type {Unsubscriber | null} */
2293
+ let stop = null;
2294
+ /** @type {Set<SubscribeInvalidateTuple<T>>} */
2295
+ const subscribers = /* @__PURE__ */ new Set();
2296
+ /**
2297
+ * @param {T} new_value
2298
+ * @returns {void}
2299
+ */
2300
+ function set(new_value) {
2301
+ if (safe_not_equal(value, new_value)) {
2302
+ value = new_value;
2303
+ if (stop) {
2304
+ const run_queue = !subscriber_queue.length;
2305
+ for (const subscriber of subscribers) {
2306
+ subscriber[1]();
2307
+ subscriber_queue.push(subscriber, value);
2308
+ }
2309
+ if (run_queue) {
2310
+ for (let i = 0; i < subscriber_queue.length; i += 2) subscriber_queue[i][0](subscriber_queue[i + 1]);
2311
+ subscriber_queue.length = 0;
2312
+ }
2313
+ }
2314
+ }
2315
+ }
2316
+ /**
2317
+ * @param {Updater<T>} fn
2318
+ * @returns {void}
2319
+ */
2320
+ function update(fn) {
2321
+ set(fn(value));
2322
+ }
2323
+ /**
2324
+ * @param {Subscriber<T>} run
2325
+ * @param {() => void} [invalidate]
2326
+ * @returns {Unsubscriber}
2327
+ */
2328
+ function subscribe(run, invalidate = noop) {
2329
+ /** @type {SubscribeInvalidateTuple<T>} */
2330
+ const subscriber = [run, invalidate];
2331
+ subscribers.add(subscriber);
2332
+ if (subscribers.size === 1) stop = start(set, update) || noop;
2333
+ run(value);
2334
+ return () => {
2335
+ subscribers.delete(subscriber);
2336
+ if (subscribers.size === 0 && stop) {
2337
+ stop();
2338
+ stop = null;
2339
+ }
2340
+ };
2341
+ }
2342
+ return {
2343
+ set,
2344
+ update,
2345
+ subscribe
2346
+ };
2347
+ }
2348
+ //#endregion
2349
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/utils.js
2350
+ /**
2351
+ * Attributes that are boolean, i.e. they are present or not present.
2352
+ */
2353
+ var DOM_BOOLEAN_ATTRIBUTES = [
2354
+ "allowfullscreen",
2355
+ "async",
2356
+ "autofocus",
2357
+ "autoplay",
2358
+ "checked",
2359
+ "controls",
2360
+ "default",
2361
+ "disabled",
2362
+ "formnovalidate",
2363
+ "indeterminate",
2364
+ "inert",
2365
+ "ismap",
2366
+ "loop",
2367
+ "multiple",
2368
+ "muted",
2369
+ "nomodule",
2370
+ "novalidate",
2371
+ "open",
2372
+ "playsinline",
2373
+ "readonly",
2374
+ "required",
2375
+ "reversed",
2376
+ "seamless",
2377
+ "selected",
2378
+ "webkitdirectory",
2379
+ "defer",
2380
+ "disablepictureinpicture",
2381
+ "disableremoteplayback"
2382
+ ];
2383
+ /**
2384
+ * Returns `true` if `name` is a boolean attribute
2385
+ * @param {string} name
2386
+ */
2387
+ function is_boolean_attribute(name) {
2388
+ return DOM_BOOLEAN_ATTRIBUTES.includes(name);
2389
+ }
2390
+ /**
2391
+ * Subset of delegated events which should be passive by default.
2392
+ * These two are already passive via browser defaults on window, document and body.
2393
+ * But since
2394
+ * - we're delegating them
2395
+ * - they happen often
2396
+ * - they apply to mobile which is generally less performant
2397
+ * we're marking them as passive by default for other elements, too.
2398
+ */
2399
+ var PASSIVE_EVENTS = ["touchstart", "touchmove"];
2400
+ /**
2401
+ * Returns `true` if `name` is a passive event
2402
+ * @param {string} name
2403
+ */
2404
+ function is_passive_event(name) {
2405
+ return PASSIVE_EVENTS.includes(name);
2406
+ }
2407
+ //#endregion
2408
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/escaping.js
2409
+ var ATTR_REGEX = /[&"<]/g;
2410
+ var CONTENT_REGEX = /[&<]/g;
2411
+ /**
2412
+ * @template V
2413
+ * @param {V} value
2414
+ * @param {boolean} [is_attr]
2415
+ */
2416
+ function escape_html(value, is_attr) {
2417
+ const str = String(value ?? "");
2418
+ const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
2419
+ pattern.lastIndex = 0;
2420
+ let escaped = "";
2421
+ let last = 0;
2422
+ while (pattern.test(str)) {
2423
+ const i = pattern.lastIndex - 1;
2424
+ const ch = str[i];
2425
+ escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === "\"" ? "&quot;" : "&lt;");
2426
+ last = i + 1;
2427
+ }
2428
+ return escaped + str.substring(last);
2429
+ }
2430
+ //#endregion
2431
+ //#region node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
2432
+ function r(e) {
2433
+ var t, f, n = "";
2434
+ if ("string" == typeof e || "number" == typeof e) n += e;
2435
+ else if ("object" == typeof e) if (Array.isArray(e)) {
2436
+ var o = e.length;
2437
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
2438
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
2439
+ return n;
2440
+ }
2441
+ function clsx$1() {
2442
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
2443
+ return n;
2444
+ }
2445
+ //#endregion
2446
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/shared/attributes.js
2447
+ /**
2448
+ * `<div translate={false}>` should be rendered as `<div translate="no">` and _not_
2449
+ * `<div translate="false">`, which is equivalent to `<div translate="yes">`. There
2450
+ * may be other odd cases that need to be added to this list in future
2451
+ * @type {Record<string, Map<any, string>>}
2452
+ */
2453
+ var replacements = { translate: /* @__PURE__ */ new Map([[true, "yes"], [false, "no"]]) };
2454
+ /**
2455
+ * @template V
2456
+ * @param {string} name
2457
+ * @param {V} value
2458
+ * @param {boolean} [is_boolean]
2459
+ * @returns {string}
2460
+ */
2461
+ function attr(name, value, is_boolean = false) {
2462
+ if (name === "hidden" && value !== "until-found") is_boolean = true;
2463
+ if (value == null || is_boolean && !value && value !== "") return "";
2464
+ const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
2465
+ return ` ${name}${is_boolean ? `=""` : `="${escape_html(normalized, true)}"`}`;
2466
+ }
2467
+ /**
2468
+ * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.
2469
+ * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)
2470
+ * @param {any} value
2471
+ */
2472
+ function clsx(value) {
2473
+ if (typeof value === "object") return clsx$1(value);
2474
+ else return value ?? "";
2475
+ }
2476
+ var whitespace = [..." \n\r\f\xA0\v"];
2477
+ /**
2478
+ * @param {any} value
2479
+ * @param {string | null} [hash]
2480
+ * @param {Record<string, boolean>} [directives]
2481
+ * @returns {string | null}
2482
+ */
2483
+ function to_class(value, hash, directives) {
2484
+ var classname = value == null ? "" : "" + value;
2485
+ if (hash) classname = classname ? classname + " " + hash : hash;
2486
+ if (directives) {
2487
+ for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key;
2488
+ else if (classname.length) {
2489
+ var len = key.length;
2490
+ var a = 0;
2491
+ while ((a = classname.indexOf(key, a)) >= 0) {
2492
+ var b = a + len;
2493
+ 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);
2494
+ else a = b;
2495
+ }
2496
+ }
2497
+ }
2498
+ return classname === "" ? null : classname;
2499
+ }
2500
+ /**
2501
+ *
2502
+ * @param {Record<string,any>} styles
2503
+ * @param {boolean} important
2504
+ */
2505
+ function append_styles(styles, important = false) {
2506
+ var separator = important ? " !important;" : ";";
2507
+ var css = "";
2508
+ for (var key of Object.keys(styles)) {
2509
+ var value = styles[key];
2510
+ if (value != null && value !== "") css += " " + key + ": " + value + separator;
2511
+ }
2512
+ return css;
2513
+ }
2514
+ /**
2515
+ * @param {string} name
2516
+ * @returns {string}
2517
+ */
2518
+ function to_css_name(name) {
2519
+ if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase();
2520
+ return name;
2521
+ }
2522
+ /**
2523
+ * @param {any} value
2524
+ * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]
2525
+ * @returns {string | null}
2526
+ */
2527
+ function to_style(value, styles) {
2528
+ if (styles) {
2529
+ var new_style = "";
2530
+ /** @type {Record<string,any> | undefined} */
2531
+ var normal_styles;
2532
+ /** @type {Record<string,any> | undefined} */
2533
+ var important_styles;
2534
+ if (Array.isArray(styles)) {
2535
+ normal_styles = styles[0];
2536
+ important_styles = styles[1];
2537
+ } else normal_styles = styles;
2538
+ if (value) {
2539
+ value = String(value).replaceAll(/\/\*.*?\*\//g, "").trim();
2540
+ /** @type {boolean | '"' | "'"} */
2541
+ var in_str = false;
2542
+ var in_apo = 0;
2543
+ var in_comment = false;
2544
+ var reserved_names = [];
2545
+ if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
2546
+ if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name));
2547
+ var start_index = 0;
2548
+ var name_index = -1;
2549
+ const len = value.length;
2550
+ for (var i = 0; i < len; i++) {
2551
+ var c = value[i];
2552
+ if (in_comment) {
2553
+ if (c === "/" && value[i - 1] === "*") in_comment = false;
2554
+ } else if (in_str) {
2555
+ if (in_str === c) in_str = false;
2556
+ } else if (c === "/" && value[i + 1] === "*") in_comment = true;
2557
+ else if (c === "\"" || c === "'") in_str = c;
2558
+ else if (c === "(") in_apo++;
2559
+ else if (c === ")") in_apo--;
2560
+ if (!in_comment && in_str === false && in_apo === 0) {
2561
+ if (c === ":" && name_index === -1) name_index = i;
2562
+ else if (c === ";" || i === len - 1) {
2563
+ if (name_index !== -1) {
2564
+ var name = to_css_name(value.substring(start_index, name_index).trim());
2565
+ if (!reserved_names.includes(name)) {
2566
+ if (c !== ";") i++;
2567
+ var property = value.substring(start_index, i).trim();
2568
+ new_style += " " + property + ";";
2569
+ }
2570
+ }
2571
+ start_index = i + 1;
2572
+ name_index = -1;
2573
+ }
2574
+ }
2575
+ }
2576
+ }
2577
+ if (normal_styles) new_style += append_styles(normal_styles);
2578
+ if (important_styles) new_style += append_styles(important_styles, true);
2579
+ new_style = new_style.trim();
2580
+ return new_style === "" ? null : new_style;
2581
+ }
2582
+ return value == null ? null : String(value);
2583
+ }
2584
+ //#endregion
2585
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/server/hydration.js
2586
+ var BLOCK_OPEN = `<!--[-->`;
2587
+ var BLOCK_CLOSE = `<!--]-->`;
2588
+ var EMPTY_COMMENT = `<!---->`;
2589
+ //#endregion
2590
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/server/context.js
2591
+ /** @import { SSRContext } from '#server' */
2592
+ /** @type {SSRContext | null} */
2593
+ var ssr_context = null;
2594
+ /** @param {SSRContext | null} v */
2595
+ function set_ssr_context(v) {
2596
+ ssr_context = v;
2597
+ }
2598
+ /**
2599
+ * @template T
2600
+ * @returns {[() => T, (context: T) => T, () => boolean]}
2601
+ * @since 5.40.0
2602
+ */
2603
+ function createContext() {
2604
+ return create_context(getContext, setContext, hasContext);
2605
+ }
2606
+ /**
2607
+ * @template T
2608
+ * @param {any} key
2609
+ * @returns {T}
2610
+ */
2611
+ function getContext(key) {
2612
+ return get_or_init_context_map(ssr_context).get(key);
2613
+ }
2614
+ /**
2615
+ * @template T
2616
+ * @param {any} key
2617
+ * @param {T} context
2618
+ * @returns {T}
2619
+ */
2620
+ function setContext(key, context) {
2621
+ get_or_init_context_map(ssr_context).set(key, context);
2622
+ return context;
2623
+ }
2624
+ /**
2625
+ * @param {any} key
2626
+ * @returns {boolean}
2627
+ */
2628
+ function hasContext(key) {
2629
+ return get_or_init_context_map(ssr_context).has(key);
2630
+ }
2631
+ /** @returns {Map<any, any>} */
2632
+ function getAllContexts() {
2633
+ return get_or_init_context_map(ssr_context);
2634
+ }
2635
+ /**
2636
+ * @param {Function} [fn]
2637
+ */
2638
+ function push(fn) {
2639
+ ssr_context = {
2640
+ p: ssr_context,
2641
+ c: null,
2642
+ r: null
2643
+ };
2644
+ }
2645
+ function pop() {
2646
+ ssr_context = ssr_context.p;
2647
+ }
2648
+ /**
2649
+ * Encountered asynchronous work while rendering synchronously.
2650
+ * @returns {never}
2651
+ */
2652
+ function await_invalid() {
2653
+ const error = /* @__PURE__ */ new Error(`await_invalid\nEncountered asynchronous work while rendering synchronously.\nhttps://svelte.dev/e/await_invalid`);
2654
+ error.name = "Svelte error";
2655
+ throw error;
2656
+ }
2657
+ /**
2658
+ * Failed to serialize `hydratable` data for key `%key%`.
2659
+ *
2660
+ * `hydratable` can serialize anything [`uneval` from `devalue`](https://npmjs.com/package/uneval) can, plus Promises.
2661
+ *
2662
+ * Cause:
2663
+ * %stack%
2664
+ * @param {string} key
2665
+ * @param {string} stack
2666
+ * @returns {never}
2667
+ */
2668
+ function hydratable_serialization_failed(key, stack) {
2669
+ const error = /* @__PURE__ */ new Error(`hydratable_serialization_failed\nFailed to serialize \`hydratable\` data for key \`${key}\`.
2670
+
2671
+ \`hydratable\` can serialize anything [\`uneval\` from \`devalue\`](https://npmjs.com/package/uneval) can, plus Promises.
2672
+
2673
+ Cause:
2674
+ ${stack}\nhttps://svelte.dev/e/hydratable_serialization_failed`);
2675
+ error.name = "Svelte error";
2676
+ throw error;
2677
+ }
2678
+ /**
2679
+ * `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
2680
+ * @returns {never}
2681
+ */
2682
+ function invalid_csp() {
2683
+ 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`);
2684
+ error.name = "Svelte error";
2685
+ throw error;
2686
+ }
2687
+ /**
2688
+ * The `idPrefix` option cannot include `--`.
2689
+ * @returns {never}
2690
+ */
2691
+ function invalid_id_prefix() {
2692
+ const error = /* @__PURE__ */ new Error(`invalid_id_prefix\nThe \`idPrefix\` option cannot include \`--\`.\nhttps://svelte.dev/e/invalid_id_prefix`);
2693
+ error.name = "Svelte error";
2694
+ throw error;
2695
+ }
2696
+ /**
2697
+ * `%name%(...)` is not available on the server
2698
+ * @param {string} name
2699
+ * @returns {never}
2700
+ */
2701
+ function lifecycle_function_unavailable(name) {
2702
+ const error = /* @__PURE__ */ new Error(`lifecycle_function_unavailable\n\`${name}(...)\` is not available on the server\nhttps://svelte.dev/e/lifecycle_function_unavailable`);
2703
+ error.name = "Svelte error";
2704
+ throw error;
2705
+ }
2706
+ /**
2707
+ * Could not resolve `render` context.
2708
+ * @returns {never}
2709
+ */
2710
+ function server_context_required() {
2711
+ const error = /* @__PURE__ */ new Error(`server_context_required\nCould not resolve \`render\` context.\nhttps://svelte.dev/e/server_context_required`);
2712
+ error.name = "Svelte error";
2713
+ throw error;
2714
+ }
2715
+ /**
2716
+ * A `hydratable` value with key `%key%` was created, but at least part of it was not used during the render.
2717
+ *
2718
+ * The `hydratable` was initialized in:
2719
+ * %stack%
2720
+ * @param {string} key
2721
+ * @param {string} stack
2722
+ */
2723
+ function unresolved_hydratable(key, stack) {
2724
+ console.warn(`https://svelte.dev/e/unresolved_hydratable`);
2725
+ }
2726
+ /** @returns {RenderContext} */
2727
+ function get_render_context() {
2728
+ const store = als?.getStore();
2729
+ server_context_required();
2730
+ return store;
2731
+ }
2732
+ /** @type {AsyncLocalStorage<RenderContext | null> | null} */
2733
+ var als = null;
2734
+ //#endregion
2735
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/server/crypto.js
2736
+ var text_encoder;
2737
+ var crypto;
2738
+ /** @param {string} module_name */
2739
+ var obfuscated_import = (module_name) => import(
2740
+ /* @vite-ignore */
2741
+ module_name
2742
+ );
2743
+ /** @param {string} data */
2744
+ async function sha256(data) {
2745
+ text_encoder ??= new TextEncoder();
2746
+ crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (await obfuscated_import("node:crypto")).webcrypto;
2747
+ return base64_encode(await crypto.subtle.digest("SHA-256", text_encoder.encode(data)));
2748
+ }
2749
+ /**
2750
+ * @param {Uint8Array} bytes
2751
+ * @returns {string}
2752
+ */
2753
+ function base64_encode(bytes) {
2754
+ if (globalThis.Buffer) return globalThis.Buffer.from(bytes).toString("base64");
2755
+ let binary = "";
2756
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
2757
+ return btoa(binary);
2758
+ }
2759
+ //#endregion
2760
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/server/renderer.js
2761
+ /** @import { Component } from 'svelte' */
2762
+ /** @import { HydratableContext, SSRContext } from './types.js' */
2763
+ /** @import { Csp, RenderOutput, SyncRenderOutput, Sha256Source } from '../../server/public.js' */
2764
+ /** @import { MaybePromise } from '#shared' */
2765
+ /** @typedef {'head' | 'body'} RendererType */
2766
+ /** @typedef {{ [key in RendererType]: string }} AccumulatedContent */
2767
+ /**
2768
+ * @typedef {string | Renderer} RendererItem
2769
+ */
2770
+ /**
2771
+ * Renderers are basically a tree of `string | Renderer`s, where each `Renderer` in the tree represents
2772
+ * work that may or may not have completed. A renderer can be {@link collect}ed to aggregate the
2773
+ * content from itself and all of its children, but this will throw if any of the children are
2774
+ * performing asynchronous work. To asynchronously collect a renderer, just `await` it.
2775
+ *
2776
+ * The `string` values within a renderer are always associated with the {@link type} of that renderer. To switch types,
2777
+ * call {@link child} with a different `type` argument.
2778
+ */
2779
+ var Renderer = class Renderer {
2780
+ /**
2781
+ * The contents of the renderer.
2782
+ * @type {RendererItem[]}
2783
+ */
2784
+ #out = [];
2785
+ /**
2786
+ * Any `onDestroy` callbacks registered during execution of this renderer.
2787
+ * @type {(() => void)[] | undefined}
2788
+ */
2789
+ #on_destroy = void 0;
2790
+ /**
2791
+ * Whether this renderer is a component body.
2792
+ * @type {boolean}
2793
+ */
2794
+ #is_component_body = false;
2795
+ /**
2796
+ * If set, this renderer is an error boundary. When async collection
2797
+ * of the children fails, the failed snippet is rendered instead.
2798
+ * @type {{
2799
+ * failed: (renderer: Renderer, error: unknown, reset: () => void) => void;
2800
+ * transformError: (error: unknown) => unknown;
2801
+ * context: SSRContext | null;
2802
+ * } | null}
2803
+ */
2804
+ #boundary = null;
2805
+ /**
2806
+ * The type of string content that this renderer is accumulating.
2807
+ * @type {RendererType}
2808
+ */
2809
+ type;
2810
+ /** @type {Renderer | undefined} */
2811
+ #parent;
2812
+ /**
2813
+ * Asynchronous work associated with this renderer
2814
+ * @type {Promise<void> | undefined}
2815
+ */
2816
+ promise = void 0;
2817
+ /**
2818
+ * State which is associated with the content tree as a whole.
2819
+ * It will be re-exposed, uncopied, on all children.
2820
+ * @type {SSRState}
2821
+ * @readonly
2822
+ */
2823
+ global;
2824
+ /**
2825
+ * State that is local to the branch it is declared in.
2826
+ * It will be shallow-copied to all children.
2827
+ *
2828
+ * @type {{ select_value: any, multiple: boolean }}
2829
+ */
2830
+ local;
2831
+ /**
2832
+ * @param {SSRState} global
2833
+ * @param {Renderer | undefined} [parent]
2834
+ */
2835
+ constructor(global, parent) {
2836
+ this.#parent = parent;
2837
+ this.global = global;
2838
+ this.local = parent ? { ...parent.local } : {
2839
+ select_value: void 0,
2840
+ multiple: false
2841
+ };
2842
+ this.type = parent ? parent.type : "body";
2843
+ }
2844
+ /**
2845
+ * @param {(renderer: Renderer) => void} fn
2846
+ */
2847
+ head(fn) {
2848
+ const head = new Renderer(this.global, this);
2849
+ head.type = "head";
2850
+ this.#out.push(head);
2851
+ head.child(fn);
2852
+ }
2853
+ /**
2854
+ * @param {Array<Promise<void>>} blockers
2855
+ * @param {(renderer: Renderer) => void} fn
2856
+ */
2857
+ async_block(blockers, fn) {
2858
+ this.#out.push(BLOCK_OPEN);
2859
+ this.async(blockers, fn);
2860
+ this.#out.push(BLOCK_CLOSE);
2861
+ }
2862
+ /**
2863
+ * @param {Array<Promise<void>>} blockers
2864
+ * @param {(renderer: Renderer) => void} fn
2865
+ */
2866
+ async(blockers, fn) {
2867
+ let callback = fn;
2868
+ if (blockers.length > 0) {
2869
+ const context = ssr_context;
2870
+ callback = (renderer) => {
2871
+ return Promise.all(blockers).then(() => {
2872
+ const previous_context = ssr_context;
2873
+ try {
2874
+ set_ssr_context(context);
2875
+ return fn(renderer);
2876
+ } finally {
2877
+ set_ssr_context(previous_context);
2878
+ }
2879
+ });
2880
+ };
2881
+ }
2882
+ this.child(callback);
2883
+ }
2884
+ /**
2885
+ * @param {Array<() => void>} thunks
2886
+ */
2887
+ run(thunks) {
2888
+ const context = ssr_context;
2889
+ let promise = Promise.resolve(thunks[0]());
2890
+ const promises = [promise];
2891
+ for (const fn of thunks.slice(1)) {
2892
+ promise = promise.then(() => {
2893
+ const previous_context = ssr_context;
2894
+ set_ssr_context(context);
2895
+ try {
2896
+ return fn();
2897
+ } finally {
2898
+ set_ssr_context(previous_context);
2899
+ }
2900
+ });
2901
+ promises.push(promise);
2902
+ }
2903
+ promise.catch(noop);
2904
+ this.promise = this.global.track(promise);
2905
+ return promises;
2906
+ }
2907
+ /**
2908
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
2909
+ */
2910
+ child_block(fn) {
2911
+ this.#out.push(BLOCK_OPEN);
2912
+ this.child(fn);
2913
+ this.#out.push(BLOCK_CLOSE);
2914
+ }
2915
+ /**
2916
+ * Create a child renderer. The child renderer inherits the state from the parent,
2917
+ * but has its own content.
2918
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
2919
+ */
2920
+ child(fn) {
2921
+ const child = new Renderer(this.global, this);
2922
+ this.#out.push(child);
2923
+ const parent = ssr_context;
2924
+ set_ssr_context({
2925
+ ...ssr_context,
2926
+ p: parent,
2927
+ c: null,
2928
+ r: child
2929
+ });
2930
+ const result = fn(child);
2931
+ set_ssr_context(parent);
2932
+ if (result instanceof Promise) {
2933
+ result.catch(noop);
2934
+ result.finally(() => set_ssr_context(null)).catch(noop);
2935
+ if (child.global.mode === "sync") await_invalid();
2936
+ child.promise = child.global.track(result);
2937
+ }
2938
+ return child;
2939
+ }
2940
+ /**
2941
+ * Render children inside an error boundary. If the children throw and the API-level
2942
+ * `transformError` transform handles the error (doesn't re-throw), the `failed` snippet is
2943
+ * rendered instead. Otherwise the error propagates.
2944
+ *
2945
+ * @param {{ failed?: (renderer: Renderer, error: unknown, reset: () => void) => void }} props
2946
+ * @param {(renderer: Renderer) => MaybePromise<void>} children_fn
2947
+ */
2948
+ boundary(props, children_fn) {
2949
+ const child = new Renderer(this.global, this);
2950
+ this.#out.push(child);
2951
+ const parent_context = ssr_context;
2952
+ if (props.failed) child.#boundary = {
2953
+ failed: props.failed,
2954
+ transformError: this.global.transformError,
2955
+ context: parent_context
2956
+ };
2957
+ set_ssr_context({
2958
+ ...ssr_context,
2959
+ p: parent_context,
2960
+ c: null,
2961
+ r: child
2962
+ });
2963
+ try {
2964
+ const result = children_fn(child);
2965
+ set_ssr_context(parent_context);
2966
+ if (result instanceof Promise) {
2967
+ if (child.global.mode === "sync") await_invalid();
2968
+ result.catch(noop);
2969
+ child.promise = child.global.track(result);
2970
+ }
2971
+ } catch (error) {
2972
+ set_ssr_context(parent_context);
2973
+ const failed_snippet = props.failed;
2974
+ if (!failed_snippet) throw error;
2975
+ const result = this.global.transformError(error);
2976
+ child.#out.length = 0;
2977
+ child.#boundary = null;
2978
+ if (result instanceof Promise) {
2979
+ if (this.global.mode === "sync") await_invalid();
2980
+ child.promise = child.global.track(
2981
+ /** @type {Promise<unknown>} */
2982
+ result.then((transformed) => {
2983
+ set_ssr_context(parent_context);
2984
+ child.#out.push(Renderer.#serialize_failed_boundary(transformed));
2985
+ failed_snippet(child, transformed, noop);
2986
+ child.#out.push(BLOCK_CLOSE);
2987
+ })
2988
+ );
2989
+ child.promise.catch(noop);
2990
+ } else {
2991
+ child.#out.push(Renderer.#serialize_failed_boundary(result));
2992
+ failed_snippet(child, result, noop);
2993
+ child.#out.push(BLOCK_CLOSE);
2994
+ }
2995
+ }
2996
+ }
2997
+ /**
2998
+ * Create a component renderer. The component renderer inherits the state from the parent,
2999
+ * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
3000
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
3001
+ * @param {Function} [component_fn]
3002
+ * @returns {void}
3003
+ */
3004
+ component(fn, component_fn) {
3005
+ push();
3006
+ this.child((renderer) => {
3007
+ renderer.#is_component_body = true;
3008
+ return fn(renderer);
3009
+ });
3010
+ pop();
3011
+ }
3012
+ /**
3013
+ * @param {Record<string, any>} attrs
3014
+ * @param {(renderer: Renderer) => void} fn
3015
+ * @param {string | undefined} [css_hash]
3016
+ * @param {Record<string, boolean> | undefined} [classes]
3017
+ * @param {Record<string, string> | undefined} [styles]
3018
+ * @param {number | undefined} [flags]
3019
+ * @param {boolean | undefined} [is_rich]
3020
+ * @returns {void}
3021
+ */
3022
+ select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
3023
+ const { value, defaultValue, ...select_attrs } = attrs;
3024
+ if (select_attrs.multiple === "") select_attrs.multiple = true;
3025
+ this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
3026
+ this.child((renderer) => {
3027
+ renderer.local.select_value = value === void 0 ? defaultValue : value;
3028
+ renderer.local.multiple = !!select_attrs.multiple;
3029
+ fn(renderer);
3030
+ });
3031
+ this.push(`${is_rich ? "<!>" : ""}</select>`);
3032
+ }
3033
+ /**
3034
+ * @param {Record<string, any>} attrs
3035
+ * @param {string | number | boolean | ((renderer: Renderer) => void)} body
3036
+ * @param {string | undefined} [css_hash]
3037
+ * @param {Record<string, boolean> | undefined} [classes]
3038
+ * @param {Record<string, string> | undefined} [styles]
3039
+ * @param {number | undefined} [flags]
3040
+ * @param {boolean | undefined} [is_rich]
3041
+ */
3042
+ option(attrs, body, css_hash, classes, styles, flags, is_rich) {
3043
+ this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
3044
+ /**
3045
+ * @param {Renderer} renderer
3046
+ * @param {any} value
3047
+ * @param {{ head?: string, body: any }} content
3048
+ */
3049
+ const close = (renderer, value, { head, body }) => {
3050
+ if (has_own_property.call(attrs, "value")) value = attrs.value;
3051
+ var select_value = this.local.select_value;
3052
+ if (this.local.multiple && is_array(select_value) ? select_value.includes(value) : value === select_value) renderer.#out.push(" selected=\"\"");
3053
+ renderer.#out.push(`>${body}${is_rich ? "<!>" : ""}</option>`);
3054
+ if (head) renderer.head((child) => child.push(head));
3055
+ };
3056
+ if (typeof body === "function") this.child((renderer) => {
3057
+ const r = new Renderer(this.global, this);
3058
+ body(r);
3059
+ if (this.global.mode === "async") return r.#collect_content_async().then((content) => {
3060
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
3061
+ });
3062
+ else {
3063
+ const content = r.#collect_content();
3064
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
3065
+ }
3066
+ });
3067
+ else close(this, body, { body: escape_html(body) });
3068
+ }
3069
+ /**
3070
+ * @param {(renderer: Renderer) => void} fn
3071
+ */
3072
+ title(fn) {
3073
+ const path = this.get_path();
3074
+ /** @param {string} head */
3075
+ const close = (head) => {
3076
+ this.global.set_title(head, path);
3077
+ };
3078
+ this.child((renderer) => {
3079
+ const r = new Renderer(renderer.global, renderer);
3080
+ fn(r);
3081
+ if (renderer.global.mode === "async") return r.#collect_content_async().then((content) => {
3082
+ close(content.head);
3083
+ });
3084
+ else {
3085
+ const content = r.#collect_content();
3086
+ close(content.head);
3087
+ }
3088
+ });
3089
+ }
3090
+ /**
3091
+ * @param {string | (() => Promise<string>)} content
3092
+ */
3093
+ push(content) {
3094
+ if (typeof content === "function") this.child(async (renderer) => renderer.push(await content()));
3095
+ else this.#out.push(content);
3096
+ }
3097
+ /**
3098
+ * @param {() => void} fn
3099
+ */
3100
+ on_destroy(fn) {
3101
+ (this.#on_destroy ??= []).push(fn);
3102
+ }
3103
+ /**
3104
+ * @returns {number[]}
3105
+ */
3106
+ get_path() {
3107
+ return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
3108
+ }
3109
+ /**
3110
+ * @deprecated this is needed for legacy component bindings
3111
+ */
3112
+ copy() {
3113
+ const copy = new Renderer(this.global, this.#parent);
3114
+ copy.type = this.type;
3115
+ copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
3116
+ copy.promise = this.promise;
3117
+ return copy;
3118
+ }
3119
+ /**
3120
+ * @param {Renderer} other
3121
+ * @deprecated this is needed for legacy component bindings
3122
+ */
3123
+ subsume(other) {
3124
+ 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!");
3125
+ this.local = other.local;
3126
+ this.#out = other.#out.map((item, i) => {
3127
+ const current = this.#out[i];
3128
+ if (current instanceof Renderer && item instanceof Renderer) {
3129
+ current.subsume(item);
3130
+ return current;
3131
+ }
3132
+ return item;
3133
+ });
3134
+ this.promise = other.promise;
3135
+ this.type = other.type;
3136
+ }
3137
+ get length() {
3138
+ return this.#out.length;
3139
+ }
3140
+ /**
3141
+ * Creates the hydration comment that marks the start of a failed boundary.
3142
+ * The error is JSON-serialized and embedded inside an HTML comment for the client
3143
+ * to parse during hydration. The JSON is escaped to prevent `-->` or `<!--` sequences
3144
+ * from breaking out of the comment (XSS). Uses unicode escapes which `JSON.parse()`
3145
+ * handles transparently.
3146
+ * @param {unknown} error
3147
+ * @returns {string}
3148
+ */
3149
+ static #serialize_failed_boundary(error) {
3150
+ return `<!--[?${JSON.stringify(error).replace(/>/g, "\\u003e").replace(/</g, "\\u003c")}-->`;
3151
+ }
3152
+ /**
3153
+ * Only available on the server and when compiling with the `server` option.
3154
+ * 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.
3155
+ * @template {Record<string, any>} Props
3156
+ * @param {Component<Props>} component
3157
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} [options]
3158
+ * @returns {RenderOutput}
3159
+ */
3160
+ static render(component, options = {}) {
3161
+ /** @type {AccumulatedContent | undefined} */
3162
+ let sync;
3163
+ const result = {};
3164
+ Object.defineProperties(result, {
3165
+ html: { get: () => {
3166
+ return (sync ??= Renderer.#render(component, options)).body;
3167
+ } },
3168
+ head: { get: () => {
3169
+ return (sync ??= Renderer.#render(component, options)).head;
3170
+ } },
3171
+ body: { get: () => {
3172
+ return (sync ??= Renderer.#render(component, options)).body;
3173
+ } },
3174
+ hashes: { value: { script: "" } },
3175
+ then: { value:
3176
+ /**
3177
+ * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
3178
+ *
3179
+ * @template TResult1
3180
+ * @template [TResult2=never]
3181
+ * @param { (value: SyncRenderOutput) => TResult1 } onfulfilled
3182
+ * @param { (reason: unknown) => TResult2 } onrejected
3183
+ */
3184
+ (onfulfilled, onrejected) => {
3185
+ {
3186
+ const result = sync ??= Renderer.#render(component, options);
3187
+ const user_result = onfulfilled({
3188
+ head: result.head,
3189
+ body: result.body,
3190
+ html: result.body,
3191
+ hashes: { script: [] }
3192
+ });
3193
+ return Promise.resolve(user_result);
3194
+ }
3195
+ } }
3196
+ });
3197
+ return result;
3198
+ }
3199
+ /**
3200
+ * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
3201
+ * after awaiting `collect_async`.
3202
+ *
3203
+ * Child renderers are "porous" and don't affect execution order, but component body renderers
3204
+ * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
3205
+ * @returns {Iterable<() => void>}
3206
+ */
3207
+ *#collect_on_destroy() {
3208
+ for (const component of this.#traverse_components()) yield* component.#collect_ondestroy();
3209
+ }
3210
+ /**
3211
+ * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
3212
+ * @returns {Iterable<Renderer>}
3213
+ */
3214
+ *#traverse_components() {
3215
+ for (const child of this.#out) if (typeof child !== "string") yield* child.#traverse_components();
3216
+ if (this.#is_component_body) yield this;
3217
+ }
3218
+ /**
3219
+ * @returns {Iterable<() => void>}
3220
+ */
3221
+ *#collect_ondestroy() {
3222
+ if (this.#on_destroy) for (const fn of this.#on_destroy) yield fn;
3223
+ for (const child of this.#out) if (child instanceof Renderer && !child.#is_component_body) yield* child.#collect_ondestroy();
3224
+ }
3225
+ /**
3226
+ * Runs every `onDestroy` callback in this renderer tree. On a failed render,
3227
+ * cleanup errors are suppressed so they do not mask the render error.
3228
+ * @param {boolean} suppress_errors
3229
+ */
3230
+ #run_on_destroy(suppress_errors) {
3231
+ let first_error;
3232
+ let has_error = false;
3233
+ for (const cleanup of this.#collect_on_destroy()) try {
3234
+ cleanup();
3235
+ } catch (error) {
3236
+ if (!suppress_errors && !has_error) {
3237
+ first_error = error;
3238
+ has_error = true;
3239
+ }
3240
+ }
3241
+ if (has_error) throw first_error;
3242
+ }
3243
+ /**
3244
+ * @param {'sync' | 'async'} mode
3245
+ * @param {{ idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
3246
+ * @returns {Renderer}
3247
+ */
3248
+ static #create(mode, options) {
3249
+ if (options.idPrefix?.includes("--")) invalid_id_prefix();
3250
+ return new Renderer(new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp, options.transformError));
3251
+ }
3252
+ /**
3253
+ * Render a component. Throws if any of the children are performing asynchronous work.
3254
+ *
3255
+ * @template {Record<string, any>} Props
3256
+ * @param {Component<Props>} component
3257
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
3258
+ * @returns {AccumulatedContent}
3259
+ */
3260
+ static #render(component, options) {
3261
+ var previous_context = ssr_context;
3262
+ const renderer = Renderer.#create("sync", options);
3263
+ /** @type {AccumulatedContent | undefined} */
3264
+ let result;
3265
+ let render_error;
3266
+ let failed = false;
3267
+ try {
3268
+ try {
3269
+ Renderer.#open_render(renderer, component, options);
3270
+ result = Renderer.#close_render(renderer.#collect_content(), renderer);
3271
+ } catch (error) {
3272
+ render_error = error;
3273
+ failed = true;
3274
+ }
3275
+ renderer.#run_on_destroy(failed);
3276
+ if (failed) throw render_error;
3277
+ return result;
3278
+ } finally {
3279
+ renderer.global.abort();
3280
+ set_ssr_context(previous_context);
3281
+ }
3282
+ }
3283
+ /**
3284
+ * Render a component.
3285
+ *
3286
+ * @template {Record<string, any>} Props
3287
+ * @param {Component<Props>} component
3288
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
3289
+ * @returns {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>}
3290
+ */
3291
+ static async #render_async(component, options) {
3292
+ const previous_context = ssr_context;
3293
+ const renderer = Renderer.#create("async", options);
3294
+ /** @type {(AccumulatedContent & { hashes: { script: Sha256Source[] } }) | undefined} */
3295
+ let result;
3296
+ let render_error;
3297
+ let failed = false;
3298
+ try {
3299
+ try {
3300
+ Renderer.#open_render(renderer, component, options);
3301
+ const content = await renderer.#collect_content_async();
3302
+ const hydratables = await renderer.#collect_hydratables();
3303
+ if (hydratables !== null) content.head = hydratables + content.head;
3304
+ result = Renderer.#close_render(content, renderer);
3305
+ } catch (error) {
3306
+ render_error = error;
3307
+ failed = true;
3308
+ renderer.global.abort();
3309
+ await renderer.global.settle();
3310
+ }
3311
+ renderer.#run_on_destroy(failed);
3312
+ if (failed) throw render_error;
3313
+ return result;
3314
+ } finally {
3315
+ set_ssr_context(previous_context);
3316
+ renderer.global.abort();
3317
+ }
3318
+ }
3319
+ /**
3320
+ * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
3321
+ * @param {AccumulatedContent} content
3322
+ * @returns {AccumulatedContent}
3323
+ */
3324
+ #collect_content(content = {
3325
+ head: "",
3326
+ body: ""
3327
+ }) {
3328
+ for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
3329
+ else if (item instanceof Renderer) item.#collect_content(content);
3330
+ return content;
3331
+ }
3332
+ /**
3333
+ * Collect all of the code from the `out` array and return it as a string.
3334
+ * @param {AccumulatedContent} content
3335
+ * @returns {Promise<AccumulatedContent>}
3336
+ */
3337
+ async #collect_content_async(content = {
3338
+ head: "",
3339
+ body: ""
3340
+ }) {
3341
+ await this.promise;
3342
+ for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
3343
+ else if (item instanceof Renderer) {
3344
+ if (item.#boundary) {
3345
+ /** @type {AccumulatedContent} */
3346
+ const boundary_content = {
3347
+ head: "",
3348
+ body: ""
3349
+ };
3350
+ try {
3351
+ await item.#collect_content_async(boundary_content);
3352
+ content.head += boundary_content.head;
3353
+ content.body += boundary_content.body;
3354
+ } catch (error) {
3355
+ const { context, failed, transformError } = item.#boundary;
3356
+ set_ssr_context(context);
3357
+ let promise = transformError(error);
3358
+ set_ssr_context(null);
3359
+ let transformed = await promise;
3360
+ set_ssr_context(context);
3361
+ const failed_renderer = new Renderer(item.global, item);
3362
+ failed_renderer.type = item.type;
3363
+ failed_renderer.#out.push(Renderer.#serialize_failed_boundary(transformed));
3364
+ failed(failed_renderer, transformed, noop);
3365
+ failed_renderer.#out.push(BLOCK_CLOSE);
3366
+ await failed_renderer.#collect_content_async(content);
3367
+ }
3368
+ } else await item.#collect_content_async(content);
3369
+ }
3370
+ return content;
3371
+ }
3372
+ async #collect_hydratables() {
3373
+ const ctx = get_render_context().hydratable;
3374
+ for (const [_, key] of ctx.unresolved_promises) unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
3375
+ for (const comparison of ctx.comparisons) await comparison;
3376
+ return await this.#hydratable_block(ctx);
3377
+ }
3378
+ /**
3379
+ * @template {Record<string, any>} Props
3380
+ * @param {Renderer} renderer
3381
+ * @param {import('svelte').Component<Props>} component
3382
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
3383
+ * @returns {void}
3384
+ */
3385
+ static #open_render(renderer, component, options) {
3386
+ var previous_context = ssr_context;
3387
+ try {
3388
+ set_ssr_context({
3389
+ p: null,
3390
+ c: options.context ?? null,
3391
+ r: renderer
3392
+ });
3393
+ renderer.push(BLOCK_OPEN);
3394
+ component(renderer, options.props ?? {});
3395
+ renderer.push(BLOCK_CLOSE);
3396
+ } finally {
3397
+ set_ssr_context(previous_context);
3398
+ }
3399
+ }
3400
+ /**
3401
+ * @param {AccumulatedContent} content
3402
+ * @param {Renderer} renderer
3403
+ * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
3404
+ */
3405
+ static #close_render(content, renderer) {
3406
+ let head = content.head + renderer.global.get_title();
3407
+ let body = content.body;
3408
+ for (const { hash, code } of renderer.global.css) head += `<style id="${hash}">${code}</style>`;
3409
+ return {
3410
+ head,
3411
+ body,
3412
+ hashes: { script: renderer.global.csp.script_hashes }
3413
+ };
3414
+ }
3415
+ /**
3416
+ * @param {HydratableContext} ctx
3417
+ */
3418
+ async #hydratable_block(ctx) {
3419
+ if (ctx.lookup.size === 0) return null;
3420
+ let entries = [];
3421
+ let has_promises = false;
3422
+ for (const [k, v] of ctx.lookup) {
3423
+ if (v.promises) {
3424
+ has_promises = true;
3425
+ for (const p of v.promises) await p;
3426
+ }
3427
+ entries.push(`[${uneval(k)},${v.serialized}]`);
3428
+ }
3429
+ let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
3430
+ if (has_promises) prelude = `const r = (v) => Promise.resolve(v);
3431
+ ${prelude}`;
3432
+ const body = `
3433
+ {
3434
+ ${prelude}
3435
+
3436
+ for (const [k, v] of [
3437
+ ${entries.join(",\n ")}
3438
+ ]) {
3439
+ h.set(k, v);
3440
+ }
3441
+ }
3442
+ `;
3443
+ let csp_attr = "";
3444
+ if (this.global.csp.nonce) csp_attr = ` nonce="${this.global.csp.nonce}"`;
3445
+ else if (this.global.csp.hash) {
3446
+ const hash = await sha256(body);
3447
+ this.global.csp.script_hashes.push(`sha256-${hash}`);
3448
+ }
3449
+ return `\n\t\t<script${csp_attr}>${body}<\/script>`;
3450
+ }
3451
+ };
3452
+ var SSRState = class {
3453
+ /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */
3454
+ csp;
3455
+ /** @readonly @type {'sync' | 'async'} */
3456
+ mode;
3457
+ /** @readonly @type {() => string} */
3458
+ uid;
3459
+ /** @readonly @type {Set<{ hash: string; code: string }>} */
3460
+ css = /* @__PURE__ */ new Set();
3461
+ /** @type {Set<Promise<unknown>>} */
3462
+ #pending = /* @__PURE__ */ new Set();
3463
+ /** @type {AbortController | null} */
3464
+ #controller = null;
3465
+ #aborted = false;
3466
+ /**
3467
+ * `transformError` passed to `render`. Called when an error boundary catches an error.
3468
+ * Throws by default if unset in `render`.
3469
+ * @type {(error: unknown) => unknown}
3470
+ */
3471
+ transformError;
3472
+ /** @type {{ path: number[], value: string }} */
3473
+ #title = {
3474
+ path: [],
3475
+ value: ""
3476
+ };
3477
+ /**
3478
+ * @param {'sync' | 'async'} mode
3479
+ * @param {string} id_prefix
3480
+ * @param {Csp} csp
3481
+ * @param {((error: unknown) => unknown) | undefined} [transformError]
3482
+ */
3483
+ constructor(mode, id_prefix = "", csp = { hash: false }, transformError) {
3484
+ this.mode = mode;
3485
+ this.csp = {
3486
+ ...csp,
3487
+ script_hashes: []
3488
+ };
3489
+ this.transformError = transformError ?? ((error) => {
3490
+ throw error;
3491
+ });
3492
+ let uid = 1;
3493
+ this.uid = () => `${id_prefix}s${uid++}`;
3494
+ }
3495
+ /**
3496
+ * @template T
3497
+ * @param {Promise<T>} promise
3498
+ * @returns {Promise<T>}
3499
+ */
3500
+ track(promise) {
3501
+ this.#pending.add(promise);
3502
+ promise.then(() => this.#pending.delete(promise), () => this.#pending.delete(promise));
3503
+ return promise;
3504
+ }
3505
+ async settle() {
3506
+ while (this.#pending.size > 0) await Promise.allSettled([...this.#pending]);
3507
+ }
3508
+ abort() {
3509
+ if (this.#aborted) return;
3510
+ this.#aborted = true;
3511
+ this.#controller?.abort(STALE_REACTION);
3512
+ }
3513
+ get_abort_signal() {
3514
+ const controller = this.#controller ??= new AbortController();
3515
+ if (this.#aborted) controller.abort(STALE_REACTION);
3516
+ return controller.signal;
3517
+ }
3518
+ get_title() {
3519
+ return this.#title.value;
3520
+ }
3521
+ /**
3522
+ * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
3523
+ * from earlier than or equal to the current value.
3524
+ * @param {string} value
3525
+ * @param {number[]} path
3526
+ */
3527
+ set_title(value, path) {
3528
+ const current = this.#title.path;
3529
+ let i = 0;
3530
+ let l = Math.min(path.length, current.length);
3531
+ while (i < l && path[i] === current[i]) i += 1;
3532
+ if (path[i] === void 0) return;
3533
+ if (current[i] === void 0 || path[i] > current[i]) {
3534
+ this.#title.path = path;
3535
+ this.#title.value = value;
3536
+ }
3537
+ }
3538
+ };
3539
+ //#endregion
3540
+ //#region node_modules/.pnpm/svelte@5.57.0/node_modules/svelte/src/internal/server/index.js
3541
+ 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;
3542
+ /**
3543
+ * Only available on the server and when compiling with the `server` option.
3544
+ * 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.
3545
+ * @template {Record<string, any>} Props
3546
+ * @param {Component<Props> | ComponentType<SvelteComponent<Props>>} component
3547
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} [options]
3548
+ * @returns {RenderOutput}
3549
+ */
3550
+ function render(component, options = {}) {
3551
+ if (options.csp?.hash && options.csp.nonce) invalid_csp();
3552
+ return Renderer.render(component, options);
3553
+ }
3554
+ /**
3555
+ * @param {string} hash
3556
+ * @param {Renderer} renderer
3557
+ * @param {(renderer: Renderer) => Promise<void> | void} fn
3558
+ * @returns {void}
3559
+ */
3560
+ function head(hash, renderer, fn) {
3561
+ renderer.head((renderer) => {
3562
+ renderer.push(`<!--${hash}-->`);
3563
+ renderer.child(fn);
3564
+ renderer.push(EMPTY_COMMENT);
3565
+ });
3566
+ }
3567
+ /**
3568
+ * @param {Record<string, unknown>} attrs
3569
+ * @param {string} [css_hash]
3570
+ * @param {Record<string, boolean>} [classes]
3571
+ * @param {Record<string, string>} [styles]
3572
+ * @param {number} [flags]
3573
+ * @returns {string}
3574
+ */
3575
+ function attributes(attrs, css_hash, classes, styles, flags = 0) {
3576
+ if (styles) attrs.style = to_style(attrs.style, styles);
3577
+ if (attrs.class) attrs.class = clsx(attrs.class);
3578
+ if (css_hash || classes) attrs.class = to_class(attrs.class, css_hash, classes);
3579
+ let attr_str = "";
3580
+ let name;
3581
+ const is_html = (flags & 1) === 0;
3582
+ const lowercase = (flags & 2) === 0;
3583
+ const is_input = (flags & 4) !== 0;
3584
+ for (name of Object.keys(attrs)) {
3585
+ if (typeof attrs[name] === "function") continue;
3586
+ if (name[0] === "$" && name[1] === "$") continue;
3587
+ if (name === "" || INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
3588
+ var value = attrs[name];
3589
+ var lower = name.toLowerCase();
3590
+ if (lowercase) name = lower;
3591
+ if (lower.length > 2 && lower.startsWith("on")) continue;
3592
+ if (is_input) {
3593
+ if (name === "defaultvalue" || name === "defaultchecked") {
3594
+ name = name === "defaultvalue" ? "value" : "checked";
3595
+ if (attrs[name]) continue;
3596
+ }
3597
+ }
3598
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
3599
+ }
3600
+ return attr_str;
3601
+ }
3602
+ /**
3603
+ * @param {unknown} value
3604
+ * @returns {string}
3605
+ */
3606
+ function stringify(value) {
3607
+ return typeof value === "string" ? value : value == null ? "" : value + "";
3608
+ }
3609
+ /**
3610
+ * @param {any} value
3611
+ * @param {string | undefined} [hash]
3612
+ * @param {Record<string, boolean>} [directives]
3613
+ */
3614
+ function attr_class(value, hash, directives) {
3615
+ var result = to_class(value, hash, directives);
3616
+ return result ? ` class="${escape_html(result, true)}"` : "";
3617
+ }
3618
+ /**
3619
+ * @param {any} value
3620
+ * @param {Record<string,any>|[Record<string,any>,Record<string,any>]} [directives]
3621
+ */
3622
+ function attr_style(value, directives) {
3623
+ var result = to_style(value, directives);
3624
+ return result ? ` style="${escape_html(result, true)}"` : "";
3625
+ }
3626
+ /** @param {any} array_like_or_iterator */
3627
+ function ensure_array_like(array_like_or_iterator) {
3628
+ if (array_like_or_iterator) return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
3629
+ return [];
3630
+ }
3631
+ /**
3632
+ * @template V
3633
+ * @param {() => V} get_value
3634
+ */
3635
+ function once(get_value) {
3636
+ let value = UNINITIALIZED;
3637
+ return () => {
3638
+ if (value === UNINITIALIZED) value = get_value();
3639
+ return value;
3640
+ };
3641
+ }
3642
+ /**
3643
+ * @template T
3644
+ * @param {()=>T} fn
3645
+ * @returns {(new_value?: T) => (T | void)}
3646
+ */
3647
+ function derived(fn) {
3648
+ const get_value = ssr_context === null ? fn : once(fn);
3649
+ /** @type {T | undefined} */
3650
+ let updated_value;
3651
+ return function(new_value) {
3652
+ if (arguments.length === 0) return updated_value ?? get_value();
3653
+ updated_value = new_value;
3654
+ return updated_value;
3655
+ };
3656
+ }
3657
+
3658
+ export { pop$1 as $, queue_micro_task as A, invoke_error_boundary as B, current_batch as C, pause_effect as D, move_effect as E, defer_effect as F, set_component_context as G, HYDRATION_ERROR as H, Batch as I, component_context as J, internal_set as K, LEGACY_PROPS as L, destroy_effect as M, next as N, skip_nodes as O, derived as P, effect_tracking as Q, render_effect as R, svelte_boundary_reset_noop as S, svelte_boundary_reset_onerror as T, source as U, untrack as V, increment as W, hydrate_next as X, push$1 as Y, mark_as_component as Z, hydration_mismatch as _, get_first_child as a, run as a0, noop as a1, hasContext as a2, getContext as a3, getAllContexts as a4, createContext as a5, ssr_context as a6, lifecycle_function_unavailable as a7, EFFECT_TRANSPARENT as a8, EFFECT_PRESERVED as a9, experimental_async_required as aa, get_render_context as ab, hydratable_serialization_failed as ac, writable as ad, readable as ae, head as af, attr as ag, escape_html as ah, attr_style as ai, attr_class as aj, ensure_array_like as ak, stringify as al, clsx as am, get_next_sibling as b, set_hydrating as c, define_property as d, set_hydrate_node as e, flushSync as f, get as g, hydration_failed as h, init_operations as i, clear_text_content as j, component_root as k, hydrate_node as l, mutable_source as m, create_text as n, array_from as o, is_passive_event as p, set_active_reaction as q, render as r, set as s, set_active_effect as t, active_reaction as u, active_effect as v, setContext as w, hydrating as x, block as y, branch as z };
3659
+ //# sourceMappingURL=server.js-ByNB8uti.js.map