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