@pie-element/simple-cloze 0.1.4-next.3 → 0.1.4-next.4

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.
@@ -1,16 +1,16 @@
1
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/disclose-version.js
1
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/disclose-version.js
2
2
  if (typeof window !== "undefined") {
3
3
  var _window$__svelte, _window;
4
4
  ((_window$__svelte = (_window = window).__svelte ?? (_window.__svelte = {})).v ?? (_window$__svelte.v = /* @__PURE__ */ new Set())).add("5");
5
5
  }
6
6
  //#endregion
7
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/constants.js
7
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/constants.js
8
8
  var HYDRATION_ERROR = {};
9
9
  var UNINITIALIZED = Symbol("uninitialized");
10
10
  var NAMESPACE_SVG = "http://www.w3.org/2000/svg";
11
11
  var NAMESPACE_MATHML = "http://www.w3.org/1998/Math/MathML";
12
12
  //#endregion
13
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/shared/utils.js
13
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/shared/utils.js
14
14
  var is_array = Array.isArray;
15
15
  var index_of = Array.prototype.indexOf;
16
16
  var includes = Array.prototype.includes;
@@ -46,7 +46,7 @@ function deferred() {
46
46
  };
47
47
  }
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
49
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
50
50
  function _typeof(o) {
51
51
  "@babel/helpers - typeof";
52
52
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -56,7 +56,7 @@ function _typeof(o) {
56
56
  }, _typeof(o);
57
57
  }
58
58
  //#endregion
