@pie-element/simple-cloze 0.1.3 → 0.1.4-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/index.d.ts +0 -1
  4. package/dist/author/index.js +14813 -20641
  5. package/dist/author/index.js.map +1 -1
  6. package/dist/controller/defaults.d.ts +0 -1
  7. package/dist/controller/index.d.ts +0 -1
  8. package/dist/controller/index.js +4 -4
  9. package/dist/controller/index.js.map +1 -1
  10. package/dist/delivery/index.d.ts +6 -1
  11. package/dist/delivery/index.js +577 -357
  12. package/dist/delivery/index.js.map +1 -1
  13. package/dist/index.d.ts +0 -1
  14. package/dist/index.iife.d.ts +0 -1
  15. package/dist/index.iife.js +3 -3
  16. package/dist/index.js +577 -357
  17. package/dist/index.js.map +1 -1
  18. package/dist/print/index.d.ts +0 -1
  19. package/dist/print/index.js +471 -314
  20. package/dist/print/index.js.map +1 -1
  21. package/dist/runtime-support.d.ts +12 -0
  22. package/dist/runtime-support.js +14 -0
  23. package/dist/runtime-support.js.map +1 -0
  24. package/package.json +21 -18
  25. package/dist/author/index.d.ts.map +0 -1
  26. package/dist/controller/defaults.d.ts.map +0 -1
  27. package/dist/controller/index.d.ts.map +0 -1
  28. package/dist/delivery/index.d.ts.map +0 -1
  29. package/dist/index.d.ts.map +0 -1
  30. package/dist/index.iife.d.ts.map +0 -1
  31. package/dist/print/index.d.ts.map +0 -1
  32. package/src/author/Author.svelte +0 -102
  33. package/src/author/index.ts +0 -28
  34. package/src/controller/defaults.ts +0 -13
  35. package/src/controller/index.ts +0 -98
  36. package/src/delivery/SimpleCloze.svelte +0 -171
  37. package/src/delivery/index.ts +0 -37
  38. package/src/index.iife.ts +0 -7
  39. package/src/index.ts +0 -1
  40. package/src/print/Print.svelte +0 -49
  41. package/src/print/index.ts +0 -18
@@ -1,16 +1,16 @@
1
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/disclose-version.js
1
+ //#region ../../../node_modules/.bun/svelte@5.56.1/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.55.1/node_modules/svelte/src/constants.js
7
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/constants.js
8
8
  var HYDRATION_ERROR = {};
9
- var UNINITIALIZED = Symbol();
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.55.1/node_modules/svelte/src/internal/shared/utils.js
13
+ //#region ../../../node_modules/.bun/svelte@5.56.1/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;
@@ -47,7 +47,7 @@ function deferred() {
47
47
  };
48
48
  }
49
49
  //#endregion
50
- //#region \0@oxc-project+runtime@0.120.0/helpers/typeof.js
50
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
51
51
  function _typeof(o) {
52
52
  "@babel/helpers - typeof";
53
53
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -57,7 +57,7 @@ function _typeof(o) {
57
57
  }, _typeof(o);
58
58
  }
59
59
  //#endregion
