@pie-element/mc-populated-blank 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.
@@ -0,0 +1,4952 @@
1
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/disclose-version.js
2
+ if (typeof window !== "undefined") {
3
+ var _window$__svelte, _window;
4
+ ((_window$__svelte = (_window = window).__svelte ?? (_window.__svelte = {})).v ?? (_window$__svelte.v = /* @__PURE__ */ new Set())).add("5");
5
+ }
6
+ //#endregion
7
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/constants.js
8
+ var HYDRATION_ERROR = {};
9
+ var UNINITIALIZED = Symbol();
10
+ var NAMESPACE_SVG = "http://www.w3.org/2000/svg";
11
+ var NAMESPACE_MATHML = "http://www.w3.org/1998/Math/MathML";
12
+ //#endregion
13
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/shared/utils.js
14
+ var is_array = Array.isArray;
15
+ var index_of = Array.prototype.indexOf;
16
+ var includes = Array.prototype.includes;
17
+ var array_from = Array.from;
18
+ var object_keys = Object.keys;
19
+ var define_property = Object.defineProperty;
20
+ var get_descriptor = Object.getOwnPropertyDescriptor;
21
+ var get_descriptors = Object.getOwnPropertyDescriptors;
22
+ var object_prototype = Object.prototype;
23
+ var array_prototype = Array.prototype;
24
+ var get_prototype_of = Object.getPrototypeOf;
25
+ var is_extensible = Object.isExtensible;
26
+ var noop = () => {};
27
+ /** @param {Array<() => void>} arr */
28
+ function run_all(arr) {
29
+ for (var i = 0; i < arr.length; i++) arr[i]();
30
+ }
31
+ /**
32
+ * TODO replace with Promise.withResolvers once supported widely enough
33
+ * @template [T=void]
34
+ */
35
+ function deferred() {
36
+ /** @type {(value: T) => void} */
37
+ var resolve;
38
+ /** @type {(reason: any) => void} */
39
+ var reject;
40
+ return {
41
+ promise: new Promise((res, rej) => {
42
+ resolve = res;
43
+ reject = rej;
44
+ }),
45
+ resolve,
46
+ reject
47
+ };
48
+ }
49
+ //#endregion
50
+ //#region \0@oxc-project+runtime@0.120.0/helpers/typeof.js
51
+ function _typeof(o) {
52
+ "@babel/helpers - typeof";
53
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
54
+ return typeof o;
55
+ } : function(o) {
56
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
57
+ }, _typeof(o);
58
+ }
59
+ //#endregion
60
+ //#region \0@oxc-project+runtime@0.120.0/helpers/toPrimitive.js
61
+ function toPrimitive(t, r) {
62
+ if ("object" != _typeof(t) || !t) return t;
63
+ var e = t[Symbol.toPrimitive];
64
+ if (void 0 !== e) {
65
+ var i = e.call(t, r || "default");
66
+ if ("object" != _typeof(i)) return i;
67
+ throw new TypeError("@@toPrimitive must return a primitive value.");
68
+ }
69
+ return ("string" === r ? String : Number)(t);
70
+ }
71
+ //#endregion
72
+ //#region \0@oxc-project+runtime@0.120.0/helpers/toPropertyKey.js
73
+ function toPropertyKey(t) {
74
+ var i = toPrimitive(t, "string");
75
+ return "symbol" == _typeof(i) ? i : i + "";
76
+ }
77
+ //#endregion
78
+ //#region \0@oxc-project+runtime@0.120.0/helpers/defineProperty.js
79
+ function _defineProperty(e, r, t) {
80
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
81
+ value: t,
82
+ enumerable: !0,
83
+ configurable: !0,
84
+ writable: !0
85
+ }) : e[r] = t, e;
86
+ }
87
+ var CLEAN = 1024;
88
+ var DIRTY = 2048;
89
+ var MAYBE_DIRTY = 4096;
90
+ var INERT = 8192;
91
+ var DESTROYED = 16384;
92
+ /** Set once a reaction has run for the first time */
93
+ var REACTION_RAN = 32768;
94
+ /** Effect is in the process of getting destroyed. Can be observed in child teardown functions */
95
+ var DESTROYING = 1 << 25;
96
+ /**
97
+ * 'Transparent' effects do not create a transition boundary.
98
+ * 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
99
+ */
100
+ var EFFECT_TRANSPARENT = 65536;
101
+ var EFFECT_PRESERVED = 1 << 19;
102
+ var USER_EFFECT = 1 << 20;
103
+ var EFFECT_OFFSCREEN = 1 << 25;
104
+ /**
105
+ * Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
106
+ * Will be lifted during execution of the derived and during checking its dirty state (both are necessary
107
+ * because a derived might be checked but not executed).
108
+ */
109
+ var WAS_MARKED = 65536;
110
+ var REACTION_IS_UPDATING = 1 << 21;
111
+ var ASYNC = 1 << 22;
112
+ var ERROR_VALUE = 1 << 23;
113
+ var STATE_SYMBOL = Symbol("$state");
114
+ var LEGACY_PROPS = Symbol("legacy props");
115
+ var LOADING_ATTR_SYMBOL = Symbol("");
116
+ /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
117
+ var STALE_REACTION = new class StaleReactionError extends Error {
118
+ constructor(..._args) {
119
+ super(..._args);
120
+ _defineProperty(this, "name", "StaleReactionError");
121
+ _defineProperty(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
122
+ }
123
+ }();
124
+ var IS_XHTML = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
125
+ //#endregion
126
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/errors.js
127
+ /**
128
+ * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
129
+ * @returns {never}
130
+ */
131
+ function async_derived_orphan() {
132
+ throw new Error(`https://svelte.dev/e/async_derived_orphan`);
133
+ }
134
+ /**
135
+ * Keyed each block has duplicate key `%value%` at indexes %a% and %b%
136
+ * @param {string} a
137
+ * @param {string} b
138
+ * @param {string | undefined | null} [value]
139
+ * @returns {never}
140
+ */
141
+ function each_key_duplicate(a, b, value) {
142
+ throw new Error(`https://svelte.dev/e/each_key_duplicate`);
143
+ }
144
+ /**
145
+ * `%rune%` cannot be used inside an effect cleanup function
146
+ * @param {string} rune
147
+ * @returns {never}
148
+ */
149
+ function effect_in_teardown(rune) {
150
+ throw new Error(`https://svelte.dev/e/effect_in_teardown`);
151
+ }
152
+ /**
153
+ * Effect cannot be created inside a `$derived` value that was not itself created inside an effect
154
+ * @returns {never}
155
+ */
156
+ function effect_in_unowned_derived() {
157
+ throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`);
158
+ }
159
+ /**
160
+ * `%rune%` can only be used inside an effect (e.g. during component initialisation)
161
+ * @param {string} rune
162
+ * @returns {never}
163
+ */
164
+ function effect_orphan(rune) {
165
+ throw new Error(`https://svelte.dev/e/effect_orphan`);
166
+ }
167
+ /**
168
+ * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
169
+ * @returns {never}
170
+ */
171
+ function effect_update_depth_exceeded() {
172
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
173
+ }
174
+ /**
175
+ * Failed to hydrate the application
176
+ * @returns {never}
177
+ */
178
+ function hydration_failed() {
179
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
180
+ }
181
+ /**
182
+ * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value
183
+ * @param {string} key
184
+ * @returns {never}
185
+ */
186
+ function props_invalid_value(key) {
187
+ throw new Error(`https://svelte.dev/e/props_invalid_value`);
188
+ }
189
+ /**
190
+ * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
191
+ * @returns {never}
192
+ */
193
+ function state_descriptors_fixed() {
194
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
195
+ }
196
+ /**
197
+ * Cannot set prototype of `$state` object
198
+ * @returns {never}
199
+ */
200
+ function state_prototype_fixed() {
201
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
202
+ }
203
+ /**
204
+ * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
205
+ * @returns {never}
206
+ */
207
+ function state_unsafe_mutation() {
208
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
209
+ }
210
+ /**
211
+ * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
212
+ * @returns {never}
213
+ */
214
+ function svelte_boundary_reset_onerror() {
215
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
216
+ }
217
+ /**
218
+ * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%
219
+ * @param {string | undefined | null} [location]
220
+ */
221
+ function hydration_mismatch(location) {
222
+ console.warn(`https://svelte.dev/e/hydration_mismatch`);
223
+ }
224
+ /**
225
+ * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called
226
+ */
227
+ function svelte_boundary_reset_noop() {
228
+ console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
229
+ }
230
+ //#endregion
231
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/hydration.js
232
+ /** @import { TemplateNode } from '#client' */
233
+ /**
234
+ * Use this variable to guard everything related to hydration code so it can be treeshaken out
235
+ * if the user doesn't use the `hydrate` method and these code paths are therefore not needed.
236
+ */
237
+ var hydrating = false;
238
+ /** @param {boolean} value */
239
+ function set_hydrating(value) {
240
+ hydrating = value;
241
+ }
242
+ /**
243
+ * The node that is currently being hydrated. This starts out as the first node inside the opening
244
+ * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.
245
+ * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the
246
+ * time we leave the block it is the closing comment, which serves as the block's anchor.
247
+ * @type {TemplateNode}
248
+ */
249
+ var hydrate_node;
250
+ /** @param {TemplateNode | null} node */
251
+ function set_hydrate_node(node) {
252
+ if (node === null) {
253
+ hydration_mismatch();
254
+ throw HYDRATION_ERROR;
255
+ }
256
+ return hydrate_node = node;
257
+ }
258
+ function hydrate_next() {
259
+ return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node));
260
+ }
261
+ /** @param {TemplateNode} node */
262
+ function reset(node) {
263
+ if (!hydrating) return;
264
+ if (/* @__PURE__ */ get_next_sibling(hydrate_node) !== null) {
265
+ hydration_mismatch();
266
+ throw HYDRATION_ERROR;
267
+ }
268
+ hydrate_node = node;
269
+ }
270
+ function next(count = 1) {
271
+ if (hydrating) {
272
+ var i = count;
273
+ var node = hydrate_node;
274
+ while (i--) node = /* @__PURE__ */ get_next_sibling(node);
275
+ hydrate_node = node;
276
+ }
277
+ }
278
+ /**
279
+ * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment
280
+ * @param {boolean} remove
281
+ */
282
+ function skip_nodes(remove = true) {
283
+ var depth = 0;
284
+ var node = hydrate_node;
285
+ while (true) {
286
+ if (node.nodeType === 8) {
287
+ var data = node.data;
288
+ if (data === "]") {
289
+ if (depth === 0) return node;
290
+ depth -= 1;
291
+ } else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1;
292
+ }
293
+ var next = /* @__PURE__ */ get_next_sibling(node);
294
+ if (remove) node.remove();
295
+ node = next;
296
+ }
297
+ }
298
+ /**
299
+ *
300
+ * @param {TemplateNode} node
301
+ */
302
+ function read_hydration_instruction(node) {
303
+ if (!node || node.nodeType !== 8) {
304
+ hydration_mismatch();
305
+ throw HYDRATION_ERROR;
306
+ }
307
+ return node.data;
308
+ }
309
+ //#endregion
310
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/equality.js
311
+ /** @import { Equals } from '#client' */
312
+ /** @type {Equals} */
313
+ function equals(value) {
314
+ return value === this.v;
315
+ }
316
+ /**
317
+ * @param {unknown} a
318
+ * @param {unknown} b
319
+ * @returns {boolean}
320
+ */
321
+ function safe_not_equal(a, b) {
322
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
323
+ }
324
+ /** @type {Equals} */
325
+ function safe_equals(value) {
326
+ return !safe_not_equal(value, this.v);
327
+ }
328
+ //#endregion
329
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/flags/index.js
330
+ /** True if experimental.async=true */
331
+ var async_mode_flag = false;
332
+ /** True if we're not certain that we only have Svelte 5 code in the compilation */
333
+ var legacy_mode_flag = false;
334
+ //#endregion
335
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/context.js
336
+ /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
337
+ /** @type {ComponentContext | null} */
338
+ var component_context = null;
339
+ /** @param {ComponentContext | null} context */
340
+ function set_component_context(context) {
341
+ component_context = context;
342
+ }
343
+ /**
344
+ * @param {Record<string, unknown>} props
345
+ * @param {any} runes
346
+ * @param {Function} [fn]
347
+ * @returns {void}
348
+ */
349
+ function push(props, runes = false, fn) {
350
+ component_context = {
351
+ p: component_context,
352
+ i: false,
353
+ c: null,
354
+ e: null,
355
+ s: props,
356
+ x: null,
357
+ r: active_effect,
358
+ l: legacy_mode_flag && !runes ? {
359
+ s: null,
360
+ u: null,
361
+ $: []
362
+ } : null
363
+ };
364
+ }
365
+ /**
366
+ * @template {Record<string, any>} T
367
+ * @param {T} [component]
368
+ * @returns {T}
369
+ */
370
+ function pop(component) {
371
+ var context = component_context;
372
+ var effects = context.e;
373
+ if (effects !== null) {
374
+ context.e = null;
375
+ for (var fn of effects) create_user_effect(fn);
376
+ }
377
+ if (component !== void 0) context.x = component;
378
+ context.i = true;
379
+ component_context = context.p;
380
+ return component ?? {};
381
+ }
382
+ /** @returns {boolean} */
383
+ function is_runes() {
384
+ return !legacy_mode_flag || component_context !== null && component_context.l === null;
385
+ }
386
+ //#endregion
387
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/task.js
388
+ /** @type {Array<() => void>} */
389
+ var micro_tasks = [];
390
+ function run_micro_tasks() {
391
+ var tasks = micro_tasks;
392
+ micro_tasks = [];
393
+ run_all(tasks);
394
+ }
395
+ /**
396
+ * @param {() => void} fn
397
+ */
398
+ function queue_micro_task(fn) {
399
+ if (micro_tasks.length === 0 && !is_flushing_sync) {
400
+ var tasks = micro_tasks;
401
+ queueMicrotask(() => {
402
+ if (tasks === micro_tasks) run_micro_tasks();
403
+ });
404
+ }
405
+ micro_tasks.push(fn);
406
+ }
407
+ /**
408
+ * Synchronously run any queued tasks.
409
+ */
410
+ function flush_tasks() {
411
+ while (micro_tasks.length > 0) run_micro_tasks();
412
+ }
413
+ /**
414
+ * @param {unknown} error
415
+ */
416
+ function handle_error(error) {
417
+ var effect = active_effect;
418
+ if (effect === null) {
419
+ /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
420
+ return error;
421
+ }
422
+ if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
423
+ invoke_error_boundary(error, effect);
424
+ }
425
+ /**
426
+ * @param {unknown} error
427
+ * @param {Effect | null} effect
428
+ */
429
+ function invoke_error_boundary(error, effect) {
430
+ while (effect !== null) {
431
+ if ((effect.f & 128) !== 0) {
432
+ if ((effect.f & 32768) === 0) throw error;
433
+ try {
434
+ /** @type {Boundary} */ effect.b.error(error);
435
+ return;
436
+ } catch (e) {
437
+ error = e;
438
+ }
439
+ }
440
+ effect = effect.parent;
441
+ }
442
+ throw error;
443
+ }
444
+ //#endregion
445
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/status.js
446
+ /** @import { Derived, Signal } from '#client' */
447
+ var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
448
+ /**
449
+ * @param {Signal} signal
450
+ * @param {number} status
451
+ */
452
+ function set_signal_status(signal, status) {
453
+ signal.f = signal.f & STATUS_MASK | status;
454
+ }
455
+ /**
456
+ * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.
457
+ * @param {Derived} derived
458
+ */
459
+ function update_derived_status(derived) {
460
+ if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN);
461
+ else set_signal_status(derived, MAYBE_DIRTY);
462
+ }
463
+ //#endregion
464
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/utils.js
465
+ /** @import { Derived, Effect, Value } from '#client' */
466
+ /**
467
+ * @param {Value[] | null} deps
468
+ */
469
+ function clear_marked(deps) {
470
+ if (deps === null) return;
471
+ for (const dep of deps) {
472
+ if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue;
473
+ dep.f ^= WAS_MARKED;
474
+ clear_marked(
475
+ /** @type {Derived} */
476
+ dep.deps
477
+ );
478
+ }
479
+ }
480
+ /**
481
+ * @param {Effect} effect
482
+ * @param {Set<Effect>} dirty_effects
483
+ * @param {Set<Effect>} maybe_dirty_effects
484
+ */
485
+ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
486
+ if ((effect.f & 2048) !== 0) dirty_effects.add(effect);
487
+ else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect);
488
+ clear_marked(effect.deps);
489
+ set_signal_status(effect, CLEAN);
490
+ }
491
+ //#endregion
492
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/store.js
493
+ /**
494
+ * We set this to `true` when updating a store so that we correctly
495
+ * schedule effects if the update takes place inside a `$:` effect
496
+ */
497
+ var legacy_is_updating_store = false;
498
+ /**
499
+ * Whether or not the prop currently being read is a store binding, as in
500
+ * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in
501
+ * runes mode, and skip `binding_property_non_reactive` validation
502
+ */
503
+ var is_store_binding = false;
504
+ /**
505
+ * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.
506
+ * Used to prevent `binding_property_non_reactive` validation false positives and
507
+ * ensure that these props are treated as mutable even in runes mode
508
+ * @template T
509
+ * @param {() => T} fn
510
+ * @returns {[T, boolean]}
511
+ */
512
+ function capture_store_binding(fn) {
513
+ var previous_is_store_binding = is_store_binding;
514
+ try {
515
+ is_store_binding = false;
516
+ return [fn(), is_store_binding];
517
+ } finally {
518
+ is_store_binding = previous_is_store_binding;
519
+ }
520
+ }
521
+ //#endregion
522
+ //#region \0@oxc-project+runtime@0.120.0/helpers/checkPrivateRedeclaration.js
523
+ function _checkPrivateRedeclaration(e, t) {
524
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
525
+ }
526
+ //#endregion
527
+ //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateMethodInitSpec.js
528
+ function _classPrivateMethodInitSpec(e, a) {
529
+ _checkPrivateRedeclaration(e, a), a.add(e);
530
+ }
531
+ //#endregion
532
+ //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldInitSpec.js
533
+ function _classPrivateFieldInitSpec(e, t, a) {
534
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
535
+ }
536
+ //#endregion
537
+ //#region \0@oxc-project+runtime@0.120.0/helpers/assertClassBrand.js
538
+ function _assertClassBrand(e, t, n) {
539
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
540
+ throw new TypeError("Private element is not present on this object");
541
+ }
542
+ //#endregion
543
+ //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldGet2.js
544
+ function _classPrivateFieldGet2(s, a) {
545
+ return s.get(_assertClassBrand(s, a));
546
+ }
547
+ //#endregion
548
+ //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldSet2.js
549
+ function _classPrivateFieldSet2(s, a, r) {
550
+ return s.set(_assertClassBrand(s, a), r), r;
551
+ }
552
+ //#endregion
553
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/batch.js
554
+ /** @import { Fork } from 'svelte' */
555
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
556
+ var _Batch;
557
+ /** @type {Set<Batch>} */
558
+ var batches = /* @__PURE__ */ new Set();
559
+ /** @type {Batch | null} */
560
+ var current_batch = null;
561
+ /**
562
+ * When time travelling (i.e. working in one batch, while other batches
563
+ * still have ongoing work), we ignore the real values of affected
564
+ * signals in favour of their values within the batch
565
+ * @type {Map<Value, any> | null}
566
+ */
567
+ var batch_values = null;
568
+ /** @type {Effect | null} */
569
+ var last_scheduled_effect = null;
570
+ var is_flushing_sync = false;
571
+ var is_processing = false;
572
+ /**
573
+ * During traversal, this is an array. Newly created effects are (if not immediately
574
+ * executed) pushed to this array, rather than going through the scheduling
575
+ * rigamarole that would cause another turn of the flush loop.
576
+ * @type {Effect[] | null}
577
+ */
578
+ var collected_effects = null;
579
+ /**
580
+ * An array of effects that are marked during traversal as a result of a `set`
581
+ * (not `internal_set`) call. These will be added to the next batch and
582
+ * trigger another `batch.process()`
583
+ * @type {Effect[] | null}
584
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
585
+ */
586
+ var legacy_updates = null;
587
+ var flush_count = 0;
588
+ var uid = 1;
589
+ var _commit_callbacks = /* @__PURE__ */ new WeakMap();
590
+ var _discard_callbacks = /* @__PURE__ */ new WeakMap();
591
+ var _pending = /* @__PURE__ */ new WeakMap();
592
+ var _blocking_pending = /* @__PURE__ */ new WeakMap();
593
+ var _deferred = /* @__PURE__ */ new WeakMap();
594
+ var _roots = /* @__PURE__ */ new WeakMap();
595
+ var _new_effects = /* @__PURE__ */ new WeakMap();
596
+ var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
597
+ var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
598
+ var _skipped_branches = /* @__PURE__ */ new WeakMap();
599
+ var _decrement_queued = /* @__PURE__ */ new WeakMap();
600
+ var _blockers = /* @__PURE__ */ new WeakMap();
601
+ var _Batch_brand = /* @__PURE__ */ new WeakSet();
602
+ var Batch = class Batch {
603
+ constructor() {
604
+ _classPrivateMethodInitSpec(this, _Batch_brand);
605
+ _defineProperty(this, "id", uid++);
606
+ _defineProperty(
607
+ this,
608
+ /**
609
+ * The current values of any signals that are updated in this batch.
610
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
611
+ * They keys of this map are identical to `this.#previous`
612
+ * @type {Map<Value, [any, boolean]>}
613
+ */
614
+ "current",
615
+ /* @__PURE__ */ new Map()
616
+ );
617
+ _defineProperty(
618
+ this,
619
+ /**
620
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
621
+ * They keys of this map are identical to `this.#current`
622
+ * @type {Map<Value, any>}
623
+ */
624
+ "previous",
625
+ /* @__PURE__ */ new Map()
626
+ );
627
+ _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
628
+ _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
629
+ _classPrivateFieldInitSpec(this, _pending, /* @__PURE__ */ new Map());
630
+ _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
631
+ _classPrivateFieldInitSpec(this, _deferred, null);
632
+ _classPrivateFieldInitSpec(this, _roots, []);
633
+ _classPrivateFieldInitSpec(this, _new_effects, []);
634
+ _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
635
+ _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
636
+ _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
637
+ _defineProperty(this, "is_fork", false);
638
+ _classPrivateFieldInitSpec(this, _decrement_queued, false);
639
+ _classPrivateFieldInitSpec(this, _blockers, /* @__PURE__ */ new Set());
640
+ }
641
+ /**
642
+ * Add an effect to the #skipped_branches map and reset its children
643
+ * @param {Effect} effect
644
+ */
645
+ skip_effect(effect) {
646
+ if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
647
+ d: [],
648
+ m: []
649
+ });
650
+ }
651
+ /**
652
+ * Remove an effect from the #skipped_branches map and reschedule
653
+ * any tracked dirty/maybe_dirty child effects
654
+ * @param {Effect} effect
655
+ */
656
+ unskip_effect(effect) {
657
+ var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
658
+ if (tracked) {
659
+ _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
660
+ for (var e of tracked.d) {
661
+ set_signal_status(e, DIRTY);
662
+ this.schedule(e);
663
+ }
664
+ for (e of tracked.m) {
665
+ set_signal_status(e, MAYBE_DIRTY);
666
+ this.schedule(e);
667
+ }
668
+ }
669
+ }
670
+ /**
671
+ * Associate a change to a given source with the current
672
+ * batch, noting its previous and current values
673
+ * @param {Value} source
674
+ * @param {any} old_value
675
+ * @param {boolean} [is_derived]
676
+ */
677
+ capture(source, old_value, is_derived = false) {
678
+ if (old_value !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, old_value);
679
+ if ((source.f & 8388608) === 0) {
680
+ this.current.set(source, [source.v, is_derived]);
681
+ batch_values?.set(source, source.v);
682
+ }
683
+ }
684
+ activate() {
685
+ current_batch = this;
686
+ }
687
+ deactivate() {
688
+ current_batch = null;
689
+ batch_values = null;
690
+ }
691
+ flush() {
692
+ try {
693
+ is_processing = true;
694
+ current_batch = this;
695
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
696
+ } finally {
697
+ flush_count = 0;
698
+ last_scheduled_effect = null;
699
+ collected_effects = null;
700
+ legacy_updates = null;
701
+ is_processing = false;
702
+ current_batch = null;
703
+ batch_values = null;
704
+ old_values.clear();
705
+ }
706
+ }
707
+ discard() {
708
+ for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
709
+ _classPrivateFieldGet2(_discard_callbacks, this).clear();
710
+ batches.delete(this);
711
+ }
712
+ /**
713
+ * @param {Effect} effect
714
+ */
715
+ register_created_effect(effect) {
716
+ _classPrivateFieldGet2(_new_effects, this).push(effect);
717
+ }
718
+ /**
719
+ * @param {boolean} blocking
720
+ * @param {Effect} effect
721
+ */
722
+ increment(blocking, effect) {
723
+ let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
724
+ _classPrivateFieldGet2(_pending, this).set(effect, pending_count + 1);
725
+ if (blocking) {
726
+ let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
727
+ _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
728
+ }
729
+ }
730
+ /**
731
+ * @param {boolean} blocking
732
+ * @param {Effect} effect
733
+ * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
734
+ */
735
+ decrement(blocking, effect, skip) {
736
+ let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
737
+ if (pending_count === 1) _classPrivateFieldGet2(_pending, this).delete(effect);
738
+ else _classPrivateFieldGet2(_pending, this).set(effect, pending_count - 1);
739
+ if (blocking) {
740
+ let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
741
+ if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
742
+ else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
743
+ }
744
+ if (_classPrivateFieldGet2(_decrement_queued, this) || skip) return;
745
+ _classPrivateFieldSet2(_decrement_queued, this, true);
746
+ queue_micro_task(() => {
747
+ _classPrivateFieldSet2(_decrement_queued, this, false);
748
+ this.flush();
749
+ });
750
+ }
751
+ /**
752
+ * @param {Set<Effect>} dirty_effects
753
+ * @param {Set<Effect>} maybe_dirty_effects
754
+ */
755
+ transfer_effects(dirty_effects, maybe_dirty_effects) {
756
+ for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
757
+ for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
758
+ dirty_effects.clear();
759
+ maybe_dirty_effects.clear();
760
+ }
761
+ /** @param {(batch: Batch) => void} fn */
762
+ oncommit(fn) {
763
+ _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
764
+ }
765
+ /** @param {(batch: Batch) => void} fn */
766
+ ondiscard(fn) {
767
+ _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
768
+ }
769
+ settled() {
770
+ return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
771
+ }
772
+ static ensure() {
773
+ if (current_batch === null) {
774
+ const batch = current_batch = new Batch();
775
+ if (!is_processing) {
776
+ batches.add(current_batch);
777
+ if (!is_flushing_sync) queue_micro_task(() => {
778
+ if (current_batch !== batch) return;
779
+ batch.flush();
780
+ });
781
+ }
782
+ }
783
+ return current_batch;
784
+ }
785
+ apply() {
786
+ if (!async_mode_flag || !this.is_fork && batches.size === 1) {
787
+ batch_values = null;
788
+ return;
789
+ }
790
+ batch_values = /* @__PURE__ */ new Map();
791
+ for (const [source, [value]] of this.current) batch_values.set(source, value);
792
+ for (const batch of batches) {
793
+ if (batch === this || batch.is_fork) continue;
794
+ var intersects = false;
795
+ var differs = false;
796
+ if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
797
+ if (is_derived) continue;
798
+ intersects || (intersects = this.current.has(source));
799
+ differs || (differs = !this.current.has(source));
800
+ }
801
+ if (intersects && differs) _classPrivateFieldGet2(_blockers, this).add(batch);
802
+ else for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
803
+ }
804
+ }
805
+ /**
806
+ *
807
+ * @param {Effect} effect
808
+ */
809
+ schedule(effect) {
810
+ last_scheduled_effect = effect;
811
+ if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
812
+ effect.b.defer_effect(effect);
813
+ return;
814
+ }
815
+ var e = effect;
816
+ while (e.parent !== null) {
817
+ e = e.parent;
818
+ var flags = e.f;
819
+ if (collected_effects !== null && e === active_effect) {
820
+ if (async_mode_flag) return;
821
+ if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
822
+ }
823
+ if ((flags & 96) !== 0) {
824
+ if ((flags & 1024) === 0) return;
825
+ e.f ^= CLEAN;
826
+ }
827
+ }
828
+ _classPrivateFieldGet2(_roots, this).push(e);
829
+ }
830
+ };
831
+ _Batch = Batch;
832
+ function _is_deferred() {
833
+ return this.is_fork || _classPrivateFieldGet2(_blocking_pending, this).size > 0;
834
+ }
835
+ function _is_blocked() {
836
+ for (const batch of _classPrivateFieldGet2(_blockers, this)) for (const effect of _classPrivateFieldGet2(_blocking_pending, batch).keys()) {
837
+ var skipped = false;
838
+ var e = effect;
839
+ while (e.parent !== null) {
840
+ if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
841
+ skipped = true;
842
+ break;
843
+ }
844
+ e = e.parent;
845
+ }
846
+ if (!skipped) return true;
847
+ }
848
+ return false;
849
+ }
850
+ function _process() {
851
+ if (flush_count++ > 1e3) {
852
+ batches.delete(this);
853
+ infinite_loop_guard();
854
+ }
855
+ if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
856
+ for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
857
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
858
+ set_signal_status(e, DIRTY);
859
+ this.schedule(e);
860
+ }
861
+ for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
862
+ set_signal_status(e, MAYBE_DIRTY);
863
+ this.schedule(e);
864
+ }
865
+ }
866
+ const roots = _classPrivateFieldGet2(_roots, this);
867
+ _classPrivateFieldSet2(_roots, this, []);
868
+ this.apply();
869
+ /** @type {Effect[]} */
870
+ var effects = collected_effects = [];
871
+ /** @type {Effect[]} */
872
+ var render_effects = [];
873
+ /**
874
+ * @type {Effect[]}
875
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
876
+ */
877
+ var updates = legacy_updates = [];
878
+ for (const root of roots) try {
879
+ _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
880
+ } catch (e) {
881
+ reset_all(root);
882
+ throw e;
883
+ }
884
+ current_batch = null;
885
+ if (updates.length > 0) {
886
+ var batch = _Batch.ensure();
887
+ for (const e of updates) batch.schedule(e);
888
+ }
889
+ collected_effects = null;
890
+ legacy_updates = null;
891
+ if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this) || _assertClassBrand(_Batch_brand, this, _is_blocked).call(this)) {
892
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
893
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
894
+ for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
895
+ } else {
896
+ if (_classPrivateFieldGet2(_pending, this).size === 0) batches.delete(this);
897
+ _classPrivateFieldGet2(_dirty_effects$1, this).clear();
898
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
899
+ for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
900
+ _classPrivateFieldGet2(_commit_callbacks, this).clear();
901
+ flush_queued_effects(render_effects);
902
+ flush_queued_effects(effects);
903
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
904
+ }
905
+ var next_batch = current_batch;
906
+ if (_classPrivateFieldGet2(_roots, this).length > 0) {
907
+ const batch = next_batch ?? (next_batch = this);
908
+ _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
909
+ }
910
+ if (next_batch !== null) {
911
+ batches.add(next_batch);
912
+ _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
913
+ }
914
+ if (!batches.has(this)) _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
915
+ }
916
+ /**
917
+ * Traverse the effect tree, executing effects or stashing
918
+ * them for later execution as appropriate
919
+ * @param {Effect} root
920
+ * @param {Effect[]} effects
921
+ * @param {Effect[]} render_effects
922
+ */
923
+ function _traverse(root, effects, render_effects) {
924
+ root.f ^= CLEAN;
925
+ var effect = root.first;
926
+ while (effect !== null) {
927
+ var flags = effect.f;
928
+ var is_branch = (flags & 96) !== 0;
929
+ if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
930
+ if (is_branch) effect.f ^= CLEAN;
931
+ else if ((flags & 4) !== 0) effects.push(effect);
932
+ else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
933
+ else if (is_dirty(effect)) {
934
+ if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(effect);
935
+ update_effect(effect);
936
+ }
937
+ var child = effect.first;
938
+ if (child !== null) {
939
+ effect = child;
940
+ continue;
941
+ }
942
+ }
943
+ while (effect !== null) {
944
+ var next = effect.next;
945
+ if (next !== null) {
946
+ effect = next;
947
+ break;
948
+ }
949
+ effect = effect.parent;
950
+ }
951
+ }
952
+ }
953
+ /**
954
+ * @param {Effect[]} effects
955
+ */
956
+ function _defer_effects(effects) {
957
+ for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
958
+ }
959
+ function _commit$1() {
960
+ for (const batch of batches) {
961
+ var is_earlier = batch.id < this.id;
962
+ /** @type {Source[]} */
963
+ var sources = [];
964
+ for (const [source, [value, is_derived]] of this.current) {
965
+ if (batch.current.has(source)) {
966
+ var batch_value = batch.current.get(source)[0];
967
+ if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
968
+ else continue;
969
+ }
970
+ sources.push(source);
971
+ }
972
+ var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
973
+ if (others.length === 0) {
974
+ if (is_earlier) batch.discard();
975
+ } else if (sources.length > 0) {
976
+ batch.activate();
977
+ /** @type {Set<Value>} */
978
+ var marked = /* @__PURE__ */ new Set();
979
+ /** @type {Map<Reaction, boolean>} */
980
+ var checked = /* @__PURE__ */ new Map();
981
+ for (var source of sources) mark_effects(source, others, marked, checked);
982
+ checked = /* @__PURE__ */ new Map();
983
+ var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
984
+ for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
985
+ set_signal_status(effect, DIRTY);
986
+ batch.schedule(effect);
987
+ } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
988
+ if (_classPrivateFieldGet2(_roots, batch).length > 0) {
989
+ batch.apply();
990
+ for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
991
+ _classPrivateFieldSet2(_roots, batch, []);
992
+ }
993
+ batch.deactivate();
994
+ }
995
+ }
996
+ for (const batch of batches) if (_classPrivateFieldGet2(_blockers, batch).has(this)) {
997
+ _classPrivateFieldGet2(_blockers, batch).delete(this);
998
+ if (_classPrivateFieldGet2(_blockers, batch).size === 0 && !_assertClassBrand(_Batch_brand, batch, _is_deferred).call(batch)) {
999
+ batch.activate();
1000
+ _assertClassBrand(_Batch_brand, batch, _process).call(batch);
1001
+ }
1002
+ }
1003
+ }
1004
+ /**
1005
+ * Synchronously flush any pending updates.
1006
+ * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1007
+ * @template [T=void]
1008
+ * @param {(() => T) | undefined} [fn]
1009
+ * @returns {T}
1010
+ */
1011
+ function flushSync(fn) {
1012
+ var was_flushing_sync = is_flushing_sync;
1013
+ is_flushing_sync = true;
1014
+ try {
1015
+ var result;
1016
+ if (fn) {
1017
+ if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
1018
+ result = fn();
1019
+ }
1020
+ while (true) {
1021
+ flush_tasks();
1022
+ if (current_batch === null) return result;
1023
+ current_batch.flush();
1024
+ }
1025
+ } finally {
1026
+ is_flushing_sync = was_flushing_sync;
1027
+ }
1028
+ }
1029
+ function infinite_loop_guard() {
1030
+ try {
1031
+ effect_update_depth_exceeded();
1032
+ } catch (error) {
1033
+ invoke_error_boundary(error, last_scheduled_effect);
1034
+ }
1035
+ }
1036
+ /** @type {Set<Effect> | null} */
1037
+ var eager_block_effects = null;
1038
+ /**
1039
+ * @param {Array<Effect>} effects
1040
+ * @returns {void}
1041
+ */
1042
+ function flush_queued_effects(effects) {
1043
+ var length = effects.length;
1044
+ if (length === 0) return;
1045
+ var i = 0;
1046
+ while (i < length) {
1047
+ var effect = effects[i++];
1048
+ if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1049
+ eager_block_effects = /* @__PURE__ */ new Set();
1050
+ update_effect(effect);
1051
+ if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1052
+ if (eager_block_effects?.size > 0) {
1053
+ old_values.clear();
1054
+ for (const e of eager_block_effects) {
1055
+ if ((e.f & 24576) !== 0) continue;
1056
+ /** @type {Effect[]} */
1057
+ const ordered_effects = [e];
1058
+ let ancestor = e.parent;
1059
+ while (ancestor !== null) {
1060
+ if (eager_block_effects.has(ancestor)) {
1061
+ eager_block_effects.delete(ancestor);
1062
+ ordered_effects.push(ancestor);
1063
+ }
1064
+ ancestor = ancestor.parent;
1065
+ }
1066
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
1067
+ const e = ordered_effects[j];
1068
+ if ((e.f & 24576) !== 0) continue;
1069
+ update_effect(e);
1070
+ }
1071
+ }
1072
+ eager_block_effects.clear();
1073
+ }
1074
+ }
1075
+ }
1076
+ eager_block_effects = null;
1077
+ }
1078
+ /**
1079
+ * This is similar to `mark_reactions`, but it only marks async/block effects
1080
+ * depending on `value` and at least one of the other `sources`, so that
1081
+ * these effects can re-run after another batch has been committed
1082
+ * @param {Value} value
1083
+ * @param {Source[]} sources
1084
+ * @param {Set<Value>} marked
1085
+ * @param {Map<Reaction, boolean>} checked
1086
+ */
1087
+ function mark_effects(value, sources, marked, checked) {
1088
+ if (marked.has(value)) return;
1089
+ marked.add(value);
1090
+ if (value.reactions !== null) for (const reaction of value.reactions) {
1091
+ const flags = reaction.f;
1092
+ if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1093
+ else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1094
+ set_signal_status(reaction, DIRTY);
1095
+ schedule_effect(reaction);
1096
+ }
1097
+ }
1098
+ }
1099
+ /**
1100
+ * @param {Reaction} reaction
1101
+ * @param {Source[]} sources
1102
+ * @param {Map<Reaction, boolean>} checked
1103
+ */
1104
+ function depends_on(reaction, sources, checked) {
1105
+ const depends = checked.get(reaction);
1106
+ if (depends !== void 0) return depends;
1107
+ if (reaction.deps !== null) for (const dep of reaction.deps) {
1108
+ if (includes.call(sources, dep)) return true;
1109
+ if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1110
+ checked.set(dep, true);
1111
+ return true;
1112
+ }
1113
+ }
1114
+ checked.set(reaction, false);
1115
+ return false;
1116
+ }
1117
+ /**
1118
+ * @param {Effect} effect
1119
+ * @returns {void}
1120
+ */
1121
+ function schedule_effect(effect) {
1122
+ /** @type {Batch} */ current_batch.schedule(effect);
1123
+ }
1124
+ /**
1125
+ * Mark all the effects inside a skipped branch CLEAN, so that
1126
+ * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1127
+ * effects so they can be rescheduled if the branch survives.
1128
+ * @param {Effect} effect
1129
+ * @param {{ d: Effect[], m: Effect[] }} tracked
1130
+ */
1131
+ function reset_branch(effect, tracked) {
1132
+ if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1133
+ if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1134
+ else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1135
+ set_signal_status(effect, CLEAN);
1136
+ var e = effect.first;
1137
+ while (e !== null) {
1138
+ reset_branch(e, tracked);
1139
+ e = e.next;
1140
+ }
1141
+ }
1142
+ /**
1143
+ * Mark an entire effect tree clean following an error
1144
+ * @param {Effect} effect
1145
+ */
1146
+ function reset_all(effect) {
1147
+ set_signal_status(effect, CLEAN);
1148
+ var e = effect.first;
1149
+ while (e !== null) {
1150
+ reset_all(e);
1151
+ e = e.next;
1152
+ }
1153
+ }
1154
+ //#endregion
1155
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/reactivity/create-subscriber.js
1156
+ /**
1157
+ * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1158
+ * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
1159
+ *
1160
+ * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
1161
+ * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
1162
+ *
1163
+ * If `start` returns a cleanup function, it will be called when the effect is destroyed.
1164
+ *
1165
+ * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
1166
+ * are active, and the returned teardown function will only be called when all effects are destroyed.
1167
+ *
1168
+ * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
1169
+ *
1170
+ * ```js
1171
+ * import { createSubscriber } from 'svelte/reactivity';
1172
+ * import { on } from 'svelte/events';
1173
+ *
1174
+ * export class MediaQuery {
1175
+ * #query;
1176
+ * #subscribe;
1177
+ *
1178
+ * constructor(query) {
1179
+ * this.#query = window.matchMedia(`(${query})`);
1180
+ *
1181
+ * this.#subscribe = createSubscriber((update) => {
1182
+ * // when the `change` event occurs, re-run any effects that read `this.current`
1183
+ * const off = on(this.#query, 'change', update);
1184
+ *
1185
+ * // stop listening when all the effects are destroyed
1186
+ * return () => off();
1187
+ * });
1188
+ * }
1189
+ *
1190
+ * get current() {
1191
+ * // This makes the getter reactive, if read in an effect
1192
+ * this.#subscribe();
1193
+ *
1194
+ * // Return the current state of the query, whether or not we're in an effect
1195
+ * return this.#query.matches;
1196
+ * }
1197
+ * }
1198
+ * ```
1199
+ * @param {(update: () => void) => (() => void) | void} start
1200
+ * @since 5.7.0
1201
+ */
1202
+ function createSubscriber(start) {
1203
+ let subscribers = 0;
1204
+ let version = source(0);
1205
+ /** @type {(() => void) | void} */
1206
+ let stop;
1207
+ return () => {
1208
+ if (effect_tracking()) {
1209
+ get(version);
1210
+ render_effect(() => {
1211
+ if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
1212
+ subscribers += 1;
1213
+ return () => {
1214
+ queue_micro_task(() => {
1215
+ subscribers -= 1;
1216
+ if (subscribers === 0) {
1217
+ stop?.();
1218
+ stop = void 0;
1219
+ increment(version);
1220
+ }
1221
+ });
1222
+ };
1223
+ });
1224
+ }
1225
+ };
1226
+ }
1227
+ //#endregion
1228
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1229
+ /** @import { Effect, Source, TemplateNode, } from '#client' */
1230
+ /**
1231
+ * @typedef {{
1232
+ * onerror?: (error: unknown, reset: () => void) => void;
1233
+ * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
1234
+ * pending?: (anchor: Node) => void;
1235
+ * }} BoundaryProps
1236
+ */
1237
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1238
+ /**
1239
+ * @param {TemplateNode} node
1240
+ * @param {BoundaryProps} props
1241
+ * @param {((anchor: Node) => void)} children
1242
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
1243
+ * @returns {void}
1244
+ */
1245
+ function boundary(node, props, children, transform_error) {
1246
+ new Boundary(node, props, children, transform_error);
1247
+ }
1248
+ var _anchor = /* @__PURE__ */ new WeakMap();
1249
+ var _hydrate_open = /* @__PURE__ */ new WeakMap();
1250
+ var _props = /* @__PURE__ */ new WeakMap();
1251
+ var _children = /* @__PURE__ */ new WeakMap();
1252
+ var _effect = /* @__PURE__ */ new WeakMap();
1253
+ var _main_effect = /* @__PURE__ */ new WeakMap();
1254
+ var _pending_effect = /* @__PURE__ */ new WeakMap();
1255
+ var _failed_effect = /* @__PURE__ */ new WeakMap();
1256
+ var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1257
+ var _local_pending_count = /* @__PURE__ */ new WeakMap();
1258
+ var _pending_count = /* @__PURE__ */ new WeakMap();
1259
+ var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
1260
+ var _dirty_effects = /* @__PURE__ */ new WeakMap();
1261
+ var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
1262
+ var _effect_pending = /* @__PURE__ */ new WeakMap();
1263
+ var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1264
+ var _Boundary_brand = /* @__PURE__ */ new WeakSet();
1265
+ var Boundary = class {
1266
+ /**
1267
+ * @param {TemplateNode} node
1268
+ * @param {BoundaryProps} props
1269
+ * @param {((anchor: Node) => void)} children
1270
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
1271
+ */
1272
+ constructor(node, props, children, transform_error) {
1273
+ _classPrivateMethodInitSpec(this, _Boundary_brand);
1274
+ _defineProperty(
1275
+ this,
1276
+ /** @type {Boundary | null} */
1277
+ "parent",
1278
+ void 0
1279
+ );
1280
+ _defineProperty(this, "is_pending", false);
1281
+ _defineProperty(
1282
+ this,
1283
+ /**
1284
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1285
+ * Inherited from parent boundary, or defaults to identity.
1286
+ * @type {(error: unknown) => unknown}
1287
+ */
1288
+ "transform_error",
1289
+ void 0
1290
+ );
1291
+ _classPrivateFieldInitSpec(this, _anchor, void 0);
1292
+ _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
1293
+ _classPrivateFieldInitSpec(this, _props, void 0);
1294
+ _classPrivateFieldInitSpec(this, _children, void 0);
1295
+ _classPrivateFieldInitSpec(this, _effect, void 0);
1296
+ _classPrivateFieldInitSpec(this, _main_effect, null);
1297
+ _classPrivateFieldInitSpec(this, _pending_effect, null);
1298
+ _classPrivateFieldInitSpec(this, _failed_effect, null);
1299
+ _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
1300
+ _classPrivateFieldInitSpec(this, _local_pending_count, 0);
1301
+ _classPrivateFieldInitSpec(this, _pending_count, 0);
1302
+ _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
1303
+ _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
1304
+ _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
1305
+ _classPrivateFieldInitSpec(this, _effect_pending, null);
1306
+ _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
1307
+ _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
1308
+ return () => {
1309
+ _classPrivateFieldSet2(_effect_pending, this, null);
1310
+ };
1311
+ }));
1312
+ _classPrivateFieldSet2(_anchor, this, node);
1313
+ _classPrivateFieldSet2(_props, this, props);
1314
+ _classPrivateFieldSet2(_children, this, (anchor) => {
1315
+ var effect = active_effect;
1316
+ effect.b = this;
1317
+ effect.f |= 128;
1318
+ children(anchor);
1319
+ });
1320
+ this.parent = active_effect.b;
1321
+ this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
1322
+ _classPrivateFieldSet2(_effect, this, block(() => {
1323
+ if (hydrating) {
1324
+ const comment = _classPrivateFieldGet2(_hydrate_open, this);
1325
+ hydrate_next();
1326
+ const server_rendered_pending = comment.data === "[!";
1327
+ if (comment.data.startsWith("[?")) {
1328
+ const serialized_error = JSON.parse(comment.data.slice(2));
1329
+ _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
1330
+ } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
1331
+ else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
1332
+ } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
1333
+ }, flags));
1334
+ if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
1335
+ }
1336
+ /**
1337
+ * Defer an effect inside a pending boundary until the boundary resolves
1338
+ * @param {Effect} effect
1339
+ */
1340
+ defer_effect(effect) {
1341
+ defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1342
+ }
1343
+ /**
1344
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1345
+ * @returns {boolean}
1346
+ */
1347
+ is_rendered() {
1348
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
1349
+ }
1350
+ has_pending_snippet() {
1351
+ return !!_classPrivateFieldGet2(_props, this).pending;
1352
+ }
1353
+ /**
1354
+ * Update the source that powers `$effect.pending()` inside this boundary,
1355
+ * and controls when the current `pending` snippet (if any) is removed.
1356
+ * Do not call from inside the class
1357
+ * @param {1 | -1} d
1358
+ * @param {Batch} batch
1359
+ */
1360
+ update_pending_count(d, batch) {
1361
+ _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
1362
+ _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
1363
+ if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
1364
+ _classPrivateFieldSet2(_pending_count_update_queued, this, true);
1365
+ queue_micro_task(() => {
1366
+ _classPrivateFieldSet2(_pending_count_update_queued, this, false);
1367
+ if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
1368
+ });
1369
+ }
1370
+ get_effect_pending() {
1371
+ _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
1372
+ return get(_classPrivateFieldGet2(_effect_pending, this));
1373
+ }
1374
+ /** @param {unknown} error */
1375
+ error(error) {
1376
+ var onerror = _classPrivateFieldGet2(_props, this).onerror;
1377
+ let failed = _classPrivateFieldGet2(_props, this).failed;
1378
+ if (!onerror && !failed) throw error;
1379
+ if (_classPrivateFieldGet2(_main_effect, this)) {
1380
+ destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1381
+ _classPrivateFieldSet2(_main_effect, this, null);
1382
+ }
1383
+ if (_classPrivateFieldGet2(_pending_effect, this)) {
1384
+ destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1385
+ _classPrivateFieldSet2(_pending_effect, this, null);
1386
+ }
1387
+ if (_classPrivateFieldGet2(_failed_effect, this)) {
1388
+ destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1389
+ _classPrivateFieldSet2(_failed_effect, this, null);
1390
+ }
1391
+ if (hydrating) {
1392
+ set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1393
+ next();
1394
+ set_hydrate_node(skip_nodes());
1395
+ }
1396
+ var did_reset = false;
1397
+ var calling_on_error = false;
1398
+ const reset = () => {
1399
+ if (did_reset) {
1400
+ svelte_boundary_reset_noop();
1401
+ return;
1402
+ }
1403
+ did_reset = true;
1404
+ if (calling_on_error) svelte_boundary_reset_onerror();
1405
+ if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1406
+ _classPrivateFieldSet2(_failed_effect, this, null);
1407
+ });
1408
+ _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1409
+ _assertClassBrand(_Boundary_brand, this, _render).call(this);
1410
+ });
1411
+ };
1412
+ /** @param {unknown} transformed_error */
1413
+ const handle_error_result = (transformed_error) => {
1414
+ try {
1415
+ calling_on_error = true;
1416
+ onerror?.(transformed_error, reset);
1417
+ calling_on_error = false;
1418
+ } catch (error) {
1419
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1420
+ }
1421
+ if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1422
+ try {
1423
+ return branch(() => {
1424
+ var effect = active_effect;
1425
+ effect.b = this;
1426
+ effect.f |= 128;
1427
+ failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1428
+ });
1429
+ } catch (error) {
1430
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1431
+ return null;
1432
+ }
1433
+ }));
1434
+ };
1435
+ queue_micro_task(() => {
1436
+ /** @type {unknown} */
1437
+ var result;
1438
+ try {
1439
+ result = this.transform_error(error);
1440
+ } catch (e) {
1441
+ invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1442
+ return;
1443
+ }
1444
+ if (result !== null && typeof result === "object" && typeof result.then === "function")
1445
+ /** @type {any} */ result.then(
1446
+ handle_error_result,
1447
+ /** @param {unknown} e */
1448
+ (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1449
+ );
1450
+ else handle_error_result(result);
1451
+ });
1452
+ }
1453
+ };
1454
+ function _hydrate_resolved_content() {
1455
+ try {
1456
+ _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
1457
+ } catch (error) {
1458
+ this.error(error);
1459
+ }
1460
+ }
1461
+ /**
1462
+ * @param {unknown} error The deserialized error from the server's hydration comment
1463
+ */
1464
+ function _hydrate_failed_content(error) {
1465
+ const failed = _classPrivateFieldGet2(_props, this).failed;
1466
+ if (!failed) return;
1467
+ _classPrivateFieldSet2(_failed_effect, this, branch(() => {
1468
+ failed(_classPrivateFieldGet2(_anchor, this), () => error, () => () => {});
1469
+ }));
1470
+ }
1471
+ function _hydrate_pending_content() {
1472
+ const pending = _classPrivateFieldGet2(_props, this).pending;
1473
+ if (!pending) return;
1474
+ this.is_pending = true;
1475
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1476
+ queue_micro_task(() => {
1477
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1478
+ var anchor = create_text();
1479
+ fragment.append(anchor);
1480
+ _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1481
+ return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
1482
+ }));
1483
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1484
+ _classPrivateFieldGet2(_anchor, this).before(fragment);
1485
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
1486
+ pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1487
+ _classPrivateFieldSet2(_pending_effect, this, null);
1488
+ });
1489
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1490
+ }
1491
+ });
1492
+ }
1493
+ function _render() {
1494
+ try {
1495
+ this.is_pending = this.has_pending_snippet();
1496
+ _classPrivateFieldSet2(_pending_count, this, 0);
1497
+ _classPrivateFieldSet2(_local_pending_count, this, 0);
1498
+ _classPrivateFieldSet2(_main_effect, this, branch(() => {
1499
+ _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
1500
+ }));
1501
+ if (_classPrivateFieldGet2(_pending_count, this) > 0) {
1502
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1503
+ move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
1504
+ const pending = _classPrivateFieldGet2(_props, this).pending;
1505
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1506
+ } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1507
+ } catch (error) {
1508
+ this.error(error);
1509
+ }
1510
+ }
1511
+ /**
1512
+ * @param {Batch} batch
1513
+ */
1514
+ function _resolve(batch) {
1515
+ this.is_pending = false;
1516
+ batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1517
+ }
1518
+ /**
1519
+ * @template T
1520
+ * @param {() => T} fn
1521
+ */
1522
+ function _run(fn) {
1523
+ var previous_effect = active_effect;
1524
+ var previous_reaction = active_reaction;
1525
+ var previous_ctx = component_context;
1526
+ set_active_effect(_classPrivateFieldGet2(_effect, this));
1527
+ set_active_reaction(_classPrivateFieldGet2(_effect, this));
1528
+ set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
1529
+ try {
1530
+ Batch.ensure();
1531
+ return fn();
1532
+ } catch (e) {
1533
+ handle_error(e);
1534
+ return null;
1535
+ } finally {
1536
+ set_active_effect(previous_effect);
1537
+ set_active_reaction(previous_reaction);
1538
+ set_component_context(previous_ctx);
1539
+ }
1540
+ }
1541
+ /**
1542
+ * Updates the pending count associated with the currently visible pending snippet,
1543
+ * if any, such that we can replace the snippet with content once work is done
1544
+ * @param {1 | -1} d
1545
+ * @param {Batch} batch
1546
+ */
1547
+ function _update_pending_count(d, batch) {
1548
+ if (!this.has_pending_snippet()) {
1549
+ if (this.parent) {
1550
+ var _this$parent;
1551
+ _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
1552
+ }
1553
+ return;
1554
+ }
1555
+ _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
1556
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1557
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
1558
+ if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1559
+ _classPrivateFieldSet2(_pending_effect, this, null);
1560
+ });
1561
+ if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
1562
+ _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
1563
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
1564
+ }
1565
+ }
1566
+ }
1567
+ //#endregion
1568
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/async.js
1569
+ /** @import { Blocker, Effect, Value } from '#client' */
1570
+ /**
1571
+ * @param {Blocker[]} blockers
1572
+ * @param {Array<() => any>} sync
1573
+ * @param {Array<() => Promise<any>>} async
1574
+ * @param {(values: Value[]) => any} fn
1575
+ */
1576
+ function flatten(blockers, sync, async, fn) {
1577
+ const d = is_runes() ? derived : derived_safe_equal;
1578
+ var pending = blockers.filter((b) => !b.settled);
1579
+ if (async.length === 0 && pending.length === 0) {
1580
+ fn(sync.map(d));
1581
+ return;
1582
+ }
1583
+ var parent = active_effect;
1584
+ var restore = capture();
1585
+ var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1586
+ /** @param {Value[]} values */
1587
+ function finish(values) {
1588
+ restore();
1589
+ try {
1590
+ fn(values);
1591
+ } catch (error) {
1592
+ if ((parent.f & 16384) === 0) invoke_error_boundary(error, parent);
1593
+ }
1594
+ unset_context();
1595
+ }
1596
+ if (async.length === 0) {
1597
+ /** @type {Promise<any>} */ blocker_promise.then(() => finish(sync.map(d)));
1598
+ return;
1599
+ }
1600
+ var decrement_pending = increment_pending();
1601
+ function run() {
1602
+ Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(() => decrement_pending());
1603
+ }
1604
+ if (blocker_promise) blocker_promise.then(() => {
1605
+ restore();
1606
+ run();
1607
+ unset_context();
1608
+ });
1609
+ else run();
1610
+ }
1611
+ /**
1612
+ * Captures the current effect context so that we can restore it after
1613
+ * some asynchronous work has happened (so that e.g. `await a + b`
1614
+ * causes `b` to be registered as a dependency).
1615
+ */
1616
+ function capture() {
1617
+ var previous_effect = active_effect;
1618
+ var previous_reaction = active_reaction;
1619
+ var previous_component_context = component_context;
1620
+ var previous_batch = current_batch;
1621
+ return function restore(activate_batch = true) {
1622
+ set_active_effect(previous_effect);
1623
+ set_active_reaction(previous_reaction);
1624
+ set_component_context(previous_component_context);
1625
+ if (activate_batch && (previous_effect.f & 16384) === 0) {
1626
+ previous_batch?.activate();
1627
+ previous_batch?.apply();
1628
+ }
1629
+ };
1630
+ }
1631
+ function unset_context(deactivate_batch = true) {
1632
+ set_active_effect(null);
1633
+ set_active_reaction(null);
1634
+ set_component_context(null);
1635
+ if (deactivate_batch) current_batch?.deactivate();
1636
+ }
1637
+ /**
1638
+ * @returns {(skip?: boolean) => void}
1639
+ */
1640
+ function increment_pending() {
1641
+ var effect = active_effect;
1642
+ var boundary = effect.b;
1643
+ var batch = current_batch;
1644
+ var blocking = boundary.is_rendered();
1645
+ boundary.update_pending_count(1, batch);
1646
+ batch.increment(blocking, effect);
1647
+ return (skip = false) => {
1648
+ boundary.update_pending_count(-1, batch);
1649
+ batch.decrement(blocking, effect, skip);
1650
+ };
1651
+ }
1652
+ /**
1653
+ * @template V
1654
+ * @param {() => V} fn
1655
+ * @returns {Derived<V>}
1656
+ */
1657
+ /* @__NO_SIDE_EFFECTS__ */
1658
+ function derived(fn) {
1659
+ var flags = 2 | DIRTY;
1660
+ var parent_derived = active_reaction !== null && (active_reaction.f & 2) !== 0 ? active_reaction : null;
1661
+ if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1662
+ return {
1663
+ ctx: component_context,
1664
+ deps: null,
1665
+ effects: null,
1666
+ equals,
1667
+ f: flags,
1668
+ fn,
1669
+ reactions: null,
1670
+ rv: 0,
1671
+ v: UNINITIALIZED,
1672
+ wv: 0,
1673
+ parent: parent_derived ?? active_effect,
1674
+ ac: null
1675
+ };
1676
+ }
1677
+ /**
1678
+ * @template V
1679
+ * @param {() => V | Promise<V>} fn
1680
+ * @param {string} [label]
1681
+ * @param {string} [location] If provided, print a warning if the value is not read immediately after update
1682
+ * @returns {Promise<Source<V>>}
1683
+ */
1684
+ /* @__NO_SIDE_EFFECTS__ */
1685
+ function async_derived(fn, label, location) {
1686
+ let parent = active_effect;
1687
+ if (parent === null) async_derived_orphan();
1688
+ var promise = void 0;
1689
+ var signal = source(UNINITIALIZED);
1690
+ var should_suspend = !active_reaction;
1691
+ /** @type {Map<Batch, ReturnType<typeof deferred<V>>>} */
1692
+ var deferreds = /* @__PURE__ */ new Map();
1693
+ async_effect(() => {
1694
+ var effect = active_effect;
1695
+ /** @type {ReturnType<typeof deferred<V>>} */
1696
+ var d = deferred();
1697
+ promise = d.promise;
1698
+ try {
1699
+ Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
1700
+ } catch (error) {
1701
+ d.reject(error);
1702
+ unset_context();
1703
+ }
1704
+ var batch = current_batch;
1705
+ if (should_suspend) {
1706
+ if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
1707
+ if (parent.b.is_rendered()) {
1708
+ deferreds.get(batch)?.reject(STALE_REACTION);
1709
+ deferreds.delete(batch);
1710
+ } else {
1711
+ for (const d of deferreds.values()) d.reject(STALE_REACTION);
1712
+ deferreds.clear();
1713
+ }
1714
+ deferreds.set(batch, d);
1715
+ }
1716
+ /**
1717
+ * @param {any} value
1718
+ * @param {unknown} error
1719
+ */
1720
+ const handler = (value, error = void 0) => {
1721
+ if (decrement_pending) decrement_pending(error === STALE_REACTION);
1722
+ if (error === STALE_REACTION || (effect.f & 16384) !== 0) return;
1723
+ batch.activate();
1724
+ if (error) {
1725
+ signal.f |= ERROR_VALUE;
1726
+ internal_set(signal, error);
1727
+ } else {
1728
+ if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
1729
+ internal_set(signal, value);
1730
+ for (const [b, d] of deferreds) {
1731
+ deferreds.delete(b);
1732
+ if (b === batch) break;
1733
+ d.reject(STALE_REACTION);
1734
+ }
1735
+ }
1736
+ batch.deactivate();
1737
+ };
1738
+ d.promise.then(handler, (e) => handler(null, e || "unknown"));
1739
+ });
1740
+ teardown(() => {
1741
+ for (const d of deferreds.values()) d.reject(STALE_REACTION);
1742
+ });
1743
+ return new Promise((fulfil) => {
1744
+ /** @param {Promise<V>} p */
1745
+ function next(p) {
1746
+ function go() {
1747
+ if (p === promise) fulfil(signal);
1748
+ else next(promise);
1749
+ }
1750
+ p.then(go, go);
1751
+ }
1752
+ next(promise);
1753
+ });
1754
+ }
1755
+ /**
1756
+ * @template V
1757
+ * @param {() => V} fn
1758
+ * @returns {Derived<V>}
1759
+ */
1760
+ /* @__NO_SIDE_EFFECTS__ */
1761
+ function user_derived(fn) {
1762
+ const d = /* @__PURE__ */ derived(fn);
1763
+ if (!async_mode_flag) push_reaction_value(d);
1764
+ return d;
1765
+ }
1766
+ /**
1767
+ * @template V
1768
+ * @param {() => V} fn
1769
+ * @returns {Derived<V>}
1770
+ */
1771
+ /* @__NO_SIDE_EFFECTS__ */
1772
+ function derived_safe_equal(fn) {
1773
+ const signal = /* @__PURE__ */ derived(fn);
1774
+ signal.equals = safe_equals;
1775
+ return signal;
1776
+ }
1777
+ /**
1778
+ * @param {Derived} derived
1779
+ * @returns {void}
1780
+ */
1781
+ function destroy_derived_effects(derived) {
1782
+ var effects = derived.effects;
1783
+ if (effects !== null) {
1784
+ derived.effects = null;
1785
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
1786
+ }
1787
+ }
1788
+ /**
1789
+ * @param {Derived} derived
1790
+ * @returns {Effect | null}
1791
+ */
1792
+ function get_derived_parent_effect(derived) {
1793
+ var parent = derived.parent;
1794
+ while (parent !== null) {
1795
+ if ((parent.f & 2) === 0) return (parent.f & 16384) === 0 ? parent : null;
1796
+ parent = parent.parent;
1797
+ }
1798
+ return null;
1799
+ }
1800
+ /**
1801
+ * @template T
1802
+ * @param {Derived} derived
1803
+ * @returns {T}
1804
+ */
1805
+ function execute_derived(derived) {
1806
+ var value;
1807
+ var prev_active_effect = active_effect;
1808
+ set_active_effect(get_derived_parent_effect(derived));
1809
+ try {
1810
+ derived.f &= ~WAS_MARKED;
1811
+ destroy_derived_effects(derived);
1812
+ value = update_reaction(derived);
1813
+ } finally {
1814
+ set_active_effect(prev_active_effect);
1815
+ }
1816
+ return value;
1817
+ }
1818
+ /**
1819
+ * @param {Derived} derived
1820
+ * @returns {void}
1821
+ */
1822
+ function update_derived(derived) {
1823
+ var old_value = derived.v;
1824
+ var value = execute_derived(derived);
1825
+ if (!derived.equals(value)) {
1826
+ derived.wv = increment_write_version();
1827
+ if (!current_batch?.is_fork || derived.deps === null) {
1828
+ derived.v = value;
1829
+ current_batch?.capture(derived, old_value, true);
1830
+ if (derived.deps === null) {
1831
+ set_signal_status(derived, CLEAN);
1832
+ return;
1833
+ }
1834
+ }
1835
+ }
1836
+ if (is_destroying_effect) return;
1837
+ if (batch_values !== null) {
1838
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1839
+ } else update_derived_status(derived);
1840
+ }
1841
+ /**
1842
+ * @param {Derived} derived
1843
+ */
1844
+ function freeze_derived_effects(derived) {
1845
+ if (derived.effects === null) return;
1846
+ for (const e of derived.effects) if (e.teardown || e.ac) {
1847
+ e.teardown?.();
1848
+ e.ac?.abort(STALE_REACTION);
1849
+ e.teardown = noop;
1850
+ e.ac = null;
1851
+ remove_reactions(e, 0);
1852
+ destroy_effect_children(e);
1853
+ }
1854
+ }
1855
+ /**
1856
+ * @param {Derived} derived
1857
+ */
1858
+ function unfreeze_derived_effects(derived) {
1859
+ if (derived.effects === null) return;
1860
+ for (const e of derived.effects) if (e.teardown) update_effect(e);
1861
+ }
1862
+ //#endregion
1863
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/sources.js
1864
+ /** @import { Derived, Effect, Source, Value } from '#client' */
1865
+ /** @type {Set<any>} */
1866
+ var eager_effects = /* @__PURE__ */ new Set();
1867
+ /** @type {Map<Source, any>} */
1868
+ var old_values = /* @__PURE__ */ new Map();
1869
+ var eager_effects_deferred = false;
1870
+ /**
1871
+ * @template V
1872
+ * @param {V} v
1873
+ * @param {Error | null} [stack]
1874
+ * @returns {Source<V>}
1875
+ */
1876
+ function source(v, stack) {
1877
+ return {
1878
+ f: 0,
1879
+ v,
1880
+ reactions: null,
1881
+ equals,
1882
+ rv: 0,
1883
+ wv: 0
1884
+ };
1885
+ }
1886
+ /**
1887
+ * @template V
1888
+ * @param {V} v
1889
+ * @param {Error | null} [stack]
1890
+ */
1891
+ /* @__NO_SIDE_EFFECTS__ */
1892
+ function state(v, stack) {
1893
+ const s = source(v, stack);
1894
+ push_reaction_value(s);
1895
+ return s;
1896
+ }
1897
+ /**
1898
+ * @template V
1899
+ * @param {V} initial_value
1900
+ * @param {boolean} [immutable]
1901
+ * @returns {Source<V>}
1902
+ */
1903
+ /* @__NO_SIDE_EFFECTS__ */
1904
+ function mutable_source(initial_value, immutable = false, trackable = true) {
1905
+ const s = source(initial_value);
1906
+ if (!immutable) s.equals = safe_equals;
1907
+ if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {
1908
+ var _component_context$l;
1909
+ ((_component_context$l = component_context.l).s ?? (_component_context$l.s = [])).push(s);
1910
+ }
1911
+ return s;
1912
+ }
1913
+ /**
1914
+ * @template V
1915
+ * @param {Source<V>} source
1916
+ * @param {V} value
1917
+ * @param {boolean} [should_proxy]
1918
+ * @returns {V}
1919
+ */
1920
+ function set(source, value, should_proxy = false) {
1921
+ if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !includes.call(current_sources, source))) state_unsafe_mutation();
1922
+ return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1923
+ }
1924
+ /**
1925
+ * @template V
1926
+ * @param {Source<V>} source
1927
+ * @param {V} value
1928
+ * @param {Effect[] | null} [updated_during_traversal]
1929
+ * @returns {V}
1930
+ */
1931
+ function internal_set(source, value, updated_during_traversal = null) {
1932
+ if (!source.equals(value)) {
1933
+ var old_value = source.v;
1934
+ if (is_destroying_effect) old_values.set(source, value);
1935
+ else old_values.set(source, old_value);
1936
+ source.v = value;
1937
+ var batch = Batch.ensure();
1938
+ batch.capture(source, old_value);
1939
+ if ((source.f & 2) !== 0) {
1940
+ const derived = source;
1941
+ if ((source.f & 2048) !== 0) execute_derived(derived);
1942
+ if (batch_values === null) update_derived_status(derived);
1943
+ }
1944
+ source.wv = increment_write_version();
1945
+ mark_reactions(source, DIRTY, updated_during_traversal);
1946
+ if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]);
1947
+ else untracked_writes.push(source);
1948
+ if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
1949
+ }
1950
+ return value;
1951
+ }
1952
+ function flush_eager_effects() {
1953
+ eager_effects_deferred = false;
1954
+ for (const effect of eager_effects) {
1955
+ if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1956
+ if (is_dirty(effect)) update_effect(effect);
1957
+ }
1958
+ eager_effects.clear();
1959
+ }
1960
+ /**
1961
+ * Silently (without using `get`) increment a source
1962
+ * @param {Source<number>} source
1963
+ */
1964
+ function increment(source) {
1965
+ set(source, source.v + 1);
1966
+ }
1967
+ /**
1968
+ * @param {Value} signal
1969
+ * @param {number} status should be DIRTY or MAYBE_DIRTY
1970
+ * @param {Effect[] | null} updated_during_traversal
1971
+ * @returns {void}
1972
+ */
1973
+ function mark_reactions(signal, status, updated_during_traversal) {
1974
+ var reactions = signal.reactions;
1975
+ if (reactions === null) return;
1976
+ var runes = is_runes();
1977
+ var length = reactions.length;
1978
+ for (var i = 0; i < length; i++) {
1979
+ var reaction = reactions[i];
1980
+ var flags = reaction.f;
1981
+ if (!runes && reaction === active_effect) continue;
1982
+ var not_dirty = (flags & DIRTY) === 0;
1983
+ if (not_dirty) set_signal_status(reaction, status);
1984
+ if ((flags & 2) !== 0) {
1985
+ var derived = reaction;
1986
+ batch_values?.delete(derived);
1987
+ if ((flags & 65536) === 0) {
1988
+ if (flags & 512) reaction.f |= WAS_MARKED;
1989
+ mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1990
+ }
1991
+ } else if (not_dirty) {
1992
+ var effect = reaction;
1993
+ if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
1994
+ if (updated_during_traversal !== null) updated_during_traversal.push(effect);
1995
+ else schedule_effect(effect);
1996
+ }
1997
+ }
1998
+ }
1999
+ /**
2000
+ * @template T
2001
+ * @param {T} value
2002
+ * @returns {T}
2003
+ */
2004
+ function proxy(value) {
2005
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value;
2006
+ const prototype = get_prototype_of(value);
2007
+ if (prototype !== object_prototype && prototype !== array_prototype) return value;
2008
+ /** @type {Map<any, Source<any>>} */
2009
+ var sources = /* @__PURE__ */ new Map();
2010
+ var is_proxied_array = is_array(value);
2011
+ var version = /* @__PURE__ */ state(0);
2012
+ var stack = null;
2013
+ var parent_version = update_version;
2014
+ /**
2015
+ * Executes the proxy in the context of the reaction it was originally created in, if any
2016
+ * @template T
2017
+ * @param {() => T} fn
2018
+ */
2019
+ var with_parent = (fn) => {
2020
+ if (update_version === parent_version) return fn();
2021
+ var reaction = active_reaction;
2022
+ var version = update_version;
2023
+ set_active_reaction(null);
2024
+ set_update_version(parent_version);
2025
+ var result = fn();
2026
+ set_active_reaction(reaction);
2027
+ set_update_version(version);
2028
+ return result;
2029
+ };
2030
+ if (is_proxied_array) sources.set("length", /* @__PURE__ */ state(
2031
+ /** @type {any[]} */
2032
+ value.length,
2033
+ stack
2034
+ ));
2035
+ return new Proxy(value, {
2036
+ defineProperty(_, prop, descriptor) {
2037
+ if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
2038
+ var s = sources.get(prop);
2039
+ if (s === void 0) with_parent(() => {
2040
+ var s = /* @__PURE__ */ state(descriptor.value, stack);
2041
+ sources.set(prop, s);
2042
+ return s;
2043
+ });
2044
+ else set(s, descriptor.value, true);
2045
+ return true;
2046
+ },
2047
+ deleteProperty(target, prop) {
2048
+ var s = sources.get(prop);
2049
+ if (s === void 0) {
2050
+ if (prop in target) {
2051
+ const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
2052
+ sources.set(prop, s);
2053
+ increment(version);
2054
+ }
2055
+ } else {
2056
+ set(s, UNINITIALIZED);
2057
+ increment(version);
2058
+ }
2059
+ return true;
2060
+ },
2061
+ get(target, prop, receiver) {
2062
+ if (prop === STATE_SYMBOL) return value;
2063
+ var s = sources.get(prop);
2064
+ var exists = prop in target;
2065
+ if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
2066
+ s = with_parent(() => {
2067
+ return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack);
2068
+ });
2069
+ sources.set(prop, s);
2070
+ }
2071
+ if (s !== void 0) {
2072
+ var v = get(s);
2073
+ return v === UNINITIALIZED ? void 0 : v;
2074
+ }
2075
+ return Reflect.get(target, prop, receiver);
2076
+ },
2077
+ getOwnPropertyDescriptor(target, prop) {
2078
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
2079
+ if (descriptor && "value" in descriptor) {
2080
+ var s = sources.get(prop);
2081
+ if (s) descriptor.value = get(s);
2082
+ } else if (descriptor === void 0) {
2083
+ var source = sources.get(prop);
2084
+ var value = source?.v;
2085
+ if (source !== void 0 && value !== UNINITIALIZED) return {
2086
+ enumerable: true,
2087
+ configurable: true,
2088
+ value,
2089
+ writable: true
2090
+ };
2091
+ }
2092
+ return descriptor;
2093
+ },
2094
+ has(target, prop) {
2095
+ if (prop === STATE_SYMBOL) return true;
2096
+ var s = sources.get(prop);
2097
+ var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
2098
+ if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
2099
+ if (s === void 0) {
2100
+ s = with_parent(() => {
2101
+ return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack);
2102
+ });
2103
+ sources.set(prop, s);
2104
+ }
2105
+ if (get(s) === UNINITIALIZED) return false;
2106
+ }
2107
+ return has;
2108
+ },
2109
+ set(target, prop, value, receiver) {
2110
+ var s = sources.get(prop);
2111
+ var has = prop in target;
2112
+ if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
2113
+ var other_s = sources.get(i + "");
2114
+ if (other_s !== void 0) set(other_s, UNINITIALIZED);
2115
+ else if (i in target) {
2116
+ other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
2117
+ sources.set(i + "", other_s);
2118
+ }
2119
+ }
2120
+ if (s === void 0) {
2121
+ if (!has || get_descriptor(target, prop)?.writable) {
2122
+ s = with_parent(() => /* @__PURE__ */ state(void 0, stack));
2123
+ set(s, proxy(value));
2124
+ sources.set(prop, s);
2125
+ }
2126
+ } else {
2127
+ has = s.v !== UNINITIALIZED;
2128
+ var p = with_parent(() => proxy(value));
2129
+ set(s, p);
2130
+ }
2131
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
2132
+ if (descriptor?.set) descriptor.set.call(receiver, value);
2133
+ if (!has) {
2134
+ if (is_proxied_array && typeof prop === "string") {
2135
+ var ls = sources.get("length");
2136
+ var n = Number(prop);
2137
+ if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
2138
+ }
2139
+ increment(version);
2140
+ }
2141
+ return true;
2142
+ },
2143
+ ownKeys(target) {
2144
+ get(version);
2145
+ var own_keys = Reflect.ownKeys(target).filter((key) => {
2146
+ var source = sources.get(key);
2147
+ return source === void 0 || source.v !== UNINITIALIZED;
2148
+ });
2149
+ for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
2150
+ return own_keys;
2151
+ },
2152
+ setPrototypeOf() {
2153
+ state_prototype_fixed();
2154
+ }
2155
+ });
2156
+ }
2157
+ //#endregion
2158
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/operations.js
2159
+ /** @import { Effect, TemplateNode } from '#client' */
2160
+ /** @type {Window} */
2161
+ var $window;
2162
+ /** @type {boolean} */
2163
+ var is_firefox;
2164
+ /** @type {() => Node | null} */
2165
+ var first_child_getter;
2166
+ /** @type {() => Node | null} */
2167
+ var next_sibling_getter;
2168
+ /**
2169
+ * Initialize these lazily to avoid issues when using the runtime in a server context
2170
+ * where these globals are not available while avoiding a separate server entry point
2171
+ */
2172
+ function init_operations() {
2173
+ if ($window !== void 0) return;
2174
+ $window = window;
2175
+ is_firefox = /Firefox/.test(navigator.userAgent);
2176
+ var element_prototype = Element.prototype;
2177
+ var node_prototype = Node.prototype;
2178
+ var text_prototype = Text.prototype;
2179
+ first_child_getter = get_descriptor(node_prototype, "firstChild").get;
2180
+ next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
2181
+ if (is_extensible(element_prototype)) {
2182
+ element_prototype.__click = void 0;
2183
+ element_prototype.__className = void 0;
2184
+ element_prototype.__attributes = null;
2185
+ element_prototype.__style = void 0;
2186
+ element_prototype.__e = void 0;
2187
+ }
2188
+ if (is_extensible(text_prototype)) text_prototype.__t = void 0;
2189
+ }
2190
+ /**
2191
+ * @param {string} value
2192
+ * @returns {Text}
2193
+ */
2194
+ function create_text(value = "") {
2195
+ return document.createTextNode(value);
2196
+ }
2197
+ /**
2198
+ * @template {Node} N
2199
+ * @param {N} node
2200
+ */
2201
+ /* @__NO_SIDE_EFFECTS__ */
2202
+ function get_first_child(node) {
2203
+ return first_child_getter.call(node);
2204
+ }
2205
+ /**
2206
+ * @template {Node} N
2207
+ * @param {N} node
2208
+ */
2209
+ /* @__NO_SIDE_EFFECTS__ */
2210
+ function get_next_sibling(node) {
2211
+ return next_sibling_getter.call(node);
2212
+ }
2213
+ /**
2214
+ * Don't mark this as side-effect-free, hydration needs to walk all nodes
2215
+ * @template {Node} N
2216
+ * @param {N} node
2217
+ * @param {boolean} is_text
2218
+ * @returns {TemplateNode | null}
2219
+ */
2220
+ function child(node, is_text) {
2221
+ if (!hydrating) return /* @__PURE__ */ get_first_child(node);
2222
+ var child = /* @__PURE__ */ get_first_child(hydrate_node);
2223
+ if (child === null) child = hydrate_node.appendChild(create_text());
2224
+ else if (is_text && child.nodeType !== 3) {
2225
+ var text = create_text();
2226
+ child?.before(text);
2227
+ set_hydrate_node(text);
2228
+ return text;
2229
+ }
2230
+ if (is_text) merge_text_nodes(child);
2231
+ set_hydrate_node(child);
2232
+ return child;
2233
+ }
2234
+ /**
2235
+ * Don't mark this as side-effect-free, hydration needs to walk all nodes
2236
+ * @param {TemplateNode} node
2237
+ * @param {boolean} [is_text]
2238
+ * @returns {TemplateNode | null}
2239
+ */
2240
+ function first_child(node, is_text = false) {
2241
+ if (!hydrating) {
2242
+ var first = /* @__PURE__ */ get_first_child(node);
2243
+ if (first instanceof Comment && first.data === "") return /* @__PURE__ */ get_next_sibling(first);
2244
+ return first;
2245
+ }
2246
+ if (is_text) {
2247
+ if (hydrate_node?.nodeType !== 3) {
2248
+ var text = create_text();
2249
+ hydrate_node?.before(text);
2250
+ set_hydrate_node(text);
2251
+ return text;
2252
+ }
2253
+ merge_text_nodes(hydrate_node);
2254
+ }
2255
+ return hydrate_node;
2256
+ }
2257
+ /**
2258
+ * Don't mark this as side-effect-free, hydration needs to walk all nodes
2259
+ * @param {TemplateNode} node
2260
+ * @param {number} count
2261
+ * @param {boolean} is_text
2262
+ * @returns {TemplateNode | null}
2263
+ */
2264
+ function sibling(node, count = 1, is_text = false) {
2265
+ let next_sibling = hydrating ? hydrate_node : node;
2266
+ var last_sibling;
2267
+ while (count--) {
2268
+ last_sibling = next_sibling;
2269
+ next_sibling = /* @__PURE__ */ get_next_sibling(next_sibling);
2270
+ }
2271
+ if (!hydrating) return next_sibling;
2272
+ if (is_text) {
2273
+ if (next_sibling?.nodeType !== 3) {
2274
+ var text = create_text();
2275
+ if (next_sibling === null) last_sibling?.after(text);
2276
+ else next_sibling.before(text);
2277
+ set_hydrate_node(text);
2278
+ return text;
2279
+ }
2280
+ merge_text_nodes(next_sibling);
2281
+ }
2282
+ set_hydrate_node(next_sibling);
2283
+ return next_sibling;
2284
+ }
2285
+ /**
2286
+ * @template {Node} N
2287
+ * @param {N} node
2288
+ * @returns {void}
2289
+ */
2290
+ function clear_text_content(node) {
2291
+ node.textContent = "";
2292
+ }
2293
+ /**
2294
+ * Returns `true` if we're updating the current block, for example `condition` in
2295
+ * an `{#if condition}` block just changed. In this case, the branch should be
2296
+ * appended (or removed) at the same time as other updates within the
2297
+ * current `<svelte:boundary>`
2298
+ */
2299
+ function should_defer_append() {
2300
+ if (!async_mode_flag) return false;
2301
+ if (eager_block_effects !== null) return false;
2302
+ return (active_effect.f & REACTION_RAN) !== 0;
2303
+ }
2304
+ /**
2305
+ * @template {keyof HTMLElementTagNameMap | string} T
2306
+ * @param {T} tag
2307
+ * @param {string} [namespace]
2308
+ * @param {string} [is]
2309
+ * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}
2310
+ */
2311
+ function create_element(tag, namespace, is) {
2312
+ let options = is ? { is } : void 0;
2313
+ return document.createElementNS(namespace ?? "http://www.w3.org/1999/xhtml", tag, options);
2314
+ }
2315
+ /**
2316
+ * Browsers split text nodes larger than 65536 bytes when parsing.
2317
+ * For hydration to succeed, we need to stitch them back together
2318
+ * @param {Text} text
2319
+ */
2320
+ function merge_text_nodes(text) {
2321
+ if (text.nodeValue.length < 65536) return;
2322
+ let next = text.nextSibling;
2323
+ while (next !== null && next.nodeType === 3) {
2324
+ next.remove();
2325
+ /** @type {string} */ text.nodeValue += next.nodeValue;
2326
+ next = text.nextSibling;
2327
+ }
2328
+ }
2329
+ //#endregion
2330
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2331
+ /**
2332
+ * @template T
2333
+ * @param {() => T} fn
2334
+ */
2335
+ function without_reactive_context(fn) {
2336
+ var previous_reaction = active_reaction;
2337
+ var previous_effect = active_effect;
2338
+ set_active_reaction(null);
2339
+ set_active_effect(null);
2340
+ try {
2341
+ return fn();
2342
+ } finally {
2343
+ set_active_reaction(previous_reaction);
2344
+ set_active_effect(previous_effect);
2345
+ }
2346
+ }
2347
+ //#endregion
2348
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/effects.js
2349
+ /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2350
+ /**
2351
+ * @param {'$effect' | '$effect.pre' | '$inspect'} rune
2352
+ */
2353
+ function validate_effect(rune) {
2354
+ if (active_effect === null) {
2355
+ if (active_reaction === null) effect_orphan(rune);
2356
+ effect_in_unowned_derived();
2357
+ }
2358
+ if (is_destroying_effect) effect_in_teardown(rune);
2359
+ }
2360
+ /**
2361
+ * @param {Effect} effect
2362
+ * @param {Effect} parent_effect
2363
+ */
2364
+ function push_effect(effect, parent_effect) {
2365
+ var parent_last = parent_effect.last;
2366
+ if (parent_last === null) parent_effect.last = parent_effect.first = effect;
2367
+ else {
2368
+ parent_last.next = effect;
2369
+ effect.prev = parent_last;
2370
+ parent_effect.last = effect;
2371
+ }
2372
+ }
2373
+ /**
2374
+ * @param {number} type
2375
+ * @param {null | (() => void | (() => void))} fn
2376
+ * @returns {Effect}
2377
+ */
2378
+ function create_effect(type, fn) {
2379
+ var parent = active_effect;
2380
+ if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
2381
+ /** @type {Effect} */
2382
+ var effect = {
2383
+ ctx: component_context,
2384
+ deps: null,
2385
+ nodes: null,
2386
+ f: type | DIRTY | 512,
2387
+ first: null,
2388
+ fn,
2389
+ last: null,
2390
+ next: null,
2391
+ parent,
2392
+ b: parent && parent.b,
2393
+ prev: null,
2394
+ teardown: null,
2395
+ wv: 0,
2396
+ ac: null
2397
+ };
2398
+ current_batch?.register_created_effect(effect);
2399
+ /** @type {Effect | null} */
2400
+ var e = effect;
2401
+ if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect);
2402
+ else Batch.ensure().schedule(effect);
2403
+ else if (fn !== null) {
2404
+ try {
2405
+ update_effect(effect);
2406
+ } catch (e) {
2407
+ destroy_effect(effect);
2408
+ throw e;
2409
+ }
2410
+ if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
2411
+ e = e.first;
2412
+ if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
2413
+ }
2414
+ }
2415
+ if (e !== null) {
2416
+ e.parent = parent;
2417
+ if (parent !== null) push_effect(e, parent);
2418
+ if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
2419
+ var derived = active_reaction;
2420
+ (derived.effects ?? (derived.effects = [])).push(e);
2421
+ }
2422
+ }
2423
+ return effect;
2424
+ }
2425
+ /**
2426
+ * Internal representation of `$effect.tracking()`
2427
+ * @returns {boolean}
2428
+ */
2429
+ function effect_tracking() {
2430
+ return active_reaction !== null && !untracking;
2431
+ }
2432
+ /**
2433
+ * @param {() => void} fn
2434
+ */
2435
+ function teardown(fn) {
2436
+ const effect = create_effect(8, null);
2437
+ set_signal_status(effect, CLEAN);
2438
+ effect.teardown = fn;
2439
+ return effect;
2440
+ }
2441
+ /**
2442
+ * Internal representation of `$effect(...)`
2443
+ * @param {() => void | (() => void)} fn
2444
+ */
2445
+ function user_effect(fn) {
2446
+ validate_effect("$effect");
2447
+ var flags = active_effect.f;
2448
+ if (!active_reaction && (flags & 32) !== 0 && (flags & 32768) === 0) {
2449
+ var context = component_context;
2450
+ (context.e ?? (context.e = [])).push(fn);
2451
+ } else return create_user_effect(fn);
2452
+ }
2453
+ /**
2454
+ * @param {() => void | (() => void)} fn
2455
+ */
2456
+ function create_user_effect(fn) {
2457
+ return create_effect(4 | USER_EFFECT, fn);
2458
+ }
2459
+ /**
2460
+ * Internal representation of `$effect.root(...)`
2461
+ * @param {() => void | (() => void)} fn
2462
+ * @returns {() => void}
2463
+ */
2464
+ function effect_root(fn) {
2465
+ Batch.ensure();
2466
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2467
+ return () => {
2468
+ destroy_effect(effect);
2469
+ };
2470
+ }
2471
+ /**
2472
+ * An effect root whose children can transition out
2473
+ * @param {() => void} fn
2474
+ * @returns {(options?: { outro?: boolean }) => Promise<void>}
2475
+ */
2476
+ function component_root(fn) {
2477
+ Batch.ensure();
2478
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2479
+ return (options = {}) => {
2480
+ return new Promise((fulfil) => {
2481
+ if (options.outro) pause_effect(effect, () => {
2482
+ destroy_effect(effect);
2483
+ fulfil(void 0);
2484
+ });
2485
+ else {
2486
+ destroy_effect(effect);
2487
+ fulfil(void 0);
2488
+ }
2489
+ });
2490
+ };
2491
+ }
2492
+ /**
2493
+ * @param {() => void | (() => void)} fn
2494
+ * @returns {Effect}
2495
+ */
2496
+ function effect(fn) {
2497
+ return create_effect(4, fn);
2498
+ }
2499
+ /**
2500
+ * @param {() => void | (() => void)} fn
2501
+ * @returns {Effect}
2502
+ */
2503
+ function async_effect(fn) {
2504
+ return create_effect(ASYNC | EFFECT_PRESERVED, fn);
2505
+ }
2506
+ /**
2507
+ * @param {() => void | (() => void)} fn
2508
+ * @returns {Effect}
2509
+ */
2510
+ function render_effect(fn, flags = 0) {
2511
+ return create_effect(8 | flags, fn);
2512
+ }
2513
+ /**
2514
+ * @param {(...expressions: any) => void | (() => void)} fn
2515
+ * @param {Array<() => any>} sync
2516
+ * @param {Array<() => Promise<any>>} async
2517
+ * @param {Blocker[]} blockers
2518
+ */
2519
+ function template_effect(fn, sync = [], async = [], blockers = []) {
2520
+ flatten(blockers, sync, async, (values) => {
2521
+ create_effect(8, () => fn(...values.map(get)));
2522
+ });
2523
+ }
2524
+ /**
2525
+ * @param {(() => void)} fn
2526
+ * @param {number} flags
2527
+ */
2528
+ function block(fn, flags = 0) {
2529
+ return create_effect(16 | flags, fn);
2530
+ }
2531
+ /**
2532
+ * @param {(() => void)} fn
2533
+ */
2534
+ function branch(fn) {
2535
+ return create_effect(32 | EFFECT_PRESERVED, fn);
2536
+ }
2537
+ /**
2538
+ * @param {Effect} effect
2539
+ */
2540
+ function execute_effect_teardown(effect) {
2541
+ var teardown = effect.teardown;
2542
+ if (teardown !== null) {
2543
+ const previously_destroying_effect = is_destroying_effect;
2544
+ const previous_reaction = active_reaction;
2545
+ set_is_destroying_effect(true);
2546
+ set_active_reaction(null);
2547
+ try {
2548
+ teardown.call(null);
2549
+ } finally {
2550
+ set_is_destroying_effect(previously_destroying_effect);
2551
+ set_active_reaction(previous_reaction);
2552
+ }
2553
+ }
2554
+ }
2555
+ /**
2556
+ * @param {Effect} signal
2557
+ * @param {boolean} remove_dom
2558
+ * @returns {void}
2559
+ */
2560
+ function destroy_effect_children(signal, remove_dom = false) {
2561
+ var effect = signal.first;
2562
+ signal.first = signal.last = null;
2563
+ while (effect !== null) {
2564
+ const controller = effect.ac;
2565
+ if (controller !== null) without_reactive_context(() => {
2566
+ controller.abort(STALE_REACTION);
2567
+ });
2568
+ var next = effect.next;
2569
+ if ((effect.f & 64) !== 0) effect.parent = null;
2570
+ else destroy_effect(effect, remove_dom);
2571
+ effect = next;
2572
+ }
2573
+ }
2574
+ /**
2575
+ * @param {Effect} signal
2576
+ * @returns {void}
2577
+ */
2578
+ function destroy_block_effect_children(signal) {
2579
+ var effect = signal.first;
2580
+ while (effect !== null) {
2581
+ var next = effect.next;
2582
+ if ((effect.f & 32) === 0) destroy_effect(effect);
2583
+ effect = next;
2584
+ }
2585
+ }
2586
+ /**
2587
+ * @param {Effect} effect
2588
+ * @param {boolean} [remove_dom]
2589
+ * @returns {void}
2590
+ */
2591
+ function destroy_effect(effect, remove_dom = true) {
2592
+ var removed = false;
2593
+ if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
2594
+ remove_effect_dom(effect.nodes.start, effect.nodes.end);
2595
+ removed = true;
2596
+ }
2597
+ set_signal_status(effect, DESTROYING);
2598
+ destroy_effect_children(effect, remove_dom && !removed);
2599
+ remove_reactions(effect, 0);
2600
+ var transitions = effect.nodes && effect.nodes.t;
2601
+ if (transitions !== null) for (const transition of transitions) transition.stop();
2602
+ execute_effect_teardown(effect);
2603
+ effect.f ^= DESTROYING;
2604
+ effect.f |= DESTROYED;
2605
+ var parent = effect.parent;
2606
+ if (parent !== null && parent.first !== null) unlink_effect(effect);
2607
+ effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null;
2608
+ }
2609
+ /**
2610
+ *
2611
+ * @param {TemplateNode | null} node
2612
+ * @param {TemplateNode} end
2613
+ */
2614
+ function remove_effect_dom(node, end) {
2615
+ while (node !== null) {
2616
+ /** @type {TemplateNode | null} */
2617
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
2618
+ node.remove();
2619
+ node = next;
2620
+ }
2621
+ }
2622
+ /**
2623
+ * Detach an effect from the effect tree, freeing up memory and
2624
+ * reducing the amount of work that happens on subsequent traversals
2625
+ * @param {Effect} effect
2626
+ */
2627
+ function unlink_effect(effect) {
2628
+ var parent = effect.parent;
2629
+ var prev = effect.prev;
2630
+ var next = effect.next;
2631
+ if (prev !== null) prev.next = next;
2632
+ if (next !== null) next.prev = prev;
2633
+ if (parent !== null) {
2634
+ if (parent.first === effect) parent.first = next;
2635
+ if (parent.last === effect) parent.last = prev;
2636
+ }
2637
+ }
2638
+ /**
2639
+ * When a block effect is removed, we don't immediately destroy it or yank it
2640
+ * out of the DOM, because it might have transitions. Instead, we 'pause' it.
2641
+ * It stays around (in memory, and in the DOM) until outro transitions have
2642
+ * completed, and if the state change is reversed then we _resume_ it.
2643
+ * A paused effect does not update, and the DOM subtree becomes inert.
2644
+ * @param {Effect} effect
2645
+ * @param {() => void} [callback]
2646
+ * @param {boolean} [destroy]
2647
+ */
2648
+ function pause_effect(effect, callback, destroy = true) {
2649
+ /** @type {TransitionManager[]} */
2650
+ var transitions = [];
2651
+ pause_children(effect, transitions, true);
2652
+ var fn = () => {
2653
+ if (destroy) destroy_effect(effect);
2654
+ if (callback) callback();
2655
+ };
2656
+ var remaining = transitions.length;
2657
+ if (remaining > 0) {
2658
+ var check = () => --remaining || fn();
2659
+ for (var transition of transitions) transition.out(check);
2660
+ } else fn();
2661
+ }
2662
+ /**
2663
+ * @param {Effect} effect
2664
+ * @param {TransitionManager[]} transitions
2665
+ * @param {boolean} local
2666
+ */
2667
+ function pause_children(effect, transitions, local) {
2668
+ if ((effect.f & 8192) !== 0) return;
2669
+ effect.f ^= INERT;
2670
+ var t = effect.nodes && effect.nodes.t;
2671
+ if (t !== null) {
2672
+ for (const transition of t) if (transition.is_global || local) transitions.push(transition);
2673
+ }
2674
+ var child = effect.first;
2675
+ while (child !== null) {
2676
+ var sibling = child.next;
2677
+ var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
2678
+ pause_children(child, transitions, transparent ? local : false);
2679
+ child = sibling;
2680
+ }
2681
+ }
2682
+ /**
2683
+ * The opposite of `pause_effect`. We call this if (for example)
2684
+ * `x` becomes falsy then truthy: `{#if x}...{/if}`
2685
+ * @param {Effect} effect
2686
+ */
2687
+ function resume_effect(effect) {
2688
+ resume_children(effect, true);
2689
+ }
2690
+ /**
2691
+ * @param {Effect} effect
2692
+ * @param {boolean} local
2693
+ */
2694
+ function resume_children(effect, local) {
2695
+ if ((effect.f & 8192) === 0) return;
2696
+ effect.f ^= INERT;
2697
+ if ((effect.f & 1024) === 0) {
2698
+ set_signal_status(effect, DIRTY);
2699
+ Batch.ensure().schedule(effect);
2700
+ }
2701
+ var child = effect.first;
2702
+ while (child !== null) {
2703
+ var sibling = child.next;
2704
+ var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0;
2705
+ resume_children(child, transparent ? local : false);
2706
+ child = sibling;
2707
+ }
2708
+ var t = effect.nodes && effect.nodes.t;
2709
+ if (t !== null) {
2710
+ for (const transition of t) if (transition.is_global || local) transition.in();
2711
+ }
2712
+ }
2713
+ /**
2714
+ * @param {Effect} effect
2715
+ * @param {DocumentFragment} fragment
2716
+ */
2717
+ function move_effect(effect, fragment) {
2718
+ if (!effect.nodes) return;
2719
+ /** @type {TemplateNode | null} */
2720
+ var node = effect.nodes.start;
2721
+ var end = effect.nodes.end;
2722
+ while (node !== null) {
2723
+ /** @type {TemplateNode | null} */
2724
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
2725
+ fragment.append(node);
2726
+ node = next;
2727
+ }
2728
+ }
2729
+ //#endregion
2730
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/legacy.js
2731
+ /**
2732
+ * @type {Set<Value> | null}
2733
+ * @deprecated
2734
+ */
2735
+ var captured_signals = null;
2736
+ //#endregion
2737
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/runtime.js
2738
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2739
+ var is_updating_effect = false;
2740
+ var is_destroying_effect = false;
2741
+ /** @param {boolean} value */
2742
+ function set_is_destroying_effect(value) {
2743
+ is_destroying_effect = value;
2744
+ }
2745
+ /** @type {null | Reaction} */
2746
+ var active_reaction = null;
2747
+ var untracking = false;
2748
+ /** @param {null | Reaction} reaction */
2749
+ function set_active_reaction(reaction) {
2750
+ active_reaction = reaction;
2751
+ }
2752
+ /** @type {null | Effect} */
2753
+ var active_effect = null;
2754
+ /** @param {null | Effect} effect */
2755
+ function set_active_effect(effect) {
2756
+ active_effect = effect;
2757
+ }
2758
+ /**
2759
+ * When sources are created within a reaction, reading and writing
2760
+ * them within that reaction should not cause a re-run
2761
+ * @type {null | Source[]}
2762
+ */
2763
+ var current_sources = null;
2764
+ /** @param {Value} value */
2765
+ function push_reaction_value(value) {
2766
+ if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) if (current_sources === null) current_sources = [value];
2767
+ else current_sources.push(value);
2768
+ }
2769
+ /**
2770
+ * The dependencies of the reaction that is currently being executed. In many cases,
2771
+ * the dependencies are unchanged between runs, and so this will be `null` unless
2772
+ * and until a new dependency is accessed — we track this via `skipped_deps`
2773
+ * @type {null | Value[]}
2774
+ */
2775
+ var new_deps = null;
2776
+ var skipped_deps = 0;
2777
+ /**
2778
+ * Tracks writes that the effect it's executed in doesn't listen to yet,
2779
+ * so that the dependency can be added to the effect later on if it then reads it
2780
+ * @type {null | Source[]}
2781
+ */
2782
+ var untracked_writes = null;
2783
+ /** @param {null | Source[]} value */
2784
+ function set_untracked_writes(value) {
2785
+ untracked_writes = value;
2786
+ }
2787
+ /**
2788
+ * @type {number} Used by sources and deriveds for handling updates.
2789
+ * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
2790
+ **/
2791
+ var write_version = 1;
2792
+ /** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
2793
+ var read_version = 0;
2794
+ var update_version = read_version;
2795
+ /** @param {number} value */
2796
+ function set_update_version(value) {
2797
+ update_version = value;
2798
+ }
2799
+ function increment_write_version() {
2800
+ return ++write_version;
2801
+ }
2802
+ /**
2803
+ * Determines whether a derived or effect is dirty.
2804
+ * If it is MAYBE_DIRTY, will set the status to CLEAN
2805
+ * @param {Reaction} reaction
2806
+ * @returns {boolean}
2807
+ */
2808
+ function is_dirty(reaction) {
2809
+ var flags = reaction.f;
2810
+ if ((flags & 2048) !== 0) return true;
2811
+ if (flags & 2) reaction.f &= ~WAS_MARKED;
2812
+ if ((flags & 4096) !== 0) {
2813
+ var dependencies = reaction.deps;
2814
+ var length = dependencies.length;
2815
+ for (var i = 0; i < length; i++) {
2816
+ var dependency = dependencies[i];
2817
+ if (is_dirty(dependency)) update_derived(dependency);
2818
+ if (dependency.wv > reaction.wv) return true;
2819
+ }
2820
+ if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
2821
+ }
2822
+ return false;
2823
+ }
2824
+ /**
2825
+ * @param {Value} signal
2826
+ * @param {Effect} effect
2827
+ * @param {boolean} [root]
2828
+ */
2829
+ function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
2830
+ var reactions = signal.reactions;
2831
+ if (reactions === null) return;
2832
+ if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) return;
2833
+ for (var i = 0; i < reactions.length; i++) {
2834
+ var reaction = reactions[i];
2835
+ if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
2836
+ else if (effect === reaction) {
2837
+ if (root) set_signal_status(reaction, DIRTY);
2838
+ else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY);
2839
+ schedule_effect(reaction);
2840
+ }
2841
+ }
2842
+ }
2843
+ /** @param {Reaction} reaction */
2844
+ function update_reaction(reaction) {
2845
+ var previous_deps = new_deps;
2846
+ var previous_skipped_deps = skipped_deps;
2847
+ var previous_untracked_writes = untracked_writes;
2848
+ var previous_reaction = active_reaction;
2849
+ var previous_sources = current_sources;
2850
+ var previous_component_context = component_context;
2851
+ var previous_untracking = untracking;
2852
+ var previous_update_version = update_version;
2853
+ var flags = reaction.f;
2854
+ new_deps = null;
2855
+ skipped_deps = 0;
2856
+ untracked_writes = null;
2857
+ active_reaction = (flags & 96) === 0 ? reaction : null;
2858
+ current_sources = null;
2859
+ set_component_context(reaction.ctx);
2860
+ untracking = false;
2861
+ update_version = ++read_version;
2862
+ if (reaction.ac !== null) {
2863
+ without_reactive_context(() => {
2864
+ /** @type {AbortController} */ reaction.ac.abort(STALE_REACTION);
2865
+ });
2866
+ reaction.ac = null;
2867
+ }
2868
+ try {
2869
+ reaction.f |= REACTION_IS_UPDATING;
2870
+ var fn = reaction.fn;
2871
+ var result = fn();
2872
+ reaction.f |= REACTION_RAN;
2873
+ var deps = reaction.deps;
2874
+ var is_fork = current_batch?.is_fork;
2875
+ if (new_deps !== null) {
2876
+ var i;
2877
+ if (!is_fork) remove_reactions(reaction, skipped_deps);
2878
+ if (deps !== null && skipped_deps > 0) {
2879
+ deps.length = skipped_deps + new_deps.length;
2880
+ for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
2881
+ } else reaction.deps = deps = new_deps;
2882
+ if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) {
2883
+ var _deps$i;
2884
+ ((_deps$i = deps[i]).reactions ?? (_deps$i.reactions = [])).push(reaction);
2885
+ }
2886
+ } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
2887
+ remove_reactions(reaction, skipped_deps);
2888
+ deps.length = skipped_deps;
2889
+ }
2890
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
2891
+ if (previous_reaction !== null && previous_reaction !== reaction) {
2892
+ read_version++;
2893
+ if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
2894
+ if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version;
2895
+ if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
2896
+ else previous_untracked_writes.push(...untracked_writes);
2897
+ }
2898
+ if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
2899
+ return result;
2900
+ } catch (error) {
2901
+ return handle_error(error);
2902
+ } finally {
2903
+ reaction.f ^= REACTION_IS_UPDATING;
2904
+ new_deps = previous_deps;
2905
+ skipped_deps = previous_skipped_deps;
2906
+ untracked_writes = previous_untracked_writes;
2907
+ active_reaction = previous_reaction;
2908
+ current_sources = previous_sources;
2909
+ set_component_context(previous_component_context);
2910
+ untracking = previous_untracking;
2911
+ update_version = previous_update_version;
2912
+ }
2913
+ }
2914
+ /**
2915
+ * @template V
2916
+ * @param {Reaction} signal
2917
+ * @param {Value<V>} dependency
2918
+ * @returns {void}
2919
+ */
2920
+ function remove_reaction(signal, dependency) {
2921
+ let reactions = dependency.reactions;
2922
+ if (reactions !== null) {
2923
+ var index = index_of.call(reactions, signal);
2924
+ if (index !== -1) {
2925
+ var new_length = reactions.length - 1;
2926
+ if (new_length === 0) reactions = dependency.reactions = null;
2927
+ else {
2928
+ reactions[index] = reactions[new_length];
2929
+ reactions.pop();
2930
+ }
2931
+ }
2932
+ }
2933
+ if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2934
+ var derived = dependency;
2935
+ if ((derived.f & 512) !== 0) {
2936
+ derived.f ^= 512;
2937
+ derived.f &= ~WAS_MARKED;
2938
+ }
2939
+ update_derived_status(derived);
2940
+ freeze_derived_effects(derived);
2941
+ remove_reactions(derived, 0);
2942
+ }
2943
+ }
2944
+ /**
2945
+ * @param {Reaction} signal
2946
+ * @param {number} start_index
2947
+ * @returns {void}
2948
+ */
2949
+ function remove_reactions(signal, start_index) {
2950
+ var dependencies = signal.deps;
2951
+ if (dependencies === null) return;
2952
+ for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
2953
+ }
2954
+ /**
2955
+ * @param {Effect} effect
2956
+ * @returns {void}
2957
+ */
2958
+ function update_effect(effect) {
2959
+ var flags = effect.f;
2960
+ if ((flags & 16384) !== 0) return;
2961
+ set_signal_status(effect, CLEAN);
2962
+ var previous_effect = active_effect;
2963
+ var was_updating_effect = is_updating_effect;
2964
+ active_effect = effect;
2965
+ is_updating_effect = true;
2966
+ try {
2967
+ if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2968
+ else destroy_effect_children(effect);
2969
+ execute_effect_teardown(effect);
2970
+ var teardown = update_reaction(effect);
2971
+ effect.teardown = typeof teardown === "function" ? teardown : null;
2972
+ effect.wv = write_version;
2973
+ } finally {
2974
+ is_updating_effect = was_updating_effect;
2975
+ active_effect = previous_effect;
2976
+ }
2977
+ }
2978
+ /**
2979
+ * @template V
2980
+ * @param {Value<V>} signal
2981
+ * @returns {V}
2982
+ */
2983
+ function get(signal) {
2984
+ var is_derived = (signal.f & 2) !== 0;
2985
+ captured_signals?.add(signal);
2986
+ if (active_reaction !== null && !untracking) {
2987
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
2988
+ var deps = active_reaction.deps;
2989
+ if ((active_reaction.f & 2097152) !== 0) {
2990
+ if (signal.rv < read_version) {
2991
+ signal.rv = read_version;
2992
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
2993
+ else if (new_deps === null) new_deps = [signal];
2994
+ else new_deps.push(signal);
2995
+ }
2996
+ } else {
2997
+ var _active_reaction;
2998
+ ((_active_reaction = active_reaction).deps ?? (_active_reaction.deps = [])).push(signal);
2999
+ var reactions = signal.reactions;
3000
+ if (reactions === null) signal.reactions = [active_reaction];
3001
+ else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
3002
+ }
3003
+ }
3004
+ }
3005
+ if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
3006
+ if (is_derived) {
3007
+ var derived = signal;
3008
+ if (is_destroying_effect) {
3009
+ var value = derived.v;
3010
+ if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
3011
+ old_values.set(derived, value);
3012
+ return value;
3013
+ }
3014
+ var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
3015
+ var is_new = (derived.f & REACTION_RAN) === 0;
3016
+ if (is_dirty(derived)) {
3017
+ if (should_connect) derived.f |= 512;
3018
+ update_derived(derived);
3019
+ }
3020
+ if (should_connect && !is_new) {
3021
+ unfreeze_derived_effects(derived);
3022
+ reconnect(derived);
3023
+ }
3024
+ }
3025
+ if (batch_values?.has(signal)) return batch_values.get(signal);
3026
+ if ((signal.f & 8388608) !== 0) throw signal.v;
3027
+ return signal.v;
3028
+ }
3029
+ /**
3030
+ * (Re)connect a disconnected derived, so that it is notified
3031
+ * of changes in `mark_reactions`
3032
+ * @param {Derived} derived
3033
+ */
3034
+ function reconnect(derived) {
3035
+ derived.f |= 512;
3036
+ if (derived.deps === null) return;
3037
+ for (const dep of derived.deps) {
3038
+ (dep.reactions ?? (dep.reactions = [])).push(derived);
3039
+ if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
3040
+ unfreeze_derived_effects(dep);
3041
+ reconnect(dep);
3042
+ }
3043
+ }
3044
+ }
3045
+ /** @param {Derived} derived */
3046
+ function depends_on_old_values(derived) {
3047
+ if (derived.v === UNINITIALIZED) return true;
3048
+ if (derived.deps === null) return false;
3049
+ for (const dep of derived.deps) {
3050
+ if (old_values.has(dep)) return true;
3051
+ if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
3052
+ }
3053
+ return false;
3054
+ }
3055
+ /**
3056
+ * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
3057
+ * any state read inside `fn` will not be treated as a dependency.
3058
+ *
3059
+ * ```ts
3060
+ * $effect(() => {
3061
+ * // this will run when `data` changes, but not when `time` changes
3062
+ * save(data, {
3063
+ * timestamp: untrack(() => time)
3064
+ * });
3065
+ * });
3066
+ * ```
3067
+ * @template T
3068
+ * @param {() => T} fn
3069
+ * @returns {T}
3070
+ */
3071
+ function untrack(fn) {
3072
+ var previous_untracking = untracking;
3073
+ try {
3074
+ untracking = true;
3075
+ return fn();
3076
+ } finally {
3077
+ untracking = previous_untracking;
3078
+ }
3079
+ }
3080
+ //#endregion
3081
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/events.js
3082
+ /**
3083
+ * Used on elements, as a map of event type -> event handler,
3084
+ * and on events themselves to track which element handled an event
3085
+ */
3086
+ var event_symbol = Symbol("events");
3087
+ /** @type {Set<string>} */
3088
+ var all_registered_events = /* @__PURE__ */ new Set();
3089
+ /** @type {Set<(events: Array<string>) => void>} */
3090
+ var root_event_handles = /* @__PURE__ */ new Set();
3091
+ var last_propagated_event = null;
3092
+ /**
3093
+ * @this {EventTarget}
3094
+ * @param {Event} event
3095
+ * @returns {void}
3096
+ */
3097
+ function handle_event_propagation(event) {
3098
+ var handler_element = this;
3099
+ var owner_document = handler_element.ownerDocument;
3100
+ var event_name = event.type;
3101
+ var path = event.composedPath?.() || [];
3102
+ var current_target = path[0] || event.target;
3103
+ last_propagated_event = event;
3104
+ var path_idx = 0;
3105
+ var handled_at = last_propagated_event === event && event[event_symbol];
3106
+ if (handled_at) {
3107
+ var at_idx = path.indexOf(handled_at);
3108
+ if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
3109
+ event[event_symbol] = handler_element;
3110
+ return;
3111
+ }
3112
+ var handler_idx = path.indexOf(handler_element);
3113
+ if (handler_idx === -1) return;
3114
+ if (at_idx <= handler_idx) path_idx = at_idx;
3115
+ }
3116
+ current_target = path[path_idx] || event.target;
3117
+ if (current_target === handler_element) return;
3118
+ define_property(event, "currentTarget", {
3119
+ configurable: true,
3120
+ get() {
3121
+ return current_target || owner_document;
3122
+ }
3123
+ });
3124
+ var previous_reaction = active_reaction;
3125
+ var previous_effect = active_effect;
3126
+ set_active_reaction(null);
3127
+ set_active_effect(null);
3128
+ try {
3129
+ /**
3130
+ * @type {unknown}
3131
+ */
3132
+ var throw_error;
3133
+ /**
3134
+ * @type {unknown[]}
3135
+ */
3136
+ var other_errors = [];
3137
+ while (current_target !== null) {
3138
+ /** @type {null | Element} */
3139
+ var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
3140
+ try {
3141
+ var delegated = current_target[event_symbol]?.[event_name];
3142
+ if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
3143
+ } catch (error) {
3144
+ if (throw_error) other_errors.push(error);
3145
+ else throw_error = error;
3146
+ }
3147
+ if (event.cancelBubble || parent_element === handler_element || parent_element === null) break;
3148
+ current_target = parent_element;
3149
+ }
3150
+ if (throw_error) {
3151
+ for (let error of other_errors) queueMicrotask(() => {
3152
+ throw error;
3153
+ });
3154
+ throw throw_error;
3155
+ }
3156
+ } finally {
3157
+ event[event_symbol] = handler_element;
3158
+ delete event.currentTarget;
3159
+ set_active_reaction(previous_reaction);
3160
+ set_active_effect(previous_effect);
3161
+ }
3162
+ }
3163
+ //#endregion
3164
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/reconciler.js
3165
+ var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (html) => {
3166
+ return html;
3167
+ } });
3168
+ /** @param {string} html */
3169
+ function create_trusted_html(html) {
3170
+ return policy?.createHTML(html) ?? html;
3171
+ }
3172
+ /**
3173
+ * @param {string} html
3174
+ */
3175
+ function create_fragment_from_html(html) {
3176
+ var elem = create_element("template");
3177
+ elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
3178
+ return elem.content;
3179
+ }
3180
+ //#endregion
3181
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/template.js
3182
+ /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
3183
+ /** @import { TemplateStructure } from './types' */
3184
+ /**
3185
+ * @param {TemplateNode} start
3186
+ * @param {TemplateNode | null} end
3187
+ */
3188
+ function assign_nodes(start, end) {
3189
+ var effect = active_effect;
3190
+ if (effect.nodes === null) effect.nodes = {
3191
+ start,
3192
+ end,
3193
+ a: null,
3194
+ t: null
3195
+ };
3196
+ }
3197
+ /**
3198
+ * @param {string} content
3199
+ * @param {number} flags
3200
+ * @returns {() => Node | Node[]}
3201
+ */
3202
+ /* @__NO_SIDE_EFFECTS__ */
3203
+ function from_html(content, flags) {
3204
+ var is_fragment = (flags & 1) !== 0;
3205
+ var use_import_node = (flags & 2) !== 0;
3206
+ /** @type {Node} */
3207
+ var node;
3208
+ /**
3209
+ * Whether or not the first item is a text/element node. If not, we need to
3210
+ * create an additional comment node to act as `effect.nodes.start`
3211
+ */
3212
+ var has_start = !content.startsWith("<!>");
3213
+ return () => {
3214
+ if (hydrating) {
3215
+ assign_nodes(hydrate_node, null);
3216
+ return hydrate_node;
3217
+ }
3218
+ if (node === void 0) {
3219
+ node = create_fragment_from_html(has_start ? content : "<!>" + content);
3220
+ if (!is_fragment) node = /* @__PURE__ */ get_first_child(node);
3221
+ }
3222
+ var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true);
3223
+ if (is_fragment) {
3224
+ var start = /* @__PURE__ */ get_first_child(clone);
3225
+ var end = clone.lastChild;
3226
+ assign_nodes(start, end);
3227
+ } else assign_nodes(clone, clone);
3228
+ return clone;
3229
+ };
3230
+ }
3231
+ /**
3232
+ * Don't mark this as side-effect-free, hydration needs to walk all nodes
3233
+ * @param {any} value
3234
+ */
3235
+ function text(value = "") {
3236
+ if (!hydrating) {
3237
+ var t = create_text(value + "");
3238
+ assign_nodes(t, t);
3239
+ return t;
3240
+ }
3241
+ var node = hydrate_node;
3242
+ if (node.nodeType !== 3) {
3243
+ node.before(node = create_text());
3244
+ set_hydrate_node(node);
3245
+ } else merge_text_nodes(node);
3246
+ assign_nodes(node, node);
3247
+ return node;
3248
+ }
3249
+ /**
3250
+ * @returns {TemplateNode | DocumentFragment}
3251
+ */
3252
+ function comment() {
3253
+ if (hydrating) {
3254
+ assign_nodes(hydrate_node, null);
3255
+ return hydrate_node;
3256
+ }
3257
+ var frag = document.createDocumentFragment();
3258
+ var start = document.createComment("");
3259
+ var anchor = create_text();
3260
+ frag.append(start, anchor);
3261
+ assign_nodes(start, anchor);
3262
+ return frag;
3263
+ }
3264
+ /**
3265
+ * Assign the created (or in hydration mode, traversed) dom elements to the current block
3266
+ * and insert the elements into the dom (in client mode).
3267
+ * @param {Text | Comment | Element} anchor
3268
+ * @param {DocumentFragment | Element} dom
3269
+ */
3270
+ function append(anchor, dom) {
3271
+ if (hydrating) {
3272
+ var effect = active_effect;
3273
+ if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node;
3274
+ hydrate_next();
3275
+ return;
3276
+ }
3277
+ if (anchor === null) return;
3278
+ anchor.before(dom);
3279
+ }
3280
+ /**
3281
+ * Subset of delegated events which should be passive by default.
3282
+ * These two are already passive via browser defaults on window, document and body.
3283
+ * But since
3284
+ * - we're delegating them
3285
+ * - they happen often
3286
+ * - they apply to mobile which is generally less performant
3287
+ * we're marking them as passive by default for other elements, too.
3288
+ */
3289
+ var PASSIVE_EVENTS = ["touchstart", "touchmove"];
3290
+ /**
3291
+ * Returns `true` if `name` is a passive event
3292
+ * @param {string} name
3293
+ */
3294
+ function is_passive_event(name) {
3295
+ return PASSIVE_EVENTS.includes(name);
3296
+ }
3297
+ /**
3298
+ * @param {Element} text
3299
+ * @param {string} value
3300
+ * @returns {void}
3301
+ */
3302
+ function set_text(text, value) {
3303
+ var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
3304
+ if (str !== (text.__t ?? (text.__t = text.nodeValue))) {
3305
+ text.__t = str;
3306
+ text.nodeValue = `${str}`;
3307
+ }
3308
+ }
3309
+ /**
3310
+ * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.
3311
+ * Transitions will play during the initial render unless the `intro` option is set to `false`.
3312
+ *
3313
+ * @template {Record<string, any>} Props
3314
+ * @template {Record<string, any>} Exports
3315
+ * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component
3316
+ * @param {MountOptions<Props>} options
3317
+ * @returns {Exports}
3318
+ */
3319
+ function mount(component, options) {
3320
+ return _mount(component, options);
3321
+ }
3322
+ /**
3323
+ * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component
3324
+ *
3325
+ * @template {Record<string, any>} Props
3326
+ * @template {Record<string, any>} Exports
3327
+ * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component
3328
+ * @param {{} extends Props ? {
3329
+ * target: Document | Element | ShadowRoot;
3330
+ * props?: Props;
3331
+ * events?: Record<string, (e: any) => any>;
3332
+ * context?: Map<any, any>;
3333
+ * intro?: boolean;
3334
+ * recover?: boolean;
3335
+ * transformError?: (error: unknown) => unknown;
3336
+ * } : {
3337
+ * target: Document | Element | ShadowRoot;
3338
+ * props: Props;
3339
+ * events?: Record<string, (e: any) => any>;
3340
+ * context?: Map<any, any>;
3341
+ * intro?: boolean;
3342
+ * recover?: boolean;
3343
+ * transformError?: (error: unknown) => unknown;
3344
+ * }} options
3345
+ * @returns {Exports}
3346
+ */
3347
+ function hydrate(component, options) {
3348
+ init_operations();
3349
+ options.intro = options.intro ?? false;
3350
+ const target = options.target;
3351
+ const was_hydrating = hydrating;
3352
+ const previous_hydrate_node = hydrate_node;
3353
+ try {
3354
+ var anchor = /* @__PURE__ */ get_first_child(target);
3355
+ while (anchor && (anchor.nodeType !== 8 || anchor.data !== "[")) anchor = /* @__PURE__ */ get_next_sibling(anchor);
3356
+ if (!anchor) throw HYDRATION_ERROR;
3357
+ set_hydrating(true);
3358
+ set_hydrate_node(anchor);
3359
+ const instance = _mount(component, {
3360
+ ...options,
3361
+ anchor
3362
+ });
3363
+ set_hydrating(false);
3364
+ return instance;
3365
+ } catch (error) {
3366
+ if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) throw error;
3367
+ if (error !== HYDRATION_ERROR) console.warn("Failed to hydrate: ", error);
3368
+ if (options.recover === false) hydration_failed();
3369
+ init_operations();
3370
+ clear_text_content(target);
3371
+ set_hydrating(false);
3372
+ return mount(component, options);
3373
+ } finally {
3374
+ set_hydrating(was_hydrating);
3375
+ set_hydrate_node(previous_hydrate_node);
3376
+ }
3377
+ }
3378
+ /** @type {Map<EventTarget, Map<string, number>>} */
3379
+ var listeners = /* @__PURE__ */ new Map();
3380
+ /**
3381
+ * @template {Record<string, any>} Exports
3382
+ * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component
3383
+ * @param {MountOptions} options
3384
+ * @returns {Exports}
3385
+ */
3386
+ function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
3387
+ init_operations();
3388
+ /** @type {Exports} */
3389
+ var component = void 0;
3390
+ var unmount = component_root(() => {
3391
+ var anchor_node = anchor ?? target.appendChild(create_text());
3392
+ boundary(anchor_node, { pending: () => {} }, (anchor_node) => {
3393
+ push({});
3394
+ var ctx = component_context;
3395
+ if (context) ctx.c = context;
3396
+ if (events)
3397
+ /** @type {any} */ props.$$events = events;
3398
+ if (hydrating) assign_nodes(anchor_node, null);
3399
+ component = Component(anchor_node, props) || {};
3400
+ if (hydrating) {
3401
+ /** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = hydrate_node;
3402
+ if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") {
3403
+ hydration_mismatch();
3404
+ throw HYDRATION_ERROR;
3405
+ }
3406
+ }
3407
+ pop();
3408
+ }, transformError);
3409
+ /** @type {Set<string>} */
3410
+ var registered_events = /* @__PURE__ */ new Set();
3411
+ /** @param {Array<string>} events */
3412
+ var event_handle = (events) => {
3413
+ for (var i = 0; i < events.length; i++) {
3414
+ var event_name = events[i];
3415
+ if (registered_events.has(event_name)) continue;
3416
+ registered_events.add(event_name);
3417
+ var passive = is_passive_event(event_name);
3418
+ for (const node of [target, document]) {
3419
+ var counts = listeners.get(node);
3420
+ if (counts === void 0) {
3421
+ counts = /* @__PURE__ */ new Map();
3422
+ listeners.set(node, counts);
3423
+ }
3424
+ var count = counts.get(event_name);
3425
+ if (count === void 0) {
3426
+ node.addEventListener(event_name, handle_event_propagation, { passive });
3427
+ counts.set(event_name, 1);
3428
+ } else counts.set(event_name, count + 1);
3429
+ }
3430
+ }
3431
+ };
3432
+ event_handle(array_from(all_registered_events));
3433
+ root_event_handles.add(event_handle);
3434
+ return () => {
3435
+ for (var event_name of registered_events) for (const node of [target, document]) {
3436
+ var counts = listeners.get(node);
3437
+ var count = counts.get(event_name);
3438
+ if (--count == 0) {
3439
+ node.removeEventListener(event_name, handle_event_propagation);
3440
+ counts.delete(event_name);
3441
+ if (counts.size === 0) listeners.delete(node);
3442
+ } else counts.set(event_name, count);
3443
+ }
3444
+ root_event_handles.delete(event_handle);
3445
+ if (anchor_node !== anchor) anchor_node.parentNode?.removeChild(anchor_node);
3446
+ };
3447
+ });
3448
+ mounted_components.set(component, unmount);
3449
+ return component;
3450
+ }
3451
+ /**
3452
+ * References of the components that were mounted or hydrated.
3453
+ * Uses a `WeakMap` to avoid memory leaks.
3454
+ */
3455
+ var mounted_components = /* @__PURE__ */ new WeakMap();
3456
+ /**
3457
+ * Unmounts a component that was previously mounted using `mount` or `hydrate`.
3458
+ *
3459
+ * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.
3460
+ *
3461
+ * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).
3462
+ *
3463
+ * ```js
3464
+ * import { mount, unmount } from 'svelte';
3465
+ * import App from './App.svelte';
3466
+ *
3467
+ * const app = mount(App, { target: document.body });
3468
+ *
3469
+ * // later...
3470
+ * unmount(app, { outro: true });
3471
+ * ```
3472
+ * @param {Record<string, any>} component
3473
+ * @param {{ outro?: boolean }} [options]
3474
+ * @returns {Promise<void>}
3475
+ */
3476
+ function unmount(component, options) {
3477
+ const fn = mounted_components.get(component);
3478
+ if (fn) {
3479
+ mounted_components.delete(component);
3480
+ return fn(options);
3481
+ }
3482
+ return Promise.resolve();
3483
+ }
3484
+ //#endregion
3485
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3486
+ /** @import { Effect, TemplateNode } from '#client' */
3487
+ var _batches = /* @__PURE__ */ new WeakMap();
3488
+ var _onscreen = /* @__PURE__ */ new WeakMap();
3489
+ var _offscreen = /* @__PURE__ */ new WeakMap();
3490
+ var _outroing = /* @__PURE__ */ new WeakMap();
3491
+ var _transition = /* @__PURE__ */ new WeakMap();
3492
+ var _commit = /* @__PURE__ */ new WeakMap();
3493
+ var _discard = /* @__PURE__ */ new WeakMap();
3494
+ /**
3495
+ * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch
3496
+ */
3497
+ /**
3498
+ * @template Key
3499
+ */
3500
+ var BranchManager = class {
3501
+ /**
3502
+ * @param {TemplateNode} anchor
3503
+ * @param {boolean} transition
3504
+ */
3505
+ constructor(anchor, transition = true) {
3506
+ _defineProperty(
3507
+ this,
3508
+ /** @type {TemplateNode} */
3509
+ "anchor",
3510
+ void 0
3511
+ );
3512
+ _classPrivateFieldInitSpec(this, _batches, /* @__PURE__ */ new Map());
3513
+ _classPrivateFieldInitSpec(this, _onscreen, /* @__PURE__ */ new Map());
3514
+ _classPrivateFieldInitSpec(this, _offscreen, /* @__PURE__ */ new Map());
3515
+ _classPrivateFieldInitSpec(this, _outroing, /* @__PURE__ */ new Set());
3516
+ _classPrivateFieldInitSpec(this, _transition, true);
3517
+ _classPrivateFieldInitSpec(this, _commit, (batch) => {
3518
+ if (!_classPrivateFieldGet2(_batches, this).has(batch)) return;
3519
+ var key = _classPrivateFieldGet2(_batches, this).get(batch);
3520
+ var onscreen = _classPrivateFieldGet2(_onscreen, this).get(key);
3521
+ if (onscreen) {
3522
+ resume_effect(onscreen);
3523
+ _classPrivateFieldGet2(_outroing, this).delete(key);
3524
+ } else {
3525
+ var offscreen = _classPrivateFieldGet2(_offscreen, this).get(key);
3526
+ if (offscreen) {
3527
+ _classPrivateFieldGet2(_onscreen, this).set(key, offscreen.effect);
3528
+ _classPrivateFieldGet2(_offscreen, this).delete(key);
3529
+ /** @type {TemplateNode} */ offscreen.fragment.lastChild.remove();
3530
+ this.anchor.before(offscreen.fragment);
3531
+ onscreen = offscreen.effect;
3532
+ }
3533
+ }
3534
+ for (const [b, k] of _classPrivateFieldGet2(_batches, this)) {
3535
+ _classPrivateFieldGet2(_batches, this).delete(b);
3536
+ if (b === batch) break;
3537
+ const offscreen = _classPrivateFieldGet2(_offscreen, this).get(k);
3538
+ if (offscreen) {
3539
+ destroy_effect(offscreen.effect);
3540
+ _classPrivateFieldGet2(_offscreen, this).delete(k);
3541
+ }
3542
+ }
3543
+ for (const [k, effect] of _classPrivateFieldGet2(_onscreen, this)) {
3544
+ if (k === key || _classPrivateFieldGet2(_outroing, this).has(k)) continue;
3545
+ const on_destroy = () => {
3546
+ if (Array.from(_classPrivateFieldGet2(_batches, this).values()).includes(k)) {
3547
+ var fragment = document.createDocumentFragment();
3548
+ move_effect(effect, fragment);
3549
+ fragment.append(create_text());
3550
+ _classPrivateFieldGet2(_offscreen, this).set(k, {
3551
+ effect,
3552
+ fragment
3553
+ });
3554
+ } else destroy_effect(effect);
3555
+ _classPrivateFieldGet2(_outroing, this).delete(k);
3556
+ _classPrivateFieldGet2(_onscreen, this).delete(k);
3557
+ };
3558
+ if (_classPrivateFieldGet2(_transition, this) || !onscreen) {
3559
+ _classPrivateFieldGet2(_outroing, this).add(k);
3560
+ pause_effect(effect, on_destroy, false);
3561
+ } else on_destroy();
3562
+ }
3563
+ });
3564
+ _classPrivateFieldInitSpec(this, _discard, (batch) => {
3565
+ _classPrivateFieldGet2(_batches, this).delete(batch);
3566
+ const keys = Array.from(_classPrivateFieldGet2(_batches, this).values());
3567
+ for (const [k, branch] of _classPrivateFieldGet2(_offscreen, this)) if (!keys.includes(k)) {
3568
+ destroy_effect(branch.effect);
3569
+ _classPrivateFieldGet2(_offscreen, this).delete(k);
3570
+ }
3571
+ });
3572
+ this.anchor = anchor;
3573
+ _classPrivateFieldSet2(_transition, this, transition);
3574
+ }
3575
+ /**
3576
+ *
3577
+ * @param {any} key
3578
+ * @param {null | ((target: TemplateNode) => void)} fn
3579
+ */
3580
+ ensure(key, fn) {
3581
+ var batch = current_batch;
3582
+ var defer = should_defer_append();
3583
+ if (fn && !_classPrivateFieldGet2(_onscreen, this).has(key) && !_classPrivateFieldGet2(_offscreen, this).has(key)) if (defer) {
3584
+ var fragment = document.createDocumentFragment();
3585
+ var target = create_text();
3586
+ fragment.append(target);
3587
+ _classPrivateFieldGet2(_offscreen, this).set(key, {
3588
+ effect: branch(() => fn(target)),
3589
+ fragment
3590
+ });
3591
+ } else _classPrivateFieldGet2(_onscreen, this).set(key, branch(() => fn(this.anchor)));
3592
+ _classPrivateFieldGet2(_batches, this).set(batch, key);
3593
+ if (defer) {
3594
+ for (const [k, effect] of _classPrivateFieldGet2(_onscreen, this)) if (k === key) batch.unskip_effect(effect);
3595
+ else batch.skip_effect(effect);
3596
+ for (const [k, branch] of _classPrivateFieldGet2(_offscreen, this)) if (k === key) batch.unskip_effect(branch.effect);
3597
+ else batch.skip_effect(branch.effect);
3598
+ batch.oncommit(_classPrivateFieldGet2(_commit, this));
3599
+ batch.ondiscard(_classPrivateFieldGet2(_discard, this));
3600
+ } else {
3601
+ if (hydrating) this.anchor = hydrate_node;
3602
+ _classPrivateFieldGet2(_commit, this).call(this, batch);
3603
+ }
3604
+ }
3605
+ };
3606
+ //#endregion
3607
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/if.js
3608
+ /** @import { TemplateNode } from '#client' */
3609
+ /**
3610
+ * @param {TemplateNode} node
3611
+ * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn
3612
+ * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'
3613
+ * @returns {void}
3614
+ */
3615
+ function if_block(node, fn, elseif = false) {
3616
+ /** @type {TemplateNode | undefined} */
3617
+ var marker;
3618
+ if (hydrating) {
3619
+ marker = hydrate_node;
3620
+ hydrate_next();
3621
+ }
3622
+ var branches = new BranchManager(node);
3623
+ var flags = elseif ? EFFECT_TRANSPARENT : 0;
3624
+ /**
3625
+ * @param {number | false} key
3626
+ * @param {null | ((anchor: Node) => void)} fn
3627
+ */
3628
+ function update_branch(key, fn) {
3629
+ if (hydrating) {
3630
+ var data = read_hydration_instruction(marker);
3631
+ if (key !== parseInt(data.substring(1))) {
3632
+ var anchor = skip_nodes();
3633
+ set_hydrate_node(anchor);
3634
+ branches.anchor = anchor;
3635
+ set_hydrating(false);
3636
+ branches.ensure(key, fn);
3637
+ set_hydrating(true);
3638
+ return;
3639
+ }
3640
+ }
3641
+ branches.ensure(key, fn);
3642
+ }
3643
+ block(() => {
3644
+ var has_branch = false;
3645
+ fn((fn, key = 0) => {
3646
+ has_branch = true;
3647
+ update_branch(key, fn);
3648
+ });
3649
+ if (!has_branch) update_branch(-1, null);
3650
+ }, flags);
3651
+ }
3652
+ //#endregion
3653
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/each.js
3654
+ /** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */
3655
+ /** @import { Batch } from '../../reactivity/batch.js'; */
3656
+ /**
3657
+ * @param {any} _
3658
+ * @param {number} i
3659
+ */
3660
+ function index(_, i) {
3661
+ return i;
3662
+ }
3663
+ /**
3664
+ * Pause multiple effects simultaneously, and coordinate their
3665
+ * subsequent destruction. Used in each blocks
3666
+ * @param {EachState} state
3667
+ * @param {Effect[]} to_destroy
3668
+ * @param {null | Node} controlled_anchor
3669
+ */
3670
+ function pause_effects(state, to_destroy, controlled_anchor) {
3671
+ /** @type {TransitionManager[]} */
3672
+ var transitions = [];
3673
+ var length = to_destroy.length;
3674
+ /** @type {EachOutroGroup} */
3675
+ var group;
3676
+ var remaining = to_destroy.length;
3677
+ for (var i = 0; i < length; i++) {
3678
+ let effect = to_destroy[i];
3679
+ pause_effect(effect, () => {
3680
+ if (group) {
3681
+ group.pending.delete(effect);
3682
+ group.done.add(effect);
3683
+ if (group.pending.size === 0) {
3684
+ var groups = state.outrogroups;
3685
+ destroy_effects(state, array_from(group.done));
3686
+ groups.delete(group);
3687
+ if (groups.size === 0) state.outrogroups = null;
3688
+ }
3689
+ } else remaining -= 1;
3690
+ }, false);
3691
+ }
3692
+ if (remaining === 0) {
3693
+ var fast_path = transitions.length === 0 && controlled_anchor !== null;
3694
+ if (fast_path) {
3695
+ var anchor = controlled_anchor;
3696
+ var parent_node = anchor.parentNode;
3697
+ clear_text_content(parent_node);
3698
+ parent_node.append(anchor);
3699
+ state.items.clear();
3700
+ }
3701
+ destroy_effects(state, to_destroy, !fast_path);
3702
+ } else {
3703
+ group = {
3704
+ pending: new Set(to_destroy),
3705
+ done: /* @__PURE__ */ new Set()
3706
+ };
3707
+ (state.outrogroups ?? (state.outrogroups = /* @__PURE__ */ new Set())).add(group);
3708
+ }
3709
+ }
3710
+ /**
3711
+ * @param {EachState} state
3712
+ * @param {Effect[]} to_destroy
3713
+ * @param {boolean} remove_dom
3714
+ */
3715
+ function destroy_effects(state, to_destroy, remove_dom = true) {
3716
+ /** @type {Set<Effect> | undefined} */
3717
+ var preserved_effects;
3718
+ if (state.pending.size > 0) {
3719
+ preserved_effects = /* @__PURE__ */ new Set();
3720
+ for (const keys of state.pending.values()) for (const key of keys) preserved_effects.add(
3721
+ /** @type {EachItem} */
3722
+ state.items.get(key).e
3723
+ );
3724
+ }
3725
+ for (var i = 0; i < to_destroy.length; i++) {
3726
+ var e = to_destroy[i];
3727
+ if (preserved_effects?.has(e)) {
3728
+ e.f |= EFFECT_OFFSCREEN;
3729
+ move_effect(e, document.createDocumentFragment());
3730
+ } else destroy_effect(to_destroy[i], remove_dom);
3731
+ }
3732
+ }
3733
+ /** @type {TemplateNode} */
3734
+ var offscreen_anchor;
3735
+ /**
3736
+ * @template V
3737
+ * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block
3738
+ * @param {number} flags
3739
+ * @param {() => V[]} get_collection
3740
+ * @param {(value: V, index: number) => any} get_key
3741
+ * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn
3742
+ * @param {null | ((anchor: Node) => void)} fallback_fn
3743
+ * @returns {void}
3744
+ */
3745
+ function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {
3746
+ var anchor = node;
3747
+ /** @type {Map<any, EachItem>} */
3748
+ var items = /* @__PURE__ */ new Map();
3749
+ if ((flags & 4) !== 0) {
3750
+ var parent_node = node;
3751
+ anchor = hydrating ? set_hydrate_node(/* @__PURE__ */ get_first_child(parent_node)) : parent_node.appendChild(create_text());
3752
+ }
3753
+ if (hydrating) hydrate_next();
3754
+ /** @type {Effect | null} */
3755
+ var fallback = null;
3756
+ var each_array = /* @__PURE__ */ derived_safe_equal(() => {
3757
+ var collection = get_collection();
3758
+ return is_array(collection) ? collection : collection == null ? [] : array_from(collection);
3759
+ });
3760
+ /** @type {V[]} */
3761
+ var array;
3762
+ /** @type {Map<Batch, Set<any>>} */
3763
+ var pending = /* @__PURE__ */ new Map();
3764
+ var first_run = true;
3765
+ /**
3766
+ * @param {Batch} batch
3767
+ */
3768
+ function commit(batch) {
3769
+ if ((state.effect.f & 16384) !== 0) return;
3770
+ state.pending.delete(batch);
3771
+ state.fallback = fallback;
3772
+ reconcile(state, array, anchor, flags, get_key);
3773
+ if (fallback !== null) if (array.length === 0) if ((fallback.f & 33554432) === 0) resume_effect(fallback);
3774
+ else {
3775
+ fallback.f ^= EFFECT_OFFSCREEN;
3776
+ move(fallback, null, anchor);
3777
+ }
3778
+ else pause_effect(fallback, () => {
3779
+ fallback = null;
3780
+ });
3781
+ }
3782
+ /**
3783
+ * @param {Batch} batch
3784
+ */
3785
+ function discard(batch) {
3786
+ state.pending.delete(batch);
3787
+ }
3788
+ /** @type {EachState} */
3789
+ var state = {
3790
+ effect: block(() => {
3791
+ array = get(each_array);
3792
+ var length = array.length;
3793
+ /** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */
3794
+ let mismatch = false;
3795
+ if (hydrating) {
3796
+ if (read_hydration_instruction(anchor) === "[!" !== (length === 0)) {
3797
+ anchor = skip_nodes();
3798
+ set_hydrate_node(anchor);
3799
+ set_hydrating(false);
3800
+ mismatch = true;
3801
+ }
3802
+ }
3803
+ var keys = /* @__PURE__ */ new Set();
3804
+ var batch = current_batch;
3805
+ var defer = should_defer_append();
3806
+ for (var index = 0; index < length; index += 1) {
3807
+ if (hydrating && hydrate_node.nodeType === 8 && hydrate_node.data === "]") {
3808
+ anchor = hydrate_node;
3809
+ mismatch = true;
3810
+ set_hydrating(false);
3811
+ }
3812
+ var value = array[index];
3813
+ var key = get_key(value, index);
3814
+ var item = first_run ? null : items.get(key);
3815
+ if (item) {
3816
+ if (item.v) internal_set(item.v, value);
3817
+ if (item.i) internal_set(item.i, index);
3818
+ if (defer) batch.unskip_effect(item.e);
3819
+ } else {
3820
+ item = create_item(items, first_run ? anchor : offscreen_anchor ?? (offscreen_anchor = create_text()), value, key, index, render_fn, flags, get_collection);
3821
+ if (!first_run) item.e.f |= EFFECT_OFFSCREEN;
3822
+ items.set(key, item);
3823
+ }
3824
+ keys.add(key);
3825
+ }
3826
+ if (length === 0 && fallback_fn && !fallback) if (first_run) fallback = branch(() => fallback_fn(anchor));
3827
+ else {
3828
+ fallback = branch(() => fallback_fn(offscreen_anchor ?? (offscreen_anchor = create_text())));
3829
+ fallback.f |= EFFECT_OFFSCREEN;
3830
+ }
3831
+ if (length > keys.size) each_key_duplicate("", "", "");
3832
+ if (hydrating && length > 0) set_hydrate_node(skip_nodes());
3833
+ if (!first_run) {
3834
+ pending.set(batch, keys);
3835
+ if (defer) {
3836
+ for (const [key, item] of items) if (!keys.has(key)) batch.skip_effect(item.e);
3837
+ batch.oncommit(commit);
3838
+ batch.ondiscard(discard);
3839
+ } else commit(batch);
3840
+ }
3841
+ if (mismatch) set_hydrating(true);
3842
+ get(each_array);
3843
+ }),
3844
+ flags,
3845
+ items,
3846
+ pending,
3847
+ outrogroups: null,
3848
+ fallback
3849
+ };
3850
+ first_run = false;
3851
+ if (hydrating) anchor = hydrate_node;
3852
+ }
3853
+ /**
3854
+ * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect
3855
+ * @param {Effect | null} effect
3856
+ * @returns {Effect | null}
3857
+ */
3858
+ function skip_to_branch(effect) {
3859
+ while (effect !== null && (effect.f & 32) === 0) effect = effect.next;
3860
+ return effect;
3861
+ }
3862
+ /**
3863
+ * Add, remove, or reorder items output by an each block as its input changes
3864
+ * @template V
3865
+ * @param {EachState} state
3866
+ * @param {Array<V>} array
3867
+ * @param {Element | Comment | Text} anchor
3868
+ * @param {number} flags
3869
+ * @param {(value: V, index: number) => any} get_key
3870
+ * @returns {void}
3871
+ */
3872
+ function reconcile(state, array, anchor, flags, get_key) {
3873
+ var is_animated = (flags & 8) !== 0;
3874
+ var length = array.length;
3875
+ var items = state.items;
3876
+ var current = skip_to_branch(state.effect.first);
3877
+ /** @type {undefined | Set<Effect>} */
3878
+ var seen;
3879
+ /** @type {Effect | null} */
3880
+ var prev = null;
3881
+ /** @type {undefined | Set<Effect>} */
3882
+ var to_animate;
3883
+ /** @type {Effect[]} */
3884
+ var matched = [];
3885
+ /** @type {Effect[]} */
3886
+ var stashed = [];
3887
+ /** @type {V} */
3888
+ var value;
3889
+ /** @type {any} */
3890
+ var key;
3891
+ /** @type {Effect | undefined} */
3892
+ var effect;
3893
+ /** @type {number} */
3894
+ var i;
3895
+ if (is_animated) for (i = 0; i < length; i += 1) {
3896
+ value = array[i];
3897
+ key = get_key(value, i);
3898
+ effect = items.get(key).e;
3899
+ if ((effect.f & 33554432) === 0) {
3900
+ effect.nodes?.a?.measure();
3901
+ (to_animate ?? (to_animate = /* @__PURE__ */ new Set())).add(effect);
3902
+ }
3903
+ }
3904
+ for (i = 0; i < length; i += 1) {
3905
+ value = array[i];
3906
+ key = get_key(value, i);
3907
+ effect = items.get(key).e;
3908
+ if (state.outrogroups !== null) for (const group of state.outrogroups) {
3909
+ group.pending.delete(effect);
3910
+ group.done.delete(effect);
3911
+ }
3912
+ if ((effect.f & 8192) !== 0) {
3913
+ resume_effect(effect);
3914
+ if (is_animated) {
3915
+ effect.nodes?.a?.unfix();
3916
+ (to_animate ?? (to_animate = /* @__PURE__ */ new Set())).delete(effect);
3917
+ }
3918
+ }
3919
+ if ((effect.f & 33554432) !== 0) {
3920
+ effect.f ^= EFFECT_OFFSCREEN;
3921
+ if (effect === current) move(effect, null, anchor);
3922
+ else {
3923
+ var next = prev ? prev.next : current;
3924
+ if (effect === state.effect.last) state.effect.last = effect.prev;
3925
+ if (effect.prev) effect.prev.next = effect.next;
3926
+ if (effect.next) effect.next.prev = effect.prev;
3927
+ link(state, prev, effect);
3928
+ link(state, effect, next);
3929
+ move(effect, next, anchor);
3930
+ prev = effect;
3931
+ matched = [];
3932
+ stashed = [];
3933
+ current = skip_to_branch(prev.next);
3934
+ continue;
3935
+ }
3936
+ }
3937
+ if (effect !== current) {
3938
+ if (seen !== void 0 && seen.has(effect)) {
3939
+ if (matched.length < stashed.length) {
3940
+ var start = stashed[0];
3941
+ var j;
3942
+ prev = start.prev;
3943
+ var a = matched[0];
3944
+ var b = matched[matched.length - 1];
3945
+ for (j = 0; j < matched.length; j += 1) move(matched[j], start, anchor);
3946
+ for (j = 0; j < stashed.length; j += 1) seen.delete(stashed[j]);
3947
+ link(state, a.prev, b.next);
3948
+ link(state, prev, a);
3949
+ link(state, b, start);
3950
+ current = start;
3951
+ prev = b;
3952
+ i -= 1;
3953
+ matched = [];
3954
+ stashed = [];
3955
+ } else {
3956
+ seen.delete(effect);
3957
+ move(effect, current, anchor);
3958
+ link(state, effect.prev, effect.next);
3959
+ link(state, effect, prev === null ? state.effect.first : prev.next);
3960
+ link(state, prev, effect);
3961
+ prev = effect;
3962
+ }
3963
+ continue;
3964
+ }
3965
+ matched = [];
3966
+ stashed = [];
3967
+ while (current !== null && current !== effect) {
3968
+ (seen ?? (seen = /* @__PURE__ */ new Set())).add(current);
3969
+ stashed.push(current);
3970
+ current = skip_to_branch(current.next);
3971
+ }
3972
+ if (current === null) continue;
3973
+ }
3974
+ if ((effect.f & 33554432) === 0) matched.push(effect);
3975
+ prev = effect;
3976
+ current = skip_to_branch(effect.next);
3977
+ }
3978
+ if (state.outrogroups !== null) {
3979
+ for (const group of state.outrogroups) if (group.pending.size === 0) {
3980
+ destroy_effects(state, array_from(group.done));
3981
+ state.outrogroups?.delete(group);
3982
+ }
3983
+ if (state.outrogroups.size === 0) state.outrogroups = null;
3984
+ }
3985
+ if (current !== null || seen !== void 0) {
3986
+ /** @type {Effect[]} */
3987
+ var to_destroy = [];
3988
+ if (seen !== void 0) {
3989
+ for (effect of seen) if ((effect.f & 8192) === 0) to_destroy.push(effect);
3990
+ }
3991
+ while (current !== null) {
3992
+ if ((current.f & 8192) === 0 && current !== state.fallback) to_destroy.push(current);
3993
+ current = skip_to_branch(current.next);
3994
+ }
3995
+ var destroy_length = to_destroy.length;
3996
+ if (destroy_length > 0) {
3997
+ var controlled_anchor = (flags & 4) !== 0 && length === 0 ? anchor : null;
3998
+ if (is_animated) {
3999
+ for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.measure();
4000
+ for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.fix();
4001
+ }
4002
+ pause_effects(state, to_destroy, controlled_anchor);
4003
+ }
4004
+ }
4005
+ if (is_animated) queue_micro_task(() => {
4006
+ if (to_animate === void 0) return;
4007
+ for (effect of to_animate) effect.nodes?.a?.apply();
4008
+ });
4009
+ }
4010
+ /**
4011
+ * @template V
4012
+ * @param {Map<any, EachItem>} items
4013
+ * @param {Node} anchor
4014
+ * @param {V} value
4015
+ * @param {unknown} key
4016
+ * @param {number} index
4017
+ * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn
4018
+ * @param {number} flags
4019
+ * @param {() => V[]} get_collection
4020
+ * @returns {EachItem}
4021
+ */
4022
+ function create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {
4023
+ var v = (flags & 1) !== 0 ? (flags & 16) === 0 ? /* @__PURE__ */ mutable_source(value, false, false) : source(value) : null;
4024
+ var i = (flags & 2) !== 0 ? source(index) : null;
4025
+ return {
4026
+ v,
4027
+ i,
4028
+ e: branch(() => {
4029
+ render_fn(anchor, v ?? value, i ?? index, get_collection);
4030
+ return () => {
4031
+ items.delete(key);
4032
+ };
4033
+ })
4034
+ };
4035
+ }
4036
+ /**
4037
+ * @param {Effect} effect
4038
+ * @param {Effect | null} next
4039
+ * @param {Text | Element | Comment} anchor
4040
+ */
4041
+ function move(effect, next, anchor) {
4042
+ if (!effect.nodes) return;
4043
+ var node = effect.nodes.start;
4044
+ var end = effect.nodes.end;
4045
+ var dest = next && (next.f & 33554432) === 0 ? next.nodes.start : anchor;
4046
+ while (node !== null) {
4047
+ var next_node = /* @__PURE__ */ get_next_sibling(node);
4048
+ dest.before(node);
4049
+ if (node === end) return;
4050
+ node = next_node;
4051
+ }
4052
+ }
4053
+ /**
4054
+ * @param {EachState} state
4055
+ * @param {Effect | null} prev
4056
+ * @param {Effect | null} next
4057
+ */
4058
+ function link(state, prev, next) {
4059
+ if (prev === null) state.effect.first = next;
4060
+ else prev.next = next;
4061
+ if (next === null) state.effect.last = prev;
4062
+ else next.prev = prev;
4063
+ }
4064
+ /**
4065
+ * @param {Element | Text | Comment} node
4066
+ * @param {() => string | TrustedHTML} get_value
4067
+ * @param {boolean} [is_controlled]
4068
+ * @param {boolean} [svg]
4069
+ * @param {boolean} [mathml]
4070
+ * @param {boolean} [skip_warning]
4071
+ * @returns {void}
4072
+ */
4073
+ function html(node, get_value, is_controlled = false, svg = false, mathml = false, skip_warning = false) {
4074
+ var anchor = node;
4075
+ /** @type {string | TrustedHTML} */
4076
+ var value = "";
4077
+ if (is_controlled) {
4078
+ var parent_node = node;
4079
+ if (hydrating) anchor = set_hydrate_node(/* @__PURE__ */ get_first_child(parent_node));
4080
+ }
4081
+ template_effect(() => {
4082
+ var effect = active_effect;
4083
+ if (value === (value = get_value() ?? "")) {
4084
+ if (hydrating) hydrate_next();
4085
+ return;
4086
+ }
4087
+ if (is_controlled && !hydrating) {
4088
+ effect.nodes = null;
4089
+ parent_node.innerHTML = value;
4090
+ if (value !== "") assign_nodes(/* @__PURE__ */ get_first_child(parent_node), parent_node.lastChild);
4091
+ return;
4092
+ }
4093
+ if (effect.nodes !== null) {
4094
+ remove_effect_dom(effect.nodes.start, effect.nodes.end);
4095
+ effect.nodes = null;
4096
+ }
4097
+ if (value === "") return;
4098
+ if (hydrating) {
4099
+ hydrate_node.data;
4100
+ /** @type {TemplateNode | null} */
4101
+ var next = hydrate_next();
4102
+ var last = next;
4103
+ while (next !== null && (next.nodeType !== 8 || next.data !== "")) {
4104
+ last = next;
4105
+ next = /* @__PURE__ */ get_next_sibling(next);
4106
+ }
4107
+ if (next === null) {
4108
+ hydration_mismatch();
4109
+ throw HYDRATION_ERROR;
4110
+ }
4111
+ assign_nodes(hydrate_node, last);
4112
+ anchor = set_hydrate_node(next);
4113
+ return;
4114
+ }
4115
+ var wrapper = create_element(svg ? "svg" : mathml ? "math" : "template", svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : void 0);
4116
+ wrapper.innerHTML = value;
4117
+ /** @type {DocumentFragment | Element} */
4118
+ var node = svg || mathml ? wrapper : wrapper.content;
4119
+ assign_nodes(/* @__PURE__ */ get_first_child(node), node.lastChild);
4120
+ if (svg || mathml) while (/* @__PURE__ */ get_first_child(node)) anchor.before(/* @__PURE__ */ get_first_child(node));
4121
+ else anchor.before(node);
4122
+ });
4123
+ }
4124
+ //#endregion
4125
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/css.js
4126
+ /**
4127
+ * @param {Node} anchor
4128
+ * @param {{ hash: string, code: string }} css
4129
+ */
4130
+ function append_styles(anchor, css) {
4131
+ effect(() => {
4132
+ var root = anchor.getRootNode();
4133
+ var target = root.host ? root : root.head ?? root.ownerDocument.head;
4134
+ if (!target.querySelector("#" + css.hash)) {
4135
+ const style = create_element("style");
4136
+ style.id = css.hash;
4137
+ style.textContent = css.code;
4138
+ target.appendChild(style);
4139
+ }
4140
+ });
4141
+ }
4142
+ //#endregion
4143
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4144
+ /** @import { Blocker, Effect } from '#client' */
4145
+ var IS_CUSTOM_ELEMENT = Symbol("is custom element");
4146
+ var IS_HTML = Symbol("is html");
4147
+ var LINK_TAG = IS_XHTML ? "link" : "LINK";
4148
+ /**
4149
+ * @param {Element} element
4150
+ * @param {string} attribute
4151
+ * @param {string | null} value
4152
+ * @param {boolean} [skip_warning]
4153
+ */
4154
+ function set_attribute(element, attribute, value, skip_warning) {
4155
+ var attributes = get_attributes(element);
4156
+ if (hydrating) {
4157
+ attributes[attribute] = element.getAttribute(attribute);
4158
+ if (attribute === "src" || attribute === "srcset" || attribute === "href" && element.nodeName === LINK_TAG) {
4159
+ if (!skip_warning) check_src_in_dev_hydration(element, attribute, value ?? "");
4160
+ return;
4161
+ }
4162
+ }
4163
+ if (attributes[attribute] === (attributes[attribute] = value)) return;
4164
+ if (attribute === "loading") element[LOADING_ATTR_SYMBOL] = value;
4165
+ if (value == null) element.removeAttribute(attribute);
4166
+ else if (typeof value !== "string" && get_setters(element).includes(attribute)) element[attribute] = value;
4167
+ else element.setAttribute(attribute, value);
4168
+ }
4169
+ /**
4170
+ *
4171
+ * @param {Element} element
4172
+ */
4173
+ function get_attributes(element) {
4174
+ return element.__attributes ?? (element.__attributes = {
4175
+ [IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
4176
+ [IS_HTML]: element.namespaceURI === "http://www.w3.org/1999/xhtml"
4177
+ });
4178
+ }
4179
+ /** @type {Map<string, string[]>} */
4180
+ var setters_cache = /* @__PURE__ */ new Map();
4181
+ /** @param {Element} element */
4182
+ function get_setters(element) {
4183
+ var cache_key = element.getAttribute("is") || element.nodeName;
4184
+ var setters = setters_cache.get(cache_key);
4185
+ if (setters) return setters;
4186
+ setters_cache.set(cache_key, setters = []);
4187
+ var descriptors;
4188
+ var proto = element;
4189
+ var element_proto = Element.prototype;
4190
+ while (element_proto !== proto) {
4191
+ descriptors = get_descriptors(proto);
4192
+ for (var key in descriptors) if (descriptors[key].set) setters.push(key);
4193
+ proto = get_prototype_of(proto);
4194
+ }
4195
+ return setters;
4196
+ }
4197
+ /**
4198
+ * @param {any} element
4199
+ * @param {string} attribute
4200
+ * @param {string} value
4201
+ */
4202
+ function check_src_in_dev_hydration(element, attribute, value) {}
4203
+ //#endregion
4204
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
4205
+ var _ResizeObserverSingleton;
4206
+ var _listeners = /* @__PURE__ */ new WeakMap();
4207
+ var _observer = /* @__PURE__ */ new WeakMap();
4208
+ var _options = /* @__PURE__ */ new WeakMap();
4209
+ var _ResizeObserverSingleton_brand = /* @__PURE__ */ new WeakSet();
4210
+ /**
4211
+ * We create one listener for all elements
4212
+ * @see {@link https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ Explanation}
4213
+ */
4214
+ var ResizeObserverSingleton = class {
4215
+ /** @param {ResizeObserverOptions} options */
4216
+ constructor(options) {
4217
+ _classPrivateMethodInitSpec(this, _ResizeObserverSingleton_brand);
4218
+ _classPrivateFieldInitSpec(this, _listeners, /* @__PURE__ */ new WeakMap());
4219
+ _classPrivateFieldInitSpec(this, _observer, void 0);
4220
+ _classPrivateFieldInitSpec(this, _options, void 0);
4221
+ _classPrivateFieldSet2(_options, this, options);
4222
+ }
4223
+ /**
4224
+ * @param {Element} element
4225
+ * @param {(entry: ResizeObserverEntry) => any} listener
4226
+ */
4227
+ observe(element, listener) {
4228
+ var listeners = _classPrivateFieldGet2(_listeners, this).get(element) || /* @__PURE__ */ new Set();
4229
+ listeners.add(listener);
4230
+ _classPrivateFieldGet2(_listeners, this).set(element, listeners);
4231
+ _assertClassBrand(_ResizeObserverSingleton_brand, this, _getObserver).call(this).observe(element, _classPrivateFieldGet2(_options, this));
4232
+ return () => {
4233
+ var listeners = _classPrivateFieldGet2(_listeners, this).get(element);
4234
+ listeners.delete(listener);
4235
+ if (listeners.size === 0) {
4236
+ _classPrivateFieldGet2(_listeners, this).delete(element);
4237
+ /** @type {ResizeObserver} */ _classPrivateFieldGet2(_observer, this).unobserve(element);
4238
+ }
4239
+ };
4240
+ }
4241
+ };
4242
+ _ResizeObserverSingleton = ResizeObserverSingleton;
4243
+ function _getObserver() {
4244
+ return _classPrivateFieldGet2(_observer, this) ?? _classPrivateFieldSet2(_observer, this, new ResizeObserver(
4245
+ /** @param {any} entries */
4246
+ (entries) => {
4247
+ for (var entry of entries) {
4248
+ _ResizeObserverSingleton.entries.set(entry.target, entry);
4249
+ for (var listener of _classPrivateFieldGet2(_listeners, this).get(entry.target) || []) listener(entry);
4250
+ }
4251
+ }
4252
+ ));
4253
+ }
4254
+ _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
4255
+ //#endregion
4256
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/props.js
4257
+ /** @import { Effect, Source } from './types.js' */
4258
+ /**
4259
+ * This function is responsible for synchronizing a possibly bound prop with the inner component state.
4260
+ * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
4261
+ * @template V
4262
+ * @param {Record<string, unknown>} props
4263
+ * @param {string} key
4264
+ * @param {number} flags
4265
+ * @param {V | (() => V)} [fallback]
4266
+ * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}
4267
+ */
4268
+ function prop(props, key, flags, fallback) {
4269
+ var runes = !legacy_mode_flag || (flags & 2) !== 0;
4270
+ var bindable = (flags & 8) !== 0;
4271
+ var lazy = (flags & 16) !== 0;
4272
+ var fallback_value = fallback;
4273
+ var fallback_dirty = true;
4274
+ var get_fallback = () => {
4275
+ if (fallback_dirty) {
4276
+ fallback_dirty = false;
4277
+ fallback_value = lazy ? untrack(fallback) : fallback;
4278
+ }
4279
+ return fallback_value;
4280
+ };
4281
+ /** @type {((v: V) => void) | undefined} */
4282
+ let setter;
4283
+ if (bindable) {
4284
+ var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
4285
+ setter = get_descriptor(props, key)?.set ?? (is_entry_props && key in props ? (v) => props[key] = v : void 0);
4286
+ }
4287
+ /** @type {V} */
4288
+ var initial_value;
4289
+ var is_store_sub = false;
4290
+ if (bindable) [initial_value, is_store_sub] = capture_store_binding(() => props[key]);
4291
+ else initial_value = props[key];
4292
+ if (initial_value === void 0 && fallback !== void 0) {
4293
+ initial_value = get_fallback();
4294
+ if (setter) {
4295
+ if (runes) props_invalid_value(key);
4296
+ setter(initial_value);
4297
+ }
4298
+ }
4299
+ /** @type {() => V} */
4300
+ var getter;
4301
+ if (runes) getter = () => {
4302
+ var value = props[key];
4303
+ if (value === void 0) return get_fallback();
4304
+ fallback_dirty = true;
4305
+ return value;
4306
+ };
4307
+ else getter = () => {
4308
+ var value = props[key];
4309
+ if (value !== void 0) fallback_value = void 0;
4310
+ return value === void 0 ? fallback_value : value;
4311
+ };
4312
+ if (runes && (flags & 4) === 0) return getter;
4313
+ if (setter) {
4314
+ var legacy_parent = props.$$legacy;
4315
+ return (function(value, mutation) {
4316
+ if (arguments.length > 0) {
4317
+ if (!runes || !mutation || legacy_parent || is_store_sub)
4318
+ /** @type {Function} */ setter(mutation ? getter() : value);
4319
+ return value;
4320
+ }
4321
+ return getter();
4322
+ });
4323
+ }
4324
+ var overridden = false;
4325
+ var d = ((flags & 1) !== 0 ? derived : derived_safe_equal)(() => {
4326
+ overridden = false;
4327
+ return getter();
4328
+ });
4329
+ if (bindable) get(d);
4330
+ var parent_effect = active_effect;
4331
+ return (function(value, mutation) {
4332
+ if (arguments.length > 0) {
4333
+ const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
4334
+ set(d, new_value);
4335
+ overridden = true;
4336
+ if (fallback_value !== void 0) fallback_value = new_value;
4337
+ return value;
4338
+ }
4339
+ if (is_destroying_effect && overridden || (parent_effect.f & 16384) !== 0) return d.v;
4340
+ return get(d);
4341
+ });
4342
+ }
4343
+ //#endregion
4344
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/legacy/legacy-client.js
4345
+ /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
4346
+ /**
4347
+ * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
4348
+ *
4349
+ * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.
4350
+ *
4351
+ * @template {Record<string, any>} Props
4352
+ * @template {Record<string, any>} Exports
4353
+ * @template {Record<string, any>} Events
4354
+ * @template {Record<string, any>} Slots
4355
+ *
4356
+ * @param {ComponentConstructorOptions<Props> & {
4357
+ * component: ComponentType<SvelteComponent<Props, Events, Slots>> | Component<Props>;
4358
+ * }} options
4359
+ * @returns {SvelteComponent<Props, Events, Slots> & Exports}
4360
+ */
4361
+ function createClassComponent(options) {
4362
+ return new Svelte4Component(options);
4363
+ }
4364
+ var _events = /* @__PURE__ */ new WeakMap();
4365
+ var _instance = /* @__PURE__ */ new WeakMap();
4366
+ /**
4367
+ * Support using the component as both a class and function during the transition period
4368
+ * @typedef {{new (o: ComponentConstructorOptions): SvelteComponent;(...args: Parameters<Component<Record<string, any>>>): ReturnType<Component<Record<string, any>, Record<string, any>>>;}} LegacyComponentType
4369
+ */
4370
+ var Svelte4Component = class {
4371
+ /**
4372
+ * @param {ComponentConstructorOptions & {
4373
+ * component: any;
4374
+ * }} options
4375
+ */
4376
+ constructor(options) {
4377
+ _classPrivateFieldInitSpec(this, _events, void 0);
4378
+ _classPrivateFieldInitSpec(this, _instance, void 0);
4379
+ var sources = /* @__PURE__ */ new Map();
4380
+ /**
4381
+ * @param {string | symbol} key
4382
+ * @param {unknown} value
4383
+ */
4384
+ var add_source = (key, value) => {
4385
+ var s = /* @__PURE__ */ mutable_source(value, false, false);
4386
+ sources.set(key, s);
4387
+ return s;
4388
+ };
4389
+ const props = new Proxy({
4390
+ ...options.props || {},
4391
+ $$events: {}
4392
+ }, {
4393
+ get(target, prop) {
4394
+ return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
4395
+ },
4396
+ has(target, prop) {
4397
+ if (prop === LEGACY_PROPS) return true;
4398
+ get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
4399
+ return Reflect.has(target, prop);
4400
+ },
4401
+ set(target, prop, value) {
4402
+ set(sources.get(prop) ?? add_source(prop, value), value);
4403
+ return Reflect.set(target, prop, value);
4404
+ }
4405
+ });
4406
+ _classPrivateFieldSet2(_instance, this, (options.hydrate ? hydrate : mount)(options.component, {
4407
+ target: options.target,
4408
+ anchor: options.anchor,
4409
+ props,
4410
+ context: options.context,
4411
+ intro: options.intro ?? false,
4412
+ recover: options.recover,
4413
+ transformError: options.transformError
4414
+ }));
4415
+ if (!async_mode_flag && (!options?.props?.$$host || options.sync === false)) flushSync();
4416
+ _classPrivateFieldSet2(_events, this, props.$$events);
4417
+ for (const key of Object.keys(_classPrivateFieldGet2(_instance, this))) {
4418
+ if (key === "$set" || key === "$destroy" || key === "$on") continue;
4419
+ define_property(this, key, {
4420
+ get() {
4421
+ return _classPrivateFieldGet2(_instance, this)[key];
4422
+ },
4423
+ set(value) {
4424
+ _classPrivateFieldGet2(_instance, this)[key] = value;
4425
+ },
4426
+ enumerable: true
4427
+ });
4428
+ }
4429
+ _classPrivateFieldGet2(_instance, this).$set = (next) => {
4430
+ Object.assign(props, next);
4431
+ };
4432
+ _classPrivateFieldGet2(_instance, this).$destroy = () => {
4433
+ unmount(_classPrivateFieldGet2(_instance, this));
4434
+ };
4435
+ }
4436
+ /** @param {Record<string, any>} props */
4437
+ $set(props) {
4438
+ _classPrivateFieldGet2(_instance, this).$set(props);
4439
+ }
4440
+ /**
4441
+ * @param {string} event
4442
+ * @param {(...args: any[]) => any} callback
4443
+ * @returns {any}
4444
+ */
4445
+ $on(event, callback) {
4446
+ _classPrivateFieldGet2(_events, this)[event] = _classPrivateFieldGet2(_events, this)[event] || [];
4447
+ /** @param {any[]} args */
4448
+ const cb = (...args) => callback.call(this, ...args);
4449
+ _classPrivateFieldGet2(_events, this)[event].push(cb);
4450
+ return () => {
4451
+ _classPrivateFieldGet2(_events, this)[event] = _classPrivateFieldGet2(_events, this)[event].filter(
4452
+ /** @param {any} fn */
4453
+ (fn) => fn !== cb
4454
+ );
4455
+ };
4456
+ }
4457
+ $destroy() {
4458
+ _classPrivateFieldGet2(_instance, this).$destroy();
4459
+ }
4460
+ };
4461
+ //#endregion
4462
+ //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4463
+ /**
4464
+ * @typedef {Object} CustomElementPropDefinition
4465
+ * @property {string} [attribute]
4466
+ * @property {boolean} [reflect]
4467
+ * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]
4468
+ */
4469
+ /** @type {any} */
4470
+ var SvelteElement;
4471
+ if (typeof HTMLElement === "function") SvelteElement = class extends HTMLElement {
4472
+ /**
4473
+ * @param {*} $$componentCtor
4474
+ * @param {*} $$slots
4475
+ * @param {ShadowRootInit | undefined} shadow_root_init
4476
+ */
4477
+ constructor($$componentCtor, $$slots, shadow_root_init) {
4478
+ super();
4479
+ _defineProperty(
4480
+ this,
4481
+ /** The Svelte component constructor */
4482
+ "$$ctor",
4483
+ void 0
4484
+ );
4485
+ _defineProperty(
4486
+ this,
4487
+ /** Slots */
4488
+ "$$s",
4489
+ void 0
4490
+ );
4491
+ _defineProperty(
4492
+ this,
4493
+ /** @type {any} The Svelte component instance */
4494
+ "$$c",
4495
+ void 0
4496
+ );
4497
+ _defineProperty(
4498
+ this,
4499
+ /** Whether or not the custom element is connected */
4500
+ "$$cn",
4501
+ false
4502
+ );
4503
+ _defineProperty(
4504
+ this,
4505
+ /** @type {Record<string, any>} Component props data */
4506
+ "$$d",
4507
+ {}
4508
+ );
4509
+ _defineProperty(
4510
+ this,
4511
+ /** `true` if currently in the process of reflecting component props back to attributes */
4512
+ "$$r",
4513
+ false
4514
+ );
4515
+ _defineProperty(
4516
+ this,
4517
+ /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
4518
+ "$$p_d",
4519
+ {}
4520
+ );
4521
+ _defineProperty(
4522
+ this,
4523
+ /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
4524
+ "$$l",
4525
+ {}
4526
+ );
4527
+ _defineProperty(
4528
+ this,
4529
+ /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
4530
+ "$$l_u",
4531
+ /* @__PURE__ */ new Map()
4532
+ );
4533
+ _defineProperty(
4534
+ this,
4535
+ /** @type {any} The managed render effect for reflecting attributes */
4536
+ "$$me",
4537
+ void 0
4538
+ );
4539
+ _defineProperty(
4540
+ this,
4541
+ /** @type {ShadowRoot | null} The ShadowRoot of the custom element */
4542
+ "$$shadowRoot",
4543
+ null
4544
+ );
4545
+ this.$$ctor = $$componentCtor;
4546
+ this.$$s = $$slots;
4547
+ if (shadow_root_init) this.$$shadowRoot = this.attachShadow(shadow_root_init);
4548
+ }
4549
+ /**
4550
+ * @param {string} type
4551
+ * @param {EventListenerOrEventListenerObject} listener
4552
+ * @param {boolean | AddEventListenerOptions} [options]
4553
+ */
4554
+ addEventListener(type, listener, options) {
4555
+ this.$$l[type] = this.$$l[type] || [];
4556
+ this.$$l[type].push(listener);
4557
+ if (this.$$c) {
4558
+ const unsub = this.$$c.$on(type, listener);
4559
+ this.$$l_u.set(listener, unsub);
4560
+ }
4561
+ super.addEventListener(type, listener, options);
4562
+ }
4563
+ /**
4564
+ * @param {string} type
4565
+ * @param {EventListenerOrEventListenerObject} listener
4566
+ * @param {boolean | AddEventListenerOptions} [options]
4567
+ */
4568
+ removeEventListener(type, listener, options) {
4569
+ super.removeEventListener(type, listener, options);
4570
+ if (this.$$c) {
4571
+ const unsub = this.$$l_u.get(listener);
4572
+ if (unsub) {
4573
+ unsub();
4574
+ this.$$l_u.delete(listener);
4575
+ }
4576
+ }
4577
+ }
4578
+ async connectedCallback() {
4579
+ this.$$cn = true;
4580
+ if (!this.$$c) {
4581
+ await Promise.resolve();
4582
+ if (!this.$$cn || this.$$c) return;
4583
+ /** @param {string} name */
4584
+ function create_slot(name) {
4585
+ /**
4586
+ * @param {Element} anchor
4587
+ */
4588
+ return (anchor) => {
4589
+ const slot = create_element("slot");
4590
+ if (name !== "default") slot.name = name;
4591
+ append(anchor, slot);
4592
+ };
4593
+ }
4594
+ /** @type {Record<string, any>} */
4595
+ const $$slots = {};
4596
+ const existing_slots = get_custom_elements_slots(this);
4597
+ for (const name of this.$$s) if (name in existing_slots) if (name === "default" && !this.$$d.children) {
4598
+ this.$$d.children = create_slot(name);
4599
+ $$slots.default = true;
4600
+ } else $$slots[name] = create_slot(name);
4601
+ for (const attribute of this.attributes) {
4602
+ const name = this.$$g_p(attribute.name);
4603
+ if (!(name in this.$$d)) this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp");
4604
+ }
4605
+ for (const key in this.$$p_d) if (!(key in this.$$d) && this[key] !== void 0) {
4606
+ this.$$d[key] = this[key];
4607
+ delete this[key];
4608
+ }
4609
+ this.$$c = createClassComponent({
4610
+ component: this.$$ctor,
4611
+ target: this.$$shadowRoot || this,
4612
+ props: {
4613
+ ...this.$$d,
4614
+ $$slots,
4615
+ $$host: this
4616
+ }
4617
+ });
4618
+ this.$$me = effect_root(() => {
4619
+ render_effect(() => {
4620
+ this.$$r = true;
4621
+ for (const key of object_keys(this.$$c)) {
4622
+ if (!this.$$p_d[key]?.reflect) continue;
4623
+ this.$$d[key] = this.$$c[key];
4624
+ const attribute_value = get_custom_element_value(key, this.$$d[key], this.$$p_d, "toAttribute");
4625
+ if (attribute_value == null) this.removeAttribute(this.$$p_d[key].attribute || key);
4626
+ else this.setAttribute(this.$$p_d[key].attribute || key, attribute_value);
4627
+ }
4628
+ this.$$r = false;
4629
+ });
4630
+ });
4631
+ for (const type in this.$$l) for (const listener of this.$$l[type]) {
4632
+ const unsub = this.$$c.$on(type, listener);
4633
+ this.$$l_u.set(listener, unsub);
4634
+ }
4635
+ this.$$l = {};
4636
+ }
4637
+ }
4638
+ /**
4639
+ * @param {string} attr
4640
+ * @param {string} _oldValue
4641
+ * @param {string} newValue
4642
+ */
4643
+ attributeChangedCallback(attr, _oldValue, newValue) {
4644
+ if (this.$$r) return;
4645
+ attr = this.$$g_p(attr);
4646
+ this.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, "toProp");
4647
+ this.$$c?.$set({ [attr]: this.$$d[attr] });
4648
+ }
4649
+ disconnectedCallback() {
4650
+ this.$$cn = false;
4651
+ Promise.resolve().then(() => {
4652
+ if (!this.$$cn && this.$$c) {
4653
+ this.$$c.$destroy();
4654
+ this.$$me();
4655
+ this.$$c = void 0;
4656
+ }
4657
+ });
4658
+ }
4659
+ /**
4660
+ * @param {string} attribute_name
4661
+ */
4662
+ $$g_p(attribute_name) {
4663
+ return object_keys(this.$$p_d).find((key) => this.$$p_d[key].attribute === attribute_name || !this.$$p_d[key].attribute && key.toLowerCase() === attribute_name) || attribute_name;
4664
+ }
4665
+ };
4666
+ /**
4667
+ * @param {string} prop
4668
+ * @param {any} value
4669
+ * @param {Record<string, CustomElementPropDefinition>} props_definition
4670
+ * @param {'toAttribute' | 'toProp'} [transform]
4671
+ */
4672
+ function get_custom_element_value(prop, value, props_definition, transform) {
4673
+ const type = props_definition[prop]?.type;
4674
+ value = type === "Boolean" && typeof value !== "boolean" ? value != null : value;
4675
+ if (!transform || !props_definition[prop]) return value;
4676
+ else if (transform === "toAttribute") switch (type) {
4677
+ case "Object":
4678
+ case "Array": return value == null ? null : JSON.stringify(value);
4679
+ case "Boolean": return value ? "" : null;
4680
+ case "Number": return value == null ? null : value;
4681
+ default: return value;
4682
+ }
4683
+ else switch (type) {
4684
+ case "Object":
4685
+ case "Array": return value && JSON.parse(value);
4686
+ case "Boolean": return value;
4687
+ case "Number": return value != null ? +value : value;
4688
+ default: return value;
4689
+ }
4690
+ }
4691
+ /**
4692
+ * @param {HTMLElement} element
4693
+ */
4694
+ function get_custom_elements_slots(element) {
4695
+ /** @type {Record<string, true>} */
4696
+ const result = {};
4697
+ element.childNodes.forEach((node) => {
4698
+ result[node.slot || "default"] = true;
4699
+ });
4700
+ return result;
4701
+ }
4702
+ /**
4703
+ * @internal
4704
+ *
4705
+ * Turn a Svelte component into a custom element.
4706
+ * @param {any} Component A Svelte component function
4707
+ * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe
4708
+ * @param {string[]} slots The slots to create
4709
+ * @param {string[]} exports Explicitly exported values, other than props
4710
+ * @param {ShadowRootInit | undefined} shadow_root_init Options passed to shadow DOM constructor
4711
+ * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend]
4712
+ */
4713
+ function create_custom_element(Component, props_definition, slots, exports, shadow_root_init, extend) {
4714
+ let Class = class extends SvelteElement {
4715
+ constructor() {
4716
+ super(Component, slots, shadow_root_init);
4717
+ this.$$p_d = props_definition;
4718
+ }
4719
+ static get observedAttributes() {
4720
+ return object_keys(props_definition).map((key) => (props_definition[key].attribute || key).toLowerCase());
4721
+ }
4722
+ };
4723
+ object_keys(props_definition).forEach((prop) => {
4724
+ define_property(Class.prototype, prop, {
4725
+ get() {
4726
+ return this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];
4727
+ },
4728
+ set(value) {
4729
+ value = get_custom_element_value(prop, value, props_definition);
4730
+ this.$$d[prop] = value;
4731
+ var component = this.$$c;
4732
+ if (component) if (get_descriptor(component, prop)?.get) component[prop] = value;
4733
+ else component.$set({ [prop]: value });
4734
+ }
4735
+ });
4736
+ });
4737
+ exports.forEach((property) => {
4738
+ define_property(Class.prototype, property, { get() {
4739
+ return this.$$c?.[property];
4740
+ } });
4741
+ });
4742
+ if (extend) Class = extend(Class);
4743
+ Component.element = Class;
4744
+ return Class;
4745
+ }
4746
+ //#endregion
4747
+ //#region src/print/Print.svelte
4748
+ var root_1 = /* @__PURE__ */ from_html(`<div class="mb-4 prose prose-sm svelte-1fx5wwa"></div>`);
4749
+ var root_2 = /* @__PURE__ */ from_html(`<div class="mb-2 prose prose-sm svelte-1fx5wwa"></div>`);
4750
+ var root_4 = /* @__PURE__ */ from_html(`<img class="max-h-14 object-contain"/>`);
4751
+ var root_3 = /* @__PURE__ */ from_html(`<div class="mb-4 prose prose-sm svelte-1fx5wwa"><!> <span class="inline-block min-w-[6rem] border-b-2 border-gray-600 print:border-black px-1"><!></span> <!></div>`);
4752
+ var root_8 = /* @__PURE__ */ from_html(`<div><strong>Audio:</strong> </div>`);
4753
+ var root_9 = /* @__PURE__ */ from_html(`<div><strong>Transcript:</strong> </div>`);
4754
+ var root_7 = /* @__PURE__ */ from_html(`<div class="text-sm mb-4"><!> <!></div>`);
4755
+ var root_11 = /* @__PURE__ */ from_html(`<span class="font-medium"> </span> <!>`, 1);
4756
+ var root_14 = /* @__PURE__ */ from_html(`<span class="font-medium">(key)</span>`);
4757
+ var root_13 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
4758
+ var root_10 = /* @__PURE__ */ from_html(`<li><!></li>`);
4759
+ var root = /* @__PURE__ */ from_html(`<div class="p-4 print:p-0"><!> <!> <!> <!> <ul class="text-sm list-disc pl-5"></ul></div>`);
4760
+ var $$css = {
4761
+ hash: "svelte-1fx5wwa",
4762
+ code: ".prose.svelte-1fx5wwa p {margin:0.5em 0;}.prose.svelte-1fx5wwa strong {font-weight:600;}"
4763
+ };
4764
+ function Print($$anchor, $$props) {
4765
+ push($$props, true);
4766
+ append_styles($$anchor, $$css);
4767
+ const BLANK_TOKEN = "{{blank}}";
4768
+ let model = prop($$props, "model", 7, null);
4769
+ let prompt = /* @__PURE__ */ state("");
4770
+ let template = /* @__PURE__ */ state("");
4771
+ user_effect(() => {
4772
+ set(prompt, model()?.prompt || "", true);
4773
+ set(template, model()?.template || "", true);
4774
+ });
4775
+ const parts = /* @__PURE__ */ user_derived(() => {
4776
+ const idx = get(template).indexOf(BLANK_TOKEN);
4777
+ if (idx < 0) return {
4778
+ before: get(template),
4779
+ after: ""
4780
+ };
4781
+ return {
4782
+ before: get(template).slice(0, idx),
4783
+ after: get(template).slice(idx + 9)
4784
+ };
4785
+ });
4786
+ const choices = /* @__PURE__ */ user_derived(() => Array.isArray(model()?.choices) ? model().choices : []);
4787
+ const correct = /* @__PURE__ */ user_derived(() => model()?.choices?.find((c) => c.id === model()?.correctChoiceId));
4788
+ const mode = /* @__PURE__ */ user_derived(() => model()?.choiceMode || "text");
4789
+ const isAudioOnlyMode = /* @__PURE__ */ user_derived(() => model()?.interactionMode === "audio_mc_only");
4790
+ const showAnswerKey = /* @__PURE__ */ user_derived(() => model()?.printAnswerKey !== false);
4791
+ var $$exports = {
4792
+ get model() {
4793
+ return model();
4794
+ },
4795
+ set model($$value = null) {
4796
+ model($$value);
4797
+ flushSync();
4798
+ }
4799
+ };
4800
+ var div = root();
4801
+ var node = child(div);
4802
+ var consequent = ($$anchor) => {
4803
+ var div_1 = root_1();
4804
+ html(div_1, () => get(prompt), true);
4805
+ reset(div_1);
4806
+ append($$anchor, div_1);
4807
+ };
4808
+ if_block(node, ($$render) => {
4809
+ if (get(prompt) && model()?.promptEnabled !== false) $$render(consequent);
4810
+ });
4811
+ var node_1 = sibling(node, 2);
4812
+ var consequent_1 = ($$anchor) => {
4813
+ var div_2 = root_2();
4814
+ html(div_2, () => model().sentenceHtml, true);
4815
+ reset(div_2);
4816
+ append($$anchor, div_2);
4817
+ };
4818
+ if_block(node_1, ($$render) => {
4819
+ if (model()?.sentenceHtml) $$render(consequent_1);
4820
+ });
4821
+ var node_2 = sibling(node_1, 2);
4822
+ var consequent_4 = ($$anchor) => {
4823
+ var div_3 = root_3();
4824
+ var node_3 = child(div_3);
4825
+ html(node_3, () => get(parts).before);
4826
+ var span = sibling(node_3, 2);
4827
+ var node_4 = child(span);
4828
+ var consequent_2 = ($$anchor) => {
4829
+ var img = root_4();
4830
+ template_effect(() => {
4831
+ set_attribute(img, "src", get(correct).imageUrl);
4832
+ set_attribute(img, "alt", get(correct).imageAlt || "");
4833
+ });
4834
+ append($$anchor, img);
4835
+ };
4836
+ var consequent_3 = ($$anchor) => {
4837
+ var fragment = comment();
4838
+ html(first_child(fragment), () => get(correct).labelHtml);
4839
+ append($$anchor, fragment);
4840
+ };
4841
+ var alternate = ($$anchor) => {
4842
+ append($$anchor, text("________"));
4843
+ };
4844
+ if_block(node_4, ($$render) => {
4845
+ if (get(showAnswerKey) && get(mode) === "image" && get(correct)?.imageUrl) $$render(consequent_2);
4846
+ else if (get(showAnswerKey) && get(correct)?.labelHtml) $$render(consequent_3, 1);
4847
+ else $$render(alternate, -1);
4848
+ });
4849
+ reset(span);
4850
+ html(sibling(span, 2), () => get(parts).after);
4851
+ reset(div_3);
4852
+ append($$anchor, div_3);
4853
+ };
4854
+ if_block(node_2, ($$render) => {
4855
+ if (!get(isAudioOnlyMode)) $$render(consequent_4);
4856
+ });
4857
+ var node_7 = sibling(node_2, 2);
4858
+ var consequent_7 = ($$anchor) => {
4859
+ var div_4 = root_7();
4860
+ var node_8 = child(div_4);
4861
+ var consequent_5 = ($$anchor) => {
4862
+ var div_5 = root_8();
4863
+ var text_1 = sibling(child(div_5));
4864
+ reset(div_5);
4865
+ template_effect(() => set_text(text_1, ` ${model().audioUrl ?? ""}`));
4866
+ append($$anchor, div_5);
4867
+ };
4868
+ if_block(node_8, ($$render) => {
4869
+ if (model()?.audioUrl) $$render(consequent_5);
4870
+ });
4871
+ var node_9 = sibling(node_8, 2);
4872
+ var consequent_6 = ($$anchor) => {
4873
+ var div_6 = root_9();
4874
+ var text_2 = sibling(child(div_6));
4875
+ reset(div_6);
4876
+ template_effect(() => set_text(text_2, ` ${model().audioTranscript ?? ""}`));
4877
+ append($$anchor, div_6);
4878
+ };
4879
+ if_block(node_9, ($$render) => {
4880
+ if (model()?.audioTranscript) $$render(consequent_6);
4881
+ });
4882
+ reset(div_4);
4883
+ append($$anchor, div_4);
4884
+ };
4885
+ if_block(node_7, ($$render) => {
4886
+ if (model()?.hasAudio) $$render(consequent_7);
4887
+ });
4888
+ var ul = sibling(node_7, 2);
4889
+ each(ul, 21, () => get(choices), index, ($$anchor, c) => {
4890
+ var li = root_10();
4891
+ var node_10 = child(li);
4892
+ var consequent_9 = ($$anchor) => {
4893
+ var fragment_1 = root_11();
4894
+ var span_1 = first_child(fragment_1);
4895
+ var text_3 = child(span_1, true);
4896
+ reset(span_1);
4897
+ var node_11 = sibling(span_1, 2);
4898
+ var consequent_8 = ($$anchor) => {
4899
+ append($$anchor, text("(key)"));
4900
+ };
4901
+ if_block(node_11, ($$render) => {
4902
+ if (get(showAnswerKey) && get(c).id === model()?.correctChoiceId) $$render(consequent_8);
4903
+ });
4904
+ template_effect(() => set_text(text_3, get(c).id));
4905
+ append($$anchor, fragment_1);
4906
+ };
4907
+ var alternate_1 = ($$anchor) => {
4908
+ var fragment_2 = root_13();
4909
+ var node_12 = first_child(fragment_2);
4910
+ html(node_12, () => get(c).labelHtml || "");
4911
+ var node_13 = sibling(node_12, 2);
4912
+ var consequent_10 = ($$anchor) => {
4913
+ append($$anchor, root_14());
4914
+ };
4915
+ if_block(node_13, ($$render) => {
4916
+ if (get(showAnswerKey) && get(c).id === model()?.correctChoiceId) $$render(consequent_10);
4917
+ });
4918
+ append($$anchor, fragment_2);
4919
+ };
4920
+ if_block(node_10, ($$render) => {
4921
+ if (get(mode) === "image") $$render(consequent_9);
4922
+ else $$render(alternate_1, -1);
4923
+ });
4924
+ reset(li);
4925
+ append($$anchor, li);
4926
+ });
4927
+ reset(ul);
4928
+ reset(div);
4929
+ append($$anchor, div);
4930
+ return pop($$exports);
4931
+ }
4932
+ create_custom_element(Print, { model: { type: "Object" } }, [], []);
4933
+ //#endregion
4934
+ //#region src/print/index.ts
4935
+ var SvelteElementClass = Print.element;
4936
+ var McPopulatedBlankPrint = class extends SvelteElementClass {
4937
+ constructor(..._args) {
4938
+ super(..._args);
4939
+ _defineProperty(this, "_model", null);
4940
+ }
4941
+ set model(m) {
4942
+ this._model = m;
4943
+ super.model = m;
4944
+ }
4945
+ get model() {
4946
+ return this._model;
4947
+ }
4948
+ };
4949
+ //#endregion
4950
+ export { McPopulatedBlankPrint as default };
4951
+
4952
+ //# sourceMappingURL=index.js.map