59
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
59
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
60
60
  function toPrimitive(t, r) {
61
61
  if ("object" != _typeof(t) || !t) return t;
62
62
  var e = t[Symbol.toPrimitive];
@@ -68,13 +68,13 @@ function toPrimitive(t, r) {
68
68
  return ("string" === r ? String : Number)(t);
69
69
  }
70
70
  //#endregion
71
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
71
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
72
72
  function toPropertyKey(t) {
73
73
  var i = toPrimitive(t, "string");
74
74
  return "symbol" == _typeof(i) ? i : i + "";
75
75
  }
76
76
  //#endregion
77
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
77
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
78
78
  function _defineProperty(e, r, t) {
79
79
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
80
80
  value: t,
@@ -110,6 +110,8 @@ var REACTION_IS_UPDATING = 1 << 21;
110
110
  var ASYNC = 1 << 22;
111
111
  var ERROR_VALUE = 1 << 23;
112
112
  var STATE_SYMBOL = Symbol("$state");
113
+ /** Marks component export objects, so that `proxy(...)` leaves them untouched */
114
+ var COMPONENT_SYMBOL = Symbol("component");
113
115
  var LEGACY_PROPS = Symbol("legacy props");
114
116
  var ATTRIBUTES_CACHE = Symbol("attributes");
115
117
  var CLASS_CACHE = Symbol("class");
@@ -124,88 +126,6 @@ var STALE_REACTION = new class StaleReactionError extends Error {
124
126
  }
125
127
  }();
126
128
  globalThis.document?.contentType;
127
- //#endregion
128
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/errors.js
129
- /**
130
- * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
131
- * @returns {never}
132
- */
133
- function async_derived_orphan() {
134
- throw new Error(`https://svelte.dev/e/async_derived_orphan`);
135
- }
136
- /**
137
- * `%rune%` cannot be used inside an effect cleanup function
138
- * @param {string} rune
139
- * @returns {never}
140
- */
141
- function effect_in_teardown(rune) {
142
- throw new Error(`https://svelte.dev/e/effect_in_teardown`);
143
- }
144
- /**
145
- * Effect cannot be created inside a `$derived` value that was not itself created inside an effect
146
- * @returns {never}
147
- */
148
- function effect_in_unowned_derived() {
149
- throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`);
150
- }
151
- /**
152
- * `%rune%` can only be used inside an effect (e.g. during component initialisation)
153
- * @param {string} rune
154
- * @returns {never}
155
- */
156
- function effect_orphan(rune) {
157
- throw new Error(`https://svelte.dev/e/effect_orphan`);
158
- }
159
- /**
160
- * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
161
- * @returns {never}
162
- */
163
- function effect_update_depth_exceeded() {
164
- throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
165
- }
166
- /**
167
- * Failed to hydrate the application
168
- * @returns {never}
169
- */
170
- function hydration_failed() {
171
- throw new Error(`https://svelte.dev/e/hydration_failed`);
172
- }
173
- /**
174
- * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value
175
- * @param {string} key
176
- * @returns {never}
177
- */
178
- function props_invalid_value(key) {
179
- throw new Error(`https://svelte.dev/e/props_invalid_value`);
180
- }
181
- /**
182
- * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
183
- * @returns {never}
184
- */
185
- function state_descriptors_fixed() {
186
- throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
187
- }
188
- /**
189
- * Cannot set prototype of `$state` object
190
- * @returns {never}
191
- */
192
- function state_prototype_fixed() {
193
- throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
194
- }
195
- /**
196
- * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
197
- * @returns {never}
198
- */
199
- function state_unsafe_mutation() {
200
- throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
201
- }
202
- /**
203
- * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
204
- * @returns {never}
205
- */
206
- function svelte_boundary_reset_onerror() {
207
- throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
208
- }
209
129
  /**
210
130
  * Reading a derived belonging to a now-destroyed effect may result in stale values
211
131
  */
@@ -226,7 +146,7 @@ function svelte_boundary_reset_noop() {
226
146
  console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
227
147
  }
228
148
  //#endregion
229
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/hydration.js
149
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/hydration.js
230
150
  /** @import { TemplateNode } from '#client' */
231
151
  /**
232
152
  * Use this variable to guard everything related to hydration code so it can be treeshaken out
@@ -305,7 +225,7 @@ function read_hydration_instruction(node) {
305
225
  return node.data;
306
226
  }
307
227
  //#endregion
308
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/equality.js
228
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/equality.js
309
229
  /** @import { Equals } from '#client' */
310
230
  /** @type {Equals} */
311
231
  function equals(value) {
@@ -324,13 +244,95 @@ function safe_equals(value) {
324
244
  return !safe_not_equal(value, this.v);
325
245
  }
326
246
  //#endregion
327
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/flags/index.js
247
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/errors.js
248
+ /**
249
+ * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
250
+ * @returns {never}
251
+ */
252
+ function async_derived_orphan() {
253
+ throw new Error(`https://svelte.dev/e/async_derived_orphan`);
254
+ }
255
+ /**
256
+ * `%rune%` cannot be used inside an effect cleanup function
257
+ * @param {string} rune
258
+ * @returns {never}
259
+ */
260
+ function effect_in_teardown(rune) {
261
+ throw new Error(`https://svelte.dev/e/effect_in_teardown`);
262
+ }
263
+ /**
264
+ * Effect cannot be created inside a `$derived` value that was not itself created inside an effect
265
+ * @returns {never}
266
+ */
267
+ function effect_in_unowned_derived() {
268
+ throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`);
269
+ }
270
+ /**
271
+ * `%rune%` can only be used inside an effect (e.g. during component initialisation)
272
+ * @param {string} rune
273
+ * @returns {never}
274
+ */
275
+ function effect_orphan(rune) {
276
+ throw new Error(`https://svelte.dev/e/effect_orphan`);
277
+ }
278
+ /**
279
+ * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
280
+ * @returns {never}
281
+ */
282
+ function effect_update_depth_exceeded() {
283
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
284
+ }
285
+ /**
286
+ * Failed to hydrate the application
287
+ * @returns {never}
288
+ */
289
+ function hydration_failed() {
290
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
291
+ }
292
+ /**
293
+ * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value
294
+ * @param {string} key
295
+ * @returns {never}
296
+ */
297
+ function props_invalid_value(key) {
298
+ throw new Error(`https://svelte.dev/e/props_invalid_value`);
299
+ }
300
+ /**
301
+ * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
302
+ * @returns {never}
303
+ */
304
+ function state_descriptors_fixed() {
305
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
306
+ }
307
+ /**
308
+ * Cannot set prototype of `$state` object
309
+ * @returns {never}
310
+ */
311
+ function state_prototype_fixed() {
312
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
313
+ }
314
+ /**
315
+ * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
316
+ * @returns {never}
317
+ */
318
+ function state_unsafe_mutation() {
319
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
320
+ }
321
+ /**
322
+ * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
323
+ * @returns {never}
324
+ */
325
+ function svelte_boundary_reset_onerror() {
326
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
327
+ }
328
+ //#endregion
329
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/flags/index.js
328
330
  /** True if experimental.async=true */
329
331
  var async_mode_flag = false;
330
332
  /** True if we're not certain that we only have Svelte 5 code in the compilation */
331
333
  var legacy_mode_flag = false;
332
334
  //#endregion
333
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/context.js
335
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/context.js
334
336
  /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
335
337
  /** @type {ComponentContext | null} */
336
338
  var component_context = null;
@@ -375,14 +377,22 @@ function pop(component) {
375
377
  if (component !== void 0) context.x = component;
376
378
  context.i = true;
377
379
  component_context = context.p;
378
- return component ?? {};
380
+ return mark_as_component(component);
381
+ }
382
+ /**
383
+ * Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.
384
+ * @param {any} component
385
+ */
386
+ function mark_as_component(component = {}) {
387
+ define_property(component, COMPONENT_SYMBOL, { value: true });
388
+ return component;
379
389
  }
380
390
  /** @returns {boolean} */
381
391
  function is_runes() {
382
392
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
383
393
  }
384
394
  //#endregion
385
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/task.js
395
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/task.js
386
396
  /** @type {Array<() => void>} */
387
397
  var micro_tasks = [];
388
398
  function run_micro_tasks() {
@@ -408,39 +418,8 @@ function queue_micro_task(fn) {
408
418
  function flush_tasks() {
409
419
  while (micro_tasks.length > 0) run_micro_tasks();
410
420
  }
411
- /**
412
- * @param {unknown} error
413
- */
414
- function handle_error(error) {
415
- var effect = active_effect;
416
- if (effect === null) {
417
- /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
418
- return error;
419
- }
420
- if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
421
- invoke_error_boundary(error, effect);
422
- }
423
- /**
424
- * @param {unknown} error
425
- * @param {Effect | null} effect
426
- */
427
- function invoke_error_boundary(error, effect) {
428
- while (effect !== null) {
429
- if ((effect.f & 128) !== 0) {
430
- if ((effect.f & 32768) === 0) throw error;
431
- try {
432
- /** @type {Boundary} */ effect.b.error(error);
433
- return;
434
- } catch (e) {
435
- error = e;
436
- }
437
- }
438
- effect = effect.parent;
439
- }
440
- throw error;
441
- }
442
421
  //#endregion
443
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/status.js
422
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/status.js
444
423
  /** @import { Derived, Signal } from '#client' */
445
424
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
446
425
  /**
@@ -459,7 +438,7 @@ function update_derived_status(derived) {
459
438
  else set_signal_status(derived, MAYBE_DIRTY);
460
439
  }
461
440
  //#endregion
462
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/utils.js
441
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/utils.js
463
442
  /** @import { Derived, Effect, Value } from '#client' */
464
443
  /**
465
444
  * @param {Value[] | null} deps
@@ -487,7 +466,7 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
487
466
  set_signal_status(effect, CLEAN);
488
467
  }
489
468
  //#endregion
490
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/store.js
469
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/store.js
491
470
  /**
492
471
  * We set this to `true` when updating a store so that we correctly
493
472
  * schedule effects if the update takes place inside a `$:` effect
@@ -517,1449 +496,1050 @@ function capture_store_binding(fn) {
517
496
  }
518
497
  }
519
498
  //#endregion
520
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/checkPrivateRedeclaration.js
521
- function _checkPrivateRedeclaration(e, t) {
522
- if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
523
- }
524
- //#endregion
525
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateMethodInitSpec.js
526
- function _classPrivateMethodInitSpec(e, a) {
527
- _checkPrivateRedeclaration(e, a), a.add(e);
528
- }
529
- //#endregion
530
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldInitSpec.js
531
- function _classPrivateFieldInitSpec(e, t, a) {
532
- _checkPrivateRedeclaration(e, t), t.set(e, a);
533
- }
534
- //#endregion
535
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/assertClassBrand.js
536
- function _assertClassBrand(e, t, n) {
537
- if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
538
- throw new TypeError("Private element is not present on this object");
539
- }
540
- //#endregion
541
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldSet2.js
542
- function _classPrivateFieldSet2(s, a, r) {
543
- return s.set(_assertClassBrand(s, a), r), r;
544
- }
545
- //#endregion
546
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldGet2.js
547
- function _classPrivateFieldGet2(s, a) {
548
- return s.get(_assertClassBrand(s, a));
499
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
500
+ /**
501
+ * @template T
502
+ * @param {() => T} fn
503
+ */
504
+ function without_reactive_context(fn) {
505
+ var previous_reaction = active_reaction;
506
+ var previous_effect = active_effect;
507
+ set_active_reaction(null);
508
+ set_active_effect(null);
509
+ try {
510
+ return fn();
511
+ } finally {
512
+ set_active_reaction(previous_reaction);
513
+ set_active_effect(previous_effect);
514
+ }
549
515
  }
550
516
  //#endregion
551
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/batch.js
552
- /** @import { Fork } from 'svelte' */
553
- /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
554
- var _Batch;
555
- /** @type {Batch | null} */
556
- var first_batch = null;
557
- /** @type {Batch | null} */
558
- var last_batch = null;
559
- /** @type {Batch | null} */
560
- var current_batch = null;
517
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/async.js
518
+ /** @import { Blocker, Effect, Source, Value } from '#client' */
561
519
  /**
562
- * This is needed to avoid overwriting inputs
563
- * @type {Batch | null}
520
+ * @param {Blocker[]} blockers
521
+ * @param {Array<() => any>} sync
522
+ * @param {Array<() => Promise<any>>} async
523
+ * @param {(values: Value[]) => any} fn
564
524
  */
565
- var previous_batch = null;
566
- /**
567
- * When time travelling (i.e. working in one batch, while other batches
568
- * still have ongoing work), we ignore the real values of affected
569
- * signals in favour of their values within the batch
570
- * @type {Map<Value, any> | null}
571
- */
572
- var batch_values = null;
573
- /** @type {Effect | null} */
574
- var last_scheduled_effect = null;
575
- var is_flushing_sync = false;
576
- var is_processing = false;
577
- /**
578
- * During traversal, this is an array. Newly created effects are (if not immediately
579
- * executed) pushed to this array, rather than going through the scheduling
580
- * rigamarole that would cause another turn of the flush loop.
581
- * @type {Effect[] | null}
582
- */
583
- var collected_effects = null;
584
- /**
585
- * An array of effects that are marked during traversal as a result of a `set`
586
- * (not `internal_set`) call. These will be added to the next batch and
587
- * trigger another `batch.process()`
588
- * @type {Effect[] | null}
589
- * @deprecated when we get rid of legacy mode and stores, we can get rid of this
590
- */
591
- var legacy_updates = null;
592
- var flush_count = 0;
593
- var uid = 1;
594
- var _started = /* @__PURE__ */ new WeakMap();
595
- var _prev = /* @__PURE__ */ new WeakMap();
596
- var _next = /* @__PURE__ */ new WeakMap();
597
- var _commit_callbacks = /* @__PURE__ */ new WeakMap();
598
- var _discard_callbacks = /* @__PURE__ */ new WeakMap();
599
- var _pending = /* @__PURE__ */ new WeakMap();
600
- var _blocking_pending = /* @__PURE__ */ new WeakMap();
601
- var _deferred = /* @__PURE__ */ new WeakMap();
602
- var _roots = /* @__PURE__ */ new WeakMap();
603
- var _new_effects = /* @__PURE__ */ new WeakMap();
604
- var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
605
- var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
606
- var _skipped_branches = /* @__PURE__ */ new WeakMap();
607
- var _unskipped_branches = /* @__PURE__ */ new WeakMap();
608
- var _decrement_queued = /* @__PURE__ */ new WeakMap();
609
- var _Batch_brand = /* @__PURE__ */ new WeakSet();
610
- var Batch = class Batch {
611
- constructor() {
612
- _classPrivateMethodInitSpec(this, _Batch_brand);
613
- _defineProperty(this, "id", uid++);
614
- _classPrivateFieldInitSpec(this, _started, false);
615
- _defineProperty(this, "linked", true);
616
- _classPrivateFieldInitSpec(this, _prev, null);
617
- _classPrivateFieldInitSpec(this, _next, null);
618
- _defineProperty(
619
- this,
620
- /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
621
- "async_deriveds",
622
- /* @__PURE__ */ new Map()
623
- );
624
- _defineProperty(
625
- this,
626
- /**
627
- * The current values of any signals that are updated in this batch.
628
- * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
629
- * They keys of this map are identical to `this.#previous`
630
- * @type {Map<Value, [any, boolean]>}
631
- */
632
- "current",
633
- /* @__PURE__ */ new Map()
634
- );
635
- _defineProperty(
636
- this,
637
- /**
638
- * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
639
- * They keys of this map are identical to `this.#current`
640
- * @type {Map<Value, any>}
641
- */
642
- "previous",
643
- /* @__PURE__ */ new Map()
644
- );
645
- _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
646
- _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
647
- _classPrivateFieldInitSpec(this, _pending, 0);
648
- _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
649
- _classPrivateFieldInitSpec(this, _deferred, null);
650
- _classPrivateFieldInitSpec(this, _roots, []);
651
- _classPrivateFieldInitSpec(this, _new_effects, []);
652
- _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
653
- _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
654
- _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
655
- _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
656
- _defineProperty(this, "is_fork", false);
657
- _classPrivateFieldInitSpec(this, _decrement_queued, false);
658
- if (last_batch === null) first_batch = last_batch = this;
659
- else {
660
- _classPrivateFieldSet2(_next, last_batch, this);
661
- _classPrivateFieldSet2(_prev, this, last_batch);
662
- }
663
- last_batch = this;
664
- }
665
- /**
666
- * Add an effect to the #skipped_branches map and reset its children
667
- * @param {Effect} effect
668
- */
669
- skip_effect(effect) {
670
- if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
671
- d: [],
672
- m: []
673
- });
674
- _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
675
- }
676
- /**
677
- * Remove an effect from the #skipped_branches map and reschedule
678
- * any tracked dirty/maybe_dirty child effects
679
- * @param {Effect} effect
680
- * @param {(e: Effect) => void} callback
681
- */
682
- unskip_effect(effect, callback = (e) => this.schedule(e)) {
683
- var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
684
- if (tracked) {
685
- _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
686
- for (var e of tracked.d) {
687
- set_signal_status(e, DIRTY);
688
- callback(e);
689
- }
690
- for (e of tracked.m) {
691
- set_signal_status(e, MAYBE_DIRTY);
692
- callback(e);
693
- }
694
- }
695
- _classPrivateFieldGet2(_unskipped_branches, this).add(effect);
525
+ function flatten(blockers, sync, async, fn) {
526
+ const d = is_runes() ? derived : derived_safe_equal;
527
+ var pending = blockers.filter((b) => !b.settled);
528
+ var deriveds = sync.map(d);
529
+ if (async.length === 0 && pending.length === 0) {
530
+ fn(deriveds);
531
+ return;
696
532
  }
533
+ var parent = active_effect;
534
+ var restore = capture();
535
+ var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
697
536
  /**
698
- * Associate a change to a given source with the current
699
- * batch, noting its previous and current values
700
- * @param {Value} source
701
- * @param {any} value
702
- * @param {boolean} [is_derived]
537
+ * @param {Source[]} async
703
538
  */
704
- capture(source, value, is_derived = false) {
705
- if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
706
- if ((source.f & 8388608) === 0) {
707
- this.current.set(source, [value, is_derived]);
708
- batch_values?.set(source, value);
709
- }
710
- if (!this.is_fork) source.v = value;
711
- }
712
- activate() {
713
- current_batch = this;
714
- }
715
- deactivate() {
716
- current_batch = null;
717
- batch_values = null;
718
- }
719
- flush() {
539
+ function finish(async) {
540
+ if ((parent.f & 16384) !== 0) return;
541
+ restore();
720
542
  try {
721
- is_processing = true;
722
- current_batch = this;
723
- _assertClassBrand(_Batch_brand, this, _process).call(this);
724
- } finally {
725
- flush_count = 0;
726
- last_scheduled_effect = null;
727
- collected_effects = null;
728
- legacy_updates = null;
729
- is_processing = false;
730
- current_batch = null;
731
- batch_values = null;
732
- old_values.clear();
543
+ fn([...deriveds, ...async]);
544
+ } catch (error) {
545
+ invoke_error_boundary(error, parent);
733
546
  }
547
+ unset_context();
734
548
  }
735
- discard() {
736
- for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
737
- _classPrivateFieldGet2(_discard_callbacks, this).clear();
738
- _assertClassBrand(_Batch_brand, this, _unlink).call(this);
739
- _classPrivateFieldGet2(_deferred, this)?.resolve();
740
- }
741
- /**
742
- * @param {Effect} effect
743
- */
744
- register_created_effect(effect) {
745
- _classPrivateFieldGet2(_new_effects, this).push(effect);
549
+ var decrement_pending = increment_pending();
550
+ if (async.length === 0) {
551
+ /** @type {Promise<any>} */ blocker_promise.then(() => finish([])).finally(decrement_pending);
552
+ return;
746
553
  }
747
- /**
748
- * @param {boolean} blocking
749
- * @param {Effect} effect
750
- */
751
- increment(blocking, effect) {
752
- _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
753
- if (blocking) {
754
- let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
755
- _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
756
- }
554
+ function run() {
555
+ Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
757
556
  }
758
- /**
759
- * @param {boolean} blocking
760
- * @param {Effect} effect
761
- */
762
- decrement(blocking, effect) {
763
- _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
764
- if (blocking) {
765
- let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
766
- if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
767
- else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
557
+ if (blocker_promise) blocker_promise.then(() => {
558
+ restore();
559
+ run();
560
+ unset_context();
561
+ });
562
+ else run();
563
+ }
564
+ /**
565
+ * Captures the current effect context so that we can restore it after
566
+ * some asynchronous work has happened (so that e.g. `await a + b`
567
+ * causes `b` to be registered as a dependency).
568
+ */
569
+ function capture() {
570
+ var previous_effect = active_effect;
571
+ var previous_reaction = active_reaction;
572
+ var previous_component_context = component_context;
573
+ var previous_batch = current_batch;
574
+ return function restore(activate_batch = true) {
575
+ set_active_effect(previous_effect);
576
+ set_active_reaction(previous_reaction);
577
+ set_component_context(previous_component_context);
578
+ if (activate_batch && (previous_effect.f & 16384) === 0) {
579
+ previous_batch?.activate();
580
+ previous_batch?.apply();
768
581
  }
769
- if (_classPrivateFieldGet2(_decrement_queued, this)) return;
770
- _classPrivateFieldSet2(_decrement_queued, this, true);
771
- queue_micro_task(() => {
772
- _classPrivateFieldSet2(_decrement_queued, this, false);
773
- if (this.linked) this.flush();
774
- });
775
- }
776
- /**
777
- * @param {Set<Effect>} dirty_effects
778
- * @param {Set<Effect>} maybe_dirty_effects
779
- */
780
- transfer_effects(dirty_effects, maybe_dirty_effects) {
781
- for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
782
- for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
783
- dirty_effects.clear();
784
- maybe_dirty_effects.clear();
785
- }
786
- /** @param {(batch: Batch) => void} fn */
787
- oncommit(fn) {
788
- _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
789
- }
790
- /** @param {(batch: Batch) => void} fn */
791
- ondiscard(fn) {
792
- _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
793
- }
794
- settled() {
795
- return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
796
- }
797
- static ensure() {
798
- if (current_batch === null) {
799
- const batch = current_batch = new Batch();
800
- if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
801
- if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
802
- });
582
+ };
583
+ }
584
+ function unset_context(deactivate_batch = true) {
585
+ set_active_effect(null);
586
+ set_active_reaction(null);
587
+ set_component_context(null);
588
+ if (deactivate_batch) current_batch?.deactivate();
589
+ }
590
+ /**
591
+ * @returns {(skip?: boolean) => void}
592
+ */
593
+ function increment_pending() {
594
+ var effect = active_effect;
595
+ var boundary = effect.b;
596
+ var batch = current_batch;
597
+ var blocking = !!boundary?.is_rendered();
598
+ boundary?.update_pending_count(1, batch);
599
+ batch.increment(blocking, effect);
600
+ return () => {
601
+ boundary?.update_pending_count(-1, batch);
602
+ batch.decrement(blocking, effect);
603
+ };
604
+ }
605
+ /**
606
+ * @template V
607
+ * @param {() => V} fn
608
+ * @returns {Derived<V>}
609
+ */
610
+ /*#__NO_SIDE_EFFECTS__*/
611
+ function derived(fn) {
612
+ var flags = 2 | DIRTY;
613
+ if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
614
+ return {
615
+ ctx: component_context,
616
+ deps: null,
617
+ effects: null,
618
+ equals,
619
+ f: flags,
620
+ fn,
621
+ reactions: null,
622
+ rv: 0,
623
+ v: UNINITIALIZED,
624
+ wv: 0,
625
+ parent: active_effect,
626
+ ac: null
627
+ };
628
+ }
629
+ var OBSOLETE = Symbol("obsolete");
630
+ /**
631
+ * @template V
632
+ * @param {() => V | Promise<V>} fn
633
+ * @param {string} [label]
634
+ * @param {string} [location] If provided, print a warning if the value is not read immediately after update
635
+ * @returns {Promise<Source<V>>}
636
+ */
637
+ /*#__NO_SIDE_EFFECTS__*/
638
+ function async_derived(fn, label, location) {
639
+ let parent = active_effect;
640
+ if (parent === null) async_derived_orphan();
641
+ var promise = void 0;
642
+ var signal = source(UNINITIALIZED);
643
+ var should_suspend = !active_reaction;
644
+ /** @type {Set<ReturnType<typeof deferred<V>>>} */
645
+ var deferreds = /* @__PURE__ */ new Set();
646
+ async_effect(() => {
647
+ var effect = active_effect;
648
+ /** @type {ReturnType<typeof deferred<V>>} */
649
+ var d = deferred();
650
+ promise = d.promise;
651
+ try {
652
+ Promise.resolve(fn()).then(d.resolve, (e) => {
653
+ if (e !== STALE_REACTION) d.reject(e);
654
+ }).finally(unset_context);
655
+ } catch (error) {
656
+ d.reject(error);
657
+ unset_context();
803
658
  }
804
- return current_batch;
805
- }
806
- apply() {
807
- if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
808
- batch_values = null;
809
- return;
659
+ var batch = current_batch;
660
+ if (should_suspend) {
661
+ if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
662
+ if (parent.b?.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE);
663
+ else for (const d of deferreds.values()) d.reject(OBSOLETE);
664
+ deferreds.add(d);
665
+ batch.async_deriveds.set(effect, d);
810
666
  }
811
- batch_values = /* @__PURE__ */ new Map();
812
- for (const [source, [value]] of this.current) batch_values.set(source, value);
813
- for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
814
- if (batch === this || batch.is_fork) continue;
815
- var intersects = false;
816
- if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
817
- if (is_derived) continue;
818
- if (this.current.has(source)) {
819
- intersects = true;
820
- break;
821
- }
667
+ /**
668
+ * @param {any} value
669
+ * @param {unknown} error
670
+ */
671
+ const handler = (value, error = void 0) => {
672
+ decrement_pending?.();
673
+ deferreds.delete(d);
674
+ if (error === OBSOLETE) return;
675
+ batch.activate();
676
+ if (error) {
677
+ signal.f |= ERROR_VALUE;
678
+ internal_set(signal, error);
679
+ } else {
680
+ if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
681
+ internal_set(signal, value);
822
682
  }
823
- if (!intersects) {
824
- for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
683
+ batch.deactivate();
684
+ };
685
+ d.promise.then(handler, (e) => handler(null, e || "unknown"));
686
+ });
687
+ teardown(() => {
688
+ for (const d of deferreds) d.reject(OBSOLETE);
689
+ });
690
+ return new Promise((fulfil) => {
691
+ /** @param {Promise<V>} p */
692
+ function next(p) {
693
+ function go() {
694
+ if (p === promise) fulfil(signal);
695
+ else next(promise);
825
696
  }
697
+ p.then(go, go);
826
698
  }
699
+ next(promise);
700
+ });
701
+ }
702
+ /**
703
+ * @template V
704
+ * @param {() => V} fn
705
+ * @returns {Derived<V>}
706
+ */
707
+ /*#__NO_SIDE_EFFECTS__*/
708
+ function derived_safe_equal(fn) {
709
+ const signal = /* @__PURE__ */ derived(fn);
710
+ signal.equals = safe_equals;
711
+ return signal;
712
+ }
713
+ /**
714
+ * @param {Derived} derived
715
+ * @returns {void}
716
+ */
717
+ function destroy_derived_effects(derived) {
718
+ var effects = derived.effects;
719
+ if (effects !== null) {
720
+ derived.effects = null;
721
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
827
722
  }
828
- /**
829
- *
830
- * @param {Effect} effect
831
- */
832
- schedule(effect) {
833
- last_scheduled_effect = effect;
834
- if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
835
- effect.b.defer_effect(effect);
836
- return;
837
- }
838
- var e = effect;
839
- while (e.parent !== null) {
840
- e = e.parent;
841
- var flags = e.f;
842
- if (collected_effects !== null && e === active_effect) {
843
- if (async_mode_flag) return;
844
- if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
845
- }
846
- if ((flags & 96) !== 0) {
847
- if ((flags & 1024) === 0) return;
848
- e.f ^= CLEAN;
849
- }
850
- }
851
- _classPrivateFieldGet2(_roots, this).push(e);
723
+ }
724
+ /**
725
+ * @template T
726
+ * @param {Derived} derived
727
+ * @returns {T}
728
+ */
729
+ function execute_derived(derived) {
730
+ var value;
731
+ var prev_active_effect = active_effect;
732
+ var parent = derived.parent;
733
+ if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
734
+ derived_inert();
735
+ return derived.v;
852
736
  }
853
- };
854
- _Batch = Batch;
855
- function _is_deferred() {
856
- if (this.is_fork) return true;
857
- for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
858
- var e = effect;
859
- var skipped = false;
860
- while (e.parent !== null) {
861
- if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
862
- skipped = true;
863
- break;
737
+ set_active_effect(parent);
738
+ try {
739
+ derived.f &= ~WAS_MARKED;
740
+ destroy_derived_effects(derived);
741
+ value = update_reaction(derived);
742
+ } finally {
743
+ set_active_effect(prev_active_effect);
744
+ }
745
+ return value;
746
+ }
747
+ /**
748
+ * @param {Derived} derived
749
+ * @returns {void}
750
+ */
751
+ function update_derived(derived) {
752
+ var value = execute_derived(derived);
753
+ if (!derived.equals(value)) {
754
+ derived.wv = increment_write_version();
755
+ if (!current_batch?.is_fork || derived.deps === null) {
756
+ if (current_batch !== null) {
757
+ current_batch.capture(derived, value, true);
758
+ previous_batch?.capture(derived, value, true);
759
+ } else derived.v = value;
760
+ if (derived.deps === null) {
761
+ set_signal_status(derived, CLEAN);
762
+ return;
864
763
  }
865
- e = e.parent;
866
764
  }
867
- if (!skipped) return true;
868
765
  }
869
- return false;
870
- }
871
- function _process() {
872
- _classPrivateFieldSet2(_started, this, true);
873
- if (flush_count++ > 1e3) {
874
- _assertClassBrand(_Batch_brand, this, _unlink).call(this);
875
- infinite_loop_guard();
876
- }
877
- for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
878
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
879
- set_signal_status(e, DIRTY);
880
- this.schedule(e);
881
- }
882
- for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
883
- set_signal_status(e, MAYBE_DIRTY);
884
- this.schedule(e);
885
- }
886
- const roots = _classPrivateFieldGet2(_roots, this);
887
- _classPrivateFieldSet2(_roots, this, []);
888
- this.apply();
889
- /** @type {Effect[]} */
890
- var effects = collected_effects = [];
891
- /** @type {Effect[]} */
892
- var render_effects = [];
893
- /**
894
- * @type {Effect[]}
895
- * @deprecated when we get rid of legacy mode and stores, we can get rid of this
896
- */
897
- var updates = legacy_updates = [];
898
- for (const root of roots) try {
899
- _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
900
- } catch (e) {
901
- reset_all(root);
902
- if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
903
- throw e;
904
- }
905
- current_batch = null;
906
- if (updates.length > 0) {
907
- var batch = _Batch.ensure();
908
- for (const e of updates) batch.schedule(e);
909
- }
910
- collected_effects = null;
911
- legacy_updates = null;
912
- if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
913
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
914
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
915
- for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
916
- if (updates.length > 0)
917
- /** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
918
- return;
919
- }
920
- const earlier_batch = _assertClassBrand(_Batch_brand, this, _find_earlier_batch).call(this);
921
- if (earlier_batch) {
922
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
923
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
924
- _assertClassBrand(_Batch_brand, earlier_batch, _merge).call(earlier_batch, this);
925
- return;
926
- }
927
- _classPrivateFieldGet2(_dirty_effects$1, this).clear();
928
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
929
- for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
930
- _classPrivateFieldGet2(_commit_callbacks, this).clear();
931
- previous_batch = this;
932
- flush_queued_effects(render_effects);
933
- flush_queued_effects(effects);
934
- previous_batch = null;
935
- _classPrivateFieldGet2(_deferred, this)?.resolve();
936
- var next_batch = current_batch;
937
- if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
938
- _assertClassBrand(_Batch_brand, this, _unlink).call(this);
939
- if (async_mode_flag) {
940
- _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
941
- current_batch = next_batch;
942
- }
943
- }
944
- if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
945
- const batch = next_batch;
946
- _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
947
- } else next_batch = this;
948
- if (next_batch !== null) _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
766
+ if (is_destroying_effect) return;
767
+ if (batch_values !== null) {
768
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
769
+ } else update_derived_status(derived);
949
770
  }
950
771
  /**
951
- * Traverse the effect tree, executing effects or stashing
952
- * them for later execution as appropriate
953
- * @param {Effect} root
954
- * @param {Effect[]} effects
955
- * @param {Effect[]} render_effects
772
+ * @param {Derived} derived
956
773
  */
957
- function _traverse(root, effects, render_effects) {
958
- root.f ^= CLEAN;
959
- var effect = root.first;
960
- while (effect !== null) {
961
- var flags = effect.f;
962
- var is_branch = (flags & 96) !== 0;
963
- if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
964
- if (is_branch) effect.f ^= CLEAN;
965
- else if ((flags & 4) !== 0) effects.push(effect);
966
- else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
967
- else if (is_dirty(effect)) {
968
- if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(effect);
969
- update_effect(effect);
970
- }
971
- var child = effect.first;
972
- if (child !== null) {
973
- effect = child;
974
- continue;
975
- }
976
- }
977
- while (effect !== null) {
978
- var next = effect.next;
979
- if (next !== null) {
980
- effect = next;
981
- break;
982
- }
983
- effect = effect.parent;
984
- }
985
- }
986
- }
987
- function _find_earlier_batch() {
988
- var batch = _classPrivateFieldGet2(_prev, this);
989
- while (batch !== null) {
990
- if (!batch.is_fork) {
991
- for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
992
- }
993
- batch = _classPrivateFieldGet2(_prev, batch);
774
+ function freeze_derived_effects(derived) {
775
+ if (derived.effects === null) return;
776
+ for (const e of derived.effects) if (e.teardown || e.ac) {
777
+ e.teardown?.();
778
+ if (e.ac !== null) without_reactive_context(() => {
779
+ /** @type {AbortController} */ e.ac.abort(STALE_REACTION);
780
+ e.ac = null;
781
+ });
782
+ if (e.fn !== null) e.teardown = noop;
783
+ remove_reactions(e, 0);
784
+ destroy_effect_children(e);
994
785
  }
995
- return null;
996
786
  }
997
787
  /**
998
- * @param {Batch} batch
788
+ * @param {Derived} derived
999
789
  */
1000
- function _merge(batch) {
1001
- for (const [source, value] of batch.current) {
1002
- if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
1003
- this.current.set(source, value);
1004
- }
1005
- for (const [effect, deferred] of batch.async_deriveds) {
1006
- const d = this.async_deriveds.get(effect);
1007
- if (d) deferred.promise.then(d.resolve).catch(d.reject);
1008
- }
1009
- this.transfer_effects(_classPrivateFieldGet2(_dirty_effects$1, batch), _classPrivateFieldGet2(_maybe_dirty_effects$1, batch));
1010
- /**
1011
- * mark all effects that depend on `batch.current`, except the
1012
- * async effects that we just resolved (TODO unless they depend
1013
- * on values in this batch that are NOT in the later batch?).
1014
- * Through this we also will populate the correct #skipped_branches,
1015
- * oncommit callbacks etc, so we don't need to merge them separately.
1016
- * @param {Value} value
1017
- */
1018
- const mark = (value) => {
1019
- var reactions = value.reactions;
1020
- if (reactions === null) return;
1021
- for (const reaction of reactions) {
1022
- var flags = reaction.f;
1023
- if ((flags & 2) !== 0) mark(reaction);
1024
- else {
1025
- var effect = reaction;
1026
- if (flags & 4194320 && !this.async_deriveds.has(effect)) {
1027
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(effect);
1028
- set_signal_status(effect, DIRTY);
1029
- this.schedule(effect);
1030
- }
1031
- }
1032
- }
1033
- };
1034
- for (const source of this.current.keys()) mark(source);
1035
- this.oncommit(() => batch.discard());
1036
- _assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
1037
- current_batch = this;
1038
- _assertClassBrand(_Batch_brand, this, _process).call(this);
790
+ function unfreeze_derived_effects(derived) {
791
+ if (derived.effects === null) return;
792
+ for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
1039
793
  }
1040
- /**
1041
- * @param {Effect[]} effects
1042
- */
1043
- function _defer_effects(effects) {
1044
- for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
794
+ //#endregion
795
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/checkPrivateRedeclaration.js
796
+ function _checkPrivateRedeclaration(e, t) {
797
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
1045
798
  }
1046
- function _commit$1() {
1047
- for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
1048
- var is_earlier = batch.id < this.id;
1049
- /** @type {Source[]} */
1050
- var sources = [];
1051
- for (const [source, [value, is_derived]] of this.current) {
1052
- if (batch.current.has(source)) {
1053
- var batch_value = batch.current.get(source)[0];
1054
- if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
1055
- else continue;
1056
- }
1057
- sources.push(source);
1058
- }
1059
- if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
1060
- const d = batch.async_deriveds.get(effect);
1061
- if (d) deferred.promise.then(d.resolve).catch(d.reject);
1062
- }
1063
- if (!_classPrivateFieldGet2(_started, batch)) continue;
1064
- var others = [...batch.current.keys()].filter((s) => !batch.current.get(s)[1] && !this.current.has(s));
1065
- if (others.length === 0) {
1066
- if (is_earlier) batch.discard();
1067
- } else if (sources.length > 0) {
1068
- if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
1069
- if ((e.f & 4194320) !== 0) batch.schedule(e);
1070
- else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
1071
- });
1072
- batch.activate();
1073
- /** @type {Set<Value>} */
1074
- var marked = /* @__PURE__ */ new Set();
1075
- /** @type {Map<Reaction, boolean>} */
1076
- var checked = /* @__PURE__ */ new Map();
1077
- for (var source of sources) mark_effects(source, others, marked, checked);
1078
- checked = /* @__PURE__ */ new Map();
1079
- var current_unequal = [...batch.current].filter(([c, v1]) => {
1080
- const v2 = this.current.get(c);
1081
- if (!v2) return true;
1082
- return v2[0] !== v1[0] || v2[1] !== v1[1];
1083
- }).map(([c]) => c);
1084
- if (current_unequal.length > 0) {
1085
- for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1086
- set_signal_status(effect, DIRTY);
1087
- batch.schedule(effect);
1088
- } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
1089
- }
1090
- if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1091
- batch.apply();
1092
- for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1093
- _classPrivateFieldSet2(_roots, batch, []);
1094
- }
1095
- batch.deactivate();
1096
- }
1097
- }
799
+ //#endregion
800
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateMethodInitSpec.js
801
+ function _classPrivateMethodInitSpec(e, a) {
802
+ _checkPrivateRedeclaration(e, a), a.add(e);
1098
803
  }
1099
- function _unlink() {
1100
- if (!this.linked) return;
1101
- var prev = _classPrivateFieldGet2(_prev, this);
1102
- var next = _classPrivateFieldGet2(_next, this);
1103
- if (prev === null) first_batch = next;
1104
- else _classPrivateFieldSet2(_next, prev, next);
1105
- if (next === null) last_batch = prev;
1106
- else _classPrivateFieldSet2(_prev, next, prev);
1107
- this.linked = false;
804
+ //#endregion
805
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldInitSpec.js
806
+ function _classPrivateFieldInitSpec(e, t, a) {
807
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
1108
808
  }
1109
- /**
1110
- * Synchronously flush any pending updates.
1111
- * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1112
- * @template [T=void]
1113
- * @param {(() => T) | undefined} [fn]
1114
- * @returns {T}
1115
- */
1116
- function flushSync(fn) {
1117
- var was_flushing_sync = is_flushing_sync;
1118
- is_flushing_sync = true;
1119
- try {
1120
- var result;
1121
- if (fn) {
1122
- if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
1123
- result = fn();
1124
- }
1125
- while (true) {
1126
- flush_tasks();
1127
- if (current_batch === null) return result;
1128
- current_batch.flush();
1129
- }
1130
- } finally {
1131
- is_flushing_sync = was_flushing_sync;
1132
- }
809
+ //#endregion
810
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/assertClassBrand.js
811
+ function _assertClassBrand(e, t, n) {
812
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
813
+ throw new TypeError("Private element is not present on this object");
1133
814
  }
1134
- function infinite_loop_guard() {
1135
- try {
1136
- effect_update_depth_exceeded();
1137
- } catch (error) {
1138
- invoke_error_boundary(error, last_scheduled_effect);
1139
- }
815
+ //#endregion
816
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldSet2.js
817
+ function _classPrivateFieldSet2(s, a, r) {
818
+ return s.set(_assertClassBrand(s, a), r), r;
1140
819
  }
1141
- /** @type {Set<Effect> | null} */
1142
- var eager_block_effects = null;
1143
- /**
1144
- * @param {Array<Effect>} effects
1145
- * @returns {void}
1146
- */
1147
- function flush_queued_effects(effects) {
1148
- var length = effects.length;
1149
- if (length === 0) return;
1150
- var i = 0;
1151
- while (i < length) {
1152
- var effect = effects[i++];
1153
- if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1154
- eager_block_effects = /* @__PURE__ */ new Set();
1155
- update_effect(effect);
1156
- if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1157
- if (eager_block_effects?.size > 0) {
1158
- old_values.clear();
1159
- for (const e of eager_block_effects) {
1160
- if ((e.f & 24576) !== 0) continue;
1161
- /** @type {Effect[]} */
1162
- const ordered_effects = [e];
1163
- let ancestor = e.parent;
1164
- while (ancestor !== null) {
1165
- if (eager_block_effects.has(ancestor)) {
1166
- eager_block_effects.delete(ancestor);
1167
- ordered_effects.push(ancestor);
1168
- }
1169
- ancestor = ancestor.parent;
1170
- }
1171
- for (let j = ordered_effects.length - 1; j >= 0; j--) {
1172
- const e = ordered_effects[j];
1173
- if ((e.f & 24576) !== 0) continue;
1174
- update_effect(e);
1175
- }
1176
- }
1177
- eager_block_effects.clear();
1178
- }
1179
- }
1180
- }
1181
- eager_block_effects = null;
820
+ //#endregion
821
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldGet2.js
822
+ function _classPrivateFieldGet2(s, a) {
823
+ return s.get(_assertClassBrand(s, a));
1182
824
  }
825
+ //#endregion
826
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/batch.js
827
+ /** @import { Fork } from 'svelte' */
828
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
829
+ var _Batch;
830
+ /** @type {Batch | null} */
831
+ var first_batch = null;
832
+ /** @type {Batch | null} */
833
+ var last_batch = null;
834
+ /** @type {Batch | null} */
835
+ var current_batch = null;
1183
836
  /**
1184
- * This is similar to `mark_reactions`, but it only marks async/block effects
1185
- * depending on `value` and at least one of the other `sources`, so that
1186
- * these effects can re-run after another batch has been committed
1187
- * @param {Value} value
1188
- * @param {Source[]} sources
1189
- * @param {Set<Value>} marked
1190
- * @param {Map<Reaction, boolean>} checked
837
+ * This is needed to avoid overwriting inputs
838
+ * @type {Batch | null}
1191
839
  */
1192
- function mark_effects(value, sources, marked, checked) {
1193
- if (marked.has(value)) return;
1194
- marked.add(value);
1195
- if (value.reactions !== null) for (const reaction of value.reactions) {
1196
- const flags = reaction.f;
1197
- if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1198
- else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1199
- set_signal_status(reaction, DIRTY);
1200
- schedule_effect(reaction);
1201
- }
1202
- }
1203
- }
840
+ var previous_batch = null;
1204
841
  /**
1205
- * @param {Reaction} reaction
1206
- * @param {Source[]} sources
1207
- * @param {Map<Reaction, boolean>} checked
842
+ * When time travelling (i.e. working in one batch, while other batches
843
+ * still have ongoing work), we ignore the real values of affected
844
+ * signals in favour of their values within the batch
845
+ * @type {Map<Value, any> | null}
1208
846
  */
1209
- function depends_on(reaction, sources, checked) {
1210
- const depends = checked.get(reaction);
1211
- if (depends !== void 0) return depends;
1212
- if (reaction.deps !== null) for (const dep of reaction.deps) {
1213
- if (includes.call(sources, dep)) return true;
1214
- if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1215
- checked.set(dep, true);
1216
- return true;
1217
- }
1218
- }
1219
- checked.set(reaction, false);
1220
- return false;
1221
- }
847
+ var batch_values = null;
848
+ /** @type {Effect | null} */
849
+ var last_scheduled_effect = null;
850
+ var is_flushing_sync = false;
851
+ var is_processing = false;
1222
852
  /**
1223
- * @param {Effect} effect
1224
- * @returns {void}
853
+ * During traversal, this is an array. Newly created effects are (if not immediately
854
+ * executed) pushed to this array, rather than going through the scheduling
855
+ * rigamarole that would cause another turn of the flush loop.
856
+ * @type {Effect[] | null}
1225
857
  */
1226
- function schedule_effect(effect) {
1227
- /** @type {Batch} */ current_batch.schedule(effect);
1228
- }
858
+ var collected_effects = null;
1229
859
  /**
1230
- * Mark all the effects inside a skipped branch CLEAN, so that
1231
- * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1232
- * effects so they can be rescheduled if the branch survives.
1233
- * @param {Effect} effect
1234
- * @param {{ d: Effect[], m: Effect[] }} tracked
860
+ * An array of effects that are marked during traversal as a result of a `set`
861
+ * (not `internal_set`) call. These will be added to the next batch and
862
+ * trigger another `batch.process()`
863
+ * @type {Effect[] | null}
864
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1235
865
  */
1236
- function reset_branch(effect, tracked) {
1237
- if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1238
- if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1239
- else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1240
- set_signal_status(effect, CLEAN);
1241
- var e = effect.first;
1242
- while (e !== null) {
1243
- reset_branch(e, tracked);
1244
- e = e.next;
866
+ var legacy_updates = null;
867
+ var flush_count = 0;
868
+ var uid = 1;
869
+ var _started = /* @__PURE__ */ new WeakMap();
870
+ var _prev = /* @__PURE__ */ new WeakMap();
871
+ var _next = /* @__PURE__ */ new WeakMap();
872
+ var _commit_callbacks = /* @__PURE__ */ new WeakMap();
873
+ var _discard_callbacks = /* @__PURE__ */ new WeakMap();
874
+ var _pending = /* @__PURE__ */ new WeakMap();
875
+ var _blocking_pending = /* @__PURE__ */ new WeakMap();
876
+ var _deferred = /* @__PURE__ */ new WeakMap();
877
+ var _roots = /* @__PURE__ */ new WeakMap();
878
+ var _new_effects = /* @__PURE__ */ new WeakMap();
879
+ var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
880
+ var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
881
+ var _skipped_branches = /* @__PURE__ */ new WeakMap();
882
+ var _unskipped_branches = /* @__PURE__ */ new WeakMap();
883
+ var _decrement_queued = /* @__PURE__ */ new WeakMap();
884
+ var _Batch_brand = /* @__PURE__ */ new WeakSet();
885
+ var Batch = class Batch {
886
+ constructor() {
887
+ _classPrivateMethodInitSpec(this, _Batch_brand);
888
+ _defineProperty(this, "id", uid++);
889
+ _classPrivateFieldInitSpec(this, _started, false);
890
+ _defineProperty(this, "linked", true);
891
+ _classPrivateFieldInitSpec(this, _prev, null);
892
+ _classPrivateFieldInitSpec(this, _next, null);
893
+ _defineProperty(
894
+ this,
895
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
896
+ "async_deriveds",
897
+ /* @__PURE__ */ new Map()
898
+ );
899
+ _defineProperty(
900
+ this,
901
+ /**
902
+ * The current values of any signals that are updated in this batch.
903
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
904
+ * They keys of this map are identical to `this.#previous`
905
+ * @type {Map<Value, [any, boolean]>}
906
+ */
907
+ "current",
908
+ /* @__PURE__ */ new Map()
909
+ );
910
+ _defineProperty(
911
+ this,
912
+ /**
913
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
914
+ * They keys of this map are identical to `this.#current`
915
+ * @type {Map<Value, any>}
916
+ */
917
+ "previous",
918
+ /* @__PURE__ */ new Map()
919
+ );
920
+ _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
921
+ _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
922
+ _classPrivateFieldInitSpec(this, _pending, 0);
923
+ _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
924
+ _classPrivateFieldInitSpec(this, _deferred, null);
925
+ _classPrivateFieldInitSpec(this, _roots, []);
926
+ _classPrivateFieldInitSpec(this, _new_effects, []);
927
+ _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
928
+ _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
929
+ _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
930
+ _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
931
+ _defineProperty(this, "is_fork", false);
932
+ _classPrivateFieldInitSpec(this, _decrement_queued, false);
933
+ if (last_batch === null) first_batch = last_batch = this;
934
+ else {
935
+ _classPrivateFieldSet2(_next, last_batch, this);
936
+ _classPrivateFieldSet2(_prev, this, last_batch);
937
+ }
938
+ last_batch = this;
1245
939
  }
1246
- }
1247
- /**
1248
- * Mark an entire effect tree clean following an error
1249
- * @param {Effect} effect
1250
- */
1251
- function reset_all(effect) {
1252
- set_signal_status(effect, CLEAN);
1253
- var e = effect.first;
1254
- while (e !== null) {
1255
- reset_all(e);
1256
- e = e.next;
940
+ /**
941
+ * Add an effect to the #skipped_branches map and reset its children
942
+ * @param {Effect} effect
943
+ */
944
+ skip_effect(effect) {
945
+ if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
946
+ d: [],
947
+ m: []
948
+ });
949
+ _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
1257
950
  }
1258
- }
1259
- //#endregion
1260
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/reactivity/create-subscriber.js
1261
- /**
1262
- * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1263
- * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
1264
- *
1265
- * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
1266
- * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
1267
- *
1268
- * If `start` returns a cleanup function, it will be called when the effect is destroyed.
1269
- *
1270
- * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
1271
- * are active, and the returned teardown function will only be called when all effects are destroyed.
1272
- *
1273
- * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
1274
- *
1275
- * ```js
1276
- * import { createSubscriber } from 'svelte/reactivity';
1277
- * import { on } from 'svelte/events';
1278
- *
1279
- * export class MediaQuery {
1280
- * #query;
1281
- * #subscribe;
1282
- *
1283
- * constructor(query) {
1284
- * this.#query = window.matchMedia(`(${query})`);
1285
- *
1286
- * this.#subscribe = createSubscriber((update) => {
1287
- * // when the `change` event occurs, re-run any effects that read `this.current`
1288
- * const off = on(this.#query, 'change', update);
1289
- *
1290
- * // stop listening when all the effects are destroyed
1291
- * return () => off();
1292
- * });
1293
- * }
1294
- *
1295
- * get current() {
1296
- * // This makes the getter reactive, if read in an effect
1297
- * this.#subscribe();
1298
- *
1299
- * // Return the current state of the query, whether or not we're in an effect
1300
- * return this.#query.matches;
1301
- * }
1302
- * }
1303
- * ```
1304
- * @param {(update: () => void) => (() => void) | void} start
1305
- * @since 5.7.0
1306
- */
1307
- function createSubscriber(start) {
1308
- let subscribers = 0;
1309
- let version = source(0);
1310
- /** @type {(() => void) | void} */
1311
- let stop;
1312
- return () => {
1313
- if (effect_tracking()) {
1314
- get(version);
1315
- render_effect(() => {
1316
- if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
1317
- subscribers += 1;
1318
- return () => {
1319
- queue_micro_task(() => {
1320
- subscribers -= 1;
1321
- if (subscribers === 0) {
1322
- stop?.();
1323
- stop = void 0;
1324
- increment(version);
1325
- }
1326
- });
1327
- };
1328
- });
951
+ /**
952
+ * Remove an effect from the #skipped_branches map and reschedule
953
+ * any tracked dirty/maybe_dirty child effects
954
+ * @param {Effect} effect
955
+ * @param {(e: Effect) => void} callback
956
+ */
957
+ unskip_effect(effect, callback = (e) => this.schedule(e)) {
958
+ var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
959
+ if (tracked) {
960
+ _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
961
+ for (var e of tracked.d) {
962
+ set_signal_status(e, DIRTY);
963
+ callback(e);
964
+ }
965
+ for (e of tracked.m) {
966
+ set_signal_status(e, MAYBE_DIRTY);
967
+ callback(e);
968
+ }
1329
969
  }
1330
- };
1331
- }
1332
- //#endregion
1333
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1334
- /** @import { Effect, Source, TemplateNode, } from '#client' */
1335
- /**
1336
- * @typedef {{
1337
- * onerror?: ((error: unknown, reset: () => void) => void) | null;
1338
- * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
1339
- * pending?: ((anchor: Node) => void) | null;
1340
- * }} BoundaryProps
1341
- */
1342
- var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1343
- /**
1344
- * @param {TemplateNode} node
1345
- * @param {BoundaryProps} props
1346
- * @param {((anchor: Node) => void)} children
1347
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1348
- * @returns {void}
1349
- */
1350
- function boundary(node, props, children, transform_error) {
1351
- new Boundary(node, props, children, transform_error);
1352
- }
1353
- var _anchor = /* @__PURE__ */ new WeakMap();
1354
- var _hydrate_open = /* @__PURE__ */ new WeakMap();
1355
- var _props = /* @__PURE__ */ new WeakMap();
1356
- var _children = /* @__PURE__ */ new WeakMap();
1357
- var _effect = /* @__PURE__ */ new WeakMap();
1358
- var _main_effect = /* @__PURE__ */ new WeakMap();
1359
- var _pending_effect = /* @__PURE__ */ new WeakMap();
1360
- var _failed_effect = /* @__PURE__ */ new WeakMap();
1361
- var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1362
- var _local_pending_count = /* @__PURE__ */ new WeakMap();
1363
- var _pending_count = /* @__PURE__ */ new WeakMap();
1364
- var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
1365
- var _dirty_effects = /* @__PURE__ */ new WeakMap();
1366
- var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
1367
- var _effect_pending = /* @__PURE__ */ new WeakMap();
1368
- var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1369
- var _Boundary_brand = /* @__PURE__ */ new WeakSet();
1370
- var Boundary = class {
970
+ _classPrivateFieldGet2(_unskipped_branches, this).add(effect);
971
+ }
1371
972
  /**
1372
- * @param {TemplateNode} node
1373
- * @param {BoundaryProps} props
1374
- * @param {((anchor: Node) => void)} children
1375
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
973
+ * Associate a change to a given source with the current
974
+ * batch, noting its previous and current values
975
+ * @param {Value} source
976
+ * @param {any} value
977
+ * @param {boolean} [is_derived]
1376
978
  */
1377
- constructor(node, props, children, transform_error) {
1378
- _classPrivateMethodInitSpec(this, _Boundary_brand);
1379
- _defineProperty(
1380
- this,
1381
- /** @type {Boundary | null} */
1382
- "parent",
1383
- void 0
1384
- );
1385
- _defineProperty(this, "is_pending", false);
1386
- _defineProperty(
1387
- this,
1388
- /**
1389
- * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1390
- * Inherited from parent boundary, or defaults to identity.
1391
- * @type {(error: unknown) => unknown}
1392
- */
1393
- "transform_error",
1394
- void 0
1395
- );
1396
- _classPrivateFieldInitSpec(this, _anchor, void 0);
1397
- _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
1398
- _classPrivateFieldInitSpec(this, _props, void 0);
1399
- _classPrivateFieldInitSpec(this, _children, void 0);
1400
- _classPrivateFieldInitSpec(this, _effect, void 0);
1401
- _classPrivateFieldInitSpec(this, _main_effect, null);
1402
- _classPrivateFieldInitSpec(this, _pending_effect, null);
1403
- _classPrivateFieldInitSpec(this, _failed_effect, null);
1404
- _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
1405
- _classPrivateFieldInitSpec(this, _local_pending_count, 0);
1406
- _classPrivateFieldInitSpec(this, _pending_count, 0);
1407
- _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
1408
- _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
1409
- _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
1410
- _classPrivateFieldInitSpec(this, _effect_pending, null);
1411
- _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
1412
- _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
1413
- return () => {
1414
- _classPrivateFieldSet2(_effect_pending, this, null);
1415
- };
1416
- }));
1417
- _classPrivateFieldSet2(_anchor, this, node);
1418
- _classPrivateFieldSet2(_props, this, props);
1419
- _classPrivateFieldSet2(_children, this, (anchor) => {
1420
- var effect = active_effect;
1421
- effect.b = this;
1422
- effect.f |= 128;
1423
- children(anchor);
1424
- });
1425
- this.parent = active_effect.b;
1426
- this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
1427
- _classPrivateFieldSet2(_effect, this, block(() => {
1428
- if (hydrating) {
1429
- const comment = _classPrivateFieldGet2(_hydrate_open, this);
1430
- hydrate_next();
1431
- const server_rendered_pending = comment.data === "[!";
1432
- if (comment.data.startsWith("[?")) {
1433
- const serialized_error = JSON.parse(comment.data.slice(2));
1434
- _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
1435
- } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
1436
- else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
1437
- } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
1438
- }, flags));
1439
- if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
979
+ capture(source, value, is_derived = false) {
980
+ if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
981
+ if ((source.f & 8388608) === 0) {
982
+ this.current.set(source, [value, is_derived]);
983
+ batch_values?.set(source, value);
984
+ }
985
+ if (!this.is_fork) source.v = value;
986
+ }
987
+ activate() {
988
+ current_batch = this;
989
+ }
990
+ deactivate() {
991
+ current_batch = null;
992
+ batch_values = null;
993
+ }
994
+ flush() {
995
+ try {
996
+ is_processing = true;
997
+ current_batch = this;
998
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
999
+ } finally {
1000
+ flush_count = 0;
1001
+ last_scheduled_effect = null;
1002
+ collected_effects = null;
1003
+ legacy_updates = null;
1004
+ is_processing = false;
1005
+ current_batch = null;
1006
+ batch_values = null;
1007
+ old_values.clear();
1008
+ }
1009
+ }
1010
+ discard() {
1011
+ for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
1012
+ _classPrivateFieldGet2(_discard_callbacks, this).clear();
1013
+ for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE);
1014
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1015
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
1440
1016
  }
1441
1017
  /**
1442
- * Defer an effect inside a pending boundary until the boundary resolves
1443
1018
  * @param {Effect} effect
1444
1019
  */
1445
- defer_effect(effect) {
1446
- defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1020
+ register_created_effect(effect) {
1021
+ _classPrivateFieldGet2(_new_effects, this).push(effect);
1447
1022
  }
1448
1023
  /**
1449
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1450
- * @returns {boolean}
1024
+ * @param {boolean} blocking
1025
+ * @param {Effect} effect
1451
1026
  */
1452
- is_rendered() {
1453
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
1454
- }
1455
- has_pending_snippet() {
1456
- return !!_classPrivateFieldGet2(_props, this).pending;
1027
+ increment(blocking, effect) {
1028
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
1029
+ if (blocking) {
1030
+ let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
1031
+ _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
1032
+ }
1457
1033
  }
1458
1034
  /**
1459
- * Update the source that powers `$effect.pending()` inside this boundary,
1460
- * and controls when the current `pending` snippet (if any) is removed.
1461
- * Do not call from inside the class
1462
- * @param {1 | -1} d
1463
- * @param {Batch} batch
1035
+ * @param {boolean} blocking
1036
+ * @param {Effect} effect
1464
1037
  */
1465
- update_pending_count(d, batch) {
1466
- _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
1467
- _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
1468
- if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
1469
- _classPrivateFieldSet2(_pending_count_update_queued, this, true);
1038
+ decrement(blocking, effect) {
1039
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
1040
+ if (blocking) {
1041
+ let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
1042
+ if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
1043
+ else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
1044
+ }
1045
+ if (_classPrivateFieldGet2(_decrement_queued, this)) return;
1046
+ _classPrivateFieldSet2(_decrement_queued, this, true);
1470
1047
  queue_micro_task(() => {
1471
- _classPrivateFieldSet2(_pending_count_update_queued, this, false);
1472
- if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
1048
+ _classPrivateFieldSet2(_decrement_queued, this, false);
1049
+ if (this.linked) this.flush();
1473
1050
  });
1474
1051
  }
1475
- get_effect_pending() {
1476
- _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
1477
- return get(_classPrivateFieldGet2(_effect_pending, this));
1052
+ /**
1053
+ * @param {Set<Effect>} dirty_effects
1054
+ * @param {Set<Effect>} maybe_dirty_effects
1055
+ */
1056
+ transfer_effects(dirty_effects, maybe_dirty_effects) {
1057
+ for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
1058
+ for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
1059
+ dirty_effects.clear();
1060
+ maybe_dirty_effects.clear();
1478
1061
  }
1479
- /** @param {unknown} error */
1480
- error(error) {
1481
- if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
1482
- if (current_batch?.is_fork) {
1483
- if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
1484
- if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
1485
- if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
1486
- current_batch.oncommit(() => {
1487
- _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1488
- });
1489
- } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1062
+ /** @param {(batch: Batch) => void} fn */
1063
+ oncommit(fn) {
1064
+ _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
1490
1065
  }
1491
- };
1492
- function _hydrate_resolved_content() {
1493
- try {
1494
- _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
1495
- } catch (error) {
1496
- this.error(error);
1066
+ /** @param {(batch: Batch) => void} fn */
1067
+ ondiscard(fn) {
1068
+ _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
1497
1069
  }
1498
- }
1499
- /**
1500
- * @param {unknown} error The deserialized error from the server's hydration comment
1501
- */
1502
- function _hydrate_failed_content(error) {
1503
- const failed = _classPrivateFieldGet2(_props, this).failed;
1504
- if (!failed) return;
1505
- _classPrivateFieldSet2(_failed_effect, this, branch(() => {
1506
- failed(_classPrivateFieldGet2(_anchor, this), () => error, () => () => {});
1507
- }));
1508
- }
1509
- function _hydrate_pending_content() {
1510
- const pending = _classPrivateFieldGet2(_props, this).pending;
1511
- if (!pending) return;
1512
- this.is_pending = true;
1513
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1514
- queue_micro_task(() => {
1515
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1516
- var anchor = create_text();
1517
- fragment.append(anchor);
1518
- _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1519
- return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
1520
- }));
1521
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1522
- _classPrivateFieldGet2(_anchor, this).before(fragment);
1523
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1524
- pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1525
- _classPrivateFieldSet2(_pending_effect, this, null);
1070
+ settled() {
1071
+ return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
1072
+ }
1073
+ static ensure() {
1074
+ if (current_batch === null) {
1075
+ const batch = current_batch = new Batch();
1076
+ if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
1077
+ if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
1526
1078
  });
1527
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1528
1079
  }
1529
- });
1530
- }
1531
- function _render() {
1532
- try {
1533
- this.is_pending = this.has_pending_snippet();
1534
- _classPrivateFieldSet2(_pending_count, this, 0);
1535
- _classPrivateFieldSet2(_local_pending_count, this, 0);
1536
- _classPrivateFieldSet2(_main_effect, this, branch(() => {
1537
- _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
1538
- }));
1539
- if (_classPrivateFieldGet2(_pending_count, this) > 0) {
1540
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1541
- move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
1542
- const pending = _classPrivateFieldGet2(_props, this).pending;
1543
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1544
- } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1545
- } catch (error) {
1546
- this.error(error);
1080
+ return current_batch;
1547
1081
  }
1548
- }
1549
- /**
1550
- * @param {Batch} batch
1551
- */
1552
- function _resolve(batch) {
1553
- this.is_pending = false;
1554
- batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1555
- }
1556
- /**
1557
- * @template T
1558
- * @param {() => T} fn
1559
- */
1560
- function _run(fn) {
1561
- var previous_effect = active_effect;
1562
- var previous_reaction = active_reaction;
1563
- var previous_ctx = component_context;
1564
- set_active_effect(_classPrivateFieldGet2(_effect, this));
1565
- set_active_reaction(_classPrivateFieldGet2(_effect, this));
1566
- set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
1567
- try {
1568
- Batch.ensure();
1569
- return fn();
1570
- } catch (e) {
1571
- handle_error(e);
1572
- return null;
1573
- } finally {
1574
- set_active_effect(previous_effect);
1575
- set_active_reaction(previous_reaction);
1576
- set_component_context(previous_ctx);
1082
+ apply() {
1083
+ if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
1084
+ batch_values = null;
1085
+ return;
1086
+ }
1087
+ batch_values = /* @__PURE__ */ new Map();
1088
+ for (const [source, [value]] of this.current) batch_values.set(source, value);
1089
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
1090
+ if (batch === this || batch.is_fork) continue;
1091
+ var intersects = false;
1092
+ if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
1093
+ if (is_derived) continue;
1094
+ if (this.current.has(source)) {
1095
+ intersects = true;
1096
+ break;
1097
+ }
1098
+ }
1099
+ if (!intersects) {
1100
+ for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
1101
+ }
1102
+ }
1577
1103
  }
1578
- }
1579
- /**
1580
- * Updates the pending count associated with the currently visible pending snippet,
1581
- * if any, such that we can replace the snippet with content once work is done
1582
- * @param {1 | -1} d
1583
- * @param {Batch} batch
1584
- */
1585
- function _update_pending_count(d, batch) {
1586
- if (!this.has_pending_snippet()) {
1587
- if (this.parent) {
1588
- var _this$parent;
1589
- _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
1104
+ /**
1105
+ *
1106
+ * @param {Effect} effect
1107
+ */
1108
+ schedule(effect) {
1109
+ last_scheduled_effect = effect;
1110
+ if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
1111
+ effect.b.defer_effect(effect);
1112
+ return;
1590
1113
  }
1591
- return;
1114
+ var e = effect;
1115
+ while (e.parent !== null) {
1116
+ e = e.parent;
1117
+ var flags = e.f;
1118
+ if (collected_effects !== null && e === active_effect) {
1119
+ if (async_mode_flag) return;
1120
+ if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
1121
+ }
1122
+ if ((flags & 96) !== 0) {
1123
+ if ((flags & 1024) === 0) return;
1124
+ e.f ^= CLEAN;
1125
+ }
1126
+ }
1127
+ _classPrivateFieldGet2(_roots, this).push(e);
1592
1128
  }
1593
- _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
1594
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1595
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
1596
- if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1597
- _classPrivateFieldSet2(_pending_effect, this, null);
1598
- });
1599
- if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
1600
- _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
1601
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1129
+ };
1130
+ _Batch = Batch;
1131
+ function _is_deferred() {
1132
+ if (this.is_fork) return true;
1133
+ for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
1134
+ var e = effect;
1135
+ var skipped = false;
1136
+ while (e.parent !== null) {
1137
+ if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
1138
+ skipped = true;
1139
+ break;
1140
+ }
1141
+ e = e.parent;
1602
1142
  }
1143
+ if (!skipped) return true;
1603
1144
  }
1145
+ return false;
1604
1146
  }
1605
- /**
1606
- * @param {unknown} error
1607
- */
1608
- function _handle_error(error) {
1609
- if (_classPrivateFieldGet2(_main_effect, this)) {
1610
- destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1611
- _classPrivateFieldSet2(_main_effect, this, null);
1612
- }
1613
- if (_classPrivateFieldGet2(_pending_effect, this)) {
1614
- destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1615
- _classPrivateFieldSet2(_pending_effect, this, null);
1147
+ function _process() {
1148
+ _classPrivateFieldSet2(_started, this, true);
1149
+ if (flush_count++ > 1e3) {
1150
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1151
+ infinite_loop_guard();
1616
1152
  }
1617
- if (_classPrivateFieldGet2(_failed_effect, this)) {
1618
- destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1619
- _classPrivateFieldSet2(_failed_effect, this, null);
1153
+ for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
1154
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
1155
+ set_signal_status(e, DIRTY);
1156
+ this.schedule(e);
1620
1157
  }
1621
- if (hydrating) {
1622
- set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1623
- next();
1624
- set_hydrate_node(skip_nodes());
1158
+ for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
1159
+ set_signal_status(e, MAYBE_DIRTY);
1160
+ this.schedule(e);
1625
1161
  }
1626
- var onerror = _classPrivateFieldGet2(_props, this).onerror;
1627
- let failed = _classPrivateFieldGet2(_props, this).failed;
1628
- var did_reset = false;
1629
- var calling_on_error = false;
1630
- const reset = () => {
1631
- if (did_reset) {
1632
- svelte_boundary_reset_noop();
1633
- return;
1634
- }
1635
- did_reset = true;
1636
- if (calling_on_error) svelte_boundary_reset_onerror();
1637
- if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1638
- _classPrivateFieldSet2(_failed_effect, this, null);
1639
- });
1640
- _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1641
- _assertClassBrand(_Boundary_brand, this, _render).call(this);
1642
- });
1643
- };
1644
- /** @param {unknown} transformed_error */
1645
- const handle_error_result = (transformed_error) => {
1646
- try {
1647
- calling_on_error = true;
1648
- onerror?.(transformed_error, reset);
1649
- calling_on_error = false;
1650
- } catch (error) {
1651
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1652
- }
1653
- if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1654
- try {
1655
- return branch(() => {
1656
- var effect = active_effect;
1657
- effect.b = this;
1658
- effect.f |= 128;
1659
- failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1660
- });
1661
- } catch (error) {
1662
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1663
- return null;
1664
- }
1665
- }));
1666
- };
1667
- queue_micro_task(() => {
1668
- /** @type {unknown} */
1669
- var result;
1670
- try {
1671
- result = this.transform_error(error);
1672
- } catch (e) {
1673
- invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1674
- return;
1675
- }
1676
- if (result !== null && typeof result === "object" && typeof result.then === "function")
1677
- /** @type {any} */ result.then(
1678
- handle_error_result,
1679
- /** @param {unknown} e */
1680
- (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1681
- );
1682
- else handle_error_result(result);
1683
- });
1684
- }
1685
- //#endregion
1686
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/async.js
1687
- /** @import { Blocker, Effect, Source, Value } from '#client' */
1688
- /**
1689
- * @param {Blocker[]} blockers
1690
- * @param {Array<() => any>} sync
1691
- * @param {Array<() => Promise<any>>} async
1692
- * @param {(values: Value[]) => any} fn
1693
- */
1694
- function flatten(blockers, sync, async, fn) {
1695
- const d = is_runes() ? derived : derived_safe_equal;
1696
- var pending = blockers.filter((b) => !b.settled);
1697
- var deriveds = sync.map(d);
1698
- if (async.length === 0 && pending.length === 0) {
1699
- fn(deriveds);
1700
- return;
1701
- }
1702
- var parent = active_effect;
1703
- var restore = capture();
1704
- var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1162
+ const roots = _classPrivateFieldGet2(_roots, this);
1163
+ _classPrivateFieldSet2(_roots, this, []);
1164
+ this.apply();
1165
+ /** @type {Effect[]} */
1166
+ var effects = collected_effects = [];
1167
+ /** @type {Effect[]} */
1168
+ var render_effects = [];
1705
1169
  /**
1706
- * @param {Source[]} async
1170
+ * @type {Effect[]}
1171
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1707
1172
  */
1708
- function finish(async) {
1709
- if ((parent.f & 16384) !== 0) return;
1710
- restore();
1711
- try {
1712
- fn([...deriveds, ...async]);
1713
- } catch (error) {
1714
- invoke_error_boundary(error, parent);
1715
- }
1716
- unset_context();
1173
+ var updates = legacy_updates = [];
1174
+ for (const root of roots) try {
1175
+ _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
1176
+ } catch (e) {
1177
+ reset_all(root);
1178
+ if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
1179
+ throw e;
1717
1180
  }
1718
- var decrement_pending = increment_pending();
1719
- if (async.length === 0) {
1720
- /** @type {Promise<any>} */ blocker_promise.then(() => finish([])).finally(decrement_pending);
1181
+ current_batch = null;
1182
+ if (updates.length > 0) {
1183
+ var batch = _Batch.ensure();
1184
+ for (const e of updates) batch.schedule(e);
1185
+ }
1186
+ collected_effects = null;
1187
+ legacy_updates = null;
1188
+ if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
1189
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
1190
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
1191
+ for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
1192
+ if (updates.length > 0)
1193
+ /** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
1721
1194
  return;
1722
1195
  }
1723
- function run() {
1724
- Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
1196
+ const earlier_batch = _assertClassBrand(_Batch_brand, this, _find_earlier_batch).call(this);
1197
+ if (earlier_batch) {
1198
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
1199
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
1200
+ _assertClassBrand(_Batch_brand, earlier_batch, _merge).call(earlier_batch, this);
1201
+ return;
1202
+ }
1203
+ _classPrivateFieldGet2(_dirty_effects$1, this).clear();
1204
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
1205
+ for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
1206
+ _classPrivateFieldGet2(_commit_callbacks, this).clear();
1207
+ previous_batch = this;
1208
+ flush_queued_effects(render_effects);
1209
+ flush_queued_effects(effects);
1210
+ previous_batch = null;
1211
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
1212
+ var next_batch = current_batch;
1213
+ if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
1214
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1215
+ if (async_mode_flag) {
1216
+ _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
1217
+ current_batch = next_batch;
1218
+ }
1219
+ }
1220
+ if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
1221
+ const batch = next_batch;
1222
+ _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
1223
+ } else next_batch = this;
1224
+ if (next_batch !== null) {
1225
+ old_values.clear();
1226
+ _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
1725
1227
  }
1726
- if (blocker_promise) blocker_promise.then(() => {
1727
- restore();
1728
- run();
1729
- unset_context();
1730
- });
1731
- else run();
1732
1228
  }
1733
1229
  /**
1734
- * Captures the current effect context so that we can restore it after
1735
- * some asynchronous work has happened (so that e.g. `await a + b`
1736
- * causes `b` to be registered as a dependency).
1230
+ * Traverse the effect tree, executing effects or stashing
1231
+ * them for later execution as appropriate
1232
+ * @param {Effect} root
1233
+ * @param {Effect[]} effects
1234
+ * @param {Effect[]} render_effects
1737
1235
  */
1738
- function capture() {
1739
- var previous_effect = active_effect;
1740
- var previous_reaction = active_reaction;
1741
- var previous_component_context = component_context;
1742
- var previous_batch = current_batch;
1743
- return function restore(activate_batch = true) {
1744
- set_active_effect(previous_effect);
1745
- set_active_reaction(previous_reaction);
1746
- set_component_context(previous_component_context);
1747
- if (activate_batch && (previous_effect.f & 16384) === 0) {
1748
- previous_batch?.activate();
1749
- previous_batch?.apply();
1236
+ function _traverse(root, effects, render_effects) {
1237
+ root.f ^= CLEAN;
1238
+ var effect = root.first;
1239
+ while (effect !== null) {
1240
+ var flags = effect.f;
1241
+ var is_branch = (flags & 96) !== 0;
1242
+ if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
1243
+ if (is_branch) effect.f ^= CLEAN;
1244
+ else if ((flags & 4) !== 0) effects.push(effect);
1245
+ else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
1246
+ else if (is_dirty(effect)) {
1247
+ if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(effect);
1248
+ update_effect(effect);
1249
+ }
1250
+ var child = effect.first;
1251
+ if (child !== null) {
1252
+ effect = child;
1253
+ continue;
1254
+ }
1750
1255
  }
1751
- };
1256
+ while (effect !== null) {
1257
+ var next = effect.next;
1258
+ if (next !== null) {
1259
+ effect = next;
1260
+ break;
1261
+ }
1262
+ effect = effect.parent;
1263
+ }
1264
+ }
1752
1265
  }
1753
- function unset_context(deactivate_batch = true) {
1754
- set_active_effect(null);
1755
- set_active_reaction(null);
1756
- set_component_context(null);
1757
- if (deactivate_batch) current_batch?.deactivate();
1266
+ function _find_earlier_batch() {
1267
+ var batch = _classPrivateFieldGet2(_prev, this);
1268
+ while (batch !== null) {
1269
+ if (!batch.is_fork) {
1270
+ for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
1271
+ }
1272
+ batch = _classPrivateFieldGet2(_prev, batch);
1273
+ }
1274
+ return null;
1758
1275
  }
1759
1276
  /**
1760
- * @returns {(skip?: boolean) => void}
1277
+ * @param {Batch} batch
1761
1278
  */
1762
- function increment_pending() {
1763
- var effect = active_effect;
1764
- var boundary = effect.b;
1765
- var batch = current_batch;
1766
- var blocking = !!boundary?.is_rendered();
1767
- boundary?.update_pending_count(1, batch);
1768
- batch.increment(blocking, effect);
1769
- return () => {
1770
- boundary?.update_pending_count(-1, batch);
1771
- batch.decrement(blocking, effect);
1279
+ function _merge(batch) {
1280
+ for (const [source, value] of batch.current) {
1281
+ if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
1282
+ this.current.set(source, value);
1283
+ }
1284
+ for (const [effect, deferred] of batch.async_deriveds) {
1285
+ const d = this.async_deriveds.get(effect);
1286
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1287
+ }
1288
+ batch.async_deriveds.clear();
1289
+ this.transfer_effects(_classPrivateFieldGet2(_dirty_effects$1, batch), _classPrivateFieldGet2(_maybe_dirty_effects$1, batch));
1290
+ /**
1291
+ * mark all effects that depend on `batch.current`, except the
1292
+ * async effects that we just resolved (TODO unless they depend
1293
+ * on values in this batch that are NOT in the later batch?).
1294
+ * Through this we also will populate the correct #skipped_branches,
1295
+ * oncommit callbacks etc, so we don't need to merge them separately.
1296
+ * @param {Value} value
1297
+ */
1298
+ const mark = (value) => {
1299
+ var reactions = value.reactions;
1300
+ if (reactions === null) return;
1301
+ if ((value.f & 2) !== 0 && (value.f & 6144) === 0) return;
1302
+ for (const reaction of reactions) {
1303
+ var flags = reaction.f;
1304
+ if ((flags & 2) !== 0) mark(reaction);
1305
+ else {
1306
+ var effect = reaction;
1307
+ if (flags & 4194320 && !this.async_deriveds.has(effect)) {
1308
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(effect);
1309
+ set_signal_status(effect, DIRTY);
1310
+ this.schedule(effect);
1311
+ }
1312
+ }
1313
+ }
1772
1314
  };
1315
+ for (const source of this.current.keys()) mark(source);
1316
+ this.oncommit(() => batch.discard());
1317
+ _assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
1318
+ current_batch = this;
1319
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
1773
1320
  }
1774
1321
  /**
1775
- * @template V
1776
- * @param {() => V} fn
1777
- * @returns {Derived<V>}
1322
+ * @param {Effect[]} effects
1778
1323
  */
1779
- /*#__NO_SIDE_EFFECTS__*/
1780
- function derived(fn) {
1781
- var flags = 2 | DIRTY;
1782
- if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1783
- return {
1784
- ctx: component_context,
1785
- deps: null,
1786
- effects: null,
1787
- equals,
1788
- f: flags,
1789
- fn,
1790
- reactions: null,
1791
- rv: 0,
1792
- v: UNINITIALIZED,
1793
- wv: 0,
1794
- parent: active_effect,
1795
- ac: null
1796
- };
1324
+ function _defer_effects(effects) {
1325
+ for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
1797
1326
  }
1798
- var OBSOLETE = Symbol("obsolete");
1799
- /**
1800
- * @template V
1801
- * @param {() => V | Promise<V>} fn
1802
- * @param {string} [label]
1803
- * @param {string} [location] If provided, print a warning if the value is not read immediately after update
1804
- * @returns {Promise<Source<V>>}
1805
- */
1806
- /*#__NO_SIDE_EFFECTS__*/
1807
- function async_derived(fn, label, location) {
1808
- let parent = active_effect;
1809
- if (parent === null) async_derived_orphan();
1810
- var promise = void 0;
1811
- var signal = source(UNINITIALIZED);
1812
- var should_suspend = !active_reaction;
1813
- /** @type {Set<ReturnType<typeof deferred<V>>>} */
1814
- var deferreds = /* @__PURE__ */ new Set();
1815
- async_effect(() => {
1816
- var effect = active_effect;
1817
- /** @type {ReturnType<typeof deferred<V>>} */
1818
- var d = deferred();
1819
- promise = d.promise;
1820
- try {
1821
- Promise.resolve(fn()).then(d.resolve, (e) => {
1822
- if (e !== STALE_REACTION) d.reject(e);
1823
- }).finally(unset_context);
1824
- } catch (error) {
1825
- d.reject(error);
1826
- unset_context();
1327
+ function _commit$1() {
1328
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
1329
+ var is_earlier = batch.id < this.id;
1330
+ /** @type {Source[]} */
1331
+ var sources = [];
1332
+ for (const [source, [value, is_derived]] of this.current) {
1333
+ if (batch.current.has(source)) {
1334
+ var batch_value = batch.current.get(source)[0];
1335
+ if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
1336
+ else continue;
1337
+ }
1338
+ sources.push(source);
1827
1339
  }
1828
- var batch = current_batch;
1829
- if (should_suspend) {
1830
- if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
1831
- if (parent.b?.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE);
1832
- else for (const d of deferreds.values()) d.reject(OBSOLETE);
1833
- deferreds.add(d);
1834
- batch.async_deriveds.set(effect, d);
1340
+ if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
1341
+ const d = batch.async_deriveds.get(effect);
1342
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1835
1343
  }
1836
- /**
1837
- * @param {any} value
1838
- * @param {unknown} error
1839
- */
1840
- const handler = (value, error = void 0) => {
1841
- decrement_pending?.();
1842
- deferreds.delete(d);
1843
- if (error === OBSOLETE) return;
1344
+ var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]);
1345
+ if (!_classPrivateFieldGet2(_started, batch) || current.length === 0) continue;
1346
+ var others = current.filter((source) => !this.current.has(source));
1347
+ if (others.length === 0) {
1348
+ if (is_earlier) batch.discard();
1349
+ } else if (sources.length > 0) {
1350
+ if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
1351
+ if ((e.f & 4194320) !== 0) batch.schedule(e);
1352
+ else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
1353
+ });
1844
1354
  batch.activate();
1845
- if (error) {
1846
- signal.f |= ERROR_VALUE;
1847
- internal_set(signal, error);
1848
- } else {
1849
- if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
1850
- internal_set(signal, value);
1355
+ /** @type {Set<Value>} */
1356
+ var marked = /* @__PURE__ */ new Set();
1357
+ /** @type {Map<Reaction, boolean>} */
1358
+ var checked = /* @__PURE__ */ new Map();
1359
+ for (var source of sources) mark_effects(source, others, marked, checked);
1360
+ checked = /* @__PURE__ */ new Map();
1361
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
1362
+ const v2 = this.current.get(c);
1363
+ if (!v2) return true;
1364
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
1365
+ }).map(([c]) => c);
1366
+ if (current_unequal.length > 0) {
1367
+ for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1368
+ set_signal_status(effect, DIRTY);
1369
+ batch.schedule(effect);
1370
+ } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
1851
1371
  }
1852
- batch.deactivate();
1853
- };
1854
- d.promise.then(handler, (e) => handler(null, e || "unknown"));
1855
- });
1856
- teardown(() => {
1857
- for (const d of deferreds) d.reject(OBSOLETE);
1858
- });
1859
- return new Promise((fulfil) => {
1860
- /** @param {Promise<V>} p */
1861
- function next(p) {
1862
- function go() {
1863
- if (p === promise) fulfil(signal);
1864
- else next(promise);
1372
+ if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1373
+ batch.apply();
1374
+ for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1375
+ _classPrivateFieldSet2(_roots, batch, []);
1865
1376
  }
1866
- p.then(go, go);
1377
+ batch.deactivate();
1867
1378
  }
1868
- next(promise);
1869
- });
1870
- }
1871
- /**
1872
- * @template V
1873
- * @param {() => V} fn
1874
- * @returns {Derived<V>}
1875
- */
1876
- /*#__NO_SIDE_EFFECTS__*/
1877
- function derived_safe_equal(fn) {
1878
- const signal = /* @__PURE__ */ derived(fn);
1879
- signal.equals = safe_equals;
1880
- return signal;
1881
- }
1882
- /**
1883
- * @param {Derived} derived
1884
- * @returns {void}
1885
- */
1886
- function destroy_derived_effects(derived) {
1887
- var effects = derived.effects;
1888
- if (effects !== null) {
1889
- derived.effects = null;
1890
- for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
1891
1379
  }
1892
1380
  }
1381
+ function _unlink() {
1382
+ if (!this.linked) return;
1383
+ var prev = _classPrivateFieldGet2(_prev, this);
1384
+ var next = _classPrivateFieldGet2(_next, this);
1385
+ if (prev === null) first_batch = next;
1386
+ else _classPrivateFieldSet2(_next, prev, next);
1387
+ if (next === null) last_batch = prev;
1388
+ else _classPrivateFieldSet2(_prev, next, prev);
1389
+ this.linked = false;
1390
+ }
1893
1391
  /**
1894
- * @template T
1895
- * @param {Derived} derived
1392
+ * Synchronously flush any pending updates.
1393
+ * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1394
+ * @template [T=void]
1395
+ * @param {(() => T) | undefined} [fn]
1896
1396
  * @returns {T}
1897
1397
  */
1898
- function execute_derived(derived) {
1899
- var value;
1900
- var prev_active_effect = active_effect;
1901
- var parent = derived.parent;
1902
- if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
1903
- derived_inert();
1904
- return derived.v;
1905
- }
1906
- set_active_effect(parent);
1398
+ function flushSync(fn) {
1399
+ var was_flushing_sync = is_flushing_sync;
1400
+ is_flushing_sync = true;
1907
1401
  try {
1908
- derived.f &= ~WAS_MARKED;
1909
- destroy_derived_effects(derived);
1910
- value = update_reaction(derived);
1402
+ var result;
1403
+ if (fn) {
1404
+ if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
1405
+ result = fn();
1406
+ }
1407
+ while (true) {
1408
+ flush_tasks();
1409
+ if (current_batch === null) return result;
1410
+ current_batch.flush();
1411
+ }
1911
1412
  } finally {
1912
- set_active_effect(prev_active_effect);
1413
+ is_flushing_sync = was_flushing_sync;
1414
+ }
1415
+ }
1416
+ function infinite_loop_guard() {
1417
+ try {
1418
+ effect_update_depth_exceeded();
1419
+ } catch (error) {
1420
+ invoke_error_boundary(error, last_scheduled_effect);
1913
1421
  }
1914
- return value;
1915
1422
  }
1423
+ /** @type {Set<Effect> | null} */
1424
+ var eager_block_effects = null;
1916
1425
  /**
1917
- * @param {Derived} derived
1426
+ * @param {Array<Effect>} effects
1918
1427
  * @returns {void}
1919
1428
  */
1920
- function update_derived(derived) {
1921
- var value = execute_derived(derived);
1922
- if (!derived.equals(value)) {
1923
- derived.wv = increment_write_version();
1924
- if (!current_batch?.is_fork || derived.deps === null) {
1925
- if (current_batch !== null) {
1926
- current_batch.capture(derived, value, true);
1927
- previous_batch?.capture(derived, value, true);
1928
- } else derived.v = value;
1929
- if (derived.deps === null) {
1930
- set_signal_status(derived, CLEAN);
1931
- return;
1429
+ function flush_queued_effects(effects) {
1430
+ var length = effects.length;
1431
+ if (length === 0) return;
1432
+ var i = 0;
1433
+ while (i < length) {
1434
+ var effect = effects[i++];
1435
+ if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1436
+ eager_block_effects = /* @__PURE__ */ new Set();
1437
+ update_effect(effect);
1438
+ if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1439
+ if (eager_block_effects?.size > 0) {
1440
+ old_values.clear();
1441
+ for (const e of eager_block_effects) {
1442
+ if ((e.f & 24576) !== 0) continue;
1443
+ /** @type {Effect[]} */
1444
+ const ordered_effects = [e];
1445
+ let ancestor = e.parent;
1446
+ while (ancestor !== null) {
1447
+ if (eager_block_effects.has(ancestor)) {
1448
+ eager_block_effects.delete(ancestor);
1449
+ ordered_effects.push(ancestor);
1450
+ }
1451
+ ancestor = ancestor.parent;
1452
+ }
1453
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
1454
+ const e = ordered_effects[j];
1455
+ if ((e.f & 24576) !== 0) continue;
1456
+ update_effect(e);
1457
+ }
1458
+ }
1459
+ eager_block_effects.clear();
1932
1460
  }
1933
1461
  }
1934
1462
  }
1935
- if (is_destroying_effect) return;
1936
- if (batch_values !== null) {
1937
- if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1938
- } else update_derived_status(derived);
1463
+ eager_block_effects = null;
1939
1464
  }
1940
1465
  /**
1941
- * @param {Derived} derived
1466
+ * This is similar to `mark_reactions`, but it only marks async/block effects
1467
+ * depending on `value` and at least one of the other `sources`, so that
1468
+ * these effects can re-run after another batch has been committed
1469
+ * @param {Value} value
1470
+ * @param {Source[]} sources
1471
+ * @param {Set<Value>} marked
1472
+ * @param {Map<Reaction, boolean>} checked
1942
1473
  */
1943
- function freeze_derived_effects(derived) {
1944
- if (derived.effects === null) return;
1945
- for (const e of derived.effects) if (e.teardown || e.ac) {
1946
- e.teardown?.();
1947
- e.ac?.abort(STALE_REACTION);
1948
- if (e.fn !== null) e.teardown = noop;
1949
- e.ac = null;
1950
- remove_reactions(e, 0);
1951
- destroy_effect_children(e);
1474
+ function mark_effects(value, sources, marked, checked) {
1475
+ if (marked.has(value)) return;
1476
+ marked.add(value);
1477
+ if (value.reactions !== null) for (const reaction of value.reactions) {
1478
+ const flags = reaction.f;
1479
+ if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1480
+ else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1481
+ set_signal_status(reaction, DIRTY);
1482
+ schedule_effect(reaction);
1483
+ }
1952
1484
  }
1953
1485
  }
1954
1486
  /**
1955
- * @param {Derived} derived
1487
+ * @param {Reaction} reaction
1488
+ * @param {Source[]} sources
1489
+ * @param {Map<Reaction, boolean>} checked
1956
1490
  */
1957
- function unfreeze_derived_effects(derived) {
1958
- if (derived.effects === null) return;
1959
- for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
1491
+ function depends_on(reaction, sources, checked) {
1492
+ const depends = checked.get(reaction);
1493
+ if (depends !== void 0) return depends;
1494
+ if (reaction.deps !== null) for (const dep of reaction.deps) {
1495
+ if (includes.call(sources, dep)) return true;
1496
+ if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1497
+ checked.set(dep, true);
1498
+ return true;
1499
+ }
1500
+ }
1501
+ checked.set(reaction, false);
1502
+ return false;
1503
+ }
1504
+ /**
1505
+ * @param {Effect} effect
1506
+ * @returns {void}
1507
+ */
1508
+ function schedule_effect(effect) {
1509
+ /** @type {Batch} */ current_batch.schedule(effect);
1510
+ }
1511
+ /**
1512
+ * Mark all the effects inside a skipped branch CLEAN, so that
1513
+ * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1514
+ * effects so they can be rescheduled if the branch survives.
1515
+ * @param {Effect} effect
1516
+ * @param {{ d: Effect[], m: Effect[] }} tracked
1517
+ */
1518
+ function reset_branch(effect, tracked) {
1519
+ if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1520
+ if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1521
+ else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1522
+ set_signal_status(effect, CLEAN);
1523
+ var e = effect.first;
1524
+ while (e !== null) {
1525
+ reset_branch(e, tracked);
1526
+ e = e.next;
1527
+ }
1528
+ }
1529
+ /**
1530
+ * Mark an entire effect tree clean following an error
1531
+ * @param {Effect} effect
1532
+ */
1533
+ function reset_all(effect) {
1534
+ set_signal_status(effect, CLEAN);
1535
+ var e = effect.first;
1536
+ while (e !== null) {
1537
+ reset_all(e);
1538
+ e = e.next;
1539
+ }
1960
1540
  }
1961
1541
  //#endregion
1962
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/sources.js
1542
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/sources.js
1963
1543
  /** @import { Derived, Effect, Source, Value } from '#client' */
1964
1544
  /** @type {Set<Effect>} */
1965
1545
  var eager_effects = /* @__PURE__ */ new Set();
@@ -2029,7 +1609,8 @@ function set(source, value, should_proxy = false) {
2029
1609
  */
2030
1610
  function internal_set(source, value, updated_during_traversal = null) {
2031
1611
  if (!source.equals(value)) {
2032
- old_values.set(source, is_destroying_effect ? value : source.v);
1612
+ if (is_destroying_effect) old_values.set(source, value);
1613
+ else if (!old_values.has(source)) old_values.set(source, source.v);
2033
1614
  var batch = Batch.ensure();
2034
1615
  batch.capture(source, value);
2035
1616
  if ((source.f & 2) !== 0) {
@@ -2105,7 +1686,7 @@ function mark_reactions(signal, status, updated_during_traversal) {
2105
1686
  * @returns {T}
2106
1687
  */
2107
1688
  function proxy(value) {
2108
- if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value;
1689
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value || COMPONENT_SYMBOL in value) return value;
2109
1690
  const prototype = get_prototype_of(value);
2110
1691
  if (prototype !== object_prototype && prototype !== array_prototype) return value;
2111
1692
  /** @type {Map<any, Source<any>>} */
@@ -2257,19 +1838,8 @@ function proxy(value) {
2257
1838
  }
2258
1839
  });
2259
1840
  }
2260
- new Set([
2261
- "copyWithin",
2262
- "fill",
2263
- "pop",
2264
- "push",
2265
- "reverse",
2266
- "shift",
2267
- "sort",
2268
- "splice",
2269
- "unshift"
2270
- ]);
2271
1841
  //#endregion
2272
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/operations.js
1842
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/operations.js
2273
1843
  /** @import { Effect, TemplateNode } from '#client' */
2274
1844
  /** @type {Window} */
2275
1845
  var $window;
@@ -2395,26 +1965,40 @@ function merge_text_nodes(text) {
2395
1965
  next = text.nextSibling;
2396
1966
  }
2397
1967
  }
2398
- //#endregion
2399
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2400
1968
  /**
2401
- * @template T
2402
- * @param {() => T} fn
1969
+ * @param {unknown} error
2403
1970
  */
2404
- function without_reactive_context(fn) {
2405
- var previous_reaction = active_reaction;
2406
- var previous_effect = active_effect;
2407
- set_active_reaction(null);
2408
- set_active_effect(null);
2409
- try {
2410
- return fn();
2411
- } finally {
2412
- set_active_reaction(previous_reaction);
2413
- set_active_effect(previous_effect);
1971
+ function handle_error(error) {
1972
+ var effect = active_effect;
1973
+ if (effect === null) {
1974
+ /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
1975
+ return error;
1976
+ }
1977
+ if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
1978
+ invoke_error_boundary(error, effect);
1979
+ }
1980
+ /**
1981
+ * @param {unknown} error
1982
+ * @param {Effect | null} effect
1983
+ */
1984
+ function invoke_error_boundary(error, effect) {
1985
+ if (effect !== null && (effect.f & 16384) !== 0) return;
1986
+ while (effect !== null) {
1987
+ if ((effect.f & 128) !== 0 && (effect.f & 33570816) === 0) {
1988
+ if ((effect.f & 32768) === 0) throw error;
1989
+ try {
1990
+ /** @type {Boundary} */ effect.b.error(error);
1991
+ return;
1992
+ } catch (e) {
1993
+ error = e;
1994
+ }
1995
+ }
1996
+ effect = effect.parent;
2414
1997
  }
1998
+ throw error;
2415
1999
  }
2416
2000
  //#endregion
2417
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/effects.js
2001
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/effects.js
2418
2002
  /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2419
2003
  /**
2420
2004
  * @param {'$effect' | '$effect.pre' | '$inspect'} rune
@@ -2617,6 +2201,8 @@ function execute_effect_teardown(effect) {
2617
2201
  set_active_reaction(null);
2618
2202
  try {
2619
2203
  teardown.call(null);
2204
+ } catch (error) {
2205
+ invoke_error_boundary(error, effect.parent);
2620
2206
  } finally {
2621
2207
  set_is_destroying_effect(previously_destroying_effect);
2622
2208
  set_active_reaction(previous_reaction);
@@ -2719,6 +2305,7 @@ function unlink_effect(effect) {
2719
2305
  function pause_effect(effect, callback, destroy = true) {
2720
2306
  /** @type {TransitionManager[]} */
2721
2307
  var transitions = [];
2308
+ effect.f |= 256;
2722
2309
  pause_children(effect, transitions, true);
2723
2310
  var fn = () => {
2724
2311
  if (destroy) destroy_effect(effect);
@@ -2758,6 +2345,7 @@ function pause_children(effect, transitions, local) {
2758
2345
  * @param {Effect} effect
2759
2346
  */
2760
2347
  function resume_effect(effect) {
2348
+ effect.f &= -257;
2761
2349
  resume_children(effect, true);
2762
2350
  }
2763
2351
  /**
@@ -2765,6 +2353,7 @@ function resume_effect(effect) {
2765
2353
  * @param {boolean} local
2766
2354
  */
2767
2355
  function resume_children(effect, local) {
2356
+ if ((effect.f & 256) !== 0) return;
2768
2357
  if ((effect.f & 8192) === 0) return;
2769
2358
  effect.f ^= INERT;
2770
2359
  if ((effect.f & 1024) === 0) {
@@ -2800,15 +2389,18 @@ function move_effect(effect, fragment) {
2800
2389
  }
2801
2390
  }
2802
2391
  //#endregion
2803
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/legacy.js
2392
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/legacy.js
2804
2393
  /**
2805
2394
  * @type {Set<Value> | null}
2806
2395
  * @deprecated
2807
2396
  */
2808
2397
  var captured_signals = null;
2809
2398
  //#endregion
2810
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/runtime.js
2399
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/runtime.js
2811
2400
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2401
+ /**
2402
+ * True if updating in an effect context that is reactive (i.e. not branch/root effects)
2403
+ */
2812
2404
  var is_updating_effect = false;
2813
2405
  var is_destroying_effect = false;
2814
2406
  /** @param {boolean} value */
@@ -2861,7 +2453,7 @@ function set_untracked_writes(value) {
2861
2453
  * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
2862
2454
  **/
2863
2455
  var write_version = 1;
2864
- /** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
2456
+ /** @type {number} Used to version each read of a source of derived to avoid duplicating dependencies inside a reaction */
2865
2457
  var read_version = 0;
2866
2458
  var update_version = read_version;
2867
2459
  /** @param {number} value */
@@ -2942,24 +2534,8 @@ function update_reaction(reaction) {
2942
2534
  var fn = reaction.fn;
2943
2535
  var result = fn();
2944
2536
  reaction.f |= REACTION_RAN;
2945
- var deps = reaction.deps;
2946
- var is_fork = current_batch?.is_fork;
2947
- if (new_deps !== null) {
2948
- var i;
2949
- if (!is_fork) remove_reactions(reaction, skipped_deps);
2950
- if (deps !== null && skipped_deps > 0) {
2951
- deps.length = skipped_deps + new_deps.length;
2952
- for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
2953
- } else reaction.deps = deps = new_deps;
2954
- if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) {
2955
- var _deps$i;
2956
- ((_deps$i = deps[i]).reactions ?? (_deps$i.reactions = [])).push(reaction);
2957
- }
2958
- } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
2959
- remove_reactions(reaction, skipped_deps);
2960
- deps.length = skipped_deps;
2961
- }
2962
- 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);
2537
+ var deps = update_dependencies(reaction);
2538
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (var i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
2963
2539
  if (previous_reaction !== null && previous_reaction !== reaction) {
2964
2540
  read_version++;
2965
2541
  if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
@@ -2970,6 +2546,7 @@ function update_reaction(reaction) {
2970
2546
  if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
2971
2547
  return result;
2972
2548
  } catch (error) {
2549
+ update_dependencies(reaction);
2973
2550
  return handle_error(error);
2974
2551
  } finally {
2975
2552
  reaction.f ^= REACTION_IS_UPDATING;
@@ -2984,6 +2561,29 @@ function update_reaction(reaction) {
2984
2561
  }
2985
2562
  }
2986
2563
  /**
2564
+ * @param {Reaction} reaction
2565
+ */
2566
+ function update_dependencies(reaction) {
2567
+ var deps = reaction.deps;
2568
+ var is_fork = current_batch?.is_fork;
2569
+ if (new_deps !== null) {
2570
+ var i;
2571
+ if (!is_fork) remove_reactions(reaction, skipped_deps);
2572
+ if (deps !== null && skipped_deps > 0) {
2573
+ deps.length = skipped_deps + new_deps.length;
2574
+ for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
2575
+ } else reaction.deps = deps = new_deps;
2576
+ if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) {
2577
+ var _deps$i;
2578
+ ((_deps$i = deps[i]).reactions ?? (_deps$i.reactions = [])).push(reaction);
2579
+ }
2580
+ } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
2581
+ remove_reactions(reaction, skipped_deps);
2582
+ deps.length = skipped_deps;
2583
+ }
2584
+ return deps;
2585
+ }
2586
+ /**
2987
2587
  * @template V
2988
2588
  * @param {Reaction} signal
2989
2589
  * @param {Value<V>} dependency
@@ -3002,339 +2602,808 @@ function remove_reaction(signal, dependency) {
3002
2602
  }
3003
2603
  }
3004
2604
  }
3005
- if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
3006
- var derived = dependency;
3007
- if ((derived.f & 512) !== 0) {
3008
- derived.f ^= 512;
3009
- derived.f &= ~WAS_MARKED;
3010
- }
3011
- if (derived.v !== UNINITIALIZED) update_derived_status(derived);
3012
- freeze_derived_effects(derived);
3013
- remove_reactions(derived, 0);
2605
+ if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2606
+ var derived = dependency;
2607
+ if ((derived.f & 512) !== 0) {
2608
+ derived.f ^= 512;
2609
+ derived.f &= ~WAS_MARKED;
2610
+ }
2611
+ if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2612
+ if (derived.ac !== null) without_reactive_context(() => {
2613
+ /** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
2614
+ derived.ac = null;
2615
+ set_signal_status(derived, DIRTY);
2616
+ });
2617
+ freeze_derived_effects(derived);
2618
+ remove_reactions(derived, 0);
2619
+ }
2620
+ }
2621
+ /**
2622
+ * @param {Reaction} signal
2623
+ * @param {number} start_index
2624
+ * @returns {void}
2625
+ */
2626
+ function remove_reactions(signal, start_index) {
2627
+ var dependencies = signal.deps;
2628
+ if (dependencies === null) return;
2629
+ for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
2630
+ }
2631
+ /**
2632
+ * @param {Effect} effect
2633
+ * @returns {void}
2634
+ */
2635
+ function update_effect(effect) {
2636
+ var flags = effect.f;
2637
+ if ((flags & 16384) !== 0) return;
2638
+ set_signal_status(effect, CLEAN);
2639
+ var previous_effect = active_effect;
2640
+ var was_updating_effect = is_updating_effect;
2641
+ active_effect = effect;
2642
+ is_updating_effect = (flags & 96) === 0;
2643
+ try {
2644
+ if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2645
+ else destroy_effect_children(effect);
2646
+ execute_effect_teardown(effect);
2647
+ var teardown = update_reaction(effect);
2648
+ effect.teardown = typeof teardown === "function" ? teardown : null;
2649
+ effect.wv = write_version;
2650
+ } finally {
2651
+ is_updating_effect = was_updating_effect;
2652
+ active_effect = previous_effect;
2653
+ }
2654
+ }
2655
+ /**
2656
+ * @template V
2657
+ * @param {Value<V>} signal
2658
+ * @returns {V}
2659
+ */
2660
+ function get(signal) {
2661
+ var is_derived = (signal.f & 2) !== 0;
2662
+ captured_signals?.add(signal);
2663
+ if (active_reaction !== null && !untracking) {
2664
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
2665
+ var deps = active_reaction.deps;
2666
+ if ((active_reaction.f & 2097152) !== 0) {
2667
+ if (signal.rv < read_version) {
2668
+ signal.rv = read_version;
2669
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
2670
+ else if (new_deps === null) new_deps = [signal];
2671
+ else new_deps.push(signal);
2672
+ }
2673
+ } else {
2674
+ var _active_reaction;
2675
+ (_active_reaction = active_reaction).deps ?? (_active_reaction.deps = []);
2676
+ if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
2677
+ var reactions = signal.reactions;
2678
+ if (reactions === null) signal.reactions = [active_reaction];
2679
+ else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
2680
+ }
2681
+ }
2682
+ }
2683
+ if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
2684
+ if (is_derived) {
2685
+ var derived = signal;
2686
+ if (is_destroying_effect) {
2687
+ var value = derived.v;
2688
+ if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
2689
+ old_values.set(derived, value);
2690
+ return value;
2691
+ }
2692
+ var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
2693
+ var is_new = (derived.f & REACTION_RAN) === 0;
2694
+ if (is_dirty(derived)) {
2695
+ if (should_connect) derived.f |= 512;
2696
+ update_derived(derived);
2697
+ }
2698
+ if (should_connect && !is_new) {
2699
+ unfreeze_derived_effects(derived);
2700
+ reconnect(derived);
2701
+ }
2702
+ }
2703
+ if (batch_values?.has(signal)) return batch_values.get(signal);
2704
+ if ((signal.f & 8388608) !== 0) throw signal.v;
2705
+ return signal.v;
2706
+ }
2707
+ /**
2708
+ * (Re)connect a disconnected derived, so that it is notified
2709
+ * of changes in `mark_reactions`
2710
+ * @param {Derived} derived
2711
+ */
2712
+ function reconnect(derived) {
2713
+ derived.f |= 512;
2714
+ if (derived.deps === null) return;
2715
+ for (const dep of derived.deps) {
2716
+ (dep.reactions ?? (dep.reactions = [])).push(derived);
2717
+ if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
2718
+ unfreeze_derived_effects(dep);
2719
+ reconnect(dep);
2720
+ }
2721
+ }
2722
+ }
2723
+ /** @param {Derived} derived */
2724
+ function depends_on_old_values(derived) {
2725
+ if (derived.v === UNINITIALIZED) return true;
2726
+ if (derived.deps === null) return false;
2727
+ for (const dep of derived.deps) {
2728
+ if (old_values.has(dep)) return true;
2729
+ if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
2730
+ }
2731
+ return false;
2732
+ }
2733
+ /**
2734
+ * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
2735
+ * any state read inside `fn` will not be treated as a dependency.
2736
+ *
2737
+ * ```ts
2738
+ * $effect(() => {
2739
+ * // this will run when `data` changes, but not when `time` changes
2740
+ * save(data, {
2741
+ * timestamp: untrack(() => time)
2742
+ * });
2743
+ * });
2744
+ * ```
2745
+ * @template T
2746
+ * @param {() => T} fn
2747
+ * @returns {T}
2748
+ */
2749
+ function untrack(fn) {
2750
+ var previous_untracking = untracking;
2751
+ try {
2752
+ untracking = true;
2753
+ return fn();
2754
+ } finally {
2755
+ untracking = previous_untracking;
2756
+ }
2757
+ }
2758
+ //#endregion
2759
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/events.js
2760
+ /**
2761
+ * Used on elements, as a map of event type -> event handler,
2762
+ * and on events themselves to track which element handled an event
2763
+ */
2764
+ var event_symbol = Symbol("events");
2765
+ /** @type {Set<string>} */
2766
+ var all_registered_events = /* @__PURE__ */ new Set();
2767
+ /** @type {Set<(events: Array<string>) => void>} */
2768
+ var root_event_handles = /* @__PURE__ */ new Set();
2769
+ var last_propagated_event = null;
2770
+ var last_propagated_event_clear_scheduled = false;
2771
+ /**
2772
+ * @this {EventTarget}
2773
+ * @param {Event} event
2774
+ * @returns {void}
2775
+ */
2776
+ function handle_event_propagation(event) {
2777
+ var handler_element = this;
2778
+ var owner_document = handler_element.ownerDocument;
2779
+ var event_name = event.type;
2780
+ var path = event.composedPath?.() || [];
2781
+ var current_target = path[0] || event.target;
2782
+ last_propagated_event = event;
2783
+ if (!last_propagated_event_clear_scheduled) {
2784
+ last_propagated_event_clear_scheduled = true;
2785
+ setTimeout(() => {
2786
+ last_propagated_event_clear_scheduled = false;
2787
+ last_propagated_event = null;
2788
+ });
2789
+ }
2790
+ var path_idx = 0;
2791
+ var handled_at = last_propagated_event === event && event[event_symbol];
2792
+ if (handled_at) {
2793
+ var at_idx = path.indexOf(handled_at);
2794
+ if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
2795
+ event[event_symbol] = handler_element;
2796
+ return;
2797
+ }
2798
+ var handler_idx = path.indexOf(handler_element);
2799
+ if (handler_idx === -1) return;
2800
+ if (at_idx <= handler_idx) path_idx = at_idx;
2801
+ }
2802
+ current_target = path[path_idx] || event.target;
2803
+ if (current_target === handler_element) return;
2804
+ define_property(event, "currentTarget", {
2805
+ configurable: true,
2806
+ get() {
2807
+ return current_target || owner_document;
2808
+ }
2809
+ });
2810
+ var previous_reaction = active_reaction;
2811
+ var previous_effect = active_effect;
2812
+ set_active_reaction(null);
2813
+ set_active_effect(null);
2814
+ try {
2815
+ /**
2816
+ * @type {unknown}
2817
+ */
2818
+ var throw_error;
2819
+ /**
2820
+ * @type {unknown[]}
2821
+ */
2822
+ var other_errors = [];
2823
+ while (current_target !== null) {
2824
+ if (current_target === handler_element) break;
2825
+ try {
2826
+ var delegated = current_target[event_symbol]?.[event_name];
2827
+ if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
2828
+ } catch (error) {
2829
+ if (throw_error) other_errors.push(error);
2830
+ else throw_error = error;
2831
+ }
2832
+ if (event.cancelBubble) break;
2833
+ path_idx++;
2834
+ current_target = path_idx < path.length ? path[path_idx] : null;
2835
+ }
2836
+ if (throw_error) {
2837
+ for (let error of other_errors) queueMicrotask(() => {
2838
+ throw error;
2839
+ });
2840
+ throw throw_error;
2841
+ }
2842
+ } finally {
2843
+ event[event_symbol] = handler_element;
2844
+ delete event.currentTarget;
2845
+ set_active_reaction(previous_reaction);
2846
+ set_active_effect(previous_effect);
2847
+ }
2848
+ }
2849
+ //#endregion
2850
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/reconciler.js
2851
+ var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
2852
+ /** @param {string} html */
2853
+ createHTML: (html) => {
2854
+ return html;
2855
+ } });
2856
+ /** @param {string} html */
2857
+ function create_trusted_html(html) {
2858
+ return policy?.createHTML(html) ?? html;
2859
+ }
2860
+ /**
2861
+ * @param {string} html
2862
+ */
2863
+ function create_fragment_from_html(html) {
2864
+ var elem = create_element("template");
2865
+ elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
2866
+ return elem.content;
2867
+ }
2868
+ //#endregion
2869
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/template.js
2870
+ /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
2871
+ /** @import { TemplateStructure } from './types' */
2872
+ /**
2873
+ * @param {TemplateNode} start
2874
+ * @param {TemplateNode | null} end
2875
+ */
2876
+ function assign_nodes(start, end) {
2877
+ var effect = active_effect;
2878
+ if (effect.nodes === null) effect.nodes = {
2879
+ start,
2880
+ end,
2881
+ a: null,
2882
+ t: null
2883
+ };
2884
+ }
2885
+ /**
2886
+ * @param {string} content
2887
+ * @param {number} flags
2888
+ * @returns {() => Node | Node[]}
2889
+ */
2890
+ /*#__NO_SIDE_EFFECTS__*/
2891
+ function from_html(content, flags) {
2892
+ var is_fragment = (flags & 1) !== 0;
2893
+ var use_import_node = (flags & 2) !== 0;
2894
+ /** @type {Node} */
2895
+ var node;
2896
+ /**
2897
+ * Whether or not the first item is a text/element node. If not, we need to
2898
+ * create an additional comment node to act as `effect.nodes.start`
2899
+ */
2900
+ var has_start = !content.startsWith("<!>");
2901
+ return () => {
2902
+ if (hydrating) {
2903
+ assign_nodes(hydrate_node, null);
2904
+ return hydrate_node;
2905
+ }
2906
+ if (node === void 0) {
2907
+ node = create_fragment_from_html(has_start ? content : "<!>" + content);
2908
+ if (!is_fragment) node = /* @__PURE__ */ get_first_child(node);
2909
+ }
2910
+ var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true);
2911
+ if (is_fragment) {
2912
+ var start = /* @__PURE__ */ get_first_child(clone);
2913
+ var end = clone.lastChild;
2914
+ assign_nodes(start, end);
2915
+ } else assign_nodes(clone, clone);
2916
+ return clone;
2917
+ };
2918
+ }
2919
+ /**
2920
+ * Assign the created (or in hydration mode, traversed) dom elements to the current block
2921
+ * and insert the elements into the dom (in client mode).
2922
+ * @param {Text | Comment | Element} anchor
2923
+ * @param {DocumentFragment | Element} dom
2924
+ */
2925
+ function append(anchor, dom) {
2926
+ if (hydrating) {
2927
+ var effect = active_effect;
2928
+ if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node;
2929
+ hydrate_next();
2930
+ return;
2931
+ }
2932
+ if (anchor === null) return;
2933
+ anchor.before(dom);
2934
+ }
2935
+ /**
2936
+ * Subset of delegated events which should be passive by default.
2937
+ * These two are already passive via browser defaults on window, document and body.
2938
+ * But since
2939
+ * - we're delegating them
2940
+ * - they happen often
2941
+ * - they apply to mobile which is generally less performant
2942
+ * we're marking them as passive by default for other elements, too.
2943
+ */
2944
+ var PASSIVE_EVENTS = ["touchstart", "touchmove"];
2945
+ /**
2946
+ * Returns `true` if `name` is a passive event
2947
+ * @param {string} name
2948
+ */
2949
+ function is_passive_event(name) {
2950
+ return PASSIVE_EVENTS.includes(name);
2951
+ }
2952
+ //#endregion
2953
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/reactivity/create-subscriber.js
2954
+ /**
2955
+ * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
2956
+ * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
2957
+ *
2958
+ * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
2959
+ * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
2960
+ *
2961
+ * If `start` returns a cleanup function, it will be called when the effect is destroyed.
2962
+ *
2963
+ * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
2964
+ * are active, and the returned teardown function will only be called when all effects are destroyed.
2965
+ *
2966
+ * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
2967
+ *
2968
+ * ```js
2969
+ * import { createSubscriber } from 'svelte/reactivity';
2970
+ * import { on } from 'svelte/events';
2971
+ *
2972
+ * export class MediaQuery {
2973
+ * #query;
2974
+ * #subscribe;
2975
+ *
2976
+ * constructor(query) {
2977
+ * this.#query = window.matchMedia(`(${query})`);
2978
+ *
2979
+ * this.#subscribe = createSubscriber((update) => {
2980
+ * // when the `change` event occurs, re-run any effects that read `this.current`
2981
+ * const off = on(this.#query, 'change', update);
2982
+ *
2983
+ * // stop listening when all the effects are destroyed
2984
+ * return () => off();
2985
+ * });
2986
+ * }
2987
+ *
2988
+ * get current() {
2989
+ * // This makes the getter reactive, if read in an effect
2990
+ * this.#subscribe();
2991
+ *
2992
+ * // Return the current state of the query, whether or not we're in an effect
2993
+ * return this.#query.matches;
2994
+ * }
2995
+ * }
2996
+ * ```
2997
+ * @param {(update: () => void) => (() => void) | void} start
2998
+ * @since 5.7.0
2999
+ */
3000
+ function createSubscriber(start) {
3001
+ let subscribers = 0;
3002
+ let version = source(0);
3003
+ /** @type {(() => void) | void} */
3004
+ let stop;
3005
+ return () => {
3006
+ if (effect_tracking()) {
3007
+ get(version);
3008
+ render_effect(() => {
3009
+ if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
3010
+ subscribers += 1;
3011
+ return () => {
3012
+ queue_micro_task(() => {
3013
+ subscribers -= 1;
3014
+ if (subscribers === 0) {
3015
+ stop?.();
3016
+ stop = void 0;
3017
+ increment(version);
3018
+ }
3019
+ });
3020
+ };
3021
+ });
3022
+ }
3023
+ };
3024
+ }
3025
+ //#endregion
3026
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
3027
+ /** @import { Effect, Source, TemplateNode, } from '#client' */
3028
+ /**
3029
+ * @typedef {{
3030
+ * onerror?: ((error: unknown, reset: () => void) => void) | null;
3031
+ * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
3032
+ * pending?: ((anchor: Node) => void) | null;
3033
+ * }} BoundaryProps
3034
+ */
3035
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
3036
+ /**
3037
+ * @param {TemplateNode} node
3038
+ * @param {BoundaryProps} props
3039
+ * @param {((anchor: Node) => void)} children
3040
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
3041
+ * @returns {void}
3042
+ */
3043
+ function boundary(node, props, children, transform_error) {
3044
+ new Boundary(node, props, children, transform_error);
3045
+ }
3046
+ var _anchor = /* @__PURE__ */ new WeakMap();
3047
+ var _hydrate_open = /* @__PURE__ */ new WeakMap();
3048
+ var _props = /* @__PURE__ */ new WeakMap();
3049
+ var _children = /* @__PURE__ */ new WeakMap();
3050
+ var _effect = /* @__PURE__ */ new WeakMap();
3051
+ var _main_effect = /* @__PURE__ */ new WeakMap();
3052
+ var _pending_effect = /* @__PURE__ */ new WeakMap();
3053
+ var _failed_effect = /* @__PURE__ */ new WeakMap();
3054
+ var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
3055
+ var _local_pending_count = /* @__PURE__ */ new WeakMap();
3056
+ var _pending_count = /* @__PURE__ */ new WeakMap();
3057
+ var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
3058
+ var _dirty_effects = /* @__PURE__ */ new WeakMap();
3059
+ var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
3060
+ var _effect_pending = /* @__PURE__ */ new WeakMap();
3061
+ var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
3062
+ var _Boundary_brand = /* @__PURE__ */ new WeakSet();
3063
+ var Boundary = class {
3064
+ /**
3065
+ * @param {TemplateNode} node
3066
+ * @param {BoundaryProps} props
3067
+ * @param {((anchor: Node) => void)} children
3068
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
3069
+ */
3070
+ constructor(node, props, children, transform_error) {
3071
+ _classPrivateMethodInitSpec(this, _Boundary_brand);
3072
+ _defineProperty(
3073
+ this,
3074
+ /** @type {Boundary | null} */
3075
+ "parent",
3076
+ void 0
3077
+ );
3078
+ _defineProperty(this, "is_pending", false);
3079
+ _defineProperty(
3080
+ this,
3081
+ /**
3082
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
3083
+ * Inherited from parent boundary, or defaults to identity.
3084
+ * @type {(error: unknown) => unknown}
3085
+ */
3086
+ "transform_error",
3087
+ void 0
3088
+ );
3089
+ _classPrivateFieldInitSpec(this, _anchor, void 0);
3090
+ _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
3091
+ _classPrivateFieldInitSpec(this, _props, void 0);
3092
+ _classPrivateFieldInitSpec(this, _children, void 0);
3093
+ _classPrivateFieldInitSpec(this, _effect, void 0);
3094
+ _classPrivateFieldInitSpec(this, _main_effect, null);
3095
+ _classPrivateFieldInitSpec(this, _pending_effect, null);
3096
+ _classPrivateFieldInitSpec(this, _failed_effect, null);
3097
+ _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
3098
+ _classPrivateFieldInitSpec(this, _local_pending_count, 0);
3099
+ _classPrivateFieldInitSpec(this, _pending_count, 0);
3100
+ _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
3101
+ _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
3102
+ _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
3103
+ _classPrivateFieldInitSpec(this, _effect_pending, null);
3104
+ _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
3105
+ _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
3106
+ return () => {
3107
+ _classPrivateFieldSet2(_effect_pending, this, null);
3108
+ };
3109
+ }));
3110
+ _classPrivateFieldSet2(_anchor, this, node);
3111
+ _classPrivateFieldSet2(_props, this, props);
3112
+ _classPrivateFieldSet2(_children, this, (anchor) => {
3113
+ var effect = active_effect;
3114
+ effect.b = this;
3115
+ effect.f |= 128;
3116
+ children(anchor);
3117
+ });
3118
+ this.parent = active_effect.b;
3119
+ this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
3120
+ _classPrivateFieldSet2(_effect, this, block(() => {
3121
+ if (hydrating) {
3122
+ const comment = _classPrivateFieldGet2(_hydrate_open, this);
3123
+ hydrate_next();
3124
+ const server_rendered_pending = comment.data === "[!";
3125
+ if (comment.data.startsWith("[?")) {
3126
+ const serialized_error = JSON.parse(comment.data.slice(2));
3127
+ _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
3128
+ } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
3129
+ else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
3130
+ } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
3131
+ }, flags));
3132
+ if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
3133
+ }
3134
+ /**
3135
+ * Defer an effect inside a pending boundary until the boundary resolves
3136
+ * @param {Effect} effect
3137
+ */
3138
+ defer_effect(effect) {
3139
+ defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
3014
3140
  }
3015
- }
3016
- /**
3017
- * @param {Reaction} signal
3018
- * @param {number} start_index
3019
- * @returns {void}
3020
- */
3021
- function remove_reactions(signal, start_index) {
3022
- var dependencies = signal.deps;
3023
- if (dependencies === null) return;
3024
- for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
3025
- }
3026
- /**
3027
- * @param {Effect} effect
3028
- * @returns {void}
3029
- */
3030
- function update_effect(effect) {
3031
- var flags = effect.f;
3032
- if ((flags & 16384) !== 0) return;
3033
- set_signal_status(effect, CLEAN);
3034
- var previous_effect = active_effect;
3035
- var was_updating_effect = is_updating_effect;
3036
- active_effect = effect;
3037
- is_updating_effect = true;
3038
- try {
3039
- if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
3040
- else destroy_effect_children(effect);
3041
- execute_effect_teardown(effect);
3042
- var teardown = update_reaction(effect);
3043
- effect.teardown = typeof teardown === "function" ? teardown : null;
3044
- effect.wv = write_version;
3045
- } finally {
3046
- is_updating_effect = was_updating_effect;
3047
- active_effect = previous_effect;
3141
+ /**
3142
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
3143
+ * @returns {boolean}
3144
+ */
3145
+ is_rendered() {
3146
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
3048
3147
  }
3049
- }
3050
- /**
3051
- * @template V
3052
- * @param {Value<V>} signal
3053
- * @returns {V}
3054
- */
3055
- function get(signal) {
3056
- var is_derived = (signal.f & 2) !== 0;
3057
- captured_signals?.add(signal);
3058
- if (active_reaction !== null && !untracking) {
3059
- if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
3060
- var deps = active_reaction.deps;
3061
- if ((active_reaction.f & 2097152) !== 0) {
3062
- if (signal.rv < read_version) {
3063
- signal.rv = read_version;
3064
- if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
3065
- else if (new_deps === null) new_deps = [signal];
3066
- else new_deps.push(signal);
3067
- }
3068
- } else {
3069
- var _active_reaction;
3070
- (_active_reaction = active_reaction).deps ?? (_active_reaction.deps = []);
3071
- if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
3072
- var reactions = signal.reactions;
3073
- if (reactions === null) signal.reactions = [active_reaction];
3074
- else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
3075
- }
3076
- }
3148
+ has_pending_snippet() {
3149
+ return !!_classPrivateFieldGet2(_props, this).pending;
3077
3150
  }
3078
- if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
3079
- if (is_derived) {
3080
- var derived = signal;
3081
- if (is_destroying_effect) {
3082
- var value = derived.v;
3083
- if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
3084
- old_values.set(derived, value);
3085
- return value;
3086
- }
3087
- var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
3088
- var is_new = (derived.f & REACTION_RAN) === 0;
3089
- if (is_dirty(derived)) {
3090
- if (should_connect) derived.f |= 512;
3091
- update_derived(derived);
3092
- }
3093
- if (should_connect && !is_new) {
3094
- unfreeze_derived_effects(derived);
3095
- reconnect(derived);
3096
- }
3151
+ /**
3152
+ * Update the source that powers `$effect.pending()` inside this boundary,
3153
+ * and controls when the current `pending` snippet (if any) is removed.
3154
+ * Do not call from inside the class
3155
+ * @param {1 | -1} d
3156
+ * @param {Batch} batch
3157
+ */
3158
+ update_pending_count(d, batch) {
3159
+ _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
3160
+ _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
3161
+ if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
3162
+ _classPrivateFieldSet2(_pending_count_update_queued, this, true);
3163
+ queue_micro_task(() => {
3164
+ _classPrivateFieldSet2(_pending_count_update_queued, this, false);
3165
+ if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
3166
+ });
3097
3167
  }
3098
- if (batch_values?.has(signal)) return batch_values.get(signal);
3099
- if ((signal.f & 8388608) !== 0) throw signal.v;
3100
- return signal.v;
3101
- }
3102
- /**
3103
- * (Re)connect a disconnected derived, so that it is notified
3104
- * of changes in `mark_reactions`
3105
- * @param {Derived} derived
3106
- */
3107
- function reconnect(derived) {
3108
- derived.f |= 512;
3109
- if (derived.deps === null) return;
3110
- for (const dep of derived.deps) {
3111
- (dep.reactions ?? (dep.reactions = [])).push(derived);
3112
- if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
3113
- unfreeze_derived_effects(dep);
3114
- reconnect(dep);
3115
- }
3168
+ get_effect_pending() {
3169
+ _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
3170
+ return get(_classPrivateFieldGet2(_effect_pending, this));
3116
3171
  }
3117
- }
3118
- /** @param {Derived} derived */
3119
- function depends_on_old_values(derived) {
3120
- if (derived.v === UNINITIALIZED) return true;
3121
- if (derived.deps === null) return false;
3122
- for (const dep of derived.deps) {
3123
- if (old_values.has(dep)) return true;
3124
- if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
3172
+ /** @param {unknown} error */
3173
+ error(error) {
3174
+ if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
3175
+ if (current_batch?.is_fork) {
3176
+ if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
3177
+ if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
3178
+ if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
3179
+ current_batch.oncommit(() => {
3180
+ _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
3181
+ });
3182
+ } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
3125
3183
  }
3126
- return false;
3127
- }
3128
- /**
3129
- * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
3130
- * any state read inside `fn` will not be treated as a dependency.
3131
- *
3132
- * ```ts
3133
- * $effect(() => {
3134
- * // this will run when `data` changes, but not when `time` changes
3135
- * save(data, {
3136
- * timestamp: untrack(() => time)
3137
- * });
3138
- * });
3139
- * ```
3140
- * @template T
3141
- * @param {() => T} fn
3142
- * @returns {T}
3143
- */
3144
- function untrack(fn) {
3145
- var previous_untracking = untracking;
3184
+ };
3185
+ function _hydrate_resolved_content() {
3146
3186
  try {
3147
- untracking = true;
3148
- return fn();
3149
- } finally {
3150
- untracking = previous_untracking;
3187
+ _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
3188
+ } catch (error) {
3189
+ this.error(error);
3151
3190
  }
3152
3191
  }
3153
- //#endregion
3154
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/events.js
3155
3192
  /**
3156
- * Used on elements, as a map of event type -> event handler,
3157
- * and on events themselves to track which element handled an event
3193
+ * @param {unknown} error The deserialized error from the server's hydration comment
3158
3194
  */
3159
- var event_symbol = Symbol("events");
3160
- /** @type {Set<string>} */
3161
- var all_registered_events = /* @__PURE__ */ new Set();
3162
- /** @type {Set<(events: Array<string>) => void>} */
3163
- var root_event_handles = /* @__PURE__ */ new Set();
3164
- var last_propagated_event = null;
3195
+ function _hydrate_failed_content(error) {
3196
+ const failed = _classPrivateFieldGet2(_props, this).failed;
3197
+ const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, error);
3198
+ queue_micro_task(invoke_onerror);
3199
+ if (!failed) return;
3200
+ _classPrivateFieldSet2(_failed_effect, this, branch(() => {
3201
+ failed(_classPrivateFieldGet2(_anchor, this), () => error, () => reset);
3202
+ }));
3203
+ }
3165
3204
  /**
3166
- * @this {EventTarget}
3167
- * @param {Event} event
3168
- * @returns {void}
3205
+ * Creates the `reset` function for a failed boundary, along with a function
3206
+ * that invokes `onerror` with it (if provided)
3207
+ * @param {unknown} error
3208
+ * @returns {{ reset: () => void, invoke_onerror: () => void }}
3169
3209
  */
3170
- function handle_event_propagation(event) {
3171
- var handler_element = this;
3172
- var owner_document = handler_element.ownerDocument;
3173
- var event_name = event.type;
3174
- var path = event.composedPath?.() || [];
3175
- var current_target = path[0] || event.target;
3176
- last_propagated_event = event;
3177
- var path_idx = 0;
3178
- var handled_at = last_propagated_event === event && event[event_symbol];
3179
- if (handled_at) {
3180
- var at_idx = path.indexOf(handled_at);
3181
- if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
3182
- event[event_symbol] = handler_element;
3210
+ function _create_reset(error) {
3211
+ var did_reset = false;
3212
+ var calling_on_error = false;
3213
+ const reset = () => {
3214
+ if (did_reset) {
3215
+ svelte_boundary_reset_noop();
3183
3216
  return;
3184
3217
  }
3185
- var handler_idx = path.indexOf(handler_element);
3186
- if (handler_idx === -1) return;
3187
- if (at_idx <= handler_idx) path_idx = at_idx;
3188
- }
3189
- current_target = path[path_idx] || event.target;
3190
- if (current_target === handler_element) return;
3191
- define_property(event, "currentTarget", {
3192
- configurable: true,
3193
- get() {
3194
- return current_target || owner_document;
3218
+ did_reset = true;
3219
+ if (calling_on_error) svelte_boundary_reset_onerror();
3220
+ if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
3221
+ _classPrivateFieldSet2(_failed_effect, this, null);
3222
+ });
3223
+ _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
3224
+ _assertClassBrand(_Boundary_brand, this, _render).call(this);
3225
+ });
3226
+ };
3227
+ const invoke_onerror = () => {
3228
+ try {
3229
+ calling_on_error = true;
3230
+ _classPrivateFieldGet2(_props, this).onerror?.(error, reset);
3231
+ calling_on_error = false;
3232
+ } catch (err) {
3233
+ invoke_error_boundary(err, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
3195
3234
  }
3196
- });
3197
- var previous_reaction = active_reaction;
3198
- var previous_effect = active_effect;
3199
- set_active_reaction(null);
3200
- set_active_effect(null);
3201
- try {
3202
- /**
3203
- * @type {unknown}
3204
- */
3205
- var throw_error;
3206
- /**
3207
- * @type {unknown[]}
3208
- */
3209
- var other_errors = [];
3210
- while (current_target !== null) {
3211
- if (current_target === handler_element) break;
3235
+ };
3236
+ return {
3237
+ reset,
3238
+ invoke_onerror
3239
+ };
3240
+ }
3241
+ function _hydrate_pending_content() {
3242
+ const pending = _classPrivateFieldGet2(_props, this).pending;
3243
+ if (!pending) return;
3244
+ this.is_pending = true;
3245
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
3246
+ queue_micro_task(() => {
3247
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
3248
+ var anchor = create_text();
3249
+ var handled = false;
3250
+ fragment.append(anchor);
3251
+ _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
3212
3252
  try {
3213
- var delegated = current_target[event_symbol]?.[event_name];
3214
- if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
3253
+ return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
3215
3254
  } catch (error) {
3216
- if (throw_error) other_errors.push(error);
3217
- else throw_error = error;
3255
+ try {
3256
+ this.error(error);
3257
+ handled = true;
3258
+ } catch (error) {
3259
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
3260
+ }
3261
+ return null;
3218
3262
  }
3219
- if (event.cancelBubble) break;
3220
- path_idx++;
3221
- current_target = path_idx < path.length ? path[path_idx] : null;
3263
+ }));
3264
+ if (_classPrivateFieldGet2(_main_effect, this) === null) {
3265
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
3266
+ if (handled) _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
3267
+ return;
3222
3268
  }
3223
- if (throw_error) {
3224
- for (let error of other_errors) queueMicrotask(() => {
3225
- throw error;
3269
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
3270
+ _classPrivateFieldGet2(_anchor, this).before(fragment);
3271
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
3272
+ pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
3273
+ _classPrivateFieldSet2(_pending_effect, this, null);
3226
3274
  });
3227
- throw throw_error;
3275
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
3228
3276
  }
3229
- } finally {
3230
- event[event_symbol] = handler_element;
3231
- delete event.currentTarget;
3232
- set_active_reaction(previous_reaction);
3233
- set_active_effect(previous_effect);
3234
- }
3277
+ });
3235
3278
  }
3236
- //#endregion
3237
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/reconciler.js
3238
- var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
3239
- /** @param {string} html */
3240
- createHTML: (html) => {
3241
- return html;
3242
- } });
3243
- /** @param {string} html */
3244
- function create_trusted_html(html) {
3245
- return policy?.createHTML(html) ?? html;
3279
+ function _render() {
3280
+ try {
3281
+ this.is_pending = this.has_pending_snippet();
3282
+ _classPrivateFieldSet2(_pending_count, this, 0);
3283
+ _classPrivateFieldSet2(_local_pending_count, this, 0);
3284
+ _classPrivateFieldSet2(_main_effect, this, branch(() => {
3285
+ _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
3286
+ }));
3287
+ if (_classPrivateFieldGet2(_pending_count, this) > 0) {
3288
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
3289
+ move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
3290
+ const pending = _classPrivateFieldGet2(_props, this).pending;
3291
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
3292
+ } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
3293
+ } catch (error) {
3294
+ this.error(error);
3295
+ }
3246
3296
  }
3247
3297
  /**
3248
- * @param {string} html
3298
+ * @param {Batch} batch
3249
3299
  */
3250
- function create_fragment_from_html(html) {
3251
- var elem = create_element("template");
3252
- elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
3253
- return elem.content;
3300
+ function _resolve(batch) {
3301
+ this.is_pending = false;
3302
+ batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
3254
3303
  }
3255
- //#endregion
3256
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/template.js
3257
- /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
3258
- /** @import { TemplateStructure } from './types' */
3259
3304
  /**
3260
- * @param {TemplateNode} start
3261
- * @param {TemplateNode | null} end
3305
+ * @template T
3306
+ * @param {() => T} fn
3262
3307
  */
3263
- function assign_nodes(start, end) {
3264
- var effect = active_effect;
3265
- if (effect.nodes === null) effect.nodes = {
3266
- start,
3267
- end,
3268
- a: null,
3269
- t: null
3270
- };
3308
+ function _run(fn) {
3309
+ var previous_effect = active_effect;
3310
+ var previous_reaction = active_reaction;
3311
+ var previous_ctx = component_context;
3312
+ set_active_effect(_classPrivateFieldGet2(_effect, this));
3313
+ set_active_reaction(_classPrivateFieldGet2(_effect, this));
3314
+ set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
3315
+ try {
3316
+ Batch.ensure();
3317
+ return fn();
3318
+ } finally {
3319
+ set_active_effect(previous_effect);
3320
+ set_active_reaction(previous_reaction);
3321
+ set_component_context(previous_ctx);
3322
+ }
3271
3323
  }
3272
3324
  /**
3273
- * @param {string} content
3274
- * @param {number} flags
3275
- * @returns {() => Node | Node[]}
3325
+ * Updates the pending count associated with the currently visible pending snippet,
3326
+ * if any, such that we can replace the snippet with content once work is done
3327
+ * @param {1 | -1} d
3328
+ * @param {Batch} batch
3276
3329
  */
3277
- /*#__NO_SIDE_EFFECTS__*/
3278
- function from_html(content, flags) {
3279
- var is_fragment = (flags & 1) !== 0;
3280
- var use_import_node = (flags & 2) !== 0;
3281
- /** @type {Node} */
3282
- var node;
3283
- /**
3284
- * Whether or not the first item is a text/element node. If not, we need to
3285
- * create an additional comment node to act as `effect.nodes.start`
3286
- */
3287
- var has_start = !content.startsWith("<!>");
3288
- return () => {
3289
- if (hydrating) {
3290
- assign_nodes(hydrate_node, null);
3291
- return hydrate_node;
3330
+ function _update_pending_count(d, batch) {
3331
+ if (!this.has_pending_snippet()) {
3332
+ if (this.parent) {
3333
+ var _this$parent;
3334
+ _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
3292
3335
  }
3293
- if (node === void 0) {
3294
- node = create_fragment_from_html(has_start ? content : "<!>" + content);
3295
- if (!is_fragment) node = /* @__PURE__ */ get_first_child(node);
3336
+ return;
3337
+ }
3338
+ _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
3339
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
3340
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
3341
+ if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
3342
+ _classPrivateFieldSet2(_pending_effect, this, null);
3343
+ });
3344
+ if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
3345
+ _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
3346
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
3296
3347
  }
3297
- var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true);
3298
- if (is_fragment) {
3299
- var start = /* @__PURE__ */ get_first_child(clone);
3300
- var end = clone.lastChild;
3301
- assign_nodes(start, end);
3302
- } else assign_nodes(clone, clone);
3303
- return clone;
3304
- };
3348
+ }
3305
3349
  }
3306
3350
  /**
3307
- * Assign the created (or in hydration mode, traversed) dom elements to the current block
3308
- * and insert the elements into the dom (in client mode).
3309
- * @param {Text | Comment | Element} anchor
3310
- * @param {DocumentFragment | Element} dom
3351
+ * @param {unknown} error
3311
3352
  */
3312
- function append(anchor, dom) {
3353
+ function _handle_error(error) {
3354
+ if (_classPrivateFieldGet2(_main_effect, this)) {
3355
+ destroy_effect(_classPrivateFieldGet2(_main_effect, this));
3356
+ _classPrivateFieldSet2(_main_effect, this, null);
3357
+ }
3358
+ if (_classPrivateFieldGet2(_pending_effect, this)) {
3359
+ destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
3360
+ _classPrivateFieldSet2(_pending_effect, this, null);
3361
+ }
3362
+ if (_classPrivateFieldGet2(_failed_effect, this)) {
3363
+ destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
3364
+ _classPrivateFieldSet2(_failed_effect, this, null);
3365
+ }
3313
3366
  if (hydrating) {
3314
- var effect = active_effect;
3315
- if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node;
3316
- hydrate_next();
3317
- return;
3367
+ set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
3368
+ next();
3369
+ set_hydrate_node(skip_nodes());
3318
3370
  }
3319
- if (anchor === null) return;
3320
- anchor.before(dom);
3321
- }
3322
- /**
3323
- * Subset of delegated events which should be passive by default.
3324
- * These two are already passive via browser defaults on window, document and body.
3325
- * But since
3326
- * - we're delegating them
3327
- * - they happen often
3328
- * - they apply to mobile which is generally less performant
3329
- * we're marking them as passive by default for other elements, too.
3330
- */
3331
- var PASSIVE_EVENTS = ["touchstart", "touchmove"];
3332
- /**
3333
- * Returns `true` if `name` is a passive event
3334
- * @param {string} name
3335
- */
3336
- function is_passive_event(name) {
3337
- return PASSIVE_EVENTS.includes(name);
3371
+ let failed = _classPrivateFieldGet2(_props, this).failed;
3372
+ /** @param {unknown} transformed_error */
3373
+ const handle_error_result = (transformed_error) => {
3374
+ const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, transformed_error);
3375
+ invoke_onerror();
3376
+ if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
3377
+ try {
3378
+ return branch(() => {
3379
+ var effect = active_effect;
3380
+ effect.b = this;
3381
+ effect.f |= 128;
3382
+ failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
3383
+ });
3384
+ } catch (error) {
3385
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
3386
+ return null;
3387
+ }
3388
+ }));
3389
+ };
3390
+ queue_micro_task(() => {
3391
+ /** @type {unknown} */
3392
+ var result;
3393
+ try {
3394
+ result = this.transform_error(error);
3395
+ } catch (e) {
3396
+ invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
3397
+ return;
3398
+ }
3399
+ if (result !== null && typeof result === "object" && typeof result.then === "function")
3400
+ /** @type {any} */ result.then(
3401
+ handle_error_result,
3402
+ /** @param {unknown} e */
3403
+ (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
3404
+ );
3405
+ else handle_error_result(result);
3406
+ });
3338
3407
  }