60
- //#region \0@oxc-project+runtime@0.120.0/helpers/toPrimitive.js
60
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
61
61
  function toPrimitive(t, r) {
62
62
  if ("object" != _typeof(t) || !t) return t;
63
63
  var e = t[Symbol.toPrimitive];
@@ -69,13 +69,13 @@ function toPrimitive(t, r) {
69
69
  return ("string" === r ? String : Number)(t);
70
70
  }
71
71
  //#endregion
72
- //#region \0@oxc-project+runtime@0.120.0/helpers/toPropertyKey.js
72
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
73
73
  function toPropertyKey(t) {
74
74
  var i = toPrimitive(t, "string");
75
75
  return "symbol" == _typeof(i) ? i : i + "";
76
76
  }
77
77
  //#endregion
78
- //#region \0@oxc-project+runtime@0.120.0/helpers/defineProperty.js
78
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
79
79
  function _defineProperty(e, r, t) {
80
80
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
81
81
  value: t,
@@ -103,7 +103,8 @@ var USER_EFFECT = 1 << 20;
103
103
  /**
104
104
  * Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
105
105
  * Will be lifted during execution of the derived and during checking its dirty state (both are necessary
106
- * because a derived might be checked but not executed).
106
+ * because a derived might be checked but not executed). This is a pure performance optimization flag and
107
+ * should not be used for any other purpose!
107
108
  */
108
109
  var WAS_MARKED = 65536;
109
110
  var REACTION_IS_UPDATING = 1 << 21;
@@ -112,6 +113,10 @@ var ERROR_VALUE = 1 << 23;
112
113
  var STATE_SYMBOL = Symbol("$state");
113
114
  var LEGACY_PROPS = Symbol("legacy props");
114
115
  var LOADING_ATTR_SYMBOL = Symbol("");
116
+ var ATTRIBUTES_CACHE = Symbol("attributes");
117
+ var CLASS_CACHE = Symbol("class");
118
+ var STYLE_CACHE = Symbol("style");
119
+ var TEXT_CACHE = Symbol("text");
115
120
  /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
116
121
  var STALE_REACTION = new class StaleReactionError extends Error {
117
122
  constructor(..._args) {
@@ -130,7 +135,7 @@ function lifecycle_outside_component(name) {
130
135
  throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
131
136
  }
132
137
  //#endregion
133
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/errors.js
138
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/errors.js
134
139
  /**
135
140
  * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
136
141
  * @returns {never}
@@ -204,6 +209,12 @@ function svelte_boundary_reset_onerror() {
204
209
  throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
205
210
  }
206
211
  /**
212
+ * Reading a derived belonging to a now-destroyed effect may result in stale values
213
+ */
214
+ function derived_inert() {
215
+ console.warn(`https://svelte.dev/e/derived_inert`);
216
+ }
217
+ /**
207
218
  * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%
208
219
  * @param {string | undefined | null} [location]
209
220
  */
@@ -217,7 +228,7 @@ function svelte_boundary_reset_noop() {
217
228
  console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
218
229
  }
219
230
  //#endregion
220
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/hydration.js
231
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/hydration.js
221
232
  /** @import { TemplateNode } from '#client' */
222
233
  /**
223
234
  * Use this variable to guard everything related to hydration code so it can be treeshaken out
@@ -296,7 +307,7 @@ function read_hydration_instruction(node) {
296
307
  return node.data;
297
308
  }
298
309
  //#endregion
299
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/equality.js
310
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/equality.js
300
311
  /** @import { Equals } from '#client' */
301
312
  /** @type {Equals} */
302
313
  function equals(value) {
@@ -315,13 +326,13 @@ function safe_equals(value) {
315
326
  return !safe_not_equal(value, this.v);
316
327
  }
317
328
  //#endregion
318
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/flags/index.js
329
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/flags/index.js
319
330
  /** True if experimental.async=true */
320
331
  var async_mode_flag = false;
321
332
  /** True if we're not certain that we only have Svelte 5 code in the compilation */
322
333
  var legacy_mode_flag = false;
323
334
  //#endregion
324
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/context.js
335
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/context.js
325
336
  /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
326
337
  /** @type {ComponentContext | null} */
327
338
  var component_context = null;
@@ -373,7 +384,7 @@ function is_runes() {
373
384
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
374
385
  }
375
386
  //#endregion
376
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/task.js
387
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/task.js
377
388
  /** @type {Array<() => void>} */
378
389
  var micro_tasks = [];
379
390
  function run_micro_tasks() {
@@ -431,7 +442,7 @@ function invoke_error_boundary(error, effect) {
431
442
  throw error;
432
443
  }
433
444
  //#endregion
434
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/status.js
445
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/status.js
435
446
  /** @import { Derived, Signal } from '#client' */
436
447
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
437
448
  /**
@@ -450,7 +461,7 @@ function update_derived_status(derived) {
450
461
  else set_signal_status(derived, MAYBE_DIRTY);
451
462
  }
452
463
  //#endregion
453
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/utils.js
464
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/utils.js
454
465
  /** @import { Derived, Effect, Value } from '#client' */
455
466
  /**
456
467
  * @param {Value[] | null} deps
@@ -478,53 +489,60 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
478
489
  set_signal_status(effect, CLEAN);
479
490
  }
480
491
  //#endregion
481
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/store.js
492
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/store.js
482
493
  /**
483
494
  * We set this to `true` when updating a store so that we correctly
484
495
  * schedule effects if the update takes place inside a `$:` effect
485
496
  */
486
497
  var legacy_is_updating_store = false;
487
498
  //#endregion
488
- //#region \0@oxc-project+runtime@0.120.0/helpers/checkPrivateRedeclaration.js
499
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/checkPrivateRedeclaration.js
489
500
  function _checkPrivateRedeclaration(e, t) {
490
501
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
491
502
  }
492
503
  //#endregion
493
- //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateMethodInitSpec.js
504
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateMethodInitSpec.js
494
505
  function _classPrivateMethodInitSpec(e, a) {
495
506
  _checkPrivateRedeclaration(e, a), a.add(e);
496
507
  }
497
508
  //#endregion
498
- //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldInitSpec.js
509
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldInitSpec.js
499
510
  function _classPrivateFieldInitSpec(e, t, a) {
500
511
  _checkPrivateRedeclaration(e, t), t.set(e, a);
501
512
  }
502
513
  //#endregion
503
- //#region \0@oxc-project+runtime@0.120.0/helpers/assertClassBrand.js
514
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/assertClassBrand.js
504
515
  function _assertClassBrand(e, t, n) {
505
516
  if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
506
517
  throw new TypeError("Private element is not present on this object");
507
518
  }
508
519
  //#endregion
509
- //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldGet2.js
510
- function _classPrivateFieldGet2(s, a) {
511
- return s.get(_assertClassBrand(s, a));
512
- }
513
- //#endregion
514
- //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldSet2.js
520
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldSet2.js
515
521
  function _classPrivateFieldSet2(s, a, r) {
516
522
  return s.set(_assertClassBrand(s, a), r), r;
517
523
  }
518
524
  //#endregion
519
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/batch.js
525
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldGet2.js
526
+ function _classPrivateFieldGet2(s, a) {
527
+ return s.get(_assertClassBrand(s, a));
528
+ }
529
+ //#endregion
530
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/batch.js
520
531
  /** @import { Fork } from 'svelte' */
521
532
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
522
533
  var _Batch;
523
- /** @type {Set<Batch>} */
524
- var batches = /* @__PURE__ */ new Set();
534
+ /** @type {Batch | null} */
535
+ var first_batch = null;
536
+ /** @type {Batch | null} */
537
+ var last_batch = null;
525
538
  /** @type {Batch | null} */
526
539
  var current_batch = null;
527
540
  /**
541
+ * This is needed to avoid overwriting inputs
542
+ * @type {Batch | null}
543
+ */
544
+ var previous_batch = null;
545
+ /**
528
546
  * When time travelling (i.e. working in one batch, while other batches
529
547
  * still have ongoing work), we ignore the real values of affected
530
548
  * signals in favour of their values within the batch
@@ -552,6 +570,9 @@ var collected_effects = null;
552
570
  var legacy_updates = null;
553
571
  var flush_count = 0;
554
572
  var uid = 1;
573
+ var _started = /* @__PURE__ */ new WeakMap();
574
+ var _prev = /* @__PURE__ */ new WeakMap();
575
+ var _next = /* @__PURE__ */ new WeakMap();
555
576
  var _commit_callbacks = /* @__PURE__ */ new WeakMap();
556
577
  var _discard_callbacks = /* @__PURE__ */ new WeakMap();
557
578
  var _pending = /* @__PURE__ */ new WeakMap();
@@ -562,13 +583,23 @@ var _new_effects = /* @__PURE__ */ new WeakMap();
562
583
  var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
563
584
  var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
564
585
  var _skipped_branches = /* @__PURE__ */ new WeakMap();
586
+ var _unskipped_branches = /* @__PURE__ */ new WeakMap();
565
587
  var _decrement_queued = /* @__PURE__ */ new WeakMap();
566
- var _blockers = /* @__PURE__ */ new WeakMap();
567
588
  var _Batch_brand = /* @__PURE__ */ new WeakSet();
568
589
  var Batch = class Batch {
569
590
  constructor() {
570
591
  _classPrivateMethodInitSpec(this, _Batch_brand);
571
592
  _defineProperty(this, "id", uid++);
593
+ _classPrivateFieldInitSpec(this, _started, false);
594
+ _defineProperty(this, "linked", true);
595
+ _classPrivateFieldInitSpec(this, _prev, null);
596
+ _classPrivateFieldInitSpec(this, _next, null);
597
+ _defineProperty(
598
+ this,
599
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
600
+ "async_deriveds",
601
+ /* @__PURE__ */ new Map()
602
+ );
572
603
  _defineProperty(
573
604
  this,
574
605
  /**
@@ -592,7 +623,7 @@ var Batch = class Batch {
592
623
  );
593
624
  _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
594
625
  _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
595
- _classPrivateFieldInitSpec(this, _pending, /* @__PURE__ */ new Map());
626
+ _classPrivateFieldInitSpec(this, _pending, 0);
596
627
  _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
597
628
  _classPrivateFieldInitSpec(this, _deferred, null);
598
629
  _classPrivateFieldInitSpec(this, _roots, []);
@@ -600,9 +631,15 @@ var Batch = class Batch {
600
631
  _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
601
632
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
602
633
  _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
634
+ _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
603
635
  _defineProperty(this, "is_fork", false);
604
636
  _classPrivateFieldInitSpec(this, _decrement_queued, false);
605
- _classPrivateFieldInitSpec(this, _blockers, /* @__PURE__ */ new Set());
637
+ if (last_batch === null) first_batch = last_batch = this;
638
+ else {
639
+ _classPrivateFieldSet2(_next, last_batch, this);
640
+ _classPrivateFieldSet2(_prev, this, last_batch);
641
+ }
642
+ last_batch = this;
606
643
  }
607
644
  /**
608
645
  * Add an effect to the #skipped_branches map and reset its children
@@ -613,39 +650,43 @@ var Batch = class Batch {
613
650
  d: [],
614
651
  m: []
615
652
  });
653
+ _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
616
654
  }
617
655
  /**
618
656
  * Remove an effect from the #skipped_branches map and reschedule
619
657
  * any tracked dirty/maybe_dirty child effects
620
658
  * @param {Effect} effect
659
+ * @param {(e: Effect) => void} callback
621
660
  */
622
- unskip_effect(effect) {
661
+ unskip_effect(effect, callback = (e) => this.schedule(e)) {
623
662
  var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
624
663
  if (tracked) {
625
664
  _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
626
665
  for (var e of tracked.d) {
627
666
  set_signal_status(e, DIRTY);
628
- this.schedule(e);
667
+ callback(e);
629
668
  }
630
669
  for (e of tracked.m) {
631
670
  set_signal_status(e, MAYBE_DIRTY);
632
- this.schedule(e);
671
+ callback(e);
633
672
  }
634
673
  }
674
+ _classPrivateFieldGet2(_unskipped_branches, this).add(effect);
635
675
  }
636
676
  /**
637
677
  * Associate a change to a given source with the current
638
678
  * batch, noting its previous and current values
639
679
  * @param {Value} source
640
- * @param {any} old_value
680
+ * @param {any} value
641
681
  * @param {boolean} [is_derived]
642
682
  */
643
- capture(source, old_value, is_derived = false) {
644
- if (old_value !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, old_value);
683
+ capture(source, value, is_derived = false) {
684
+ if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
645
685
  if ((source.f & 8388608) === 0) {
646
- this.current.set(source, [source.v, is_derived]);
647
- batch_values?.set(source, source.v);
686
+ this.current.set(source, [value, is_derived]);
687
+ batch_values?.set(source, value);
648
688
  }
689
+ if (!this.is_fork) source.v = value;
649
690
  }
650
691
  activate() {
651
692
  current_batch = this;
@@ -673,7 +714,8 @@ var Batch = class Batch {
673
714
  discard() {
674
715
  for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
675
716
  _classPrivateFieldGet2(_discard_callbacks, this).clear();
676
- batches.delete(this);
717
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
718
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
677
719
  }
678
720
  /**
679
721
  * @param {Effect} effect
@@ -686,8 +728,7 @@ var Batch = class Batch {
686
728
  * @param {Effect} effect
687
729
  */
688
730
  increment(blocking, effect) {
689
- let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
690
- _classPrivateFieldGet2(_pending, this).set(effect, pending_count + 1);
731
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
691
732
  if (blocking) {
692
733
  let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
693
734
  _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
@@ -696,22 +737,19 @@ var Batch = class Batch {
696
737
  /**
697
738
  * @param {boolean} blocking
698
739
  * @param {Effect} effect
699
- * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
700
740
  */
701
- decrement(blocking, effect, skip) {
702
- let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
703
- if (pending_count === 1) _classPrivateFieldGet2(_pending, this).delete(effect);
704
- else _classPrivateFieldGet2(_pending, this).set(effect, pending_count - 1);
741
+ decrement(blocking, effect) {
742
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
705
743
  if (blocking) {
706
744
  let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
707
745
  if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
708
746
  else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
709
747
  }
710
- if (_classPrivateFieldGet2(_decrement_queued, this) || skip) return;
748
+ if (_classPrivateFieldGet2(_decrement_queued, this)) return;
711
749
  _classPrivateFieldSet2(_decrement_queued, this, true);
712
750
  queue_micro_task(() => {
713
751
  _classPrivateFieldSet2(_decrement_queued, this, false);
714
- this.flush();
752
+ if (this.linked) this.flush();
715
753
  });
716
754
  }
717
755
  /**
@@ -738,34 +776,32 @@ var Batch = class Batch {
738
776
  static ensure() {
739
777
  if (current_batch === null) {
740
778
  const batch = current_batch = new Batch();
741
- if (!is_processing) {
742
- batches.add(current_batch);
743
- if (!is_flushing_sync) queue_micro_task(() => {
744
- if (current_batch !== batch) return;
745
- batch.flush();
746
- });
747
- }
779
+ if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
780
+ if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
781
+ });
748
782
  }
749
783
  return current_batch;
750
784
  }
751
785
  apply() {
752
- if (!async_mode_flag || !this.is_fork && batches.size === 1) {
786
+ if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
753
787
  batch_values = null;
754
788
  return;
755
789
  }
756
790
  batch_values = /* @__PURE__ */ new Map();
757
791
  for (const [source, [value]] of this.current) batch_values.set(source, value);
758
- for (const batch of batches) {
792
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
759
793
  if (batch === this || batch.is_fork) continue;
760
794
  var intersects = false;
761
- var differs = false;
762
795
  if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
763
796
  if (is_derived) continue;
764
- intersects || (intersects = this.current.has(source));
765
- differs || (differs = !this.current.has(source));
797
+ if (this.current.has(source)) {
798
+ intersects = true;
799
+ break;
800
+ }
801
+ }
802
+ if (!intersects) {
803
+ for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
766
804
  }
767
- if (intersects && differs) _classPrivateFieldGet2(_blockers, this).add(batch);
768
- else for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
769
805
  }
770
806
  }
771
807
  /**
@@ -796,12 +832,10 @@ var Batch = class Batch {
796
832
  };
797
833
  _Batch = Batch;
798
834
  function _is_deferred() {
799
- return this.is_fork || _classPrivateFieldGet2(_blocking_pending, this).size > 0;
800
- }
801
- function _is_blocked() {
802
- for (const batch of _classPrivateFieldGet2(_blockers, this)) for (const effect of _classPrivateFieldGet2(_blocking_pending, batch).keys()) {
803
- var skipped = false;
835
+ if (this.is_fork) return true;
836
+ for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
804
837
  var e = effect;
838
+ var skipped = false;
805
839
  while (e.parent !== null) {
806
840
  if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
807
841
  skipped = true;
@@ -814,20 +848,19 @@ function _is_blocked() {
814
848
  return false;
815
849
  }
816
850
  function _process() {
851
+ _classPrivateFieldSet2(_started, this, true);
817
852
  if (flush_count++ > 1e3) {
818
- batches.delete(this);
853
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
819
854
  infinite_loop_guard();
820
855
  }
821
- if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
822
- for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
823
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
824
- set_signal_status(e, DIRTY);
825
- this.schedule(e);
826
- }
827
- for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
828
- set_signal_status(e, MAYBE_DIRTY);
829
- this.schedule(e);
830
- }
856
+ for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
857
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
858
+ set_signal_status(e, DIRTY);
859
+ this.schedule(e);
860
+ }
861
+ for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
862
+ set_signal_status(e, MAYBE_DIRTY);
863
+ this.schedule(e);
831
864
  }
832
865
  const roots = _classPrivateFieldGet2(_roots, this);
833
866
  _classPrivateFieldSet2(_roots, this, []);
@@ -845,6 +878,7 @@ function _process() {
845
878
  _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
846
879
  } catch (e) {
847
880
  reset_all(root);
881
+ if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
848
882
  throw e;
849
883
  }
850
884
  current_batch = null;
@@ -854,30 +888,43 @@ function _process() {
854
888
  }
855
889
  collected_effects = null;
856
890
  legacy_updates = null;
857
- if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this) || _assertClassBrand(_Batch_brand, this, _is_blocked).call(this)) {
891
+ if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
858
892
  _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
859
893
  _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
860
894
  for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
861
- } else {
862
- if (_classPrivateFieldGet2(_pending, this).size === 0) batches.delete(this);
863
- _classPrivateFieldGet2(_dirty_effects$1, this).clear();
864
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
865
- for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
866
- _classPrivateFieldGet2(_commit_callbacks, this).clear();
867
- flush_queued_effects(render_effects);
868
- flush_queued_effects(effects);
869
- _classPrivateFieldGet2(_deferred, this)?.resolve();
895
+ if (updates.length > 0)
896
+ /** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
897
+ return;
870
898
  }
871
- var next_batch = current_batch;
872
- if (_classPrivateFieldGet2(_roots, this).length > 0) {
873
- const batch = next_batch ?? (next_batch = this);
874
- _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
899
+ const earlier_batch = _assertClassBrand(_Batch_brand, this, _find_earlier_batch).call(this);
900
+ if (earlier_batch) {
901
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
902
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
903
+ _assertClassBrand(_Batch_brand, earlier_batch, _merge).call(earlier_batch, this);
904
+ return;
875
905
  }
876
- if (next_batch !== null) {
877
- batches.add(next_batch);
878
- _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
906
+ _classPrivateFieldGet2(_dirty_effects$1, this).clear();
907
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
908
+ for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
909
+ _classPrivateFieldGet2(_commit_callbacks, this).clear();
910
+ previous_batch = this;
911
+ flush_queued_effects(render_effects);
912
+ flush_queued_effects(effects);
913
+ previous_batch = null;
914
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
915
+ var next_batch = current_batch;
916
+ if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
917
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
918
+ if (async_mode_flag) {
919
+ _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
920
+ current_batch = next_batch;
921
+ }
879
922
  }
880
- if (!batches.has(this)) _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
923
+ if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
924
+ const batch = next_batch;
925
+ _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
926
+ } else next_batch = this;
927
+ if (next_batch !== null) _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
881
928
  }
882
929
  /**
883
930
  * Traverse the effect tree, executing effects or stashing
@@ -916,6 +963,59 @@ function _traverse(root, effects, render_effects) {
916
963
  }
917
964
  }
918
965
  }
966
+ function _find_earlier_batch() {
967
+ var batch = _classPrivateFieldGet2(_prev, this);
968
+ while (batch !== null) {
969
+ if (!batch.is_fork) {
970
+ for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
971
+ }
972
+ batch = _classPrivateFieldGet2(_prev, batch);
973
+ }
974
+ return null;
975
+ }
976
+ /**
977
+ * @param {Batch} batch
978
+ */
979
+ function _merge(batch) {
980
+ for (const [source, value] of batch.current) {
981
+ if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
982
+ this.current.set(source, value);
983
+ }
984
+ for (const [effect, deferred] of batch.async_deriveds) {
985
+ const d = this.async_deriveds.get(effect);
986
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
987
+ }
988
+ this.transfer_effects(_classPrivateFieldGet2(_dirty_effects$1, batch), _classPrivateFieldGet2(_maybe_dirty_effects$1, batch));
989
+ /**
990
+ * mark all effects that depend on `batch.current`, except the
991
+ * async effects that we just resolved (TODO unless they depend
992
+ * on values in this batch that are NOT in the later batch?).
993
+ * Through this we also will populate the correct #skipped_branches,
994
+ * oncommit callbacks etc, so we don't need to merge them separately.
995
+ * @param {Value} value
996
+ */
997
+ const mark = (value) => {
998
+ var reactions = value.reactions;
999
+ if (reactions === null) return;
1000
+ for (const reaction of reactions) {
1001
+ var flags = reaction.f;
1002
+ if ((flags & 2) !== 0) mark(reaction);
1003
+ else {
1004
+ var effect = reaction;
1005
+ if (flags & 4194320 && !this.async_deriveds.has(effect)) {
1006
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(effect);
1007
+ set_signal_status(effect, DIRTY);
1008
+ this.schedule(effect);
1009
+ }
1010
+ }
1011
+ }
1012
+ };
1013
+ for (const source of this.current.keys()) mark(source);
1014
+ this.oncommit(() => batch.discard());
1015
+ _assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
1016
+ current_batch = this;
1017
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
1018
+ }
919
1019
  /**
920
1020
  * @param {Effect[]} effects
921
1021
  */
@@ -923,7 +1023,7 @@ function _defer_effects(effects) {
923
1023
  for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
924
1024
  }
925
1025
  function _commit$1() {
926
- for (const batch of batches) {
1026
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
927
1027
  var is_earlier = batch.id < this.id;
928
1028
  /** @type {Source[]} */
929
1029
  var sources = [];
@@ -935,10 +1035,19 @@ function _commit$1() {
935
1035
  }
936
1036
  sources.push(source);
937
1037
  }
938
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
1038
+ if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
1039
+ const d = batch.async_deriveds.get(effect);
1040
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1041
+ }
1042
+ if (!_classPrivateFieldGet2(_started, batch)) continue;
1043
+ var others = [...batch.current.keys()].filter((s) => !batch.current.get(s)[1] && !this.current.has(s));
939
1044
  if (others.length === 0) {
940
1045
  if (is_earlier) batch.discard();
941
1046
  } else if (sources.length > 0) {
1047
+ if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
1048
+ if ((e.f & 4194320) !== 0) batch.schedule(e);
1049
+ else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
1050
+ });
942
1051
  batch.activate();
943
1052
  /** @type {Set<Value>} */
944
1053
  var marked = /* @__PURE__ */ new Set();
@@ -946,12 +1055,18 @@ function _commit$1() {
946
1055
  var checked = /* @__PURE__ */ new Map();
947
1056
  for (var source of sources) mark_effects(source, others, marked, checked);
948
1057
  checked = /* @__PURE__ */ new Map();
949
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
950
- for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
951
- set_signal_status(effect, DIRTY);
952
- batch.schedule(effect);
953
- } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
954
- if (_classPrivateFieldGet2(_roots, batch).length > 0) {
1058
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
1059
+ const v2 = this.current.get(c);
1060
+ if (!v2) return true;
1061
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
1062
+ }).map(([c]) => c);
1063
+ if (current_unequal.length > 0) {
1064
+ for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1065
+ set_signal_status(effect, DIRTY);
1066
+ batch.schedule(effect);
1067
+ } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
1068
+ }
1069
+ if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
955
1070
  batch.apply();
956
1071
  for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
957
1072
  _classPrivateFieldSet2(_roots, batch, []);
@@ -959,13 +1074,16 @@ function _commit$1() {
959
1074
  batch.deactivate();
960
1075
  }
961
1076
  }
962
- for (const batch of batches) if (_classPrivateFieldGet2(_blockers, batch).has(this)) {
963
- _classPrivateFieldGet2(_blockers, batch).delete(this);
964
- if (_classPrivateFieldGet2(_blockers, batch).size === 0 && !_assertClassBrand(_Batch_brand, batch, _is_deferred).call(batch)) {
965
- batch.activate();
966
- _assertClassBrand(_Batch_brand, batch, _process).call(batch);
967
- }
968
- }
1077
+ }
1078
+ function _unlink() {
1079
+ if (!this.linked) return;
1080
+ var prev = _classPrivateFieldGet2(_prev, this);
1081
+ var next = _classPrivateFieldGet2(_next, this);
1082
+ if (prev === null) first_batch = next;
1083
+ else _classPrivateFieldSet2(_next, prev, next);
1084
+ if (next === null) last_batch = prev;
1085
+ else _classPrivateFieldSet2(_prev, next, prev);
1086
+ this.linked = false;
969
1087
  }
970
1088
  /**
971
1089
  * Synchronously flush any pending updates.
@@ -1118,7 +1236,7 @@ function reset_all(effect) {
1118
1236
  }
1119
1237
  }
1120
1238
  //#endregion
1121
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/reactivity/create-subscriber.js
1239
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/reactivity/create-subscriber.js
1122
1240
  /**
1123
1241
  * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1124
1242
  * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
@@ -1191,13 +1309,13 @@ function createSubscriber(start) {
1191
1309
  };
1192
1310
  }
1193
1311
  //#endregion
1194
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1312
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1195
1313
  /** @import { Effect, Source, TemplateNode, } from '#client' */
1196
1314
  /**
1197
1315
  * @typedef {{
1198
- * onerror?: (error: unknown, reset: () => void) => void;
1199
- * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
1200
- * pending?: (anchor: Node) => void;
1316
+ * onerror?: ((error: unknown, reset: () => void) => void) | null;
1317
+ * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
1318
+ * pending?: ((anchor: Node) => void) | null;
1201
1319
  * }} BoundaryProps
1202
1320
  */
1203
1321
  var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
@@ -1339,82 +1457,15 @@ var Boundary = class {
1339
1457
  }
1340
1458
  /** @param {unknown} error */
1341
1459
  error(error) {
1342
- var onerror = _classPrivateFieldGet2(_props, this).onerror;
1343
- let failed = _classPrivateFieldGet2(_props, this).failed;
1344
- if (!onerror && !failed) throw error;
1345
- if (_classPrivateFieldGet2(_main_effect, this)) {
1346
- destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1347
- _classPrivateFieldSet2(_main_effect, this, null);
1348
- }
1349
- if (_classPrivateFieldGet2(_pending_effect, this)) {
1350
- destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1351
- _classPrivateFieldSet2(_pending_effect, this, null);
1352
- }
1353
- if (_classPrivateFieldGet2(_failed_effect, this)) {
1354
- destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1355
- _classPrivateFieldSet2(_failed_effect, this, null);
1356
- }
1357
- if (hydrating) {
1358
- set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1359
- next();
1360
- set_hydrate_node(skip_nodes());
1361
- }
1362
- var did_reset = false;
1363
- var calling_on_error = false;
1364
- const reset = () => {
1365
- if (did_reset) {
1366
- svelte_boundary_reset_noop();
1367
- return;
1368
- }
1369
- did_reset = true;
1370
- if (calling_on_error) svelte_boundary_reset_onerror();
1371
- if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1372
- _classPrivateFieldSet2(_failed_effect, this, null);
1460
+ if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
1461
+ if (current_batch?.is_fork) {
1462
+ if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
1463
+ if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
1464
+ if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
1465
+ current_batch.oncommit(() => {
1466
+ _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1373
1467
  });
1374
- _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1375
- _assertClassBrand(_Boundary_brand, this, _render).call(this);
1376
- });
1377
- };
1378
- /** @param {unknown} transformed_error */
1379
- const handle_error_result = (transformed_error) => {
1380
- try {
1381
- calling_on_error = true;
1382
- onerror?.(transformed_error, reset);
1383
- calling_on_error = false;
1384
- } catch (error) {
1385
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1386
- }
1387
- if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1388
- try {
1389
- return branch(() => {
1390
- var effect = active_effect;
1391
- effect.b = this;
1392
- effect.f |= 128;
1393
- failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1394
- });
1395
- } catch (error) {
1396
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1397
- return null;
1398
- }
1399
- }));
1400
- };
1401
- queue_micro_task(() => {
1402
- /** @type {unknown} */
1403
- var result;
1404
- try {
1405
- result = this.transform_error(error);
1406
- } catch (e) {
1407
- invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1408
- return;
1409
- }
1410
- if (result !== null && typeof result === "object" && typeof result.then === "function")
1411
- /** @type {any} */ result.then(
1412
- handle_error_result,
1413
- /** @param {unknown} e */
1414
- (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1415
- );
1416
- else handle_error_result(result);
1417
- });
1468
+ } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1418
1469
  }
1419
1470
  };
1420
1471
  function _hydrate_resolved_content() {
@@ -1530,9 +1581,89 @@ function _update_pending_count(d, batch) {
1530
1581
  }
1531
1582
  }
1532
1583
  }
1584
+ /**
1585
+ * @param {unknown} error
1586
+ */
1587
+ function _handle_error(error) {
1588
+ if (_classPrivateFieldGet2(_main_effect, this)) {
1589
+ destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1590
+ _classPrivateFieldSet2(_main_effect, this, null);
1591
+ }
1592
+ if (_classPrivateFieldGet2(_pending_effect, this)) {
1593
+ destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1594
+ _classPrivateFieldSet2(_pending_effect, this, null);
1595
+ }
1596
+ if (_classPrivateFieldGet2(_failed_effect, this)) {
1597
+ destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1598
+ _classPrivateFieldSet2(_failed_effect, this, null);
1599
+ }
1600
+ if (hydrating) {
1601
+ set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1602
+ next();
1603
+ set_hydrate_node(skip_nodes());
1604
+ }
1605
+ var onerror = _classPrivateFieldGet2(_props, this).onerror;
1606
+ let failed = _classPrivateFieldGet2(_props, this).failed;
1607
+ var did_reset = false;
1608
+ var calling_on_error = false;
1609
+ const reset = () => {
1610
+ if (did_reset) {
1611
+ svelte_boundary_reset_noop();
1612
+ return;
1613
+ }
1614
+ did_reset = true;
1615
+ if (calling_on_error) svelte_boundary_reset_onerror();
1616
+ if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1617
+ _classPrivateFieldSet2(_failed_effect, this, null);
1618
+ });
1619
+ _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1620
+ _assertClassBrand(_Boundary_brand, this, _render).call(this);
1621
+ });
1622
+ };
1623
+ /** @param {unknown} transformed_error */
1624
+ const handle_error_result = (transformed_error) => {
1625
+ try {
1626
+ calling_on_error = true;
1627
+ onerror?.(transformed_error, reset);
1628
+ calling_on_error = false;
1629
+ } catch (error) {
1630
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1631
+ }
1632
+ if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1633
+ try {
1634
+ return branch(() => {
1635
+ var effect = active_effect;
1636
+ effect.b = this;
1637
+ effect.f |= 128;
1638
+ failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1639
+ });
1640
+ } catch (error) {
1641
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1642
+ return null;
1643
+ }
1644
+ }));
1645
+ };
1646
+ queue_micro_task(() => {
1647
+ /** @type {unknown} */
1648
+ var result;
1649
+ try {
1650
+ result = this.transform_error(error);
1651
+ } catch (e) {
1652
+ invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1653
+ return;
1654
+ }
1655
+ if (result !== null && typeof result === "object" && typeof result.then === "function")
1656
+ /** @type {any} */ result.then(
1657
+ handle_error_result,
1658
+ /** @param {unknown} e */
1659
+ (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1660
+ );
1661
+ else handle_error_result(result);
1662
+ });
1663
+ }
1533
1664
  //#endregion