3339
3408
  /**
3340
3409
  * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.
@@ -3426,7 +3495,7 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
3426
3495
  if (events)
3427
3496
  /** @type {any} */ props.$$events = events;
3428
3497
  if (hydrating) assign_nodes(anchor_node, null);
3429
- component = Component(anchor_node, props) || {};
3498
+ component = Component(anchor_node, props) || mark_as_component();
3430
3499
  if (hydrating) {
3431
3500
  /** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = hydrate_node;
3432
3501
  if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") {
@@ -3512,7 +3581,7 @@ function unmount(component, options) {
3512
3581
  return Promise.resolve();
3513
3582
  }
3514
3583
  //#endregion
3515
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3584
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3516
3585
  /** @import { Effect, TemplateNode } from '#client' */
3517
3586
  var _batches = /* @__PURE__ */ new WeakMap();
3518
3587
  var _onscreen = /* @__PURE__ */ new WeakMap();
@@ -3635,7 +3704,7 @@ var BranchManager = class {
3635
3704
  }
3636
3705
  };
3637
3706
  //#endregion
3638
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/blocks/if.js
3707
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/if.js
3639
3708
  /** @import { TemplateNode } from '#client' */
3640
3709
  /**
3641
3710
  * @param {TemplateNode} node
@@ -3741,13 +3810,14 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
3741
3810
  });
3742
3811
  }
3743
3812
  //#endregion
3744
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/css.js
3813
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/css.js
3745
3814
  /**
3746
3815
  * @param {Node} anchor
3747
3816
  * @param {{ hash: string, code: string }} css
3748
3817
  */
3749
3818
  function append_styles(anchor, css) {
3750
3819
  effect(() => {
3820
+ anchor = active_effect?.parent?.nodes?.start ?? anchor;
3751
3821
  var root = anchor.getRootNode();
3752
3822
  var target = root.host ? root : /** @type {Document} */ root.head ?? root.ownerDocument.head;
3753
3823
  if (!target.querySelector("#" + css.hash)) {
@@ -3759,7 +3829,7 @@ function append_styles(anchor, css) {
3759
3829
  });
3760
3830
  }
3761
3831
  //#endregion
3762
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3832
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3763
3833
  var _ResizeObserverSingleton;
3764
3834
  var _listeners = /* @__PURE__ */ new WeakMap();
3765
3835
  var _observer = /* @__PURE__ */ new WeakMap();
@@ -3811,7 +3881,7 @@ function _getObserver() {
3811
3881
  }
3812
3882
  _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
3813
3883
  //#endregion
3814
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/props.js
3884
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/props.js
3815
3885
  /** @import { Derived, Effect, Source } from './types.js' */
3816
3886
  /**
3817
3887
  * This function is responsible for synchronizing a possibly bound prop with the inner component state.
@@ -3904,7 +3974,7 @@ function prop(props, key, flags, fallback) {
3904
3974
  });
3905
3975
  }
3906
3976
  //#endregion
3907
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/legacy/legacy-client.js
3977
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/legacy/legacy-client.js
3908
3978
  /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
3909
3979
  /**
3910
3980
  * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
@@ -4023,7 +4093,7 @@ var Svelte4Component = class {
4023
4093
  }
4024
4094
  };
4025
4095
  //#endregion
4026
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4096
+ //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4027
4097
  /**
4028
4098
  * @typedef {Object} CustomElementPropDefinition
4029
4099
  * @property {string} [attribute]