1534
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/async.js
1535
- /** @import { Blocker, Effect, Value } from '#client' */
1665
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/async.js
1666
+ /** @import { Blocker, Effect, Source, Value } from '#client' */
1536
1667
  /**
1537
1668
  * @param {Blocker[]} blockers
1538
1669
  * @param {Array<() => any>} sync
@@ -1542,30 +1673,34 @@ function _update_pending_count(d, batch) {
1542
1673
  function flatten(blockers, sync, async, fn) {
1543
1674
  const d = is_runes() ? derived : derived_safe_equal;
1544
1675
  var pending = blockers.filter((b) => !b.settled);
1676
+ var deriveds = sync.map(d);
1545
1677
  if (async.length === 0 && pending.length === 0) {
1546
- fn(sync.map(d));
1678
+ fn(deriveds);
1547
1679
  return;
1548
1680
  }
1549
1681
  var parent = active_effect;
1550
1682
  var restore = capture();
1551
1683
  var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1552
- /** @param {Value[]} values */
1553
- function finish(values) {
1684
+ /**
1685
+ * @param {Source[]} async
1686
+ */
1687
+ function finish(async) {
1688
+ if ((parent.f & 16384) !== 0) return;
1554
1689
  restore();
1555
1690
  try {
1556
- fn(values);
1691
+ fn([...deriveds, ...async]);
1557
1692
  } catch (error) {
1558
- if ((parent.f & 16384) === 0) invoke_error_boundary(error, parent);
1693
+ invoke_error_boundary(error, parent);
1559
1694
  }
1560
1695
  unset_context();
1561
1696
  }
1697
+ var decrement_pending = increment_pending();
1562
1698
  if (async.length === 0) {
1563
- /** @type {Promise<any>} */ blocker_promise.then(() => finish(sync.map(d)));
1699
+ /** @type {Promise<any>} */ blocker_promise.then(() => finish([])).finally(decrement_pending);
1564
1700
  return;
1565
1701
  }
1566
- var decrement_pending = increment_pending();
1567
1702
  function run() {
1568
- Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(() => decrement_pending());
1703
+ Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
1569
1704
  }
1570
1705
  if (blocker_promise) blocker_promise.then(() => {
1571
1706
  restore();
@@ -1607,12 +1742,12 @@ function increment_pending() {
1607
1742
  var effect = active_effect;
1608
1743
  var boundary = effect.b;
1609
1744
  var batch = current_batch;
1610
- var blocking = boundary.is_rendered();
1611
- boundary.update_pending_count(1, batch);
1745
+ var blocking = !!boundary?.is_rendered();
1746
+ boundary?.update_pending_count(1, batch);
1612
1747
  batch.increment(blocking, effect);
1613
- return (skip = false) => {
1614
- boundary.update_pending_count(-1, batch);
1615
- batch.decrement(blocking, effect, skip);
1748
+ return () => {
1749
+ boundary?.update_pending_count(-1, batch);
1750
+ batch.decrement(blocking, effect);
1616
1751
  };
1617
1752
  }
1618
1753
  /**
@@ -1620,10 +1755,9 @@ function increment_pending() {
1620
1755
  * @param {() => V} fn
1621
1756
  * @returns {Derived<V>}
1622
1757
  */
1623
- /* @__NO_SIDE_EFFECTS__ */
1758
+ /*#__NO_SIDE_EFFECTS__*/
1624
1759
  function derived(fn) {
1625
1760
  var flags = 2 | DIRTY;
1626
- var parent_derived = active_reaction !== null && (active_reaction.f & 2) !== 0 ? active_reaction : null;
1627
1761
  if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1628
1762
  return {
1629
1763
  ctx: component_context,
@@ -1636,10 +1770,11 @@ function derived(fn) {
1636
1770
  rv: 0,
1637
1771
  v: UNINITIALIZED,
1638
1772
  wv: 0,
1639
- parent: parent_derived ?? active_effect,
1773
+ parent: active_effect,
1640
1774
  ac: null
1641
1775
  };
1642
1776
  }
1777
+ var OBSOLETE = Symbol("obsolete");
1643
1778
  /**
1644
1779
  * @template V
1645
1780
  * @param {() => V | Promise<V>} fn
@@ -1647,22 +1782,24 @@ function derived(fn) {
1647
1782
  * @param {string} [location] If provided, print a warning if the value is not read immediately after update
1648
1783
  * @returns {Promise<Source<V>>}
1649
1784
  */
1650
- /* @__NO_SIDE_EFFECTS__ */
1785
+ /*#__NO_SIDE_EFFECTS__*/
1651
1786
  function async_derived(fn, label, location) {
1652
1787
  let parent = active_effect;
1653
1788
  if (parent === null) async_derived_orphan();
1654
1789
  var promise = void 0;
1655
1790
  var signal = source(UNINITIALIZED);
1656
1791
  var should_suspend = !active_reaction;
1657
- /** @type {Map<Batch, ReturnType<typeof deferred<V>>>} */
1658
- var deferreds = /* @__PURE__ */ new Map();
1792
+ /** @type {Set<ReturnType<typeof deferred<V>>>} */
1793
+ var deferreds = /* @__PURE__ */ new Set();
1659
1794
  async_effect(() => {
1660
1795
  var effect = active_effect;
1661
1796
  /** @type {ReturnType<typeof deferred<V>>} */
1662
1797
  var d = deferred();
1663
1798
  promise = d.promise;
1664
1799
  try {
1665
- Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
1800
+ Promise.resolve(fn()).then(d.resolve, (e) => {
1801
+ if (e !== STALE_REACTION) d.reject(e);
1802
+ }).finally(unset_context);
1666
1803
  } catch (error) {
1667
1804
  d.reject(error);
1668
1805
  unset_context();
@@ -1670,22 +1807,19 @@ function async_derived(fn, label, location) {
1670
1807
  var batch = current_batch;
1671
1808
  if (should_suspend) {
1672
1809
  if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
1673
- if (parent.b.is_rendered()) {
1674
- deferreds.get(batch)?.reject(STALE_REACTION);
1675
- deferreds.delete(batch);
1676
- } else {
1677
- for (const d of deferreds.values()) d.reject(STALE_REACTION);
1678
- deferreds.clear();
1679
- }
1680
- deferreds.set(batch, d);
1810
+ if (parent.b?.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE);
1811
+ else for (const d of deferreds.values()) d.reject(OBSOLETE);
1812
+ deferreds.add(d);
1813
+ batch.async_deriveds.set(effect, d);
1681
1814
  }
1682
1815
  /**
1683
1816
  * @param {any} value
1684
1817
  * @param {unknown} error
1685
1818
  */
1686
1819
  const handler = (value, error = void 0) => {
1687
- if (decrement_pending) decrement_pending(error === STALE_REACTION);
1688
- if (error === STALE_REACTION || (effect.f & 16384) !== 0) return;
1820
+ decrement_pending?.();
1821
+ deferreds.delete(d);
1822
+ if (error === OBSOLETE) return;
1689
1823
  batch.activate();
1690
1824
  if (error) {
1691
1825
  signal.f |= ERROR_VALUE;
@@ -1693,18 +1827,13 @@ function async_derived(fn, label, location) {
1693
1827
  } else {
1694
1828
  if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
1695
1829
  internal_set(signal, value);
1696
- for (const [b, d] of deferreds) {
1697
- deferreds.delete(b);
1698
- if (b === batch) break;
1699
- d.reject(STALE_REACTION);
1700
- }
1701
1830
  }
1702
1831
  batch.deactivate();
1703
1832
  };
1704
1833
  d.promise.then(handler, (e) => handler(null, e || "unknown"));
1705
1834
  });
1706
1835
  teardown(() => {
1707
- for (const d of deferreds.values()) d.reject(STALE_REACTION);
1836
+ for (const d of deferreds) d.reject(OBSOLETE);
1708
1837
  });
1709
1838
  return new Promise((fulfil) => {
1710
1839
  /** @param {Promise<V>} p */
@@ -1723,7 +1852,7 @@ function async_derived(fn, label, location) {
1723
1852
  * @param {() => V} fn
1724
1853
  * @returns {Derived<V>}
1725
1854
  */
1726
- /* @__NO_SIDE_EFFECTS__ */
1855
+ /*#__NO_SIDE_EFFECTS__*/
1727
1856
  function user_derived(fn) {
1728
1857
  const d = /* @__PURE__ */ derived(fn);
1729
1858
  if (!async_mode_flag) push_reaction_value(d);
@@ -1734,7 +1863,7 @@ function user_derived(fn) {
1734
1863
  * @param {() => V} fn
1735
1864
  * @returns {Derived<V>}
1736
1865
  */
1737
- /* @__NO_SIDE_EFFECTS__ */
1866
+ /*#__NO_SIDE_EFFECTS__*/
1738
1867
  function derived_safe_equal(fn) {
1739
1868
  const signal = /* @__PURE__ */ derived(fn);
1740
1869
  signal.equals = safe_equals;
@@ -1752,18 +1881,6 @@ function destroy_derived_effects(derived) {
1752
1881
  }
1753
1882
  }
1754
1883
  /**
1755
- * @param {Derived} derived
1756
- * @returns {Effect | null}
1757
- */
1758
- function get_derived_parent_effect(derived) {
1759
- var parent = derived.parent;
1760
- while (parent !== null) {
1761
- if ((parent.f & 2) === 0) return (parent.f & 16384) === 0 ? parent : null;
1762
- parent = parent.parent;
1763
- }
1764
- return null;
1765
- }
1766
- /**
1767
1884
  * @template T
1768
1885
  * @param {Derived} derived
1769
1886
  * @returns {T}
@@ -1771,7 +1888,12 @@ function get_derived_parent_effect(derived) {
1771
1888
  function execute_derived(derived) {
1772
1889
  var value;
1773
1890
  var prev_active_effect = active_effect;
1774
- set_active_effect(get_derived_parent_effect(derived));
1891
+ var parent = derived.parent;
1892
+ if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
1893
+ derived_inert();
1894
+ return derived.v;
1895
+ }
1896
+ set_active_effect(parent);
1775
1897
  try {
1776
1898
  derived.f &= ~WAS_MARKED;
1777
1899
  destroy_derived_effects(derived);
@@ -1786,13 +1908,14 @@ function execute_derived(derived) {
1786
1908
  * @returns {void}
1787
1909
  */
1788
1910
  function update_derived(derived) {
1789
- var old_value = derived.v;
1790
1911
  var value = execute_derived(derived);
1791
1912
  if (!derived.equals(value)) {
1792
1913
  derived.wv = increment_write_version();
1793
1914
  if (!current_batch?.is_fork || derived.deps === null) {
1794
- derived.v = value;
1795
- current_batch?.capture(derived, old_value, true);
1915
+ if (current_batch !== null) {
1916
+ current_batch.capture(derived, value, true);
1917
+ previous_batch?.capture(derived, value, true);
1918
+ } else derived.v = value;
1796
1919
  if (derived.deps === null) {
1797
1920
  set_signal_status(derived, CLEAN);
1798
1921
  return;
@@ -1812,7 +1935,7 @@ function freeze_derived_effects(derived) {
1812
1935
  for (const e of derived.effects) if (e.teardown || e.ac) {
1813
1936
  e.teardown?.();
1814
1937
  e.ac?.abort(STALE_REACTION);
1815
- e.teardown = noop;
1938
+ if (e.fn !== null) e.teardown = noop;
1816
1939
  e.ac = null;
1817
1940
  remove_reactions(e, 0);
1818
1941
  destroy_effect_children(e);
@@ -1823,12 +1946,12 @@ function freeze_derived_effects(derived) {
1823
1946
  */
1824
1947
  function unfreeze_derived_effects(derived) {
1825
1948
  if (derived.effects === null) return;
1826
- for (const e of derived.effects) if (e.teardown) update_effect(e);
1949
+ for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
1827
1950
  }
1828
1951
  //#endregion
1829
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/sources.js
1952
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/sources.js
1830
1953
  /** @import { Derived, Effect, Source, Value } from '#client' */
1831
- /** @type {Set<any>} */
1954
+ /** @type {Set<Effect>} */
1832
1955
  var eager_effects = /* @__PURE__ */ new Set();
1833
1956
  /** @type {Map<Source, any>} */
1834
1957
  var old_values = /* @__PURE__ */ new Map();
@@ -1854,7 +1977,7 @@ function source(v, stack) {
1854
1977
  * @param {V} v
1855
1978
  * @param {Error | null} [stack]
1856
1979
  */
1857
- /* @__NO_SIDE_EFFECTS__ */
1980
+ /*#__NO_SIDE_EFFECTS__*/
1858
1981
  function state(v, stack) {
1859
1982
  const s = source(v, stack);
1860
1983
  push_reaction_value(s);
@@ -1866,7 +1989,7 @@ function state(v, stack) {
1866
1989
  * @param {boolean} [immutable]
1867
1990
  * @returns {Source<V>}
1868
1991
  */
1869
- /* @__NO_SIDE_EFFECTS__ */
1992
+ /*#__NO_SIDE_EFFECTS__*/
1870
1993
  function mutable_source(initial_value, immutable = false, trackable = true) {
1871
1994
  const s = source(initial_value);
1872
1995
  if (!immutable) s.equals = safe_equals;
@@ -1884,7 +2007,7 @@ function mutable_source(initial_value, immutable = false, trackable = true) {
1884
2007
  * @returns {V}
1885
2008
  */
1886
2009
  function set(source, value, should_proxy = false) {
1887
- if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !includes.call(current_sources, source))) state_unsafe_mutation();
2010
+ if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !current_sources.has(source))) state_unsafe_mutation();
1888
2011
  return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1889
2012
  }
1890
2013
  /**
@@ -1896,12 +2019,9 @@ function set(source, value, should_proxy = false) {
1896
2019
  */
1897
2020
  function internal_set(source, value, updated_during_traversal = null) {
1898
2021
  if (!source.equals(value)) {
1899
- var old_value = source.v;
1900
- if (is_destroying_effect) old_values.set(source, value);
1901
- else old_values.set(source, old_value);
1902
- source.v = value;
2022
+ old_values.set(source, is_destroying_effect ? value : source.v);
1903
2023
  var batch = Batch.ensure();
1904
- batch.capture(source, old_value);
2024
+ batch.capture(source, value);
1905
2025
  if ((source.f & 2) !== 0) {
1906
2026
  const derived = source;
1907
2027
  if ((source.f & 2048) !== 0) execute_derived(derived);
@@ -1919,7 +2039,13 @@ function flush_eager_effects() {
1919
2039
  eager_effects_deferred = false;
1920
2040
  for (const effect of eager_effects) {
1921
2041
  if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1922
- if (is_dirty(effect)) update_effect(effect);
2042
+ let dirty;
2043
+ try {
2044
+ dirty = is_dirty(effect);
2045
+ } catch {
2046
+ dirty = true;
2047
+ }
2048
+ if (dirty) update_effect(effect);
1923
2049
  }
1924
2050
  eager_effects.clear();
1925
2051
  }
@@ -1947,11 +2073,12 @@ function mark_reactions(signal, status, updated_during_traversal) {
1947
2073
  if (!runes && reaction === active_effect) continue;
1948
2074
  var not_dirty = (flags & DIRTY) === 0;
1949
2075
  if (not_dirty) set_signal_status(reaction, status);
1950
- if ((flags & 2) !== 0) {
2076
+ if ((flags & 131072) !== 0) eager_effects.add(reaction);
2077
+ else if ((flags & 2) !== 0) {
1951
2078
  var derived = reaction;
1952
2079
  batch_values?.delete(derived);
1953
2080
  if ((flags & 65536) === 0) {
1954
- if (flags & 512) reaction.f |= WAS_MARKED;
2081
+ if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED;
1955
2082
  mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1956
2083
  }
1957
2084
  } else if (not_dirty) {
@@ -2120,8 +2247,19 @@ function proxy(value) {
2120
2247
  }
2121
2248
  });
2122
2249
  }
2250
+ new Set([
2251
+ "copyWithin",
2252
+ "fill",
2253
+ "pop",
2254
+ "push",
2255
+ "reverse",
2256
+ "shift",
2257
+ "sort",
2258
+ "splice",
2259
+ "unshift"
2260
+ ]);
2123
2261
  //#endregion
2124
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/operations.js
2262
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/operations.js
2125
2263
  /** @import { Effect, TemplateNode } from '#client' */
2126
2264
  /** @type {Window} */
2127
2265
  var $window;
@@ -2145,13 +2283,13 @@ function init_operations() {
2145
2283
  first_child_getter = get_descriptor(node_prototype, "firstChild").get;
2146
2284
  next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
2147
2285
  if (is_extensible(element_prototype)) {
2148
- element_prototype.__click = void 0;
2149
- element_prototype.__className = void 0;
2150
- element_prototype.__attributes = null;
2151
- element_prototype.__style = void 0;
2286
+ /** @type {any} */ element_prototype[CLASS_CACHE] = void 0;
2287
+ /** @type {any} */ element_prototype[ATTRIBUTES_CACHE] = null;
2288
+ /** @type {any} */ element_prototype[STYLE_CACHE] = void 0;
2152
2289
  element_prototype.__e = void 0;
2153
2290
  }
2154
- if (is_extensible(text_prototype)) text_prototype.__t = void 0;
2291
+ if (is_extensible(text_prototype))
2292
+ /** @type {any} */ text_prototype[TEXT_CACHE] = void 0;
2155
2293
  }
2156
2294
  /**
2157
2295
  * @param {string} value
@@ -2164,7 +2302,7 @@ function create_text(value = "") {
2164
2302
  * @template {Node} N
2165
2303
  * @param {N} node
2166
2304
  */
2167
- /* @__NO_SIDE_EFFECTS__ */
2305
+ /*@__NO_SIDE_EFFECTS__*/
2168
2306
  function get_first_child(node) {
2169
2307
  return first_child_getter.call(node);
2170
2308
  }
@@ -2172,7 +2310,7 @@ function get_first_child(node) {
2172
2310
  * @template {Node} N
2173
2311
  * @param {N} node
2174
2312
  */
2175
- /* @__NO_SIDE_EFFECTS__ */
2313
+ /*@__NO_SIDE_EFFECTS__*/
2176
2314
  function get_next_sibling(node) {
2177
2315
  return next_sibling_getter.call(node);
2178
2316
  }
@@ -2245,6 +2383,12 @@ function should_defer_append() {
2245
2383
  return (active_effect.f & REACTION_RAN) !== 0;
2246
2384
  }
2247
2385
  /**
2386
+ * Branching here is intentional and load-bearing for perf. `createElement(tag)`
2387
+ * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,
2388
+ * and passing an explicit `undefined` as the trailing options arg measurably
2389
+ * slows both APIs. Funnelling every case through a single `createElementNS(ns,
2390
+ * tag, options)` call would be smaller but slower on the HTML path.
2391
+ *
2248
2392
  * @template {keyof HTMLElementTagNameMap | string} T
2249
2393
  * @param {T} tag
2250
2394
  * @param {string} [namespace]
@@ -2252,8 +2396,8 @@ function should_defer_append() {
2252
2396
  * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}
2253
2397
  */
2254
2398
  function create_element(tag, namespace, is) {
2255
- let options = is ? { is } : void 0;
2256
- return document.createElementNS(namespace ?? "http://www.w3.org/1999/xhtml", tag, options);
2399
+ if (namespace == null || namespace === "http://www.w3.org/1999/xhtml") return is ? document.createElement(tag, { is }) : document.createElement(tag);
2400
+ return is ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag);
2257
2401
  }
2258
2402
  /**
2259
2403
  * Browsers split text nodes larger than 65536 bytes when parsing.
@@ -2270,7 +2414,7 @@ function merge_text_nodes(text) {
2270
2414
  }
2271
2415
  }
2272
2416
  //#endregion
2273
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2417
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2274
2418
  /**
2275
2419
  * @template T
2276
2420
  * @param {() => T} fn
@@ -2288,7 +2432,7 @@ function without_reactive_context(fn) {
2288
2432
  }
2289
2433
  }
2290
2434
  //#endregion
2291
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/effects.js
2435
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/effects.js
2292
2436
  /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2293
2437
  /**
2294
2438
  * @param {'$effect' | '$effect.pre' | '$inspect'} rune
@@ -2388,7 +2532,7 @@ function teardown(fn) {
2388
2532
  function user_effect(fn) {
2389
2533
  validate_effect("$effect");
2390
2534
  var flags = active_effect.f;
2391
- if (!active_reaction && (flags & 32) !== 0 && (flags & 32768) === 0) {
2535
+ if (!active_reaction && (flags & 32) !== 0 && component_context !== null && !component_context.i) {
2392
2536
  var context = component_context;
2393
2537
  (context.e ?? (context.e = [])).push(fn);
2394
2538
  } else return create_user_effect(fn);
@@ -2461,7 +2605,9 @@ function render_effect(fn, flags = 0) {
2461
2605
  */
2462
2606
  function template_effect(fn, sync = [], async = [], blockers = []) {
2463
2607
  flatten(blockers, sync, async, (values) => {
2464
- create_effect(8, () => fn(...values.map(get)));
2608
+ create_effect(8, () => {
2609
+ fn(...values.map(get));
2610
+ });
2465
2611
  });
2466
2612
  }
2467
2613
  /**
@@ -2537,7 +2683,7 @@ function destroy_effect(effect, remove_dom = true) {
2537
2683
  remove_effect_dom(effect.nodes.start, effect.nodes.end);
2538
2684
  removed = true;
2539
2685
  }
2540
- set_signal_status(effect, DESTROYING);
2686
+ effect.f |= DESTROYING;
2541
2687
  destroy_effect_children(effect, remove_dom && !removed);
2542
2688
  remove_reactions(effect, 0);
2543
2689
  var transitions = effect.nodes && effect.nodes.t;
@@ -2617,8 +2763,10 @@ function pause_children(effect, transitions, local) {
2617
2763
  var child = effect.first;
2618
2764
  while (child !== null) {
2619
2765
  var sibling = child.next;
2620
- var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
2621
- pause_children(child, transitions, transparent ? local : false);
2766
+ if ((child.f & 64) === 0) {
2767
+ var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
2768
+ pause_children(child, transitions, transparent ? local : false);
2769
+ }
2622
2770
  child = sibling;
2623
2771
  }
2624
2772
  }
@@ -2670,14 +2818,14 @@ function move_effect(effect, fragment) {
2670
2818
  }
2671
2819
  }
2672
2820
  //#endregion
2673
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/legacy.js
2821
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/legacy.js
2674
2822
  /**
2675
2823
  * @type {Set<Value> | null}
2676
2824
  * @deprecated
2677
2825
  */
2678
2826
  var captured_signals = null;
2679
2827
  //#endregion
2680
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/runtime.js
2828
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/runtime.js
2681
2829
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2682
2830
  var is_updating_effect = false;
2683
2831
  var is_destroying_effect = false;
@@ -2701,13 +2849,12 @@ function set_active_effect(effect) {
2701
2849
  /**
2702
2850
  * When sources are created within a reaction, reading and writing
2703
2851
  * them within that reaction should not cause a re-run
2704
- * @type {null | Source[]}
2852
+ * @type {null | Set<Source>}
2705
2853
  */
2706
2854
  var current_sources = null;
2707
2855
  /** @param {Value} value */
2708
2856
  function push_reaction_value(value) {
2709
- if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) if (current_sources === null) current_sources = [value];
2710
- else current_sources.push(value);
2857
+ if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
2711
2858
  }
2712
2859
  /**
2713
2860
  * The dependencies of the reaction that is currently being executed. In many cases,
@@ -2772,7 +2919,7 @@ function is_dirty(reaction) {
2772
2919
  function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
2773
2920
  var reactions = signal.reactions;
2774
2921
  if (reactions === null) return;
2775
- if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) return;
2922
+ if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) return;
2776
2923
  for (var i = 0; i < reactions.length; i++) {
2777
2924
  var reaction = reactions[i];
2778
2925
  if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
@@ -2879,7 +3026,7 @@ function remove_reaction(signal, dependency) {
2879
3026
  derived.f ^= 512;
2880
3027
  derived.f &= ~WAS_MARKED;
2881
3028
  }
2882
- update_derived_status(derived);
3029
+ if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2883
3030
  freeze_derived_effects(derived);
2884
3031
  remove_reactions(derived, 0);
2885
3032
  }
@@ -2927,7 +3074,7 @@ function get(signal) {
2927
3074
  var is_derived = (signal.f & 2) !== 0;
2928
3075
  captured_signals?.add(signal);
2929
3076
  if (active_reaction !== null && !untracking) {
2930
- if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
3077
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
2931
3078
  var deps = active_reaction.deps;
2932
3079
  if ((active_reaction.f & 2097152) !== 0) {
2933
3080
  if (signal.rv < read_version) {
@@ -2938,7 +3085,8 @@ function get(signal) {
2938
3085
  }
2939
3086
  } else {
2940
3087
  var _active_reaction;
2941
- ((_active_reaction = active_reaction).deps ?? (_active_reaction.deps = [])).push(signal);
3088
+ (_active_reaction = active_reaction).deps ?? (_active_reaction.deps = []);
3089
+ if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
2942
3090
  var reactions = signal.reactions;
2943
3091
  if (reactions === null) signal.reactions = [active_reaction];
2944
3092
  else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
@@ -3021,7 +3169,7 @@ function untrack(fn) {
3021
3169
  }
3022
3170
  }
3023
3171
  //#endregion
3024
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/events.js
3172
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/events.js
3025
3173
  /**
3026
3174
  * Used on elements, as a map of event type -> event handler,
3027
3175
  * and on events themselves to track which element handled an event
@@ -3095,8 +3243,7 @@ function handle_event_propagation(event) {
3095
3243
  */
3096
3244
  var other_errors = [];
3097
3245
  while (current_target !== null) {
3098
- /** @type {null | Element} */
3099
- var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
3246
+ if (current_target === handler_element) break;
3100
3247
  try {
3101
3248
  var delegated = current_target[event_symbol]?.[event_name];
3102
3249
  if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
@@ -3104,8 +3251,9 @@ function handle_event_propagation(event) {
3104
3251
  if (throw_error) other_errors.push(error);
3105
3252
  else throw_error = error;
3106
3253
  }
3107
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) break;
3108
- current_target = parent_element;
3254
+ if (event.cancelBubble) break;
3255
+ path_idx++;
3256
+ current_target = path_idx < path.length ? path[path_idx] : null;
3109
3257
  }
3110
3258
  if (throw_error) {
3111
3259
  for (let error of other_errors) queueMicrotask(() => {
@@ -3121,8 +3269,10 @@ function handle_event_propagation(event) {
3121
3269
  }
3122
3270
  }
3123
3271
  //#endregion
3124
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/reconciler.js
3125
- var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (html) => {
3272
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/reconciler.js
3273
+ var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
3274
+ /** @param {string} html */
3275
+ createHTML: (html) => {
3126
3276
  return html;
3127
3277
  } });
3128
3278
  /** @param {string} html */
@@ -3138,7 +3288,7 @@ function create_fragment_from_html(html) {
3138
3288
  return elem.content;
3139
3289
  }
3140
3290
  //#endregion
3141
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/template.js
3291
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/template.js
3142
3292
  /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
3143
3293
  /** @import { TemplateStructure } from './types' */
3144
3294
  /**
@@ -3159,7 +3309,7 @@ function assign_nodes(start, end) {
3159
3309
  * @param {number} flags
3160
3310
  * @returns {() => Node | Node[]}
3161
3311
  */
3162
- /* @__NO_SIDE_EFFECTS__ */
3312
+ /*#__NO_SIDE_EFFECTS__*/
3163
3313
  function from_html(content, flags) {
3164
3314
  var is_fragment = (flags & 1) !== 0;
3165
3315
  var use_import_node = (flags & 2) !== 0;
@@ -3194,7 +3344,7 @@ function from_html(content, flags) {
3194
3344
  * @param {'svg' | 'math'} ns
3195
3345
  * @returns {() => Node | Node[]}
3196
3346
  */
3197
- /* @__NO_SIDE_EFFECTS__ */
3347
+ /*#__NO_SIDE_EFFECTS__*/
3198
3348
  function from_namespace(content, flags, ns = "svg") {
3199
3349
  /**
3200
3350
  * Whether or not the first item is a text/element node. If not, we need to
@@ -3230,7 +3380,7 @@ function from_namespace(content, flags, ns = "svg") {
3230
3380
  * @param {string} content
3231
3381
  * @param {number} flags
3232
3382
  */
3233
- /* @__NO_SIDE_EFFECTS__ */
3383
+ /*#__NO_SIDE_EFFECTS__*/
3234
3384
  function from_svg(content, flags) {
3235
3385
  return /* @__PURE__ */ from_namespace(content, flags, "svg");
3236
3386
  }
@@ -3273,9 +3423,10 @@ function is_passive_event(name) {
3273
3423
  * @returns {void}
3274
3424
  */
3275
3425
  function set_text(text, value) {
3426
+ var _text;
3276
3427
  var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
3277
- if (str !== (text.__t ?? (text.__t = text.nodeValue))) {
3278
- text.__t = str;
3428
+ if (str !== ((_text = text)[TEXT_CACHE] ?? (_text[TEXT_CACHE] = text.nodeValue))) {
3429
+ /** @type {any} */ text[TEXT_CACHE] = str;
3279
3430
  text.nodeValue = `${str}`;
3280
3431
  }
3281
3432
  }
@@ -3455,7 +3606,7 @@ function unmount(component, options) {
3455
3606
  return Promise.resolve();
3456
3607
  }
3457
3608
  //#endregion
3458
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3609
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3459
3610
  /** @import { Effect, TemplateNode } from '#client' */
3460
3611
  var _batches = /* @__PURE__ */ new WeakMap();
3461
3612
  var _onscreen = /* @__PURE__ */ new WeakMap();
@@ -3497,6 +3648,7 @@ var BranchManager = class {
3497
3648
  } else {
3498
3649
  var offscreen = _classPrivateFieldGet2(_offscreen, this).get(key);
3499
3650
  if (offscreen) {
3651
+ resume_effect(offscreen.effect);
3500
3652
  _classPrivateFieldGet2(_onscreen, this).set(key, offscreen.effect);
3501
3653
  _classPrivateFieldGet2(_offscreen, this).delete(key);
3502
3654
  /** @type {TemplateNode} */ offscreen.fragment.lastChild.remove();
@@ -3611,7 +3763,7 @@ function init_update_callbacks(context) {
3611
3763
  });
3612
3764
  }
3613
3765
  //#endregion
3614
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/if.js
3766
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/blocks/if.js
3615
3767
  /** @import { TemplateNode } from '#client' */
3616
3768
  /**
3617
3769
  * @param {TemplateNode} node
@@ -3710,14 +3862,14 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
3710
3862
  var wrapper = create_element(svg ? "svg" : mathml ? "math" : "template", svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : void 0);
3711
3863
  wrapper.innerHTML = value;
3712
3864
  /** @type {DocumentFragment | Element} */
3713
- var node = svg || mathml ? wrapper : wrapper.content;
3865
+ var node = svg || mathml ? wrapper : /** @type {HTMLTemplateElement} */ wrapper.content;
3714
3866
  assign_nodes(/* @__PURE__ */ get_first_child(node), node.lastChild);
3715
3867
  if (svg || mathml) while (/* @__PURE__ */ get_first_child(node)) anchor.before(/* @__PURE__ */ get_first_child(node));
3716
3868
  else anchor.before(node);
3717
3869
  });
3718
3870
  }
3719
3871
  //#endregion
3720
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/css.js
3872
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/css.js
3721
3873
  /**
3722
3874
  * @param {Node} anchor
3723
3875
  * @param {{ hash: string, code: string }} css
@@ -3725,7 +3877,7 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
3725
3877
  function append_styles$1(anchor, css) {
3726
3878
  effect(() => {
3727
3879
  var root = anchor.getRootNode();
3728
- var target = root.host ? root : root.head ?? root.ownerDocument.head;
3880
+ var target = root.host ? root : /** @type {Document} */ root.head ?? root.ownerDocument.head;
3729
3881
  if (!target.querySelector("#" + css.hash)) {
3730
3882
  const style = create_element("style");
3731
3883
  style.id = css.hash;
@@ -3734,6 +3886,8 @@ function append_styles$1(anchor, css) {
3734
3886
  }
3735
3887
  });
3736
3888
  }
3889
+ //#endregion
3890
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/shared/attributes.js
3737
3891
  /**
3738
3892
  *
3739
3893
  * @param {Record<string,any>} styles
@@ -3819,7 +3973,7 @@ function to_style(value, styles) {
3819
3973
  return value == null ? null : String(value);
3820
3974
  }
3821
3975
  //#endregion
3822
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/style.js
3976
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/style.js
3823
3977
  /**
3824
3978
  * @param {Element & ElementCSSInlineStyle} dom
3825
3979
  * @param {Record<string, any>} prev
@@ -3840,12 +3994,12 @@ function update_styles(dom, prev = {}, next, priority) {
3840
3994
  * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]
3841
3995
  */
3842
3996
  function set_style(dom, value, prev_styles, next_styles) {
3843
- var prev = dom.__style;
3997
+ var prev = dom[STYLE_CACHE];
3844
3998
  if (hydrating || prev !== value) {
3845
3999
  var next_style_attr = to_style(value, next_styles);
3846
4000
  if (!hydrating || next_style_attr !== dom.getAttribute("style")) if (next_style_attr == null) dom.removeAttribute("style");
3847
4001
  else dom.style.cssText = next_style_attr;
3848
- dom.__style = value;
4002
+ /** @type {any} */ dom[STYLE_CACHE] = value;
3849
4003
  } else if (next_styles) if (Array.isArray(next_styles)) {
3850
4004
  update_styles(dom, prev_styles?.[0], next_styles[0]);
3851
4005
  update_styles(dom, prev_styles?.[1], next_styles[1], "important");
@@ -3853,7 +4007,7 @@ function set_style(dom, value, prev_styles, next_styles) {
3853
4007
  return next_styles;
3854
4008
  }
3855
4009
  //#endregion
3856
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4010
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/attributes.js
3857
4011
  /** @import { Blocker, Effect } from '#client' */
3858
4012
  var IS_CUSTOM_ELEMENT = Symbol("is custom element");
3859
4013
  var IS_HTML = Symbol("is html");
@@ -3869,7 +4023,7 @@ function set_attribute(element, attribute, value, skip_warning) {
3869
4023
  if (hydrating) {
3870
4024
  attributes[attribute] = element.getAttribute(attribute);
3871
4025
  if (attribute === "src" || attribute === "srcset" || attribute === "href" && element.nodeName === LINK_TAG) {
3872
- if (!skip_warning) check_src_in_dev_hydration(element, attribute, value ?? "");
4026
+ if (!skip_warning);
3873
4027
  return;
3874
4028
  }
3875
4029
  }
@@ -3884,7 +4038,8 @@ function set_attribute(element, attribute, value, skip_warning) {
3884
4038
  * @param {Element} element
3885
4039
  */
3886
4040
  function get_attributes(element) {
3887
- return element.__attributes ?? (element.__attributes = {
4041
+ var _element;
4042
+ return (_element = element)[ATTRIBUTES_CACHE] ?? (_element[ATTRIBUTES_CACHE] = {
3888
4043
  [IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
3889
4044
  [IS_HTML]: element.namespaceURI === "http://www.w3.org/1999/xhtml"
3890
4045
  });
@@ -3902,19 +4057,13 @@ function get_setters(element) {
3902
4057
  var element_proto = Element.prototype;
3903
4058
  while (element_proto !== proto) {
3904
4059
  descriptors = get_descriptors(proto);
3905
- for (var key in descriptors) if (descriptors[key].set) setters.push(key);
4060
+ for (var key in descriptors) if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") setters.push(key);
3906
4061
  proto = get_prototype_of(proto);
3907
4062
  }
3908
4063
  return setters;
3909
4064
  }
3910
- /**
3911
- * @param {any} element
3912
- * @param {string} attribute
3913
- * @param {string} value
3914
- */
3915
- function check_src_in_dev_hydration(element, attribute, value) {}
3916
4065
  //#endregion
3917
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
4066
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3918
4067
  var _ResizeObserverSingleton;
3919
4068
  var _listeners = /* @__PURE__ */ new WeakMap();
3920
4069
  var _observer = /* @__PURE__ */ new WeakMap();
@@ -3966,7 +4115,7 @@ function _getObserver() {
3966
4115
  }
3967
4116
  _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
3968
4117
  //#endregion
3969
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
4118
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
3970
4119
  /** @import { ComponentContext, Effect } from '#client' */
3971
4120
  /**
3972
4121
  * @param {any} bound_value
@@ -3996,7 +4145,7 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
3996
4145
  old_parts = parts;
3997
4146
  parts = get_parts?.() || [];
3998
4147
  untrack(() => {
3999
- if (element_or_component !== get_value(...parts)) {
4148
+ if (!is_bound_this(get_value(...parts), element_or_component)) {
4000
4149
  update(element_or_component, ...parts);
4001
4150
  if (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) update(null, ...old_parts);
4002
4151
  }
@@ -4018,7 +4167,7 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
4018
4167
  return element_or_component;
4019
4168
  }
4020
4169
  //#endregion
4021
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/legacy/legacy-client.js
4170
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/legacy/legacy-client.js
4022
4171
  /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
4023
4172
  /**
4024
4173
  * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
@@ -4097,6 +4246,7 @@ var Svelte4Component = class {
4097
4246
  get() {
4098
4247
  return _classPrivateFieldGet2(_instance, this)[key];
4099
4248
  },
4249
+ /** @param {any} value */
4100
4250
  set(value) {
4101
4251
  _classPrivateFieldGet2(_instance, this)[key] = value;
4102
4252
  },
@@ -4136,7 +4286,7 @@ var Svelte4Component = class {
4136
4286
  }
4137
4287
  };
4138
4288
  //#endregion
4139
- //#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4289
+ //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4140
4290
  /**
4141
4291
  * @typedef {Object} CustomElementPropDefinition
4142
4292
  * @property {string} [attribute]
@@ -4421,14 +4571,67 @@ function create_custom_element(Component, props_definition, slots, exports, shad
4421
4571
  return Class;
4422
4572
  }
4423
4573
  //#endregion
4424
- //#region src/delivery/SimpleCloze.svelte
4425
- var root_1 = /* @__PURE__ */ from_html(`<div class="mb-4 prose"></div>`);
4426
- var root_3 = /* @__PURE__ */ from_svg(`<svg style="width: 25px; height: 25px;" preserveAspectRatio="xMinYMin meet" version="1.1" viewBox="-283 359 34 35"><circle cx="-266" cy="375.9" r="14" fill="#bce2ff"></circle><path d="M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z" fill="#bce2ff"></path><polygon points="-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6" fill="#1a9cff"></polygon></svg>`);
4427
- var root_4 = /* @__PURE__ */ from_svg(`<svg style="width: 25px; height: 25px;" preserveAspectRatio="xMinYMin meet" version="1.1" viewBox="-129.5 127 34 35"><path style="fill: #D0CAC5; stroke: #E6E3E0; stroke-width: 0.75; stroke-miterlimit: 10;" d="M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5 C-97.4,153.5-104.3,160.4-112.9,160.4z"></path><path style="fill: #B3ABA4; stroke: #CDC7C2; stroke-width: 0.5; stroke-miterlimit: 10;" d="M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z"></path><circle cx="-114.2" cy="143.5" r="14" fill="white"></circle><path d="M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z" fill="#bce2ff"></path><polygon points="-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2" fill="#1a9cff"></polygon></svg>`);
4428
- var root_2 = /* @__PURE__ */ from_html(`<button type="button" class="mb-3 flex items-center gap-2 cursor-pointer select-none"><!> <span class="text-sm hover:underline"> </span></button>`);
4429
- var root_5 = /* @__PURE__ */ from_html(`<span class="correctness-icon svelte-1glps5n" style="background-color: #0EA449;"><svg style="width: 12px; height: 12px; color: white;" fill="currentColor" viewBox="0 0 24 24"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"></path></svg></span>`);
4430
- var root_6 = /* @__PURE__ */ from_html(`<span class="correctness-icon svelte-1glps5n" style="background-color: #BF0D00;"><svg style="width: 12px; height: 12px; color: white;" fill="currentColor" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"></path></svg></span>`);
4431
- var root = /* @__PURE__ */ from_html(`<div class="p-4"><!> <!> <div class="relative inline-block"><!> <!> <input type="text" placeholder="Enter your answer..." class="outline-none px-3 py-2 rounded svelte-1glps5n"/></div></div>`);
4574
+ //#region ../../lib-svelte/delivery-events/dist/index2.js
4575
+ var _e, _e2;
4576
+ var e = (_e = class e extends CustomEvent {
4577
+ constructor(t, n, r) {
4578
+ super(e.TYPE, {
4579
+ bubbles: !0,
4580
+ composed: !0,
4581
+ detail: {
4582
+ complete: n,
4583
+ component: t,
4584
+ hasModel: r
4585
+ }
4586
+ }), this.component = t, this.complete = n;
4587
+ }
4588
+ }, _e.TYPE = "model-set", _e), t$1 = (_e2 = class e extends CustomEvent {
4589
+ constructor(t, n) {
4590
+ super(e.TYPE, {
4591
+ bubbles: !0,
4592
+ composed: !0,
4593
+ detail: {
4594
+ complete: n,
4595
+ component: t
4596
+ }
4597
+ }), this.component = t, this.complete = n;
4598
+ }
4599
+ }, _e2.TYPE = "session-changed", _e2);
4600
+ //#endregion
4601
+ //#region ../../lib-svelte/delivery-events/dist/index3.js
4602
+ var t = (e) => {
4603
+ let t = e;
4604
+ return t ? typeof t.onSessionChange == "function" || typeof t.onAudioStarted == "function" || typeof t.onAudioEnded == "function" : !1;
4605
+ };
4606
+ function n(e, n = {}) {
4607
+ let r = n.hostPredicate ?? t, i = e;
4608
+ for (; i;) {
4609
+ if (r(i)) return i;
4610
+ i = i.parentElement;
4611
+ }
4612
+ if (typeof document < "u" && n.fallbackSelector) {
4613
+ let e = document.querySelector(n.fallbackSelector);
4614
+ if (r(e)) return e;
4615
+ }
4616
+ return null;
4617
+ }
4618
+ function r({ sourceEl: t, fallbackSelector: r, component: i, complete: a, session: o }) {
4619
+ let s = n(t, { fallbackSelector: r });
4620
+ return s ? typeof s.onSessionChange == "function" ? (s.onSessionChange(o), s) : (s.dispatchEvent(new t$1(i, a)), s) : null;
4621
+ }
4622
+ new Set([
4623
+ "$$slots",
4624
+ "$$events",
4625
+ "$$legacy",
4626
+ "$$host"
4627
+ ]);
4628
+ var root = /* @__PURE__ */ from_html(`<div class="mb-4 prose"></div>`);
4629
+ var root_1 = /* @__PURE__ */ from_svg(`<svg style="width: 25px; height: 25px;" preserveAspectRatio="xMinYMin meet" version="1.1" viewBox="-283 359 34 35"><circle cx="-266" cy="375.9" r="14" fill="#bce2ff"></circle><path d="M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z" fill="#bce2ff"></path><polygon points="-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6" fill="#1a9cff"></polygon></svg>`);
4630
+ var root_2 = /* @__PURE__ */ from_svg(`<svg style="width: 25px; height: 25px;" preserveAspectRatio="xMinYMin meet" version="1.1" viewBox="-129.5 127 34 35"><path style="fill: #D0CAC5; stroke: #E6E3E0; stroke-width: 0.75; stroke-miterlimit: 10;" d="M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5 C-97.4,153.5-104.3,160.4-112.9,160.4z"></path><path style="fill: #B3ABA4; stroke: #CDC7C2; stroke-width: 0.5; stroke-miterlimit: 10;" d="M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z"></path><circle cx="-114.2" cy="143.5" r="14" fill="white"></circle><path d="M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z" fill="#bce2ff"></path><polygon points="-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2" fill="#1a9cff"></polygon></svg>`);
4631
+ var root_3 = /* @__PURE__ */ from_html(`<button type="button" class="mb-3 flex items-center gap-2 cursor-pointer select-none"><!> <span class="text-sm hover:underline"> </span></button>`);
4632
+ var root_4 = /* @__PURE__ */ from_html(`<span class="correctness-icon svelte-1glps5n" style="background-color: #0EA449;"><svg style="width: 12px; height: 12px; color: white;" fill="currentColor" viewBox="0 0 24 24"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"></path></svg></span>`);
4633
+ var root_5 = /* @__PURE__ */ from_html(`<span class="correctness-icon svelte-1glps5n" style="background-color: #BF0D00;"><svg style="width: 12px; height: 12px; color: white;" fill="currentColor" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"></path></svg></span>`);
4634
+ var root_6 = /* @__PURE__ */ from_html(`<div class="p-4"><!> <!> <div class="relative inline-block"><!> <!> <input type="text" placeholder="Enter your answer..." class="outline-none px-3 py-2 rounded svelte-1glps5n"/></div></div>`);
4432
4635
  var $$css = {
4433
4636
  hash: "svelte-1glps5n",
4434
4637
  code: "\n /* Custom styles for correct answer display */input[readonly].svelte-1glps5n {font-weight:600;}.correctness-icon.svelte-1glps5n {position:absolute;top:-8px;left:-8px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;padding:2px;}"
@@ -4462,21 +4665,16 @@ function SimpleCloze($$anchor, $$props) {
4462
4665
  function handleInput(event) {
4463
4666
  const target = event.target;
4464
4667
  const newValue = target.value;
4465
- const updatedSession = {
4466
- ...$$props.session,
4467
- response: newValue
4468
- };
4469
- const hostElement = target.closest("simple-cloze");
4470
- if (hostElement?._internalSession) hostElement._internalSession = updatedSession;
4471
- const customEvent = new CustomEvent("session-changed", {
4472
- bubbles: true,
4473
- composed: true,
4474
- detail: {
4475
- complete: true,
4476
- component: "simple-cloze"
4477
- }
4668
+ r({
4669
+ sourceEl: target,
4670
+ fallbackSelector: "simple-cloze",
4671
+ component: "simple-cloze",
4672
+ session: {
4673
+ ...$$props.session,
4674
+ response: newValue
4675
+ },
4676
+ complete: newValue.trim().length > 0
4478
4677
  });
4479
- hostElement?.dispatchEvent(customEvent);
4480
4678
  }
4481
4679
  function toggleCorrectAnswer() {
4482
4680
  set(showCorrectAnswer, !get(showCorrectAnswer));
@@ -4485,10 +4683,10 @@ function SimpleCloze($$anchor, $$props) {
4485
4683
  const correctness = /* @__PURE__ */ user_derived(() => $$props?.model?.correctness);
4486
4684
  const isCorrect = /* @__PURE__ */ user_derived(() => get(correctness) === "correct");
4487
4685
  const isIncorrect = /* @__PURE__ */ user_derived(() => get(correctness) === "incorrect");
4488
- var div = root();
4686
+ var div = root_6();
4489
4687
  var node = child(div);
4490
4688
  var consequent = ($$anchor) => {
4491
- var div_1 = root_1();
4689
+ var div_1 = root();
4492
4690
  html(div_1, () => $$props.model.prompt, true);
4493
4691
  reset(div_1);
4494
4692
  append($$anchor, div_1);
@@ -4498,13 +4696,13 @@ function SimpleCloze($$anchor, $$props) {
4498
4696
  });
4499
4697
  var node_1 = sibling(node, 2);
4500
4698
  var consequent_2 = ($$anchor) => {
4501
- var button = root_2();
4699
+ var button = root_3();
4502
4700
  var node_2 = child(button);
4503
4701
  var consequent_1 = ($$anchor) => {
4504
- append($$anchor, root_3());
4702
+ append($$anchor, root_1());
4505
4703
  };
4506
4704
  var alternate = ($$anchor) => {
4507
- append($$anchor, root_4());
4705
+ append($$anchor, root_2());
4508
4706
  };
4509
4707
  if_block(node_2, ($$render) => {
4510
4708
  if (get(showCorrectAnswer)) $$render(consequent_1);
@@ -4527,14 +4725,14 @@ function SimpleCloze($$anchor, $$props) {
4527
4725
  var div_2 = sibling(node_1, 2);
4528
4726
  var node_3 = child(div_2);
4529
4727
  var consequent_3 = ($$anchor) => {
4530
- append($$anchor, root_5());
4728
+ append($$anchor, root_4());
4531
4729
  };
4532
4730
  if_block(node_3, ($$render) => {
4533
4731
  if (get(isEvaluateMode) && (get(isCorrect) || get(showCorrectAnswer))) $$render(consequent_3);
4534
4732
  });
4535
4733
  var node_4 = sibling(node_3, 2);
4536
4734
  var consequent_4 = ($$anchor) => {
4537
- append($$anchor, root_6());
4735
+ append($$anchor, root_5());
4538
4736
  };
4539
4737
  if_block(node_4, ($$render) => {
4540
4738
  if (get(isEvaluateMode) && get(isIncorrect) && !get(showCorrectAnswer)) $$render(consequent_4);
@@ -4567,13 +4765,35 @@ var SimpleClozeElement = class extends SvelteElementClass {
4567
4765
  constructor(..._args) {
4568
4766
  super(..._args);
4569
4767
  _defineProperty(this, "_internalSession", null);
4768
+ _defineProperty(this, "_model", null);
4769
+ _defineProperty(this, "_isComplete", () => {
4770
+ const response = this._internalSession?.response;
4771
+ return typeof response === "string" && response.trim().length > 0;
4772
+ });
4773
+ _defineProperty(this, "_dispatchModelSet", () => {
4774
+ this.dispatchEvent(new e(this.tagName.toLowerCase(), this._isComplete(), this._model !== void 0));
4775
+ });
4776
+ _defineProperty(this, "_dispatchSessionChanged", () => {
4777
+ this.dispatchEvent(new t$1(this.tagName.toLowerCase(), this._isComplete()));
4778
+ });
4570
4779
  _defineProperty(this, "onSessionChange", (updatedSession) => {
4571
4780
  this._internalSession = updatedSession;
4781
+ super.session = updatedSession;
4782
+ this._dispatchSessionChanged();
4572
4783
  });
4573
4784
  }
4785
+ set model(m) {
4786
+ this._model = m;
4787
+ super.model = m;
4788
+ this._dispatchModelSet();
4789
+ }
4790
+ get model() {
4791
+ return this._model;
4792
+ }
4574
4793
  set session(s) {
4575
4794
  this._internalSession = s;
4576
4795
  super.session = s;
4796
+ this._dispatchSessionChanged();
4577
4797
  }
4578
4798
  get session() {
4579
4799
  return this._internalSession;